openvideo 0.0.3 → 0.0.4

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,4 +1,4 @@
1
- import { F as Ie, u as Ee, l as se, M as v, G as De, v as Oe, S as Fe, x as ae, E as u, e as D, y as S, z as Le, H as O, I as b, R as F, J as ne, K as He, t as m, b as f, i as B, w as L, L as K, N as We, c as Y, B as y, j as U, O as ze, Q as C, k as M, V as w, W as Ve, a as Ne, X as ie, Y as oe, Z as le, _ as ue, C as P, $ as je, a0 as A, a1 as J, D as H, a2 as $e, a3 as qe, P as Ke, d as Ye, T as X, a4 as Q, a5 as Je, a6 as Xe, a7 as Qe } from "./index-gXIG5heI.js";
1
+ import { F as Ie, u as Ee, l as se, M as v, G as De, v as Oe, S as Fe, x as ae, E as u, e as D, y as S, z as Le, H as O, I as b, R as F, J as ne, K as He, t as m, b as f, i as B, w as L, L as K, N as We, c as Y, B as y, j as U, O as ze, Q as C, k as M, V as w, W as Ve, a as Ne, X as ie, Y as oe, Z as le, _ as ue, C as P, $ as je, a0 as A, a1 as J, D as H, a2 as $e, a3 as qe, P as Ke, d as Ye, T as X, a4 as Q, a5 as Je, a6 as Xe, a7 as Qe } from "./index-BdiiyukT.js";
2
2
  import { B as de, c as Ze } from "./colorToUniform-C2jGzNe1.js";
