@drincs/pixi-vn 1.1.2 → 1.2.0

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.
Files changed (127) hide show
  1. package/dist/canvas/CanvasManager.cjs +1 -1
  2. package/dist/canvas/CanvasManager.js +1 -1
  3. package/dist/canvas/CanvasManagerStatic.cjs +1 -1
  4. package/dist/canvas/CanvasManagerStatic.js +1 -1
  5. package/dist/canvas/components/Container.cjs +1 -1
  6. package/dist/canvas/components/Container.js +1 -1
  7. package/dist/canvas/components/ImageContainer.cjs +1 -1
  8. package/dist/canvas/components/ImageContainer.js +1 -1
  9. package/dist/canvas/components/ImageSprite.cjs +2 -2
  10. package/dist/canvas/components/ImageSprite.js +2 -2
  11. package/dist/canvas/components/Sprite.cjs +1 -1
  12. package/dist/canvas/components/Sprite.js +1 -1
  13. package/dist/canvas/components/Text.cjs +1 -1
  14. package/dist/canvas/components/Text.js +1 -1
  15. package/dist/canvas/components/VideoSprite.cjs +2 -2
  16. package/dist/canvas/components/VideoSprite.js +2 -2
  17. package/dist/canvas/decorators/canvas-element-decorator.cjs +1 -1
  18. package/dist/canvas/decorators/canvas-element-decorator.js +1 -1
  19. package/dist/canvas/decorators/event-decorator.cjs +1 -1
  20. package/dist/canvas/decorators/event-decorator.js +1 -1
  21. package/dist/canvas/functions/canvas-effect.cjs +1 -1
  22. package/dist/canvas/functions/canvas-effect.js +1 -1
  23. package/dist/canvas/functions/canvas-import-utility.cjs +1 -1
  24. package/dist/canvas/functions/canvas-import-utility.js +1 -1
  25. package/dist/canvas/functions/canvas-transition.cjs +1 -1
  26. package/dist/canvas/functions/canvas-transition.js +1 -1
  27. package/dist/canvas/functions/image-container-utility.cjs +1 -1
  28. package/dist/canvas/functions/image-container-utility.js +1 -1
  29. package/dist/canvas/functions/image-utility.cjs +1 -1
  30. package/dist/canvas/functions/image-utility.js +1 -1
  31. package/dist/canvas/functions/video-utility.cjs +1 -1
  32. package/dist/canvas/functions/video-utility.js +1 -1
  33. package/dist/canvas/index.cjs +1 -1
  34. package/dist/canvas/index.js +1 -1
  35. package/dist/canvas/tickers/classes/TickerBase.cjs +1 -1
  36. package/dist/canvas/tickers/classes/TickerBase.js +1 -1
  37. package/dist/canvas/tickers/components/FadeAlphaTicker.cjs +1 -1
  38. package/dist/canvas/tickers/components/FadeAlphaTicker.js +1 -1
  39. package/dist/canvas/tickers/components/MoveTicker.cjs +1 -1
  40. package/dist/canvas/tickers/components/MoveTicker.js +1 -1
  41. package/dist/canvas/tickers/components/RotateTicker.cjs +1 -1
  42. package/dist/canvas/tickers/components/RotateTicker.js +1 -1
  43. package/dist/canvas/tickers/components/ZoomTicker.cjs +1 -1
  44. package/dist/canvas/tickers/components/ZoomTicker.js +1 -1
  45. package/dist/canvas/tickers/decorators/ticker-decorator.cjs +1 -1
  46. package/dist/canvas/tickers/decorators/ticker-decorator.js +1 -1
  47. package/dist/canvas/tickers/functions/ticker-texture-utility.cjs +1 -1
  48. package/dist/canvas/tickers/functions/ticker-texture-utility.js +1 -1
  49. package/dist/canvas/tickers/index.cjs +1 -1
  50. package/dist/canvas/tickers/index.js +1 -1
  51. package/dist/character/classes/CharacterBaseModel.cjs +17 -17
  52. package/dist/character/classes/CharacterBaseModel.js +17 -17
  53. package/dist/character/classes/CharacterStoredClass.cjs +16 -16
  54. package/dist/character/classes/CharacterStoredClass.js +16 -16
  55. package/dist/character/decorators/character-decorator.cjs +1 -1
  56. package/dist/character/decorators/character-decorator.js +1 -1
  57. package/dist/character/index.cjs +16 -16
  58. package/dist/character/index.js +16 -16
  59. package/dist/classes/CachedMap.cjs +1 -1
  60. package/dist/classes/CachedMap.d.cts +1 -1
  61. package/dist/classes/CachedMap.d.ts +1 -1
  62. package/dist/classes/CachedMap.js +1 -1
  63. package/dist/classes/index.cjs +1 -1
  64. package/dist/classes/index.js +1 -1
  65. package/dist/constants.cjs +1 -1
  66. package/dist/constants.d.cts +5 -1
  67. package/dist/constants.d.ts +5 -1
  68. package/dist/constants.js +1 -1
  69. package/dist/history/HistoryManager.cjs +2 -2
  70. package/dist/history/HistoryManager.d.cts +24 -13
  71. package/dist/history/HistoryManager.d.ts +24 -13
  72. package/dist/history/HistoryManager.js +2 -2
  73. package/dist/history/HistoryManagerStatic.cjs +1 -1
  74. package/dist/history/HistoryManagerStatic.d.cts +9 -8
  75. package/dist/history/HistoryManagerStatic.d.ts +9 -8
  76. package/dist/history/HistoryManagerStatic.js +1 -1
  77. package/dist/history/index.cjs +2 -2
  78. package/dist/history/index.d.cts +4 -2
  79. package/dist/history/index.d.ts +4 -2
  80. package/dist/history/index.js +2 -2
  81. package/dist/history/interfaces/HistoryManagerInterface.d.cts +54 -11
  82. package/dist/history/interfaces/HistoryManagerInterface.d.ts +54 -11
  83. package/dist/{index-CWhYJ7yq.d.ts → index-CvpVN1rC.d.ts} +3 -3
  84. package/dist/{index-CVn6zVij.d.cts → index-DCnX_VPi.d.cts} +3 -3
  85. package/dist/index.cjs +73 -73
  86. package/dist/index.d.cts +6 -5
  87. package/dist/index.d.ts +6 -5
  88. package/dist/index.js +73 -73
  89. package/dist/narration/NarrationManager.cjs +16 -16
  90. package/dist/narration/NarrationManager.d.cts +1 -1
  91. package/dist/narration/NarrationManager.d.ts +1 -1
  92. package/dist/narration/NarrationManager.js +16 -16
  93. package/dist/narration/NarrationManagerStatic.cjs +1 -1
  94. package/dist/narration/NarrationManagerStatic.js +1 -1
  95. package/dist/narration/classes/ChoiceMenuOption.cjs +1 -1
  96. package/dist/narration/classes/ChoiceMenuOption.js +1 -1
  97. package/dist/narration/decorators/RegisteredLabels.cjs +1 -1
  98. package/dist/narration/decorators/RegisteredLabels.js +1 -1
  99. package/dist/narration/decorators/newLabel.cjs +1 -1
  100. package/dist/narration/decorators/newLabel.js +1 -1
  101. package/dist/narration/index.cjs +17 -17
  102. package/dist/narration/index.d.cts +2 -2
  103. package/dist/narration/index.d.ts +2 -2
  104. package/dist/narration/index.js +17 -17
  105. package/dist/narration/interfaces/HistoryStep.d.cts +5 -5
  106. package/dist/narration/interfaces/HistoryStep.d.ts +5 -5
  107. package/dist/narration/interfaces/{NarrativeHistory.d.cts → NarrationHistory.d.cts} +2 -2
  108. package/dist/narration/interfaces/{NarrativeHistory.d.ts → NarrationHistory.d.ts} +2 -2
  109. package/dist/narration/interfaces/NarrationManagerInterface.d.cts +1 -1
  110. package/dist/narration/interfaces/NarrationManagerInterface.d.ts +1 -1
  111. package/dist/pixi-devtools/additionalPositionsProperties.cjs +1 -1
  112. package/dist/pixi-devtools/additionalPositionsProperties.js +1 -1
  113. package/dist/pixi-vn.d.d.cts +44 -1
  114. package/dist/pixi-vn.d.d.ts +44 -1
  115. package/dist/storage/StorageManager.cjs +1 -1
  116. package/dist/storage/StorageManager.js +1 -1
  117. package/dist/storage/StorageManagerStatic.cjs +1 -1
  118. package/dist/storage/StorageManagerStatic.js +1 -1
  119. package/dist/storage/classes/StoredClassModel.cjs +1 -1
  120. package/dist/storage/classes/StoredClassModel.js +1 -1
  121. package/dist/storage/index.cjs +1 -1
  122. package/dist/storage/index.js +1 -1
  123. package/dist/utils/diff-utility.d.cts +2 -2
  124. package/dist/utils/diff-utility.d.ts +2 -2
  125. package/package.json +3 -3
  126. /package/dist/narration/interfaces/{NarrativeHistory.cjs → NarrationHistory.cjs} +0 -0
  127. /package/dist/narration/interfaces/{NarrativeHistory.js → NarrationHistory.js} +0 -0
@@ -617,4 +617,4 @@ ${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let i=Pt(t
617
617
  };
618
618
 
619
619
  })();