3
3
  var et = `in vec2 vMaskCoord;
4
4
  in vec2 vTextureCoord;
@@ -1,6 +1,6 @@
1
- import { S as G, E as d, B as v, w as m, D as S, L as j, v as ve, s as U, t as b, a8 as Be, k as K, a9 as Ae, b as p, V as L, j as B, i as A, l as F, M as $, aa as z, ab as Ne, ac as ye, ad as Y, ae as Ce, A as De, R as Ie, e as T } from "./index-gXIG5heI.js";
1
+ import { S as G, E as d, B as v, w as m, D as S, L as j, v as ve, s as U, t as b, a8 as Be, k as K, a9 as Ae, b as p, V as L, j as B, i as A, l as F, M as $, aa as z, ab as Ne, ac as ye, ad as Y, ae as Ce, A as De, R as Ie, e as T } from "./index-BdiiyukT.js";
2
2
  import { b as q } from "./colorToUniform-C2jGzNe1.js";
3
- import { e as Ge, G as Ue, c as Fe, b as Oe, U as Pe, R as Me, B as Z, d as N, f as Le, S as He, a as we } from "./SharedSystems-B3cyWriK.js";
3
+ import { e as Ge, G as Ue, c as Fe, b as Oe, U as Pe, R as Me, B as Z, d as N, f as Le, S as He, a as we } from "./SharedSystems-CbOvgzCC.js";
4
4
  class Q {
5
5
  constructor() {
6
6
  this._tempState = G.for2d(), this._didUploadHash = {};
@@ -1,6 +1,6 @@
1
- import { S as E, g as A, E as p, f as ae, D as S, b as C, B as T, c as ue, d as L, h as M, w as v, i as x, j as ce, k as de, l as k, m as w, M as D, n as H, o as he, p as pe, q as z, s as F, t as R, A as le, R as fe, e as B } from "./index-gXIG5heI.js";
1
+ import { S as E, g as A, E as p, f as ae, D as S, b as C, B as T, c as ue, d as L, h as M, w as v, i as x, j as ce, k as de, l as k, m as w, M as D, n as H, o as he, p as pe, q as z, s as F, t as R, A as le, R as fe, e as B } from "./index-BdiiyukT.js";
2
2
  import { l as ge, a as me } from "./colorToUniform-C2jGzNe1.js";
3
- import { c as _e, u as be, U as xe, B as ye, G as Ge, e as Se, R as Be, t as Pe, S as Te, a as Ce } from "./SharedSystems-B3cyWriK.js";
3
+ import { c as _e, u as be, U as xe, B as ye, G as Ge, e as Se, R as Be, t as Pe, S as Te, a as Ce } from "./SharedSystems-CbOvgzCC.js";
4
4
  const y = E.for2d();
5
5
  class O {
6
6
  start(e, t, r) {
@@ -1,5 +1,5 @@
1
- import { T as M, U as Z, P as m, r as te, E as y, a as ie, w as g, e as P, C as V } from "./index-gXIG5heI.js";
2
- import "./webworkerAll-I-KX_dQM.js";
1
+ import { T as M, U as Z, P as m, r as te, E as y, a as ie, w as g, e as P, C as V } from "./index-BdiiyukT.js";
2
+ import "./webworkerAll-BuYW7nlg.js";
3
3
  class q {
4
4
  constructor(e) {
5
5
  this._lastTransform = "", this._observer = null, this._tickerAttached = !1, this.updateTranslation = () => {
@@ -30,6 +30,10 @@ export interface IClip<T extends BaseSpriteEvents = BaseSpriteEvents> extends Om
30
30
  * Clip type (e.g., 'video', 'image', 'text', 'audio')
31
31
  */
32
32
  readonly type: string;
33
+ /**
34
+ * Name of this clip
35
+ */
36
+ name: string;
33
37
  /**
34
38
  * Source URL or identifier for this clip
35
39
  */
@@ -8562,6 +8562,10 @@ class V_ extends Gh {
8562
8562
  * Unique identifier for the sprite/clip
8563
8563
  */
8564
8564
  id = "";
8565
+ /**
8566
+ * Name of the sprite/clip
8567
+ */
8568
+ name = "";
8565
8569
  /**
8566
8570
  * Control display time range of clips, commonly used in editing scenario timeline (track) module
8567
8571
  * from: start time offset in microseconds
@@ -8950,6 +8954,8 @@ class Fe extends V_ {
8950
8954
  } : void 0;
8951
8955
  return {
8952
8956
  type: this.constructor.name,
8957
+ id: this.id,
8958
+ name: this.name,
8953
8959
  src: this.src,
8954
8960
  display: {
8955
8961
  from: this.display.from,
@@ -9627,7 +9633,7 @@ const hh = (i) => {
9627
9633
  },
9628
9634
  test: () => !0,
9629
9635
  load: async () => {
9630
- await import("./browserAll-C8dCWSj4.js");
9636
+ await import("./browserAll-D2WDRHjP.js");
9631
9637
  }
9632
9638
  }, K_ = {
9633
9639
  extension: {
@@ -9637,7 +9643,7 @@ const hh = (i) => {
9637
9643
  },
9638
9644
  test: () => typeof self < "u" && self.WorkerGlobalScope !== void 0,
9639
9645
  load: async () => {
9640
- await import("./webworkerAll-I-KX_dQM.js");
9646
+ await import("./webworkerAll-BuYW7nlg.js");
9641
9647
  }
9642
9648
  };
9643
9649
  class wt {
@@ -18828,13 +18834,13 @@ async function H2(i) {
18828
18834
  for (let n = 0; n < t.length; n++) {
18829
18835
  const o = t[n];
18830
18836
  if (o === "webgpu" && await G2()) {
18831
- const { WebGPURenderer: a } = await import("./WebGPURenderer-BHkeWSc1.js");
18837
+ const { WebGPURenderer: a } = await import("./WebGPURenderer-BAGe_F9Z.js");
18832
18838
  e = a, s = { ...i, ...i.webgpu };
18833
18839
  break;
18834
18840
  } else if (o === "webgl" && N2(
18835
18841
  i.failIfMajorPerformanceCaveat ?? Op.defaultOptions.failIfMajorPerformanceCaveat
18836
18842
  )) {
18837
- const { WebGLRenderer: a } = await import("./WebGLRenderer-D7W8spZ5.js");
18843
+ const { WebGLRenderer: a } = await import("./WebGLRenderer-BytNn1OJ.js");
18838
18844
  e = a, s = { ...i, ...i.webgl };
18839
18845
  break;
18840
18846
  } else if (o === "canvas")
@@ -34523,7 +34529,7 @@ async function Hi(i) {
34523
34529
  default:
34524
34530
  throw new Error(`Unsupported clip type: ${i.type}`);
34525
34531
  }
34526
- return t.left = i.left, t.top = i.top, t.width = i.width, t.height = i.height, t.angle = i.angle, t.display.from = i.display.from, t.display.to = i.display.to, t.duration = i.duration, t.playbackRate = i.playbackRate, t.zIndex = i.zIndex, t.opacity = i.opacity, t.flip = i.flip, i.style && (t.style = { ...t.style, ...i.style }), i.animation && t.setAnimation(i.animation.keyFrames, i.animation.opts), i.id && (t.id = i.id), i.effects && (t.effects = i.effects), i.trim && (t.trim.from = i.trim.from < 1e6 ? i.trim.from * 1e6 : i.trim.from, t.trim.to = i.trim.to < 1e6 ? i.trim.to * 1e6 : i.trim.to), t;
34532
+ return t.left = i.left, t.top = i.top, t.width = i.width, t.height = i.height, t.angle = i.angle, t.display.from = i.display.from, t.display.to = i.display.to, t.duration = i.duration, t.playbackRate = i.playbackRate, t.zIndex = i.zIndex, t.opacity = i.opacity, t.flip = i.flip, i.style && (t.style = { ...t.style, ...i.style }), i.animation && t.setAnimation(i.animation.keyFrames, i.animation.opts), i.id && (t.id = i.id), i.name && (t.name = i.name), i.effects && (t.effects = i.effects), i.trim && (t.trim.from = i.trim.from < 1e6 ? i.trim.from * 1e6 : i.trim.from, t.trim.to = i.trim.to < 1e6 ? i.trim.to * 1e6 : i.trim.to), t;
34527
34533
  }
34528
34534
  var Zc, Ad;
34529
34535
  function v3() {
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ay as o, az as i, aH as t, aG as e, aD as n, aO as r, aQ as T, aA as m, aJ as C, aB as O, aF as f, aI as I, aC as P, aE as d, aB as p, aK as A, aw as N, at as c, au as x, aM as E, aL as F, aN as M, aP as _, av as l, ax as u } from "./index-gXIG5heI.js";
1
+ import { ay as o, az as i, aH as t, aG as e, aD as n, aO as r, aQ as T, aA as m, aJ as C, aB as O, aF as f, aI as I, aC as P, aE as d, aB as p, aK as A, aw as N, at as c, au as x, aM as E, aL as F, aN as M, aP as _, av as l, ax as u } from "./index-BdiiyukT.js";
2
2
  export {
3
3
  o as Audio,
4
4
  i as Caption,
package/dist/index.umd.js CHANGED
@@ -63,7 +63,7 @@ void main() {
63
63
  <div xmlns="http://www.w3.org/1999/xhtml">${s.outerHTML}</div>
64
64
  </foreignObject>
65
65
  </svg>
66
- `.replace(/\t/g,"").replace(/#/g,"%23");return o.src=`data:image/svg+xml;charset=utf-8,${l}`,await new Promise(c=>{o.onload=c}),o}async function sT(i,e,t={}){const s=await iT(i,e,t),r=new OffscreenCanvas(s.width,s.height);return r.getContext("2d")?.drawImage(s,0,0,s.width,s.height),await createImageBitmap(r)}async function rT(i,e){const t={type:e,data:i},s=new ImageDecoder(t);await Promise.all([s.completed,s.tracks.ready]);const r=s.tracks.selectedTrack?.frameCount??1,n=[];for(let o=0;o<r;o+=1)n.push((await s.decode({frameIndex:o})).image);return n}let Lh=class{all=new Map;on(e,t){const s=this.all.get(e);return s?s.push(t):this.all.set(e,[t]),()=>this.off(e,t)}once(e,t){const s=this.on(e,r=>{s(),t(r)});return s}off(e,t){const s=this.all.get(e);s&&(t?s.splice(s.indexOf(t)>>>0,1):this.all.set(e,[]))}emit(e,t){let s=this.all.get(e);s&&s.slice().forEach(r=>{r(t)}),s=this.all.get("*"),s&&s.slice().forEach(r=>{r(e,t)})}};class nT extends Lh{id="";display={from:0,to:0};duration=0;playbackRate=1;trim={from:0,to:0};constructor(){super()}_left=0;get left(){return this._left}set left(e){const t=this._left!==e;this._left=e,t&&this.emit("propsChange",{left:e})}_top=0;get top(){return this._top}set top(e){const t=this._top!==e;this._top=e,t&&this.emit("propsChange",{top:e})}_width=0;get width(){return this._width}set width(e){const t=this._width!==e;this._width=e,t&&this.emit("propsChange",{width:e})}_height=0;get height(){return this._height}set height(e){const t=this._height!==e;this._height=e,t&&this.emit("propsChange",{height:e})}_angle=0;get angle(){return this._angle}set angle(e){const t=this._angle!==e;this._angle=e,t&&this.emit("propsChange",{angle:e})}get center(){return{x:this.left+this.width/2,y:this.top+this.height/2}}_zIndex=0;get zIndex(){return this._zIndex}set zIndex(e){const t=this._zIndex!==e;this._zIndex=e,t&&this.emit("propsChange",{zIndex:e})}_opacity=1;get opacity(){return this._opacity}set opacity(e){const t=this._opacity!==e;this._opacity=e,t&&this.emit("propsChange",{opacity:e})}_volume=1;get volume(){return this._volume}set volume(e){const t=this._volume!==e;this._volume=e,t&&this.emit("propsChange",{volume:e})}flip=null;effects=[];_style={};get style(){return this._style}set style(e){this._style=e}animatKeyFrame=null;animatOpts=null;ready=Promise.resolve();_render(e){const{center:t}=this;e.setTransform(this.flip==="horizontal"?-1:1,0,0,this.flip==="vertical"?-1:1,t.x,t.y);const s=this.angle*Math.PI/180;e.rotate((this.flip==null?1:-1)*s),e.globalAlpha=this.opacity}setAnimation(e,t){this.animatKeyFrame=Object.entries(e).map(([s,r])=>{const n={from:0,to:100}[s]??Number(s.slice(0,-1));if(isNaN(n)||n>100||n<0)throw Error("keyFrame must between 0~100");return[n/100,r]}),this.animatOpts=Object.assign({},this.animatOpts,{duration:t.duration,delay:t.delay??0,iterCount:t.iterCount??1/0})}animate(e){if(this.animatKeyFrame==null||this.animatOpts==null||e<this.animatOpts.delay)return;const t=oT(e,this.animatKeyFrame,this.animatOpts);for(const s in t)switch(s){case"opacity":this.opacity=t[s];break;case"x":this.left=t[s];break;case"y":this.top=t[s];break;case"w":this.width=t[s];break;case"h":this.height=t[s];break;case"angle":this.angle=t[s];break}}copyStateTo(e){e.animatKeyFrame=this.animatKeyFrame,e.animatOpts=this.animatOpts,e.zIndex=this.zIndex,e.opacity=this.opacity,e.volume=this.volume,e.flip=this.flip,e.left=this.left,e.top=this.top,e.width=this.width,e.height=this.height,e.angle=this.angle,e.display={...this.display},e.duration=this.duration,e.playbackRate=this.playbackRate,e.trim={...this.trim},e.style=JSON.parse(JSON.stringify(this.style||{})),"src"in this&&"src"in e&&(e.src=this.src)}update(e){Object.assign(this,e),this.emit("propsChange",e)}destroy(){this.all.clear()}}function oT(i,e,t){const s=i-t.delay,r=s%t.duration,n=s/t.duration>=t.iterCount||s===t.duration?1:r/t.duration,o=e.findIndex(f=>f[0]>=n);if(o===-1)return{};const a=e[o-1],l=e[o],c=l[1];if(a==null)return c;const h=a[1],u={},d=(n-a[0])/(l[0]-a[0]);for(const f in c){if(!Object.hasOwn(c,f)||typeof f!="string")continue;const p=f;h[p]!=null&&(u[p]=(c[p]-h[p])*d+h[p])}return u}class Yt extends nT{lastVf=null;destroyed=!1;src="";transition;constructor(){super()}async getFrame(e){const t=e*this.playbackRate,{video:s,audio:r,state:n}=await this.tick(t);let o=r??[];r!=null&&this.playbackRate!==1&&(o=r.map(l=>gp(l,this.playbackRate)));let a=null;return s!=null?(this.lastVf?.close(),s instanceof VideoFrame?(a=await createImageBitmap(s),s.close()):a=s,this.lastVf=a):this.lastVf!=null&&(a=this.lastVf),{video:a,audio:o,done:n==="done"}}async offscreenRender(e,t){const s=t*this.playbackRate;this.animate(s),super._render(e);const{width:r,height:n}=this,{video:o,audio:a,state:l}=await this.tick(s);let c=a??[];if(a!=null&&this.playbackRate!==1&&(c=a.map(u=>gp(u,this.playbackRate))),l==="done")return{audio:c,done:!0};const h=o??this.lastVf;if(h!=null){const u=this.style.borderRadius||0,d=this.style.dropShadow;if(e.save(),d&&(d.blur>0||d.distance>0)){const p=d.distance??0,g=d.angle??0;e.shadowColor=d.color||"#000000",e.shadowBlur=d.blur||0,e.shadowOffsetX=Math.cos(g)*p,e.shadowOffsetY=Math.sin(g)*p}if(u>0){const p=Math.min(u,r/2,n/2);e.beginPath(),e.roundRect(-r/2,-n/2,r,n,p),e.clip()}e.drawImage(h,-r/2,-n/2,r,n),e.restore();const f=this.style.stroke;if(f&&f.width>0){if(e.save(),e.strokeStyle=f.color,e.lineWidth=f.width,u>0){const p=Math.min(u,r/2,n/2);e.beginPath(),e.roundRect(-r/2,-n/2,r,n,p),e.stroke()}else e.strokeRect(-r/2,-n/2,r,n);e.restore()}}return o!=null&&(this.lastVf?.close(),o instanceof ImageBitmap&&(this.lastVf=o)),{audio:c,done:!1}}set(e,t=30){if(e.display&&(e.display.from!==void 0&&(this.display.from=e.display.from<1e6?e.display.from/t*1e6:e.display.from),e.display.to!==void 0&&(this.display.to=e.display.to<1e6?e.display.to/t*1e6:e.display.to)),e.x!==void 0&&(this.left=e.x),e.y!==void 0&&(this.top=e.y),e.width!==void 0&&(this.width=e.width),e.height!==void 0&&(this.height=e.height),e.duration!==void 0){const s=e.duration<1e6?e.duration/t*1e6:e.duration;this.duration=s,this.display.from!==void 0&&(this.display.to=this.display.from+s)}return this}toJSON(e=!1){const t=this.animatKeyFrame&&this.animatOpts?{keyFrames:this.animatKeyFrame.reduce((s,[r,n])=>{const o=r===0?"from":r===1?"to":`${Math.round(r*100)}%`;return s[o]=n,s},{}),opts:this.animatOpts}:void 0;return{type:this.constructor.name,src:this.src,display:{from:this.display.from,to:this.display.to},playbackRate:this.playbackRate,duration:this.duration,left:this.left,top:this.top,width:this.width,height:this.height,angle:this.angle,zIndex:this.zIndex,opacity:this.opacity,flip:this.flip,style:this.style,trim:{from:this.trim.from,to:this.trim.to},...t&&{animation:t},...e&&{main:!0}}}getVisibleHandles(){return["tl","tr","bl","br","ml","mr","mt","mb","rot"]}async scaleToFit(e,t){await this.ready;const{width:s,height:r}=this.meta;if(s===0||r===0)return;const n=Math.min(e/s,t/r);this.width=s*n,this.height=r*n}async scaleToFill(e,t){await this.ready;const{width:s,height:r}=this.meta;if(s===0||r===0)return;const n=Math.max(e/s,t/r);this.width=s*n,this.height=r*n}centerInScene(e,t){this.left=(e-this.width)/2,this.top=(t-this.height)/2}destroy(){this.destroyed||(this.destroyed=!0,Z.info("BaseClip destroy"),super.destroy(),this.lastVf?.close(),this.lastVf=null)}}let Hh=null;async function xp(){return Hh===null&&(Hh=z1()),await Hh}const ue={get codec(){return xr()?.codec??"mp4a.40.2"},get codecType(){return xr()?.codecType??"aac"},get sampleRate(){return xr()?.sampleRate??48e3},get channelCount(){return xr()?.channelCount??2}};class Ii{static async getCacheKey(e){const s=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-1",s);return Array.from(new Uint8Array(r)).map(o=>o.toString(16).padStart(2,"0")).join("")}static getPath(e){return`assets/${e}`}static async get(e){const t=await this.getCacheKey(e),s=this.getPath(t),r=ni(s);return await r.exists()?r:null}static async put(e,t){const s=await this.getCacheKey(e),r=this.getPath(s),n=ni(r);return await Si(n,t),n}}class Pi{resources=new Map;loadingPromises=new Map;async preload(e){const s=[...new Set(e)].filter(r=>r&&!r.startsWith("data:")&&!r.startsWith("blob:")).map(r=>this.loadResource(r));await Promise.allSettled(s)}static async getReadableStream(e){const t=await Ii.get(e);if(t){const a=await t.getOriginFile();if(a)return a.stream()}const s=await fetch(e);if(!s.ok)throw new Error(`Failed to fetch: ${s.status} ${s.statusText}`);const r=s.body;if(!r)throw new Error("Response body is null");if(e.startsWith("data:")||e.startsWith("blob:"))return r;const[n,o]=r.tee();return Ii.put(e,o).catch(a=>{console.error(`ResourceManager: Failed to cache ${e}`,a)}),n}static async getImageBitmap(e){const t=await Ii.get(e);if(t){const l=await t.getOriginFile();if(l)return await createImageBitmap(l)}if(e.startsWith("data:")||e.startsWith("blob:")){const c=await(await fetch(e)).blob();return await createImageBitmap(c)}const s=await fetch(e);if(!s.ok)throw new Error(`Failed to fetch: ${s.status} ${s.statusText}`);const r=s.body;if(!r)throw new Error("Response body is null");const[n,o]=r.tee(),a=(async()=>{const c=await new Response(n).blob();return await createImageBitmap(c)})();return Ii.put(e,o).catch(l=>{console.error(`ResourceManager: Failed to cache ${e}`,l)}),await a}async loadResource(e){const t=this.loadingPromises.get(e);if(t)return t;if(this.resources.has(e)){const r=this.resources.get(e);if(r.status==="completed")return r}const s=(async()=>{const r={url:e,status:"loading"};this.resources.set(e,r);try{const n=await Ii.get(e);if(n)return r.status="completed",r.localFile=n,r;const o=await fetch(e);if(!o.ok)throw new Error(`Fetch failed: ${o.status}`);const a=o.body;if(!a)throw new Error("No body");const l=await Ii.put(e,a);return r.status="completed",r.localFile=l,r}catch(n){return r.status="failed",r.error=n instanceof Error?n:new Error(String(n)),r}finally{this.loadingPromises.delete(e)}})();return this.loadingPromises.set(e,s),s}async resolve(e){if(!e||e.startsWith("data:")||e.startsWith("blob:"))return e;const t=await this.loadResource(e);return t.status==="completed"&&t.localFile?t.localFile:e}getStatus(e){return this.resources.get(e)}clear(){this.resources.clear(),this.loadingPromises.clear()}}class at extends Yt{type="Audio";static ctx=null;ready;_meta={duration:0,width:0,height:0};get meta(){return{...this._meta,sampleRate:ue.sampleRate,chanCount:2}}chan0Buf=new Float32Array;chan1Buf=new Float32Array;getPCMData(){return[this.chan0Buf,this.chan1Buf]}opts;loop=!1;static async fromUrl(e,t={}){const s=await Pi.getReadableStream(e),r=new at(s,t,e);return await r.ready,r}static async fromObject(e){if(e.type!=="Audio")throw new Error(`Expected Audio, got ${e.type}`);if(!e.src||e.src.trim()==="")throw new Error("Audio requires a valid source URL");const t={};e.loop!==void 0&&(t.loop=e.loop),e.volume!==void 0&&(t.volume=e.volume);const s=await at.fromUrl(e.src,t);return s.left=e.left,s.top=e.top,s.width=e.width,s.height=e.height,s.angle=e.angle,s.display.from=e.display.from,s.display.to=e.display.to,s.duration=e.duration,s.playbackRate=e.playbackRate,s.zIndex=e.zIndex,s.opacity=e.opacity,s.flip=e.flip,e.animation&&s.setAnimation(e.animation.keyFrames,e.animation.opts),s}constructor(e,t={},s){super(),this.src=s!==void 0?s:"",this.opts={loop:!1,volume:1,...t},this.loop=this.opts.loop??!1,this.volume=this.opts.volume??1,this.ready=this.init(e).then(r=>{const n={width:0,height:0,duration:t.loop?1/0:this._meta.duration};return this.width=this.width===0?n.width:this.width,this.height=this.height===0?n.height:this.height,this.duration=this.duration===0?n.duration:this.duration,this.display.to=this.display.from+this.duration,n})}async init(e){at.ctx==null&&(at.ctx=new AudioContext({sampleRate:ue.sampleRate}));const t=performance.now(),s=e instanceof ReadableStream?await lT(e,at.ctx):e;Z.info("Audio clip decoded complete:",performance.now()-t),this._meta.duration=s[0].length/ue.sampleRate*1e6,this.chan0Buf=s[0],this.chan1Buf=s[1]??this.chan0Buf,Z.info("Audio clip convert to AudioData, time:",performance.now()-t)}tickInterceptor=async(e,t)=>t;timestamp=0;frameOffset=0;async tick(e){if(!this.opts.loop&&e>=this._meta.duration)return await this.tickInterceptor(e,{audio:[],state:"done"});const t=e-this.timestamp;if(e<this.timestamp||t>3e6)return this.timestamp=e,this.frameOffset=Math.ceil(this.timestamp/1e6*ue.sampleRate),await this.tickInterceptor(e,{audio:[new Float32Array(0),new Float32Array(0)],state:"success"});this.timestamp=e;const s=Math.ceil(t/1e6*ue.sampleRate),r=this.frameOffset+s,n=this.opts.loop?[Gh(this.chan0Buf,this.frameOffset,r),Gh(this.chan1Buf,this.frameOffset,r)]:[this.chan0Buf.slice(this.frameOffset,r),this.chan1Buf.slice(this.frameOffset,r)];if(this.volume!==1)for(const o of n)for(let a=0;a<o.length;a++)o[a]*=this.volume;return this.frameOffset=r,await this.tickInterceptor(e,{audio:n,state:"success"})}async split(e){await this.ready;const t=Math.ceil(e/1e6*ue.sampleRate),s=new at(this.getPCMData().map(n=>n.slice(0,t)),this.opts,this.src),r=new at(this.getPCMData().map(n=>n.slice(t)),this.opts,this.src);return[s,r]}async clone(){await this.ready;const e=new at(this.getPCMData(),this.opts,this.src);return await e.ready,this.copyStateTo(e),e}destroy(){this.chan0Buf=new Float32Array(0),this.chan1Buf=new Float32Array(0),Z.info("---- audioclip destroy ----"),super.destroy()}toJSON(e=!1){return{...super.toJSON(e),type:"Audio",loop:this.loop,id:this.id,volume:this.volume}}static concatAudio=aT;async createPlaybackElement(){if(await this.ready,!this.src||this.src.trim()==="")throw new Error("Audio requires a source URL for playback");const e=this.src.startsWith("blob:")?this.src:void 0,t=document.createElement("audio");return t.crossOrigin="anonymous",t.autoplay=!1,t.preload="auto",t.loop=this.opts.loop||!1,t.src=this.src,await new Promise((s,r)=>{const n=()=>{t.removeEventListener("loadeddata",n),t.removeEventListener("error",o),t.pause(),t.currentTime=0,s()},o=()=>{t.removeEventListener("loadeddata",n),t.removeEventListener("error",o),r(new Error("Failed to load audio"))};t.addEventListener("loadeddata",n,{once:!0}),t.addEventListener("error",o,{once:!0}),t.load()}),{element:t,objectUrl:e}}async play(e,t){const s=e;if(Math.abs(s.currentTime-t)>.1&&(s.currentTime=t),s.paused)try{await s.play()}catch{try{await s.play()}catch(n){console.warn("Failed to play audio:",n)}}}pause(e){e.pause()}async seek(e,t){const s=e;return s.pause(),s.currentTime=t,new Promise(r=>{if(Math.abs(s.currentTime-t)<.01){r();return}const n=()=>{s.removeEventListener("seeked",n),r()};s.addEventListener("seeked",n,{once:!0}),setTimeout(()=>{s.removeEventListener("seeked",n),r()},500)})}syncPlayback(e,t,s){const r=e,n=this.meta.duration/1e6,o=s>=0&&s<n;r.volume=this.volume,t&&o?r.paused&&this.play(r,s).catch(console.warn):(r.paused||r.pause(),o&&Math.abs(r.currentTime-s)>.1&&(r.currentTime=s))}cleanupPlayback(e,t){const s=e;s.pause(),s.removeAttribute("src"),s.load(),t&&t.startsWith("blob:")&&URL.revokeObjectURL(t)}}async function aT(i,e){const t=[];for(const s of i)await s.ready,t.push(s.getPCMData());return new at(fp(t),e)}async function lT(i,e){const t=await new Response(i).arrayBuffer();return Dh(await e.decodeAudioData(t))}var T=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(T||{});const Wh=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},vr=(i,e)=>Wh(i).priority??e,q={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Wh).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...i){return i.map(Wh).forEach(e=>{e.type.forEach(t=>{const s=this._addHandlers,r=this._queue;s[t]?s[t]?.(e):(r[t]=r[t]||[],r[t]?.push(e))})}),this},handle(i,e,t){const s=this._addHandlers,r=this._removeHandlers;if(s[i]||r[i])throw new Error(`Extension type ${i} already has a handler`);s[i]=e,r[i]=t;const n=this._queue;return n[i]&&(n[i]?.forEach(o=>e(o)),delete n[i]),this},handleByMap(i,e){return this.handle(i,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByNamedList(i,e,t=-1){return this.handle(i,s=>{e.findIndex(n=>n.name===s.name)>=0||(e.push({name:s.name,value:s.ref}),e.sort((n,o)=>vr(o.value,t)-vr(n.value,t)))},s=>{const r=e.findIndex(n=>n.name===s.name);r!==-1&&e.splice(r,1)})},handleByList(i,e,t=-1){return this.handle(i,s=>{e.includes(s.ref)||(e.push(s.ref),e.sort((r,n)=>vr(n,t)-vr(r,t)))},s=>{const r=e.indexOf(s.ref);r!==-1&&e.splice(r,1)})},mixin(i,...e){for(const t of e)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(t))}},cT={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>QR)}},hT={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>eM)}};class Ue{constructor(e,t,s){this._x=t||0,this._y=s||0,this._observer=e}clone(e){return new Ue(e??this._observer,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}function Vh(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var $h={exports:{}},yp;function uT(){return yp||(yp=1,(function(i){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function r(l,c,h){this.fn=l,this.context=c,this.once=h||!1}function n(l,c,h,u,d){if(typeof h!="function")throw new TypeError("The listener must be a function");var f=new r(h,u||l,d),p=t?t+c:c;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],f]:l._events[p].push(f):(l._events[p]=f,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new s:delete l._events[c]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],h,u;if(this._eventsCount===0)return c;for(u in h=this._events)e.call(h,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(h)):c},a.prototype.listeners=function(c){var h=t?t+c:c,u=this._events[h];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,p=new Array(f);d<f;d++)p[d]=u[d].fn;return p},a.prototype.listenerCount=function(c){var h=t?t+c:c,u=this._events[h];return u?u.fn?1:u.length:0},a.prototype.emit=function(c,h,u,d,f,p){var g=t?t+c:c;if(!this._events[g])return!1;var m=this._events[g],_=arguments.length,x,y;if(m.fn){switch(m.once&&this.removeListener(c,m.fn,void 0,!0),_){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,h),!0;case 3:return m.fn.call(m.context,h,u),!0;case 4:return m.fn.call(m.context,h,u,d),!0;case 5:return m.fn.call(m.context,h,u,d,f),!0;case 6:return m.fn.call(m.context,h,u,d,f,p),!0}for(y=1,x=new Array(_-1);y<_;y++)x[y-1]=arguments[y];m.fn.apply(m.context,x)}else{var v=m.length,C;for(y=0;y<v;y++)switch(m[y].once&&this.removeListener(c,m[y].fn,void 0,!0),_){case 1:m[y].fn.call(m[y].context);break;case 2:m[y].fn.call(m[y].context,h);break;case 3:m[y].fn.call(m[y].context,h,u);break;case 4:m[y].fn.call(m[y].context,h,u,d);break;default:if(!x)for(C=1,x=new Array(_-1);C<_;C++)x[C-1]=arguments[C];m[y].fn.apply(m[y].context,x)}}return!0},a.prototype.on=function(c,h,u){return n(this,c,h,u,!1)},a.prototype.once=function(c,h,u){return n(this,c,h,u,!0)},a.prototype.removeListener=function(c,h,u,d){var f=t?t+c:c;if(!this._events[f])return this;if(!h)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===h&&(!d||p.once)&&(!u||p.context===u)&&o(this,f);else{for(var g=0,m=[],_=p.length;g<_;g++)(p[g].fn!==h||d&&!p[g].once||u&&p[g].context!==u)&&m.push(p[g]);m.length?this._events[f]=m.length===1?m[0]:m:o(this,f)}return this},a.prototype.removeAllListeners=function(c){var h;return c?(h=t?t+c:c,this._events[h]&&o(this,h)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,i.exports=a})($h)),$h.exports}var dT=uT();const Je=Vh(dT),fT=Math.PI*2,pT=180/Math.PI,mT=Math.PI/180;class X{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new X(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Xh.x=0,Xh.y=0,Xh}}const Xh=new X;class G{constructor(e=1,t=0,s=0,r=1,n=0,o=0){this.array=null,this.a=e,this.b=t,this.c=s,this.d=r,this.tx=n,this.ty=o}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,s,r,n,o){return this.a=e,this.b=t,this.c=s,this.d=r,this.tx=n,this.ty=o,this}toArray(e,t){this.array||(this.array=new Float32Array(9));const s=t||this.array;return e?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(e,t){t=t||new X;const s=e.x,r=e.y;return t.x=this.a*s+this.c*r+this.tx,t.y=this.b*s+this.d*r+this.ty,t}applyInverse(e,t){t=t||new X;const s=this.a,r=this.b,n=this.c,o=this.d,a=this.tx,l=this.ty,c=1/(s*o+n*-r),h=e.x,u=e.y;return t.x=o*c*h+-n*c*u+(l*n-a*o)*c,t.y=s*c*u+-r*c*h+(-l*s+a*r)*c,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){const t=Math.cos(e),s=Math.sin(e),r=this.a,n=this.c,o=this.tx;return this.a=r*t-this.b*s,this.b=r*s+this.b*t,this.c=n*t-this.d*s,this.d=n*s+this.d*t,this.tx=o*t-this.ty*s,this.ty=o*s+this.ty*t,this}append(e){const t=this.a,s=this.b,r=this.c,n=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*s+e.b*n,this.c=e.c*t+e.d*r,this.d=e.c*s+e.d*n,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*s+e.ty*n+this.ty,this}appendFrom(e,t){const s=e.a,r=e.b,n=e.c,o=e.d,a=e.tx,l=e.ty,c=t.a,h=t.b,u=t.c,d=t.d;return this.a=s*c+r*u,this.b=s*h+r*d,this.c=n*c+o*u,this.d=n*h+o*d,this.tx=a*c+l*u+t.tx,this.ty=a*h+l*d+t.ty,this}setTransform(e,t,s,r,n,o,a,l,c){return this.a=Math.cos(a+c)*n,this.b=Math.sin(a+c)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=e-(s*this.a+r*this.c),this.ty=t-(s*this.b+r*this.d),this}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const s=this.a,r=this.c;this.a=s*e.a+this.b*e.c,this.b=s*e.b+this.b*e.d,this.c=r*e.a+this.d*e.c,this.d=r*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){const t=this.a,s=this.b,r=this.c,n=this.d,o=e.pivot,a=-Math.atan2(-r,n),l=Math.atan2(s,t),c=Math.abs(a+l);return c<1e-5||Math.abs(fT-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(t*t+s*s),e.scale.y=Math.sqrt(r*r+n*n),e.position.x=this.tx+(o.x*t+o.y*r),e.position.y=this.ty+(o.x*s+o.y*n),e}invert(){const e=this.a,t=this.b,s=this.c,r=this.d,n=this.tx,o=e*r-t*s;return this.a=r/o,this.b=-t/o,this.c=-s/o,this.d=e/o,this.tx=(s*this.ty-r*n)/o,this.ty=-(e*this.ty-t*n)/o,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const e=new G;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return _T.identity()}static get shared(){return gT.identity()}}const gT=new G,_T=new G,oi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ai=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],li=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ci=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Yh=[],vp=[],br=Math.sign;function xT(){for(let i=0;i<16;i++){const e=[];Yh.push(e);for(let t=0;t<16;t++){const s=br(oi[i]*oi[t]+li[i]*ai[t]),r=br(ai[i]*oi[t]+ci[i]*ai[t]),n=br(oi[i]*li[t]+li[i]*ci[t]),o=br(ai[i]*li[t]+ci[i]*ci[t]);for(let a=0;a<16;a++)if(oi[a]===s&&ai[a]===r&&li[a]===n&&ci[a]===o){e.push(a);break}}}for(let i=0;i<16;i++){const e=new G;e.set(oi[i],ai[i],li[i],ci[i],0,0),vp.push(e)}}xT();const de={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>oi[i],uY:i=>ai[i],vX:i=>li[i],vY:i=>ci[i],inv:i=>i&8?i&15:-i&7,add:(i,e)=>Yh[i][e],sub:(i,e)=>Yh[i][de.inv(e)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,e)=>Math.abs(i)*2<=Math.abs(e)?e>=0?de.S:de.N:Math.abs(e)*2<=Math.abs(i)?i>0?de.E:de.W:e>0?i>0?de.SE:de.SW:i>0?de.NE:de.NW,matrixAppendRotationInv:(i,e,t=0,s=0)=>{const r=vp[de.inv(e)];r.tx=t,r.ty=s,i.append(r)},transformRectCoords:(i,e,t,s)=>{const{x:r,y:n,width:o,height:a}=i,{x:l,y:c,width:h,height:u}=e;return t===de.E?(s.set(r+l,n+c,o,a),s):t===de.S?s.set(h-n-a+l,r+c,a,o):t===de.W?s.set(h-r-o+l,u-n-a+c,o,a):t===de.N?s.set(n+l,u-r-o+c,a,o):s.set(r+l,n+c,o,a)}},wr=[new X,new X,new X,new X];class V{constructor(e=0,t=0,s=0,r=0){this.type="rectangle",this.x=Number(e),this.y=Number(t),this.width=Number(s),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new V(0,0,0,0)}clone(){return new V(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}strokeContains(e,t,s,r=.5){const{width:n,height:o}=this;if(n<=0||o<=0)return!1;const a=this.x,l=this.y,c=s*(1-r),h=s-c,u=a-c,d=a+n+c,f=l-c,p=l+o+c,g=a+h,m=a+n-h,_=l+h,x=l+o-h;return e>=u&&e<=d&&t>=f&&t<=p&&!(e>g&&e<m&&t>_&&t<x)}intersects(e,t){if(!t){const P=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=P)return!1;const w=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>w}const s=this.left,r=this.right,n=this.top,o=this.bottom;if(r<=s||o<=n)return!1;const a=wr[0].set(e.left,e.top),l=wr[1].set(e.left,e.bottom),c=wr[2].set(e.right,e.top),h=wr[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;const u=Math.sign(t.a*t.d-t.b*t.c);if(u===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.apply(h,h),Math.max(a.x,l.x,c.x,h.x)<=s||Math.min(a.x,l.x,c.x,h.x)>=r||Math.max(a.y,l.y,c.y,h.y)<=n||Math.min(a.y,l.y,c.y,h.y)>=o))return!1;const d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*s+f*n,g=d*r+f*n,m=d*s+f*o,_=d*r+f*o;if(Math.max(p,g,m,_)<=d*a.x+f*a.y||Math.min(p,g,m,_)>=d*h.x+f*h.y)return!1;const x=u*(a.y-c.y),y=u*(c.x-a.x),v=x*s+y*n,C=x*r+y*n,S=x*s+y*o,b=x*r+y*o;return!(Math.max(v,C,S,b)<=x*a.x+y*a.y||Math.min(v,C,S,b)>=x*h.x+y*h.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){const t=Math.max(this.x,e.x),s=Math.min(this.x+this.width,e.x+e.width),r=Math.max(this.y,e.y),n=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(s-t,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(e=1,t=.001){const s=Math.ceil((this.x+this.width-t)*e)/e,r=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=s-this.x,this.height=r-this.y,this}scale(e,t=e){return this.x*=e,this.y*=t,this.width*=e,this.height*=t,this}enlarge(e){const t=Math.min(this.x,e.x),s=Math.max(this.x+this.width,e.x+e.width),r=Math.min(this.y,e.y),n=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=s-t,this.y=r,this.height=n-r,this}getBounds(e){return e||(e=new V),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;const t=e.x,s=e.y,r=e.x+e.width,n=e.y+e.height;return t>=this.x&&t<this.x+this.width&&s>=this.y&&s<this.y+this.height&&r>=this.x&&r<this.x+this.width&&n>=this.y&&n<this.y+this.height}set(e,t,s,r){return this.x=e,this.y=t,this.width=s,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const qh={default:-1};function pe(i="default"){return qh[i]===void 0&&(qh[i]=-1),++qh[i]}const bp=new Set,ie="8.0.0",yT="8.3.4",Ri={quiet:!1,noColor:!1},W=(i,e,t=3)=>{if(Ri.quiet||bp.has(e))return;let s=new Error().stack;const r=`${e}
66
+ `.replace(/\t/g,"").replace(/#/g,"%23");return o.src=`data:image/svg+xml;charset=utf-8,${l}`,await new Promise(c=>{o.onload=c}),o}async function sT(i,e,t={}){const s=await iT(i,e,t),r=new OffscreenCanvas(s.width,s.height);return r.getContext("2d")?.drawImage(s,0,0,s.width,s.height),await createImageBitmap(r)}async function rT(i,e){const t={type:e,data:i},s=new ImageDecoder(t);await Promise.all([s.completed,s.tracks.ready]);const r=s.tracks.selectedTrack?.frameCount??1,n=[];for(let o=0;o<r;o+=1)n.push((await s.decode({frameIndex:o})).image);return n}let Lh=class{all=new Map;on(e,t){const s=this.all.get(e);return s?s.push(t):this.all.set(e,[t]),()=>this.off(e,t)}once(e,t){const s=this.on(e,r=>{s(),t(r)});return s}off(e,t){const s=this.all.get(e);s&&(t?s.splice(s.indexOf(t)>>>0,1):this.all.set(e,[]))}emit(e,t){let s=this.all.get(e);s&&s.slice().forEach(r=>{r(t)}),s=this.all.get("*"),s&&s.slice().forEach(r=>{r(e,t)})}};class nT extends Lh{id="";name="";display={from:0,to:0};duration=0;playbackRate=1;trim={from:0,to:0};constructor(){super()}_left=0;get left(){return this._left}set left(e){const t=this._left!==e;this._left=e,t&&this.emit("propsChange",{left:e})}_top=0;get top(){return this._top}set top(e){const t=this._top!==e;this._top=e,t&&this.emit("propsChange",{top:e})}_width=0;get width(){return this._width}set width(e){const t=this._width!==e;this._width=e,t&&this.emit("propsChange",{width:e})}_height=0;get height(){return this._height}set height(e){const t=this._height!==e;this._height=e,t&&this.emit("propsChange",{height:e})}_angle=0;get angle(){return this._angle}set angle(e){const t=this._angle!==e;this._angle=e,t&&this.emit("propsChange",{angle:e})}get center(){return{x:this.left+this.width/2,y:this.top+this.height/2}}_zIndex=0;get zIndex(){return this._zIndex}set zIndex(e){const t=this._zIndex!==e;this._zIndex=e,t&&this.emit("propsChange",{zIndex:e})}_opacity=1;get opacity(){return this._opacity}set opacity(e){const t=this._opacity!==e;this._opacity=e,t&&this.emit("propsChange",{opacity:e})}_volume=1;get volume(){return this._volume}set volume(e){const t=this._volume!==e;this._volume=e,t&&this.emit("propsChange",{volume:e})}flip=null;effects=[];_style={};get style(){return this._style}set style(e){this._style=e}animatKeyFrame=null;animatOpts=null;ready=Promise.resolve();_render(e){const{center:t}=this;e.setTransform(this.flip==="horizontal"?-1:1,0,0,this.flip==="vertical"?-1:1,t.x,t.y);const s=this.angle*Math.PI/180;e.rotate((this.flip==null?1:-1)*s),e.globalAlpha=this.opacity}setAnimation(e,t){this.animatKeyFrame=Object.entries(e).map(([s,r])=>{const n={from:0,to:100}[s]??Number(s.slice(0,-1));if(isNaN(n)||n>100||n<0)throw Error("keyFrame must between 0~100");return[n/100,r]}),this.animatOpts=Object.assign({},this.animatOpts,{duration:t.duration,delay:t.delay??0,iterCount:t.iterCount??1/0})}animate(e){if(this.animatKeyFrame==null||this.animatOpts==null||e<this.animatOpts.delay)return;const t=oT(e,this.animatKeyFrame,this.animatOpts);for(const s in t)switch(s){case"opacity":this.opacity=t[s];break;case"x":this.left=t[s];break;case"y":this.top=t[s];break;case"w":this.width=t[s];break;case"h":this.height=t[s];break;case"angle":this.angle=t[s];break}}copyStateTo(e){e.animatKeyFrame=this.animatKeyFrame,e.animatOpts=this.animatOpts,e.zIndex=this.zIndex,e.opacity=this.opacity,e.volume=this.volume,e.flip=this.flip,e.left=this.left,e.top=this.top,e.width=this.width,e.height=this.height,e.angle=this.angle,e.display={...this.display},e.duration=this.duration,e.playbackRate=this.playbackRate,e.trim={...this.trim},e.style=JSON.parse(JSON.stringify(this.style||{})),"src"in this&&"src"in e&&(e.src=this.src)}update(e){Object.assign(this,e),this.emit("propsChange",e)}destroy(){this.all.clear()}}function oT(i,e,t){const s=i-t.delay,r=s%t.duration,n=s/t.duration>=t.iterCount||s===t.duration?1:r/t.duration,o=e.findIndex(f=>f[0]>=n);if(o===-1)return{};const a=e[o-1],l=e[o],c=l[1];if(a==null)return c;const h=a[1],u={},d=(n-a[0])/(l[0]-a[0]);for(const f in c){if(!Object.hasOwn(c,f)||typeof f!="string")continue;const p=f;h[p]!=null&&(u[p]=(c[p]-h[p])*d+h[p])}return u}class Yt extends nT{lastVf=null;destroyed=!1;src="";transition;constructor(){super()}async getFrame(e){const t=e*this.playbackRate,{video:s,audio:r,state:n}=await this.tick(t);let o=r??[];r!=null&&this.playbackRate!==1&&(o=r.map(l=>gp(l,this.playbackRate)));let a=null;return s!=null?(this.lastVf?.close(),s instanceof VideoFrame?(a=await createImageBitmap(s),s.close()):a=s,this.lastVf=a):this.lastVf!=null&&(a=this.lastVf),{video:a,audio:o,done:n==="done"}}async offscreenRender(e,t){const s=t*this.playbackRate;this.animate(s),super._render(e);const{width:r,height:n}=this,{video:o,audio:a,state:l}=await this.tick(s);let c=a??[];if(a!=null&&this.playbackRate!==1&&(c=a.map(u=>gp(u,this.playbackRate))),l==="done")return{audio:c,done:!0};const h=o??this.lastVf;if(h!=null){const u=this.style.borderRadius||0,d=this.style.dropShadow;if(e.save(),d&&(d.blur>0||d.distance>0)){const p=d.distance??0,g=d.angle??0;e.shadowColor=d.color||"#000000",e.shadowBlur=d.blur||0,e.shadowOffsetX=Math.cos(g)*p,e.shadowOffsetY=Math.sin(g)*p}if(u>0){const p=Math.min(u,r/2,n/2);e.beginPath(),e.roundRect(-r/2,-n/2,r,n,p),e.clip()}e.drawImage(h,-r/2,-n/2,r,n),e.restore();const f=this.style.stroke;if(f&&f.width>0){if(e.save(),e.strokeStyle=f.color,e.lineWidth=f.width,u>0){const p=Math.min(u,r/2,n/2);e.beginPath(),e.roundRect(-r/2,-n/2,r,n,p),e.stroke()}else e.strokeRect(-r/2,-n/2,r,n);e.restore()}}return o!=null&&(this.lastVf?.close(),o instanceof ImageBitmap&&(this.lastVf=o)),{audio:c,done:!1}}set(e,t=30){if(e.display&&(e.display.from!==void 0&&(this.display.from=e.display.from<1e6?e.display.from/t*1e6:e.display.from),e.display.to!==void 0&&(this.display.to=e.display.to<1e6?e.display.to/t*1e6:e.display.to)),e.x!==void 0&&(this.left=e.x),e.y!==void 0&&(this.top=e.y),e.width!==void 0&&(this.width=e.width),e.height!==void 0&&(this.height=e.height),e.duration!==void 0){const s=e.duration<1e6?e.duration/t*1e6:e.duration;this.duration=s,this.display.from!==void 0&&(this.display.to=this.display.from+s)}return this}toJSON(e=!1){const t=this.animatKeyFrame&&this.animatOpts?{keyFrames:this.animatKeyFrame.reduce((s,[r,n])=>{const o=r===0?"from":r===1?"to":`${Math.round(r*100)}%`;return s[o]=n,s},{}),opts:this.animatOpts}:void 0;return{type:this.constructor.name,id:this.id,name:this.name,src:this.src,display:{from:this.display.from,to:this.display.to},playbackRate:this.playbackRate,duration:this.duration,left:this.left,top:this.top,width:this.width,height:this.height,angle:this.angle,zIndex:this.zIndex,opacity:this.opacity,flip:this.flip,style:this.style,trim:{from:this.trim.from,to:this.trim.to},...t&&{animation:t},...e&&{main:!0}}}getVisibleHandles(){return["tl","tr","bl","br","ml","mr","mt","mb","rot"]}async scaleToFit(e,t){await this.ready;const{width:s,height:r}=this.meta;if(s===0||r===0)return;const n=Math.min(e/s,t/r);this.width=s*n,this.height=r*n}async scaleToFill(e,t){await this.ready;const{width:s,height:r}=this.meta;if(s===0||r===0)return;const n=Math.max(e/s,t/r);this.width=s*n,this.height=r*n}centerInScene(e,t){this.left=(e-this.width)/2,this.top=(t-this.height)/2}destroy(){this.destroyed||(this.destroyed=!0,Z.info("BaseClip destroy"),super.destroy(),this.lastVf?.close(),this.lastVf=null)}}let Hh=null;async function xp(){return Hh===null&&(Hh=z1()),await Hh}const ue={get codec(){return xr()?.codec??"mp4a.40.2"},get codecType(){return xr()?.codecType??"aac"},get sampleRate(){return xr()?.sampleRate??48e3},get channelCount(){return xr()?.channelCount??2}};class Ii{static async getCacheKey(e){const s=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-1",s);return Array.from(new Uint8Array(r)).map(o=>o.toString(16).padStart(2,"0")).join("")}static getPath(e){return`assets/${e}`}static async get(e){const t=await this.getCacheKey(e),s=this.getPath(t),r=ni(s);return await r.exists()?r:null}static async put(e,t){const s=await this.getCacheKey(e),r=this.getPath(s),n=ni(r);return await Si(n,t),n}}class Pi{resources=new Map;loadingPromises=new Map;async preload(e){const s=[...new Set(e)].filter(r=>r&&!r.startsWith("data:")&&!r.startsWith("blob:")).map(r=>this.loadResource(r));await Promise.allSettled(s)}static async getReadableStream(e){const t=await Ii.get(e);if(t){const a=await t.getOriginFile();if(a)return a.stream()}const s=await fetch(e);if(!s.ok)throw new Error(`Failed to fetch: ${s.status} ${s.statusText}`);const r=s.body;if(!r)throw new Error("Response body is null");if(e.startsWith("data:")||e.startsWith("blob:"))return r;const[n,o]=r.tee();return Ii.put(e,o).catch(a=>{console.error(`ResourceManager: Failed to cache ${e}`,a)}),n}static async getImageBitmap(e){const t=await Ii.get(e);if(t){const l=await t.getOriginFile();if(l)return await createImageBitmap(l)}if(e.startsWith("data:")||e.startsWith("blob:")){const c=await(await fetch(e)).blob();return await createImageBitmap(c)}const s=await fetch(e);if(!s.ok)throw new Error(`Failed to fetch: ${s.status} ${s.statusText}`);const r=s.body;if(!r)throw new Error("Response body is null");const[n,o]=r.tee(),a=(async()=>{const c=await new Response(n).blob();return await createImageBitmap(c)})();return Ii.put(e,o).catch(l=>{console.error(`ResourceManager: Failed to cache ${e}`,l)}),await a}async loadResource(e){const t=this.loadingPromises.get(e);if(t)return t;if(this.resources.has(e)){const r=this.resources.get(e);if(r.status==="completed")return r}const s=(async()=>{const r={url:e,status:"loading"};this.resources.set(e,r);try{const n=await Ii.get(e);if(n)return r.status="completed",r.localFile=n,r;const o=await fetch(e);if(!o.ok)throw new Error(`Fetch failed: ${o.status}`);const a=o.body;if(!a)throw new Error("No body");const l=await Ii.put(e,a);return r.status="completed",r.localFile=l,r}catch(n){return r.status="failed",r.error=n instanceof Error?n:new Error(String(n)),r}finally{this.loadingPromises.delete(e)}})();return this.loadingPromises.set(e,s),s}async resolve(e){if(!e||e.startsWith("data:")||e.startsWith("blob:"))return e;const t=await this.loadResource(e);return t.status==="completed"&&t.localFile?t.localFile:e}getStatus(e){return this.resources.get(e)}clear(){this.resources.clear(),this.loadingPromises.clear()}}class at extends Yt{type="Audio";static ctx=null;ready;_meta={duration:0,width:0,height:0};get meta(){return{...this._meta,sampleRate:ue.sampleRate,chanCount:2}}chan0Buf=new Float32Array;chan1Buf=new Float32Array;getPCMData(){return[this.chan0Buf,this.chan1Buf]}opts;loop=!1;static async fromUrl(e,t={}){const s=await Pi.getReadableStream(e),r=new at(s,t,e);return await r.ready,r}static async fromObject(e){if(e.type!=="Audio")throw new Error(`Expected Audio, got ${e.type}`);if(!e.src||e.src.trim()==="")throw new Error("Audio requires a valid source URL");const t={};e.loop!==void 0&&(t.loop=e.loop),e.volume!==void 0&&(t.volume=e.volume);const s=await at.fromUrl(e.src,t);return s.left=e.left,s.top=e.top,s.width=e.width,s.height=e.height,s.angle=e.angle,s.display.from=e.display.from,s.display.to=e.display.to,s.duration=e.duration,s.playbackRate=e.playbackRate,s.zIndex=e.zIndex,s.opacity=e.opacity,s.flip=e.flip,e.animation&&s.setAnimation(e.animation.keyFrames,e.animation.opts),s}constructor(e,t={},s){super(),this.src=s!==void 0?s:"",this.opts={loop:!1,volume:1,...t},this.loop=this.opts.loop??!1,this.volume=this.opts.volume??1,this.ready=this.init(e).then(r=>{const n={width:0,height:0,duration:t.loop?1/0:this._meta.duration};return this.width=this.width===0?n.width:this.width,this.height=this.height===0?n.height:this.height,this.duration=this.duration===0?n.duration:this.duration,this.display.to=this.display.from+this.duration,n})}async init(e){at.ctx==null&&(at.ctx=new AudioContext({sampleRate:ue.sampleRate}));const t=performance.now(),s=e instanceof ReadableStream?await lT(e,at.ctx):e;Z.info("Audio clip decoded complete:",performance.now()-t),this._meta.duration=s[0].length/ue.sampleRate*1e6,this.chan0Buf=s[0],this.chan1Buf=s[1]??this.chan0Buf,Z.info("Audio clip convert to AudioData, time:",performance.now()-t)}tickInterceptor=async(e,t)=>t;timestamp=0;frameOffset=0;async tick(e){if(!this.opts.loop&&e>=this._meta.duration)return await this.tickInterceptor(e,{audio:[],state:"done"});const t=e-this.timestamp;if(e<this.timestamp||t>3e6)return this.timestamp=e,this.frameOffset=Math.ceil(this.timestamp/1e6*ue.sampleRate),await this.tickInterceptor(e,{audio:[new Float32Array(0),new Float32Array(0)],state:"success"});this.timestamp=e;const s=Math.ceil(t/1e6*ue.sampleRate),r=this.frameOffset+s,n=this.opts.loop?[Gh(this.chan0Buf,this.frameOffset,r),Gh(this.chan1Buf,this.frameOffset,r)]:[this.chan0Buf.slice(this.frameOffset,r),this.chan1Buf.slice(this.frameOffset,r)];if(this.volume!==1)for(const o of n)for(let a=0;a<o.length;a++)o[a]*=this.volume;return this.frameOffset=r,await this.tickInterceptor(e,{audio:n,state:"success"})}async split(e){await this.ready;const t=Math.ceil(e/1e6*ue.sampleRate),s=new at(this.getPCMData().map(n=>n.slice(0,t)),this.opts,this.src),r=new at(this.getPCMData().map(n=>n.slice(t)),this.opts,this.src);return[s,r]}async clone(){await this.ready;const e=new at(this.getPCMData(),this.opts,this.src);return await e.ready,this.copyStateTo(e),e}destroy(){this.chan0Buf=new Float32Array(0),this.chan1Buf=new Float32Array(0),Z.info("---- audioclip destroy ----"),super.destroy()}toJSON(e=!1){return{...super.toJSON(e),type:"Audio",loop:this.loop,id:this.id,volume:this.volume}}static concatAudio=aT;async createPlaybackElement(){if(await this.ready,!this.src||this.src.trim()==="")throw new Error("Audio requires a source URL for playback");const e=this.src.startsWith("blob:")?this.src:void 0,t=document.createElement("audio");return t.crossOrigin="anonymous",t.autoplay=!1,t.preload="auto",t.loop=this.opts.loop||!1,t.src=this.src,await new Promise((s,r)=>{const n=()=>{t.removeEventListener("loadeddata",n),t.removeEventListener("error",o),t.pause(),t.currentTime=0,s()},o=()=>{t.removeEventListener("loadeddata",n),t.removeEventListener("error",o),r(new Error("Failed to load audio"))};t.addEventListener("loadeddata",n,{once:!0}),t.addEventListener("error",o,{once:!0}),t.load()}),{element:t,objectUrl:e}}async play(e,t){const s=e;if(Math.abs(s.currentTime-t)>.1&&(s.currentTime=t),s.paused)try{await s.play()}catch{try{await s.play()}catch(n){console.warn("Failed to play audio:",n)}}}pause(e){e.pause()}async seek(e,t){const s=e;return s.pause(),s.currentTime=t,new Promise(r=>{if(Math.abs(s.currentTime-t)<.01){r();return}const n=()=>{s.removeEventListener("seeked",n),r()};s.addEventListener("seeked",n,{once:!0}),setTimeout(()=>{s.removeEventListener("seeked",n),r()},500)})}syncPlayback(e,t,s){const r=e,n=this.meta.duration/1e6,o=s>=0&&s<n;r.volume=this.volume,t&&o?r.paused&&this.play(r,s).catch(console.warn):(r.paused||r.pause(),o&&Math.abs(r.currentTime-s)>.1&&(r.currentTime=s))}cleanupPlayback(e,t){const s=e;s.pause(),s.removeAttribute("src"),s.load(),t&&t.startsWith("blob:")&&URL.revokeObjectURL(t)}}async function aT(i,e){const t=[];for(const s of i)await s.ready,t.push(s.getPCMData());return new at(fp(t),e)}async function lT(i,e){const t=await new Response(i).arrayBuffer();return Dh(await e.decodeAudioData(t))}var T=(i=>(i.Application="application",i.WebGLPipes="webgl-pipes",i.WebGLPipesAdaptor="webgl-pipes-adaptor",i.WebGLSystem="webgl-system",i.WebGPUPipes="webgpu-pipes",i.WebGPUPipesAdaptor="webgpu-pipes-adaptor",i.WebGPUSystem="webgpu-system",i.CanvasSystem="canvas-system",i.CanvasPipesAdaptor="canvas-pipes-adaptor",i.CanvasPipes="canvas-pipes",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i.MaskEffect="mask-effect",i.BlendMode="blend-mode",i.TextureSource="texture-source",i.Environment="environment",i.ShapeBuilder="shape-builder",i.Batcher="batcher",i))(T||{});const Wh=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},vr=(i,e)=>Wh(i).priority??e,q={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Wh).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...i){return i.map(Wh).forEach(e=>{e.type.forEach(t=>{const s=this._addHandlers,r=this._queue;s[t]?s[t]?.(e):(r[t]=r[t]||[],r[t]?.push(e))})}),this},handle(i,e,t){const s=this._addHandlers,r=this._removeHandlers;if(s[i]||r[i])throw new Error(`Extension type ${i} already has a handler`);s[i]=e,r[i]=t;const n=this._queue;return n[i]&&(n[i]?.forEach(o=>e(o)),delete n[i]),this},handleByMap(i,e){return this.handle(i,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByNamedList(i,e,t=-1){return this.handle(i,s=>{e.findIndex(n=>n.name===s.name)>=0||(e.push({name:s.name,value:s.ref}),e.sort((n,o)=>vr(o.value,t)-vr(n.value,t)))},s=>{const r=e.findIndex(n=>n.name===s.name);r!==-1&&e.splice(r,1)})},handleByList(i,e,t=-1){return this.handle(i,s=>{e.includes(s.ref)||(e.push(s.ref),e.sort((r,n)=>vr(n,t)-vr(r,t)))},s=>{const r=e.indexOf(s.ref);r!==-1&&e.splice(r,1)})},mixin(i,...e){for(const t of e)Object.defineProperties(i.prototype,Object.getOwnPropertyDescriptors(t))}},cT={extension:{type:T.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(()=>QR)}},hT={extension:{type:T.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(()=>eM)}};class Ue{constructor(e,t,s){this._x=t||0,this._y=s||0,this._observer=e}clone(e){return new Ue(e??this._observer,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this._observer._onUpdate(this)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this._observer._onUpdate(this)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this._observer._onUpdate(this))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this._observer._onUpdate(this))}}function Vh(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var $h={exports:{}},yp;function uT(){return yp||(yp=1,(function(i){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function r(l,c,h){this.fn=l,this.context=c,this.once=h||!1}function n(l,c,h,u,d){if(typeof h!="function")throw new TypeError("The listener must be a function");var f=new r(h,u||l,d),p=t?t+c:c;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],f]:l._events[p].push(f):(l._events[p]=f,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new s:delete l._events[c]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],h,u;if(this._eventsCount===0)return c;for(u in h=this._events)e.call(h,u)&&c.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(h)):c},a.prototype.listeners=function(c){var h=t?t+c:c,u=this._events[h];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,f=u.length,p=new Array(f);d<f;d++)p[d]=u[d].fn;return p},a.prototype.listenerCount=function(c){var h=t?t+c:c,u=this._events[h];return u?u.fn?1:u.length:0},a.prototype.emit=function(c,h,u,d,f,p){var g=t?t+c:c;if(!this._events[g])return!1;var m=this._events[g],_=arguments.length,x,y;if(m.fn){switch(m.once&&this.removeListener(c,m.fn,void 0,!0),_){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,h),!0;case 3:return m.fn.call(m.context,h,u),!0;case 4:return m.fn.call(m.context,h,u,d),!0;case 5:return m.fn.call(m.context,h,u,d,f),!0;case 6:return m.fn.call(m.context,h,u,d,f,p),!0}for(y=1,x=new Array(_-1);y<_;y++)x[y-1]=arguments[y];m.fn.apply(m.context,x)}else{var v=m.length,C;for(y=0;y<v;y++)switch(m[y].once&&this.removeListener(c,m[y].fn,void 0,!0),_){case 1:m[y].fn.call(m[y].context);break;case 2:m[y].fn.call(m[y].context,h);break;case 3:m[y].fn.call(m[y].context,h,u);break;case 4:m[y].fn.call(m[y].context,h,u,d);break;default:if(!x)for(C=1,x=new Array(_-1);C<_;C++)x[C-1]=arguments[C];m[y].fn.apply(m[y].context,x)}}return!0},a.prototype.on=function(c,h,u){return n(this,c,h,u,!1)},a.prototype.once=function(c,h,u){return n(this,c,h,u,!0)},a.prototype.removeListener=function(c,h,u,d){var f=t?t+c:c;if(!this._events[f])return this;if(!h)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===h&&(!d||p.once)&&(!u||p.context===u)&&o(this,f);else{for(var g=0,m=[],_=p.length;g<_;g++)(p[g].fn!==h||d&&!p[g].once||u&&p[g].context!==u)&&m.push(p[g]);m.length?this._events[f]=m.length===1?m[0]:m:o(this,f)}return this},a.prototype.removeAllListeners=function(c){var h;return c?(h=t?t+c:c,this._events[h]&&o(this,h)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,i.exports=a})($h)),$h.exports}var dT=uT();const Je=Vh(dT),fT=Math.PI*2,pT=180/Math.PI,mT=Math.PI/180;class X{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new X(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Xh.x=0,Xh.y=0,Xh}}const Xh=new X;class G{constructor(e=1,t=0,s=0,r=1,n=0,o=0){this.array=null,this.a=e,this.b=t,this.c=s,this.d=r,this.tx=n,this.ty=o}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,s,r,n,o){return this.a=e,this.b=t,this.c=s,this.d=r,this.tx=n,this.ty=o,this}toArray(e,t){this.array||(this.array=new Float32Array(9));const s=t||this.array;return e?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(e,t){t=t||new X;const s=e.x,r=e.y;return t.x=this.a*s+this.c*r+this.tx,t.y=this.b*s+this.d*r+this.ty,t}applyInverse(e,t){t=t||new X;const s=this.a,r=this.b,n=this.c,o=this.d,a=this.tx,l=this.ty,c=1/(s*o+n*-r),h=e.x,u=e.y;return t.x=o*c*h+-n*c*u+(l*n-a*o)*c,t.y=s*c*u+-r*c*h+(-l*s+a*r)*c,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){const t=Math.cos(e),s=Math.sin(e),r=this.a,n=this.c,o=this.tx;return this.a=r*t-this.b*s,this.b=r*s+this.b*t,this.c=n*t-this.d*s,this.d=n*s+this.d*t,this.tx=o*t-this.ty*s,this.ty=o*s+this.ty*t,this}append(e){const t=this.a,s=this.b,r=this.c,n=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*s+e.b*n,this.c=e.c*t+e.d*r,this.d=e.c*s+e.d*n,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*s+e.ty*n+this.ty,this}appendFrom(e,t){const s=e.a,r=e.b,n=e.c,o=e.d,a=e.tx,l=e.ty,c=t.a,h=t.b,u=t.c,d=t.d;return this.a=s*c+r*u,this.b=s*h+r*d,this.c=n*c+o*u,this.d=n*h+o*d,this.tx=a*c+l*u+t.tx,this.ty=a*h+l*d+t.ty,this}setTransform(e,t,s,r,n,o,a,l,c){return this.a=Math.cos(a+c)*n,this.b=Math.sin(a+c)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=e-(s*this.a+r*this.c),this.ty=t-(s*this.b+r*this.d),this}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const s=this.a,r=this.c;this.a=s*e.a+this.b*e.c,this.b=s*e.b+this.b*e.d,this.c=r*e.a+this.d*e.c,this.d=r*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){const t=this.a,s=this.b,r=this.c,n=this.d,o=e.pivot,a=-Math.atan2(-r,n),l=Math.atan2(s,t),c=Math.abs(a+l);return c<1e-5||Math.abs(fT-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(t*t+s*s),e.scale.y=Math.sqrt(r*r+n*n),e.position.x=this.tx+(o.x*t+o.y*r),e.position.y=this.ty+(o.x*s+o.y*n),e}invert(){const e=this.a,t=this.b,s=this.c,r=this.d,n=this.tx,o=e*r-t*s;return this.a=r/o,this.b=-t/o,this.c=-s/o,this.d=e/o,this.tx=(s*this.ty-r*n)/o,this.ty=-(e*this.ty-t*n)/o,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const e=new G;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}equals(e){return e.a===this.a&&e.b===this.b&&e.c===this.c&&e.d===this.d&&e.tx===this.tx&&e.ty===this.ty}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return _T.identity()}static get shared(){return gT.identity()}}const gT=new G,_T=new G,oi=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],ai=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],li=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ci=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Yh=[],vp=[],br=Math.sign;function xT(){for(let i=0;i<16;i++){const e=[];Yh.push(e);for(let t=0;t<16;t++){const s=br(oi[i]*oi[t]+li[i]*ai[t]),r=br(ai[i]*oi[t]+ci[i]*ai[t]),n=br(oi[i]*li[t]+li[i]*ci[t]),o=br(ai[i]*li[t]+ci[i]*ci[t]);for(let a=0;a<16;a++)if(oi[a]===s&&ai[a]===r&&li[a]===n&&ci[a]===o){e.push(a);break}}}for(let i=0;i<16;i++){const e=new G;e.set(oi[i],ai[i],li[i],ci[i],0,0),vp.push(e)}}xT();const de={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>oi[i],uY:i=>ai[i],vX:i=>li[i],vY:i=>ci[i],inv:i=>i&8?i&15:-i&7,add:(i,e)=>Yh[i][e],sub:(i,e)=>Yh[i][de.inv(e)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,e)=>Math.abs(i)*2<=Math.abs(e)?e>=0?de.S:de.N:Math.abs(e)*2<=Math.abs(i)?i>0?de.E:de.W:e>0?i>0?de.SE:de.SW:i>0?de.NE:de.NW,matrixAppendRotationInv:(i,e,t=0,s=0)=>{const r=vp[de.inv(e)];r.tx=t,r.ty=s,i.append(r)},transformRectCoords:(i,e,t,s)=>{const{x:r,y:n,width:o,height:a}=i,{x:l,y:c,width:h,height:u}=e;return t===de.E?(s.set(r+l,n+c,o,a),s):t===de.S?s.set(h-n-a+l,r+c,a,o):t===de.W?s.set(h-r-o+l,u-n-a+c,o,a):t===de.N?s.set(n+l,u-r-o+c,a,o):s.set(r+l,n+c,o,a)}},wr=[new X,new X,new X,new X];class V{constructor(e=0,t=0,s=0,r=0){this.type="rectangle",this.x=Number(e),this.y=Number(t),this.width=Number(s),this.height=Number(r)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new V(0,0,0,0)}clone(){return new V(this.x,this.y,this.width,this.height)}copyFromBounds(e){return this.x=e.minX,this.y=e.minY,this.width=e.maxX-e.minX,this.height=e.maxY-e.minY,this}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.copyFrom(this),e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}strokeContains(e,t,s,r=.5){const{width:n,height:o}=this;if(n<=0||o<=0)return!1;const a=this.x,l=this.y,c=s*(1-r),h=s-c,u=a-c,d=a+n+c,f=l-c,p=l+o+c,g=a+h,m=a+n-h,_=l+h,x=l+o-h;return e>=u&&e<=d&&t>=f&&t<=p&&!(e>g&&e<m&&t>_&&t<x)}intersects(e,t){if(!t){const P=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=P)return!1;const w=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>w}const s=this.left,r=this.right,n=this.top,o=this.bottom;if(r<=s||o<=n)return!1;const a=wr[0].set(e.left,e.top),l=wr[1].set(e.left,e.bottom),c=wr[2].set(e.right,e.top),h=wr[3].set(e.right,e.bottom);if(c.x<=a.x||l.y<=a.y)return!1;const u=Math.sign(t.a*t.d-t.b*t.c);if(u===0||(t.apply(a,a),t.apply(l,l),t.apply(c,c),t.apply(h,h),Math.max(a.x,l.x,c.x,h.x)<=s||Math.min(a.x,l.x,c.x,h.x)>=r||Math.max(a.y,l.y,c.y,h.y)<=n||Math.min(a.y,l.y,c.y,h.y)>=o))return!1;const d=u*(l.y-a.y),f=u*(a.x-l.x),p=d*s+f*n,g=d*r+f*n,m=d*s+f*o,_=d*r+f*o;if(Math.max(p,g,m,_)<=d*a.x+f*a.y||Math.min(p,g,m,_)>=d*h.x+f*h.y)return!1;const x=u*(a.y-c.y),y=u*(c.x-a.x),v=x*s+y*n,C=x*r+y*n,S=x*s+y*o,b=x*r+y*o;return!(Math.max(v,C,S,b)<=x*a.x+y*a.y||Math.min(v,C,S,b)>=x*h.x+y*h.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){const t=Math.max(this.x,e.x),s=Math.min(this.x+this.width,e.x+e.width),r=Math.max(this.y,e.y),n=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(s-t,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(e=1,t=.001){const s=Math.ceil((this.x+this.width-t)*e)/e,r=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=s-this.x,this.height=r-this.y,this}scale(e,t=e){return this.x*=e,this.y*=t,this.width*=e,this.height*=t,this}enlarge(e){const t=Math.min(this.x,e.x),s=Math.max(this.x+this.width,e.x+e.width),r=Math.min(this.y,e.y),n=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=s-t,this.y=r,this.height=n-r,this}getBounds(e){return e||(e=new V),e.copyFrom(this),e}containsRect(e){if(this.width<=0||this.height<=0)return!1;const t=e.x,s=e.y,r=e.x+e.width,n=e.y+e.height;return t>=this.x&&t<this.x+this.width&&s>=this.y&&s<this.y+this.height&&r>=this.x&&r<this.x+this.width&&n>=this.y&&n<this.y+this.height}set(e,t,s,r){return this.x=e,this.y=t,this.width=s,this.height=r,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const qh={default:-1};function pe(i="default"){return qh[i]===void 0&&(qh[i]=-1),++qh[i]}const bp=new Set,ie="8.0.0",yT="8.3.4",Ri={quiet:!1,noColor:!1},W=(i,e,t=3)=>{if(Ri.quiet||bp.has(e))return;let s=new Error().stack;const r=`${e}
67
67
  Deprecated since v${i}`,n=typeof console.groupCollapsed=="function"&&!Ri.noColor;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",r):(s=s.split(`
68
68
  `).splice(t).join(`
69
69
  `),n?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",r),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",r),console.warn(s))),bp.add(e)};Object.defineProperties(W,{quiet:{get:()=>Ri.quiet,set:i=>{Ri.quiet=i},enumerable:!0,configurable:!1},noColor:{get:()=>Ri.noColor,set:i=>{Ri.noColor=i},enumerable:!0,configurable:!1}});const wp=()=>{};function Mi(i){return i+=i===0?1:0,--i,i|=i>>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Tp(i){return!(i&i-1)&&!!i}function Sp(i){const e={};for(const t in i)i[t]!==void 0&&(e[t]=i[t]);return e}const Cp=Object.create(null);function vT(i){const e=Cp[i];return e===void 0&&(Cp[i]=pe("resource")),e}const Ep=class bx extends Je{constructor(e={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,e={...bx.defaultOptions,...e},this.addressMode=e.addressMode,this.addressModeU=e.addressModeU??this.addressModeU,this.addressModeV=e.addressModeV??this.addressModeV,this.addressModeW=e.addressModeW??this.addressModeW,this.scaleMode=e.scaleMode,this.magFilter=e.magFilter??this.magFilter,this.minFilter=e.minFilter??this.minFilter,this.mipmapFilter=e.mipmapFilter??this.mipmapFilter,this.lodMinClamp=e.lodMinClamp,this.lodMaxClamp=e.lodMaxClamp,this.compare=e.compare,this.maxAnisotropy=e.maxAnisotropy??1}set addressMode(e){this.addressModeU=e,this.addressModeV=e,this.addressModeW=e}get addressMode(){return this.addressModeU}set wrapMode(e){W(ie,"TextureStyle.wrapMode is now TextureStyle.addressMode"),this.addressMode=e}get wrapMode(){return this.addressMode}set scaleMode(e){this.magFilter=e,this.minFilter=e,this.mipmapFilter=e}get scaleMode(){return this.magFilter}set maxAnisotropy(e){this._maxAnisotropy=Math.min(e,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){const e=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=vT(e),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Ep.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let qt=Ep;const Ap=class wx extends Je{constructor(e={}){super(),this.options=e,this.uid=pe("textureSource"),this._resourceType="textureSource",this._resourceId=pe("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,e={...wx.defaultOptions,...e},this.label=e.label??"",this.resource=e.resource,this.autoGarbageCollect=e.autoGarbageCollect,this._resolution=e.resolution,e.width?this.pixelWidth=e.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,e.height?this.pixelHeight=e.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=e.format,this.dimension=e.dimensions,this.mipLevelCount=e.mipLevelCount,this.autoGenerateMipmaps=e.autoGenerateMipmaps,this.sampleCount=e.sampleCount,this.antialias=e.antialias,this.alphaMode=e.alphaMode,this.style=new qt(Sp(e)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(e){this.style!==e&&(this._style?.off("change",this._onStyleChange,this),this._style=e,this._style?.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(e){this._style.maxAnisotropy=e}get maxAnisotropy(){return this._style.maxAnisotropy}get addressMode(){return this._style.addressMode}set addressMode(e){this._style.addressMode=e}get repeatMode(){return this._style.addressMode}set repeatMode(e){this._style.addressMode=e}get magFilter(){return this._style.magFilter}set magFilter(e){this._style.magFilter=e}get minFilter(){return this._style.minFilter}set minFilter(e){this._style.minFilter=e}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(e){this._style.mipmapFilter=e}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(e){this._style.lodMinClamp=e}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(e){this._style.lodMaxClamp=e}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const e=this._resolution;if(this.resize(this.resourceWidth/e,this.resourceHeight/e))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=pe("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){const{resource:e}=this;return e.naturalWidth||e.videoWidth||e.displayWidth||e.width}get resourceHeight(){const{resource:e}=this;return e.naturalHeight||e.videoHeight||e.displayHeight||e.height}get resolution(){return this._resolution}set resolution(e){this._resolution!==e&&(this._resolution=e,this.width=this.pixelWidth/e,this.height=this.pixelHeight/e)}resize(e,t,s){s||(s=this._resolution),e||(e=this.width),t||(t=this.height);const r=Math.round(e*s),n=Math.round(t*s);return this.width=r/s,this.height=n/s,this._resolution=s,this.pixelWidth===r&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=r,this.pixelHeight=n,this.emit("resize",this),this._resourceId=pe("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(e){this._style.wrapMode=e}get wrapMode(){return this._style.wrapMode}set scaleMode(e){this._style.scaleMode=e}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=Tp(this.pixelWidth)&&Tp(this.pixelHeight)}static test(e){throw new Error("Unimplemented")}};Ap.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let Ie=Ap;class Kh extends Ie{constructor(e){const t=e.resource||new Float32Array(e.width*e.height*4);let s=e.format;s||(t instanceof Float32Array?s="rgba32float":t instanceof Int32Array||t instanceof Uint32Array?s="rgba32uint":t instanceof Int16Array||t instanceof Uint16Array?s="rgba16uint":(t instanceof Int8Array,s="bgra8unorm")),super({...e,resource:t,format:s}),this.uploadMethodId="buffer"}static test(e){return e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}}Kh.extension=T.TextureSource;const Ip=new G;class Pp{constructor(e,t){this.mapCoord=new G,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof t>"u"?this.clampMargin=e.width<10?0:.5:this.clampMargin=t,this.isSimple=!1,this.texture=e}get texture(){return this._texture}set texture(e){this.texture!==e&&(this._texture?.removeListener("update",this.update,this),this._texture=e,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(e,t){t===void 0&&(t=e);const s=this.mapCoord;for(let r=0;r<e.length;r+=2){const n=e[r],o=e[r+1];t[r]=n*s.a+o*s.c+s.tx,t[r+1]=n*s.b+o*s.d+s.ty}return t}update(){const e=this._texture;this._updateID++;const t=e.uvs;this.mapCoord.set(t.x1-t.x0,t.y1-t.y0,t.x3-t.x0,t.y3-t.y0,t.x0,t.y0);const s=e.orig,r=e.trim;r&&(Ip.set(s.width/r.width,0,0,s.height/r.height,-r.x/r.width,-r.y/r.height),this.mapCoord.append(Ip));const n=e.source,o=this.uClampFrame,a=this.clampMargin/n._resolution,l=this.clampOffset/n._resolution;return o[0]=(e.frame.x+a+l)/n.width,o[1]=(e.frame.y+a+l)/n.height,o[2]=(e.frame.x+e.frame.width-a+l)/n.width,o[3]=(e.frame.y+e.frame.height-a+l)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=e.frame.width===n.width&&e.frame.height===n.height&&e.rotate===0,!0}}class F extends Je{constructor({source:e,label:t,frame:s,orig:r,trim:n,defaultAnchor:o,defaultBorders:a,rotate:l,dynamic:c}={}){if(super(),this.uid=pe("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new V,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=t,this.source=e?.source??new Ie,this.noFrame=!s,s)this.frame.copyFrom(s);else{const{width:h,height:u}=this._source;this.frame.width=h,this.frame.height=u}this.orig=r||this.frame,this.trim=n,this.rotate=l??0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=c||!1,this.updateUvs()}set source(e){this._source&&this._source.off("resize",this.update,this),this._source=e,e.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new Pp(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:e,frame:t}=this,{width:s,height:r}=this._source,n=t.x/s,o=t.y/r,a=t.width/s,l=t.height/r;let c=this.rotate;if(c){const h=a/2,u=l/2,d=n+h,f=o+u;c=de.add(c,de.NW),e.x0=d+h*de.uX(c),e.y0=f+u*de.uY(c),c=de.add(c,2),e.x1=d+h*de.uX(c),e.y1=f+u*de.uY(c),c=de.add(c,2),e.x2=d+h*de.uX(c),e.y2=f+u*de.uY(c),c=de.add(c,2),e.x3=d+h*de.uX(c),e.y3=f+u*de.uY(c)}else e.x0=n,e.y0=o,e.x1=n+a,e.y1=o,e.x2=n+a,e.y2=o+l,e.x3=n,e.y3=o+l}destroy(e=!1){this._source&&(this._source.off("resize",this.update,this),e&&(this._source.destroy(),this._source=null)),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return W(ie,"Texture.baseTexture is now Texture.source"),this._source}}F.EMPTY=new F({label:"EMPTY",source:new Ie({label:"EMPTY"})}),F.EMPTY.destroy=wp,F.WHITE=new F({source:new Kh({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),F.WHITE.destroy=wp;function Rp(i,e,t){const{width:s,height:r}=t.orig,n=t.trim;if(n){const o=n.width,a=n.height;i.minX=n.x-e._x*s,i.maxX=i.minX+o,i.minY=n.y-e._y*r,i.maxY=i.minY+a}else i.minX=-e._x*s,i.maxX=i.minX+s,i.minY=-e._y*r,i.maxY=i.minY+r}const Mp=new G;class Ge{constructor(e=1/0,t=1/0,s=-1/0,r=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Mp,this.minX=e,this.minY=t,this.maxX=s,this.maxY=r}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new V);const e=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(e.x=0,e.y=0,e.width=0,e.height=0):e.copyFromBounds(this),e}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Mp,this}set(e,t,s,r){this.minX=e,this.minY=t,this.maxX=s,this.maxY=r}addFrame(e,t,s,r,n){n||(n=this.matrix);const o=n.a,a=n.b,l=n.c,c=n.d,h=n.tx,u=n.ty;let d=this.minX,f=this.minY,p=this.maxX,g=this.maxY,m=o*e+l*t+h,_=a*e+c*t+u;m<d&&(d=m),_<f&&(f=_),m>p&&(p=m),_>g&&(g=_),m=o*s+l*t+h,_=a*s+c*t+u,m<d&&(d=m),_<f&&(f=_),m>p&&(p=m),_>g&&(g=_),m=o*e+l*r+h,_=a*e+c*r+u,m<d&&(d=m),_<f&&(f=_),m>p&&(p=m),_>g&&(g=_),m=o*s+l*r+h,_=a*s+c*r+u,m<d&&(d=m),_<f&&(f=_),m>p&&(p=m),_>g&&(g=_),this.minX=d,this.minY=f,this.maxX=p,this.maxY=g}addRect(e,t){this.addFrame(e.x,e.y,e.x+e.width,e.y+e.height,t)}addBounds(e,t){this.addFrame(e.minX,e.minY,e.maxX,e.maxY,t)}addBoundsMask(e){this.minX=this.minX>e.minX?this.minX:e.minX,this.minY=this.minY>e.minY?this.minY:e.minY,this.maxX=this.maxX<e.maxX?this.maxX:e.maxX,this.maxY=this.maxY<e.maxY?this.maxY:e.maxY}applyMatrix(e){const t=this.minX,s=this.minY,r=this.maxX,n=this.maxY,{a:o,b:a,c:l,d:c,tx:h,ty:u}=e;let d=o*t+l*s+h,f=a*t+c*s+u;this.minX=d,this.minY=f,this.maxX=d,this.maxY=f,d=o*r+l*s+h,f=a*r+c*s+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=o*t+l*n+h,f=a*t+c*n+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY,d=o*r+l*n+h,f=a*r+c*n+u,this.minX=d<this.minX?d:this.minX,this.minY=f<this.minY?f:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(e){return this.minX<e.left&&(this.minX=e.left),this.maxX>e.right&&(this.maxX=e.right),this.minY<e.top&&(this.minY=e.top),this.maxY>e.bottom&&(this.maxY=e.bottom),this}fitBounds(e,t,s,r){return this.minX<e&&(this.minX=e),this.maxX>t&&(this.maxX=t),this.minY<s&&(this.minY=s),this.maxY>r&&(this.maxY=r),this}pad(e,t=e){return this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new Ge(this.minX,this.minY,this.maxX,this.maxY)}scale(e,t=e){return this.minX*=e,this.minY*=t,this.maxX*=e,this.maxY*=t,this}get x(){return this.minX}set x(e){const t=this.maxX-this.minX;this.minX=e,this.maxX=e+t}get y(){return this.minY}set y(e){const t=this.maxY-this.minY;this.minY=e,this.maxY=e+t}get width(){return this.maxX-this.minX}set width(e){this.maxX=this.minX+e}get height(){return this.maxY-this.minY}set height(e){this.maxY=this.minY+e}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(e,t,s,r){let n=this.minX,o=this.minY,a=this.maxX,l=this.maxY;r||(r=this.matrix);const c=r.a,h=r.b,u=r.c,d=r.d,f=r.tx,p=r.ty;for(let g=t;g<s;g+=2){const m=e[g],_=e[g+1],x=c*m+u*_+f,y=h*m+d*_+p;n=x<n?x:n,o=y<o?y:o,a=x>a?x:a,l=y>l?y:l}this.minX=n,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(e,t){return this.minX<=e&&this.minY<=t&&this.maxX>=e&&this.maxY>=t}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(e){return this.minX=e.minX,this.minY=e.minY,this.maxX=e.maxX,this.maxY=e.maxY,this}}var bT={grad:.9,turn:360,rad:360/(2*Math.PI)},Rt=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},Re=function(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*i)/t+0},lt=function(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),i>t?t:i>e?i:e},kp=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},Fp=function(i){return{r:lt(i.r,0,255),g:lt(i.g,0,255),b:lt(i.b,0,255),a:lt(i.a)}},jh=function(i){return{r:Re(i.r),g:Re(i.g),b:Re(i.b),a:Re(i.a,3)}},wT=/^#([0-9a-f]{3,8})$/i,Tr=function(i){var e=i.toString(16);return e.length<2?"0"+e:e},Up=function(i){var e=i.r,t=i.g,s=i.b,r=i.a,n=Math.max(e,t,s),o=n-Math.min(e,t,s),a=o?n===e?(t-s)/o:n===t?2+(s-e)/o:4+(e-t)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:r}},Bp=function(i){var e=i.h,t=i.s,s=i.v,r=i.a;e=e/360*6,t/=100,s/=100;var n=Math.floor(e),o=s*(1-t),a=s*(1-(e-n)*t),l=s*(1-(1-e+n)*t),c=n%6;return{r:255*[s,a,o,o,l,s][c],g:255*[l,s,s,a,o,o][c],b:255*[o,o,l,s,s,a][c],a:r}},Op=function(i){return{h:kp(i.h),s:lt(i.s,0,100),l:lt(i.l,0,100),a:lt(i.a)}},Dp=function(i){return{h:Re(i.h),s:Re(i.s),l:Re(i.l),a:Re(i.a,3)}},Gp=function(i){return Bp((t=(e=i).s,{h:e.h,s:(t*=((s=e.l)<50?s:100-s)/100)>0?2*t/(s+t)*100:0,v:s+t,a:e.a}));var e,t,s},as=function(i){return{h:(e=Up(i)).h,s:(r=(200-(t=e.s))*(s=e.v)/100)>0&&r<200?t*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:e.a};var e,t,s,r},TT=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ST=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,CT=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ET=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Zh={string:[[function(i){var e=wT.exec(i);return e?(i=e[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?Re(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?Re(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var e=CT.exec(i)||ET.exec(i);return e?e[2]!==e[4]||e[4]!==e[6]?null:Fp({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(i){var e=TT.exec(i)||ST.exec(i);if(!e)return null;var t,s,r=Op({h:(t=e[1],s=e[2],s===void 0&&(s="deg"),Number(t)*(bT[s]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Gp(r)},"hsl"]],object:[[function(i){var e=i.r,t=i.g,s=i.b,r=i.a,n=r===void 0?1:r;return Rt(e)&&Rt(t)&&Rt(s)?Fp({r:Number(e),g:Number(t),b:Number(s),a:Number(n)}):null},"rgb"],[function(i){var e=i.h,t=i.s,s=i.l,r=i.a,n=r===void 0?1:r;if(!Rt(e)||!Rt(t)||!Rt(s))return null;var o=Op({h:Number(e),s:Number(t),l:Number(s),a:Number(n)});return Gp(o)},"hsl"],[function(i){var e=i.h,t=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!Rt(e)||!Rt(t)||!Rt(s))return null;var o=(function(a){return{h:kp(a.h),s:lt(a.s,0,100),v:lt(a.v,0,100),a:lt(a.a)}})({h:Number(e),s:Number(t),v:Number(s),a:Number(n)});return Bp(o)},"hsv"]]},zp=function(i,e){for(var t=0;t<e.length;t++){var s=e[t][0](i);if(s)return[s,e[t][1]]}return[null,void 0]},AT=function(i){return typeof i=="string"?zp(i.trim(),Zh.string):typeof i=="object"&&i!==null?zp(i,Zh.object):[null,void 0]},Jh=function(i,e){var t=as(i);return{h:t.h,s:lt(t.s+100*e,0,100),l:t.l,a:t.a}},Qh=function(i){return(299*i.r+587*i.g+114*i.b)/1e3/255},Np=function(i,e){var t=as(i);return{h:t.h,s:t.s,l:lt(t.l+100*e,0,100),a:t.a}},eu=(function(){function i(e){this.parsed=AT(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return i.prototype.isValid=function(){return this.parsed!==null},i.prototype.brightness=function(){return Re(Qh(this.rgba),2)},i.prototype.isDark=function(){return Qh(this.rgba)<.5},i.prototype.isLight=function(){return Qh(this.rgba)>=.5},i.prototype.toHex=function(){return e=jh(this.rgba),t=e.r,s=e.g,r=e.b,o=(n=e.a)<1?Tr(Re(255*n)):"","#"+Tr(t)+Tr(s)+Tr(r)+o;var e,t,s,r,n,o},i.prototype.toRgb=function(){return jh(this.rgba)},i.prototype.toRgbString=function(){return e=jh(this.rgba),t=e.r,s=e.g,r=e.b,(n=e.a)<1?"rgba("+t+", "+s+", "+r+", "+n+")":"rgb("+t+", "+s+", "+r+")";var e,t,s,r,n},i.prototype.toHsl=function(){return Dp(as(this.rgba))},i.prototype.toHslString=function(){return e=Dp(as(this.rgba)),t=e.h,s=e.s,r=e.l,(n=e.a)<1?"hsla("+t+", "+s+"%, "+r+"%, "+n+")":"hsl("+t+", "+s+"%, "+r+"%)";var e,t,s,r,n},i.prototype.toHsv=function(){return e=Up(this.rgba),{h:Re(e.h),s:Re(e.s),v:Re(e.v),a:Re(e.a,3)};var e},i.prototype.invert=function(){return St({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},i.prototype.saturate=function(e){return e===void 0&&(e=.1),St(Jh(this.rgba,e))},i.prototype.desaturate=function(e){return e===void 0&&(e=.1),St(Jh(this.rgba,-e))},i.prototype.grayscale=function(){return St(Jh(this.rgba,-1))},i.prototype.lighten=function(e){return e===void 0&&(e=.1),St(Np(this.rgba,e))},i.prototype.darken=function(e){return e===void 0&&(e=.1),St(Np(this.rgba,-e))},i.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},i.prototype.alpha=function(e){return typeof e=="number"?St({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Re(this.rgba.a,3);var t},i.prototype.hue=function(e){var t=as(this.rgba);return typeof e=="number"?St({h:e,s:t.s,l:t.l,a:t.a}):Re(t.h)},i.prototype.isEqual=function(e){return this.toHex()===St(e).toHex()},i})(),St=function(i){return i instanceof eu?i:new eu(i)},Lp=[],IT=function(i){i.forEach(function(e){Lp.indexOf(e)<0&&(e(eu,Zh),Lp.push(e))})};function PT(i,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in t)s[t[r]]=r;var n={};i.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,c=s[this.toHex()];if(c)return c;if(o?.closest){var h=this.toRgb(),u=1/0,d="black";if(!n.length)for(var f in t)n[f]=new i(t[f]).toRgb();for(var p in t){var g=(a=h,l=n[p],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));g<u&&(u=g,d=p)}return d}},e.string.push([function(o){var a=o.toLowerCase(),l=a==="transparent"?"#0000":t[a];return l?new i(l).toRgb():null},"name"])}IT([PT]);const ki=class Ns{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(e){return this.value=e,this}set value(e){if(e instanceof Ns)this._value=this._cloneSource(e._value),this._int=e._int,this._components.set(e._components);else{if(e===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,e))&&(this._value=this._cloneSource(e),this._normalize(this._value))}}get value(){return this._value}_cloneSource(e){return typeof e=="string"||typeof e=="number"||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e=="object"&&e!==null?{...e}:e}_isSourceEqual(e,t){const s=typeof e;if(s!==typeof t)return!1;if(s==="number"||s==="string"||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length!==t.length?!1:e.every((n,o)=>n===t[o]);if(e!==null&&t!==null){const n=Object.keys(e),o=Object.keys(t);return n.length!==o.length?!1:n.every(a=>e[a]===t[a])}return e===t}toRgba(){const[e,t,s,r]=this._components;return{r:e,g:t,b:s,a:r}}toRgb(){const[e,t,s]=this._components;return{r:e,g:t,b:s}}toRgbaString(){const[e,t,s]=this.toUint8RgbArray();return`rgba(${e},${t},${s},${this.alpha})`}toUint8RgbArray(e){const[t,s,r]=this._components;return this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb),e[0]=Math.round(t*255),e[1]=Math.round(s*255),e[2]=Math.round(r*255),e}toArray(e){this._arrayRgba||(this._arrayRgba=[]),e||(e=this._arrayRgba);const[t,s,r,n]=this._components;return e[0]=t,e[1]=s,e[2]=r,e[3]=n,e}toRgbArray(e){this._arrayRgb||(this._arrayRgb=[]),e||(e=this._arrayRgb);const[t,s,r]=this._components;return e[0]=t,e[1]=s,e[2]=r,e}toNumber(){return this._int}toBgrNumber(){const[e,t,s]=this.toUint8RgbArray();return(s<<16)+(t<<8)+e}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[t,s,r,n]=Ns._temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=s,this._components[2]*=r,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this._refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let s=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return t&&(s=s*e+.5|0,r=r*e+.5|0,n=n*e+.5|0),(e*255<<24)+(s<<16)+(r<<8)+n}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(e){return this._components[3]=this._clamp(e),this}_normalize(e){let t,s,r,n;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const o=e;t=(o>>16&255)/255,s=(o>>8&255)/255,r=(o&255)/255,n=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[t,s,r,n=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[t,s,r,n=255]=e,t/=255,s/=255,r/=255,n/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const a=Ns.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=St(e);o.isValid()&&({r:t,g:s,b:r,a:n}=o.rgba,t/=255,s/=255,r/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=s,this._components[2]=r,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${e}`)}_refreshInt(){this._clamp(this._components);const[e,t,s]=this._components;this._int=(e*255<<16)+(t*255<<8)+(s*255|0)}_clamp(e,t=0,s=1){return typeof e=="number"?Math.min(Math.max(e,t),s):(e.forEach((r,n)=>{e[n]=Math.min(Math.max(r,t),s)}),e)}static isColorLike(e){return typeof e=="number"||typeof e=="string"||e instanceof Number||e instanceof Ns||Array.isArray(e)||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Float32Array||e.r!==void 0&&e.g!==void 0&&e.b!==void 0||e.r!==void 0&&e.g!==void 0&&e.b!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0||e.h!==void 0&&e.s!==void 0&&e.l!==void 0&&e.a!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0||e.h!==void 0&&e.s!==void 0&&e.v!==void 0&&e.a!==void 0}};ki.shared=new ki,ki._temp=new ki,ki.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let me=ki;const RT={cullArea:null,cullable:!1,cullableChildren:!0};let tu=0;const Hp=500;function K(...i){tu!==Hp&&(tu++,tu===Hp?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...i))}const Fi={_registeredResources:new Set,register(i){this._registeredResources.add(i)},unregister(i){this._registeredResources.delete(i)},release(){this._registeredResources.forEach(i=>i.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(i){return this._registeredResources.has(i)},reset(){this._registeredResources.clear()}};class MT{constructor(e,t){this._pool=[],this._count=0,this._index=0,this._classType=e,t&&this.prepopulate(t)}prepopulate(e){for(let t=0;t<e;t++)this._pool[this._index++]=new this._classType;this._count+=e}get(e){let t;return this._index>0?t=this._pool[--this._index]:(t=new this._classType,this._count++),t.init?.(e),t}return(e){e.reset?.(),this._pool[this._index++]=e}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){if(this._pool.length>0&&this._pool[0].destroy)for(let e=0;e<this._index;e++)this._pool[e].destroy();this._pool.length=0,this._count=0,this._index=0}}class kT{constructor(){this._poolsByClass=new Map}prepopulate(e,t){this.getPool(e).prepopulate(t)}get(e,t){return this.getPool(e).get(t)}return(e){this.getPool(e.constructor).return(e)}getPool(e){return this._poolsByClass.has(e)||this._poolsByClass.set(e,new MT(e)),this._poolsByClass.get(e)}stats(){const e={};return this._poolsByClass.forEach(t=>{const s=e[t._classType.name]?t._classType.name+t._classType.ID:t._classType.name;e[s]={free:t.totalFree,used:t.totalUsed,size:t.totalSize}}),e}clear(){this._poolsByClass.forEach(e=>e.clear()),this._poolsByClass.clear()}}const Ce=new kT;Fi.register(Ce);const FT={get isCachedAsTexture(){return!!this.renderGroup?.isCachedAsTexture},cacheAsTexture(i){typeof i=="boolean"&&i===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(i===!0?{}:i))},updateCacheTexture(){this.renderGroup?.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(i){W("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(i)}};function Wp(i,e,t){const s=i.length;let r;if(e>=s||t===0)return;t=e+t>s?s-e:t;const n=s-t;for(r=e;r<n;++r)i[r]=i[r+t];i.length=n}const UT={allowChildren:!0,removeChildren(i=0,e){const t=e??this.children.length,s=t-i,r=[];if(s>0&&s<=t){for(let o=t-1;o>=i;o--){const a=this.children[o];a&&(r.push(a),a.parent=null)}Wp(this.children,i,t);const n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(r);for(let o=0;o<r.length;++o){const a=r[o];a.parentRenderLayer?.detach(a),this.emit("childRemoved",a,this,o),r[o].emit("removed",this)}return r.length>0&&this._didViewChangeTick++,r}else if(s===0&&this.children.length===0)return r;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(i){const e=this.getChildAt(i);return this.removeChild(e)},getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]},setChildIndex(i,e){if(e<0||e>=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);this.getChildIndex(i),this.addChildAt(i,e)},getChildIndex(i){const e=this.children.indexOf(i);if(e===-1)throw new Error("The supplied Container must be a child of the caller");return e},addChildAt(i,e){this.allowChildren||W(ie,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:t}=this;if(e<0||e>t.length)throw new Error(`${i}addChildAt: The index ${e} supplied is out of bounds ${t.length}`);if(i.parent){const r=i.parent.children.indexOf(i);if(i.parent===this&&r===e)return i;r!==-1&&i.parent.children.splice(r,1)}e===t.length?t.push(i):t.splice(e,0,i),i.parent=this,i.didChange=!0,i._updateFlags=15;const s=this.renderGroup||this.parentRenderGroup;return s&&s.addChild(i),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",i,this,e),i.emit("added",this),i},swapChildren(i,e){if(i===e)return;const t=this.getChildIndex(i),s=this.getChildIndex(e);this.children[t]=e,this.children[s]=i;const r=this.renderGroup||this.parentRenderGroup;r&&(r.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){this.parent?.removeChild(this)},reparentChild(...i){return i.length===1?this.reparentChildAt(i[0],this.children.length):(i.forEach(e=>this.reparentChildAt(e,this.children.length)),i[0])},reparentChildAt(i,e){if(i.parent===this)return this.setChildIndex(i,e),i;const t=i.worldTransform.clone();i.removeFromParent(),this.addChildAt(i,e);const s=this.worldTransform.clone();return s.invert(),t.prepend(s),i.setFromMatrix(t),i},replaceChild(i,e){i.updateLocalTransform(),this.addChildAt(e,this.getChildIndex(i)),e.setFromMatrix(i.localTransform),e.updateLocalTransform(),this.removeChild(i)}},BT={collectRenderables(i,e,t){this.parentRenderLayer&&this.parentRenderLayer!==t||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(i,e,t):this.renderGroup?e.renderPipes.renderGroup.addRenderGroup(this.renderGroup,i):this.collectRenderablesWithEffects(i,e,t))},collectRenderablesSimple(i,e,t){const s=this.children,r=s.length;for(let n=0;n<r;n++)s[n].collectRenderables(i,e,t)},collectRenderablesWithEffects(i,e,t){const{renderPipes:s}=e;for(let r=0;r<this.effects.length;r++){const n=this.effects[r];s[n.pipe].push(n,this,i)}this.collectRenderablesSimple(i,e,t);for(let r=this.effects.length-1;r>=0;r--){const n=this.effects[r];s[n.pipe].pop(n,this,i)}}};class Sr{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let e=0;e<this.filters.length;e++)this.filters[e].destroy();this.filters=null,this.filterArea=null}}class OT{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(e=>{this.add({test:e.test,maskClass:e})}))}add(e){this._tests.push(e)}getMaskEffect(e){this._initialized||this.init();for(let t=0;t<this._tests.length;t++){const s=this._tests[t];if(s.test(e))return Ce.get(s.maskClass,e)}return e}returnMaskEffect(e){Ce.return(e)}}const iu=new OT;q.handleByList(T.MaskEffect,iu._effectClasses);const DT={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0)},addEffect(i){this.effects.indexOf(i)===-1&&(this.effects.push(i),this.effects.sort((t,s)=>t.priority-s.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(i){const e=this.effects.indexOf(i);e!==-1&&(this.effects.splice(e,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(i){const e=this._maskEffect;e?.mask!==i&&(e&&(this.removeEffect(e),iu.returnMaskEffect(e),this._maskEffect=null),i!=null&&(this._maskEffect=iu.getMaskEffect(i),this.addEffect(this._maskEffect)))},get mask(){return this._maskEffect?.mask},setMask(i){this._maskOptions={...this._maskOptions,...i},i.mask&&(this.mask=i.mask),this._markStructureAsChanged()},set filters(i){!Array.isArray(i)&&i&&(i=[i]);const e=this._filterEffect||(this._filterEffect=new Sr);i=i;const t=i?.length>0,s=e.filters?.length>0,r=t!==s;i=Array.isArray(i)?i.slice(0):i,e.filters=Object.freeze(i),r&&(t?this.addEffect(e):(this.removeEffect(e),e.filters=i??null))},get filters(){return this._filterEffect?.filters},set filterArea(i){this._filterEffect||(this._filterEffect=new Sr),this._filterEffect.filterArea=i},get filterArea(){return this._filterEffect?.filterArea}},GT={label:null,get name(){return W(ie,"Container.name property has been removed, use Container.label instead"),this.label},set name(i){W(ie,"Container.name property has been removed, use Container.label instead"),this.label=i},getChildByName(i,e=!1){return this.getChildByLabel(i,e)},getChildByLabel(i,e=!1){const t=this.children;for(let s=0;s<t.length;s++){const r=t[s];if(r.label===i||i instanceof RegExp&&i.test(r.label))return r}if(e)for(let s=0;s<t.length;s++){const n=t[s].getChildByLabel(i,!0);if(n)return n}return null},getChildrenByLabel(i,e=!1,t=[]){const s=this.children;for(let r=0;r<s.length;r++){const n=s[r];(n.label===i||i instanceof RegExp&&i.test(n.label))&&t.push(n)}if(e)for(let r=0;r<s.length;r++)s[r].getChildrenByLabel(i,!0,t);return t}},We=Ce.getPool(G),Mt=Ce.getPool(Ge),zT=new G,NT={getFastGlobalBounds(i,e){e||(e=new Ge),e.clear(),this._getGlobalBoundsRecursive(!!i,e,this.parentRenderLayer),e.isValid||e.set(0,0,0,0);const t=this.renderGroup||this.parentRenderGroup;return e.applyMatrix(t.worldTransform),e},_getGlobalBoundsRecursive(i,e,t){let s=e;if(i&&this.parentRenderLayer&&this.parentRenderLayer!==t||this.localDisplayStatus!==7||!this.measurable)return;const r=!!this.effects.length;if((this.renderGroup||r)&&(s=Mt.get().clear()),this.boundsArea)e.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const o=this.bounds;s.addFrame(o.minX,o.minY,o.maxX,o.maxY,this.groupTransform)}const n=this.children;for(let o=0;o<n.length;o++)n[o]._getGlobalBoundsRecursive(i,s,t)}if(r){let n=!1;const o=this.renderGroup||this.parentRenderGroup;for(let a=0;a<this.effects.length;a++)this.effects[a].addBounds&&(n||(n=!0,s.applyMatrix(o.worldTransform)),this.effects[a].addBounds(s,!0));n&&s.applyMatrix(o.worldTransform.copyTo(zT).invert()),e.addBounds(s),Mt.return(s)}else this.renderGroup&&(e.addBounds(s,this.relativeGroupTransform),Mt.return(s))}};function su(i,e,t){t.clear();let s,r;return i.parent?e?s=i.parent.worldTransform:(r=We.get().identity(),s=ru(i,r)):s=G.IDENTITY,Vp(i,t,s,e),r&&We.return(r),t.isValid||t.set(0,0,0,0),t}function Vp(i,e,t,s){if(!i.visible||!i.measurable)return;let r;s?r=i.worldTransform:(i.updateLocalTransform(),r=We.get(),r.appendFrom(i.localTransform,t));const n=e,o=!!i.effects.length;if(o&&(e=Mt.get().clear()),i.boundsArea)e.addRect(i.boundsArea,r);else{const a=i.bounds;a&&!a.isEmpty()&&(e.matrix=r,e.addBounds(a));for(let l=0;l<i.children.length;l++)Vp(i.children[l],e,r,s)}if(o){for(let a=0;a<i.effects.length;a++)i.effects[a].addBounds?.(e);n.addBounds(e,G.IDENTITY),Mt.return(e)}s||We.return(r)}function ru(i,e){const t=i.parent;return t&&(ru(t,e),t.updateLocalTransform(),e.append(t.localTransform)),e}function $p(i,e){if(i===16777215||!e)return e;if(e===16777215||!i)return i;const t=i>>16&255,s=i>>8&255,r=i&255,n=e>>16&255,o=e>>8&255,a=e&255,l=t*n/255|0,c=s*o/255|0,h=r*a/255|0;return(l<<16)+(c<<8)+h}const Xp=16777215;function Cr(i,e){return i===Xp?e:e===Xp?i:$p(i,e)}function Er(i){return((i&255)<<16)+(i&65280)+(i>>16&255)}const LT={getGlobalAlpha(i){if(i)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let e=this.alpha,t=this.parent;for(;t;)e*=t.alpha,t=t.parent;return e},getGlobalTransform(i=new G,e){if(e)return i.copyFrom(this.worldTransform);this.updateLocalTransform();const t=ru(this,We.get().identity());return i.appendFrom(this.localTransform,t),We.return(t),i},getGlobalTint(i){if(i)return this.renderGroup?Er(this.renderGroup.worldColor):this.parentRenderGroup?Er(Cr(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let e=this.localColor,t=this.parent;for(;t;)e=Cr(e,t.localColor),t=t.parent;return Er(e)}};function nu(i,e,t){return e.clear(),t||(t=G.IDENTITY),Yp(i,e,t,i,!0),e.isValid||e.set(0,0,0,0),e}function Yp(i,e,t,s,r){let n;if(r)n=We.get(),n=t.copyTo(n);else{if(!i.visible||!i.measurable)return;i.updateLocalTransform();const l=i.localTransform;n=We.get(),n.appendFrom(l,t)}const o=e,a=!!i.effects.length;if(a&&(e=Mt.get().clear()),i.boundsArea)e.addRect(i.boundsArea,n);else{i.renderPipeId&&(e.matrix=n,e.addBounds(i.bounds));const l=i.children;for(let c=0;c<l.length;c++)Yp(l[c],e,n,s,!1)}if(a){for(let l=0;l<i.effects.length;l++)i.effects[l].addLocalBounds?.(e,s);o.addBounds(e,G.IDENTITY),Mt.return(e)}We.return(n)}function qp(i,e){const t=i.children;for(let s=0;s<t.length;s++){const r=t[s],n=r.uid,o=(r._didViewChangeTick&65535)<<16|r._didContainerChangeTick&65535,a=e.index;(e.data[a]!==n||e.data[a+1]!==o)&&(e.data[e.index]=n,e.data[e.index+1]=o,e.didChange=!0),e.index=a+2,r.children.length&&qp(r,e)}return e.didChange}const HT=new G,WT={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(i,e){const t=Math.sign(this.scale.x)||1;e!==0?this.scale.x=i/e*t:this.scale.x=t},_setHeight(i,e){const t=Math.sign(this.scale.y)||1;e!==0?this.scale.y=i/e*t:this.scale.y=t},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Ge});const i=this._localBoundsCacheData;return i.index=1,i.didChange=!1,i.data[0]!==this._didViewChangeTick&&(i.didChange=!0,i.data[0]=this._didViewChangeTick),qp(this,i),i.didChange&&nu(this,i.localBounds,HT),i.localBounds},getBounds(i,e){return su(this,i,e||new Ge)}},VT={_onRender:null,set onRender(i){const e=this.renderGroup||this.parentRenderGroup;if(!i){this._onRender&&e?.removeOnRender(this),this._onRender=null;return}this._onRender||e?.addOnRender(this),this._onRender=i},get onRender(){return this._onRender}},$T={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(i){this._zIndex!==i&&(this._zIndex=i,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(XT))}};function XT(i,e){return i._zIndex-e._zIndex}const YT={getGlobalPosition(i=new X,e=!1){return this.parent?this.parent.toGlobal(this._position,i,e):(i.x=this._position.x,i.y=this._position.y),i},toGlobal(i,e,t=!1){const s=this.getGlobalTransform(We.get(),t);return e=s.apply(i,e),We.return(s),e},toLocal(i,e,t,s){e&&(i=e.toGlobal(i,t,s));const r=this.getGlobalTransform(We.get(),s);return t=r.applyInverse(i,t),We.return(r),t}};class Kp{constructor(){this.uid=pe("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(e){this.instructions[this.instructionSize++]=e}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}let qT=0;class KT{constructor(e){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this.textureStyle=new qt(this.textureOptions)}createTexture(e,t,s){const r=new Ie({...this.textureOptions,width:e,height:t,resolution:1,antialias:s,autoGarbageCollect:!1});return new F({source:r,label:`texturePool_${qT++}`})}getOptimalTexture(e,t,s=1,r){let n=Math.ceil(e*s-1e-6),o=Math.ceil(t*s-1e-6);n=Mi(n),o=Mi(o);const a=(n<<17)+(o<<1)+(r?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(n,o,r)),l.source._resolution=s,l.source.width=n/s,l.source.height=o/s,l.source.pixelWidth=n,l.source.pixelHeight=o,l.frame.x=0,l.frame.y=0,l.frame.width=e,l.frame.height=t,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(e,t=!1){const s=e.source;return this.getOptimalTexture(e.width,e.height,s._resolution,t)}returnTexture(e,t=!1){const s=this._poolKeyHash[e.uid];t&&(e.source.style=this.textureStyle),this._texturePool[s].push(e)}clear(e){if(e=e!==!1,e)for(const t in this._texturePool){const s=this._texturePool[t];if(s)for(let r=0;r<s.length;r++)s[r].destroy(!0)}this._texturePool={}}}const Te=new KT;Fi.register(Te);class ou{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new G,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new Kp,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(e){this.root=e,e._onRender&&this.addOnRender(e),e.didChange=!0;const t=e.children;for(let s=0;s<t.length;s++){const r=t[s];r._updateFlags=15,this.addChild(r)}}enableCacheAsTexture(e={}){this.textureOptions=e,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Te.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const e=this._parentCacheAsTextureRenderGroup;e&&!e.textureNeedsUpdate&&e.updateCacheTexture()}reset(){this.renderGroupChildren.length=0;for(const e in this.childrenToUpdate){const t=this.childrenToUpdate[e];t.list.fill(null),t.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null,this.disableCacheAsTexture()}get localTransform(){return this.root.localTransform}addRenderGroupChild(e){e.renderGroupParent&&e.renderGroupParent._removeRenderGroupChild(e),e.renderGroupParent=this,this.renderGroupChildren.push(e)}_removeRenderGroupChild(e){const t=this.renderGroupChildren.indexOf(e);t>-1&&this.renderGroupChildren.splice(t,1),e.renderGroupParent=null}addChild(e){if(this.structureDidChange=!0,e.parentRenderGroup=this,e.updateTick=-1,e.parent===this.root?e.relativeRenderGroupDepth=1:e.relativeRenderGroupDepth=e.parent.relativeRenderGroupDepth+1,e.didChange=!0,this.onChildUpdate(e),e.renderGroup){this.addRenderGroupChild(e.renderGroup);return}e._onRender&&this.addOnRender(e);const t=e.children;for(let s=0;s<t.length;s++)this.addChild(t[s])}removeChild(e){if(this.structureDidChange=!0,e._onRender&&(e.renderGroup||this.removeOnRender(e)),e.parentRenderGroup=null,e.renderGroup){this._removeRenderGroupChild(e.renderGroup);return}const t=e.children;for(let s=0;s<t.length;s++)this.removeChild(t[s])}removeChildren(e){for(let t=0;t<e.length;t++)this.removeChild(e[t])}onChildUpdate(e){let t=this.childrenToUpdate[e.relativeRenderGroupDepth];t||(t=this.childrenToUpdate[e.relativeRenderGroupDepth]={index:0,list:[]}),t.list[t.index++]=e}updateRenderable(e){e.globalDisplayStatus<7||(this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e),e.didViewUpdate=!1)}onChildViewUpdate(e){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=e}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(e){this._onRenderContainers.push(e)}removeOnRender(e){this._onRenderContainers.splice(this._onRenderContainers.indexOf(e),1)}runOnRender(e){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender(e)}destroy(){this.disableCacheAsTexture(),this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(e=[]){const t=this.root.children;for(let s=0;s<t.length;s++)this._getChildren(t[s],e);return e}_getChildren(e,t=[]){if(t.push(e),e.renderGroup)return t;const s=e.children;for(let r=0;r<s.length;r++)this._getChildren(s[r],t);return t}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new G),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new G),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;const e=this._parentCacheAsTextureRenderGroup;return e?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new G),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(e.inverseWorldTransform).translate(-e._textureBounds.x,-e._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function jT(i,e,t={}){for(const s in e)!t[s]&&e[s]!==void 0&&(i[s]=e[s])}const au=new Ue(null),Ar=new Ue(null),lu=new Ue(null,1,1),Ir=new Ue(null),Pr=1,cu=2,ls=4;class le extends Je{constructor(e={}){super(),this.uid=pe("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new G,this.relativeGroupTransform=new G,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new Ue(this,0,0),this._scale=lu,this._pivot=Ar,this._origin=Ir,this._skew=au,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],jT(this,e,{children:!0,parent:!0,effects:!0}),e.children?.forEach(t=>this.addChild(t)),e.parent?.addChild(this)}static mixin(e){W("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),q.mixin(le,e)}set _didChangeId(e){this._didViewChangeTick=e>>12&4095,this._didContainerChangeTick=e&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...e){if(this.allowChildren||W(ie,"addChild: Only Containers will be allowed to add children in v8.0.0"),e.length>1){for(let r=0;r<e.length;r++)this.addChild(e[r]);return e[0]}const t=e[0],s=this.renderGroup||this.parentRenderGroup;return t.parent===this?(this.children.splice(this.children.indexOf(t),1),this.children.push(t),s&&(s.structureDidChange=!0),t):(t.parent&&t.parent.removeChild(t),this.children.push(t),this.sortableChildren&&(this.sortDirty=!0),t.parent=this,t.didChange=!0,t._updateFlags=15,s&&s.addChild(t),this.emit("childAdded",t,this,this.children.length-1),t.emit("added",this),this._didViewChangeTick++,t._zIndex!==0&&t.depthOfChildModified(),t)}removeChild(...e){if(e.length>1){for(let r=0;r<e.length;r++)this.removeChild(e[r]);return e[0]}const t=e[0],s=this.children.indexOf(t);return s>-1&&(this._didViewChangeTick++,this.children.splice(s,1),this.renderGroup?this.renderGroup.removeChild(t):this.parentRenderGroup&&this.parentRenderGroup.removeChild(t),t.parentRenderLayer&&t.parentRenderLayer.detach(t),t.parent=null,this.emit("childRemoved",t,this,s),t.emit("removed",this)),t}_onUpdate(e){e&&e===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(e){!!this.renderGroup!==e&&(e?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const e=this.parentRenderGroup;e?.removeChild(this),this.renderGroup=Ce.get(ou,this),this.groupTransform=G.IDENTITY,e?.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const e=this.parentRenderGroup;e?.removeChild(this),Ce.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,e?.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new G),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(e){this._position.x=e}get y(){return this._position.y}set y(e){this._position.y=e}get position(){return this._position}set position(e){this._position.copyFrom(e)}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this._onUpdate(this._skew))}get angle(){return this.rotation*pT}set angle(e){this.rotation=e*mT}get pivot(){return this._pivot===Ar&&(this._pivot=new Ue(this,0,0)),this._pivot}set pivot(e){this._pivot===Ar&&(this._pivot=new Ue(this,0,0),this._origin!==Ir&&K("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._pivot.set(e):this._pivot.copyFrom(e)}get skew(){return this._skew===au&&(this._skew=new Ue(this,0,0)),this._skew}set skew(e){this._skew===au&&(this._skew=new Ue(this,0,0)),this._skew.copyFrom(e)}get scale(){return this._scale===lu&&(this._scale=new Ue(this,1,1)),this._scale}set scale(e){this._scale===lu&&(this._scale=new Ue(this,0,0)),typeof e=="string"&&(e=parseFloat(e)),typeof e=="number"?this._scale.set(e):this._scale.copyFrom(e)}get origin(){return this._origin===Ir&&(this._origin=new Ue(this,0,0)),this._origin}set origin(e){this._origin===Ir&&(this._origin=new Ue(this,0,0),this._pivot!==Ar&&K("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof e=="number"?this._origin.set(e):this._origin.copyFrom(e)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(e){const t=this.getLocalBounds().width;this._setWidth(e,t)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(e){const t=this.getLocalBounds().height;this._setHeight(e,t)}getSize(e){e||(e={});const t=this.getLocalBounds();return e.width=Math.abs(this.scale.x*t.width),e.height=Math.abs(this.scale.y*t.height),e}setSize(e,t){const s=this.getLocalBounds();typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,s.width),t!==void 0&&this._setHeight(t,s.height)}_updateSkew(){const e=this._rotation,t=this._skew;this._cx=Math.cos(e+t._y),this._sx=Math.sin(e+t._y),this._cy=-Math.sin(e-t._x),this._sy=Math.cos(e-t._x)}updateTransform(e){return this.position.set(typeof e.x=="number"?e.x:this.position.x,typeof e.y=="number"?e.y:this.position.y),this.scale.set(typeof e.scaleX=="number"?e.scaleX||1:this.scale.x,typeof e.scaleY=="number"?e.scaleY||1:this.scale.y),this.rotation=typeof e.rotation=="number"?e.rotation:this.rotation,this.skew.set(typeof e.skewX=="number"?e.skewX:this.skew.x,typeof e.skewY=="number"?e.skewY:this.skew.y),this.pivot.set(typeof e.pivotX=="number"?e.pivotX:this.pivot.x,typeof e.pivotY=="number"?e.pivotY:this.pivot.y),this.origin.set(typeof e.originX=="number"?e.originX:this.origin.x,typeof e.originY=="number"?e.originY:this.origin.y),this}setFromMatrix(e){e.decompose(this)}updateLocalTransform(){const e=this._didContainerChangeTick;if(this._didLocalTransformChangeId===e)return;this._didLocalTransformChangeId=e;const t=this.localTransform,s=this._scale,r=this._pivot,n=this._origin,o=this._position,a=s._x,l=s._y,c=r._x,h=r._y,u=-n._x,d=-n._y;t.a=this._cx*a,t.b=this._sx*a,t.c=this._cy*l,t.d=this._sy*l,t.tx=o._x-(c*t.a+h*t.c)+(u*t.a+d*t.c)-u,t.ty=o._y-(c*t.b+h*t.d)+(u*t.b+d*t.d)-d}set alpha(e){e!==this.localAlpha&&(this.localAlpha=e,this._updateFlags|=Pr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(e){const s=me.shared.setValue(e??16777215).toBgrNumber();s!==this.localColor&&(this.localColor=s,this._updateFlags|=Pr,this._onUpdate())}get tint(){return Er(this.localColor)}set blendMode(e){this.localBlendMode!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=cu,this.localBlendMode=e,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(e){const t=e?2:0;(this.localDisplayStatus&2)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ls,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(e){const t=e?0:4;(this.localDisplayStatus&4)!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ls,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(e){const t=e?1:0;(this.localDisplayStatus&1)!==t&&(this._updateFlags|=ls,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(e=!1){if(this.destroyed)return;this.destroyed=!0;let t;if(this.children.length&&(t=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof e=="boolean"?e:e?.children)&&t)for(let r=0;r<t.length;++r)t[r].destroy(e);this.renderGroup?.destroy(),this.renderGroup=null}}q.mixin(le,UT,NT,YT,VT,WT,DT,GT,$T,RT,FT,LT,BT);class hu extends le{constructor(e){super(e),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this._bounds=new Ge(0,1,0,0),this._boundsDirty=!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(e){this._roundPixels=e?1:0}containsPoint(e){const t=this.bounds,{x:s,y:r}=e;return s>=t.minX&&s<=t.maxX&&r>=t.minY&&r<=t.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const e=this.renderGroup||this.parentRenderGroup;e&&e.onChildViewUpdate(this)}destroy(e){super.destroy(e),this._bounds=null;for(const t in this._gpuData)this._gpuData[t].destroy?.();this._gpuData=null}collectRenderablesSimple(e,t,s){const{renderPipes:r}=t;r.blendMode.pushBlendMode(this,this.groupBlendMode,e),r[this.renderPipeId].addRenderable(this,e),this.didViewUpdate=!1;const o=this.children,a=o.length;for(let l=0;l<a;l++)o[l].collectRenderables(e,t,s);r.blendMode.popBlendMode(e)}}class Be extends hu{constructor(e=F.EMPTY){e instanceof F&&(e={texture:e});const{texture:t=F.EMPTY,anchor:s,roundPixels:r,width:n,height:o,...a}=e;super({label:"Sprite",...a}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new Ue({_onUpdate:()=>{this.onViewUpdate()}}),s?this.anchor=s:t.defaultAnchor&&(this.anchor=t.defaultAnchor),this.texture=t,this.allowChildren=!1,this.roundPixels=r??!1,n!==void 0&&(this.width=n),o!==void 0&&(this.height=o)}static from(e,t=!1){return e instanceof F?new Be(e):new Be(F.from(e,t))}set texture(e){e||(e=F.EMPTY);const t=this._texture;t!==e&&(t&&t.dynamic&&t.off("update",this.onViewUpdate,this),e.dynamic&&e.on("update",this.onViewUpdate,this),this._texture=e,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get visualBounds(){return Rp(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return W("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const e=this._anchor,t=this._texture,s=this._bounds,{width:r,height:n}=t.orig;s.minX=-e._x*r,s.maxX=s.minX+r,s.minY=-e._y*n,s.maxY=s.minY+n}destroy(e=!1){if(super.destroy(e),typeof e=="boolean"?e:e?.texture){const s=typeof e=="boolean"?e:e?.textureSource;this._texture.destroy(s)}this._texture=null,this._visualBounds=null,this._bounds=null,this._anchor=null,this._gpuData=null}get anchor(){return this._anchor}set anchor(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this._setWidth(e,this._texture.orig.width),this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this._setHeight(e,this._texture.orig.height),this._height=e}getSize(e){return e||(e={}),e.width=Math.abs(this.scale.x)*this._texture.orig.width,e.height=Math.abs(this.scale.y)*this._texture.orig.height,e}setSize(e,t){typeof e=="object"?(t=e.height??e.width,e=e.width):t??(t=e),e!==void 0&&this._setWidth(e,this._texture.orig.width),t!==void 0&&this._setHeight(t,this._texture.orig.height)}}const ZT=new Ge;function jp(i,e,t){const s=ZT;i.measurable=!0,su(i,t,s),e.addBoundsMask(s),i.measurable=!1}function Zp(i,e,t){const s=Mt.get();i.measurable=!0;const r=We.get().identity(),n=Jp(i,t,r);nu(i,s,n),i.measurable=!1,e.addBoundsMask(s),We.return(r),Mt.return(s)}function Jp(i,e,t){return i?(i!==e&&(Jp(i.parent,e,t),i.updateLocalTransform(),t.append(i.localTransform)),t):(K("Mask bounds, renderable is not inside the root container"),t)}class Qp{constructor(e){this.priority=0,this.inverse=!1,this.pipe="alphaMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.renderMaskToTexture=!(e instanceof Be),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(e,t){this.inverse||jp(this.mask,e,t)}addLocalBounds(e,t){Zp(this.mask,e,t)}containsPoint(e,t){const s=this.mask;return t(s,e)}destroy(){this.reset()}static test(e){return e instanceof Be}}Qp.extension=T.MaskEffect;class em{constructor(e){this.priority=0,this.pipe="colorMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e}destroy(){}static test(e){return typeof e=="number"}}em.extension=T.MaskEffect;class tm{constructor(e){this.priority=0,this.pipe="stencilMask",e?.mask&&this.init(e.mask)}init(e){this.mask=e,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(e,t){jp(this.mask,e,t)}addLocalBounds(e,t){Zp(this.mask,e,t)}containsPoint(e,t){const s=this.mask;return t(s,e)}destroy(){this.reset()}static test(e){return e instanceof le}}tm.extension=T.MaskEffect;let im={createCanvas:(i,e)=>{const t=document.createElement("canvas");return t.width=i,t.height=e,t},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,e)=>fetch(i,e),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")};const he={get(){return im},set(i){im=i}};class kt extends Ie{constructor(e){e.resource||(e.resource=he.get().createCanvas()),e.width||(e.width=e.resource.width,e.autoDensity||(e.width/=e.resolution)),e.height||(e.height=e.resource.height,e.autoDensity||(e.height/=e.resolution)),super(e),this.uploadMethodId="image",this.autoDensity=e.autoDensity,this.resizeCanvas(),this.transparent=!!e.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(e=this.width,t=this.height,s=this._resolution){const r=super.resize(e,t,s);return r&&this.resizeCanvas(),r}static test(e){return globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&e instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}kt.extension=T.TextureSource;class Kt extends Ie{constructor(e){super(e),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(e){return globalThis.HTMLImageElement&&e instanceof HTMLImageElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||globalThis.VideoFrame&&e instanceof VideoFrame}}Kt.extension=T.TextureSource;var Ui=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Ui||{});class uu{constructor(e,t=null,s=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=e,this._context=t,this.priority=s,this._once=r}match(e,t=null){return this._fn===e&&this._context===t}emit(e){this._fn&&(this._context?this._fn.call(this._context,e):this._fn(e));const t=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const t=this.next;return this.next=e?null:t,this.previous=null,t}}const sm=class rt{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new uu(null,null,1/0),this.deltaMS=1/rt.targetFPMS,this.elapsedMS=1/rt.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,s=Ui.NORMAL){return this._addListener(new uu(e,t,s))}addOnce(e,t,s=Ui.NORMAL){return this._addListener(new uu(e,t,s,!0))}_addListener(e){let t=this._head.next,s=this._head;if(!t)e.connect(s);else{for(;t;){if(e.priority>t.priority){e.connect(s);break}s=t,t=t.next}e.previous||e.connect(s)}return this._startIfPossible(),this}remove(e,t){let s=this._head.next;for(;s;)s.match(e,t)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){const n=e-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=e-n%this._minElapsedMS}this.deltaMS=t,this.deltaTime=this.deltaMS*rt.targetFPMS;const s=this._head;let r=s.next;for(;r;)r=r.emit(this);s.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=e}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(e){const t=Math.min(this.maxFPS,e),s=Math.min(Math.max(0,t)/1e3,rt.targetFPMS);this._maxElapsedMS=1/s}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{const t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!rt._shared){const e=rt._shared=new rt;e.autoStart=!0,e._protected=!0}return rt._shared}static get system(){if(!rt._system){const e=rt._system=new rt;e.autoStart=!0,e._protected=!0}return rt._system}};sm.targetFPMS=.06;let Qe=sm,du;async function JT(){return du??(du=(async()=>{const e=he.get().createCanvas(1,1).getContext("webgl");if(!e)return"premultiply-alpha-on-upload";const t=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!t)return"premultiply-alpha-on-upload";const s=e.createTexture();e.bindTexture(e.TEXTURE_2D,s);const r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,s,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);const n=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,n),e.deleteFramebuffer(r),e.deleteTexture(s),e.getExtension("WEBGL_lose_context")?.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),du}const Rr=class Tx extends Ie{constructor(e){super(e),this.isReady=!1,this.uploadMethodId="video",e={...Tx.defaultOptions,...e},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=e.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=e.autoPlay!==!1,this.alphaMode=e.alphaMode??"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),e.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const e=Qe.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const e=this.resource,t=this.options;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener("play",this._onPlayStart),e.addEventListener("pause",this._onPlayStop),e.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(t.preload||e.addEventListener("canplay",this._onCanPlay),e.addEventListener("canplaythrough",this._onCanPlayThrough),e.addEventListener("error",this._onError,!0)),this.alphaMode=await JT(),this._load=new Promise((s,r)=>{this.isValid?s(this):(this._resolve=s,this._reject=r,t.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${t.preloadTimeoutMs}ms`))})),e.load())}),this._load}_onError(e){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){const e=this.resource;return!e.paused&&!e.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const e=this.resource;this.isValid&&(this.isReady=!0,this.resize(e.videoWidth,e.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const e=this.resource;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlayThrough),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(Qe.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Qe.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Qe.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement}};Rr.extension=T.TextureSource,Rr.defaultOptions={...Ie.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1},Rr.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let QT=Rr;const Bi=(i,e,t=!1)=>(Array.isArray(i)||(i=[i]),e?i.map(s=>typeof s=="string"||t?e(s):s):i);class eS{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){const t=this._cache.get(e);return t||K(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){const s=Bi(e);let r;for(let l=0;l<this.parsers.length;l++){const c=this.parsers[l];if(c.test(t)){r=c.getCacheableAssets(s,t);break}}const n=new Map(Object.entries(r||{}));r||s.forEach(l=>{n.set(l,t)});const o=[...n.keys()],a={cacheKeys:o,keys:s};s.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{const c=r?r[l]:t;this._cache.has(l)&&this._cache.get(l)!==c&&K("[Cache] already has key:",l),this._cache.set(l,n.get(l))})}remove(e){if(!this._cacheMap.has(e)){K(`[Assets] Asset id ${e} was not found in the Cache`);return}const t=this._cacheMap.get(e);t.cacheKeys.forEach(r=>{this._cache.delete(r)}),t.keys.forEach(r=>{this._cacheMap.delete(r)})}get parsers(){return this._parsers}}const ze=new eS,fu=[];q.handleByList(T.TextureSource,fu);function rm(i={}){const e=i&&i.resource,t=e?i.resource:i,s=e?i:{resource:i};for(let r=0;r<fu.length;r++){const n=fu[r];if(n.test(t))return new n(s)}throw new Error(`Could not find a source type for resource: ${s.resource}`)}function tS(i={},e=!1){const t=i&&i.resource,s=t?i.resource:i,r=t?i:{resource:i};if(!e&&ze.has(s))return ze.get(s);const n=new F({source:rm(r)});return n.on("destroy",()=>{ze.has(s)&&ze.remove(s)}),e||ze.set(s,n),n}function iS(i,e=!1){return typeof i=="string"?ze.get(i):i instanceof Ie?new F({source:i}):tS(i,e)}F.from=iS,Ie.from=rm,q.add(Qp,em,tm,QT,Kt,kt,Kh);var nm=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(nm||{});function ft(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function cs(i){return i.split("?")[0].split("#")[0]}function sS(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function rS(i,e,t){return i.replace(new RegExp(sS(e),"g"),t)}function nS(i,e){let t="",s=0,r=-1,n=0,o=-1;for(let a=0;a<=i.length;++a){if(a<i.length)o=i.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(r===a-1||n===1))if(r!==a-1&&n===2){if(t.length<2||s!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){const l=t.lastIndexOf("/");if(l!==t.length-1){l===-1?(t="",s=0):(t=t.slice(0,l),s=t.length-1-t.lastIndexOf("/")),r=a,n=0;continue}}else if(t.length===2||t.length===1){t="",s=0,r=a,n=0;continue}}}else t.length>0?t+=`/${i.slice(r+1,a)}`:t=i.slice(r+1,a),s=a-r-1;r=a,n=0}else o===46&&n!==-1?++n:n=-1}return t}const hs={toPosix(i){return rS(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){ft(i),i=this.toPosix(i);const e=/^file:\/\/\//.exec(i);if(e)return e[0];const t=/^[^/:]+:\/{0,2}/.exec(i);return t?t[0]:""},toAbsolute(i,e,t){if(ft(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=cs(this.toPosix(e??he.get().getBaseUrl())),r=cs(this.toPosix(t??this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?hs.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(ft(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let e="";const t=i.startsWith("/");this.hasProtocol(i)&&(e=this.rootname(i),i=i.slice(e.length));const s=i.endsWith("/");return i=nS(i),i.length>0&&s&&(i+="/"),t?`/${i}`:e+i},isAbsolute(i){return ft(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let e;for(let t=0;t<i.length;++t){const s=i[t];if(ft(s),s.length>0)if(e===void 0)e=s;else{const r=i[t-1]??"";this.joinExtensions.includes(this.extname(r).toLowerCase())?e+=`/../${s}`:e+=`/${s}`}}return e===void 0?".":this.normalize(e)},dirname(i){if(ft(i),i.length===0)return".";i=this.toPosix(i);let e=i.charCodeAt(0);const t=e===47;let s=-1,r=!0;const n=this.getProtocol(i),o=i;i=i.slice(n.length);for(let a=i.length-1;a>=1;--a)if(e=i.charCodeAt(a),e===47){if(!r){s=a;break}}else r=!1;return s===-1?t?"/":this.isUrl(o)?n+i:n:t&&s===1?"//":n+i.slice(0,s)},rootname(i){ft(i),i=this.toPosix(i);let e="";if(i.startsWith("/")?e="/":e=this.getProtocol(i),this.isUrl(i)){const t=i.indexOf("/",e.length);t!==-1?e=i.slice(0,t):e=i,e.endsWith("/")||(e+="/")}return e},basename(i,e){ft(i),e&&ft(e),i=cs(this.toPosix(i));let t=0,s=-1,r=!0,n;if(e!==void 0&&e.length>0&&e.length<=i.length){if(e.length===i.length&&e===i)return"";let o=e.length-1,a=-1;for(n=i.length-1;n>=0;--n){const l=i.charCodeAt(n);if(l===47){if(!r){t=n+1;break}}else a===-1&&(r=!1,a=n+1),o>=0&&(l===e.charCodeAt(o)?--o===-1&&(s=n):(o=-1,s=a))}return t===s?s=a:s===-1&&(s=i.length),i.slice(t,s)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!r){t=n+1;break}}else s===-1&&(r=!1,s=n+1);return s===-1?"":i.slice(t,s)},extname(i){ft(i),i=cs(this.toPosix(i));let e=-1,t=0,s=-1,r=!0,n=0;for(let o=i.length-1;o>=0;--o){const a=i.charCodeAt(o);if(a===47){if(!r){t=o+1;break}continue}s===-1&&(r=!1,s=o+1),a===46?e===-1?e=o:n!==1&&(n=1):e!==-1&&(n=-1)}return e===-1||s===-1||n===0||n===1&&e===s-1&&e===t+1?"":i.slice(e,s)},parse(i){ft(i);const e={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return e;i=cs(this.toPosix(i));let t=i.charCodeAt(0);const s=this.isAbsolute(i);let r;e.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let n=-1,o=0,a=-1,l=!0,c=i.length-1,h=0;for(;c>=r;--c){if(t=i.charCodeAt(c),t===47){if(!l){o=c+1;break}continue}a===-1&&(l=!1,a=c+1),t===46?n===-1?n=c:h!==1&&(h=1):n!==-1&&(h=-1)}return n===-1||a===-1||h===0||h===1&&n===a-1&&n===o+1?a!==-1&&(o===0&&s?e.base=e.name=i.slice(1,a):e.base=e.name=i.slice(o,a)):(o===0&&s?(e.name=i.slice(1,n),e.base=i.slice(1,a)):(e.name=i.slice(o,n),e.base=i.slice(o,a)),e.ext=i.slice(n,a)),e.dir=this.dirname(i),e},sep:"/",delimiter:":",joinExtensions:[".html"]};function om(i,e,t,s,r){const n=e[t];for(let o=0;o<n.length;o++){const a=n[o];t<e.length-1?om(i.replace(s[t],a),e,t+1,s,r):r.push(i.replace(s[t],a))}}function oS(i){const e=/\{(.*?)\}/g,t=i.match(e),s=[];if(t){const r=[];t.forEach(n=>{const o=n.substring(1,n.length-1).split(",");r.push(o)}),om(i,r,0,t,s)}else s.push(i);return s}const am=i=>!Array.isArray(i);class lm{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{const t=e;this._defaultSearchParams=Object.keys(t).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(t[s])}`).join("&")}}getAlias(e){const{alias:t,src:s}=e;return Bi(t||s,n=>typeof n=="string"?n:Array.isArray(n)?n.map(o=>o?.src??o):n?.src?n.src:n,!0)}addManifest(e){this._manifest&&K("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(t=>{this.addBundle(t.name,t.assets)})}addBundle(e,t){const s=[];let r=t;Array.isArray(t)||(r=Object.entries(t).map(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:{alias:n,...o})),r.forEach(n=>{const o=n.src,a=n.alias;let l;if(typeof a=="string"){const c=this._createBundleAssetId(e,a);s.push(c),l=[a,c]}else{const c=a.map(h=>this._createBundleAssetId(e,h));s.push(...c),l=[...a,...c]}this.add({...n,alias:l,src:o})}),this._bundles[e]=s}add(e){const t=[];Array.isArray(e)?t.push(...e):t.push(e);let s;s=n=>{this.hasKey(n)&&K(`[Resolver] already has key: ${n} overwriting`)},Bi(t).forEach(n=>{const{src:o}=n;let{data:a,format:l,loadParser:c,parser:h}=n;const u=Bi(o).map(g=>typeof g=="string"?oS(g):Array.isArray(g)?g:[g]),d=this.getAlias(n);Array.isArray(d)?d.forEach(s):s(d);const f=[],p=g=>({...this._parsers.find(_=>_.test(g))?.parse(g),src:g});u.forEach(g=>{g.forEach(m=>{let _={};if(typeof m!="object"?_=p(m):(a=m.data??a,l=m.format??l,(m.loadParser||m.parser)&&(c=m.loadParser??c,h=m.parser??h),_={...p(m.src),...m}),!d)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this._buildResolvedAsset(_,{aliases:d,data:a,format:l,loadParser:c,parser:h,progressSize:n.progressSize}),f.push(_)})}),d.forEach(g=>{this._assetMap[g]=f})})}resolveBundle(e){const t=am(e);e=Bi(e);const s={};return e.forEach(r=>{const n=this._bundles[r];if(n){const o=this.resolve(n),a={};for(const l in o){const c=o[l];a[this._extractAssetIdFromBundle(r,l)]=c}s[r]=a}}),t?s[e[0]]:s}resolveUrl(e){const t=this.resolve(e);if(typeof e!="string"){const s={};for(const r in t)s[r]=t[r].src;return s}return t.src}resolve(e){const t=am(e);e=Bi(e);const s={};return e.forEach(r=>{if(!this._resolverHash[r])if(this._assetMap[r]){let n=this._assetMap[r];const o=this._getPreferredOrder(n);o?.priority.forEach(a=>{o.params[a].forEach(l=>{const c=n.filter(h=>h[a]?h[a]===l:!1);c.length&&(n=c)})}),this._resolverHash[r]=n[0]}else this._resolverHash[r]=this._buildResolvedAsset({alias:[r],src:r},{});s[r]=this._resolverHash[r]}),t?s[e[0]]:s}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){const s=e[t],r=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}_buildResolvedAsset(e,t){const{aliases:s,data:r,loadParser:n,parser:o,format:a,progressSize:l}=t;return(this._basePath||this._rootPath)&&(e.src=hs.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=s??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...r||{},...e.data},e.loadParser=n??e.loadParser,e.parser=o??e.parser,e.format=a??e.format??aS(e.src),l!==void 0&&(e.progressSize=l),e}}lm.RETINA_PREFIX=/@([0-9\.]+)x/;function aS(i){return i.split(".").pop().split("?").shift().split("#").shift()}const cm=(i,e)=>{const t=e.split("?")[1];return t&&(i+=`?${t}`),i},hm=class Ls{constructor(e,t){this.linkedSheets=[];let s=e;e?.source instanceof Ie&&(s={texture:e,data:t});const{texture:r,data:n,cachePrefix:o=""}=s;this.cachePrefix=o,this._texture=r instanceof F?r:null,this.textureSource=r.source,this.textures={},this.animations={},this.data=n;const a=parseFloat(n.meta.scale);a?(this.resolution=a,r.source.resolution=this.resolution):this.resolution=r.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=Ls.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let t=e;const s=Ls.BATCH_SIZE;for(;t-e<s&&t<this._frameKeys.length;){const r=this._frameKeys[t],n=this._frames[r],o=n.frame;if(o){let a=null,l=null;const c=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,h=new V(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);n.rotated?a=new V(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new V(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(l=new V(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[r]=new F({source:this.textureSource,frame:a,orig:h,trim:l,rotate:n.rotated?2:0,defaultAnchor:n.anchor,defaultBorders:n.borders,label:r.toString()})}t++}}_processAnimations(){const e=this.data.animations||{};for(const t in e){this.animations[t]=[];for(let s=0;s<e[t].length;s++){const r=e[t][s];this.animations[t].push(this.textures[r])}}}_parseComplete(){const e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Ls.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Ls.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){for(const t in this.textures)this.textures[t].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&(this._texture?.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};hm.BATCH_SIZE=1e3;let um=hm;const lS=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function dm(i,e,t){const s={};if(i.forEach(r=>{s[r]=e}),Object.keys(e.textures).forEach(r=>{s[`${e.cachePrefix}${r}`]=e.textures[r]}),!t){const r=hs.dirname(i[0]);e.linkedSheets.forEach((n,o)=>{const a=dm([`${r}/${e.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(s,a)})}return s}const cS={extension:T.Asset,cache:{test:i=>i instanceof um,getCacheableAssets:(i,e)=>dm(i,e,!1)},resolver:{extension:{type:T.ResolveParser,name:"resolveSpritesheet"},test:i=>{const t=i.split("?")[0].split("."),s=t.pop(),r=t.pop();return s==="json"&&lS.includes(r)},parse:i=>{const e=i.split(".");return{resolution:parseFloat(lm.RETINA_PREFIX.exec(i)?.[1]??"1"),format:e[e.length-2],src:i}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:T.LoadParser,priority:nm.Normal,name:"spritesheetLoader"},async testParse(i,e){return hs.extname(e.src).toLowerCase()===".json"&&!!i.frames},async parse(i,e,t){const{texture:s,imageFilename:r,textureOptions:n,cachePrefix:o}=e?.data??{};let a=hs.dirname(e.src);a&&a.lastIndexOf("/")!==a.length-1&&(a+="/");let l;if(s instanceof F)l=s;else{const u=cm(a+(r??i.meta.image),e.src);l=(await t.load([{src:u,data:n}]))[u]}const c=new um({texture:l.source,data:i,cachePrefix:o});await c.parse();const h=i?.meta?.related_multi_packs;if(Array.isArray(h)){const u=[];for(const f of h){if(typeof f!="string")continue;let p=a+f;e.data?.ignoreMultiPack||(p=cm(p,e.src),u.push(t.load({src:p,data:{textureOptions:n,ignoreMultiPack:!0}})))}const d=await Promise.all(u);c.linkedSheets=d,d.forEach(f=>{f.linkedSheets=[c].concat(c.linkedSheets.filter(p=>p!==f))})}return c},async unload(i,e,t){await t.unload(i.textureSource._sourceOrigin),i.destroy(!1)}}};q.add(cS);class fm{constructor(e){this._lastTransform="",this._observer=null,this._tickerAttached=!1,this.updateTranslation=()=>{if(!this._canvas)return;const t=this._canvas.getBoundingClientRect(),s=this._canvas.width,r=this._canvas.height,n=t.width/s*this._renderer.resolution,o=t.height/r*this._renderer.resolution,a=t.left,l=t.top,c=`translate(${a}px, ${l}px) scale(${n}, ${o})`;c!==this._lastTransform&&(this._domElement.style.transform=c,this._lastTransform=c)},this._domElement=e.domElement,this._renderer=e.renderer,!(globalThis.OffscreenCanvas&&this._renderer.canvas instanceof OffscreenCanvas)&&(this._canvas=this._renderer.canvas,this._attachObserver())}get canvas(){return this._canvas}ensureAttached(){!this._domElement.parentNode&&this._canvas.parentNode&&(this._canvas.parentNode.appendChild(this._domElement),this.updateTranslation())}_attachObserver(){"ResizeObserver"in globalThis?(this._observer&&(this._observer.disconnect(),this._observer=null),this._observer=new ResizeObserver(e=>{for(const t of e){if(t.target!==this._canvas)continue;const s=this.canvas.width,r=this.canvas.height,n=t.contentRect.width/s*this._renderer.resolution,o=t.contentRect.height/r*this._renderer.resolution;(this._lastScaleX!==n||this._lastScaleY!==o)&&(this.updateTranslation(),this._lastScaleX=n,this._lastScaleY=o)}}),this._observer.observe(this._canvas)):this._tickerAttached||Qe.shared.add(this.updateTranslation,this,Ui.HIGH)}destroy(){this._observer?(this._observer.disconnect(),this._observer=null):this._tickerAttached&&Qe.shared.remove(this.updateTranslation),this._domElement=null,this._renderer=null,this._canvas=null,this._tickerAttached=!1,this._lastTransform="",this._lastScaleX=null,this._lastScaleY=null}}class us{constructor(e){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=us.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new X,this.page=new X,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,s){throw new Error("initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}initUIEvent(e,t,s,r,n){throw new Error("initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.")}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}}var pu=/iPhone/i,pm=/iPod/i,mm=/iPad/i,gm=/\biOS-universal(?:.+)Mac\b/i,mu=/\bAndroid(?:.+)Mobile\b/i,_m=/Android/i,Oi=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Mr=/Silk/i,Ft=/Windows Phone/i,xm=/\bWindows(?:.+)ARM\b/i,ym=/BlackBerry/i,vm=/BB10/i,bm=/Opera Mini/i,wm=/\b(CriOS|Chrome)(?:.+)Mobile/i,Tm=/Mobile(?:.+)Firefox\b/i,Sm=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};function hS(i){return function(e){return e.test(i)}}function Cm(i){var e={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?e.userAgent=i:i&&i.userAgent&&(e={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var t=e.userAgent,s=t.split("[FBAN");typeof s[1]<"u"&&(t=s[0]),s=t.split("Twitter"),typeof s[1]<"u"&&(t=s[0]);var r=hS(t),n={apple:{phone:r(pu)&&!r(Ft),ipod:r(pm),tablet:!r(pu)&&(r(mm)||Sm(e))&&!r(Ft),universal:r(gm),device:(r(pu)||r(pm)||r(mm)||r(gm)||Sm(e))&&!r(Ft)},amazon:{phone:r(Oi),tablet:!r(Oi)&&r(Mr),device:r(Oi)||r(Mr)},android:{phone:!r(Ft)&&r(Oi)||!r(Ft)&&r(mu),tablet:!r(Ft)&&!r(Oi)&&!r(mu)&&(r(Mr)||r(_m)),device:!r(Ft)&&(r(Oi)||r(Mr)||r(mu)||r(_m))||r(/\bokhttp\b/i)},windows:{phone:r(Ft),tablet:r(xm),device:r(Ft)||r(xm)},other:{blackberry:r(ym),blackberry10:r(vm),opera:r(bm),firefox:r(Tm),chrome:r(wm),device:r(ym)||r(vm)||r(bm)||r(Tm)||r(wm)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const uS=(Cm.default??Cm)(globalThis.navigator),dS=9,Em=100,fS=0,pS=0,Am=2,Im=1,mS=-1e3,gS=-1e3,_S=2,gu=class Sx{constructor(e,t=uS){this._mobileInfo=t,this.debug=!1,this._activateOnTab=!0,this._deactivateOnMouseMove=!0,this._isActive=!1,this._isMobileAccessibility=!1,this._div=null,this._pools={},this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._isRunningTests=!1,this._boundOnKeyDown=this._onKeyDown.bind(this),this._boundOnMouseMove=this._onMouseMove.bind(this),this._hookDiv=null,(t.tablet||t.phone)&&this._createTouchHook(),this._renderer=e}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}get div(){return this._div}_createTouchHook(){const e=document.createElement("button");e.style.width=`${Im}px`,e.style.height=`${Im}px`,e.style.position="absolute",e.style.top=`${mS}px`,e.style.left=`${gS}px`,e.style.zIndex=_S.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){if(this._isActive)return;this._isActive=!0,this._div||(this._div=document.createElement("div"),this._div.style.position="absolute",this._div.style.top=`${fS}px`,this._div.style.left=`${pS}px`,this._div.style.pointerEvents="none",this._div.style.zIndex=Am.toString(),this._canvasObserver=new fm({domElement:this._div,renderer:this._renderer})),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._deactivateOnMouseMove&&globalThis.document.addEventListener("mousemove",this._boundOnMouseMove,!0);const e=this._renderer.view.canvas;if(e.parentNode)this._canvasObserver.ensureAttached(),this._initAccessibilitySetup();else{const t=new MutationObserver(()=>{e.parentNode&&(t.disconnect(),this._canvasObserver.ensureAttached(),this._initAccessibilitySetup())});t.observe(document.body,{childList:!0,subtree:!0})}}_initAccessibilitySetup(){this._renderer.runners.postrender.add(this),this._renderer.lastObjectRendered&&this._updateAccessibleObjects(this._renderer.lastObjectRendered)}_deactivate(){if(!(!this._isActive||this._isMobileAccessibility)){this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._boundOnMouseMove,!0),this._activateOnTab&&globalThis.addEventListener("keydown",this._boundOnKeyDown,!1),this._renderer.runners.postrender.remove(this);for(const e of this._children)e._accessibleDiv?.parentNode&&(e._accessibleDiv.parentNode.removeChild(e._accessibleDiv),e._accessibleDiv=null),e._accessibleActive=!1;for(const e in this._pools)this._pools[e].forEach(s=>{s.parentNode&&s.parentNode.removeChild(s)}),delete this._pools[e];this._div?.parentNode&&this._div.parentNode.removeChild(this._div),this._pools={},this._children=[]}}_updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&(e._accessibleActive||this._addChild(e),e._renderId=this._renderId);const t=e.children;if(t)for(let s=0;s<t.length;s++)this._updateAccessibleObjects(t[s])}init(e){const s={accessibilityOptions:{...Sx.defaultOptions,...e?.accessibilityOptions||{}}};this.debug=s.accessibilityOptions.debug,this._activateOnTab=s.accessibilityOptions.activateOnTab,this._deactivateOnMouseMove=s.accessibilityOptions.deactivateOnMouseMove,s.accessibilityOptions.enabledByDefault&&this._activate(),this._renderer.runners.postrender.remove(this)}postrender(){const e=performance.now();if(this._mobileInfo.android.device&&e<this._androidUpdateCount||(this._androidUpdateCount=e+this._androidUpdateFrequency,(!this._renderer.renderingToScreen||!this._renderer.view.canvas)&&!this._isRunningTests))return;const t=new Set;if(this._renderer.lastObjectRendered){this._updateAccessibleObjects(this._renderer.lastObjectRendered);for(const s of this._children)s._renderId===this._renderId&&t.add(this._children.indexOf(s))}for(let s=this._children.length-1;s>=0;s--){const r=this._children[s];t.has(s)||(r._accessibleDiv&&r._accessibleDiv.parentNode&&(r._accessibleDiv.parentNode.removeChild(r._accessibleDiv),this._getPool(r.accessibleType).push(r._accessibleDiv),r._accessibleDiv=null),r._accessibleActive=!1,Wp(this._children,s,1))}this._renderer.renderingToScreen&&this._canvasObserver.ensureAttached();for(let s=0;s<this._children.length;s++){const r=this._children[s];if(!r._accessibleActive||!r._accessibleDiv)continue;const n=r._accessibleDiv,o=r.hitArea||r.getBounds().rectangle;if(r.hitArea){const a=r.worldTransform;n.style.left=`${a.tx+o.x*a.a}px`,n.style.top=`${a.ty+o.y*a.d}px`,n.style.width=`${o.width*a.a}px`,n.style.height=`${o.height*a.d}px`}else this._capHitArea(o),n.style.left=`${o.x}px`,n.style.top=`${o.y}px`,n.style.width=`${o.width}px`,n.style.height=`${o.height}px`}this._renderId++}_updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}_capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:s}=this._renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>s&&(e.height=s-e.y)}_addChild(e){let s=this._getPool(e.accessibleType).pop();s?(s.innerHTML="",s.removeAttribute("title"),s.removeAttribute("aria-label"),s.tabIndex=0):(e.accessibleType==="button"?s=document.createElement("button"):(s=document.createElement(e.accessibleType),s.style.cssText=`
@@ -4303,7 +4303,7 @@ void main() {
4303
4303
 
4304
4304
  gl_FragColor = color;
4305
4305
  }
4306
- `,uniforms:{uTime:{value:0,type:"f32"},uZoomSpeed:{value:5,type:"f32"},uMaxZoom:{value:2,type:"f32"},uBlurStrength:{value:.01,type:"f32"}}}}},DP=Object.entries(zd).map(([i,e])=>({key:i,label:e.label,previewStatic:`https://cdn.subgen.co/previews/effects/static/effect_${i}_static.webp`,previewDynamic:`https://cdn.subgen.co/previews/effects/dynamic/effect_${i}_dynamic.webp`}));function Nd({name:i,renderer:e}){let t;const s=Object.keys(zd).find(u=>u.toLowerCase()===i.toLowerCase());s&&(t=zd[s]);const{fragment:r,uniforms:n,label:o}=t,a=new Be,l=De.create({width:e.width,height:e.height}),c=new Ct({vertex:wP,fragment:r,name:`${o}-shader`}),h=new Di({glProgram:c,resources:{effectUniforms:{...n}}});return a.filters=[h],{filter:h,render({width:u,height:d,canvasTexture:f,progress:p}){(l.width!==u||l.height!==d)&&l.resize(u,d);const g=f instanceof De?f:F.from(f);a.texture=g,a.width=u,a.height=d;const m=h.resources.effectUniforms.uniforms;return m.uTime=p,e.render({container:a,target:l,clear:!0}),l}}}function GP(i,e){const{opacity:t,zIndex:s,flip:r,left:n,top:o,width:a,height:l,angle:c}=i;e.x=n,e.y=o,e.width=Math.abs(a),e.height=Math.abs(l),e.angle=c,e.alpha=t,e.zIndex=s,r==="horizontal"?e.scale.x=-Math.abs(e.scale.x):r==="vertical"&&(e.scale.y=-Math.abs(e.scale.y))}class cx{constructor(e,t,s=null){this.sprite=t,this.targetContainer=s,!s&&e&&(this.targetContainer=e.stage),this.resolution=e?.renderer?.resolution??1,this.canvas=new OffscreenCanvas(1,1);const r=this.canvas.getContext("2d");if(r==null)throw new Error("Failed to create 2d context for PixiSpriteRenderer");this.context=r,this.root=new le,this.root.visible=!1,this.targetContainer&&this.targetContainer.addChild(this.root)}pixiSprite=null;texture=null;canvas;context;root=null;strokeGraphics=null;maskGraphics=null;shadowGraphics=null;shadowContainer=null;resolution=1;destroyed=!1;async updateFrame(e){if(this.destroyed)return;if(e==null){this.root!=null&&(this.root.visible=!1,this.applySpriteTransforms());return}if(e instanceof F||e&&typeof e.source<"u"){if(e.width===0||e.height===0){console.warn("PixiSpriteRenderer: Texture has zero dimensions",e.width,e.height);return}this.pixiSprite==null?(this.pixiSprite=new Be(e),this.pixiSprite.label="MainSprite",this.root.addChild(this.pixiSprite),this.applySpriteTransforms()):this.pixiSprite.texture=e,this.root!=null&&(this.root.visible=!0,this.applySpriteTransforms());return}const s=e.width,r=e.height;if(typeof s!="number"||typeof r!="number"||s<=0||r<=0){console.warn("PixiSpriteRenderer: Invalid frame dimensions",s,r);return}const n=this.texture==null||this.pixiSprite==null,o=Math.floor(s),a=Math.floor(r);if(this.canvas.width!==o||this.canvas.height!==a||n){if(this.canvas.width=o,this.canvas.height=a,this.texture!=null&&(this.texture.destroy(!0),this.texture=null),this.texture=F.from(this.canvas),!this.texture||!this.texture.source){console.error("PixiSpriteRenderer: Failed to create valid texture");return}this.pixiSprite==null?(this.pixiSprite=new Be(this.texture),this.pixiSprite.label="MainSprite",this.root.addChild(this.pixiSprite),this.applySpriteTransforms()):this.pixiSprite.texture=this.texture}if(this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.drawImage(e,0,0),this.texture!=null&&this.texture.source!=null){const c=this.texture.source;if(c.resource){const h=c.resource;h.update&&h.update()}typeof c.update=="function"&&c.update()}this.root!=null&&(this.root.visible=!0,this.applySpriteTransforms())}applySpriteTransforms(){if(this.pixiSprite==null||this.root==null||this.destroyed)return;const{flip:e,center:t,width:s,height:r,angle:n,opacity:o,zIndex:a}=this.sprite;this.root.x=t.x,this.root.y=t.y,this.root.angle=(e==null?1:-1)*n,this.root.alpha=o,this.root.zIndex=a,this.root.scale.set(1,1),this.pixiSprite.anchor.set(.5,.5),this.pixiSprite.position.set(0,0);const l=this.pixiSprite.texture?.width??1,c=this.pixiSprite.texture?.height??1,h=this.sprite.type==="Caption",u=!h&&s&&s!==0?Math.abs(s)/l:1,d=!h&&r&&r!==0?Math.abs(r)/c:1;e==="horizontal"?(this.pixiSprite.scale.x=-u,this.pixiSprite.scale.y=d):e==="vertical"?(this.pixiSprite.scale.x=u,this.pixiSprite.scale.y=-d):(this.pixiSprite.scale.x=u,this.pixiSprite.scale.y=d),this.applyStyle()}applyStyle(){if(this.pixiSprite==null||this.destroyed)return;const e=this.sprite.style||{},t=this.pixiSprite.texture?.width??0,s=this.pixiSprite.texture?.height??0;if(t===0||s===0)return;const r=e.borderRadius||0;r>0?(this.maskGraphics==null&&(this.maskGraphics=new ye,this.pixiSprite.addChild(this.maskGraphics),this.pixiSprite.mask=this.maskGraphics),this.maskGraphics.clear(),this.maskGraphics.roundRect(-t/2,-s/2,t,s,Math.min(r,t/2,s/2)),this.maskGraphics.fill({color:16777215,alpha:1}),this.maskGraphics.visible=!0):this.maskGraphics&&(this.maskGraphics.visible=!1,this.pixiSprite.mask=null),this.sprite.type!=="Text"&&this.sprite.type!=="Caption"?this.applyStroke(e,t,s):this.strokeGraphics&&(this.strokeGraphics.visible=!1),this.sprite.type!=="Text"&&this.sprite.type!=="Caption"?this.applyShadow(e):this.shadowContainer&&(this.shadowContainer.visible=!1,this.shadowContainer.filters=[])}applyStroke(e,t,s){const r=e.stroke;if(r&&r.width>0){this.strokeGraphics==null&&(this.strokeGraphics=new ye,this.pixiSprite.addChild(this.strokeGraphics)),this.strokeGraphics.clear();const n=Ee(r.color)??16777215,o=r.width,a=e.borderRadius||0;if(this.strokeGraphics.setStrokeStyle({width:o,color:n,alignment:1}),a>0){const l=Math.min(a,t/2,s/2);this.strokeGraphics.roundRect(-t/2,-s/2,t,s,l)}else this.strokeGraphics.rect(-t/2,-s/2,t,s);this.strokeGraphics.stroke(),this.strokeGraphics.visible=!0}else this.strokeGraphics!=null&&(this.strokeGraphics.visible=!1)}applyShadow(e){const t=e.dropShadow,s=Math.abs(this.sprite.width??0),r=Math.abs(this.sprite.height??0);if(t&&s>0&&r>0&&(t.blur>0||t.distance>0)){this.shadowContainer==null&&(this.shadowContainer=new le,this.shadowContainer.label="ShadowContainer",this.shadowGraphics=new ye,this.shadowContainer.addChild(this.shadowGraphics),this.root.addChildAt(this.shadowContainer,0));const n=Ee(t.color)??0,o=t.alpha??.5,a=t.blur??0,l=t.distance??0,c=t.angle??0,h=Math.cos(c)*l,u=Math.sin(c)*l;this.shadowContainer.position.set(h,u),this.shadowGraphics.clear();const d=e.borderRadius||0;if(d>0){const f=Math.min(d,s/2,r/2);this.shadowGraphics.roundRect(-s/2,-r/2,s,r,f)}else this.shadowGraphics.rect(-s/2,-r/2,s,r);if(this.shadowGraphics.fill({color:n,alpha:o}),a>0){(!this.shadowContainer.filters||this.shadowContainer.filters.length===0)&&(this.shadowContainer.filters=[new Yg]);const f=this.shadowContainer.filters[0],p=this.root?Math.sqrt(this.root.worldTransform.a**2+this.root.worldTransform.b**2):1;f.strength=a*p,f.resolution=this.resolution,f.padding=Math.max(a*2*p,20)}else this.shadowContainer.filters=[];this.shadowContainer.visible=!0}else this.shadowContainer!=null&&(this.shadowContainer.visible=!1,this.shadowContainer.filters=[])}updateTransforms(){this.root!=null&&!this.destroyed&&this.applySpriteTransforms()}getSprite(){return this.pixiSprite}getRoot(){return this.root}destroy(){this.destroyed||(this.destroyed=!0,this.root!=null&&(this.root.parent&&this.root.parent.removeChild(this.root),this.root.destroy({children:!0}),this.root=null,this.pixiSprite=null),this.strokeGraphics!=null&&(this.strokeGraphics.destroy(),this.strokeGraphics=null),this.maskGraphics!=null&&(this.maskGraphics.destroy(),this.maskGraphics=null),this.shadowGraphics!=null&&(this.shadowGraphics.destroy(),this.shadowGraphics=null),this.shadowContainer!=null&&(this.shadowContainer.destroy({children:!0}),this.shadowContainer=null),this.texture!=null&&(this.texture.destroy(),this.texture=null))}}function zs(i,e=!1){return i.toJSON(e)}async function Vi(i){let e,t=null;switch(i.type){case"Video":t=je;break;case"Audio":t=at;break;case"Image":return e=await Gs.fromObject(i),e;case"Text":t=xt;break;case"Caption":t=Nt;break;case"Effect":t=ut;break;case"Transition":t=Et;break;case"Placeholder":t=on;break}if(t&&typeof t.fromObject=="function")return await t.fromObject(i);switch(i.type){case"Text":{const s=i.text||"",r=i.style||{},n={fontSize:r.fontSize,fontFamily:r.fontFamily,fontWeight:r.fontWeight,fontStyle:r.fontStyle,fill:r.color,align:r.align};r.stroke&&(n.stroke=r.stroke.color,n.strokeWidth=r.stroke.width),r.shadow&&(n.dropShadow={color:r.shadow.color,alpha:r.shadow.alpha,blur:r.shadow.blur,distance:r.shadow.distance,angle:r.shadow.angle}),e=new xt(s,n);break}case"Caption":{const s=i.text||"",r=i.style||{},n={fontSize:r.fontSize,fontFamily:r.fontFamily,fontWeight:r.fontWeight,fontStyle:r.fontStyle,fill:r.color,align:r.align};if(r.fontUrl!==void 0?n.fontUrl=r.fontUrl:i.fontUrl!==void 0&&(n.fontUrl=i.fontUrl),r.wordsPerLine!==void 0?n.wordsPerLine=r.wordsPerLine:i.wordsPerLine!==void 0&&(n.wordsPerLine=i.wordsPerLine),r.stroke&&(n.stroke=r.stroke.color,n.strokeWidth=r.stroke.width),r.shadow&&(n.dropShadow={color:r.shadow.color,alpha:r.shadow.alpha,blur:r.shadow.blur,distance:r.shadow.distance,angle:r.shadow.angle}),i.caption){const o=i.caption;o.words&&(n.words=o.words),o.colors&&(o.colors.appeared!==void 0&&(n.appearedColor=o.colors.appeared),o.colors.active!==void 0&&(n.activeColor=o.colors.active),o.colors.activeFill!==void 0&&(n.activeFillColor=o.colors.activeFill),o.colors.background!==void 0&&(n.backgroundColor=o.colors.background),o.colors.keyword!==void 0&&(n.isKeyWordColor=o.colors.keyword)),o.preserveKeywordColor!==void 0&&(n.preservedColorKeyWord=o.preserveKeywordColor),o.positioning&&(o.positioning.bottomOffset!==void 0&&(n.bottomOffset=o.positioning.bottomOffset),o.positioning.videoWidth!==void 0&&(n.videoWidth=o.positioning.videoWidth),o.positioning.videoHeight!==void 0&&(n.videoHeight=o.positioning.videoHeight))}else i.bottomOffset!==void 0&&(n.bottomOffset=i.bottomOffset),i.words&&(n.words=i.words),i.appearedColor!==void 0&&(n.appearedColor=i.appearedColor),i.activeColor!==void 0&&(n.activeColor=i.activeColor),i.activeFillColor!==void 0&&(n.activeFillColor=i.activeFillColor),i.backgroundColor!==void 0&&(n.backgroundColor=i.backgroundColor),i.isKeyWordColor!==void 0&&(n.isKeyWordColor=i.isKeyWordColor),i.preservedColorKeyWord!==void 0&&(n.preservedColorKeyWord=i.preservedColorKeyWord),i.videoWidth!==void 0&&(n.videoWidth=i.videoWidth),i.videoHeight!==void 0&&(n.videoHeight=i.videoHeight);i.mediaId&&(n.mediaId=i.mediaId),i.wordsPerLine&&(n.wordsPerLine=i.wordsPerLine),n.initialLayoutApplied=!0,e=new Nt(s,n);break}case"Effect":{e=new ut(i.effect.key),e.effect=i.effect;break}default:throw new Error(`Unsupported clip type: ${i.type}`)}return e.left=i.left,e.top=i.top,e.width=i.width,e.height=i.height,e.angle=i.angle,e.display.from=i.display.from,e.display.to=i.display.to,e.duration=i.duration,e.playbackRate=i.playbackRate,e.zIndex=i.zIndex,e.opacity=i.opacity,e.flip=i.flip,i.style&&(e.style={...e.style,...i.style}),i.animation&&e.setAnimation(i.animation.keyFrames,i.animation.opts),i.id&&(e.id=i.id),i.effects&&(e.effects=i.effects),i.trim&&(e.trim.from=i.trim.from<1e6?i.trim.from*1e6:i.trim.from,e.trim.to=i.trim.to<1e6?i.trim.to*1e6:i.trim.to),e}var Ld,hx;function zP(){return hx||(hx=1,Ld=[{name:"Bounce",paramsTypes:{shadow_colour:"vec4",shadow_height:"float",bounces:"float"},defaultParams:{shadow_colour:[0,0,0,.6],shadow_height:.075,bounces:3},glsl:`// Author: Adrian Purser
4306
+ `,uniforms:{uTime:{value:0,type:"f32"},uZoomSpeed:{value:5,type:"f32"},uMaxZoom:{value:2,type:"f32"},uBlurStrength:{value:.01,type:"f32"}}}}},DP=Object.entries(zd).map(([i,e])=>({key:i,label:e.label,previewStatic:`https://cdn.subgen.co/previews/effects/static/effect_${i}_static.webp`,previewDynamic:`https://cdn.subgen.co/previews/effects/dynamic/effect_${i}_dynamic.webp`}));function Nd({name:i,renderer:e}){let t;const s=Object.keys(zd).find(u=>u.toLowerCase()===i.toLowerCase());s&&(t=zd[s]);const{fragment:r,uniforms:n,label:o}=t,a=new Be,l=De.create({width:e.width,height:e.height}),c=new Ct({vertex:wP,fragment:r,name:`${o}-shader`}),h=new Di({glProgram:c,resources:{effectUniforms:{...n}}});return a.filters=[h],{filter:h,render({width:u,height:d,canvasTexture:f,progress:p}){(l.width!==u||l.height!==d)&&l.resize(u,d);const g=f instanceof De?f:F.from(f);a.texture=g,a.width=u,a.height=d;const m=h.resources.effectUniforms.uniforms;return m.uTime=p,e.render({container:a,target:l,clear:!0}),l}}}function GP(i,e){const{opacity:t,zIndex:s,flip:r,left:n,top:o,width:a,height:l,angle:c}=i;e.x=n,e.y=o,e.width=Math.abs(a),e.height=Math.abs(l),e.angle=c,e.alpha=t,e.zIndex=s,r==="horizontal"?e.scale.x=-Math.abs(e.scale.x):r==="vertical"&&(e.scale.y=-Math.abs(e.scale.y))}class cx{constructor(e,t,s=null){this.sprite=t,this.targetContainer=s,!s&&e&&(this.targetContainer=e.stage),this.resolution=e?.renderer?.resolution??1,this.canvas=new OffscreenCanvas(1,1);const r=this.canvas.getContext("2d");if(r==null)throw new Error("Failed to create 2d context for PixiSpriteRenderer");this.context=r,this.root=new le,this.root.visible=!1,this.targetContainer&&this.targetContainer.addChild(this.root)}pixiSprite=null;texture=null;canvas;context;root=null;strokeGraphics=null;maskGraphics=null;shadowGraphics=null;shadowContainer=null;resolution=1;destroyed=!1;async updateFrame(e){if(this.destroyed)return;if(e==null){this.root!=null&&(this.root.visible=!1,this.applySpriteTransforms());return}if(e instanceof F||e&&typeof e.source<"u"){if(e.width===0||e.height===0){console.warn("PixiSpriteRenderer: Texture has zero dimensions",e.width,e.height);return}this.pixiSprite==null?(this.pixiSprite=new Be(e),this.pixiSprite.label="MainSprite",this.root.addChild(this.pixiSprite),this.applySpriteTransforms()):this.pixiSprite.texture=e,this.root!=null&&(this.root.visible=!0,this.applySpriteTransforms());return}const s=e.width,r=e.height;if(typeof s!="number"||typeof r!="number"||s<=0||r<=0){console.warn("PixiSpriteRenderer: Invalid frame dimensions",s,r);return}const n=this.texture==null||this.pixiSprite==null,o=Math.floor(s),a=Math.floor(r);if(this.canvas.width!==o||this.canvas.height!==a||n){if(this.canvas.width=o,this.canvas.height=a,this.texture!=null&&(this.texture.destroy(!0),this.texture=null),this.texture=F.from(this.canvas),!this.texture||!this.texture.source){console.error("PixiSpriteRenderer: Failed to create valid texture");return}this.pixiSprite==null?(this.pixiSprite=new Be(this.texture),this.pixiSprite.label="MainSprite",this.root.addChild(this.pixiSprite),this.applySpriteTransforms()):this.pixiSprite.texture=this.texture}if(this.context.clearRect(0,0,this.canvas.width,this.canvas.height),this.context.drawImage(e,0,0),this.texture!=null&&this.texture.source!=null){const c=this.texture.source;if(c.resource){const h=c.resource;h.update&&h.update()}typeof c.update=="function"&&c.update()}this.root!=null&&(this.root.visible=!0,this.applySpriteTransforms())}applySpriteTransforms(){if(this.pixiSprite==null||this.root==null||this.destroyed)return;const{flip:e,center:t,width:s,height:r,angle:n,opacity:o,zIndex:a}=this.sprite;this.root.x=t.x,this.root.y=t.y,this.root.angle=(e==null?1:-1)*n,this.root.alpha=o,this.root.zIndex=a,this.root.scale.set(1,1),this.pixiSprite.anchor.set(.5,.5),this.pixiSprite.position.set(0,0);const l=this.pixiSprite.texture?.width??1,c=this.pixiSprite.texture?.height??1,h=this.sprite.type==="Caption",u=!h&&s&&s!==0?Math.abs(s)/l:1,d=!h&&r&&r!==0?Math.abs(r)/c:1;e==="horizontal"?(this.pixiSprite.scale.x=-u,this.pixiSprite.scale.y=d):e==="vertical"?(this.pixiSprite.scale.x=u,this.pixiSprite.scale.y=-d):(this.pixiSprite.scale.x=u,this.pixiSprite.scale.y=d),this.applyStyle()}applyStyle(){if(this.pixiSprite==null||this.destroyed)return;const e=this.sprite.style||{},t=this.pixiSprite.texture?.width??0,s=this.pixiSprite.texture?.height??0;if(t===0||s===0)return;const r=e.borderRadius||0;r>0?(this.maskGraphics==null&&(this.maskGraphics=new ye,this.pixiSprite.addChild(this.maskGraphics),this.pixiSprite.mask=this.maskGraphics),this.maskGraphics.clear(),this.maskGraphics.roundRect(-t/2,-s/2,t,s,Math.min(r,t/2,s/2)),this.maskGraphics.fill({color:16777215,alpha:1}),this.maskGraphics.visible=!0):this.maskGraphics&&(this.maskGraphics.visible=!1,this.pixiSprite.mask=null),this.sprite.type!=="Text"&&this.sprite.type!=="Caption"?this.applyStroke(e,t,s):this.strokeGraphics&&(this.strokeGraphics.visible=!1),this.sprite.type!=="Text"&&this.sprite.type!=="Caption"?this.applyShadow(e):this.shadowContainer&&(this.shadowContainer.visible=!1,this.shadowContainer.filters=[])}applyStroke(e,t,s){const r=e.stroke;if(r&&r.width>0){this.strokeGraphics==null&&(this.strokeGraphics=new ye,this.pixiSprite.addChild(this.strokeGraphics)),this.strokeGraphics.clear();const n=Ee(r.color)??16777215,o=r.width,a=e.borderRadius||0;if(this.strokeGraphics.setStrokeStyle({width:o,color:n,alignment:1}),a>0){const l=Math.min(a,t/2,s/2);this.strokeGraphics.roundRect(-t/2,-s/2,t,s,l)}else this.strokeGraphics.rect(-t/2,-s/2,t,s);this.strokeGraphics.stroke(),this.strokeGraphics.visible=!0}else this.strokeGraphics!=null&&(this.strokeGraphics.visible=!1)}applyShadow(e){const t=e.dropShadow,s=Math.abs(this.sprite.width??0),r=Math.abs(this.sprite.height??0);if(t&&s>0&&r>0&&(t.blur>0||t.distance>0)){this.shadowContainer==null&&(this.shadowContainer=new le,this.shadowContainer.label="ShadowContainer",this.shadowGraphics=new ye,this.shadowContainer.addChild(this.shadowGraphics),this.root.addChildAt(this.shadowContainer,0));const n=Ee(t.color)??0,o=t.alpha??.5,a=t.blur??0,l=t.distance??0,c=t.angle??0,h=Math.cos(c)*l,u=Math.sin(c)*l;this.shadowContainer.position.set(h,u),this.shadowGraphics.clear();const d=e.borderRadius||0;if(d>0){const f=Math.min(d,s/2,r/2);this.shadowGraphics.roundRect(-s/2,-r/2,s,r,f)}else this.shadowGraphics.rect(-s/2,-r/2,s,r);if(this.shadowGraphics.fill({color:n,alpha:o}),a>0){(!this.shadowContainer.filters||this.shadowContainer.filters.length===0)&&(this.shadowContainer.filters=[new Yg]);const f=this.shadowContainer.filters[0],p=this.root?Math.sqrt(this.root.worldTransform.a**2+this.root.worldTransform.b**2):1;f.strength=a*p,f.resolution=this.resolution,f.padding=Math.max(a*2*p,20)}else this.shadowContainer.filters=[];this.shadowContainer.visible=!0}else this.shadowContainer!=null&&(this.shadowContainer.visible=!1,this.shadowContainer.filters=[])}updateTransforms(){this.root!=null&&!this.destroyed&&this.applySpriteTransforms()}getSprite(){return this.pixiSprite}getRoot(){return this.root}destroy(){this.destroyed||(this.destroyed=!0,this.root!=null&&(this.root.parent&&this.root.parent.removeChild(this.root),this.root.destroy({children:!0}),this.root=null,this.pixiSprite=null),this.strokeGraphics!=null&&(this.strokeGraphics.destroy(),this.strokeGraphics=null),this.maskGraphics!=null&&(this.maskGraphics.destroy(),this.maskGraphics=null),this.shadowGraphics!=null&&(this.shadowGraphics.destroy(),this.shadowGraphics=null),this.shadowContainer!=null&&(this.shadowContainer.destroy({children:!0}),this.shadowContainer=null),this.texture!=null&&(this.texture.destroy(),this.texture=null))}}function zs(i,e=!1){return i.toJSON(e)}async function Vi(i){let e,t=null;switch(i.type){case"Video":t=je;break;case"Audio":t=at;break;case"Image":return e=await Gs.fromObject(i),e;case"Text":t=xt;break;case"Caption":t=Nt;break;case"Effect":t=ut;break;case"Transition":t=Et;break;case"Placeholder":t=on;break}if(t&&typeof t.fromObject=="function")return await t.fromObject(i);switch(i.type){case"Text":{const s=i.text||"",r=i.style||{},n={fontSize:r.fontSize,fontFamily:r.fontFamily,fontWeight:r.fontWeight,fontStyle:r.fontStyle,fill:r.color,align:r.align};r.stroke&&(n.stroke=r.stroke.color,n.strokeWidth=r.stroke.width),r.shadow&&(n.dropShadow={color:r.shadow.color,alpha:r.shadow.alpha,blur:r.shadow.blur,distance:r.shadow.distance,angle:r.shadow.angle}),e=new xt(s,n);break}case"Caption":{const s=i.text||"",r=i.style||{},n={fontSize:r.fontSize,fontFamily:r.fontFamily,fontWeight:r.fontWeight,fontStyle:r.fontStyle,fill:r.color,align:r.align};if(r.fontUrl!==void 0?n.fontUrl=r.fontUrl:i.fontUrl!==void 0&&(n.fontUrl=i.fontUrl),r.wordsPerLine!==void 0?n.wordsPerLine=r.wordsPerLine:i.wordsPerLine!==void 0&&(n.wordsPerLine=i.wordsPerLine),r.stroke&&(n.stroke=r.stroke.color,n.strokeWidth=r.stroke.width),r.shadow&&(n.dropShadow={color:r.shadow.color,alpha:r.shadow.alpha,blur:r.shadow.blur,distance:r.shadow.distance,angle:r.shadow.angle}),i.caption){const o=i.caption;o.words&&(n.words=o.words),o.colors&&(o.colors.appeared!==void 0&&(n.appearedColor=o.colors.appeared),o.colors.active!==void 0&&(n.activeColor=o.colors.active),o.colors.activeFill!==void 0&&(n.activeFillColor=o.colors.activeFill),o.colors.background!==void 0&&(n.backgroundColor=o.colors.background),o.colors.keyword!==void 0&&(n.isKeyWordColor=o.colors.keyword)),o.preserveKeywordColor!==void 0&&(n.preservedColorKeyWord=o.preserveKeywordColor),o.positioning&&(o.positioning.bottomOffset!==void 0&&(n.bottomOffset=o.positioning.bottomOffset),o.positioning.videoWidth!==void 0&&(n.videoWidth=o.positioning.videoWidth),o.positioning.videoHeight!==void 0&&(n.videoHeight=o.positioning.videoHeight))}else i.bottomOffset!==void 0&&(n.bottomOffset=i.bottomOffset),i.words&&(n.words=i.words),i.appearedColor!==void 0&&(n.appearedColor=i.appearedColor),i.activeColor!==void 0&&(n.activeColor=i.activeColor),i.activeFillColor!==void 0&&(n.activeFillColor=i.activeFillColor),i.backgroundColor!==void 0&&(n.backgroundColor=i.backgroundColor),i.isKeyWordColor!==void 0&&(n.isKeyWordColor=i.isKeyWordColor),i.preservedColorKeyWord!==void 0&&(n.preservedColorKeyWord=i.preservedColorKeyWord),i.videoWidth!==void 0&&(n.videoWidth=i.videoWidth),i.videoHeight!==void 0&&(n.videoHeight=i.videoHeight);i.mediaId&&(n.mediaId=i.mediaId),i.wordsPerLine&&(n.wordsPerLine=i.wordsPerLine),n.initialLayoutApplied=!0,e=new Nt(s,n);break}case"Effect":{e=new ut(i.effect.key),e.effect=i.effect;break}default:throw new Error(`Unsupported clip type: ${i.type}`)}return e.left=i.left,e.top=i.top,e.width=i.width,e.height=i.height,e.angle=i.angle,e.display.from=i.display.from,e.display.to=i.display.to,e.duration=i.duration,e.playbackRate=i.playbackRate,e.zIndex=i.zIndex,e.opacity=i.opacity,e.flip=i.flip,i.style&&(e.style={...e.style,...i.style}),i.animation&&e.setAnimation(i.animation.keyFrames,i.animation.opts),i.id&&(e.id=i.id),i.name&&(e.name=i.name),i.effects&&(e.effects=i.effects),i.trim&&(e.trim.from=i.trim.from<1e6?i.trim.from*1e6:i.trim.from,e.trim.to=i.trim.to<1e6?i.trim.to*1e6:i.trim.to),e}var Ld,hx;function zP(){return hx||(hx=1,Ld=[{name:"Bounce",paramsTypes:{shadow_colour:"vec4",shadow_height:"float",bounces:"float"},defaultParams:{shadow_colour:[0,0,0,.6],shadow_height:.075,bounces:3},glsl:`// Author: Adrian Purser
4307
4307
  // License: MIT
4308
4308
 
4309
4309
  uniform vec4 shadow_colour; // = vec4(0.,0.,0.,.6)
@@ -1,6 +1,7 @@
1
1
  import { IClip, ITransitionInfo } from './clips';
2
2
  interface BaseClipJSON {
3
3
  id?: string;
4
+ name?: string;
4
5
  effects?: Array<{
5
6
  id: string;
6
7
  key: string;
@@ -34,6 +34,10 @@ export declare abstract class BaseSprite<T extends BaseSpriteEvents = BaseSprite
34
34
  * Unique identifier for the sprite/clip
35
35
  */
36
36
  id: string;
37
+ /**
38
+ * Name of the sprite/clip
39
+ */
40
+ name: string;
37
41
  /**
38
42
  * Control display time range of clips, commonly used in editing scenario timeline (track) module
39
43
  * from: start time offset in microseconds
@@ -1,4 +1,4 @@
1
- import { E as p, U as dt, T as ce, F as ht, G as Fe, v as Re, M as P, l as M, d as Ue, I as w, t as R, a8 as te, R as re, w as N, H as Be, a5 as O, a6 as Me, c as D, B as C, D as W, af as de, V as q, ag as B, m as I, ah as ft, a0 as Ge, ai as he, S as E, y as V, aj as pt, ak as ne, L as Q, al as z, s as ie, $ as J, n as De, q as Ae, aa as ze, ad as ke, o as mt, p as gt, ab as xt, ac as _t, ae as vt, am as bt, an as yt, ao as Z, ap as Tt, aq as wt, ar as fe, e as y, as as Ct } from "./index-gXIG5heI.js";
1
+ import { E as p, U as dt, T as ce, F as ht, G as Fe, v as Re, M as P, l as M, d as Ue, I as w, t as R, a8 as te, R as re, w as N, H as Be, a5 as O, a6 as Me, c as D, B as C, D as W, af as de, V as q, ag as B, m as I, ah as ft, a0 as Ge, ai as he, S as E, y as V, aj as pt, ak as ne, L as Q, al as z, s as ie, $ as J, n as De, q as Ae, aa as ze, ad as ke, o as mt, p as gt, ab as xt, ac as _t, ae as vt, am as bt, an as yt, ao as Z, ap as Tt, aq as wt, ar as fe, e as y, as as Ct } from "./index-BdiiyukT.js";
2
2
  import { c as L, a as Pt, b as St, B as Oe } from "./colorToUniform-C2jGzNe1.js";
3
3
  class Ie {
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openvideo",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Video rendering and processing library",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -21,7 +21,7 @@
21
21
  "files": [
22
22
  "dist"
23
23
  ],
24
- "main": "dist/index.umd.js",
24
+ "main": "dist/index.umd.js",
25
25
  "module": "dist/index.es.js",
26
26
  "types": "dist/index.d.ts",
27
27
  "exports": {