620
- `,Vr=null,Qi=class{constructor(){Vr||(Vr=URL.createObjectURL(new Blob([Iy],{type:"application/javascript"}))),this.worker=new Worker(Vr);}};Qi.revokeObjectURL=function(){Vr&&(URL.revokeObjectURL(Vr),Vr=null);};var Mg=0,ol,nl=class{constructor(){this._initialized=false,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={};}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Hr;e.addEventListener("message",i=>{e.terminate(),Hr.revokeObjectURL(),t(i.data);});}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=true);}_getWorker(){ol===void 0&&(ol=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return !t&&this._createdWorkers<ol&&(this._createdWorkers++,t=new Qi().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next();})),t}_returnWorker(t){this._workerPool.push(t);}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null;}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o});});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[Mg]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Mg++,id:i});}},al=new nl;de();var Gy=[".jpeg",".jpg",".png",".webp",".avif"],Dy=["image/jpeg","image/png","image/webp","image/avif"];async function Uy(r,t){let e=await W.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var Jo={name:"loadTextures",extension:{type:T.LoadParser,priority:mt.High,name:"loadTextures"},config:{preferWorkers:true,preferCreateImageBitmap:true,crossOrigin:"anonymous"},test(r){return Vt(r,Dy)||Nt(r,Gy)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await al.isImageBitmapSupported()?i=await al.loadImageBitmap(r,t):i=await Uy(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i);},i.onerror=n);});let s=new kt({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Or(r),...t.data});return zr(s,e,r)},unload(r){r.destroy(true);}};P();xa();ga();var Eg=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Ly=Eg.map(r=>`video/${r.substring(1)}`);function Oy(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=Wy(t):e!==false&&(r.crossOrigin=typeof e=="string"?e:"anonymous");}function zy(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t();}function s(n){o(),e(n);}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s);}})}function Wy(r,t=globalThis.location){if(r.startsWith("data:"))return "";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var Bg={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=Vt(r,Ly),e=Nt(r,Eg);return t||e},async load(r,t,e){let i={...cr.defaultOptions,resolution:t.data?.resolution||Or(r),alphaMode:t.data?.alphaMode||await Ws(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==false?"auto":void 0,"webkit-playsinline":i.playsinline!==false?"":void 0,playsinline:i.playsinline!==false?"":void 0,muted:i.muted===true?"":void 0,loop:i.loop===true?"":void 0,autoplay:i.autoPlay!==false?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l);}),i.muted===true&&(s.muted=true),Oy(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let h=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=cr.MIME_TYPES[h]||`video/${h}`;}return n.src=r,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new cr({...i,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await zy(s),h(zr(c,e,r));};s.addEventListener("canplay",l),s.appendChild(n);})},unload(r){r.destroy(true);}};P();ar();P();ar();var tn={extension:{type:T.ResolveParser,name:"resolveTexture"},test:Jo.test,parse:r=>({resolution:parseFloat(Lt.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var Fg={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Lt.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:tn.parse};ar();xi();Ds();var en=class{constructor(){this._detections=[],this._initialized=false,this.resolver=new Lt,this.loader=new Qo,this.cache=j,this._backgroundLoader=new qo(this.loader),this._backgroundLoader.active=true,this.reset();}async init(t={}){if(this._initialized){G("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=true,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o);}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences);}add(t){this.resolver.add(t);}async load(t,e){this._initialized||await this.init();let i=Ve(t),s=Pt(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e);}async loadBundle(t,e){this._initialized||await this.init();let i=false;typeof t=="string"&&(i=true,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h);},c=n.map(u=>{let f=s[u];return h+=Object.keys(f).length,this._mapLoadToResolve(f,l).then(d=>{o[u]=d;})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e));}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i));});}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=false;}get(t){if(typeof t=="string")return j.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=j.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=false;let s=await this.loader.load(i,e);this._backgroundLoader.active=true;let o={};return i.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a;}),j.set(h,a);}),o}async unload(t){this._initialized||await this.init();let e=Pt(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i);}async unloadBundle(t){this._initialized||await this.init(),t=Pt(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i);}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{j.remove(i.src);}),await this.loader.unload(e);}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i];});});}},Jt=new en;R.handleByList(T.LoadParser,Jt.loader.parsers).handleByList(T.ResolveParser,Jt.resolver.parsers).handleByList(T.CacheParser,Jt.cache.parsers).handleByList(T.DetectionParser,Jt.detections);R.add(gg,yg,xg,wg,bg,vg,Tg,Sg,Ag,Pg,Cg,Jo,Bg,mg,pg,tn,Fg);var kg={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};R.handle(T.Asset,r=>{let t=r.ref;Object.entries(kg).filter(([e])=>!!t[e]).forEach(([e,i])=>R.add(Object.assign(t[e],{extension:t[e].extension??i})));},r=>{let t=r.ref;Object.keys(kg).filter(e=>!!t[e]).forEach(e=>R.remove(t[e]));});fs();ht();Gs();var rn=class extends be{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=true,this._resolution=null,this._autoResolution=true,this._didTextUpdate=true,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=false,this._anchor=new _t({_onUpdate:()=>{this.onViewUpdate();}}),n&&(this.anchor=n),this.roundPixels=l??false,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h);}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t);}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate());}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate();}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate();}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width);}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height);}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height);}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=true),super.onViewUpdate();}_getKey(){return `${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=false){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null;}};function Rg(r,t){let e=r[0]??{};return (typeof e=="string"||r[1])&&(D(O,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}Uo();kr();var Ji=class extends rn{constructor(...t){let e=Rg(t,"Text");super(e,It),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,i=Ht.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o;}};de();gt();at();ba();sr();da();di();Gt();ve();cs(qa());R.add(ug,fg);var ae={};ox(ae,{DistortionFilter:()=>sn,EqualizerFilter:()=>$t,Filter:()=>ft,MonoFilter:()=>on,ReverbFilter:()=>nn,StereoFilter:()=>an,StreamFilter:()=>hn,TelephoneFilter:()=>ln});var Ig;function Gg(r){return Ig=r,r}function K(){return Ig}var ft=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var sn=class extends ft{constructor(t=0){let e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,K().useLegacy)return;let e=t*1e3,i=44100,s=new Float32Array(i),o=Math.PI/180,n=0,a;for(;n<i;++n)a=n*2/i-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var ut=class{static setParamValue(t,e){if(t.setValueAtTime){let i=K().context;t.setValueAtTime(e,i.audioContext.currentTime);}else t.value=e;return e}};var q=class extends ft{constructor(r=0,t=0,e=0,i=0,s=0,o=0,n=0,a=0,h=0,l=0){let c=[],u=[{f:q.F32,type:"lowshelf",gain:r},{f:q.F64,type:"peaking",gain:t},{f:q.F125,type:"peaking",gain:e},{f:q.F250,type:"peaking",gain:i},{f:q.F500,type:"peaking",gain:s},{f:q.F1K,type:"peaking",gain:o},{f:q.F2K,type:"peaking",gain:n},{f:q.F4K,type:"peaking",gain:a},{f:q.F8K,type:"peaking",gain:h},{f:q.F16K,type:"highshelf",gain:l}];K().useLegacy||(c=u.map(f=>{let d=K().context.audioContext.createBiquadFilter();return d.type=f.type,ut.setParamValue(d.Q,1),d.frequency.value=f.f,ut.setParamValue(d.gain,f.gain),d})),super(c[0],c[c.length-1]),this.bands=c,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(r,t=0){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);ut.setParamValue(this.bandsMap[r].gain,t);}getGain(r){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);return this.bandsMap[r].gain.value}set f32(r){this.setGain(q.F32,r);}get f32(){return this.getGain(q.F32)}set f64(r){this.setGain(q.F64,r);}get f64(){return this.getGain(q.F64)}set f125(r){this.setGain(q.F125,r);}get f125(){return this.getGain(q.F125)}set f250(r){this.setGain(q.F250,r);}get f250(){return this.getGain(q.F250)}set f500(r){this.setGain(q.F500,r);}get f500(){return this.getGain(q.F500)}set f1k(r){this.setGain(q.F1K,r);}get f1k(){return this.getGain(q.F1K)}set f2k(r){this.setGain(q.F2K,r);}get f2k(){return this.getGain(q.F2K)}set f4k(r){this.setGain(q.F4K,r);}get f4k(){return this.getGain(q.F4K)}set f8k(r){this.setGain(q.F8K,r);}get f8k(){return this.getGain(q.F8K)}set f16k(r){this.setGain(q.F16K,r);}get f16k(){return this.getGain(q.F16K)}reset(){this.bands.forEach(r=>{ut.setParamValue(r.gain,0);});}destroy(){this.bands.forEach(r=>{r.disconnect();}),this.bands=null,this.bandsMap=null;}},$t=q;$t.F32=32;$t.F64=64;$t.F125=125;$t.F250=250;$t.F500=500;$t.F1K=1e3;$t.F2K=2e3;$t.F4K=4e3;$t.F8K=8e3;$t.F16K=16e3;var on=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createChannelSplitter(),t=i.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var nn=class extends ft{constructor(t=3,e=2,i=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=i,this._rebuild();}_clamp(t,e,i){return Math.min(i,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(K().useLegacy)return;let{audioContext:t}=K().context,e=t.sampleRate,i=e*this._seconds,s=t.createBuffer(2,i,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<i;l++)a=this._reverse?i-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var an=class extends ft{constructor(t=0){let e,i,s;if(!K().useLegacy){let{audioContext:o}=K().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(i=o.createPanner(),i.panningModel="equalpower",s=i);}super(s),this._stereo=e,this._panner=i,this.pan=t;}set pan(t){this._pan=t,this._stereo?ut.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var hn=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;t=i.createMediaStreamDestination(),e=i.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var ln=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context,s=i.createBiquadFilter(),o=i.createBiquadFilter(),n=i.createBiquadFilter(),a=i.createBiquadFilter();s.type="lowpass",ut.setParamValue(s.frequency,2e3),o.type="lowpass",ut.setParamValue(o.frequency,2e3),n.type="highpass",ut.setParamValue(n.frequency,500),a.type="highpass",ut.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};var ts=class extends Y{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var Vy=0,hl=class extends Y{constructor(r){super(),this.id=Vy++,this.init(r);}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(r){this._playing=false,this._duration=r.source.duration;let t=this._source=r.source.cloneNode(false);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters");}refresh(){let r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=r.volume*(r.muted?0:1),i=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*i,this._source.playbackRate=this._speed*r.speed*t.speed;}refreshPaused(){let r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(r){let{start:t,end:e,speed:i,loop:s,volume:o,muted:n}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-hl.PADDING),this._end=Math.min(this._end+hl.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),dt.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){dt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){dt.shared.remove(this._onUpdate,this),this.removeAllListeners();let r=this._source;r&&(r.onended=null,r.onplay=null,r.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},cn=hl;cn.PADDING=.1;var es=class extends Y{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new cn(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=true;let h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h);},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;let s=()=>{a(),i.isLoaded=true;let h=i.autoPlayStart();t&&t(null,i,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var rs=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var Ze=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],ll=["audio/mpeg","audio/ogg"],Qe={};function Dg(r){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),i={},s=/^no$/;Ze.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";i[o]=!!n||!!a;}),Object.assign(Qe,i);}Dg();var $y=0,is=class extends Y{constructor(t){super(),this.id=$y++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let i=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);ut.setParamValue(this._gain.gain,o*s*i),ut.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i));}play(t){let{start:e,end:i,speed:s,loop:o,volume:n,muted:a,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=false;let{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let u=this._source.buffer.duration;this._duration=u,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){dt.shared.remove(this._updateListener,this),t&&dt.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),i=e-this._lastUpdate;if(i>0||t){let s=this._source.playbackRate.value;this._elapsed+=i*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Je=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Ug=class extends Je{constructor(r){let t=r.audioContext,e=t.createBufferSource(),i=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(i),i.connect(r.destination),super(s,i),this.context=r,this.bufferSource=e,this.gain=i,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Ug.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,ut.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},un=Ug;un.BUFFER_SIZE=0;var tr=class{init(t){this.parent=t,this._nodes=new un(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new is(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,i=await W.get().fetch(e);this._decode(await i.arrayBuffer(),t);}_decode(t,e){let i=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i);}};var Nr=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=K().useLegacy?new es:new tr;return new Nr(e,t)}constructor(r,t){this.media=r,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(r){let[t]=r.map(e=>({url:e,ext:tt.extname(e).slice(1)})).filter(({ext:e})=>Qe[e]).sort((e,i)=>Ze.indexOf(e.ext)-Ze.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return K().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get filters(){return this.media.filters}set filters(r){this.media.filters=r;}addSprites(r,t){if(typeof r=="object"){let i={};for(let s in r)i[s]=this.addSprites(s,r[s]);return i}console.assert(!this._sprites[r],`Alias ${r} is already taken`);let e=new rs(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(r){if(r){let t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let i=this._createInstance();return this._instances.push(i),this.isPlaying=true,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i);}),i.once("stop",()=>{this._onComplete(i);}),i.play(e),i}refresh(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh();}refreshPaused(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}_preload(r){this.media.load(r);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0;}_onComplete(r){if(this._instances){let t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(r);}_createInstance(){if(Nr._pool.length>0){let r=Nr._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),Nr._pool.indexOf(r)<0&&Nr._pool.push(r);}},Ee=Nr;Ee._pool=[];var $r=class r extends Je{constructor(){let t=window,e=new r.AudioContext,i=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(i),i.connect(e.destination),super(s,i),this.autoPause=true,this._ctx=e,this._offlineCtx=new r.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=s,this.events=new Y,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let i=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},i);s&&s.catch(i);}};var dn=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new $r),this._htmlAudioContext=new ts,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return $r.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof Ee)return this._sounds[t]=e,e;let i=this._getOptions(e),s=Ee.from(i);return this._sounds[t]=s,s}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){let i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var Lg=r=>{let t=r.src,e=r?.alias?.[0];return (!e||r.src===e)&&(e=tt.basename(t,tt.extname(t))),e},Og={extension:T.Asset,detection:{test:async()=>true,add:async r=>[...r,...Ze.filter(t=>Qe[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:mt.High},test(r){let t=tt.extname(r).slice(1);return !!Qe[t]||ll.some(e=>r.startsWith(`data:${e}`))},async load(r,t){let e=await new Promise((i,s)=>Ee.from({...t.data,url:r,preload:true,loaded(o,n){o?s(o):i(n),t.data?.loaded?.(o,n);}}));return K().add(Lg(t),e),e},async unload(r,t){K().remove(Lg(t));}}};R.add(Og);Gg(new dn);({DistortionFilter:ae.DistortionFilter,EqualizerFilter:ae.EqualizerFilter,MonoFilter:ae.MonoFilter,ReverbFilter:ae.ReverbFilter,StereoFilter:ae.StereoFilter,StreamFilter:ae.StreamFilter,TelephoneFilter:ae.TelephoneFilter});var Yr="Container";var Xr="Sprite",zg="Text";var st;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(st||={});var jr=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Hg=new Set,cl=typeof process=="object"&&process?process:{},Vg=(r,t,e,i)=>{typeof cl.emitWarning=="function"?cl.emitWarning(r,t,e,i):console.error(`[${e}] ${t}: ${r}`);},fn=globalThis.AbortController,Wg=globalThis.AbortSignal;if(typeof fn>"u"){Wg=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},fn=class{constructor(){t();}signal=new Wg;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let r=cl.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{r&&(r=false,Vg("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var jy=r=>!Hg.has(r),Be=r=>r&&r===Math.floor(r)&&r>0&&isFinite(r),Ng=r=>Be(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?Kr:null:null,Kr=class extends Array{constructor(t){super(t),this.fill(0);}},ul=class r{heap;length;static#h=false;static create(t){let e=Ng(t);if(!e)return [];r.#h=true;let i=new r(t,e);return r.#h=false,i}constructor(t,e){if(!r.#h)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},pn=class r{#h;#u;#m;#C;#g;#F;#k;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#x;#i;#r;#t;#l;#d;#a;#o;#_;#n;#y;#b;#f;#v;#P;#c;#R;static unsafeExposeInternals(t){return {starts:t.#b,ttls:t.#f,sizes:t.#y,keyMap:t.#i,keyList:t.#r,valList:t.#t,next:t.#l,prev:t.#d,get head(){return t.#a},get tail(){return t.#o},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,o)=>t.#D(e,i,s,o),moveToTail:e=>t.#B(e),indexes:e=>t.#T(e),rindexes:e=>t.#w(e),isStale:e=>t.#p(e)}}get max(){return this.#h}get maxSize(){return this.#u}get calculatedSize(){return this.#x}get size(){return this.#s}get fetchMethod(){return this.#F}get memoMethod(){return this.#k}get dispose(){return this.#m}get onInsert(){return this.#C}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:p=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:w,ignoreFetchAbort:S}=t;if(e!==0&&!Be(e))throw new TypeError("max option must be a nonnegative integer");let B=e?Ng(e):Array;if(!B)throw new Error("invalid max value: "+e);if(this.#h=e,this.#u=p,this.maxEntrySize=x||this.#u,this.sizeCalculation=g,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#k=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#F=_,this.#P=!!_,this.#i=new Map,this.#r=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new B(e),this.#d=new B(e),this.#a=0,this.#o=0,this.#_=ul.create(e),this.#s=0,this.#x=0,typeof l=="function"&&(this.#m=l),typeof c=="function"&&(this.#C=c),typeof u=="function"?(this.#g=u,this.#n=[]):(this.#g=void 0,this.#n=void 0),this.#v=!!this.#m,this.#R=!!this.#C,this.#c=!!this.#g,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!S,this.maxEntrySize!==0){if(this.#u!==0&&!Be(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!Be(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V();}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=Be(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!Be(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#U();}if(this.#h===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#u){let k="LRU_CACHE_UNBOUNDED";jy(k)&&(Hg.add(k),Vg("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",k,r));}}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#U(){let t=new Kr(this.#h),e=new Kr(this.#h);this.#f=t,this.#b=e,this.#L=(o,n,a=jr.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#p(o)&&this.#S(this.#r[o],"expire");},n+1);h.unref&&h.unref();}},this.#M=o=>{e[o]=t[o]!==0?jr.now():0;},this.#A=(o,n)=>{if(t[n]){let a=t[n],h=e[n];if(!a||!h)return;o.ttl=a,o.start=h,o.now=i||s();let l=o.now-h;o.remainingTTL=a-l;}};let i=0,s=()=>{let o=jr.now();if(this.ttlResolution>0){i=o;let n=setTimeout(()=>i=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=this.#i.get(o);if(n===void 0)return 0;let a=t[n],h=e[n];if(!a||!h)return 1/0;let l=(i||s())-h;return a-l},this.#p=o=>{let n=e[o],a=t[o];return !!a&&!!n&&(i||s())-n>a};}#M=()=>{};#A=()=>{};#L=()=>{};#p=()=>false;#V(){let t=new Kr(this.#h);this.#x=0,this.#y=t,this.#E=e=>{this.#x-=t[e],t[e]=0;},this.#O=(e,i,s,o)=>{if(this.#e(i))return 0;if(!Be(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(i,e),!Be(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#I=(e,i,s)=>{if(t[e]=i,this.#u){let o=this.#u-t[e];for(;this.#x>o;)this.#G(true);}this.#x+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#x);};}#E=t=>{};#I=(t,e,i)=>{};#O=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#o;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#a));)e=this.#d[e];}*#w({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#a;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#o));)e=this.#l[e];}#z(t){return t!==void 0&&this.#i.get(this.#r[t])===t}*entries(){for(let t of this.#T())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*rentries(){for(let t of this.#w())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*keys(){for(let t of this.#T()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*rkeys(){for(let t of this.#w()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*values(){for(let t of this.#T())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}*rvalues(){for(let t of this.#w())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#T()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#r[i],this))return this.get(this.#r[i],e)}}forEach(t,e=this){for(let i of this.#T()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[i],this);}}rforEach(t,e=this){for(let i of this.#w()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[i],this);}}purgeStale(){let t=false;for(let e of this.#w({allowStale:true}))this.#p(e)&&(this.#S(this.#r[e],"expire"),t=true);return t}info(t){let e=this.#i.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let o={value:s};if(this.#f&&this.#b){let n=this.#f[e],a=this.#b[e];if(n&&a){let h=n-(jr.now()-a);o.ttl=h,o.start=Date.now();}}return this.#y&&(o.size=this.#y[e]),o}dump(){let t=[];for(let e of this.#T({allowStale:true})){let i=this.#r[e],s=this.#t[e],o=this.#e(s)?s.__staleWhileFetching:s;if(o===void 0||i===void 0)continue;let n={value:o};if(this.#f&&this.#b){n.ttl=this.#f[e];let a=jr.now()-this.#b[e];n.start=Math.floor(Date.now()-a);}this.#y&&(n.size=this.#y[e]),t.unshift([i,n]);}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=jr.now()-s;}this.set(e,i.value,i);}}set(t,e,i={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=i,{noUpdateTTL:l=this.noUpdateTTL}=i,c=this.#O(t,e,i.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),this.#S(t,"set"),this;let u=this.#s===0?void 0:this.#i.get(t);if(u===void 0)u=this.#s===0?this.#o:this.#_.length!==0?this.#_.pop():this.#s===this.#h?this.#G(false):this.#s,this.#r[u]=t,this.#t[u]=e,this.#i.set(t,u),this.#l[this.#o]=u,this.#d[u]=this.#o,this.#o=u,this.#s++,this.#I(u,c,h),h&&(h.set="add"),l=false,this.#R&&this.#C?.(e,t,"add");else {this.#B(u);let f=this.#t[u];if(e!==f){if(this.#P&&this.#e(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=f;d!==void 0&&!n&&(this.#v&&this.#m?.(d,t,"set"),this.#c&&this.#n?.push([d,t,"set"]));}else n||(this.#v&&this.#m?.(f,t,"set"),this.#c&&this.#n?.push([f,t,"set"]));if(this.#E(u),this.#I(u,c,h),this.#t[u]=e,h){h.set="replace";let d=f&&this.#e(f)?f.__staleWhileFetching:f;d!==void 0&&(h.oldValue=d);}}else h&&(h.set="update");this.#R&&this.onInsert?.(e,t,e===f?"update":"replace");}if(s!==0&&!this.#f&&this.#U(),this.#f&&(l||this.#L(u,s,o),h&&this.#A(h,u)),!n&&this.#c&&this.#n){let f=this.#n,d;for(;d=f?.shift();)this.#g?.(...d);}return this}pop(){try{for(;this.#s;){let t=this.#t[this.#a];if(this.#G(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#c&&this.#n){let t=this.#n,e;for(;e=t?.shift();)this.#g?.(...e);}}}#G(t){let e=this.#a,i=this.#r[e],s=this.#t[e];return this.#P&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(s,i,"evict"),this.#c&&this.#n?.push([s,i,"evict"])),this.#E(e),t&&(this.#r[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#s===1?(this.#a=this.#o=0,this.#_.length=0):this.#a=this.#l[e],this.#i.delete(i),this.#s--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,o=this.#i.get(t);if(o!==void 0){let n=this.#t[o];if(this.#e(n)&&n.__staleWhileFetching===void 0)return false;if(this.#p(o))s&&(s.has="stale",this.#A(s,o));else return i&&this.#M(o),s&&(s.has="hit",this.#A(s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#i.get(t);if(s===void 0||!i&&this.#p(s))return;let o=this.#t[s];return this.#e(o)?o.__staleWhileFetching:o}#D(t,e,i,s){let o=e===void 0?void 0:this.#t[e];if(this.#e(o))return o;let n=new fn,{signal:a}=i;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:i,context:s},l=(x,g=false)=>{let{aborted:_}=n.signal,y=i.ignoreFetchAbort&&x!==void 0;if(i.status&&(_&&!g?(i.status.fetchAborted=true,i.status.fetchError=n.signal.reason,y&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),_&&!y&&!g)return u(n.signal.reason);let v=d;return this.#t[e]===d&&(x===void 0?v.__staleWhileFetching?this.#t[e]=v.__staleWhileFetching:this.#S(t,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(t,x,h.options))),x},c=x=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=x),u(x)),u=x=>{let{aborted:g}=n.signal,_=g&&i.allowStaleOnFetchAbort,y=_||i.allowStaleOnFetchRejection,v=y||i.noDeleteOnFetchRejection,b=d;if(this.#t[e]===d&&(!v||b.__staleWhileFetching===void 0?this.#S(t,"fetch"):_||(this.#t[e]=b.__staleWhileFetching)),y)return i.status&&b.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),b.__staleWhileFetching;if(b.__returned===b)throw x},f=(x,g)=>{let _=this.#F?.(t,o,h);_&&_ instanceof Promise&&_.then(y=>x(y===void 0?void 0:y),g),n.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(x(void 0),i.allowStaleOnFetchAbort&&(x=y=>l(y,true)));});};i.status&&(i.status.fetchDispatched=true);let d=new Promise(f).then(l,c),p=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,p,{...h.options,status:void 0}),e=this.#i.get(t)):this.#t[e]=p,p}#e(t){if(!this.#P)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof fn}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:x,forceRefresh:g=false,status:_,signal:y}=e;if(!this.#P)return _&&(_.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:_});let v={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:p,ignoreFetchAbort:d,status:_,signal:y},b=this.#i.get(t);if(b===void 0){_&&(_.fetch="miss");let A=this.#D(t,b,v,x);return A.__returned=A}else {let A=this.#t[b];if(this.#e(A)){let C=i&&A.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",C&&(_.returnedStale=true)),C?A.__staleWhileFetching:A.__returned=A}let w=this.#p(b);if(!g&&!w)return _&&(_.fetch="hit"),this.#B(b),s&&this.#M(b),_&&this.#A(_,b),A;let S=this.#D(t,b,v,x),k=S.__staleWhileFetching!==void 0&&i;return _&&(_.fetch=w?"stale":"refresh",k&&w&&(_.returnedStale=true)),k?S.__staleWhileFetching:S.__returned=S}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#k;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let h=i(t,a,{options:n,context:s});return this.set(t,h,n),h}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=this.#i.get(t);if(a!==void 0){let h=this.#t[a],l=this.#e(h);return n&&this.#A(n,a),this.#p(a)?(n&&(n.get="stale"),l?(n&&i&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),i?h.__staleWhileFetching:void 0):(o||this.#S(t,"expire"),n&&i&&(n.returnedStale=true),i?h:void 0)):(n&&(n.get="hit"),l?h.__staleWhileFetching:(this.#B(a),s&&this.#M(a),h))}else n&&(n.get="miss");}#W(t,e){this.#d[e]=t,this.#l[t]=e;}#B(t){t!==this.#o&&(t===this.#a?this.#a=this.#l[t]:this.#W(this.#d[t],this.#l[t]),this.#W(this.#o,t),this.#o=t);}delete(t){return this.#S(t,"delete")}#S(t,e){let i=false;if(this.#s!==0){let s=this.#i.get(t);if(s!==void 0)if(i=true,this.#s===1)this.#H(e);else {this.#E(s);let o=this.#t[s];if(this.#e(o)?o.__abortController.abort(new Error("deleted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(o,t,e),this.#c&&this.#n?.push([o,t,e])),this.#i.delete(t),this.#r[s]=void 0,this.#t[s]=void 0,s===this.#o)this.#o=this.#d[s];else if(s===this.#a)this.#a=this.#l[s];else {let n=this.#d[s];this.#l[n]=this.#l[s];let a=this.#l[s];this.#d[a]=this.#d[s];}this.#s--,this.#_.push(s);}}if(this.#c&&this.#n?.length){let s=this.#n,o;for(;o=s?.shift();)this.#g?.(...o);}return i}clear(){return this.#H("delete")}#H(t){for(let e of this.#w({allowStale:true})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else {let s=this.#r[e];this.#v&&this.#m?.(i,s,t),this.#c&&this.#n?.push([i,s,t]);}}if(this.#i.clear(),this.#t.fill(void 0),this.#r.fill(void 0),this.#f&&this.#b&&(this.#f.fill(0),this.#b.fill(0)),this.#y&&this.#y.fill(0),this.#a=0,this.#o=0,this.#_.length=0,this.#x=0,this.#s=0,this.#c&&this.#n){let e=this.#n,i;for(;i=e?.shift();)this.#g?.(...i);}}};var Fe=class{cache;map=new Map;constructor(t){this.cache=new pn({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}get keys(){return this.map.keys}get values(){return this.map.values}};var ss=new Fe({cacheSize:5});var $g;(s=>{function r(o,n){n||(n=o.name),ss.get(n)&&st.warn(`CanvasElement "${n}" already registered`),o.prototype.pixivnId=n,ss.set(n,o);}s.add=r;function t(o){try{let n=ss.get(o);if(!n){st.error(`CanvasElement "${o}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return new n,n}catch(n){st.error(`Error while getting CanvasElement "${o}"`,n);return}}s.get=t;function e(){return Array.from(ss.values())}s.values=e;function i(o){return ss.has(o)}s.has=i;})($g||={});var qr=$g;var Zr=new Fe({cacheSize:5});var Yg;(o=>{function r(n,a){a||(a=n.name),Zr.get(a)&&st.info(`Event "${a}" already exists, it will be overwritten`),n.prototype.id=a,Zr.set(a,n);}o.add=r;function t(n){try{let a=Zr.get(n);if(!a){st.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a,a}catch(a){st.error(`Error while getting Event "${n}"`,a);return}}o.get=t;function e(n){try{let a=Zr.get(n);if(!a){st.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a}catch(a){st.error(`Error while getting Event "${n}"`,a);return}}o.getInstance=e;function i(){return Array.from(Zr.values())}o.values=i;function s(n){return Zr.has(n)}o.has=s;})(Yg||={});var os=Yg;function Ky(r){return "memory"in r?r.memory:r instanceof Ji?Zy(r):r instanceof qt?dl(r):ns(r)}function qy(r){return {width:r.width,height:r.height,isRenderGroup:r.isRenderGroup,blendMode:r.blendMode,tint:r.tint,alpha:r.alpha,angle:r.angle,renderable:r.renderable,rotation:r.rotation,scale:{x:r.scale.x,y:r.scale.y},pivot:{x:r.pivot.x,y:r.pivot.y},position:{x:r.position.x,y:r.position.y},skew:{x:r.skew.x,y:r.skew.y},visible:r.visible,x:r.x,y:r.y,boundsArea:r.boundsArea,cursor:r.cursor,eventMode:r.eventMode,interactive:r.interactive,interactiveChildren:r.interactiveChildren,hitArea:r.hitArea}}function Xg(r,t){return {url:r.source.label,alias:t===r.source.label?void 0:t}}function ns(r,t){let e=Qy(r,Yr),s=t?.childrenExport||false?r.children.sort((o,n)=>r.getChildIndex(o)-r.getChildIndex(n)).map(o=>Ky(o)):[];return {pixivnId:e,elements:s,...qy(r)}}function dl(r){let t=ns(r),e=t.pixivnId??Xr,i=Kg(r),s="textureAlias"in r?Xg(r.texture,r.textureAlias):Xg(r.texture);return {...t,pixivnId:e,textureData:s,anchor:{x:r.anchor.x,y:r.anchor.y},roundPixels:r.roundPixels,onEvents:i}}function Zy(r){let t=ns(r),e=t.pixivnId??zg,i=Kg(r);return {...t,pixivnId:e,anchor:{x:r.anchor.x,y:r.anchor.y},text:r.text,resolution:r.resolution,style:Jy(r.style),roundPixels:r.roundPixels,onEvents:i}}function Qy(r,t){return Object.prototype.hasOwnProperty.call(r,"pixivnId")?r.pixivnId:t}function Kg(r){return "onEvents"in r?r.onEvents:{}}function jg(r,t){if(typeof r!="object"||r===null)return r;st.warn(`Unsupported property type for Text.style.${t}: FillGradient or FillPattern.`,r);}function Jy(r){return {align:r.align,breakWords:r.breakWords,dropShadow:r.dropShadow,fill:jg(r.stroke,"fill"),fontFamily:r.fontFamily,fontSize:r.fontSize,fontStyle:r.fontStyle,fontVariant:r.fontVariant,fontWeight:r.fontWeight,leading:r.leading,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,padding:r.padding,stroke:jg(r.stroke,"stroke"),textBaseline:r.textBaseline,trim:r.trim,whiteSpace:r.whiteSpace,wordWrap:r.wordWrap,wordWrapWidth:r.wordWrapWidth}}async function fl(r){if(r!=="EMPTY"){if(!r){st.error("Texture not found",r);return}if(Jt.cache.has(r)){let t=Jt.get(r);if(t)return t}return Jt.load(r).then(t=>{if(!t){st.error("Texture not found",r);return}if(!(t instanceof F)){st.error("File not is a file",r);return}return t}).catch(t=>{st.error("Error loading file",t);})}}async function qg(r){let t=tb(r.pixivnId);if(t)await t.setMemory(r);else throw new Error("[Pixi\u2019VN] The element "+r.pixivnId+" could not be created");return t}function tb(r){try{let t=qr.get(r);return t?new t:void 0}catch(t){st.error(`Error while getting CanvasElement ${r}`,t);return}}var mn=class extends Ft{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Yr;}pixivnId=Yr;get memory(){return ns(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await pl(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let i=t.elements[e],s=await qg(i);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=os.getInstance(i);return this._onEvents[t]=i,s?super.on(t,()=>{s.fn(t,this);}):st.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};qr.add(mn,Yr);async function pl(r,t,e){"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(r.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(r.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(r.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(r.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(r.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(r.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(r.rotation=t.rotation),"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?r.scale.set(t.scale,t.scale):r.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?r.pivot.set(t.pivot,t.pivot):r.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&r.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&r.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(r.visible=t.visible),"x"in t&&t.x!==void 0&&(r.x=t.x),"y"in t&&t.y!==void 0&&(r.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(r.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(r.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(r.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(r.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(r.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(r.hitArea=t.hitArea),("width"in t&&t.width!==void 0&&(r.width=t.width),"height"in t&&t.height!==void 0&&(r.height=t.height));}var gn=class r extends qt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Xr;}pixivnId=Xr;_textureAlias;get textureAlias(){return this._textureAlias?this._textureAlias:this.texture.source.label}set textureAlias(t){this._textureAlias=t;}get memory(){return dl(this)}set memory(t){}async setMemory(t){return this.memory=t,await eb(this,t)}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=os.getInstance(i);return this._onEvents[t]=i,s?(super.on(t,()=>{s.fn(t,this);}),this.interactive||(this.interactive=true,this.eventMode="dynamic")):st.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}static from(t,e){let i=qt.from(t,e),s=new r;return s.texture=i.texture,s}};qr.add(gn,Xr);async function eb(r,t,e){let i=e?.ignoreTexture||false;if(await pl(r,t),!i){if("textureImage"in t&&t.textureImage&&t.textureImage.image){let o=await fl(t.textureImage.image);o&&(r.texture=o);}if("textureData"in t&&(t.textureData.alias&&(r.textureAlias=t.textureData.alias),t.textureData.url!=="EMPTY")){let o=t.textureData.url;t.textureData.alias&&Jt.resolver.hasKey(t.textureData.alias)&&(o=t.textureData.alias);let n=await fl(o);n&&(r.texture=n);}}let s=e?.half;if(s&&await s(),"anchor"in t&&t.anchor!==void 0&&(typeof t.anchor=="number"?r.anchor.set(t.anchor,t.anchor):r.anchor.set(t.anchor.x,t.anchor.y)),"roundPixels"in t&&t.roundPixels!==void 0&&(r.roundPixels=t.roundPixels),"onEvents"in t)for(let o in t.onEvents){let n=t.onEvents[o],a=os.get(n);a&&r.onEvent(o,a);}}export{gn as default,eb as setMemorySprite};
620
+ `,Vr=null,Qi=class{constructor(){Vr||(Vr=URL.createObjectURL(new Blob([Iy],{type:"application/javascript"}))),this.worker=new Worker(Vr);}};Qi.revokeObjectURL=function(){Vr&&(URL.revokeObjectURL(Vr),Vr=null);};var Mg=0,ol,nl=class{constructor(){this._initialized=false,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={};}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Hr;e.addEventListener("message",i=>{e.terminate(),Hr.revokeObjectURL(),t(i.data);});}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=true);}_getWorker(){ol===void 0&&(ol=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return !t&&this._createdWorkers<ol&&(this._createdWorkers++,t=new Qi().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next();})),t}_returnWorker(t){this._workerPool.push(t);}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null;}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o});});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[Mg]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Mg++,id:i});}},al=new nl;de();var Gy=[".jpeg",".jpg",".png",".webp",".avif"],Dy=["image/jpeg","image/png","image/webp","image/avif"];async function Uy(r,t){let e=await W.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var Jo={name:"loadTextures",extension:{type:T.LoadParser,priority:mt.High,name:"loadTextures"},config:{preferWorkers:true,preferCreateImageBitmap:true,crossOrigin:"anonymous"},test(r){return Vt(r,Dy)||Nt(r,Gy)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await al.isImageBitmapSupported()?i=await al.loadImageBitmap(r,t):i=await Uy(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i);},i.onerror=n);});let s=new kt({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Or(r),...t.data});return zr(s,e,r)},unload(r){r.destroy(true);}};P();xa();ga();var Eg=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],Ly=Eg.map(r=>`video/${r.substring(1)}`);function Oy(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=Wy(t):e!==false&&(r.crossOrigin=typeof e=="string"?e:"anonymous");}function zy(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t();}function s(n){o(),e(n);}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s);}})}function Wy(r,t=globalThis.location){if(r.startsWith("data:"))return "";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var Bg={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=Vt(r,Ly),e=Nt(r,Eg);return t||e},async load(r,t,e){let i={...cr.defaultOptions,resolution:t.data?.resolution||Or(r),alphaMode:t.data?.alphaMode||await Ws(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==false?"auto":void 0,"webkit-playsinline":i.playsinline!==false?"":void 0,playsinline:i.playsinline!==false?"":void 0,muted:i.muted===true?"":void 0,loop:i.loop===true?"":void 0,autoplay:i.autoPlay!==false?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l);}),i.muted===true&&(s.muted=true),Oy(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let h=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=cr.MIME_TYPES[h]||`video/${h}`;}return n.src=r,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new cr({...i,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await zy(s),h(zr(c,e,r));};s.addEventListener("canplay",l),s.appendChild(n);})},unload(r){r.destroy(true);}};P();ar();P();ar();var tn={extension:{type:T.ResolveParser,name:"resolveTexture"},test:Jo.test,parse:r=>({resolution:parseFloat(Lt.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var Fg={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Lt.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:tn.parse};ar();xi();Ds();var en=class{constructor(){this._detections=[],this._initialized=false,this.resolver=new Lt,this.loader=new Qo,this.cache=j,this._backgroundLoader=new qo(this.loader),this._backgroundLoader.active=true,this.reset();}async init(t={}){if(this._initialized){G("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=true,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o);}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences);}add(t){this.resolver.add(t);}async load(t,e){this._initialized||await this.init();let i=Ve(t),s=Pt(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e);}async loadBundle(t,e){this._initialized||await this.init();let i=false;typeof t=="string"&&(i=true,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h);},c=n.map(u=>{let f=s[u];return h+=Object.keys(f).length,this._mapLoadToResolve(f,l).then(d=>{o[u]=d;})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e));}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i));});}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=false;}get(t){if(typeof t=="string")return j.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=j.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=false;let s=await this.loader.load(i,e);this._backgroundLoader.active=true;let o={};return i.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a;}),j.set(h,a);}),o}async unload(t){this._initialized||await this.init();let e=Pt(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i);}async unloadBundle(t){this._initialized||await this.init(),t=Pt(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i);}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{j.remove(i.src);}),await this.loader.unload(e);}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i];});});}},Jt=new en;R.handleByList(T.LoadParser,Jt.loader.parsers).handleByList(T.ResolveParser,Jt.resolver.parsers).handleByList(T.CacheParser,Jt.cache.parsers).handleByList(T.DetectionParser,Jt.detections);R.add(gg,yg,xg,wg,bg,vg,Tg,Sg,Ag,Pg,Cg,Jo,Bg,mg,pg,tn,Fg);var kg={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};R.handle(T.Asset,r=>{let t=r.ref;Object.entries(kg).filter(([e])=>!!t[e]).forEach(([e,i])=>R.add(Object.assign(t[e],{extension:t[e].extension??i})));},r=>{let t=r.ref;Object.keys(kg).filter(e=>!!t[e]).forEach(e=>R.remove(t[e]));});fs();ht();Gs();var rn=class extends be{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=true,this._resolution=null,this._autoResolution=true,this._didTextUpdate=true,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=false,this._anchor=new _t({_onUpdate:()=>{this.onViewUpdate();}}),n&&(this.anchor=n),this.roundPixels=l??false,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h);}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t);}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate());}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate();}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate();}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width);}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height);}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height);}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=true),super.onViewUpdate();}_getKey(){return `${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=false){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null;}};function Rg(r,t){let e=r[0]??{};return (typeof e=="string"||r[1])&&(D(O,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}Uo();kr();var Ji=class extends rn{constructor(...t){let e=Rg(t,"Text");super(e,It),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,i=Ht.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o;}};de();gt();at();ba();sr();da();di();Gt();ve();cs(qa());R.add(ug,fg);var ae={};ox(ae,{DistortionFilter:()=>sn,EqualizerFilter:()=>$t,Filter:()=>ft,MonoFilter:()=>on,ReverbFilter:()=>nn,StereoFilter:()=>an,StreamFilter:()=>hn,TelephoneFilter:()=>ln});var Ig;function Gg(r){return Ig=r,r}function K(){return Ig}var ft=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var sn=class extends ft{constructor(t=0){let e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,K().useLegacy)return;let e=t*1e3,i=44100,s=new Float32Array(i),o=Math.PI/180,n=0,a;for(;n<i;++n)a=n*2/i-1,s[n]=(3+e)*a*20*o/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var ut=class{static setParamValue(t,e){if(t.setValueAtTime){let i=K().context;t.setValueAtTime(e,i.audioContext.currentTime);}else t.value=e;return e}};var q=class extends ft{constructor(r=0,t=0,e=0,i=0,s=0,o=0,n=0,a=0,h=0,l=0){let c=[],u=[{f:q.F32,type:"lowshelf",gain:r},{f:q.F64,type:"peaking",gain:t},{f:q.F125,type:"peaking",gain:e},{f:q.F250,type:"peaking",gain:i},{f:q.F500,type:"peaking",gain:s},{f:q.F1K,type:"peaking",gain:o},{f:q.F2K,type:"peaking",gain:n},{f:q.F4K,type:"peaking",gain:a},{f:q.F8K,type:"peaking",gain:h},{f:q.F16K,type:"highshelf",gain:l}];K().useLegacy||(c=u.map(f=>{let d=K().context.audioContext.createBiquadFilter();return d.type=f.type,ut.setParamValue(d.Q,1),d.frequency.value=f.f,ut.setParamValue(d.gain,f.gain),d})),super(c[0],c[c.length-1]),this.bands=c,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(r,t=0){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);ut.setParamValue(this.bandsMap[r].gain,t);}getGain(r){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);return this.bandsMap[r].gain.value}set f32(r){this.setGain(q.F32,r);}get f32(){return this.getGain(q.F32)}set f64(r){this.setGain(q.F64,r);}get f64(){return this.getGain(q.F64)}set f125(r){this.setGain(q.F125,r);}get f125(){return this.getGain(q.F125)}set f250(r){this.setGain(q.F250,r);}get f250(){return this.getGain(q.F250)}set f500(r){this.setGain(q.F500,r);}get f500(){return this.getGain(q.F500)}set f1k(r){this.setGain(q.F1K,r);}get f1k(){return this.getGain(q.F1K)}set f2k(r){this.setGain(q.F2K,r);}get f2k(){return this.getGain(q.F2K)}set f4k(r){this.setGain(q.F4K,r);}get f4k(){return this.getGain(q.F4K)}set f8k(r){this.setGain(q.F8K,r);}get f8k(){return this.getGain(q.F8K)}set f16k(r){this.setGain(q.F16K,r);}get f16k(){return this.getGain(q.F16K)}reset(){this.bands.forEach(r=>{ut.setParamValue(r.gain,0);});}destroy(){this.bands.forEach(r=>{r.disconnect();}),this.bands=null,this.bandsMap=null;}},$t=q;$t.F32=32;$t.F64=64;$t.F125=125;$t.F250=250;$t.F500=500;$t.F1K=1e3;$t.F2K=2e3;$t.F4K=4e3;$t.F8K=8e3;$t.F16K=16e3;var on=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createChannelSplitter(),t=i.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var nn=class extends ft{constructor(t=3,e=2,i=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=i,this._rebuild();}_clamp(t,e,i){return Math.min(i,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(K().useLegacy)return;let{audioContext:t}=K().context,e=t.sampleRate,i=e*this._seconds,s=t.createBuffer(2,i,e),o=s.getChannelData(0),n=s.getChannelData(1),a;for(let l=0;l<i;l++)a=this._reverse?i-l:l,o[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay),n[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var an=class extends ft{constructor(t=0){let e,i,s;if(!K().useLegacy){let{audioContext:o}=K().context;o.createStereoPanner?(e=o.createStereoPanner(),s=e):(i=o.createPanner(),i.panningModel="equalpower",s=i);}super(s),this._stereo=e,this._panner=i,this.pan=t;}set pan(t){this._pan=t,this._stereo?ut.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var hn=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;t=i.createMediaStreamDestination(),e=i.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var ln=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context,s=i.createBiquadFilter(),o=i.createBiquadFilter(),n=i.createBiquadFilter(),a=i.createBiquadFilter();s.type="lowpass",ut.setParamValue(s.frequency,2e3),o.type="lowpass",ut.setParamValue(o.frequency,2e3),n.type="highpass",ut.setParamValue(n.frequency,500),a.type="highpass",ut.setParamValue(a.frequency,500),s.connect(o),o.connect(n),n.connect(a),t=s,e=a;}super(t,e);}};var ts=class extends Y{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var Vy=0,hl=class extends Y{constructor(r){super(),this.id=Vy++,this.init(r);}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(r){this._playing=false,this._duration=r.source.duration;let t=this._source=r.source.cloneNode(false);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters");}refresh(){let r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=r.volume*(r.muted?0:1),i=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*i,this._source.playbackRate=this._speed*r.speed*t.speed;}refreshPaused(){let r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(r){let{start:t,end:e,speed:i,loop:s,volume:o,muted:n}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=o,this._loop=!!s,this._muted=n,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-hl.PADDING),this._end=Math.min(this._end+hl.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),dt.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){dt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){dt.shared.remove(this._onUpdate,this),this.removeAllListeners();let r=this._source;r&&(r.onended=null,r.onplay=null,r.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},cn=hl;cn.PADDING=.1;var es=class extends Y{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new cn(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=true;let h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h);},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;let s=()=>{a(),i.isLoaded=true;let h=i.autoPlayStart();t&&t(null,i,h);},o=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},n=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",o),e.removeEventListener("error",n);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",o,false),e.addEventListener("error",n,false),e.load();}};var rs=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var Ze=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],ll=["audio/mpeg","audio/ogg"],Qe={};function Dg(r){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),i={},s=/^no$/;Ze.forEach(o=>{let n=e.canPlayType(`audio/${o}`).replace(s,""),a=t[o]?e.canPlayType(t[o]).replace(s,""):"";i[o]=!!n||!!a;}),Object.assign(Qe,i);}Dg();var $y=0,is=class extends Y{constructor(t){super(),this.id=$y++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let i=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),o=this._volume*(this._muted?0:1);ut.setParamValue(this._gain.gain,o*s*i),ut.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i));}play(t){let{start:e,end:i,speed:s,loop:o,volume:n,muted:a,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=false;let{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=s,this._volume=n,this._loop=!!o,this._muted=a,this._filters=h,this.refresh();let u=this._source.buffer.duration;this._duration=u,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){dt.shared.remove(this._updateListener,this),t&&dt.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),i=e-this._lastUpdate;if(i>0||t){let s=this._source.playbackRate.value;this._elapsed+=i*s,this._lastUpdate=e;let o=this._duration,n;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;n=(this._source.loopStart+this._elapsed%a)/o;}else n=this._elapsed%o/o;this._progress=n,this.emit("progress",this._progress,o);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var Je=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var Ug=class extends Je{constructor(r){let t=r.audioContext,e=t.createBufferSource(),i=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(i),i.connect(r.destination),super(s,i),this.context=r,this.bufferSource=e,this.gain=i,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(Ug.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,ut.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},un=Ug;un.BUFFER_SIZE=0;var tr=class{init(t){this.parent=t,this._nodes=new un(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new is(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,i=await W.get().fetch(e);this._decode(await i.arrayBuffer(),t);}_decode(t,e){let i=(s,o)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=o;let n=this.parent.autoPlayStart();e&&e(null,this.parent,n);}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i);}};var Nr=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=K().useLegacy?new es:new tr;return new Nr(e,t)}constructor(r,t){this.media=r,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(r){let[t]=r.map(e=>({url:e,ext:tt.extname(e).slice(1)})).filter(({ext:e})=>Qe[e]).sort((e,i)=>Ze.indexOf(e.ext)-Ze.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return K().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get filters(){return this.media.filters}set filters(r){this.media.filters=r;}addSprites(r,t){if(typeof r=="object"){let i={};for(let s in r)i[s]=this.addSprites(s,r[s]);return i}console.assert(!this._sprites[r],`Alias ${r} is already taken`);let e=new rs(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(r){if(r){let t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let o=this._sprites[s];e.start=o.start+(e.start||0),e.end=o.end,e.speed=o.speed||1,e.loop=o.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,o)=>{this._preload((n,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,n?o(n):(e.loaded&&e.loaded(n,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let i=this._createInstance();return this._instances.push(i),this.isPlaying=true,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i);}),i.once("stop",()=>{this._onComplete(i);}),i.play(e),i}refresh(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh();}refreshPaused(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}_preload(r){this.media.load(r);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0;}_onComplete(r){if(this._instances){let t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(r);}_createInstance(){if(Nr._pool.length>0){let r=Nr._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),Nr._pool.indexOf(r)<0&&Nr._pool.push(r);}},Ee=Nr;Ee._pool=[];var $r=class r extends Je{constructor(){let t=window,e=new r.AudioContext,i=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(i),i.connect(e.destination),super(s,i),this.autoPause=true,this._ctx=e,this._offlineCtx=new r.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=s,this.events=new Y,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let i=o=>{e(new Error(o?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,o=>{e(null,o);},i);s&&s.catch(i);}};var dn=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new $r),this._htmlAudioContext=new ts,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return $r.AudioContext!==null}add(t,e){if(typeof t=="object"){let o={};for(let n in t){let a=this._getOptions(t[n],e);o[n]=this.add(n,a);}return o}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof Ee)return this._sounds[t]=e,e;let i=this._getOptions(e),s=Ee.from(i);return this._sounds[t]=s,s}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){let i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var Lg=r=>{let t=r.src,e=r?.alias?.[0];return (!e||r.src===e)&&(e=tt.basename(t,tt.extname(t))),e},Og={extension:T.Asset,detection:{test:async()=>true,add:async r=>[...r,...Ze.filter(t=>Qe[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:mt.High},test(r){let t=tt.extname(r).slice(1);return !!Qe[t]||ll.some(e=>r.startsWith(`data:${e}`))},async load(r,t){let e=await new Promise((i,s)=>Ee.from({...t.data,url:r,preload:true,loaded(o,n){o?s(o):i(n),t.data?.loaded?.(o,n);}}));return K().add(Lg(t),e),e},async unload(r,t){K().remove(Lg(t));}}};R.add(Og);Gg(new dn);({DistortionFilter:ae.DistortionFilter,EqualizerFilter:ae.EqualizerFilter,MonoFilter:ae.MonoFilter,ReverbFilter:ae.ReverbFilter,StereoFilter:ae.StereoFilter,StreamFilter:ae.StreamFilter,TelephoneFilter:ae.TelephoneFilter});var Yr="Container";var Xr="Sprite",zg="Text";var st;(s=>(s.log=(o,...n)=>console.log(`[Pixi\u2019VN] ${o}`,...n),s.warn=(o,...n)=>console.warn(`[Pixi\u2019VN] ${o}`,...n),s.error=(o,...n)=>console.error(`[Pixi\u2019VN] ${o}`,...n),s.info=(o,...n)=>console.info(`[Pixi\u2019VN] ${o}`,...n)))(st||={});var jr=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Hg=new Set,cl=typeof process=="object"&&process?process:{},Vg=(r,t,e,i)=>{typeof cl.emitWarning=="function"?cl.emitWarning(r,t,e,i):console.error(`[${e}] ${t}: ${r}`);},fn=globalThis.AbortController,Wg=globalThis.AbortSignal;if(typeof fn>"u"){Wg=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},fn=class{constructor(){t();}signal=new Wg;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let r=cl.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{r&&(r=false,Vg("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var jy=r=>!Hg.has(r),Be=r=>r&&r===Math.floor(r)&&r>0&&isFinite(r),Ng=r=>Be(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?Kr:null:null,Kr=class extends Array{constructor(t){super(t),this.fill(0);}},ul=class r{heap;length;static#h=false;static create(t){let e=Ng(t);if(!e)return [];r.#h=true;let i=new r(t,e);return r.#h=false,i}constructor(t,e){if(!r.#h)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},pn=class r{#h;#u;#m;#C;#g;#F;#k;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#x;#i;#r;#t;#l;#d;#a;#o;#_;#n;#y;#b;#f;#v;#P;#c;#R;static unsafeExposeInternals(t){return {starts:t.#b,ttls:t.#f,sizes:t.#y,keyMap:t.#i,keyList:t.#r,valList:t.#t,next:t.#l,prev:t.#d,get head(){return t.#a},get tail(){return t.#o},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,o)=>t.#D(e,i,s,o),moveToTail:e=>t.#B(e),indexes:e=>t.#T(e),rindexes:e=>t.#w(e),isStale:e=>t.#p(e)}}get max(){return this.#h}get maxSize(){return this.#u}get calculatedSize(){return this.#x}get size(){return this.#s}get fetchMethod(){return this.#F}get memoMethod(){return this.#k}get dispose(){return this.#m}get onInsert(){return this.#C}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:n,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:p=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:w,ignoreFetchAbort:S}=t;if(e!==0&&!Be(e))throw new TypeError("max option must be a nonnegative integer");let B=e?Ng(e):Array;if(!B)throw new Error("invalid max value: "+e);if(this.#h=e,this.#u=p,this.maxEntrySize=x||this.#u,this.sizeCalculation=g,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#k=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#F=_,this.#P=!!_,this.#i=new Map,this.#r=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new B(e),this.#d=new B(e),this.#a=0,this.#o=0,this.#_=ul.create(e),this.#s=0,this.#x=0,typeof l=="function"&&(this.#m=l),typeof c=="function"&&(this.#C=c),typeof u=="function"?(this.#g=u,this.#n=[]):(this.#g=void 0,this.#n=void 0),this.#v=!!this.#m,this.#R=!!this.#C,this.#c=!!this.#g,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!A,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!S,this.maxEntrySize!==0){if(this.#u!==0&&!Be(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!Be(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#V();}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!a,this.ttlResolution=Be(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!Be(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#U();}if(this.#h===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#u){let k="LRU_CACHE_UNBOUNDED";jy(k)&&(Hg.add(k),Vg("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",k,r));}}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#U(){let t=new Kr(this.#h),e=new Kr(this.#h);this.#f=t,this.#b=e,this.#L=(o,n,a=jr.now())=>{if(e[o]=n!==0?a:0,t[o]=n,n!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#p(o)&&this.#S(this.#r[o],"expire");},n+1);h.unref&&h.unref();}},this.#M=o=>{e[o]=t[o]!==0?jr.now():0;},this.#A=(o,n)=>{if(t[n]){let a=t[n],h=e[n];if(!a||!h)return;o.ttl=a,o.start=h,o.now=i||s();let l=o.now-h;o.remainingTTL=a-l;}};let i=0,s=()=>{let o=jr.now();if(this.ttlResolution>0){i=o;let n=setTimeout(()=>i=0,this.ttlResolution);n.unref&&n.unref();}return o};this.getRemainingTTL=o=>{let n=this.#i.get(o);if(n===void 0)return 0;let a=t[n],h=e[n];if(!a||!h)return 1/0;let l=(i||s())-h;return a-l},this.#p=o=>{let n=e[o],a=t[o];return !!a&&!!n&&(i||s())-n>a};}#M=()=>{};#A=()=>{};#L=()=>{};#p=()=>false;#V(){let t=new Kr(this.#h);this.#x=0,this.#y=t,this.#E=e=>{this.#x-=t[e],t[e]=0;},this.#O=(e,i,s,o)=>{if(this.#e(i))return 0;if(!Be(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(i,e),!Be(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#I=(e,i,s)=>{if(t[e]=i,this.#u){let o=this.#u-t[e];for(;this.#x>o;)this.#G(true);}this.#x+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#x);};}#E=t=>{};#I=(t,e,i)=>{};#O=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#o;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#a));)e=this.#d[e];}*#w({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#a;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#o));)e=this.#l[e];}#z(t){return t!==void 0&&this.#i.get(this.#r[t])===t}*entries(){for(let t of this.#T())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*rentries(){for(let t of this.#w())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*keys(){for(let t of this.#T()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*rkeys(){for(let t of this.#w()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*values(){for(let t of this.#T())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}*rvalues(){for(let t of this.#w())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#T()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,this.#r[i],this))return this.get(this.#r[i],e)}}forEach(t,e=this){for(let i of this.#T()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[i],this);}}rforEach(t,e=this){for(let i of this.#w()){let s=this.#t[i],o=this.#e(s)?s.__staleWhileFetching:s;o!==void 0&&t.call(e,o,this.#r[i],this);}}purgeStale(){let t=false;for(let e of this.#w({allowStale:true}))this.#p(e)&&(this.#S(this.#r[e],"expire"),t=true);return t}info(t){let e=this.#i.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let o={value:s};if(this.#f&&this.#b){let n=this.#f[e],a=this.#b[e];if(n&&a){let h=n-(jr.now()-a);o.ttl=h,o.start=Date.now();}}return this.#y&&(o.size=this.#y[e]),o}dump(){let t=[];for(let e of this.#T({allowStale:true})){let i=this.#r[e],s=this.#t[e],o=this.#e(s)?s.__staleWhileFetching:s;if(o===void 0||i===void 0)continue;let n={value:o};if(this.#f&&this.#b){n.ttl=this.#f[e];let a=jr.now()-this.#b[e];n.start=Math.floor(Date.now()-a);}this.#y&&(n.size=this.#y[e]),t.unshift([i,n]);}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=jr.now()-s;}this.set(e,i.value,i);}}set(t,e,i={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:n=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=i,{noUpdateTTL:l=this.noUpdateTTL}=i,c=this.#O(t,e,i.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),this.#S(t,"set"),this;let u=this.#s===0?void 0:this.#i.get(t);if(u===void 0)u=this.#s===0?this.#o:this.#_.length!==0?this.#_.pop():this.#s===this.#h?this.#G(false):this.#s,this.#r[u]=t,this.#t[u]=e,this.#i.set(t,u),this.#l[this.#o]=u,this.#d[u]=this.#o,this.#o=u,this.#s++,this.#I(u,c,h),h&&(h.set="add"),l=false,this.#R&&this.#C?.(e,t,"add");else {this.#B(u);let f=this.#t[u];if(e!==f){if(this.#P&&this.#e(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=f;d!==void 0&&!n&&(this.#v&&this.#m?.(d,t,"set"),this.#c&&this.#n?.push([d,t,"set"]));}else n||(this.#v&&this.#m?.(f,t,"set"),this.#c&&this.#n?.push([f,t,"set"]));if(this.#E(u),this.#I(u,c,h),this.#t[u]=e,h){h.set="replace";let d=f&&this.#e(f)?f.__staleWhileFetching:f;d!==void 0&&(h.oldValue=d);}}else h&&(h.set="update");this.#R&&this.onInsert?.(e,t,e===f?"update":"replace");}if(s!==0&&!this.#f&&this.#U(),this.#f&&(l||this.#L(u,s,o),h&&this.#A(h,u)),!n&&this.#c&&this.#n){let f=this.#n,d;for(;d=f?.shift();)this.#g?.(...d);}return this}pop(){try{for(;this.#s;){let t=this.#t[this.#a];if(this.#G(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#c&&this.#n){let t=this.#n,e;for(;e=t?.shift();)this.#g?.(...e);}}}#G(t){let e=this.#a,i=this.#r[e],s=this.#t[e];return this.#P&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(s,i,"evict"),this.#c&&this.#n?.push([s,i,"evict"])),this.#E(e),t&&(this.#r[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#s===1?(this.#a=this.#o=0,this.#_.length=0):this.#a=this.#l[e],this.#i.delete(i),this.#s--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,o=this.#i.get(t);if(o!==void 0){let n=this.#t[o];if(this.#e(n)&&n.__staleWhileFetching===void 0)return false;if(this.#p(o))s&&(s.has="stale",this.#A(s,o));else return i&&this.#M(o),s&&(s.has="hit",this.#A(s,o)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#i.get(t);if(s===void 0||!i&&this.#p(s))return;let o=this.#t[s];return this.#e(o)?o.__staleWhileFetching:o}#D(t,e,i,s){let o=e===void 0?void 0:this.#t[e];if(this.#e(o))return o;let n=new fn,{signal:a}=i;a?.addEventListener("abort",()=>n.abort(a.reason),{signal:n.signal});let h={signal:n.signal,options:i,context:s},l=(x,g=false)=>{let{aborted:_}=n.signal,y=i.ignoreFetchAbort&&x!==void 0;if(i.status&&(_&&!g?(i.status.fetchAborted=true,i.status.fetchError=n.signal.reason,y&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),_&&!y&&!g)return u(n.signal.reason);let v=d;return this.#t[e]===d&&(x===void 0?v.__staleWhileFetching?this.#t[e]=v.__staleWhileFetching:this.#S(t,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(t,x,h.options))),x},c=x=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=x),u(x)),u=x=>{let{aborted:g}=n.signal,_=g&&i.allowStaleOnFetchAbort,y=_||i.allowStaleOnFetchRejection,v=y||i.noDeleteOnFetchRejection,b=d;if(this.#t[e]===d&&(!v||b.__staleWhileFetching===void 0?this.#S(t,"fetch"):_||(this.#t[e]=b.__staleWhileFetching)),y)return i.status&&b.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),b.__staleWhileFetching;if(b.__returned===b)throw x},f=(x,g)=>{let _=this.#F?.(t,o,h);_&&_ instanceof Promise&&_.then(y=>x(y===void 0?void 0:y),g),n.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(x(void 0),i.allowStaleOnFetchAbort&&(x=y=>l(y,true)));});};i.status&&(i.status.fetchDispatched=true);let d=new Promise(f).then(l,c),p=Object.assign(d,{__abortController:n,__staleWhileFetching:o,__returned:void 0});return e===void 0?(this.set(t,p,{...h.options,status:void 0}),e=this.#i.get(t)):this.#t[e]=p,p}#e(t){if(!this.#P)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof fn}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:n=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:x,forceRefresh:g=false,status:_,signal:y}=e;if(!this.#P)return _&&(_.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:_});let v={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:n,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:p,ignoreFetchAbort:d,status:_,signal:y},b=this.#i.get(t);if(b===void 0){_&&(_.fetch="miss");let A=this.#D(t,b,v,x);return A.__returned=A}else {let A=this.#t[b];if(this.#e(A)){let C=i&&A.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",C&&(_.returnedStale=true)),C?A.__staleWhileFetching:A.__returned=A}let w=this.#p(b);if(!g&&!w)return _&&(_.fetch="hit"),this.#B(b),s&&this.#M(b),_&&this.#A(_,b),A;let S=this.#D(t,b,v,x),k=S.__staleWhileFetching!==void 0&&i;return _&&(_.fetch=w?"stale":"refresh",k&&w&&(_.returnedStale=true)),k?S.__staleWhileFetching:S.__returned=S}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#k;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...n}=e,a=this.get(t,n);if(!o&&a!==void 0)return a;let h=i(t,a,{options:n,context:s});return this.set(t,h,n),h}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:n}=e,a=this.#i.get(t);if(a!==void 0){let h=this.#t[a],l=this.#e(h);return n&&this.#A(n,a),this.#p(a)?(n&&(n.get="stale"),l?(n&&i&&h.__staleWhileFetching!==void 0&&(n.returnedStale=true),i?h.__staleWhileFetching:void 0):(o||this.#S(t,"expire"),n&&i&&(n.returnedStale=true),i?h:void 0)):(n&&(n.get="hit"),l?h.__staleWhileFetching:(this.#B(a),s&&this.#M(a),h))}else n&&(n.get="miss");}#W(t,e){this.#d[e]=t,this.#l[t]=e;}#B(t){t!==this.#o&&(t===this.#a?this.#a=this.#l[t]:this.#W(this.#d[t],this.#l[t]),this.#W(this.#o,t),this.#o=t);}delete(t){return this.#S(t,"delete")}#S(t,e){let i=false;if(this.#s!==0){let s=this.#i.get(t);if(s!==void 0)if(i=true,this.#s===1)this.#H(e);else {this.#E(s);let o=this.#t[s];if(this.#e(o)?o.__abortController.abort(new Error("deleted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(o,t,e),this.#c&&this.#n?.push([o,t,e])),this.#i.delete(t),this.#r[s]=void 0,this.#t[s]=void 0,s===this.#o)this.#o=this.#d[s];else if(s===this.#a)this.#a=this.#l[s];else {let n=this.#d[s];this.#l[n]=this.#l[s];let a=this.#l[s];this.#d[a]=this.#d[s];}this.#s--,this.#_.push(s);}}if(this.#c&&this.#n?.length){let s=this.#n,o;for(;o=s?.shift();)this.#g?.(...o);}return i}clear(){return this.#H("delete")}#H(t){for(let e of this.#w({allowStale:true})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else {let s=this.#r[e];this.#v&&this.#m?.(i,s,t),this.#c&&this.#n?.push([i,s,t]);}}if(this.#i.clear(),this.#t.fill(void 0),this.#r.fill(void 0),this.#f&&this.#b&&(this.#f.fill(0),this.#b.fill(0)),this.#y&&this.#y.fill(0),this.#a=0,this.#o=0,this.#_.length=0,this.#x=0,this.#s=0,this.#c&&this.#n){let e=this.#n,i;for(;i=e?.shift();)this.#g?.(...i);}}};var Fe=class{cache;map=new Map;constructor(t){this.cache=new pn({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}keys(){return this.map.keys()}get values(){return this.map.values}};var ss=new Fe({cacheSize:5});var $g;(s=>{function r(o,n){n||(n=o.name),ss.get(n)&&st.warn(`CanvasElement "${n}" already registered`),o.prototype.pixivnId=n,ss.set(n,o);}s.add=r;function t(o){try{let n=ss.get(o);if(!n){st.error(`CanvasElement "${o}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return new n,n}catch(n){st.error(`Error while getting CanvasElement "${o}"`,n);return}}s.get=t;function e(){return Array.from(ss.values())}s.values=e;function i(o){return ss.has(o)}s.has=i;})($g||={});var qr=$g;var Zr=new Fe({cacheSize:5});var Yg;(o=>{function r(n,a){a||(a=n.name),Zr.get(a)&&st.info(`Event "${a}" already exists, it will be overwritten`),n.prototype.id=a,Zr.set(a,n);}o.add=r;function t(n){try{let a=Zr.get(n);if(!a){st.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a,a}catch(a){st.error(`Error while getting Event "${n}"`,a);return}}o.get=t;function e(n){try{let a=Zr.get(n);if(!a){st.error(`Event "${n}" not found, did you forget to register it with the eventDecorator?`);return}return new a}catch(a){st.error(`Error while getting Event "${n}"`,a);return}}o.getInstance=e;function i(){return Array.from(Zr.values())}o.values=i;function s(n){return Zr.has(n)}o.has=s;})(Yg||={});var os=Yg;function Ky(r){return "memory"in r?r.memory:r instanceof Ji?Zy(r):r instanceof qt?dl(r):ns(r)}function qy(r){return {width:r.width,height:r.height,isRenderGroup:r.isRenderGroup,blendMode:r.blendMode,tint:r.tint,alpha:r.alpha,angle:r.angle,renderable:r.renderable,rotation:r.rotation,scale:{x:r.scale.x,y:r.scale.y},pivot:{x:r.pivot.x,y:r.pivot.y},position:{x:r.position.x,y:r.position.y},skew:{x:r.skew.x,y:r.skew.y},visible:r.visible,x:r.x,y:r.y,boundsArea:r.boundsArea,cursor:r.cursor,eventMode:r.eventMode,interactive:r.interactive,interactiveChildren:r.interactiveChildren,hitArea:r.hitArea}}function Xg(r,t){return {url:r.source.label,alias:t===r.source.label?void 0:t}}function ns(r,t){let e=Qy(r,Yr),s=t?.childrenExport||false?r.children.sort((o,n)=>r.getChildIndex(o)-r.getChildIndex(n)).map(o=>Ky(o)):[];return {pixivnId:e,elements:s,...qy(r)}}function dl(r){let t=ns(r),e=t.pixivnId??Xr,i=Kg(r),s="textureAlias"in r?Xg(r.texture,r.textureAlias):Xg(r.texture);return {...t,pixivnId:e,textureData:s,anchor:{x:r.anchor.x,y:r.anchor.y},roundPixels:r.roundPixels,onEvents:i}}function Zy(r){let t=ns(r),e=t.pixivnId??zg,i=Kg(r);return {...t,pixivnId:e,anchor:{x:r.anchor.x,y:r.anchor.y},text:r.text,resolution:r.resolution,style:Jy(r.style),roundPixels:r.roundPixels,onEvents:i}}function Qy(r,t){return Object.prototype.hasOwnProperty.call(r,"pixivnId")?r.pixivnId:t}function Kg(r){return "onEvents"in r?r.onEvents:{}}function jg(r,t){if(typeof r!="object"||r===null)return r;st.warn(`Unsupported property type for Text.style.${t}: FillGradient or FillPattern.`,r);}function Jy(r){return {align:r.align,breakWords:r.breakWords,dropShadow:r.dropShadow,fill:jg(r.stroke,"fill"),fontFamily:r.fontFamily,fontSize:r.fontSize,fontStyle:r.fontStyle,fontVariant:r.fontVariant,fontWeight:r.fontWeight,leading:r.leading,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,padding:r.padding,stroke:jg(r.stroke,"stroke"),textBaseline:r.textBaseline,trim:r.trim,whiteSpace:r.whiteSpace,wordWrap:r.wordWrap,wordWrapWidth:r.wordWrapWidth}}async function fl(r){if(r!=="EMPTY"){if(!r){st.error("Texture not found",r);return}if(Jt.cache.has(r)){let t=Jt.get(r);if(t)return t}return Jt.load(r).then(t=>{if(!t){st.error("Texture not found",r);return}if(!(t instanceof F)){st.error("File not is a file",r);return}return t}).catch(t=>{st.error("Error loading file",t);})}}async function qg(r){let t=tb(r.pixivnId);if(t)await t.setMemory(r);else throw new Error("[Pixi\u2019VN] The element "+r.pixivnId+" could not be created");return t}function tb(r){try{let t=qr.get(r);return t?new t:void 0}catch(t){st.error(`Error while getting CanvasElement ${r}`,t);return}}var mn=class extends Ft{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Yr;}pixivnId=Yr;get memory(){return ns(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await pl(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let i=t.elements[e],s=await qg(i);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=os.getInstance(i);return this._onEvents[t]=i,s?super.on(t,()=>{s.fn(t,this);}):st.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};qr.add(mn,Yr);async function pl(r,t,e){"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(r.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(r.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(r.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(r.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(r.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(r.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(r.rotation=t.rotation),"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?r.scale.set(t.scale,t.scale):r.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?r.pivot.set(t.pivot,t.pivot):r.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&r.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&r.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(r.visible=t.visible),"x"in t&&t.x!==void 0&&(r.x=t.x),"y"in t&&t.y!==void 0&&(r.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(r.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(r.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(r.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(r.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(r.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(r.hitArea=t.hitArea),("width"in t&&t.width!==void 0&&(r.width=t.width),"height"in t&&t.height!==void 0&&(r.height=t.height));}var gn=class r extends qt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||Xr;}pixivnId=Xr;_textureAlias;get textureAlias(){return this._textureAlias?this._textureAlias:this.texture.source.label}set textureAlias(t){this._textureAlias=t;}get memory(){return dl(this)}set memory(t){}async setMemory(t){return this.memory=t,await eb(this,t)}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=os.getInstance(i);return this._onEvents[t]=i,s?(super.on(t,()=>{s.fn(t,this);}),this.interactive||(this.interactive=true,this.eventMode="dynamic")):st.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}static from(t,e){let i=qt.from(t,e),s=new r;return s.texture=i.texture,s}};qr.add(gn,Xr);async function eb(r,t,e){let i=e?.ignoreTexture||false;if(await pl(r,t),!i){if("textureImage"in t&&t.textureImage&&t.textureImage.image){let o=await fl(t.textureImage.image);o&&(r.texture=o);}if("textureData"in t&&(t.textureData.alias&&(r.textureAlias=t.textureData.alias),t.textureData.url!=="EMPTY")){let o=t.textureData.url;t.textureData.alias&&Jt.resolver.hasKey(t.textureData.alias)&&(o=t.textureData.alias);let n=await fl(o);n&&(r.texture=n);}}let s=e?.half;if(s&&await s(),"anchor"in t&&t.anchor!==void 0&&(typeof t.anchor=="number"?r.anchor.set(t.anchor,t.anchor):r.anchor.set(t.anchor.x,t.anchor.y)),"roundPixels"in t&&t.roundPixels!==void 0&&(r.roundPixels=t.roundPixels),"onEvents"in t)for(let o in t.onEvents){let n=t.onEvents[o],a=os.get(n);a&&r.onEvent(o,a);}}export{gn as default,eb as setMemorySprite};