@drincs/pixi-vn 1.8.25 → 1.9.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 (53) hide show
  1. package/README.md +23 -1
  2. package/dist/{ContainerMemory-D2HtgX7w.d.cts → ContainerMemory-BpDgacyr.d.cts} +2 -15
  3. package/dist/{ContainerMemory-D2HtgX7w.d.ts → ContainerMemory-BpDgacyr.d.ts} +2 -15
  4. package/dist/{HistoryChoiceMenuOption-DVMD78W7.d.cts → HistoryChoiceMenuOption-BxMSXnyI.d.cts} +1 -1
  5. package/dist/{HistoryChoiceMenuOption-B8RfQz5H.d.ts → HistoryChoiceMenuOption-hSI4SHV-.d.ts} +1 -1
  6. package/dist/{HistoryGameState-CmjUtlkV.d.ts → HistoryGameState-C8ATx9K6.d.ts} +1 -1
  7. package/dist/{HistoryGameState-C28NcKKl.d.cts → HistoryGameState-CGfvq5iL.d.cts} +1 -1
  8. package/dist/{HistoryStep-G9dUn0Lf.d.cts → HistoryStep-WGB6nA4N.d.cts} +5 -0
  9. package/dist/{HistoryStep-G9dUn0Lf.d.ts → HistoryStep-WGB6nA4N.d.ts} +5 -0
  10. package/dist/{OpenedLabel-DLfFuZgk.d.ts → OpenedLabel-CmRdzTXP.d.ts} +1 -1
  11. package/dist/{OpenedLabel-BxfL31aQ.d.cts → OpenedLabel-Cmd675NI.d.cts} +1 -1
  12. package/dist/SoundGameState-C_6ZsQX6.d.cts +186 -0
  13. package/dist/SoundGameState-C_6ZsQX6.d.ts +186 -0
  14. package/dist/{StorageGameState-CtjNJpvE.d.cts → StorageGameState-C3PGrFPr.d.cts} +2 -2
  15. package/dist/{StorageGameState-BJy57o6K.d.ts → StorageGameState-jAexrJLj.d.ts} +2 -2
  16. package/dist/canvas.cjs +2 -2
  17. package/dist/canvas.d.cts +265 -24
  18. package/dist/canvas.d.ts +265 -24
  19. package/dist/canvas.mjs +2 -2
  20. package/dist/characters.cjs +1 -1
  21. package/dist/characters.mjs +1 -1
  22. package/dist/chunk-HD353M4B.mjs +1 -0
  23. package/dist/chunk-I7DOUH5V.mjs +1 -0
  24. package/dist/history.cjs +1 -1
  25. package/dist/history.d.cts +38 -15
  26. package/dist/history.d.ts +38 -15
  27. package/dist/history.mjs +1 -1
  28. package/dist/index.cjs +2 -2
  29. package/dist/index.d.cts +32 -34
  30. package/dist/index.d.ts +32 -34
  31. package/dist/index.mjs +2 -2
  32. package/dist/motion.cjs +1 -1
  33. package/dist/motion.mjs +1 -1
  34. package/dist/narration.cjs +2 -2
  35. package/dist/narration.d.cts +196 -52
  36. package/dist/narration.d.ts +196 -52
  37. package/dist/narration.mjs +2 -2
  38. package/dist/pixi/browser.js +115 -115
  39. package/dist/sound.cjs +1 -1
  40. package/dist/sound.d.cts +313 -6
  41. package/dist/sound.d.ts +313 -6
  42. package/dist/sound.mjs +1 -1
  43. package/dist/storage.cjs +1 -1
  44. package/dist/storage.d.cts +50 -3
  45. package/dist/storage.d.ts +50 -3
  46. package/dist/storage.mjs +1 -1
  47. package/dist/vite.cjs +2 -2
  48. package/dist/vite.mjs +2 -2
  49. package/package.json +2 -1
  50. package/dist/SoundManagerInterface-Dd0b88_N.d.cts +0 -436
  51. package/dist/SoundManagerInterface-Dd0b88_N.d.ts +0 -436
  52. package/dist/chunk-GIYMPXBT.mjs +0 -1
  53. package/dist/chunk-IWAXXFXE.mjs +0 -1
package/dist/canvas.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-6GLWL3NH.mjs';import'./chunk-JMOSOAGB.mjs';import {f,e,h as h$1,c as c$1,d as d$1,g as g$1,b,a as a$1}from'./chunk-IWAXXFXE.mjs';import {c,d,e as e$1,f as f$1}from'./chunk-HQQ5WH6C.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';import B,{Container}from'@drincs/pixi-vn/pixi.js';import {initDevtools}from'@pixi/devtools';var Ze={extension:{type:"sceneProperties",name:"additional-positions"},testNode(t){return "xAlign"in t||"yAlign"in t||"percentageX"in t||"percentageY"in t||"positionType"in t},testProp(t){switch(t){case "xAlign":case "yAlign":case "percentageX":case "percentageY":case "positionType":return true;default:return false}},setProperty(t,e,i){switch(e){case "xAlign":"xAlign"in t&&(t.xAlign=i/100);break;case "yAlign":"yAlign"in t&&(t.yAlign=i/100);break;case "percentageX":"percentageX"in t&&(t.percentageX=i/100);break;case "percentageY":"percentageY"in t&&(t.percentageY=i/100);break}},getProperties(t){return [{value:t.positionType,prop:"positionType",entry:{section:"Transform",type:"text",label:"Position Type"}},{value:t.xAlign*100,prop:"xAlign",entry:{section:"Transform",type:"range",label:"X Align",tooltip:"0% is left, 100% is right",options:{min:0,max:100}}},{value:t.yAlign*100,prop:"yAlign",entry:{section:"Transform",type:"range",label:"Y Align",tooltip:"0% is top, 100% is bottom",options:{min:0,max:100}}},{value:t.percentageX*100,prop:"percentageX",entry:{section:"Transform",type:"range",label:"X Percentage Position",tooltip:"0% is left, 100% is right",options:{min:0,max:100}}},{value:t.percentageY*100,prop:"percentageY",entry:{section:"Transform",type:"range",label:"Y Percentage Position",tooltip:"0% is top, 100% is bottom",options:{min:0,max:100}}}]}},Ee=Ze;function Me(t,e){let i=0;return async(...n)=>{let r=Date.now();if(r-i>=e)return i=r,await t(...n)}}var Oe=c(a(),1),g=class t{constructor(){}static _app=void 0;static get app(){if(!t._app)throw e$1.error("The canvas is not initialized"),new PixiError("invalid_usage","CanvasManagerStatic.app is undefined");return t._app}static get gameLayer(){let e=t.app.stage.getChildByLabel(b);return e||(e=new B.Container,e.label=b,t.app.stage.addChild(e)),e}static htmlLayers=[];static canvasWidth=300;static canvasHeight=300;static _isInitialized=false;static async init(e,i,n){let{id:r="pixi-vn-canvas",width:c=800,height:o=600,resolution:u=1,autoDensity:p=true,resizeMode:s="contain",...a}=i||{};return t.canvasWidth=c,t.canvasHeight=o,t._app=new B.Application,t.app.init({width:c,height:o,resolution:u,autoDensity:p,...a}).then(()=>{let{app:f=t.app,extensions:d=[],...y}=n||{};if(initDevtools({app:f,extensions:[Ee,...d],...y}),t._isInitialized=true,t.addCanvasIntoHTMLElement(e,r),s==="contain"){let x=Me(async()=>{requestAnimationFrame(()=>t.resize());},10);new ResizeObserver(x).observe(e),t.resize(),setTimeout(()=>t.resize(),750);}t.gameLayer;})}static addCanvasIntoHTMLElement(e,i){t._isInitialized?(e.appendChild(t.app.canvas),t.app.canvas.id=i):e$1.error("GameWindowManager is not initialized");}static addHtmlLayer(e,i,n={}){let{position:r="absolute",pointerEvents:c="none",userSelect:o="none"}=n,u=document.createElement("div");u.setAttribute("id",e),u.style.position=r,u.style.pointerEvents=c,u.style.userSelect=o;let p=i.appendChild(u);return t.htmlLayers.push(u),t.resize(),p}static removeHtmlLayer(e){let i=t.htmlLayers.find(n=>n.id===e);i&&(i.remove(),t.htmlLayers=t.htmlLayers.filter(n=>n.id!==e));}static getHtmlLayer(e){return t.htmlLayers.find(i=>i.id===e)}static async resize(){let e=t.canvasWidth,i=t.canvasHeight,n=t.app.resizeTo,r=t.app.canvas.style;n instanceof HTMLElement||(n=document.documentElement);let c,o;if(n===document.body||n===document.documentElement)c=document.documentElement.clientWidth||window.innerWidth,o=document.documentElement.clientHeight||window.innerHeight;else {let d=n.getBoundingClientRect();c=d.width||n.clientWidth,o=d.height||n.clientHeight;}let u=Math.min(c/e,o/i),p=Math.floor(u*e),s=Math.floor(u*i);r.width=`${p}px`,r.height=`${s}px`;let a=(c-p)/2,f=(o-s)/2;r.marginLeft=`${a}px`,r.marginRight=`${a}px`,r.marginTop=`${f}px`,r.marginBottom=`${f}px`,t.htmlLayers.forEach(d=>{d.style.width=`${p}px`,d.style.height=`${s}px`,d.style.marginLeft=`${a}px`,d.style.marginRight=`${a}px`,d.style.marginTop=`${f}px`,d.style.marginBottom=`${f}px`;});}static get childrenAliasesOrder(){return t.gameLayer.children.filter(e=>e.label).sort((e,i)=>t.gameLayer.getChildIndex(e)-t.gameLayer.getChildIndex(i)).map(e=>e.label)}static get currentTickersWithoutCreatedBySteps(){return Object.fromEntries(Array.from(t._currentTickers.entries()).filter(([e,i])=>!i.createdByTicketSteps).map(([e,i])=>[e,{id:i.ticker.alias,args:i.ticker.args,canvasElementAliases:i.ticker.canvasElementAliases,priority:i.ticker.priority,duration:i.ticker.duration,paused:i.ticker.paused}]))}static _currentTickers=new Map;static _currentTickersSequence=new Map;static get currentTickersSequence(){return Object.fromEntries(Array.from(t._currentTickersSequence.entries()).map(([e,i])=>[e,Object.fromEntries(i)]))}static _currentTickersTimeouts=new Map;static _tickersToCompleteOnStepEnd={tikersIds:[],stepAlias:[]};static generateTickerId(...e){try{return `${(0,Oe.default)(JSON.stringify(e)).toString()}_${Math.random().toString(36).substring(7)}`}catch(i){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${i}`)}}static addTickerTimeoutInfo(e,i,n,r){typeof e=="string"&&(e=[e]),t._currentTickersTimeouts.set(n,{aliases:e,ticker:i,canBeDeletedBeforeEnd:r});}static removeTickerTimeoutInfo(e){typeof e!="string"&&(e=e.toString()),t._currentTickersTimeouts.delete(e);}static removeTickerTimeout(e){typeof e!="string"&&(e=e.toString()),clearTimeout(Number(e)),t.removeTickerTimeoutInfo(e);}static removeTickerTimeoutsByAlias(e,i){t._currentTickersTimeouts.forEach((n,r)=>{let c=n.aliases.filter(o=>o!==e);if(c.length===0){let o=n.canBeDeletedBeforeEnd;(!i||o)&&t.removeTickerTimeout(r);}else n.aliases=c;});}};var ge=Symbol("SerializableEvent"),X=new d({cacheSize:5});function Qe(t){return (e,i,n)=>{let r=n.value;he.add(r,t||`${i}`);}}var he;(c=>{function t(o,u){o[ge]=u,X.get(u)&&e$1.info(`Event "${u}" already exists, it will be overwritten`),X.set(u,o);}c.add=t;function e(o){try{let u=X.get(o);if(!u){e$1.error(`Event "${o}" not found, did you forget to register it with the eventDecorator?`);return}return u}catch(u){e$1.error(`Error while getting Event "${o}"`,u);return}}c.get=e;function i(){return Array.from(X.values())}c.values=i;function n(o){return X.has(o)}c.has=n;function r(){return Array.from(X.keys())}c.keys=r;})(he||={});var ye=he;async function Be(t,e){if("onEvents"in e)for(let i in e.onEvents){let n=e.onEvents[i],r=ye.get(n);r&&t.on(i,r);}}function Re(t){let{onEventsHandlers:e={}}=t;return e}function O(t,e,i){let n=i[ge];return n&&typeof n=="string"?(e.onEventsHandlers[t]=n,true):(e$1.warn(`The event handler for event "${t}" is not registered with the eventDecorator, it will not be saved in the memory and it will not work after loading the game. Please register the event handler with the eventDecorator to avoid this warning. Read more about it here: https://pixi-vn.com/start/canvas-functions#add-a-listener-to-an-event`),false)}var q=new d({cacheSize:5}),De=new d({cacheSize:2}),Le=new d({cacheSize:2});function et(t={}){return e=>{me.add(e,t);}}async function S(t,e,i){let n=i?.ignoreScale||false,r=i?.end;"isRenderGroup"in e&&e.isRenderGroup!==void 0&&(t.isRenderGroup=e.isRenderGroup),"blendMode"in e&&e.blendMode!==void 0&&(t.blendMode=e.blendMode),"tint"in e&&e.tint!==void 0&&(t.tint=e.tint),"alpha"in e&&e.alpha!==void 0&&(t.alpha=e.alpha),"angle"in e&&e.angle!==void 0&&(t.angle=e.angle),"renderable"in e&&e.renderable!==void 0&&(t.renderable=e.renderable),"rotation"in e&&e.rotation!==void 0&&(t.rotation=e.rotation),!n&&"scale"in e&&e.scale!==void 0&&(typeof e.scale=="number"?t.scale.set(e.scale,e.scale):t.scale.set(e.scale.x,e.scale.y)),"pivot"in e&&e.pivot!==void 0&&(typeof e.pivot=="number"?t.pivot.set(e.pivot,e.pivot):t.pivot.set(e.pivot.x,e.pivot.y)),"position"in e&&e.position!==void 0&&t.position.set(e.position.x,e.position.y),"skew"in e&&e.skew!==void 0&&t.skew.set(e.skew.x,e.skew.y),"visible"in e&&e.visible!==void 0&&(t.visible=e.visible),"x"in e&&e.x!==void 0&&(t.x=e.x),"y"in e&&e.y!==void 0&&(t.y=e.y),"boundsArea"in e&&e.boundsArea!==void 0&&(t.boundsArea=e.boundsArea),"cursor"in e&&e.cursor!==void 0&&(t.cursor=e.cursor),"eventMode"in e&&e.eventMode!==void 0&&(t.eventMode=e.eventMode),"interactive"in e&&e.interactive!==void 0&&(t.interactive=e.interactive),"interactiveChildren"in e&&e.interactiveChildren!==void 0&&(t.interactiveChildren=e.interactiveChildren),"hitArea"in e&&e.hitArea!==void 0&&(t.hitArea=e.hitArea),Be(t,e),"align"in e&&e.align!==void 0&&"align"in t&&(t.align=e.align),"percentagePosition"in e&&e.percentagePosition!==void 0&&"percentagePosition"in t&&(t.percentagePosition=e.percentagePosition),r&&await r(),n||("width"in e&&e.width!==void 0&&(t.width=e.width),"height"in e&&e.height!==void 0&&(t.height=e.height));}var me;(u=>{function t(p,s={}){let{name:a=p.name,getInstance:f=async(y,x)=>{let T=new y;return await T.setMemory(x),T},copyProperty:d=async(y,x)=>{await y.setMemory(x);}}=s;q.get(a)&&e$1.warn(`CanvasElement "${a}" already registered`),p.prototype.pixivnId=a,q.set(a,p),De.set(a,f),Le.set(a,d);}u.add=t;function e(p){let s=q.get(p);if(!s){e$1.error(`CanvasElement "${p}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return s}u.get=e;async function i(p,s){let a=e(p),f=De.get(p);if(!a||!f){e$1.error(`CanvasElement "${p}" not found, did you forget to register it with the canvasComponentDecorator?`);return}try{return await f(a,s)}catch(d){e$1.error(`Error while getting CanvasElement instance "${p}"`,d);}}u.getInstance=i;async function n(p,s,a){let f=Le.get(p);if(!f){e$1.error(`CanvasElement "${p}" not found, did you forget to register it with the canvasComponentDecorator?`);return}try{await f(s,a);}catch(d){e$1.error(`Error while copying properties of CanvasElement "${p}"`,d);}}u.copyProperty=n;function r(){return Array.from(q.values())}u.values=r;function c(p){return q.has(p)}u.has=c;function o(){return Array.from(q.keys())}u.keys=o;})(me||={});var C=me;async function ee(t){let e=await C.getInstance(t.pixivnId,t);if(!e)throw new PixiError("unregistered_element",`The element ${t.pixivnId} could not be created`,"canvas",t);return e}function Te(t){return "memory"in t?t.memory:t instanceof B.Text?Pe(t):t instanceof B.Sprite?ve(t):R(t)}function it(t){let e=t.parent;return {width:t.width,height:t.height,isRenderGroup:t.isRenderGroup,blendMode:t.blendMode,tint:t.tint,alpha:t.alpha,angle:t.angle,renderable:t.renderable,rotation:t.rotation,scale:{x:t.scale.x,y:t.scale.y},pivot:{x:t.pivot.x,y:t.pivot.y},position:{x:t.position.x,y:t.position.y},skew:{x:t.skew.x,y:t.skew.y},visible:t.visible,x:t.x,y:t.y,boundsArea:t.boundsArea,cursor:t.cursor,eventMode:t.eventMode,interactive:t.interactive,interactiveChildren:t.interactiveChildren,hitArea:t.hitArea,index:e?.getChildIndex(t),parentLabel:e?.label,label:t.label}}function xe(t,e){return {url:t.source.label,alias:e===t.source.label?void 0:e}}function R(t,e){let i=rt(t,c$1),r=e?.childrenExport||false?t.children.sort((c,o)=>t.getChildIndex(c)-t.getChildIndex(o)).map(c=>Te(c)):[];return {pixivnId:i,elements:r,onEvents:Re(t),...it(t)}}function ve(t){let e=R(t),i=e.pixivnId??f,n="assetsAliases"in t&&Array.isArray(t.assetsAliases)?xe(t.texture,t.assetsAliases[0]):"textureAlias"in t?xe(t.texture,t.textureAlias):xe(t.texture);return {...e,pixivnId:i,textureData:n,anchor:{x:t.anchor.x,y:t.anchor.y},roundPixels:t.roundPixels}}function Pe(t){let e=R(t),i=e.pixivnId??g$1;return {...e,pixivnId:i,anchor:{x:t.anchor.x,y:t.anchor.y},text:t.text,resolution:t.resolution,style:at(t.style),roundPixels:t.roundPixels}}function rt(t,e){return Object.hasOwn(t,"pixivnId")?t.pixivnId:e}function te(t){switch(t.type){case "linear":return {type:"linear",colorStops:t.colorStops,end:{x:t.end.x,y:t.end.y},start:{x:t.start.x,y:t.start.y},textureSpace:t.textureSpace,wrapMode:t.texture.source.wrapMode,textureSize:t.texture.source.width/t.texture.source.height};case "radial":return {type:"radial",colorStops:t.colorStops,textureSpace:t.textureSpace,center:{x:t.center.x,y:t.center.y},innerRadius:t.innerRadius,outerCenter:{x:t.outerCenter.x,y:t.outerCenter.y},outerRadius:t.outerRadius,rotation:t.rotation,scale:t.scale,wrapMode:t.texture.source.wrapMode,textureSize:t.texture.source.width/t.texture.source.height}}}function nt(t){if(t!=null){{if(typeof t=="number")return t;if(typeof t=="string"||Array.isArray(t))return t;if(t instanceof B.FillGradient)return te(t);if(typeof t=="object"&&"fill"in t&&typeof t.fill!="function"&&t.fill){if(!(t.fill instanceof B.FillPattern))return te(t.fill)}}e$1.warn("Unsupported property type for Text.style.fill.",t);}}function st(t){if(typeof t=="number")return t;if(typeof t=="string")return t;if(Array.isArray(t))return t;if(t instanceof B.Color)return t.toNumber();e$1.warn("Unsupported color type.",t);}function ot(t){if(t!=null){{if(typeof t=="number")return t;if(typeof t=="string"||Array.isArray(t))return t;if(t instanceof B.FillGradient)return te(t);if(typeof t=="object"&&"alignment"in t)return {alignment:t.alignment,alpha:t.alpha,color:st(t.color),join:t.join,miterLimit:t.miterLimit,width:t.width,cap:t.cap,pixelLine:t.pixelLine,textureSpace:t.textureSpace};if(typeof t=="object"&&"fill"in t&&typeof t.fill!="function"&&t.fill){if(!(t.fill instanceof B.FillPattern))return te(t.fill)}}e$1.warn("Unsupported property type for Text.style.stroke.",t);}}function at(t){return {align:t.align,breakWords:t.breakWords,dropShadow:t.dropShadow,fill:nt(t.fill),fontFamily:t.fontFamily,fontSize:t.fontSize,fontStyle:t.fontStyle,fontVariant:t.fontVariant,fontWeight:t.fontWeight,leading:t.leading,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,padding:t.padding,stroke:ot(t.stroke),textBaseline:t.textBaseline,trim:t.trim,whiteSpace:t.whiteSpace,wordWrap:t.wordWrap,wordWrapWidth:t.wordWrapWidth}}var He=c(a(),1);var ie=class{constructor(e,i){this.alias=this.constructor.prototype.id;let{duration:n,priority:r,id:c=this.generateTickerId(this.alias,i),canvasElementAliases:o=[]}=i||{};this.args=e,this.duration=n,this.priority=r,this.id=c,this.canvasElementAliases=o;}alias;id;args;duration;priority;ticker=new B.Ticker;canvasElementAliases=[];generateTickerId(...e){try{return (0,He.default)(JSON.stringify(e)).toString()+"_"+Math.random().toString(36).substring(7)}catch(i){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${i}`)}}fnValue;complete(e){this.stop();}stop(){let e=this.fnValue;if(!e){e$1.warn("TickerBase.stop() called without fnValue set. This may cause issues.");return}this.ticker.remove(e,null);}start(){let e=this.id,i=()=>this.fn(this.ticker,this.args,this.canvasElementAliases,e);this.fnValue=i,this.ticker.add(i,null,this.priority),this.ticker.start();}pause(){this.ticker.stop();}play(){this.ticker.start();}get paused(){return !this.ticker.started}};var D=new d({cacheSize:5});function pt(t){return function(e){Ie.add(e,t);}}var Ie;(o=>{function t(u,p){p||(p=u.name),D.get(p)&&e$1.info(`Ticker "${p}" already exists, it will be overwritten`),u.prototype.id=p,D.set(p,u);}o.add=t;function e(u){try{let p=D.get(u);if(!p){e$1.error(`Event "${u}" not found, did you forget to register it with the tickerDecorator?`);return}return p}catch(p){e$1.error(`Error while getting Event "${u}"`,p);return}}o.get=e;function i(u,p,s){try{let a=D.get(u);if(!a){e$1.error(`Ticker "${u}" not found, did you forget to register it with the tickerDecorator?`);return}return new a(p,s)}catch(a){e$1.error(`Error while getting Ticker "${u}"`,a);return}}o.getInstance=i;function n(){return Array.from(D.values())}o.values=n;function r(u){return D.has(u)}o.has=r;function c(){return Array.from(D.keys())}o.keys=c;})(Ie||={});var L=Ie;var ze="aliasToRemoveAfter";var U=class{tickersPausedByGameLayerRender=[];get app(){return g.app}get gameLayer(){return g.gameLayer}get isInitialized(){return g._isInitialized}get width(){return g.canvasWidth}get height(){return g.canvasHeight}set width(e){g.canvasWidth=e;}set height(e){g.canvasHeight=e;}get screen(){return this.app.screen}async init(e,i,n){return await g.init(e,i,n)}get children(){return g.gameLayer.children}async copyCanvasElementProperty(e,i,n={}){let r=["isRenderGroup","scale","visible","boundsArea","text","resolution","style","height","width"],{ignoreProperties:c=p=>p}=n;if(typeof i=="string"){let p=this.find(i);if(p)i=p;else {e$1.error(`Canvas element ${i} not found`);return}}if(typeof e=="string"){let p=this.find(e);if(p)e=p;else {e$1.error(`Canvas element ${e} not found`);return}}e instanceof B.Container&&(e=e.memory);let o=c(r),u={...e};o.forEach(p=>{p in u&&delete u[p];}),await C.copyProperty(i.pixivnId,i,u);}add(e,i,n={}){if(e===b){e$1.error(`The alias ${b} is reserved`);return}let r=this.find(e),c=n?.ignoreOldStyle;r&&!c&&this.copyCanvasElementProperty(r,i);let{zIndex:o=r?.parent?.getChildIndex(r)}=n;r&&!this.canvasElementIsOnCanvas(r)?e$1.error(`The canvas element ${e} exist in the memory but it is not on the canvas, so the zIndex is not set`):r&&this.remove(e,{ignoreTickers:true}),o!==void 0?(i.label=e,this.gameLayer.addChildAt(i,o)):(i.label=e,this.gameLayer.addChild(i));}remove(e,i={}){if(e===b){e$1.error(`The alias ${b} is reserved`);return}let n=i.ignoreTickers;typeof e=="string"&&(e=[e]),e.forEach(r=>{this.gameLayer.getChildrenByLabel(r).forEach(c=>{this.gameLayer.removeChild(c),!n&&this.unlinkComponentFromTicker(r);});});}find(e){if(e===b)return this.gameLayer;let i=this.gameLayer.getChildByLabel(e);if(i)return i}canvasElementIsOnCanvas(e){return this.gameLayer.children.includes(e)}removeAll(){this.gameLayer.removeChildren();}editAlias(e,i,n={}){let r=this.find(e);r&&(r.label=i),!n.ignoreTickers&&this.transferTickers(e,i,"move");}get currentTickers(){return g._currentTickers}get currentTickersSteps(){return g._currentTickersSequence}findTicker(e){let i=g._currentTickers.get(e);if(i)return i.ticker}addTicker(e,i){let n=i.id,r=i.alias;if(typeof e=="string"&&(e=[e]),i.canvasElementAliases=e,!L.has(r)){e$1.error(`Ticker ${r} not found`);return}let c={ticker:i};if(g._currentTickers.set(n,c),c.ticker.start(),i.duration){let o=setTimeout(()=>{g.removeTickerTimeoutInfo(o),g._currentTickersTimeouts.get(o.toString())&&c.ticker.complete({ignoreTickerSteps:true});},i.duration*1e3);g.addTickerTimeoutInfo(e,r,o.toString(),true);}return n}addTickersSequence(e,i,n=0){if(i.length===0){e$1.warn("The steps of the tickers is empty");return}g._currentTickersSequence.has(e)||g._currentTickersSequence.set(e,new Map);let r={currentStepNumber:n,steps:i.map(o=>o===a$1||Object.hasOwn(o,"type")&&o.type==="pause"?o:{ticker:o.alias,args:f$1(o.args),duration:o.duration})},c=g.generateTickerId(r);return g._currentTickersSequence.get(e)?.set(c,r),this.runTickersSequence(e,c),c}runTickersSequence(e,i){let n=g._currentTickersSequence.get(e);if(!n?.has(i))return;let r=n.get(i).steps[n.get(i).currentStepNumber];if(r===a$1&&(r=n.get(i).steps[0],n.get(i).currentStepNumber=0,r===a$1)){e$1.error("TikersSteps has a RepeatType in the first step");return}if(Object.hasOwn(r,"type")&&r.type==="pause"){let s=setTimeout(()=>{let a=g._currentTickersTimeouts.get(s.toString());a&&a.aliases.forEach(f=>{this.nextTickerStep(f,i);}),g.removeTickerTimeoutInfo(s);},r.duration*1e3);g.addTickerTimeoutInfo(e,"steps",s.toString(),false);return}let c=L.getInstance(r.ticker,r.args,{canvasElementAliases:[e],duration:r.duration,priority:r.priority});if(!c){e$1.error(`Ticker ${r.ticker} not found`);return}let o=c.alias,u=c.id;c.canvasElementAliases=[e];let p={createdByTicketSteps:{canvasElementAlias:e,id:i},ticker:c};if(g._currentTickers.set(u,p),p.ticker.start(),c.duration){let s=setTimeout(()=>{let a=g._currentTickersTimeouts.get(s.toString());a&&(p.ticker.complete({ignoreTickerSteps:true}),a.aliases.forEach(f=>{this.nextTickerStep(f,i);})),g.removeTickerTimeoutInfo(s);},c.duration*1e3);g.addTickerTimeoutInfo(e,o,s.toString(),false);}}nextTickerStep(e,i){let n=g._currentTickersSequence.get(e);if(n?.has(i)){let r=n.get(i);r.currentStepNumber+1<r.steps.length?(r.currentStepNumber++,n.set(i,r),this.runTickersSequence(e,i)):i&&n.has(i)&&(n.delete(i),g._currentTickers.forEach((c,o)=>{c.createdByTicketSteps?.canvasElementAlias===e&&c.createdByTicketSteps.id===i&&this.removeTicker(o);}));}}onTickerComplete(e,i){let{stopTicker:n=true,aliasToRemoveAfter:r,tickerAliasToResume:c,tickerIdToResume:o}=i,u=g._currentTickers.get(e),p=i.ignoreTickerSteps||false;this.remove(r),c.forEach(s=>{this.resumeTicker({canvasAlias:s});}),this.resumeTicker({id:o}),u&&(this.removeTicker(e,{stopTicker:n}),!p&&u.ticker.duration===void 0&&u.createdByTicketSteps&&this.nextTickerStep(u.createdByTicketSteps.canvasElementAlias,u.createdByTicketSteps.id));}unlinkComponentFromTicker(e,i){if(typeof e=="string"&&(e=[e]),!i){e.forEach(r=>{g._currentTickers.forEach((c,o)=>{c.ticker.canvasElementAliases.includes(r)&&(c.ticker.canvasElementAliases.length===1?this.removeTicker(o):c.ticker.canvasElementAliases=c.ticker.canvasElementAliases.filter(u=>u!==r));}),g._currentTickersSequence.has(r)&&g._currentTickersSequence.delete(r),g.removeTickerTimeoutsByAlias(r,false);});return}let n;typeof i=="string"?n=i:n=i.prototype.id,e.forEach(r=>{let c=g._currentTickersSequence.get(r);c&&c.forEach((o,u)=>{o.steps.find(p=>typeof p=="object"&&"ticker"in p&&p.ticker===n)&&c.delete(u);});}),g._currentTickers.forEach(r=>{r.ticker.alias===n&&(r.ticker.canvasElementAliases=r.ticker.canvasElementAliases.filter(c=>!e.includes(c)));}),g._currentTickersTimeouts.forEach(r=>{r.ticker===n&&r.canBeDeletedBeforeEnd&&(r.aliases=r.aliases.filter(c=>!e.includes(c)));}),this.removeTickersWithoutAssociatedCanvasElement();}removeTickersWithoutAssociatedCanvasElement(){g._currentTickers.forEach(e=>{e.ticker.canvasElementAliases=e.ticker.canvasElementAliases.filter(i=>this.find(i)),e.ticker.canvasElementAliases.length===0&&e.ticker.complete({ignoreTickerSteps:true});}),g._currentTickersSequence.forEach((e,i)=>{e===void 0&&g._currentTickersSequence.delete(i);}),Array.from(g._currentTickersTimeouts.keys()).forEach(e=>{let i=g._currentTickersTimeouts.get(e);i&&i.aliases.length===0&&g.removeTickerTimeout(e);});}removeAllTickers(){this.tickersPausedByGameLayerRender=[],g._currentTickersSequence.clear(),Array.from(g._currentTickers.keys()).forEach(e=>{this.removeTicker(e);}),g._currentTickers.clear(),Array.from(g._currentTickersTimeouts.keys()).forEach(e=>{g.removeTickerTimeout(e);}),g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.stepAlias.length=0;}removeTicker(e,i={stopTicker:true}){typeof e=="string"&&(e=[e]),e.forEach(n=>{let r=g._currentTickers.get(n);r&&(i.stopTicker&&r.ticker.stop(),g._currentTickers.delete(n));});}pauseTicker(e){let i=[];if("canvasAlias"in e){let{canvasAlias:n,tickerIdsExcluded:r=[]}=e;g._currentTickers.forEach((c,o)=>{c.ticker.canvasElementAliases.includes(n)&&!r.includes(c.ticker.alias)&&c.ticker.paused===false&&(c.ticker.pause(),i.push(o));});}else if("id"in e){let{id:n}=e;typeof n=="string"&&(n=[n]),[...new Set(n)].forEach(r=>{let c=g._currentTickers.get(r);c?c.ticker.paused===false&&(c.ticker.pause(),i.push(r)):e$1.error(`Ticker with id ${r} not found`);});}return i}resumeTicker(e){if("canvasAlias"in e){let{canvasAlias:i}=e;g._currentTickers.forEach(n=>{n.ticker.canvasElementAliases.includes(i)&&n.ticker.play();});}else if("id"in e){let{id:i}=e;typeof i=="string"&&(i=[i]),[...new Set(i)].forEach(n=>{let r=g._currentTickers.get(n);r?r.ticker.play():e$1.error(`Ticker with id ${n} not found`);});}}isTickerPaused(e,i){return false}pause(){this.gameLayer.renderable!==false&&(this.gameLayer.renderable=false,this.tickersPausedByGameLayerRender=this.pauseTicker({id:Array.from(g._currentTickers.keys())}));}resume(){if(this.gameLayer.renderable===true)return;this.gameLayer.renderable=true;let e=this.tickersPausedByGameLayerRender.filter(i=>g._currentTickers.has(i));e.length>0&&this.resumeTicker({id:e}),this.tickersPausedByGameLayerRender=[];}transferTickers(e,i,n="move"){let r=g._currentTickersSequence.get(e);if(r){let o=new Map(Array.from(r.entries()).map(([u,p])=>[u,f$1(p)]));g._currentTickersSequence.set(i,o);}g._currentTickers.forEach((o,u)=>{if(o.createdByTicketSteps?.canvasElementAlias===e&&this.removeTicker(u),o.ticker.canvasElementAliases.includes(e)){let p=L.getInstance(o.ticker.alias,f$1(o.ticker.args),{duration:o.ticker.duration,priority:o.ticker.priority,canvasElementAliases:[i]});if(p?(this.addTicker(i,p),o.ticker.paused&&p.pause()):e$1.error(`Ticker ${o.ticker.alias} not found`),n==="move"&&(o.ticker.canvasElementAliases=o.ticker.canvasElementAliases.filter(s=>s!==e)),Object.hasOwn(o.ticker.args,ze)){let s=o.ticker.args.aliasToRemoveAfter;typeof s=="string"&&(s=[s]),Array.isArray(s)&&(n==="move"?o.ticker.args.aliasToRemoveAfter=s.map(a=>a===e?i:a):n==="duplicate"&&s.find(a=>a===e)&&(o.ticker.args.aliasToRemoveAfter=[...s,i]));}}}),g._currentTickersTimeouts.forEach(o=>{o.aliases.includes(e)&&(n==="move"?o.aliases=o.aliases.map(u=>u===e?i:u):n==="duplicate"&&o.aliases.find(u=>u===e)&&o.aliases.push(i));});let c=g._currentTickersSequence.get(i);if(c&&c.forEach((o,u)=>{this.runTickersSequence(i,u);}),n==="duplicate"){let o=g._currentTickersSequence.get(e);o&&o.forEach((u,p)=>{this.runTickersSequence(e,p);});}}completeTickerOnStepEnd(e){e.alias?g._tickersToCompleteOnStepEnd.stepAlias.push({id:e.id,alias:e.alias}):g._tickersToCompleteOnStepEnd.tikersIds.push({id:e.id});}async forceCompletionOfTicker(e,i){if(i){let n=g._currentTickersSequence.get(i),r=n?.get(e);if(n&&r)if(r.steps.includes(a$1))e$1.error(`The ticker alias: ${i} id: ${e} contains a RepeatType, so it can't be forced to complete`,r);else {let c=r.steps.map(o=>{if(typeof o=="object"&&"ticker"in o){let u=L.getInstance(o.ticker,o.args,{duration:o.duration,canvasElementAliases:[i],priority:o.priority});if(u)return u.complete()}return Promise.resolve()});await Promise.all(c);}}else {let n=g._currentTickers.get(e);n&&await n.ticker.complete();}}animate(e,i,n,r){return GameUnifier.animate(e,i,n,r)}addLayer(e,i){if(e===b){e$1.error(`The alias ${b} is reserved`);return}return i.label=e,g.app.stage.addChild(i)}getLayer(e){return g.app.stage.getChildByLabel(e)}removeLayer(e){let i=g.app.stage.getChildByLabel(e);i&&g.app.stage.removeChild(i);}addHtmlLayer(e,i,n){return g.addHtmlLayer(e,i,n)}removeHtmlLayer(e){return g.removeHtmlLayer(e)}getHtmlLayer(e){return g.getHtmlLayer(e)}async extractImage(){let e=this.gameLayer.renderable===false;e&&this.resume();let i;try{i=this.app.renderer.extract.image(this.app.stage);}finally{e&&this.pause();}return (await i).src}clear(){this.removeAllTickers(),this.removeAll();}export(){let e=this.gameLayer.renderable===false;e&&this.resume();try{let i={};return this.children.forEach(n=>{n.label&&(i[n.label]=Te(n));}),{tickers:f$1(g.currentTickersWithoutCreatedBySteps),tickersSteps:f$1(g.currentTickersSequence),elements:f$1(i),stage:f$1(R(this.gameLayer)),elementAliasesOrder:f$1(g.childrenAliasesOrder),tickersToCompleteOnStepEnd:f$1(g._tickersToCompleteOnStepEnd)}}finally{e&&this.pause();}}async restore(e){this.clear();try{if(Object.hasOwn(e,"elements")&&Object.hasOwn(e,"elementAliasesOrder")){let i=e.elementAliasesOrder,n={},r=Object.entries(e.elements).map(async([c,o])=>{n[c]=await ee(o);});await Promise.all(r),i.forEach(c=>{let o=n[c];o&&this.add(c,o);});}else {e$1.error("The data does not have the properties elementAliasesOrder and elements");return}if(Object.hasOwn(e,"stage")&&Object.hasOwn(e,"stage")?S(this.gameLayer,e.stage,{ignoreScale:!0}):e$1.error("The data does not have the properties stage"),Object.hasOwn(e,"tickers")){let i=e.tickers;Object.entries(i).forEach(([n,r])=>{let c=r.canvasElementAliases;if(c.length!==0){let o=L.getInstance(r.id,r.args,{duration:r.duration,priority:r.priority,id:n,canvasElementAliases:c});o?(o.canvasElementAliases=c,this.addTicker(c,o),r.paused&&o.pause()):e$1.error(`Ticker ${r.id} not found`);}});}if(Object.hasOwn(e,"tickersSteps")){let i=e.tickersSteps;Object.entries(i).forEach(([n,r])=>{g._currentTickersSequence.set(n,new Map(Object.entries(r))),Object.keys(r).forEach(c=>{this.runTickersSequence(n,c);});});}if(Object.hasOwn(e,"tickersToCompleteOnStepEnd")){let i=e.tickersToCompleteOnStepEnd,n=i.tikersIds,r=i.stepAlias.map(c=>({id:c.id,alias:c.alias}));g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.tikersIds.push(...n),g._tickersToCompleteOnStepEnd.stepAlias.length=0,g._tickersToCompleteOnStepEnd.stepAlias.push(...r);}}catch(i){e$1.error("Error importing data",i);}}};var I=class t{static init(e){t._getScreen=e.getScreen;}static _getScreen;static get screen(){return t._getScreen()}};var h;(p=>{function t(s,a,f,d,y,x=0){return y?s==="width"?a*(I.screen.width-f)+f-d-x*f:a*(I.screen.height-f)+f-d-x*f:s==="width"?a*(I.screen.width-f)+d+x*f:a*(I.screen.height-f)+d+x*f}p.calculatePositionByAlign=t;function e(s,a,f,d,y,x=0){return y?s==="width"?(a-f+d+x*f)/(I.screen.width-f):(a-f+d+x*f)/(I.screen.height-f):s==="width"?(a-d-x*f)/(I.screen.width-f):(a-d-x*f)/(I.screen.height-f)}p.calculateAlignByPosition=e;function i(s,a){return s==="width"?a*I.screen.width:a*I.screen.height}p.calculatePositionByPercentagePosition=i;function n(s,a){return s==="width"?a/I.screen.width:a/I.screen.height}p.calculatePercentagePositionByPosition=n;function r(s,a){if(a=a%360,a<0&&(a+=360),a===0)return {x:s.x,y:s.y};if(a===90)return {x:-s.y,y:s.x};if(a===180)return {x:-s.x,y:-s.y};if(a===270)return {x:s.y,y:-s.x};if(a>0&&a<90){let f=a*Math.PI/180,d=Math.cos(f),y=Math.sin(f),x=s.x*d-s.y*y,T=s.x*y+s.y*d;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(a>90&&a<180){let f=(a-90)*Math.PI/180,d=Math.cos(f),y=Math.sin(f),x=-s.y*y-s.x*d,T=s.y*d-s.x*y;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(a>180&&a<270){let f=(a-180)*Math.PI/180,d=Math.cos(f),y=Math.sin(f),x=-s.x*d+s.y*y,T=-s.x*y-s.y*d;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(a>270&&a<360){let f=(a-270)*Math.PI/180,d=Math.cos(f),y=Math.sin(f),x=s.y*y-s.x*d,T=-s.y*d-s.x*y;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}return {x:0,y:0}}p.getSuperPoint=r;function c(s,a){if(a=a%360,a<0&&(a+=360),a===0)return {x:s.x,y:s.y};if(a===90)return {x:s.y,y:-s.x};if(a===180)return {x:-s.x,y:-s.y};if(a===270)return {x:-s.y,y:s.x};if(a>0&&a<90){let f=a*Math.PI/180,d=Math.cos(f),y=Math.sin(f);return {x:s.x*d+s.y*y,y:-s.x*y+s.y*d}}else if(a>90&&a<180){let f=(a-90)*Math.PI/180,d=Math.cos(f),y=Math.sin(f);return {x:s.y*d-s.x*y,y:-s.y*y-s.x*d}}else if(a>180&&a<270){let f=(a-180)*Math.PI/180,d=Math.cos(f),y=Math.sin(f);return {x:-s.x*d-s.y*y,y:s.x*y-s.y*d}}else if(a>270&&a<360){let f=(a-270)*Math.PI/180,d=Math.cos(f),y=Math.sin(f);return {x:-s.y*d+s.x*y,y:s.y*y+s.x*d}}return {x:0,y:0}}p.getPointBySuperPoint=c;function o(s){let a=s.width,f=s.height,d=s.angle%360;return d<0&&(d+=360),d===0||d===180?a:d===90||d===270?f:Math.abs(a*Math.cos(d*Math.PI/180))+Math.abs(f*Math.sin(d*Math.PI/180))}p.getSuperWidth=o;function u(s){let a=s.width,f=s.height,d=s.angle%360;return d<0&&(d+=360),d===0||d===180?f:d===90||d===270?a:Math.abs(f*Math.cos(d*Math.PI/180))+Math.abs(a*Math.sin(d*Math.PI/180))}p.getSuperHeight=u;})(h||={});async function F(t){if(t!=="EMPTY"){if(!t)throw e$1.error("Texture not found",t),new PixiError("unregistered_asset","Texture not found");if(B.Assets.cache.has(t)){let e=B.Assets.get(t);if(e)return e}return B.Assets.load(t).then(e=>{if(!e)throw e$1.error("Texture not found",t),new PixiError("unregistered_asset","Texture not found");if(!(e instanceof B.Texture))throw e$1.error("File is not a Texture",t),new PixiError("unregistered_asset","File is not a Texture");return e}).catch(e=>{throw e$1.error("Error loading file",e),new PixiError("unknown_element","Error loading file")})}}function A(t){return t&&(typeof t.align!="number"&&(t.xAlign!==void 0&&(t.align===void 0?(t.align={x:t.xAlign},delete t.xAlign):(t.align.x=t.xAlign,delete t.xAlign)),t.yAlign!==void 0&&(t.align===void 0?(t.align={y:t.yAlign},delete t.yAlign):(t.align.y=t.yAlign,delete t.yAlign))),typeof t.percentagePosition!="number"&&(t.percentageX!==void 0&&(t.percentagePosition===void 0?(t.percentagePosition={x:t.percentageX},delete t.percentageX):(t.percentagePosition.x=t.percentageX,delete t.percentageX)),t.percentageY!==void 0&&(t.percentagePosition===void 0?(t.percentagePosition={y:t.percentageY},delete t.percentageY):(t.percentagePosition.y=t.percentageY,delete t.percentageY))),t)}var H=class t extends B.Sprite{constructor(e){if(e instanceof B.Texture)super(e);else {let{align:i,percentagePosition:n,...r}=A(e)||{};super(r),i&&(this.align=i),n&&(this.percentagePosition=n);}this.pixivnId=this.constructor.prototype.pixivnId||f;}pixivnId=f;get memory(){return {...ve(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){return await oe(this,e)}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}}set xAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)}set yAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageX(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}set percentageY(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};C.add(H,{name:f,copyProperty:async(t,e)=>{await oe(t,e,{ignoreTexture:true});}});async function oe(t,e,i){e=A(e);let n=i?.ignoreTexture||false;if(await S(t,e),!n){let c;if("textureData"in e&&e.textureData&&(c=e.textureData),c&&c.url!=="EMPTY"){let o=c.url;c.alias&&B.Assets.resolver.hasKey(c.alias)&&(o=c.alias);try{let u=await F(o);u&&(t.texture=u);}catch(u){e$1.error("Error in Sprite.setMemorySprite() while loading texture"),u=new PixiError("unregistered_asset",`Error loading image ${o}`,"canvas",e),GameUnifier.runOnError(u,{});}}}let r=i?.half;r&&await r(),"anchor"in e&&e.anchor!==void 0&&(typeof e.anchor=="number"?t.anchor.set(e.anchor,e.anchor):t.anchor.set(e.anchor.x,e.anchor.y)),"align"in e&&e.align!==void 0&&(t.align=e.align),"percentagePosition"in e&&e.percentagePosition!==void 0&&(t.percentagePosition=e.percentagePosition),"roundPixels"in e&&e.roundPixels!==void 0&&(t.roundPixels=e.roundPixels);}var v=class t extends H{_textureAlias;get textureAlias(){return this._textureAlias?this._textureAlias:this.texture.source.label}pixivnId=e;constructor(e,i){super(e),i&&(this._textureAlias=i);}get memory(){return {...super.memory,pixivnId:this.pixivnId,loadIsStarted:this._loadIsStarted}}async setMemory(e){let i;"textureData"in e&&e.textureData&&(i=e.textureData),"assetsData"in e&&Array.isArray(e.assetsData)&&e.assetsData.length>0&&(i=e.assetsData[0]),i&&i.alias&&(this._textureAlias=i.alias),await ae(this,e),this.reloadPosition();}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){return this._loadIsStarted=true,F(this.textureAlias).then(e=>{this._loadIsStarted=false,e&&(this.texture=e);}).catch(e=>{this._loadIsStarted=false,e$1.error("Error into ImageSprite.load()"),e=new PixiError("unregistered_asset",`Error loading image ${this.textureAlias}`,"canvas",{...this.memory,label:this.textureAlias},this),GameUnifier.runOnError(e,{});})}set texture(e){super.texture=e,this.reloadPosition();}get texture(){return super.texture}get haveEmptyTexture(){return this.texture._source.label==="EMPTY"}};C.add(v,{name:e,copyProperty:async(t,e)=>{await ae(t,e,{ignoreTexture:true});}});async function ae(t,e,i){return await oe(t,e,{half:async()=>{"loadIsStarted"in e&&e.loadIsStarted&&await t.load();},ignoreTexture:i?.ignoreTexture})}var M=class t extends v{constructor(e,i){if(e instanceof B.Texture){super(e,i);return}let{loop:n,paused:r,currentTime:c,...o}=e||{};super(o,i),n&&(this.loop=n),r&&(this.paused=r),c&&(this.currentTime=c);}pixivnId=h$1;get memory(){return {...super.memory,pixivnId:this.pixivnId,loop:this.loop,paused:this._paused,currentTime:this.currentTime}}async setMemory(e){await Ye(this,e),this.reloadPosition();}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}async load(){await super.load(),this.loop=this._looop,this.currentTime=this._currentTime,this.paused=this._paused;}_looop=false;get loop(){return this.texture?.source?.resource?.loop||false}set loop(e){this._looop=e,this.texture?.source?.resource&&(this.texture.source.resource.loop=e);}_paused=false;get paused(){return this.texture?.source?.resource?.paused||false}set paused(e){e?this.pause():this.play();}pause(){this._paused=true,this.texture?.source?.resource&&this.texture.source.resource.pause();}play(){this._paused=false,this.texture?.source?.resource?.play&&typeof this.texture.source.resource.play=="function"&&this.texture.source.resource.play();}_currentTime=0;get currentTime(){return this.texture?.source?.resource?.currentTime||0}set currentTime(e){let i=this.duration;i&&e>=i&&(e=0),this._currentTime=e,this.texture?.source?.resource&&(this.texture.source.resource.currentTime=e);}restart(){this.currentTime=0;}get duration(){if(this.texture?.source?.resource)return this.texture.source.resource.duration||0}};C.add(M,{name:h$1,getInstance:async(t,e)=>{let i;"textureData"in e&&e.textureData&&(i=e.textureData);let n=new t(void 0,i?.alias);return await n.setMemory(e),n},copyProperty:async(t,e)=>{await Ye(t,e,{ignoreTexture:true});}});async function Ye(t,e,i){await ae(t,e,{ignoreTexture:i?.ignoreTexture}),"loop"in e&&e.loop!==void 0&&(t.loop=e.loop),"currentTime"in e&&e.currentTime!==void 0&&(t.currentTime=e.currentTime),"paused"in e&&e.paused!==void 0&&(t.paused=e.paused);}var _=class extends Container{constructor(e){let{anchor:i,align:n,percentagePosition:r,...c}=A(e)||{};super(c),this.pixivnId=this.constructor.prototype.pixivnId||c$1,i&&(this.anchor=i),n&&(this.align=n),r&&(this.percentagePosition=r);}pixivnId=c$1;get memory(){return {...R(this,{childrenExport:true}),anchor:this._anchor?this.anchor:void 0,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){await this.importChildren(e),await S(this,e),this.reloadAnchor(),this.reloadPosition();}async importChildren(e){for(let i=0;i<e.elements.length;i++){let n=e.elements[i],r=await ee(n);this.addChild(r);}}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_anchor;get anchor(){let e=super.pivot.x/this.width,i=super.pivot.y/this.height;return {x:e,y:i}}set anchor(e){typeof e=="number"?this._anchor={x:e,y:e}:this._anchor=e,this.reloadAnchor();}reloadAnchor(){this._anchor&&super.pivot.set(this._anchor.x*this.width,this._anchor.y*this.height);}get pivot(){return super.pivot}set pivot(e){this._anchor=void 0,super.pivot=e;}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0)}}set xAlign(e){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0)}set yAlign(e){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}set percentageX(e){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageY(e){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};C.add(_,{name:c$1,copyProperty:async(t,e)=>await S(t,e)});var Tt=new Set(["mp4","webm","ogg","ogv","avi","mov","wmv","flv","mkv","m4v","3gp","3g2","ts","mts"]);function K(t){let e=B.Assets.cache.has(t)?B.Assets.get(t):null;return e instanceof B.Texture&&(t=e.source?.label||t),vt(t)}function vt(t){let e=t.split(".").pop()?.toLowerCase();return e!==void 0&&Tt.has(e)}var P=class extends _{constructor(e,i){let{anchor:n,align:r,percentagePosition:c,...o}=A(e)||{};super(o),i&&i.forEach(u=>{K(u)?this.addChild(new M(void 0,u)):this.addChild(new v(void 0,u));}),n&&(this.anchor=n),r&&(this.align=r),c&&(this.percentagePosition=c);}get memory(){return {...super.memory,pixivnId:d$1,loadIsStarted:this._loadIsStarted}}async setMemory(e){await this.importChildren(e),await We(this,e),this.reloadAnchor(),this.reloadPosition();}pixivnId=d$1;_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){this._loadIsStarted=true;let e=this.children.map(i=>i.load());return Promise.all(e).then(()=>{this._loadIsStarted=false,this.reloadAnchor(),this.reloadPosition();}).catch(i=>{this._loadIsStarted=false,e$1.error("Error into ImageContainer.load()",i);})}get texture(){return this.children.length>0?this.children[0].texture:new B.Texture}get haveEmptyTexture(){return this.children.some(e=>e.texture._source.label==="EMPTY")}};C.add(P,{name:d$1,copyProperty:async(t,e)=>await We(t,e)});async function We(t,e){e=A(e)||{},S(t,e,{end:async()=>{"loadIsStarted"in e&&e.loadIsStarted&&await t.load();}});}var ce=class{constructor(...e){}get memory(){throw new PixiError("not_implemented","The method CanvasBaseItem.memory must be overridden")}setMemory(e){throw new PixiError("not_implemented","The method CanvasBaseItem.setMemory must be overridden")}pixivnId="canvas_element_id_not_set"};var z=class extends B.Text{constructor(e){let{align:i,percentagePosition:n,...r}=A(e)||{};super(r),this.pixivnId=this.constructor.prototype.pixivnId||g$1,i&&(this.align=i),n&&(this.percentagePosition=n);}pixivnId=g$1;get memory(){return {...Pe(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){await Ct(this,e),this.reloadPosition();}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}}set xAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)}set yAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageX(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}set percentageY(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};C.add(z,{name:g$1});async function Ct(t,e){"text"in e&&e.text!==void 0&&(t.text=e.text),await S(t,e,{end:()=>{"style"in e&&e.style!==void 0&&(t.style=e.style);}}),"anchor"in e&&e.anchor!==void 0&&(typeof e.anchor=="number"?t.anchor.set(e.anchor,e.anchor):t.anchor.set(e.anchor.x,e.anchor.y)),"resolution"in e&&e.resolution!==void 0&&(t.resolution=e.resolution),"anchor"in e&&e.anchor!==void 0&&(typeof e.anchor=="number"?t.anchor.set(e.anchor,e.anchor):t.anchor.set(e.anchor.x,e.anchor.y)),"align"in e&&e.align!==void 0&&(t.align=e.align),"percentagePosition"in e&&e.percentagePosition!==void 0&&(t.percentagePosition=e.percentagePosition),"roundPixels"in e&&e.roundPixels!==void 0&&(t.roundPixels=e.roundPixels);}async function kt(t,e={},i){let n=l.find(t);if(!n){e$1.error(`The element with the alias ${t} does not exist. So the shake effect can't be applied.`);return}let r={x:n.position.x,y:n.position.y},{shakeType:c="horizontal",maxShockSize:o=10,shocksNumber:u=10,...p}=e,s=u-1;if(s<2){e$1.error("The number of shocks must be at least 3.");return}let a=Math.floor(s/2),f=Math.ceil(s/2),d=[];for(let T=0;T<a;T++){let k=o*(T+1)/a;c==="horizontal"?T%2!==0?d.push(r.x+k):d.push(r.x-k):T%2!==0?d.push(r.y+k):d.push(r.y-k);}let y=a%2===0;for(let T=f;T>0;T--){let k=o*(T+1)/(f-1);c==="horizontal"?T%2===0&&!y||T%2!==0&&y?d.push(r.x-k):d.push(r.x+k):T%2===0&&!y||T%2!==0&&y?d.push(r.y-k):d.push(r.y+k);}let x;if(c==="horizontal"?(d.push(r.x),x=l.animate(t,{x:d},p,i)):(d.push(r.y),x=l.animate(t,{y:d},p,i)),x)return [x]}function de(t,e,i){let n={...l.find(t)?.memory,...i},r=new P(i,e);return n&&l.copyCanvasElementProperty(n,r),l.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function St(t,e,i){let n={...l.find(t)?.memory,...i},r=new P(i,e);return r.label=t,await r.load(),n&&l.copyCanvasElementProperty(n,r),l.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function pe(t,e$1,i){if(!e$1)if(B.Assets.resolver.hasKey(t))e$1=t;else throw new PixiError("unregistered_asset",`The image ${t} does not exist in the cache.`,"canvas",{pixivnId:e,...i,label:t});let n={...l.find(t)?.memory,...i},r=new v(i,e$1);return n&&l.copyCanvasElementProperty(n,r),l.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function bt(t,e$1,i){if(!e$1)if(B.Assets.resolver.hasKey(t))e$1=t;else throw new PixiError("unregistered_asset",`The image ${t} does not exist in the cache.`,"canvas",{pixivnId:e,...i,label:t});let n={...l.find(t)?.memory,...i},r=new v(i,e$1);return r.label=t,await r.load(),n&&l.copyCanvasElementProperty(n,r),l.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function ue(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The video ${t} does not exist in the cache.`,"canvas",{pixivnId:h$1,...i,label:t});let n={...l.find(t)?.memory,...i},r=new M(i,e);return n&&l.copyCanvasElementProperty(n,r),l.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function At(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The video ${t} does not exist in the cache.`,"canvas",{pixivnId:h$1,...i,label:t});let n={...l.find(t)?.memory,...i},r=new M(i,e);return r.label=t,await r.load(),n&&l.copyCanvasElementProperty(n,r),l.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function ke(t){switch(t.type){case "align":return {xAlign:t.x,yAlign:t.y};case "percentage":return {percentageX:t.x,percentageY:t.y};default:return {x:t.x,y:t.y}}}function Z(t,e,i){if(typeof e=="string")return K(e)?ue(t,e,i):pe(t,e,i);if(Array.isArray(e))return de(t,e,i);if(typeof e=="object"&&"value"in e&&"options"in e){if(typeof e.value=="string")return K(e.value)?ue(t,e.value,{...e.options,zIndex:i.zIndex}):pe(t,e.value,{...e.options,zIndex:i.zIndex});if(Array.isArray(e.value))return de(t,e.value,{...e.options,zIndex:i.zIndex})}return l.add(t,e,i),e}async function Ge(t,e,i={},n){let{forceCompleteBeforeNext:r=true}=i,{completeOnContinue:c=r,tickerIdToResume:o=[],...u}=i,p=[];e||(e=t),typeof o=="string"&&(o=[o]);let s,a=l.find(t);if(a&&(s=`${t}_temp_disolve`,l.editAlias(t,s)),e=Z(t,e,{zIndex:a?a.parent?.getChildIndex(a):void 0}),a?.parent?.setChildIndex(a,a.parent.getChildIndex(a)-.1),s&&l.copyCanvasElementProperty(s,t),s&&l.transferTickers(s,t,"duplicate"),e.alpha=0,s){let d=fe(s,{...i,autoplay:false,completeOnContinue:c},n);d&&(p.push(...d),o.push(...d));}let f=l.animate(t,{alpha:1},{...u,tickerIdToResume:o,completeOnContinue:c},n);if(f&&p.push(f),(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),p.length>0)return p}function fe(t,e={},i){let{forceCompleteBeforeNext:n=true}=e,{completeOnContinue:r=n,aliasToRemoveAfter:c=[],...o}=e;typeof c=="string"&&(c=[c]),c.push(t);let u=l.animate(t,{alpha:0},{...o,aliasToRemoveAfter:c,completeOnContinue:r},i);if(u)return [u]}async function Et(t,e,i={},n){let{forceCompleteBeforeNext:r=true}=i,{completeOnContinue:c=r,aliasToRemoveAfter:o=[],...u}=i,p=[];e||(e=t),typeof o=="string"&&(o=[o]);let s=l.find(t);if(!s)return Ge(t,e,i,n);let a=`${t}_temp_fade`;l.editAlias(t,a),o.push(a),e=Z(t,e,{zIndex:s?s.parent?.getChildIndex(s):void 0}),s?.parent?.setChildIndex(s,s.parent.getChildIndex(s)-.1),a&&l.copyCanvasElementProperty(a,t),a&&l.transferTickers(a,t,"duplicate"),e.alpha=0;let f=l.animate(t,{alpha:1},{...u,aliasToRemoveAfter:o,completeOnContinue:c},n);if(f){let d=fe(a,{...i,tickerIdToResume:f,completeOnContinue:c},n);d&&p.push(...d),p.push(f),l.pauseTicker({id:f});}if((e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),p.length>0)return p}function Mt(t,e={},i){return fe(t,e,i)}async function _t(t,e,i={},n){let{forceCompleteBeforeNext:r=true}=i,{direction:c="right",completeOnContinue:o=r,tickerIdToResume:u=[],aliasToRemoveAfter:p=[],removeOldComponentWithMoveOut:s,...a}=i,f=[],d;e||(e=t),typeof u=="string"&&(u=[u]),typeof p=="string"&&(p=[p]);let y,x=l.find(t);if(x&&(y=`${t}_temp_movein`,l.editAlias(t,y),x instanceof v||x instanceof P?d=x.positionInfo:d={x:x.x,y:x.y,type:"pixel"}),e=Z(t,e,{zIndex:x?x.parent?.getChildIndex(x):void 0}),x?.parent?.setChildIndex(x,x.parent.getChildIndex(x)-.1),y&&l.copyCanvasElementProperty(y,t),y&&l.transferTickers(y,t,"move"),d||(e instanceof v||e instanceof P?d=e.positionInfo:d={x:e.x,y:e.y,type:"pixel"}),y)if(s){let V=Se(y,{...i,autoplay:false,completeOnContinue:o},n);V&&(f.push(...V),u.push(...V));}else p.push(y);switch((e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),c){case "up":e.y=l.height+e.height;break;case "down":e.y=-e.height;break;case "left":e.x=l.width+e.width;break;case "right":e.x=-e.width;break}let T=l.pauseTicker({canvasAlias:t});u.push(...T);let k=l.animate(t,ke(d),{...a,tickerIdToResume:u,aliasToRemoveAfter:p,completeOnContinue:o},n);if(k&&f.push(k),f.length>0)return f}function Se(t,e={},i){let{forceCompleteBeforeNext:n=true}=e,{direction:r="right",completeOnContinue:c=n,aliasToRemoveAfter:o=[],...u}=e;typeof o=="string"&&(o=[o]),o.push(t);let p=l.find(t);if(!p){e$1.warn(`The canvas component "${t}" is not found.`);return}let s={x:p.x,y:p.y};switch(r){case "up":s.y=-p.height;break;case "down":s.y=l.height+p.height;break;case "left":s.x=-p.width;break;case "right":s.x=l.width+p.width;break}l.pauseTicker({canvasAlias:t});let a=l.animate(t,s,{...u,aliasToRemoveAfter:o,completeOnContinue:c},i);if(a)return [a]}async function wt(t,e,i={},n){let{forceCompleteBeforeNext:r=true}=i,{direction:c="right",completeOnContinue:o=r,tickerIdToResume:u=[],aliasToRemoveAfter:p=[],...s}=i,a=[],f;e||(e=t),typeof u=="string"&&(u=[u]),typeof p=="string"&&(p=[p]);let d,y=l.find(t);y&&(d=`${t}_temp_zoom`,l.editAlias(t,d),y instanceof v||y instanceof P?f=y.positionInfo:f={x:y.x,y:y.y,type:"pixel"}),e=Z(t,e,{zIndex:y?y.parent?.getChildIndex(y):void 0}),y?.parent?.setChildIndex(y,y.parent.getChildIndex(y)-.1),d&&l.copyCanvasElementProperty(d,t),d&&l.transferTickers(d,t,"move"),f||(e instanceof v||e instanceof P?f=e.positionInfo:f={x:e.x,y:e.y,type:"pixel"});let x={x:e.pivot.x,y:e.pivot.y},T={x:e.scale.x,y:e.scale.y};if(d)if(i.removeOldComponentWithZoomOut){let le=Ue(d,{...i,autoplay:false,completeOnContinue:o},n);le&&(a.push(...le),u.push(...le));}else p.push(d);(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),c==="up"?(e.pivot.y=l.height-e.y,e.pivot.x=l.width/2-e.x,e.y=l.height,e.x=l.width/2):c==="down"?(e.pivot.y=0-e.y,e.pivot.x=l.width/2-e.x,e.y=0,e.x=l.width/2):c==="left"?(e.pivot.x=l.width-e.x,e.pivot.y=l.height/2-e.y,e.x=l.width,e.y=l.height/2):c==="right"&&(e.pivot.x=0-e.x,e.pivot.y=l.height/2-e.y,e.x=0,e.y=l.height/2),e.pivot=h.getPointBySuperPoint(e.pivot,e.angle),e.scale.set(0);let k=l.pauseTicker({canvasAlias:t});u.push(...k);let V=l.animate(t,{...ke(f),pivotX:x.x,pivotY:x.y,scaleX:T.x,scaleY:T.y},{...s,tickerIdToResume:u,aliasToRemoveAfter:p,completeOnContinue:o},n);if(V&&a.push(V),a.length>0)return a}function Ue(t,e={},i){let{forceCompleteBeforeNext:n=true}=e,{direction:r="right",completeOnContinue:c=n,aliasToRemoveAfter:o=[],...u}=e;typeof o=="string"&&(o=[o]),o.push(t);let p=l.find(t);if(!p){e$1.warn(`The canvas component "${t}" is not found.`);return}let s={x:p.x,y:p.y},a={x:p.pivot.x,y:p.pivot.y};r==="down"?(s.y=l.height,s.x=l.width/2,a.y=l.height-s.y,a.x=l.width/2-s.x):r==="up"?(s.y=0,s.x=l.width/2,a.y=0-s.y,a.x=l.width/2-s.x):r==="right"?(s.x=l.width,s.y=l.height/2,a.x=l.width-s.x,a.y=l.height/2-s.y):r==="left"&&(s.x=0,s.y=l.height/2,a.x=0-s.x,a.y=l.height/2-s.y),a=h.getPointBySuperPoint(a,p.angle),l.pauseTicker({canvasAlias:t});let f=l.animate(t,{...s,pivotX:a.x,pivotY:a.y,scaleX:0,scaleY:0},{...u,aliasToRemoveAfter:o,completeOnContinue:c},i);if(f)return [f]}async function Ot(t,e,i={},n){let{forceCompleteBeforeNext:r=true}=i,{direction:c="right",completeOnContinue:o=r,tickerIdToResume:u=[],...p}=i,s=[],a;e||(e=t),typeof u=="string"&&(u=[u]);let f,d=l.find(t);switch(d&&(f=`${t}_temp_push`,l.editAlias(t,f),d instanceof v||d instanceof P?a=d.positionInfo:a={x:d.x,y:d.y,type:"pixel"}),e=Z(t,e,{zIndex:d?d.parent?.getChildIndex(d):void 0}),d?.parent?.setChildIndex(d,d.parent.getChildIndex(d)-.1),f&&l.copyCanvasElementProperty(f,t),f&&l.transferTickers(f,t,"move"),a||((e instanceof v||e instanceof P)&&e.haveEmptyTexture?a=e.positionInfo:a={x:e.x,y:e.y,type:"pixel"}),(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),c){case "up":e.y=l.height+e.height;break;case "down":e.y=-e.height;break;case "left":e.x=l.width+e.width;break;case "right":e.x=-e.width;break}let y=l.pauseTicker({canvasAlias:t});if(u.push(...y),f){let T=Fe(f,{...i,direction:c,completeOnContinue:o});T&&s.push(...T);}let x=l.animate(t,ke(a),{...p,tickerIdToResume:u,completeOnContinue:o},n);if(x&&s.push(x),s.length>0)return s}function Fe(t,e={direction:"right"},i){return Se(t,e,i)}var J=class extends _{constructor(i){super(i);this._memory=i;this.pixivnId=i.pixivnId;}_memory;pixivnId;get memory(){return {...this._memory,...super.memory,elements:[],pixivnId:this.pixivnId}}};function Bt(){return async(e,i)=>{try{let n=e.canvasElementInfo;if(n){let r=new J(n),c=n.zIndex;r.groupColor=16711680;let o=new B.Graphics;o.rect(0,0,300,100).fill({color:16711680,alpha:.5}),r.addChild(o);let u=new B.Text({text:`Error: ${n.label}`,x:10,y:10});r.addChild(u);let p=e.parent;if(p&&"addChild"in p)c!==void 0?p.addChildAt(r,c):p.addChild(r);else {let s=n.parentLabel?l.find(n.parentLabel):void 0;if(s)c!==void 0?s.addChildAt(r,c):s.addChild(r);else {let a=n.label??n.pixivnId;l.add(a,r,{zIndex:c});}}}}catch{}}}function Rt(t,e,i){let n={...l.find(t)?.memory,...i},r=new z({text:e,...i});return n&&l.copyCanvasElementProperty(n,r),l.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}var {Assets:wn,Color:On,Rectangle:Bn,TextStyle:Rn,Texture:Dn,UPDATE_PRIORITY:Ln}=B,l=new U;I.init({getScreen:()=>l.screen});GameUnifier.addOnPreContinue(async()=>{try{let t=g._tickersToCompleteOnStepEnd.tikersIds,e=g._tickersToCompleteOnStepEnd.stepAlias,i=(async()=>{for(;t.length;){let{id:r}=t.pop()||{};r&&await l.forceCompletionOfTicker(r);}})(),n=(async()=>{for(;e.length;){let{alias:r,id:c}=e.pop()||{};r&&c&&await l.forceCompletionOfTicker(c,r);}})();await Promise.all([i,n]),g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.stepAlias.length=0;}catch{}});
2
- export{wn as Assets,ce as CanvasBaseItem,g as CanvasManagerStatic,h as CanvasPropertyUtility,On as Color,_ as Container,P as ImageContainer,v as ImageSprite,Bn as Rectangle,C as RegisteredCanvasComponents,ye as RegisteredEvents,L as RegisteredTickers,H as Sprite,z as Text,Rn as TextStyle,Dn as Texture,ie as TickerBase,Ln as UPDATE_PRIORITY,M as VideoSprite,pe as addImage,de as addImageCointainer,O as addListenerHandler,ue as addVideo,A as analizePositionsExtensionProps,l as canvas,et as canvasComponentDecorator,Bt as drawCanvasErrorHandler,Qe as eventDecorator,F as getTexture,_t as moveIn,Se as moveOut,Ot as pushIn,Fe as pushOut,fe as removeWithDissolve,Mt as removeWithFade,S as setMemoryContainer,kt as shakeEffect,bt as showImage,St as showImageContainer,Rt as showText,At as showVideo,Ge as showWithDissolve,Et as showWithFade,pt as tickerDecorator,wt as zoomIn,Ue as zoomOut};
1
+ import {a}from'./chunk-6GLWL3NH.mjs';import'./chunk-JMOSOAGB.mjs';import {e,d as d$1,g as g$1,b,c as c$1,f as f$1,a as a$1}from'./chunk-HD353M4B.mjs';import {c,d,e as e$1,f as f$2}from'./chunk-HQQ5WH6C.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';import B,{Container}from'@drincs/pixi-vn/pixi.js';import {initDevtools}from'@pixi/devtools';var Fe={extension:{type:"sceneProperties",name:"additional-positions"},testNode(t){return "xAlign"in t||"yAlign"in t||"percentageX"in t||"percentageY"in t||"positionType"in t},testProp(t){switch(t){case "xAlign":case "yAlign":case "percentageX":case "percentageY":case "positionType":return true;default:return false}},setProperty(t,e,i){switch(e){case "xAlign":"xAlign"in t&&(t.xAlign=i/100);break;case "yAlign":"yAlign"in t&&(t.yAlign=i/100);break;case "percentageX":"percentageX"in t&&(t.percentageX=i/100);break;case "percentageY":"percentageY"in t&&(t.percentageY=i/100);break}},getProperties(t){return [{value:t.positionType,prop:"positionType",entry:{section:"Transform",type:"text",label:"Position Type"}},{value:t.xAlign*100,prop:"xAlign",entry:{section:"Transform",type:"range",label:"X Align",tooltip:"0% is left, 100% is right",options:{min:0,max:100}}},{value:t.yAlign*100,prop:"yAlign",entry:{section:"Transform",type:"range",label:"Y Align",tooltip:"0% is top, 100% is bottom",options:{min:0,max:100}}},{value:t.percentageX*100,prop:"percentageX",entry:{section:"Transform",type:"range",label:"X Percentage Position",tooltip:"0% is left, 100% is right",options:{min:0,max:100}}},{value:t.percentageY*100,prop:"percentageY",entry:{section:"Transform",type:"range",label:"Y Percentage Position",tooltip:"0% is top, 100% is bottom",options:{min:0,max:100}}}]}},be=Fe;function Ae(t,e){let i=0;return async(...n)=>{let r=Date.now();if(r-i>=e)return i=r,await t(...n)}}var _e=c(a(),1),g=class t{constructor(){}static _app=void 0;static get app(){if(!t._app)throw e$1.error("The canvas is not initialized"),new PixiError("invalid_usage","CanvasManagerStatic.app is undefined");return t._app}static get gameLayer(){let e=t.app.stage.getChildByLabel(a$1);return e||(e=new B.Container,e.label=a$1,t.app.stage.addChild(e)),e}static htmlLayers=[];static canvasWidth=300;static canvasHeight=300;static _isInitialized=false;static async init(e,i,n){let{id:r="pixi-vn-canvas",width:a=800,height:o=600,resolution:p=1,autoDensity:d=true,resizeMode:s="contain",...c}=i||{};return t.canvasWidth=a,t.canvasHeight=o,t._app=new B.Application,t.app.init({width:a,height:o,resolution:p,autoDensity:d,...c}).then(()=>{let{app:l=t.app,extensions:u=[],...y}=n||{};if(initDevtools({app:l,extensions:[be,...u],...y}),t._isInitialized=true,t.addCanvasIntoHTMLElement(e,r),s==="contain"){let x=Ae(async()=>{requestAnimationFrame(()=>t.resize());},10);new ResizeObserver(x).observe(e),t.resize(),setTimeout(()=>t.resize(),750);}t.gameLayer;})}static addCanvasIntoHTMLElement(e,i){t._isInitialized?(e.appendChild(t.app.canvas),t.app.canvas.id=i):e$1.error("GameWindowManager is not initialized");}static addHtmlLayer(e,i,n={}){let{position:r="absolute",pointerEvents:a="none",userSelect:o="none"}=n,p=document.createElement("div");p.setAttribute("id",e),p.style.position=r,p.style.pointerEvents=a,p.style.userSelect=o;let d=i.appendChild(p);return t.htmlLayers.push(p),t.resize(),d}static removeHtmlLayer(e){let i=t.htmlLayers.find(n=>n.id===e);i&&(i.remove(),t.htmlLayers=t.htmlLayers.filter(n=>n.id!==e));}static getHtmlLayer(e){return t.htmlLayers.find(i=>i.id===e)}static async resize(){let e=t.canvasWidth,i=t.canvasHeight,n=t.app.resizeTo,r=t.app.canvas.style;n instanceof HTMLElement||(n=document.documentElement);let a,o;if(n===document.body||n===document.documentElement)a=document.documentElement.clientWidth||window.innerWidth,o=document.documentElement.clientHeight||window.innerHeight;else {let u=n.getBoundingClientRect();a=u.width||n.clientWidth,o=u.height||n.clientHeight;}let p=Math.min(a/e,o/i),d=Math.floor(p*e),s=Math.floor(p*i);r.width=`${d}px`,r.height=`${s}px`;let c=(a-d)/2,l=(o-s)/2;r.marginLeft=`${c}px`,r.marginRight=`${c}px`,r.marginTop=`${l}px`,r.marginBottom=`${l}px`,t.htmlLayers.forEach(u=>{u.style.width=`${d}px`,u.style.height=`${s}px`,u.style.marginLeft=`${c}px`,u.style.marginRight=`${c}px`,u.style.marginTop=`${l}px`,u.style.marginBottom=`${l}px`;});}static get childrenAliasesOrder(){return t.gameLayer.children.filter(e=>e.label).sort((e,i)=>t.gameLayer.getChildIndex(e)-t.gameLayer.getChildIndex(i)).map(e=>e.label)}static get currentTickersWithoutCreatedBySteps(){return Object.fromEntries(Array.from(t._currentTickers.entries()).filter(([e,i])=>!i.createdByTicketSteps).map(([e,i])=>[e,{id:i.ticker.alias,args:i.ticker.args,canvasElementAliases:i.ticker.canvasElementAliases,priority:i.ticker.priority,duration:i.ticker.duration,paused:i.ticker.paused}]))}static _currentTickers=new Map;static _currentTickersSequence=new Map;static get currentTickersSequence(){return Object.fromEntries(Array.from(t._currentTickersSequence.entries()).map(([e,i])=>[e,Object.fromEntries(i)]))}static _currentTickersTimeouts=new Map;static _tickersToCompleteOnStepEnd={tikersIds:[],stepAlias:[]};static generateTickerId(...e){try{return `${(0,_e.default)(JSON.stringify(e)).toString()}_${Math.random().toString(36).substring(7)}`}catch(i){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${i}`)}}static addTickerTimeoutInfo(e,i,n,r){typeof e=="string"&&(e=[e]),t._currentTickersTimeouts.set(n,{aliases:e,ticker:i,canBeDeletedBeforeEnd:r});}static removeTickerTimeoutInfo(e){typeof e!="string"&&(e=e.toString()),t._currentTickersTimeouts.delete(e);}static removeTickerTimeout(e){typeof e!="string"&&(e=e.toString()),clearTimeout(Number(e)),t.removeTickerTimeoutInfo(e);}static removeTickerTimeoutsByAlias(e,i){t._currentTickersTimeouts.forEach((n,r)=>{let a=n.aliases.filter(o=>o!==e);if(a.length===0){let o=n.canBeDeletedBeforeEnd;(!i||o)&&t.removeTickerTimeout(r);}else n.aliases=a;});}};var ue=Symbol("SerializableEvent"),X=new d({cacheSize:5});function Ze(t){return (e,i,n)=>{let r=n.value;fe.add(r,t||`${i}`);}}var fe;(a=>{function t(o,p){o[ue]=p,X.get(p)&&e$1.info(`Event "${p}" already exists, it will be overwritten`),X.set(p,o);}a.add=t;function e(o){try{let p=X.get(o);if(!p){e$1.error(`Event "${o}" not found, did you forget to register it with the eventDecorator?`);return}return p}catch(p){e$1.error(`Error while getting Event "${o}"`,p);return}}a.get=e;function i(){return Array.from(X.values())}a.values=i;function n(o){return X.has(o)}a.has=n;function r(){return Array.from(X.keys())}a.keys=r;})(fe||={});var ge=fe;async function we(t,e){if("onEvents"in e)for(let i in e.onEvents){let n=e.onEvents[i],r=ge.get(n);r&&t.on(i,r);}}function Oe(t){let{onEventsHandlers:e={}}=t;return e}function O(t,e,i){let n=i[ue];return n&&typeof n=="string"?(e.onEventsHandlers[t]=n,true):(e$1.warn(`The event handler for event "${t}" is not registered with the eventDecorator, it will not be saved in the memory and it will not work after loading the game. Please register the event handler with the eventDecorator to avoid this warning. Read more about it here: https://pixi-vn.com/start/canvas-functions#add-a-listener-to-an-event`),false)}var q=new d({cacheSize:5}),Be=new d({cacheSize:2}),Le=new d({cacheSize:2});function Je(t={}){return e=>{he.add(e,t);}}async function S(t,e,i){let n=i?.ignoreScale||false,r=i?.end;"isRenderGroup"in e&&e.isRenderGroup!==void 0&&(t.isRenderGroup=e.isRenderGroup),"blendMode"in e&&e.blendMode!==void 0&&(t.blendMode=e.blendMode),"tint"in e&&e.tint!==void 0&&(t.tint=e.tint),"alpha"in e&&e.alpha!==void 0&&(t.alpha=e.alpha),"angle"in e&&e.angle!==void 0&&(t.angle=e.angle),"renderable"in e&&e.renderable!==void 0&&(t.renderable=e.renderable),"rotation"in e&&e.rotation!==void 0&&(t.rotation=e.rotation),!n&&"scale"in e&&e.scale!==void 0&&(typeof e.scale=="number"?t.scale.set(e.scale,e.scale):t.scale.set(e.scale.x,e.scale.y)),"pivot"in e&&e.pivot!==void 0&&(typeof e.pivot=="number"?t.pivot.set(e.pivot,e.pivot):t.pivot.set(e.pivot.x,e.pivot.y)),"position"in e&&e.position!==void 0&&t.position.set(e.position.x,e.position.y),"skew"in e&&e.skew!==void 0&&t.skew.set(e.skew.x,e.skew.y),"visible"in e&&e.visible!==void 0&&(t.visible=e.visible),"x"in e&&e.x!==void 0&&(t.x=e.x),"y"in e&&e.y!==void 0&&(t.y=e.y),"boundsArea"in e&&e.boundsArea!==void 0&&(t.boundsArea=e.boundsArea),"cursor"in e&&e.cursor!==void 0&&(t.cursor=e.cursor),"eventMode"in e&&e.eventMode!==void 0&&(t.eventMode=e.eventMode),"interactive"in e&&e.interactive!==void 0&&(t.interactive=e.interactive),"interactiveChildren"in e&&e.interactiveChildren!==void 0&&(t.interactiveChildren=e.interactiveChildren),"hitArea"in e&&e.hitArea!==void 0&&(t.hitArea=e.hitArea),we(t,e),"align"in e&&e.align!==void 0&&"align"in t&&(t.align=e.align),"percentagePosition"in e&&e.percentagePosition!==void 0&&"percentagePosition"in t&&(t.percentagePosition=e.percentagePosition),r&&await r(),n||("width"in e&&e.width!==void 0&&(t.width=e.width),"height"in e&&e.height!==void 0&&(t.height=e.height));}var he;(p=>{function t(d,s={}){let{name:c=d.name,getInstance:l=async(y,x)=>{let T=new y;return await T.setMemory(x),T},copyProperty:u=async(y,x)=>{await y.setMemory(x);}}=s;q.get(c)&&e$1.warn(`CanvasElement "${c}" already registered`),d.prototype.pixivnId=c,q.set(c,d),Be.set(c,l),Le.set(c,u);}p.add=t;function e(d){let s=q.get(d);if(!s){e$1.error(`CanvasElement "${d}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return s}p.get=e;async function i(d,s){let c=e(d),l=Be.get(d);if(!c||!l){e$1.error(`CanvasElement "${d}" not found, did you forget to register it with the canvasComponentDecorator?`);return}try{return await l(c,s)}catch(u){e$1.error(`Error while getting CanvasElement instance "${d}"`,u);}}p.getInstance=i;async function n(d,s,c){let l=Le.get(d);if(!l){e$1.error(`CanvasElement "${d}" not found, did you forget to register it with the canvasComponentDecorator?`);return}try{await l(s,c);}catch(u){e$1.error(`Error while copying properties of CanvasElement "${d}"`,u);}}p.copyProperty=n;function r(){return Array.from(q.values())}p.values=r;function a(d){return q.has(d)}p.has=a;function o(){return Array.from(q.keys())}p.keys=o;})(he||={});var k=he;async function J(t){let e=await k.getInstance(t.pixivnId,t);if(!e)throw new PixiError("unregistered_element",`The element ${t.pixivnId} could not be created`,"canvas",t);return e}function ye(t){return "memory"in t?t.memory:t instanceof B.Text?Te(t):t instanceof B.Sprite?xe(t):L(t)}function et(t){let e=t.parent;return {width:t.width,height:t.height,isRenderGroup:t.isRenderGroup,blendMode:t.blendMode,tint:t.tint,alpha:t.alpha,angle:t.angle,renderable:t.renderable,rotation:t.rotation,scale:{x:t.scale.x,y:t.scale.y},pivot:{x:t.pivot.x,y:t.pivot.y},position:{x:t.position.x,y:t.position.y},skew:{x:t.skew.x,y:t.skew.y},visible:t.visible,x:t.x,y:t.y,boundsArea:t.boundsArea,cursor:t.cursor,eventMode:t.eventMode,interactive:t.interactive,interactiveChildren:t.interactiveChildren,hitArea:t.hitArea,index:e?.getChildIndex(t),parentLabel:e?.label,label:t.label}}function me(t,e){return {url:t.source.label,alias:e===t.source.label?void 0:e}}function L(t,e){let i=tt(t,b),r=e?.childrenExport||false?t.children.sort((a,o)=>t.getChildIndex(a)-t.getChildIndex(o)).map(a=>ye(a)):[];return {pixivnId:i,elements:r,onEvents:Oe(t),...et(t)}}function xe(t){let e$1=L(t),i=e$1.pixivnId??e,n="assetsAliases"in t&&Array.isArray(t.assetsAliases)?me(t.texture,t.assetsAliases[0]):"textureAlias"in t?me(t.texture,t.textureAlias):me(t.texture);return {...e$1,pixivnId:i,textureData:n,anchor:{x:t.anchor.x,y:t.anchor.y},roundPixels:t.roundPixels}}function Te(t){let e=L(t),i=e.pixivnId??f$1;return {...e,pixivnId:i,anchor:{x:t.anchor.x,y:t.anchor.y},text:t.text,resolution:t.resolution,style:st(t.style),roundPixels:t.roundPixels}}function tt(t,e){return Object.hasOwn(t,"pixivnId")?t.pixivnId:e}function Q(t){switch(t.type){case "linear":return {type:"linear",colorStops:t.colorStops,end:{x:t.end.x,y:t.end.y},start:{x:t.start.x,y:t.start.y},textureSpace:t.textureSpace,wrapMode:t.texture.source.wrapMode,textureSize:t.texture.source.width/t.texture.source.height};case "radial":return {type:"radial",colorStops:t.colorStops,textureSpace:t.textureSpace,center:{x:t.center.x,y:t.center.y},innerRadius:t.innerRadius,outerCenter:{x:t.outerCenter.x,y:t.outerCenter.y},outerRadius:t.outerRadius,rotation:t.rotation,scale:t.scale,wrapMode:t.texture.source.wrapMode,textureSize:t.texture.source.width/t.texture.source.height}}}function it(t){if(t!=null){{if(typeof t=="number")return t;if(typeof t=="string"||Array.isArray(t))return t;if(t instanceof B.FillGradient)return Q(t);if(typeof t=="object"&&"fill"in t&&typeof t.fill!="function"&&t.fill){if(!(t.fill instanceof B.FillPattern))return Q(t.fill)}}e$1.warn("Unsupported property type for Text.style.fill.",t);}}function rt(t){if(typeof t=="number")return t;if(typeof t=="string")return t;if(Array.isArray(t))return t;if(t instanceof B.Color)return t.toNumber();e$1.warn("Unsupported color type.",t);}function nt(t){if(t!=null){{if(typeof t=="number")return t;if(typeof t=="string"||Array.isArray(t))return t;if(t instanceof B.FillGradient)return Q(t);if(typeof t=="object"&&"alignment"in t)return {alignment:t.alignment,alpha:t.alpha,color:rt(t.color),join:t.join,miterLimit:t.miterLimit,width:t.width,cap:t.cap,pixelLine:t.pixelLine,textureSpace:t.textureSpace};if(typeof t=="object"&&"fill"in t&&typeof t.fill!="function"&&t.fill){if(!(t.fill instanceof B.FillPattern))return Q(t.fill)}}e$1.warn("Unsupported property type for Text.style.stroke.",t);}}function st(t){return {align:t.align,breakWords:t.breakWords,dropShadow:t.dropShadow,fill:it(t.fill),fontFamily:t.fontFamily,fontSize:t.fontSize,fontStyle:t.fontStyle,fontVariant:t.fontVariant,fontWeight:t.fontWeight,leading:t.leading,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,padding:t.padding,stroke:nt(t.stroke),textBaseline:t.textBaseline,trim:t.trim,whiteSpace:t.whiteSpace,wordWrap:t.wordWrap,wordWrapWidth:t.wordWrapWidth}}var Re=c(a(),1);var ee=class{constructor(e,i){this.alias=this.constructor.prototype.id;let{duration:n,priority:r,id:a=this.generateTickerId(this.alias,i),canvasElementAliases:o=[]}=i||{};this.args=e,this.duration=n,this.priority=r,this.id=a,this.canvasElementAliases=o;}alias;id;args;duration;priority;ticker=new B.Ticker;canvasElementAliases=[];generateTickerId(...e){try{return (0,Re.default)(JSON.stringify(e)).toString()+"_"+Math.random().toString(36).substring(7)}catch(i){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${i}`)}}fnValue;complete(e){this.stop();}stop(){let e=this.fnValue;if(!e){e$1.warn("TickerBase.stop() called without fnValue set. This may cause issues.");return}this.ticker.remove(e,null);}start(){let e=this.id,i=()=>this.fn(this.ticker,this.args,this.canvasElementAliases,e);this.fnValue=i,this.ticker.add(i,null,this.priority),this.ticker.start();}pause(){this.ticker.stop();}play(){this.ticker.start();}get paused(){return !this.ticker.started}};var R=new d({cacheSize:5});function ct(t){return function(e){ve.add(e,t);}}var ve;(o=>{function t(p,d){d||(d=p.name),R.get(d)&&e$1.info(`Ticker "${d}" already exists, it will be overwritten`),p.prototype.id=d,R.set(d,p);}o.add=t;function e(p){try{let d=R.get(p);if(!d){e$1.error(`Event "${p}" not found, did you forget to register it with the tickerDecorator?`);return}return d}catch(d){e$1.error(`Error while getting Event "${p}"`,d);return}}o.get=e;function i(p,d,s){try{let c=R.get(p);if(!c){e$1.error(`Ticker "${p}" not found, did you forget to register it with the tickerDecorator?`);return}return new c(d,s)}catch(c){e$1.error(`Error while getting Ticker "${p}"`,c);return}}o.getInstance=i;function n(){return Array.from(R.values())}o.values=n;function r(p){return R.has(p)}o.has=r;function a(){return Array.from(R.keys())}o.keys=a;})(ve||={});var D=ve;var De="aliasToRemoveAfter";var G=class{tickersPausedByGameLayerRender=[];get app(){return g.app}get gameLayer(){return g.gameLayer}get isInitialized(){return g._isInitialized}get width(){return g.canvasWidth}get height(){return g.canvasHeight}set width(e){g.canvasWidth=e;}set height(e){g.canvasHeight=e;}get screen(){return this.app.screen}async init(e,i,n){return await g.init(e,i,n)}get children(){return g.gameLayer.children}async copyCanvasElementProperty(e,i,n={}){let r=["isRenderGroup","scale","visible","boundsArea","text","resolution","style","height","width"],{ignoreProperties:a=d=>d}=n;if(typeof i=="string"){let d=this.find(i);if(d)i=d;else {e$1.error(`Canvas element ${i} not found`);return}}if(typeof e=="string"){let d=this.find(e);if(d)e=d;else {e$1.error(`Canvas element ${e} not found`);return}}e instanceof B.Container&&(e=e.memory);let o=a(r),p={...e};o.forEach(d=>{d in p&&delete p[d];}),await k.copyProperty(i.pixivnId,i,p);}add(e,i,n={}){if(e===a$1){e$1.error(`The alias ${a$1} is reserved`);return}let r=this.find(e),a=n?.ignoreOldStyle;r&&!a&&this.copyCanvasElementProperty(r,i);let{zIndex:o=r?.parent?.getChildIndex(r)}=n;r&&!this.canvasElementIsOnCanvas(r)?e$1.error(`The canvas element ${e} exist in the memory but it is not on the canvas, so the zIndex is not set`):r&&this.remove(e,{ignoreTickers:true}),o!==void 0?(i.label=e,this.gameLayer.addChildAt(i,o)):(i.label=e,this.gameLayer.addChild(i));}remove(e,i={}){if(e===a$1){e$1.error(`The alias ${a$1} is reserved`);return}let n=i.ignoreTickers;typeof e=="string"&&(e=[e]),e.forEach(r=>{this.gameLayer.getChildrenByLabel(r).forEach(a=>{this.gameLayer.removeChild(a),!n&&this.unlinkComponentFromTickerInternal(r);});});}find(e){if(e===a$1)return this.gameLayer;let i=this.gameLayer.getChildByLabel(e);if(i)return i}canvasElementIsOnCanvas(e){return this.gameLayer.children.includes(e)}removeAll(){this.gameLayer.removeChildren();}editAlias(e,i,n={}){let r=this.find(e);r&&(r.label=i),!n.ignoreTickers&&this.transferTickersInternal(e,i,"move");}get currentTickers(){return this.tickers.currentTickers}get currentTickersSteps(){return this.tickers.currentTickersSteps}findTicker(e){return this.findTickerInternal(e)}findTickerInternal(e){let i=g._currentTickers.get(e);if(i)return i.ticker}addTicker(e,i){return this.addTickerInternal(e,i)}addTickerInternal(e,i){let n=i.id,r=i.alias;if(typeof e=="string"&&(e=[e]),i.canvasElementAliases=e,!D.has(r)){e$1.error(`Ticker ${r} not found`);return}let a={ticker:i};if(g._currentTickers.set(n,a),a.ticker.start(),i.duration){let o=setTimeout(()=>{g.removeTickerTimeoutInfo(o),g._currentTickersTimeouts.get(o.toString())&&a.ticker.complete({ignoreTickerSteps:true});},i.duration*1e3);g.addTickerTimeoutInfo(e,r,o.toString(),true);}return n}addTickersSequence(e,i,n=0){if(i.length===0){e$1.warn("The steps of the tickers is empty");return}g._currentTickersSequence.has(e)||g._currentTickersSequence.set(e,new Map);let r={currentStepNumber:n,steps:i.map(o=>({ticker:o.alias,args:f$2(o.args),duration:o.duration}))},a=g.generateTickerId(r);return g._currentTickersSequence.get(e)?.set(a,r),this.runTickersSequence(e,a),a}runTickersSequence(e,i){let n=g._currentTickersSequence.get(e);if(!n?.has(i))return;let r=n.get(i).steps[n.get(i).currentStepNumber],a=D.getInstance(r.ticker,r.args,{canvasElementAliases:[e],duration:r.duration,priority:r.priority});if(!a){e$1.error(`Ticker ${r.ticker} not found`);return}let o=a.alias,p=a.id;a.canvasElementAliases=[e];let d={createdByTicketSteps:{canvasElementAlias:e,id:i},ticker:a};if(g._currentTickers.set(p,d),d.ticker.start(),a.duration){let s=setTimeout(()=>{let c=g._currentTickersTimeouts.get(s.toString());c&&(d.ticker.complete({ignoreTickerSteps:true}),c.aliases.forEach(l=>{this.nextTickerStep(l,i);})),g.removeTickerTimeoutInfo(s);},a.duration*1e3);g.addTickerTimeoutInfo(e,o,s.toString(),false);}}nextTickerStep(e,i){let n=g._currentTickersSequence.get(e);if(n?.has(i)){let r=n.get(i);r.currentStepNumber+1<r.steps.length?(r.currentStepNumber++,n.set(i,r),this.runTickersSequence(e,i)):i&&n.has(i)&&(n.delete(i),g._currentTickers.forEach((a,o)=>{a.createdByTicketSteps?.canvasElementAlias===e&&a.createdByTicketSteps.id===i&&this.removeTickerInternal(o);}));}}onTickerComplete(e,i){return this.onTickerCompleteInternal(e,i)}onTickerCompleteInternal(e,i){let{stopTicker:n=true,aliasToRemoveAfter:r,tickerAliasToResume:a,tickerIdToResume:o}=i,p=g._currentTickers.get(e),d=i.ignoreTickerSteps||false;this.remove(r),a.forEach(s=>{this.resumeTickerInternal({canvasAlias:s});}),this.resumeTickerInternal({id:o}),p&&(this.removeTickerInternal(e,{stopTicker:n}),!d&&p.ticker.duration===void 0&&p.createdByTicketSteps&&this.nextTickerStep(p.createdByTicketSteps.canvasElementAlias,p.createdByTicketSteps.id));}unlinkComponentFromTicker(e,i){return this.unlinkComponentFromTickerInternal(e,i)}unlinkComponentFromTickerInternal(e,i){if(typeof e=="string"&&(e=[e]),!i){e.forEach(r=>{g._currentTickers.forEach((a,o)=>{a.ticker.canvasElementAliases.includes(r)&&(a.ticker.canvasElementAliases.length===1?this.removeTickerInternal(o):a.ticker.canvasElementAliases=a.ticker.canvasElementAliases.filter(p=>p!==r));}),g._currentTickersSequence.has(r)&&g._currentTickersSequence.delete(r),g.removeTickerTimeoutsByAlias(r,false);});return}let n;typeof i=="string"?n=i:n=i.prototype.id,e.forEach(r=>{let a=g._currentTickersSequence.get(r);a&&a.forEach((o,p)=>{o.steps.find(d=>typeof d=="object"&&"ticker"in d&&d.ticker===n)&&a.delete(p);});}),g._currentTickers.forEach(r=>{r.ticker.alias===n&&(r.ticker.canvasElementAliases=r.ticker.canvasElementAliases.filter(a=>!e.includes(a)));}),g._currentTickersTimeouts.forEach(r=>{r.ticker===n&&r.canBeDeletedBeforeEnd&&(r.aliases=r.aliases.filter(a=>!e.includes(a)));}),this.removeTickersWithoutAssociatedCanvasElement();}removeTickersWithoutAssociatedCanvasElement(){g._currentTickers.forEach(e=>{e.ticker.canvasElementAliases=e.ticker.canvasElementAliases.filter(i=>this.find(i)),e.ticker.canvasElementAliases.length===0&&e.ticker.complete({ignoreTickerSteps:true});}),g._currentTickersSequence.forEach((e,i)=>{e===void 0&&g._currentTickersSequence.delete(i);}),Array.from(g._currentTickersTimeouts.keys()).forEach(e=>{let i=g._currentTickersTimeouts.get(e);i&&i.aliases.length===0&&g.removeTickerTimeout(e);});}removeAllTickers(){return this.removeAllTickersInternal()}removeAllTickersInternal(){this.tickersPausedByGameLayerRender=[],g._currentTickersSequence.clear(),Array.from(g._currentTickers.keys()).forEach(e=>{this.removeTickerInternal(e);}),g._currentTickers.clear(),Array.from(g._currentTickersTimeouts.keys()).forEach(e=>{g.removeTickerTimeout(e);}),g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.stepAlias.length=0;}removeTicker(e,i={stopTicker:true}){return this.removeTickerInternal(e,i)}removeTickerInternal(e,i={stopTicker:true}){typeof e=="string"&&(e=[e]),e.forEach(n=>{let r=g._currentTickers.get(n);r&&(i.stopTicker&&r.ticker.stop(),g._currentTickers.delete(n));});}pauseTicker(e){return this.pauseTickerInternal(e)}pauseTickerInternal(e){let i=[];if("canvasAlias"in e){let{canvasAlias:n,tickerIdsExcluded:r=[]}=e;g._currentTickers.forEach((a,o)=>{a.ticker.canvasElementAliases.includes(n)&&!r.includes(a.ticker.alias)&&a.ticker.paused===false&&(a.ticker.pause(),i.push(o));});}else if("id"in e){let{id:n}=e;typeof n=="string"&&(n=[n]),[...new Set(n)].forEach(r=>{let a=g._currentTickers.get(r);a?a.ticker.paused===false&&(a.ticker.pause(),i.push(r)):e$1.error(`Ticker with id ${r} not found`);});}return i}resumeTicker(e){return this.resumeTickerInternal(e)}resumeTickerInternal(e){if("canvasAlias"in e){let{canvasAlias:i}=e;g._currentTickers.forEach(n=>{n.ticker.canvasElementAliases.includes(i)&&n.ticker.play();});}else if("id"in e){let{id:i}=e;typeof i=="string"&&(i=[i]),[...new Set(i)].forEach(n=>{let r=g._currentTickers.get(n);r?r.ticker.play():e$1.error(`Ticker with id ${n} not found`);});}}isTickerPaused(e,i){return this.isTickerPausedInternal(e,i)}isTickerPausedInternal(e,i){return false}pause(){this.gameLayer.renderable!==false&&(this.gameLayer.renderable=false,this.tickersPausedByGameLayerRender=this.pauseTickerInternal({id:Array.from(g._currentTickers.keys())}));}resume(){if(this.gameLayer.renderable===true)return;this.gameLayer.renderable=true;let e=this.tickersPausedByGameLayerRender.filter(i=>g._currentTickers.has(i));e.length>0&&this.resumeTickerInternal({id:e}),this.tickersPausedByGameLayerRender=[];}transferTickers(e,i,n="move"){return this.transferTickersInternal(e,i,n)}transferTickersInternal(e,i,n="move"){let r=g._currentTickersSequence.get(e);if(r){let o=new Map(Array.from(r.entries()).map(([p,d])=>[p,f$2(d)]));g._currentTickersSequence.set(i,o);}g._currentTickers.forEach((o,p)=>{if(o.createdByTicketSteps?.canvasElementAlias===e&&this.removeTickerInternal(p),o.ticker.canvasElementAliases.includes(e)){let d=D.getInstance(o.ticker.alias,f$2(o.ticker.args),{duration:o.ticker.duration,priority:o.ticker.priority,canvasElementAliases:[i]});if(d?(this.addTickerInternal(i,d),o.ticker.paused&&d.pause()):e$1.error(`Ticker ${o.ticker.alias} not found`),n==="move"&&(o.ticker.canvasElementAliases=o.ticker.canvasElementAliases.filter(s=>s!==e)),Object.hasOwn(o.ticker.args,De)){let s=o.ticker.args.aliasToRemoveAfter;typeof s=="string"&&(s=[s]),Array.isArray(s)&&(n==="move"?o.ticker.args.aliasToRemoveAfter=s.map(c=>c===e?i:c):n==="duplicate"&&s.find(c=>c===e)&&(o.ticker.args.aliasToRemoveAfter=[...s,i]));}}}),g._currentTickersTimeouts.forEach(o=>{o.aliases.includes(e)&&(n==="move"?o.aliases=o.aliases.map(p=>p===e?i:p):n==="duplicate"&&o.aliases.find(p=>p===e)&&o.aliases.push(i));});let a=g._currentTickersSequence.get(i);if(a&&a.forEach((o,p)=>{this.runTickersSequence(i,p);}),n==="duplicate"){let o=g._currentTickersSequence.get(e);o&&o.forEach((p,d)=>{this.runTickersSequence(e,d);});}}completeTickerOnStepEnd(e){return this.completeTickerOnStepEndInternal(e)}completeTickerOnStepEndInternal(e){e.alias?g._tickersToCompleteOnStepEnd.stepAlias.push({id:e.id,alias:e.alias}):g._tickersToCompleteOnStepEnd.tikersIds.push({id:e.id});}async forceCompletionOfTicker(e,i){return this.forceCompletionOfTickerInternal(e,i)}async forceCompletionOfTickerInternal(e,i){if(i){let n=g._currentTickersSequence.get(i),r=n?.get(e);if(n&&r){let a=r.steps.map(o=>{if(typeof o=="object"&&"ticker"in o){let p=D.getInstance(o.ticker,o.args,{duration:o.duration,canvasElementAliases:[i],priority:o.priority});if(p)return p.complete()}return Promise.resolve()});await Promise.all(a);}}else {let n=g._currentTickers.get(e);n&&await n.ticker.complete();}}tickers={transfer:(e,i,n)=>this.transferTickersInternal(e,i,n),get currentTickers(){return g._currentTickers},get currentTickersSteps(){return g._currentTickersSequence},find:e=>this.findTickerInternal(e),add:(e,i)=>this.addTickerInternal(e,i),addSequence:(e,i,n)=>this.addTickersSequence(e,i,n),unlinkComponent:(e,i)=>this.unlinkComponentFromTickerInternal(e,i),removeAll:()=>this.removeAllTickersInternal(),remove:e=>this.removeTickerInternal(e),pause:e=>this.pauseTickerInternal(e),resume:e=>this.resumeTickerInternal(e),isPaused:(e,i)=>this.isTickerPausedInternal(e,i),completeOnStepEnd:e=>this.completeTickerOnStepEndInternal(e),forceCompletion:(e,i)=>this.forceCompletionOfTickerInternal(e,i),onComplete:(e,i)=>this.onTickerCompleteInternal(e,i)};animate(e,i,n,r){return GameUnifier.animate(e,i,n,r)}addLayerInternal(e,i){if(e===a$1){e$1.error(`The alias ${a$1} is reserved`);return}return i.label=e,g.app.stage.addChild(i)}getLayerInternal(e){return g.app.stage.getChildByLabel(e)}removeLayerInternal(e){let i=g.app.stage.getChildByLabel(e);i&&g.app.stage.removeChild(i);}addHtmlLayerInternal(e,i,n){return g.addHtmlLayer(e,i,n)}removeHtmlLayerInternal(e){return g.removeHtmlLayer(e)}getHtmlLayerInternal(e){return g.getHtmlLayer(e)}addLayer(e,i){return this.addLayerInternal(e,i)}getLayer(e){return this.getLayerInternal(e)}removeLayer(e){return this.removeLayerInternal(e)}addHtmlLayer(e,i,n){return this.addHtmlLayerInternal(e,i,n)}removeHtmlLayer(e){return this.removeHtmlLayerInternal(e)}getHtmlLayer(e){return this.getHtmlLayerInternal(e)}layers={get gameLayer(){return g.gameLayer},add:(e,i)=>this.addLayerInternal(e,i),get:e=>this.getLayerInternal(e),remove:e=>this.removeLayerInternal(e)};htmlLayers={add:(e,i,n)=>this.addHtmlLayerInternal(e,i,n),get:e=>this.getHtmlLayerInternal(e),remove:e=>this.removeHtmlLayerInternal(e)};async extractImage(){let e=this.gameLayer.renderable===false;e&&this.resume();let i;try{i=this.app.renderer.extract.image(this.app.stage);}finally{e&&this.pause();}return (await i).src}clear(){this.removeAllTickersInternal(),this.removeAll();}export(){let e=this.gameLayer.renderable===false;e&&this.resume();try{let i={};return this.children.forEach(n=>{n.label&&(i[n.label]=ye(n));}),{tickers:f$2(g.currentTickersWithoutCreatedBySteps),tickersSteps:f$2(g.currentTickersSequence),elements:f$2(i),stage:f$2(L(this.gameLayer)),elementAliasesOrder:f$2(g.childrenAliasesOrder),tickersToCompleteOnStepEnd:f$2(g._tickersToCompleteOnStepEnd)}}finally{e&&this.pause();}}async restore(e){this.clear();try{if(Object.hasOwn(e,"elements")&&Object.hasOwn(e,"elementAliasesOrder")){let i=e.elementAliasesOrder,n={},r=Object.entries(e.elements).map(async([a,o])=>{n[a]=await J(o);});await Promise.all(r),i.forEach(a=>{let o=n[a];o&&this.add(a,o);});}else {e$1.error("The data does not have the properties elementAliasesOrder and elements");return}if(Object.hasOwn(e,"stage")&&Object.hasOwn(e,"stage")?S(this.gameLayer,e.stage,{ignoreScale:!0}):e$1.error("The data does not have the properties stage"),Object.hasOwn(e,"tickers")){let i=e.tickers;Object.entries(i).forEach(([n,r])=>{let a=r.canvasElementAliases;if(a.length!==0){let o=D.getInstance(r.id,r.args,{duration:r.duration,priority:r.priority,id:n,canvasElementAliases:a});o?(o.canvasElementAliases=a,this.addTickerInternal(a,o),r.paused&&o.pause()):e$1.error(`Ticker ${r.id} not found`);}});}if(Object.hasOwn(e,"tickersSteps")){let i=e.tickersSteps;Object.entries(i).forEach(([n,r])=>{g._currentTickersSequence.set(n,new Map(Object.entries(r))),Object.keys(r).forEach(a=>{this.runTickersSequence(n,a);});});}if(Object.hasOwn(e,"tickersToCompleteOnStepEnd")){let i=e.tickersToCompleteOnStepEnd,n=i.tikersIds,r=i.stepAlias.map(a=>({id:a.id,alias:a.alias}));g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.tikersIds.push(...n),g._tickersToCompleteOnStepEnd.stepAlias.length=0,g._tickersToCompleteOnStepEnd.stepAlias.push(...r);}}catch(i){e$1.error("Error importing data",i);}}};var I=class t{static init(e){t._getScreen=e.getScreen;}static _getScreen;static get screen(){return t._getScreen()}};var h;(d=>{function t(s,c,l,u,y,x=0){return y?s==="width"?c*(I.screen.width-l)+l-u-x*l:c*(I.screen.height-l)+l-u-x*l:s==="width"?c*(I.screen.width-l)+u+x*l:c*(I.screen.height-l)+u+x*l}d.calculatePositionByAlign=t;function e(s,c,l,u,y,x=0){return y?s==="width"?(c-l+u+x*l)/(I.screen.width-l):(c-l+u+x*l)/(I.screen.height-l):s==="width"?(c-u-x*l)/(I.screen.width-l):(c-u-x*l)/(I.screen.height-l)}d.calculateAlignByPosition=e;function i(s,c){return s==="width"?c*I.screen.width:c*I.screen.height}d.calculatePositionByPercentagePosition=i;function n(s,c){return s==="width"?c/I.screen.width:c/I.screen.height}d.calculatePercentagePositionByPosition=n;function r(s,c){if(c=c%360,c<0&&(c+=360),c===0)return {x:s.x,y:s.y};if(c===90)return {x:-s.y,y:s.x};if(c===180)return {x:-s.x,y:-s.y};if(c===270)return {x:s.y,y:-s.x};if(c>0&&c<90){let l=c*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=s.x*u-s.y*y,T=s.x*y+s.y*u;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(c>90&&c<180){let l=(c-90)*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=-s.y*y-s.x*u,T=s.y*u-s.x*y;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(c>180&&c<270){let l=(c-180)*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=-s.x*u+s.y*y,T=-s.x*y-s.y*u;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(c>270&&c<360){let l=(c-270)*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=s.y*y-s.x*u,T=-s.y*u-s.x*y;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}return {x:0,y:0}}d.getSuperPoint=r;function a(s,c){if(c=c%360,c<0&&(c+=360),c===0)return {x:s.x,y:s.y};if(c===90)return {x:s.y,y:-s.x};if(c===180)return {x:-s.x,y:-s.y};if(c===270)return {x:-s.y,y:s.x};if(c>0&&c<90){let l=c*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:s.x*u+s.y*y,y:-s.x*y+s.y*u}}else if(c>90&&c<180){let l=(c-90)*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:s.y*u-s.x*y,y:-s.y*y-s.x*u}}else if(c>180&&c<270){let l=(c-180)*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:-s.x*u-s.y*y,y:s.x*y-s.y*u}}else if(c>270&&c<360){let l=(c-270)*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:-s.y*u+s.x*y,y:s.y*y+s.x*u}}return {x:0,y:0}}d.getPointBySuperPoint=a;function o(s){let c=s.width,l=s.height,u=s.angle%360;return u<0&&(u+=360),u===0||u===180?c:u===90||u===270?l:Math.abs(c*Math.cos(u*Math.PI/180))+Math.abs(l*Math.sin(u*Math.PI/180))}d.getSuperWidth=o;function p(s){let c=s.width,l=s.height,u=s.angle%360;return u<0&&(u+=360),u===0||u===180?l:u===90||u===270?c:Math.abs(l*Math.cos(u*Math.PI/180))+Math.abs(c*Math.sin(u*Math.PI/180))}d.getSuperHeight=p;})(h||={});async function N(t){if(t!=="EMPTY"){if(!t)throw e$1.error("Texture not found",t),new PixiError("unregistered_asset","Texture not found");if(B.Assets.cache.has(t)){let e=B.Assets.get(t);if(e)return e}return B.Assets.load(t).then(e=>{if(!e)throw e$1.error("Texture not found",t),new PixiError("unregistered_asset","Texture not found");if(!(e instanceof B.Texture))throw e$1.error("File is not a Texture",t),new PixiError("unregistered_asset","File is not a Texture");return e}).catch(e=>{throw e$1.error("Error loading file",e),new PixiError("unknown_element","Error loading file")})}}function A(t){return t&&(typeof t.align!="number"&&(t.xAlign!==void 0&&(t.align===void 0?(t.align={x:t.xAlign},delete t.xAlign):(t.align.x=t.xAlign,delete t.xAlign)),t.yAlign!==void 0&&(t.align===void 0?(t.align={y:t.yAlign},delete t.yAlign):(t.align.y=t.yAlign,delete t.yAlign))),typeof t.percentagePosition!="number"&&(t.percentageX!==void 0&&(t.percentagePosition===void 0?(t.percentagePosition={x:t.percentageX},delete t.percentageX):(t.percentagePosition.x=t.percentageX,delete t.percentageX)),t.percentageY!==void 0&&(t.percentagePosition===void 0?(t.percentagePosition={y:t.percentageY},delete t.percentageY):(t.percentagePosition.y=t.percentageY,delete t.percentageY))),t)}var H=class t extends B.Sprite{constructor(e$1){if(e$1 instanceof B.Texture)super(e$1);else {let{align:i,percentagePosition:n,...r}=A(e$1)||{};super(r),i&&(this.align=i),n&&(this.percentagePosition=n);}this.pixivnId=this.constructor.prototype.pixivnId||e;}pixivnId=e;get memory(){return {...xe(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){return await ne(this,e)}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}}set xAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)}set yAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageX(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}set percentageY(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};k.add(H,{name:e,copyProperty:async(t,e)=>{await ne(t,e,{ignoreTexture:true});}});async function ne(t,e,i){e=A(e);let n=i?.ignoreTexture||false;if(await S(t,e),!n){let a;if("textureData"in e&&e.textureData&&(a=e.textureData),a&&a.url!=="EMPTY"){let o=a.url;a.alias&&B.Assets.resolver.hasKey(a.alias)&&(o=a.alias);try{let p=await N(o);p&&(t.texture=p);}catch(p){e$1.error("Error in Sprite.setMemorySprite() while loading texture"),p=new PixiError("unregistered_asset",`Error loading image ${o}`,"canvas",e),GameUnifier.runOnError(p,{});}}}let r=i?.half;r&&await r(),"anchor"in e&&e.anchor!==void 0&&(typeof e.anchor=="number"?t.anchor.set(e.anchor,e.anchor):t.anchor.set(e.anchor.x,e.anchor.y)),"align"in e&&e.align!==void 0&&(t.align=e.align),"percentagePosition"in e&&e.percentagePosition!==void 0&&(t.percentagePosition=e.percentagePosition),"roundPixels"in e&&e.roundPixels!==void 0&&(t.roundPixels=e.roundPixels);}var v=class t extends H{_textureAlias;get textureAlias(){return this._textureAlias?this._textureAlias:this.texture.source.label}pixivnId=d$1;constructor(e,i){super(e),i&&(this._textureAlias=i);}get memory(){return {...super.memory,pixivnId:this.pixivnId,loadIsStarted:this._loadIsStarted}}async setMemory(e){let i;"textureData"in e&&e.textureData&&(i=e.textureData),"assetsData"in e&&Array.isArray(e.assetsData)&&e.assetsData.length>0&&(i=e.assetsData[0]),i&&i.alias&&(this._textureAlias=i.alias),await se(this,e),this.reloadPosition();}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){return this._loadIsStarted=true,N(this.textureAlias).then(e=>{this._loadIsStarted=false,e&&(this.texture=e);}).catch(e=>{this._loadIsStarted=false,e$1.error("Error into ImageSprite.load()"),e=new PixiError("unregistered_asset",`Error loading image ${this.textureAlias}`,"canvas",{...this.memory,label:this.textureAlias},this),GameUnifier.runOnError(e,{});})}set texture(e){super.texture=e,this.reloadPosition();}get texture(){return super.texture}get haveEmptyTexture(){return this.texture._source.label==="EMPTY"}};k.add(v,{name:d$1,copyProperty:async(t,e)=>{await se(t,e,{ignoreTexture:true});}});async function se(t,e,i){return await ne(t,e,{half:async()=>{"loadIsStarted"in e&&e.loadIsStarted&&await t.load();},ignoreTexture:i?.ignoreTexture})}var M=class t extends v{constructor(e,i){if(e instanceof B.Texture){super(e,i);return}let{loop:n,paused:r,currentTime:a,...o}=e||{};super(o,i),n&&(this.loop=n),r&&(this.paused=r),a&&(this.currentTime=a);}pixivnId=g$1;get memory(){return {...super.memory,pixivnId:this.pixivnId,loop:this.loop,paused:this._paused,currentTime:this.currentTime}}async setMemory(e){await ze(this,e),this.reloadPosition();}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}async load(){await super.load(),this.loop=this._looop,this.currentTime=this._currentTime,this.paused=this._paused;}_looop=false;get loop(){return this.texture?.source?.resource?.loop||false}set loop(e){this._looop=e,this.texture?.source?.resource&&(this.texture.source.resource.loop=e);}_paused=false;get paused(){return this.texture?.source?.resource?.paused||false}set paused(e){e?this.pause():this.play();}pause(){this._paused=true,this.texture?.source?.resource&&this.texture.source.resource.pause();}play(){this._paused=false,this.texture?.source?.resource?.play&&typeof this.texture.source.resource.play=="function"&&this.texture.source.resource.play();}_currentTime=0;get currentTime(){return this.texture?.source?.resource?.currentTime||0}set currentTime(e){let i=this.duration;i&&e>=i&&(e=0),this._currentTime=e,this.texture?.source?.resource&&(this.texture.source.resource.currentTime=e);}restart(){this.currentTime=0;}get duration(){if(this.texture?.source?.resource)return this.texture.source.resource.duration||0}};k.add(M,{name:g$1,getInstance:async(t,e)=>{let i;"textureData"in e&&e.textureData&&(i=e.textureData);let n=new t(void 0,i?.alias);return await n.setMemory(e),n},copyProperty:async(t,e)=>{await ze(t,e,{ignoreTexture:true});}});async function ze(t,e,i){await se(t,e,{ignoreTexture:i?.ignoreTexture}),"loop"in e&&e.loop!==void 0&&(t.loop=e.loop),"currentTime"in e&&e.currentTime!==void 0&&(t.currentTime=e.currentTime),"paused"in e&&e.paused!==void 0&&(t.paused=e.paused);}var _=class extends Container{constructor(e){let{anchor:i,align:n,percentagePosition:r,...a}=A(e)||{};super(a),this.pixivnId=this.constructor.prototype.pixivnId||b,i&&(this.anchor=i),n&&(this.align=n),r&&(this.percentagePosition=r);}pixivnId=b;get memory(){return {...L(this,{childrenExport:true}),anchor:this._anchor?this.anchor:void 0,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){await this.importChildren(e),await S(this,e),this.reloadAnchor(),this.reloadPosition();}async importChildren(e){for(let i=0;i<e.elements.length;i++){let n=e.elements[i],r=await J(n);this.addChild(r);}}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_anchor;get anchor(){let e=super.pivot.x/this.width,i=super.pivot.y/this.height;return {x:e,y:i}}set anchor(e){typeof e=="number"?this._anchor={x:e,y:e}:this._anchor=e,this.reloadAnchor();}reloadAnchor(){this._anchor&&super.pivot.set(this._anchor.x*this.width,this._anchor.y*this.height);}get pivot(){return super.pivot}set pivot(e){this._anchor=void 0,super.pivot=e;}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0)}}set xAlign(e){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0)}set yAlign(e){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}set percentageX(e){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageY(e){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};k.add(_,{name:b,copyProperty:async(t,e)=>await S(t,e)});var yt=new Set(["mp4","webm","ogg","ogv","avi","mov","wmv","flv","mkv","m4v","3gp","3g2","ts","mts"]);function U(t){let e=B.Assets.cache.has(t)?B.Assets.get(t):null;return e instanceof B.Texture&&(t=e.source?.label||t),xt(t)}function xt(t){let e=t.split(".").pop()?.toLowerCase();return e!==void 0&&yt.has(e)}var P=class extends _{constructor(e,i){let{anchor:n,align:r,percentagePosition:a,...o}=A(e)||{};super(o),i&&i.forEach(p=>{U(p)?this.addChild(new M(void 0,p)):this.addChild(new v(void 0,p));}),n&&(this.anchor=n),r&&(this.align=r),a&&(this.percentagePosition=a);}get memory(){return {...super.memory,pixivnId:c$1,loadIsStarted:this._loadIsStarted}}async setMemory(e){await this.importChildren(e),await Ve(this,e),this.reloadAnchor(),this.reloadPosition();}pixivnId=c$1;_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){this._loadIsStarted=true;let e=this.children.map(i=>i.load());return Promise.all(e).then(()=>{this._loadIsStarted=false,this.reloadAnchor(),this.reloadPosition();}).catch(i=>{this._loadIsStarted=false,e$1.error("Error into ImageContainer.load()",i);})}get texture(){return this.children.length>0?this.children[0].texture:new B.Texture}get haveEmptyTexture(){return this.children.some(e=>e.texture._source.label==="EMPTY")}};k.add(P,{name:c$1,copyProperty:async(t,e)=>await Ve(t,e)});async function Ve(t,e){e=A(e)||{},S(t,e,{end:async()=>{"loadIsStarted"in e&&e.loadIsStarted&&await t.load();}});}var ae=class{constructor(...e){}get memory(){throw new PixiError("not_implemented","The method CanvasBaseItem.memory must be overridden")}setMemory(e){throw new PixiError("not_implemented","The method CanvasBaseItem.setMemory must be overridden")}pixivnId="canvas_element_id_not_set"};var z=class extends B.Text{constructor(e){let{align:i,percentagePosition:n,...r}=A(e)||{};super(r),this.pixivnId=this.constructor.prototype.pixivnId||f$1,i&&(this.align=i),n&&(this.percentagePosition=n);}pixivnId=f$1;get memory(){return {...Te(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){await Pt(this,e),this.reloadPosition();}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}}set xAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)}set yAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageX(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}set percentageY(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};k.add(z,{name:f$1});async function Pt(t,e){"text"in e&&e.text!==void 0&&(t.text=e.text),await S(t,e,{end:()=>{"style"in e&&e.style!==void 0&&(t.style=e.style);}}),"anchor"in e&&e.anchor!==void 0&&(typeof e.anchor=="number"?t.anchor.set(e.anchor,e.anchor):t.anchor.set(e.anchor.x,e.anchor.y)),"resolution"in e&&e.resolution!==void 0&&(t.resolution=e.resolution),"anchor"in e&&e.anchor!==void 0&&(typeof e.anchor=="number"?t.anchor.set(e.anchor,e.anchor):t.anchor.set(e.anchor.x,e.anchor.y)),"align"in e&&e.align!==void 0&&(t.align=e.align),"percentagePosition"in e&&e.percentagePosition!==void 0&&(t.percentagePosition=e.percentagePosition),"roundPixels"in e&&e.roundPixels!==void 0&&(t.roundPixels=e.roundPixels);}async function It(t,e={},i){let n=f.find(t);if(!n){e$1.error(`The element with the alias ${t} does not exist. So the shake effect can't be applied.`);return}let r={x:n.position.x,y:n.position.y},{shakeType:a="horizontal",maxShockSize:o=10,shocksNumber:p=10,...d}=e,s=p-1;if(s<2){e$1.error("The number of shocks must be at least 3.");return}let c=Math.floor(s/2),l=Math.ceil(s/2),u=[];for(let T=0;T<c;T++){let C=o*(T+1)/c;a==="horizontal"?T%2!==0?u.push(r.x+C):u.push(r.x-C):T%2!==0?u.push(r.y+C):u.push(r.y-C);}let y=c%2===0;for(let T=l;T>0;T--){let C=o*(T+1)/(l-1);a==="horizontal"?T%2===0&&!y||T%2!==0&&y?u.push(r.x-C):u.push(r.x+C):T%2===0&&!y||T%2!==0&&y?u.push(r.y-C):u.push(r.y+C);}let x;if(a==="horizontal"?(u.push(r.x),x=f.animate(t,{x:u},d,i)):(u.push(r.y),x=f.animate(t,{y:u},d,i)),x)return [x]}function oe(t,e,i){let n={...f.find(t)?.memory,...i},r=new P(i,e);return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function kt(t,e,i){let n={...f.find(t)?.memory,...i},r=new P(i,e);return r.label=t,await r.load(),n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function ce(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The image ${t} does not exist in the cache.`,"canvas",{pixivnId:d$1,...i,label:t});let n={...f.find(t)?.memory,...i},r=new v(i,e);return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function Ct(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The image ${t} does not exist in the cache.`,"canvas",{pixivnId:d$1,...i,label:t});let n={...f.find(t)?.memory,...i},r=new v(i,e);return r.label=t,await r.load(),n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function de(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The video ${t} does not exist in the cache.`,"canvas",{pixivnId:g$1,...i,label:t});let n={...f.find(t)?.memory,...i},r=new M(i,e);return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function St(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The video ${t} does not exist in the cache.`,"canvas",{pixivnId:g$1,...i,label:t});let n={...f.find(t)?.memory,...i},r=new M(i,e);return r.label=t,await r.load(),n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function Ie(t){switch(t.type){case "align":return {xAlign:t.x,yAlign:t.y};case "percentage":return {percentageX:t.x,percentageY:t.y};default:return {x:t.x,y:t.y}}}function F(t,e,i){if(typeof e=="string")return U(e)?de(t,e,i):ce(t,e,i);if(Array.isArray(e))return oe(t,e,i);if(typeof e=="object"&&"value"in e&&"options"in e){if(typeof e.value=="string")return U(e.value)?de(t,e.value,{...e.options,zIndex:i.zIndex}):ce(t,e.value,{...e.options,zIndex:i.zIndex});if(Array.isArray(e.value))return oe(t,e.value,{...e.options,zIndex:i.zIndex})}return f.add(t,e,i),e}async function qe(t,e,i={},n){let{completeOnContinue:r=true,tickerIdToResume:a=[],...o}=i,p=[];e||(e=t),typeof a=="string"&&(a=[a]);let d,s=f.find(t);if(s&&(d=`${t}_temp_disolve`,f.editAlias(t,d)),e=F(t,e,{zIndex:s?s.parent?.getChildIndex(s):void 0}),s?.parent?.setChildIndex(s,s.parent.getChildIndex(s)-.1),d&&f.copyCanvasElementProperty(d,t),d&&f.tickers.transfer(d,t,"duplicate"),e.alpha=0,d){let l=pe(d,{...i,autoplay:false,completeOnContinue:r},n);l&&(p.push(...l),a.push(...l));}let c=f.animate(t,{alpha:1},{...o,tickerIdToResume:a,completeOnContinue:r},n);if(c&&p.push(c),(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),p.length>0)return p}function pe(t,e={},i){let{completeOnContinue:n=true,aliasToRemoveAfter:r=[],...a}=e;typeof r=="string"&&(r=[r]),r.push(t);let o=f.animate(t,{alpha:0},{...a,aliasToRemoveAfter:r,completeOnContinue:n},i);if(o)return [o]}async function bt(t,e,i={},n){let{completeOnContinue:r=true,aliasToRemoveAfter:a=[],...o}=i,p=[];e||(e=t),typeof a=="string"&&(a=[a]);let d=f.find(t);if(!d)return qe(t,e,i,n);let s=`${t}_temp_fade`;f.editAlias(t,s),a.push(s),e=F(t,e,{zIndex:d?d.parent?.getChildIndex(d):void 0}),d?.parent?.setChildIndex(d,d.parent.getChildIndex(d)-.1),s&&f.copyCanvasElementProperty(s,t),s&&f.tickers.transfer(s,t,"duplicate"),e.alpha=0;let c=f.animate(t,{alpha:1},{...o,aliasToRemoveAfter:a,completeOnContinue:r},n);if(c){let l=pe(s,{...i,tickerIdToResume:c,completeOnContinue:r},n);l&&p.push(...l),p.push(c),f.tickers.pause({id:c});}if((e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),p.length>0)return p}function At(t,e={},i){return pe(t,e,i)}async function Et(t,e,i={},n){let{direction:r="right",completeOnContinue:a=true,tickerIdToResume:o=[],aliasToRemoveAfter:p=[],removeOldComponentWithMoveOut:d,...s}=i,c=[],l;e||(e=t),typeof o=="string"&&(o=[o]),typeof p=="string"&&(p=[p]);let u,y=f.find(t);if(y&&(u=`${t}_temp_movein`,f.editAlias(t,u),y instanceof v||y instanceof P?l=y.positionInfo:l={x:y.x,y:y.y,type:"pixel"}),e=F(t,e,{zIndex:y?y.parent?.getChildIndex(y):void 0}),y?.parent?.setChildIndex(y,y.parent.getChildIndex(y)-.1),u&&f.copyCanvasElementProperty(u,t),u&&f.tickers.transfer(u,t,"move"),l||(e instanceof v||e instanceof P?l=e.positionInfo:l={x:e.x,y:e.y,type:"pixel"}),u)if(d){let C=ke(u,{...i,autoplay:false,completeOnContinue:a},n);C&&(c.push(...C),o.push(...C));}else p.push(u);switch((e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),r){case "up":e.y=f.height+e.height;break;case "down":e.y=-e.height;break;case "left":e.x=f.width+e.width;break;case "right":e.x=-e.width;break}let x=f.tickers.pause({canvasAlias:t});o.push(...x);let T=f.animate(t,Ie(l),{...s,tickerIdToResume:o,aliasToRemoveAfter:p,completeOnContinue:a},n);if(T&&c.push(T),c.length>0)return c}function ke(t,e={},i){let{direction:n="right",completeOnContinue:r=true,aliasToRemoveAfter:a=[],...o}=e;typeof a=="string"&&(a=[a]),a.push(t);let p=f.find(t);if(!p){e$1.warn(`The canvas component "${t}" is not found.`);return}let d={x:p.x,y:p.y};switch(n){case "up":d.y=-p.height;break;case "down":d.y=f.height+p.height;break;case "left":d.x=-p.width;break;case "right":d.x=f.width+p.width;break}f.tickers.pause({canvasAlias:t});let s=f.animate(t,d,{...o,aliasToRemoveAfter:a,completeOnContinue:r},i);if(s)return [s]}async function Mt(t,e,i={},n){let{direction:r="right",completeOnContinue:a=true,tickerIdToResume:o=[],aliasToRemoveAfter:p=[],...d}=i,s=[],c;e||(e=t),typeof o=="string"&&(o=[o]),typeof p=="string"&&(p=[p]);let l,u=f.find(t);u&&(l=`${t}_temp_zoom`,f.editAlias(t,l),u instanceof v||u instanceof P?c=u.positionInfo:c={x:u.x,y:u.y,type:"pixel"}),e=F(t,e,{zIndex:u?u.parent?.getChildIndex(u):void 0}),u?.parent?.setChildIndex(u,u.parent.getChildIndex(u)-.1),l&&f.copyCanvasElementProperty(l,t),l&&f.tickers.transfer(l,t,"move"),c||(e instanceof v||e instanceof P?c=e.positionInfo:c={x:e.x,y:e.y,type:"pixel"});let y={x:e.pivot.x,y:e.pivot.y},x={x:e.scale.x,y:e.scale.y};if(l)if(i.removeOldComponentWithZoomOut){let le=Ge(l,{...i,autoplay:false,completeOnContinue:a},n);le&&(s.push(...le),o.push(...le));}else p.push(l);(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),r==="up"?(e.pivot.y=f.height-e.y,e.pivot.x=f.width/2-e.x,e.y=f.height,e.x=f.width/2):r==="down"?(e.pivot.y=0-e.y,e.pivot.x=f.width/2-e.x,e.y=0,e.x=f.width/2):r==="left"?(e.pivot.x=f.width-e.x,e.pivot.y=f.height/2-e.y,e.x=f.width,e.y=f.height/2):r==="right"&&(e.pivot.x=0-e.x,e.pivot.y=f.height/2-e.y,e.x=0,e.y=f.height/2),e.pivot=h.getPointBySuperPoint(e.pivot,e.angle),e.scale.set(0);let T=f.tickers.pause({canvasAlias:t});o.push(...T);let C=f.animate(t,{...Ie(c),pivotX:y.x,pivotY:y.y,scaleX:x.x,scaleY:x.y},{...d,tickerIdToResume:o,aliasToRemoveAfter:p,completeOnContinue:a},n);if(C&&s.push(C),s.length>0)return s}function Ge(t,e={},i){let{direction:n="right",completeOnContinue:r=true,aliasToRemoveAfter:a=[],...o}=e;typeof a=="string"&&(a=[a]),a.push(t);let p=f.find(t);if(!p){e$1.warn(`The canvas component "${t}" is not found.`);return}let d={x:p.x,y:p.y},s={x:p.pivot.x,y:p.pivot.y};n==="down"?(d.y=f.height,d.x=f.width/2,s.y=f.height-d.y,s.x=f.width/2-d.x):n==="up"?(d.y=0,d.x=f.width/2,s.y=0-d.y,s.x=f.width/2-d.x):n==="right"?(d.x=f.width,d.y=f.height/2,s.x=f.width-d.x,s.y=f.height/2-d.y):n==="left"&&(d.x=0,d.y=f.height/2,s.x=0-d.x,s.y=f.height/2-d.y),s=h.getPointBySuperPoint(s,p.angle),f.tickers.pause({canvasAlias:t});let c=f.animate(t,{...d,pivotX:s.x,pivotY:s.y,scaleX:0,scaleY:0},{...o,aliasToRemoveAfter:a,completeOnContinue:r},i);if(c)return [c]}async function _t(t,e,i={},n){let{direction:r="right",completeOnContinue:a=true,tickerIdToResume:o=[],...p}=i,d=[],s;e||(e=t),typeof o=="string"&&(o=[o]);let c,l=f.find(t);switch(l&&(c=`${t}_temp_push`,f.editAlias(t,c),l instanceof v||l instanceof P?s=l.positionInfo:s={x:l.x,y:l.y,type:"pixel"}),e=F(t,e,{zIndex:l?l.parent?.getChildIndex(l):void 0}),l?.parent?.setChildIndex(l,l.parent.getChildIndex(l)-.1),c&&f.copyCanvasElementProperty(c,t),c&&f.tickers.transfer(c,t,"move"),s||((e instanceof v||e instanceof P)&&e.haveEmptyTexture?s=e.positionInfo:s={x:e.x,y:e.y,type:"pixel"}),(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),r){case "up":e.y=f.height+e.height;break;case "down":e.y=-e.height;break;case "left":e.x=f.width+e.width;break;case "right":e.x=-e.width;break}let u=f.tickers.pause({canvasAlias:t});if(o.push(...u),c){let x=Ne(c,{...i,direction:r,completeOnContinue:a});x&&d.push(...x);}let y=f.animate(t,Ie(s),{...p,tickerIdToResume:o,completeOnContinue:a},n);if(y&&d.push(y),d.length>0)return d}function Ne(t,e={direction:"right"},i){return ke(t,e,i)}var K=class extends _{constructor(i){super(i);this._memory=i;this.pixivnId=i.pixivnId;}_memory;pixivnId;get memory(){return {...this._memory,...super.memory,elements:[],pixivnId:this.pixivnId}}};function wt(){return async(e,i)=>{try{let n=e.canvasElementInfo;if(n){let r=new K(n),a=n.zIndex;r.groupColor=16711680;let o=new B.Graphics;o.rect(0,0,300,100).fill({color:16711680,alpha:.5}),r.addChild(o);let p=new B.Text({text:`Error: ${n.label}`,x:10,y:10});r.addChild(p);let d=e.parent;if(d&&"addChild"in d)a!==void 0?d.addChildAt(r,a):d.addChild(r);else {let s=n.parentLabel?f.find(n.parentLabel):void 0;if(s)a!==void 0?s.addChildAt(r,a):s.addChild(r);else {let c=n.label??n.pixivnId;f.add(c,r,{zIndex:a});}}}}catch{}}}function Ot(t,e,i){let n={...f.find(t)?.memory,...i},r=new z({text:e,...i});return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}var {Assets:Mn,Color:_n,Rectangle:wn,TextStyle:On,Texture:Bn,UPDATE_PRIORITY:Ln}=B,f=new G;I.init({getScreen:()=>f.screen});GameUnifier.addOnPreContinue(async()=>{try{let t=g._tickersToCompleteOnStepEnd.tikersIds,e=g._tickersToCompleteOnStepEnd.stepAlias,i=(async()=>{for(;t.length;){let{id:r}=t.pop()||{};r&&await f.tickers.forceCompletion(r);}})(),n=(async()=>{for(;e.length;){let{alias:r,id:a}=e.pop()||{};r&&a&&await f.tickers.forceCompletion(a,r);}})();await Promise.all([i,n]),g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.stepAlias.length=0;}catch{}});
2
+ export{Mn as Assets,ae as CanvasBaseItem,g as CanvasManagerStatic,h as CanvasPropertyUtility,_n as Color,_ as Container,P as ImageContainer,v as ImageSprite,wn as Rectangle,k as RegisteredCanvasComponents,ge as RegisteredEvents,D as RegisteredTickers,H as Sprite,z as Text,On as TextStyle,Bn as Texture,ee as TickerBase,Ln as UPDATE_PRIORITY,M as VideoSprite,ce as addImage,oe as addImageCointainer,O as addListenerHandler,de as addVideo,A as analizePositionsExtensionProps,f as canvas,Je as canvasComponentDecorator,wt as drawCanvasErrorHandler,Ze as eventDecorator,N as getTexture,Et as moveIn,ke as moveOut,_t as pushIn,Ne as pushOut,pe as removeWithDissolve,At as removeWithFade,S as setMemoryContainer,It as shakeEffect,Ct as showImage,kt as showImageContainer,Ot as showText,St as showVideo,qe as showWithDissolve,bt as showWithFade,ct as tickerDecorator,Mt as zoomIn,Ge as zoomOut};
@@ -1 +1 @@
1
- 'use strict';var core=require('@drincs/pixi-vn/core');var se=Object.defineProperty;var kt=u=>{throw TypeError(u)};var ae=(u,t,i)=>t in u?se(u,t,{enumerable:true,configurable:true,writable:true,value:i}):u[t]=i;var N=(u,t,i)=>ae(u,typeof t!="symbol"?t+"":t,i),Yt=(u,t,i)=>t.has(u)||kt("Cannot "+i);var e=(u,t,i)=>(Yt(u,t,"read from private field"),i?i.call(u):t.get(u)),_=(u,t,i)=>t.has(u)?kt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(u):t.set(u,i),f=(u,t,i,r)=>(Yt(u,t,"write to private field"),t.set(u,i),i),c=(u,t,i)=>(Yt(u,t,"access private method"),i);var Mt=(u,t,i,r)=>({set _(s){f(u,t,s);},get _(){return e(u,t,r)}});var st="storage",ut="temp",Ft="flags",U={CHARACTER_CATEGORY_KEY:"character"};var oe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,qt=new Set,Kt=typeof process=="object"&&process?process:{},Qt=(u,t,i,r)=>{typeof Kt.emitWarning=="function"?Kt.emitWarning(u,t,i,r):console.error(`[${i}] ${t}: ${u}`);},Pt=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof Pt>"u"){Bt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,r){this._onabort.push(r);}},Pt=class{constructor(){t();}signal=new Bt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let r of this.signal._onabort)r(i);this.signal.onabort?.(i);}}};let u=Kt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{u&&(u=false,Qt("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 ne=u=>!qt.has(u);var at=u=>u&&u===Math.floor(u)&&u>0&&isFinite(u),Zt=u=>at(u)?u<=Math.pow(2,8)?Uint8Array:u<=Math.pow(2,16)?Uint16Array:u<=Math.pow(2,32)?Uint32Array:u<=Number.MAX_SAFE_INTEGER?Gt:null:null,Gt=class extends Array{constructor(u){super(u),this.fill(0);}},et,Et,he=(et=class{heap;length;static create(t){let i=Zt(t);if(!i)return [];f(et,Et,true);let r=new et(t,i);return f(et,Et,false),r}constructor(t,i){if(!e(et,Et))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Et=new WeakMap,_(et,Et,false),et),Xt,Jt,j,z,k,ft,B,Tt,yt,X,R,J,x,O,d,V,Y,M,I,q,D,Q,Z,K,W,tt,lt,L,bt,n,Wt,dt,rt,Ct,H,ee,gt,At,It,ot,nt,Ht,Vt,Lt,v,$t,Rt,ht,jt,vt,te=(vt=class{constructor(t){_(this,n);_(this,j);_(this,z);_(this,k);_(this,ft);_(this,B);_(this,Tt);_(this,yt);_(this,X);N(this,"ttl");N(this,"ttlResolution");N(this,"ttlAutopurge");N(this,"updateAgeOnGet");N(this,"updateAgeOnHas");N(this,"allowStale");N(this,"noDisposeOnSet");N(this,"noUpdateTTL");N(this,"maxEntrySize");N(this,"sizeCalculation");N(this,"noDeleteOnFetchRejection");N(this,"noDeleteOnStaleGet");N(this,"allowStaleOnFetchAbort");N(this,"allowStaleOnFetchRejection");N(this,"ignoreFetchAbort");_(this,R);_(this,J);_(this,x);_(this,O);_(this,d);_(this,V);_(this,Y);_(this,M);_(this,I);_(this,q);_(this,D);_(this,Q);_(this,Z);_(this,K);_(this,W);_(this,tt);_(this,lt);_(this,L);_(this,bt);_(this,dt,()=>{});_(this,rt,()=>{});_(this,Ct,()=>{});_(this,H,()=>false);_(this,gt,t=>{});_(this,At,(t,i,r)=>{});_(this,It,(t,i,r,s)=>{if(r||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});N(this,Xt,"LRUCache");let{max:i=0,ttl:r,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:h,allowStale:l,dispose:S,onInsert:C,disposeAfter:g,noDisposeOnSet:y,noUpdateTTL:T,maxSize:E=0,maxEntrySize:b=0,sizeCalculation:A,fetchMethod:p,memoMethod:F,noDeleteOnFetchRejection:P,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:xt,ignoreFetchAbort:_t,perf:mt}=t;if(mt!==void 0&&typeof mt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,mt??oe),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let St=i?Zt(i):Array;if(!St)throw new Error("invalid max value: "+i);if(f(this,j,i),f(this,z,E),this.maxEntrySize=b||e(this,z),this.sizeCalculation=A,this.sizeCalculation){if(!e(this,z)&&!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(F!==void 0&&typeof F!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,yt,F),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,Tt,p),f(this,lt,!!p),f(this,x,new Map),f(this,O,new Array(i).fill(void 0)),f(this,d,new Array(i).fill(void 0)),f(this,V,new St(i)),f(this,Y,new St(i)),f(this,M,0),f(this,I,0),f(this,q,he.create(i)),f(this,R,0),f(this,J,0),typeof S=="function"&&f(this,k,S),typeof C=="function"&&f(this,ft,C),typeof g=="function"?(f(this,B,g),f(this,D,[])):(f(this,B,void 0),f(this,D,void 0)),f(this,tt,!!e(this,k)),f(this,bt,!!e(this,ft)),f(this,L,!!e(this,B)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!T,this.noDeleteOnFetchRejection=!!P,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!xt,this.ignoreFetchAbort=!!_t,this.maxEntrySize!==0){if(e(this,z)!==0&&!at(e(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");c(this,n,ee).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!h,this.ttlResolution=at(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=r||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");c(this,n,Wt).call(this);}if(e(this,j)===0&&this.ttl===0&&e(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,j)&&!e(this,z)){let zt="LRU_CACHE_UNBOUNDED";ne(zt)&&(qt.add(zt),Qt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",zt,vt));}}get perf(){return e(this,X)}static unsafeExposeInternals(t){return {starts:e(t,Z),ttls:e(t,K),autopurgeTimers:e(t,W),sizes:e(t,Q),keyMap:e(t,x),keyList:e(t,O),valList:e(t,d),next:e(t,V),prev:e(t,Y),get head(){return e(t,M)},get tail(){return e(t,I)},free:e(t,q),isBackgroundFetch:i=>{var r;return c(r=t,n,v).call(r,i)},backgroundFetch:(i,r,s,o)=>{var a;return c(a=t,n,Lt).call(a,i,r,s,o)},moveToTail:i=>{var r;return c(r=t,n,Rt).call(r,i)},indexes:i=>{var r;return c(r=t,n,ot).call(r,i)},rindexes:i=>{var r;return c(r=t,n,nt).call(r,i)},isStale:i=>{var r;return e(r=t,H).call(r,i)}}}get max(){return e(this,j)}get maxSize(){return e(this,z)}get calculatedSize(){return e(this,J)}get size(){return e(this,R)}get fetchMethod(){return e(this,Tt)}get memoMethod(){return e(this,yt)}get dispose(){return e(this,k)}get onInsert(){return e(this,ft)}get disposeAfter(){return e(this,B)}getRemainingTTL(t){return e(this,x).has(t)?1/0:0}*entries(){for(let t of c(this,n,ot).call(this))e(this,d)[t]!==void 0&&e(this,O)[t]!==void 0&&!c(this,n,v).call(this,e(this,d)[t])&&(yield [e(this,O)[t],e(this,d)[t]]);}*rentries(){for(let t of c(this,n,nt).call(this))e(this,d)[t]!==void 0&&e(this,O)[t]!==void 0&&!c(this,n,v).call(this,e(this,d)[t])&&(yield [e(this,O)[t],e(this,d)[t]]);}*keys(){for(let t of c(this,n,ot).call(this)){let i=e(this,O)[t];i!==void 0&&!c(this,n,v).call(this,e(this,d)[t])&&(yield i);}}*rkeys(){for(let t of c(this,n,nt).call(this)){let i=e(this,O)[t];i!==void 0&&!c(this,n,v).call(this,e(this,d)[t])&&(yield i);}}*values(){for(let t of c(this,n,ot).call(this))e(this,d)[t]!==void 0&&!c(this,n,v).call(this,e(this,d)[t])&&(yield e(this,d)[t]);}*rvalues(){for(let t of c(this,n,nt).call(this))e(this,d)[t]!==void 0&&!c(this,n,v).call(this,e(this,d)[t])&&(yield e(this,d)[t]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){return this.entries()}find(t,i={}){for(let r of c(this,n,ot).call(this)){let s=e(this,d)[r],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,e(this,O)[r],this))return this.get(e(this,O)[r],i)}}forEach(t,i=this){for(let r of c(this,n,ot).call(this)){let s=e(this,d)[r],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(i,o,e(this,O)[r],this);}}rforEach(t,i=this){for(let r of c(this,n,nt).call(this)){let s=e(this,d)[r],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(i,o,e(this,O)[r],this);}}purgeStale(){let t=false;for(let i of c(this,n,nt).call(this,{allowStale:true}))e(this,H).call(this,i)&&(c(this,n,ht).call(this,e(this,O)[i],"expire"),t=true);return t}info(t){let i=e(this,x).get(t);if(i===void 0)return;let r=e(this,d)[i],s=c(this,n,v).call(this,r)?r.__staleWhileFetching:r;if(s===void 0)return;let o={value:s};if(e(this,K)&&e(this,Z)){let a=e(this,K)[i],h=e(this,Z)[i];if(a&&h){let l=a-(e(this,X).now()-h);o.ttl=l,o.start=Date.now();}}return e(this,Q)&&(o.size=e(this,Q)[i]),o}dump(){let t=[];for(let i of c(this,n,ot).call(this,{allowStale:true})){let r=e(this,O)[i],s=e(this,d)[i],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||r===void 0)continue;let a={value:o};if(e(this,K)&&e(this,Z)){a.ttl=e(this,K)[i];let h=e(this,X).now()-e(this,Z)[i];a.start=Math.floor(Date.now()-h);}e(this,Q)&&(a.size=e(this,Q)[i]),t.unshift([r,a]);}return t}load(t){this.clear();for(let[i,r]of t){if(r.start){let s=Date.now()-r.start;r.start=e(this,X).now()-s;}this.set(i,r.value,r);}}set(t,i,r={}){var y,T,E,b;if(i===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:l}=r,{noUpdateTTL:S=this.noUpdateTTL}=r,C=e(this,It).call(this,t,i,r.size||0,h);if(this.maxEntrySize&&C>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),c(this,n,ht).call(this,t,"set"),this;let g=e(this,R)===0?void 0:e(this,x).get(t);if(g===void 0)g=e(this,R)===0?e(this,I):e(this,q).length!==0?e(this,q).pop():e(this,R)===e(this,j)?c(this,n,Vt).call(this,false):e(this,R),e(this,O)[g]=t,e(this,d)[g]=i,e(this,x).set(t,g),e(this,V)[e(this,I)]=g,e(this,Y)[g]=e(this,I),f(this,I,g),Mt(this,R)._++,e(this,At).call(this,g,C,l),l&&(l.set="add"),S=false,e(this,bt)&&((y=e(this,ft))==null||y.call(this,i,t,"add"));else {c(this,n,Rt).call(this,g);let A=e(this,d)[g];if(i!==A){if(e(this,lt)&&c(this,n,v).call(this,A)){A.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=A;p!==void 0&&!a&&(e(this,tt)&&((T=e(this,k))==null||T.call(this,p,t,"set")),e(this,L)&&e(this,D)?.push([p,t,"set"]));}else a||(e(this,tt)&&((E=e(this,k))==null||E.call(this,A,t,"set")),e(this,L)&&e(this,D)?.push([A,t,"set"]));if(e(this,gt).call(this,g),e(this,At).call(this,g,C,l),e(this,d)[g]=i,l){l.set="replace";let p=A&&c(this,n,v).call(this,A)?A.__staleWhileFetching:A;p!==void 0&&(l.oldValue=p);}}else l&&(l.set="update");e(this,bt)&&this.onInsert?.(i,t,i===A?"update":"replace");}if(s!==0&&!e(this,K)&&c(this,n,Wt).call(this),e(this,K)&&(S||e(this,Ct).call(this,g,s,o),l&&e(this,rt).call(this,l,g)),!a&&e(this,L)&&e(this,D)){let A=e(this,D),p;for(;p=A?.shift();)(b=e(this,B))==null||b.call(this,...p);}return this}pop(){var t;try{for(;e(this,R);){let i=e(this,d)[e(this,M)];if(c(this,n,Vt).call(this,!0),c(this,n,v).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(e(this,L)&&e(this,D)){let i=e(this,D),r;for(;r=i?.shift();)(t=e(this,B))==null||t.call(this,...r);}}}has(t,i={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:s}=i,o=e(this,x).get(t);if(o!==void 0){let a=e(this,d)[o];if(c(this,n,v).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(e(this,H).call(this,o))s&&(s.has="stale",e(this,rt).call(this,s,o));else return r&&e(this,dt).call(this,o),s&&(s.has="hit",e(this,rt).call(this,s,o)),true}else s&&(s.has="miss");return false}peek(t,i={}){let{allowStale:r=this.allowStale}=i,s=e(this,x).get(t);if(s===void 0||!r&&e(this,H).call(this,s))return;let o=e(this,d)[s];return c(this,n,v).call(this,o)?o.__staleWhileFetching:o}async fetch(t,i={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:l=0,sizeCalculation:S=this.sizeCalculation,noUpdateTTL:C=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:T=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:b,forceRefresh:A=false,status:p,signal:F}=i;if(!e(this,lt))return p&&(p.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:p});let P={allowStale:r,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:h,size:l,sizeCalculation:S,noUpdateTTL:C,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:E,ignoreFetchAbort:T,status:p,signal:F},G=e(this,x).get(t);if(G===void 0){p&&(p.fetch="miss");let w=c(this,n,Lt).call(this,t,G,P,b);return w.__returned=w}else {let w=e(this,d)[G];if(c(this,n,v).call(this,w)){let St=r&&w.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",St&&(p.returnedStale=true)),St?w.__staleWhileFetching:w.__returned=w}let xt=e(this,H).call(this,G);if(!A&&!xt)return p&&(p.fetch="hit"),c(this,n,Rt).call(this,G),s&&e(this,dt).call(this,G),p&&e(this,rt).call(this,p,G),w;let _t=c(this,n,Lt).call(this,t,G,P,b),mt=_t.__staleWhileFetching!==void 0&&r;return p&&(p.fetch=xt?"stale":"refresh",mt&&xt&&(p.returnedStale=true)),mt?_t.__staleWhileFetching:_t.__returned=_t}}async forceFetch(t,i={}){let r=await this.fetch(t,i);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,i={}){let r=e(this,yt);if(!r)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...a}=i,h=this.get(t,a);if(!o&&h!==void 0)return h;let l=r(t,h,{options:a,context:s});return this.set(t,l,a),l}get(t,i={}){let{allowStale:r=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=i,h=e(this,x).get(t);if(h!==void 0){let l=e(this,d)[h],S=c(this,n,v).call(this,l);return a&&e(this,rt).call(this,a,h),e(this,H).call(this,h)?(a&&(a.get="stale"),S?(a&&r&&l.__staleWhileFetching!==void 0&&(a.returnedStale=true),r?l.__staleWhileFetching:void 0):(o||c(this,n,ht).call(this,t,"expire"),a&&r&&(a.returnedStale=true),r?l:void 0)):(a&&(a.get="hit"),S?l.__staleWhileFetching:(c(this,n,Rt).call(this,h),s&&e(this,dt).call(this,h),l))}else a&&(a.get="miss");}delete(t){return c(this,n,ht).call(this,t,"delete")}clear(){return c(this,n,jt).call(this,"delete")}},j=new WeakMap,z=new WeakMap,k=new WeakMap,ft=new WeakMap,B=new WeakMap,Tt=new WeakMap,yt=new WeakMap,X=new WeakMap,R=new WeakMap,J=new WeakMap,x=new WeakMap,O=new WeakMap,d=new WeakMap,V=new WeakMap,Y=new WeakMap,M=new WeakMap,I=new WeakMap,q=new WeakMap,D=new WeakMap,Q=new WeakMap,Z=new WeakMap,K=new WeakMap,W=new WeakMap,tt=new WeakMap,lt=new WeakMap,L=new WeakMap,bt=new WeakMap,n=new WeakSet,Wt=function(){let t=new Gt(e(this,j)),i=new Gt(e(this,j));f(this,K,t),f(this,Z,i);let r=this.ttlAutopurge?new Array(e(this,j)):void 0;f(this,W,r),f(this,Ct,(h,l,S=e(this,X).now())=>{i[h]=l!==0?S:0,t[h]=l,s(h,l);}),f(this,dt,h=>{i[h]=t[h]!==0?e(this,X).now():0,s(h,t[h]);});let s=this.ttlAutopurge?(h,l)=>{if(r?.[h]&&(clearTimeout(r[h]),r[h]=void 0),l&&l!==0&&r){let S=setTimeout(()=>{e(this,H).call(this,h)&&c(this,n,ht).call(this,e(this,O)[h],"expire");},l+1);S.unref&&S.unref(),r[h]=S;}}:()=>{};f(this,rt,(h,l)=>{if(t[l]){let S=t[l],C=i[l];if(!S||!C)return;h.ttl=S,h.start=C,h.now=o||a();let g=h.now-C;h.remainingTTL=S-g;}});let o=0,a=()=>{let h=e(this,X).now();if(this.ttlResolution>0){o=h;let l=setTimeout(()=>o=0,this.ttlResolution);l.unref&&l.unref();}return h};this.getRemainingTTL=h=>{let l=e(this,x).get(h);if(l===void 0)return 0;let S=t[l],C=i[l];if(!S||!C)return 1/0;let g=(o||a())-C;return S-g},f(this,H,h=>{let l=i[h],S=t[h];return !!S&&!!l&&(o||a())-l>S});},dt=new WeakMap,rt=new WeakMap,Ct=new WeakMap,H=new WeakMap,ee=function(){let t=new Gt(e(this,j));f(this,J,0),f(this,Q,t),f(this,gt,i=>{f(this,J,e(this,J)-t[i]),t[i]=0;}),f(this,It,(i,r,s,o)=>{if(c(this,n,v).call(this,r))return 0;if(!at(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(r,i),!at(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}),f(this,At,(i,r,s)=>{if(t[i]=r,e(this,z)){let o=e(this,z)-t[i];for(;e(this,J)>o;)c(this,n,Vt).call(this,true);}f(this,J,e(this,J)+t[i]),s&&(s.entrySize=r,s.totalCalculatedSize=e(this,J));});},gt=new WeakMap,At=new WeakMap,It=new WeakMap,ot=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,I);!(!c(this,n,Ht).call(this,i)||((t||!e(this,H).call(this,i))&&(yield i),i===e(this,M)));)i=e(this,Y)[i];},nt=function*({allowStale:t=this.allowStale}={}){if(e(this,R))for(let i=e(this,M);!(!c(this,n,Ht).call(this,i)||((t||!e(this,H).call(this,i))&&(yield i),i===e(this,I)));)i=e(this,V)[i];},Ht=function(t){return t!==void 0&&e(this,x).get(e(this,O)[t])===t},Vt=function(t){var o;let i=e(this,M),r=e(this,O)[i],s=e(this,d)[i];return e(this,lt)&&c(this,n,v).call(this,s)?s.__abortController.abort(new Error("evicted")):(e(this,tt)||e(this,L))&&(e(this,tt)&&((o=e(this,k))==null||o.call(this,s,r,"evict")),e(this,L)&&e(this,D)?.push([s,r,"evict"])),e(this,gt).call(this,i),e(this,W)?.[i]&&(clearTimeout(e(this,W)[i]),e(this,W)[i]=void 0),t&&(e(this,O)[i]=void 0,e(this,d)[i]=void 0,e(this,q).push(i)),e(this,R)===1?(f(this,M,f(this,I,0)),e(this,q).length=0):f(this,M,e(this,V)[i]),e(this,x).delete(r),Mt(this,R)._--,i},Lt=function(t,i,r,s){let o=i===void 0?void 0:e(this,d)[i];if(c(this,n,v).call(this,o))return o;let a=new Pt,{signal:h}=r;h?.addEventListener("abort",()=>a.abort(h.reason),{signal:a.signal});let l={signal:a.signal,options:r,context:s},S=(b,A=false)=>{let{aborted:p}=a.signal,F=r.ignoreFetchAbort&&b!==void 0,P=r.ignoreFetchAbort||!!(r.allowStaleOnFetchAbort&&b!==void 0);if(r.status&&(p&&!A?(r.status.fetchAborted=true,r.status.fetchError=a.signal.reason,F&&(r.status.fetchAbortIgnored=true)):r.status.fetchResolved=true),p&&!F&&!A)return g(a.signal.reason,P);let G=T,w=e(this,d)[i];return (w===T||F&&A&&w===void 0)&&(b===void 0?G.__staleWhileFetching!==void 0?e(this,d)[i]=G.__staleWhileFetching:c(this,n,ht).call(this,t,"fetch"):(r.status&&(r.status.fetchUpdated=true),this.set(t,b,l.options))),b},C=b=>(r.status&&(r.status.fetchRejected=true,r.status.fetchError=b),g(b,false)),g=(b,A)=>{let{aborted:p}=a.signal,F=p&&r.allowStaleOnFetchAbort,P=F||r.allowStaleOnFetchRejection,G=P||r.noDeleteOnFetchRejection,w=T;if(e(this,d)[i]===T&&(!G||!A&&w.__staleWhileFetching===void 0?c(this,n,ht).call(this,t,"fetch"):F||(e(this,d)[i]=w.__staleWhileFetching)),P)return r.status&&w.__staleWhileFetching!==void 0&&(r.status.returnedStale=true),w.__staleWhileFetching;if(w.__returned===w)throw b},y=(b,A)=>{var F;let p=(F=e(this,Tt))==null?void 0:F.call(this,t,o,l);p&&p instanceof Promise&&p.then(P=>b(P===void 0?void 0:P),A),a.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(b(void 0),r.allowStaleOnFetchAbort&&(b=P=>S(P,true)));});};r.status&&(r.status.fetchDispatched=true);let T=new Promise(y).then(S,C),E=Object.assign(T,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(t,E,{...l.options,status:void 0}),i=e(this,x).get(t)):e(this,d)[i]=E,E},v=function(t){if(!e(this,lt))return false;let i=t;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Pt},$t=function(t,i){e(this,Y)[i]=t,e(this,V)[t]=i;},Rt=function(t){t!==e(this,I)&&(t===e(this,M)?f(this,M,e(this,V)[t]):c(this,n,$t).call(this,e(this,Y)[t],e(this,V)[t]),c(this,n,$t).call(this,e(this,I),t),f(this,I,t));},ht=function(t,i){var s,o;let r=false;if(e(this,R)!==0){let a=e(this,x).get(t);if(a!==void 0)if(e(this,W)?.[a]&&(clearTimeout(e(this,W)?.[a]),e(this,W)[a]=void 0),r=true,e(this,R)===1)c(this,n,jt).call(this,i);else {e(this,gt).call(this,a);let h=e(this,d)[a];if(c(this,n,v).call(this,h)?h.__abortController.abort(new Error("deleted")):(e(this,tt)||e(this,L))&&(e(this,tt)&&((s=e(this,k))==null||s.call(this,h,t,i)),e(this,L)&&e(this,D)?.push([h,t,i])),e(this,x).delete(t),e(this,O)[a]=void 0,e(this,d)[a]=void 0,a===e(this,I))f(this,I,e(this,Y)[a]);else if(a===e(this,M))f(this,M,e(this,V)[a]);else {let l=e(this,Y)[a];e(this,V)[l]=e(this,V)[a];let S=e(this,V)[a];e(this,Y)[S]=e(this,Y)[a];}Mt(this,R)._--,e(this,q).push(a);}}if(e(this,L)&&e(this,D)?.length){let a=e(this,D),h;for(;h=a?.shift();)(o=e(this,B))==null||o.call(this,...h);}return r},jt=function(t){var i,r;for(let s of c(this,n,nt).call(this,{allowStale:true})){let o=e(this,d)[s];if(c(this,n,v).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=e(this,O)[s];e(this,tt)&&((i=e(this,k))==null||i.call(this,o,a,t)),e(this,L)&&e(this,D)?.push([o,a,t]);}}if(e(this,x).clear(),e(this,d).fill(void 0),e(this,O).fill(void 0),e(this,K)&&e(this,Z)){e(this,K).fill(0),e(this,Z).fill(0);for(let s of e(this,W)??[])s!==void 0&&clearTimeout(s);e(this,W)?.fill(void 0);}if(e(this,Q)&&e(this,Q).fill(0),f(this,M,0),f(this,I,0),e(this,q).length=0,f(this,J,0),f(this,R,0),e(this,L)&&e(this,D)){let s=e(this,D),o;for(;o=s?.shift();)(r=e(this,B))==null||r.call(this,...o);}},vt);var ct=class{cache;map=new Map;constructor(t){this.cache=new te({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(t){let i=this.map.delete(t);return i&&this.cache.delete(t),i}get forEach(){return this.map.forEach}get(t){let i=this.cache.get(t);return i||this.map.get(t)}has(t){return this.map.has(t)}set(t,i){return this.map.set(t,i),this.cache.set(t,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var it;(s=>(s.log=(o,...a)=>console.log(`[Pixi\u2019VN] ${o}`,...a),s.warn=(o,...a)=>console.warn(`[Pixi\u2019VN] ${o}`,...a),s.error=(o,...a)=>console.error(`[Pixi\u2019VN] ${o}`,...a),s.info=(o,...a)=>console.info(`[Pixi\u2019VN] ${o}`,...a)))(it||={});function Dt(u){try{if(typeof u>"u")return u;let t=JSON.stringify(u);return JSON.parse(t)}catch(t){throw it.error("Error creating exportable element",u,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ie;(g=>{g.storage=new ct({cacheSize:50}),g.defaultStorage=new ct({cacheSize:10}),g.tempStorageDeadlines=new Map;let r;function s(y){g.tempStorageDeadlines.forEach((T,E)=>{T>y&&(g.storage.delete(`${ut}:${E}`),r?.onClearOldTempVariable?.(E),g.tempStorageDeadlines.delete(E));});}g.clearOldTempVariables=s;function o(y){r=y;}g.setExternalStoreHandler=o;function a(y,T,E){E==null?g.storage.delete(`${y}:${T}`):g.storage.set(`${y}:${T}`,E),r?.onSetVariable?.(T,E);}g.setVariable=a;function h(y,T){let E=g.storage.get(`${y}:${T}`);return Dt(E)}g.getVariable=h;function l(y,T){g.storage.delete(`${y}:${T}`),r?.onRemoveVariable?.(T);}g.removeVariable=l;function S(y,T){let E=g.storage.get(Ft)||[];if(T)E.includes(y)||E.push(y);else {let b=E.indexOf(y);b>-1&&E.splice(b,1);}g.storage.set(Ft,E);}g.setFlag=S;function C(y){return (g.storage.get(Ft)||[]).includes(y)}g.getFlag=C;})(ie||={});var m=ie;var Ot=class{constructor(t,i){this.categoryId=t,this.id=i,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let i=m.getVariable(st,t);i&&(Object.entries(i).forEach(([r,s])=>{typeof s=="object"&&s!==null&&Object.entries(s).forEach(([o,a])=>{m.setVariable(this.categoryId,`${r}:${o}`,a);});}),m.removeVariable(st,t));}id;categoryId;setStorageProperty(t,i){m.setVariable(this.categoryId,`${this.id}:${t}`,i);}getStorageProperty(t,i=this.id){return m.getVariable(this.categoryId,`${i}:${t}`)}};var ue="@",wt=class extends Ot{sourceId;constructor(t,i=""){super(U.CHARACTER_CATEGORY_KEY,t+(i?ue+i:"")),this.sourceId=t,this.migrateOldStorage("___character___");}getStorageProperty(t){let i=super.getStorageProperty(t);return i===void 0&&(i=super.getStorageProperty(t,this.sourceId)),i}};var Ut=class extends wt{constructor(t,i){super(typeof t=="string"?t:t.id,typeof t=="string"?"":t.emotion),this.defaultName=i.name,this.defaultSurname=i.surname,this.defaultAge=i.age,this.icon=i.icon,this.color=i.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(t){this.setStorageProperty("name",t);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(t){this.setStorageProperty("surname",t);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(t){this.setStorageProperty("age",t);}icon;color};var pt=new ct({cacheSize:10}),re;(a=>{function u(h){try{let l=pt.get(h);if(!l){it.warn(`Character "${h}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return l}catch(l){it.error(`Error while getting Character "${h}"`,l);return}}a.get=u;function t(...h){for(let l of h){if(Array.isArray(l)){t(...l);continue}pt.get(l.id)&&it.info(`Character id "${l.id}" already exists, it will be overwritten`),pt.set(l.id,l);}}a.add=t;function i(){return Array.from(pt.values())}a.values=i;function r(h){return pt.has(h)}a.has=r;function s(){return Array.from(pt.keys())}a.keys=s;function o(){pt.clear();}a.clear=o;})(re||={});var fe=re;exports.CharacterBaseModel=Ut;exports.CharacterStoredClass=wt;exports.RegisteredCharacters=fe;
1
+ 'use strict';var core=require('@drincs/pixi-vn/core');var se=Object.defineProperty;var kt=f=>{throw TypeError(f)};var ae=(f,t,r)=>t in f?se(f,t,{enumerable:true,configurable:true,writable:true,value:r}):f[t]=r;var F=(f,t,r)=>ae(f,typeof t!="symbol"?t+"":t,r),Yt=(f,t,r)=>t.has(f)||kt("Cannot "+r);var e=(f,t,r)=>(Yt(f,t,"read from private field"),r?r.call(f):t.get(f)),_=(f,t,r)=>t.has(f)?kt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(f):t.set(f,r),u=(f,t,r,i)=>(Yt(f,t,"write to private field"),t.set(f,r),r),c=(f,t,r)=>(Yt(f,t,"access private method"),r);var Mt=(f,t,r,i)=>({set _(s){u(f,t,s);},get _(){return e(f,t,i)}});var st="storage",ft="temp",Dt="flags",z={CHARACTER_CATEGORY_KEY:"character"};var oe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,qt=new Set,Kt=typeof process=="object"&&process?process:{},Qt=(f,t,r,i)=>{typeof Kt.emitWarning=="function"?Kt.emitWarning(f,t,r,i):console.error(`[${r}] ${t}: ${f}`);},Ut=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof Ut>"u"){Bt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(r,i){this._onabort.push(i);}},Ut=class{constructor(){t();}signal=new Bt;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r);}}};let f=Kt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{f&&(f=false,Qt("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 ne=f=>!qt.has(f);var at=f=>f&&f===Math.floor(f)&&f>0&&isFinite(f),Zt=f=>at(f)?f<=Math.pow(2,8)?Uint8Array:f<=Math.pow(2,16)?Uint16Array:f<=Math.pow(2,32)?Uint32Array:f<=Number.MAX_SAFE_INTEGER?Gt:null:null,Gt=class extends Array{constructor(f){super(f),this.fill(0);}},et,Et,he=(et=class{heap;length;static create(t){let r=Zt(t);if(!r)return [];u(et,Et,true);let i=new et(t,r);return u(et,Et,false),i}constructor(t,r){if(!e(et,Et))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Et=new WeakMap,_(et,Et,false),et),Xt,Jt,j,P,k,ut,B,Tt,yt,X,I,J,x,O,g,L,Y,M,C,q,N,Q,Z,K,W,tt,lt,V,bt,n,Wt,gt,it,Rt,H,ee,dt,At,Ct,ot,nt,Ht,Lt,Vt,v,$t,It,ht,jt,vt,te=(vt=class{constructor(t){_(this,n);_(this,j);_(this,P);_(this,k);_(this,ut);_(this,B);_(this,Tt);_(this,yt);_(this,X);F(this,"ttl");F(this,"ttlResolution");F(this,"ttlAutopurge");F(this,"updateAgeOnGet");F(this,"updateAgeOnHas");F(this,"allowStale");F(this,"noDisposeOnSet");F(this,"noUpdateTTL");F(this,"maxEntrySize");F(this,"sizeCalculation");F(this,"noDeleteOnFetchRejection");F(this,"noDeleteOnStaleGet");F(this,"allowStaleOnFetchAbort");F(this,"allowStaleOnFetchRejection");F(this,"ignoreFetchAbort");_(this,I);_(this,J);_(this,x);_(this,O);_(this,g);_(this,L);_(this,Y);_(this,M);_(this,C);_(this,q);_(this,N);_(this,Q);_(this,Z);_(this,K);_(this,W);_(this,tt);_(this,lt);_(this,V);_(this,bt);_(this,gt,()=>{});_(this,it,()=>{});_(this,Rt,()=>{});_(this,H,()=>false);_(this,dt,t=>{});_(this,At,(t,r,i)=>{});_(this,Ct,(t,r,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});F(this,Xt,"LRUCache");let{max:r=0,ttl:i,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:h,allowStale:l,dispose:S,onInsert:R,disposeAfter:d,noDisposeOnSet:y,noUpdateTTL:T,maxSize:E=0,maxEntrySize:b=0,sizeCalculation:A,fetchMethod:p,memoMethod:D,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:xt,ignoreFetchAbort:_t,perf:mt}=t;if(mt!==void 0&&typeof mt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,X,mt??oe),r!==0&&!at(r))throw new TypeError("max option must be a nonnegative integer");let St=r?Zt(r):Array;if(!St)throw new Error("invalid max value: "+r);if(u(this,j,r),u(this,P,E),this.maxEntrySize=b||e(this,P),this.sizeCalculation=A,this.sizeCalculation){if(!e(this,P)&&!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(D!==void 0&&typeof D!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,yt,D),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,Tt,p),u(this,lt,!!p),u(this,x,new Map),u(this,O,new Array(r).fill(void 0)),u(this,g,new Array(r).fill(void 0)),u(this,L,new St(r)),u(this,Y,new St(r)),u(this,M,0),u(this,C,0),u(this,q,he.create(r)),u(this,I,0),u(this,J,0),typeof S=="function"&&u(this,k,S),typeof R=="function"&&u(this,ut,R),typeof d=="function"?(u(this,B,d),u(this,N,[])):(u(this,B,void 0),u(this,N,void 0)),u(this,tt,!!e(this,k)),u(this,bt,!!e(this,ut)),u(this,V,!!e(this,B)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!T,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!xt,this.ignoreFetchAbort=!!_t,this.maxEntrySize!==0){if(e(this,P)!==0&&!at(e(this,P)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");c(this,n,ee).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!h,this.ttlResolution=at(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");c(this,n,Wt).call(this);}if(e(this,j)===0&&this.ttl===0&&e(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,j)&&!e(this,P)){let Pt="LRU_CACHE_UNBOUNDED";ne(Pt)&&(qt.add(Pt),Qt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,vt));}}get perf(){return e(this,X)}static unsafeExposeInternals(t){return {starts:e(t,Z),ttls:e(t,K),autopurgeTimers:e(t,W),sizes:e(t,Q),keyMap:e(t,x),keyList:e(t,O),valList:e(t,g),next:e(t,L),prev:e(t,Y),get head(){return e(t,M)},get tail(){return e(t,C)},free:e(t,q),isBackgroundFetch:r=>{var i;return c(i=t,n,v).call(i,r)},backgroundFetch:(r,i,s,o)=>{var a;return c(a=t,n,Vt).call(a,r,i,s,o)},moveToTail:r=>{var i;return c(i=t,n,It).call(i,r)},indexes:r=>{var i;return c(i=t,n,ot).call(i,r)},rindexes:r=>{var i;return c(i=t,n,nt).call(i,r)},isStale:r=>{var i;return e(i=t,H).call(i,r)}}}get max(){return e(this,j)}get maxSize(){return e(this,P)}get calculatedSize(){return e(this,J)}get size(){return e(this,I)}get fetchMethod(){return e(this,Tt)}get memoMethod(){return e(this,yt)}get dispose(){return e(this,k)}get onInsert(){return e(this,ut)}get disposeAfter(){return e(this,B)}getRemainingTTL(t){return e(this,x).has(t)?1/0:0}*entries(){for(let t of c(this,n,ot).call(this))e(this,g)[t]!==void 0&&e(this,O)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield [e(this,O)[t],e(this,g)[t]]);}*rentries(){for(let t of c(this,n,nt).call(this))e(this,g)[t]!==void 0&&e(this,O)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield [e(this,O)[t],e(this,g)[t]]);}*keys(){for(let t of c(this,n,ot).call(this)){let r=e(this,O)[t];r!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield r);}}*rkeys(){for(let t of c(this,n,nt).call(this)){let r=e(this,O)[t];r!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield r);}}*values(){for(let t of c(this,n,ot).call(this))e(this,g)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}*rvalues(){for(let t of c(this,n,nt).call(this))e(this,g)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){return this.entries()}find(t,r={}){for(let i of c(this,n,ot).call(this)){let s=e(this,g)[i],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,e(this,O)[i],this))return this.get(e(this,O)[i],r)}}forEach(t,r=this){for(let i of c(this,n,ot).call(this)){let s=e(this,g)[i],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,e(this,O)[i],this);}}rforEach(t,r=this){for(let i of c(this,n,nt).call(this)){let s=e(this,g)[i],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,e(this,O)[i],this);}}purgeStale(){let t=false;for(let r of c(this,n,nt).call(this,{allowStale:true}))e(this,H).call(this,r)&&(c(this,n,ht).call(this,e(this,O)[r],"expire"),t=true);return t}info(t){let r=e(this,x).get(t);if(r===void 0)return;let i=e(this,g)[r],s=c(this,n,v).call(this,i)?i.__staleWhileFetching:i;if(s===void 0)return;let o={value:s};if(e(this,K)&&e(this,Z)){let a=e(this,K)[r],h=e(this,Z)[r];if(a&&h){let l=a-(e(this,X).now()-h);o.ttl=l,o.start=Date.now();}}return e(this,Q)&&(o.size=e(this,Q)[r]),o}dump(){let t=[];for(let r of c(this,n,ot).call(this,{allowStale:true})){let i=e(this,O)[r],s=e(this,g)[r],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||i===void 0)continue;let a={value:o};if(e(this,K)&&e(this,Z)){a.ttl=e(this,K)[r];let h=e(this,X).now()-e(this,Z)[r];a.start=Math.floor(Date.now()-h);}e(this,Q)&&(a.size=e(this,Q)[r]),t.unshift([i,a]);}return t}load(t){this.clear();for(let[r,i]of t){if(i.start){let s=Date.now()-i.start;i.start=e(this,X).now()-s;}this.set(r,i.value,i);}}set(t,r,i={}){var y,T,E,b;if(r===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:l}=i,{noUpdateTTL:S=this.noUpdateTTL}=i,R=e(this,Ct).call(this,t,r,i.size||0,h);if(this.maxEntrySize&&R>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),c(this,n,ht).call(this,t,"set"),this;let d=e(this,I)===0?void 0:e(this,x).get(t);if(d===void 0)d=e(this,I)===0?e(this,C):e(this,q).length!==0?e(this,q).pop():e(this,I)===e(this,j)?c(this,n,Lt).call(this,false):e(this,I),e(this,O)[d]=t,e(this,g)[d]=r,e(this,x).set(t,d),e(this,L)[e(this,C)]=d,e(this,Y)[d]=e(this,C),u(this,C,d),Mt(this,I)._++,e(this,At).call(this,d,R,l),l&&(l.set="add"),S=false,e(this,bt)&&((y=e(this,ut))==null||y.call(this,r,t,"add"));else {c(this,n,It).call(this,d);let A=e(this,g)[d];if(r!==A){if(e(this,lt)&&c(this,n,v).call(this,A)){A.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=A;p!==void 0&&!a&&(e(this,tt)&&((T=e(this,k))==null||T.call(this,p,t,"set")),e(this,V)&&e(this,N)?.push([p,t,"set"]));}else a||(e(this,tt)&&((E=e(this,k))==null||E.call(this,A,t,"set")),e(this,V)&&e(this,N)?.push([A,t,"set"]));if(e(this,dt).call(this,d),e(this,At).call(this,d,R,l),e(this,g)[d]=r,l){l.set="replace";let p=A&&c(this,n,v).call(this,A)?A.__staleWhileFetching:A;p!==void 0&&(l.oldValue=p);}}else l&&(l.set="update");e(this,bt)&&this.onInsert?.(r,t,r===A?"update":"replace");}if(s!==0&&!e(this,K)&&c(this,n,Wt).call(this),e(this,K)&&(S||e(this,Rt).call(this,d,s,o),l&&e(this,it).call(this,l,d)),!a&&e(this,V)&&e(this,N)){let A=e(this,N),p;for(;p=A?.shift();)(b=e(this,B))==null||b.call(this,...p);}return this}pop(){var t;try{for(;e(this,I);){let r=e(this,g)[e(this,M)];if(c(this,n,Lt).call(this,!0),c(this,n,v).call(this,r)){if(r.__staleWhileFetching)return r.__staleWhileFetching}else if(r!==void 0)return r}}finally{if(e(this,V)&&e(this,N)){let r=e(this,N),i;for(;i=r?.shift();)(t=e(this,B))==null||t.call(this,...i);}}}has(t,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=r,o=e(this,x).get(t);if(o!==void 0){let a=e(this,g)[o];if(c(this,n,v).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(e(this,H).call(this,o))s&&(s.has="stale",e(this,it).call(this,s,o));else return i&&e(this,gt).call(this,o),s&&(s.has="hit",e(this,it).call(this,s,o)),true}else s&&(s.has="miss");return false}peek(t,r={}){let{allowStale:i=this.allowStale}=r,s=e(this,x).get(t);if(s===void 0||!i&&e(this,H).call(this,s))return;let o=e(this,g)[s];return c(this,n,v).call(this,o)?o.__staleWhileFetching:o}async fetch(t,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:l=0,sizeCalculation:S=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:T=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:b,forceRefresh:A=false,status:p,signal:D}=r;if(!e(this,lt))return p&&(p.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:p});let U={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:h,size:l,sizeCalculation:S,noUpdateTTL:R,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:E,ignoreFetchAbort:T,status:p,signal:D},G=e(this,x).get(t);if(G===void 0){p&&(p.fetch="miss");let w=c(this,n,Vt).call(this,t,G,U,b);return w.__returned=w}else {let w=e(this,g)[G];if(c(this,n,v).call(this,w)){let St=i&&w.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",St&&(p.returnedStale=true)),St?w.__staleWhileFetching:w.__returned=w}let xt=e(this,H).call(this,G);if(!A&&!xt)return p&&(p.fetch="hit"),c(this,n,It).call(this,G),s&&e(this,gt).call(this,G),p&&e(this,it).call(this,p,G),w;let _t=c(this,n,Vt).call(this,t,G,U,b),mt=_t.__staleWhileFetching!==void 0&&i;return p&&(p.fetch=xt?"stale":"refresh",mt&&xt&&(p.returnedStale=true)),mt?_t.__staleWhileFetching:_t.__returned=_t}}async forceFetch(t,r={}){let i=await this.fetch(t,r);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,r={}){let i=e(this,yt);if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...a}=r,h=this.get(t,a);if(!o&&h!==void 0)return h;let l=i(t,h,{options:a,context:s});return this.set(t,l,a),l}get(t,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=r,h=e(this,x).get(t);if(h!==void 0){let l=e(this,g)[h],S=c(this,n,v).call(this,l);return a&&e(this,it).call(this,a,h),e(this,H).call(this,h)?(a&&(a.get="stale"),S?(a&&i&&l.__staleWhileFetching!==void 0&&(a.returnedStale=true),i?l.__staleWhileFetching:void 0):(o||c(this,n,ht).call(this,t,"expire"),a&&i&&(a.returnedStale=true),i?l:void 0)):(a&&(a.get="hit"),S?l.__staleWhileFetching:(c(this,n,It).call(this,h),s&&e(this,gt).call(this,h),l))}else a&&(a.get="miss");}delete(t){return c(this,n,ht).call(this,t,"delete")}clear(){return c(this,n,jt).call(this,"delete")}},j=new WeakMap,P=new WeakMap,k=new WeakMap,ut=new WeakMap,B=new WeakMap,Tt=new WeakMap,yt=new WeakMap,X=new WeakMap,I=new WeakMap,J=new WeakMap,x=new WeakMap,O=new WeakMap,g=new WeakMap,L=new WeakMap,Y=new WeakMap,M=new WeakMap,C=new WeakMap,q=new WeakMap,N=new WeakMap,Q=new WeakMap,Z=new WeakMap,K=new WeakMap,W=new WeakMap,tt=new WeakMap,lt=new WeakMap,V=new WeakMap,bt=new WeakMap,n=new WeakSet,Wt=function(){let t=new Gt(e(this,j)),r=new Gt(e(this,j));u(this,K,t),u(this,Z,r);let i=this.ttlAutopurge?new Array(e(this,j)):void 0;u(this,W,i),u(this,Rt,(h,l,S=e(this,X).now())=>{r[h]=l!==0?S:0,t[h]=l,s(h,l);}),u(this,gt,h=>{r[h]=t[h]!==0?e(this,X).now():0,s(h,t[h]);});let s=this.ttlAutopurge?(h,l)=>{if(i?.[h]&&(clearTimeout(i[h]),i[h]=void 0),l&&l!==0&&i){let S=setTimeout(()=>{e(this,H).call(this,h)&&c(this,n,ht).call(this,e(this,O)[h],"expire");},l+1);S.unref&&S.unref(),i[h]=S;}}:()=>{};u(this,it,(h,l)=>{if(t[l]){let S=t[l],R=r[l];if(!S||!R)return;h.ttl=S,h.start=R,h.now=o||a();let d=h.now-R;h.remainingTTL=S-d;}});let o=0,a=()=>{let h=e(this,X).now();if(this.ttlResolution>0){o=h;let l=setTimeout(()=>o=0,this.ttlResolution);l.unref&&l.unref();}return h};this.getRemainingTTL=h=>{let l=e(this,x).get(h);if(l===void 0)return 0;let S=t[l],R=r[l];if(!S||!R)return 1/0;let d=(o||a())-R;return S-d},u(this,H,h=>{let l=r[h],S=t[h];return !!S&&!!l&&(o||a())-l>S});},gt=new WeakMap,it=new WeakMap,Rt=new WeakMap,H=new WeakMap,ee=function(){let t=new Gt(e(this,j));u(this,J,0),u(this,Q,t),u(this,dt,r=>{u(this,J,e(this,J)-t[r]),t[r]=0;}),u(this,Ct,(r,i,s,o)=>{if(c(this,n,v).call(this,i))return 0;if(!at(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(i,r),!at(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}),u(this,At,(r,i,s)=>{if(t[r]=i,e(this,P)){let o=e(this,P)-t[r];for(;e(this,J)>o;)c(this,n,Lt).call(this,true);}u(this,J,e(this,J)+t[r]),s&&(s.entrySize=i,s.totalCalculatedSize=e(this,J));});},dt=new WeakMap,At=new WeakMap,Ct=new WeakMap,ot=function*({allowStale:t=this.allowStale}={}){if(e(this,I))for(let r=e(this,C);!(!c(this,n,Ht).call(this,r)||((t||!e(this,H).call(this,r))&&(yield r),r===e(this,M)));)r=e(this,Y)[r];},nt=function*({allowStale:t=this.allowStale}={}){if(e(this,I))for(let r=e(this,M);!(!c(this,n,Ht).call(this,r)||((t||!e(this,H).call(this,r))&&(yield r),r===e(this,C)));)r=e(this,L)[r];},Ht=function(t){return t!==void 0&&e(this,x).get(e(this,O)[t])===t},Lt=function(t){var o;let r=e(this,M),i=e(this,O)[r],s=e(this,g)[r];return e(this,lt)&&c(this,n,v).call(this,s)?s.__abortController.abort(new Error("evicted")):(e(this,tt)||e(this,V))&&(e(this,tt)&&((o=e(this,k))==null||o.call(this,s,i,"evict")),e(this,V)&&e(this,N)?.push([s,i,"evict"])),e(this,dt).call(this,r),e(this,W)?.[r]&&(clearTimeout(e(this,W)[r]),e(this,W)[r]=void 0),t&&(e(this,O)[r]=void 0,e(this,g)[r]=void 0,e(this,q).push(r)),e(this,I)===1?(u(this,M,u(this,C,0)),e(this,q).length=0):u(this,M,e(this,L)[r]),e(this,x).delete(i),Mt(this,I)._--,r},Vt=function(t,r,i,s){let o=r===void 0?void 0:e(this,g)[r];if(c(this,n,v).call(this,o))return o;let a=new Ut,{signal:h}=i;h?.addEventListener("abort",()=>a.abort(h.reason),{signal:a.signal});let l={signal:a.signal,options:i,context:s},S=(b,A=false)=>{let{aborted:p}=a.signal,D=i.ignoreFetchAbort&&b!==void 0,U=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&b!==void 0);if(i.status&&(p&&!A?(i.status.fetchAborted=true,i.status.fetchError=a.signal.reason,D&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),p&&!D&&!A)return d(a.signal.reason,U);let G=T,w=e(this,g)[r];return (w===T||D&&A&&w===void 0)&&(b===void 0?G.__staleWhileFetching!==void 0?e(this,g)[r]=G.__staleWhileFetching:c(this,n,ht).call(this,t,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(t,b,l.options))),b},R=b=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=b),d(b,false)),d=(b,A)=>{let{aborted:p}=a.signal,D=p&&i.allowStaleOnFetchAbort,U=D||i.allowStaleOnFetchRejection,G=U||i.noDeleteOnFetchRejection,w=T;if(e(this,g)[r]===T&&(!G||!A&&w.__staleWhileFetching===void 0?c(this,n,ht).call(this,t,"fetch"):D||(e(this,g)[r]=w.__staleWhileFetching)),U)return i.status&&w.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),w.__staleWhileFetching;if(w.__returned===w)throw b},y=(b,A)=>{var D;let p=(D=e(this,Tt))==null?void 0:D.call(this,t,o,l);p&&p instanceof Promise&&p.then(U=>b(U===void 0?void 0:U),A),a.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(b(void 0),i.allowStaleOnFetchAbort&&(b=U=>S(U,true)));});};i.status&&(i.status.fetchDispatched=true);let T=new Promise(y).then(S,R),E=Object.assign(T,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(t,E,{...l.options,status:void 0}),r=e(this,x).get(t)):e(this,g)[r]=E,E},v=function(t){if(!e(this,lt))return false;let r=t;return !!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Ut},$t=function(t,r){e(this,Y)[r]=t,e(this,L)[t]=r;},It=function(t){t!==e(this,C)&&(t===e(this,M)?u(this,M,e(this,L)[t]):c(this,n,$t).call(this,e(this,Y)[t],e(this,L)[t]),c(this,n,$t).call(this,e(this,C),t),u(this,C,t));},ht=function(t,r){var s,o;let i=false;if(e(this,I)!==0){let a=e(this,x).get(t);if(a!==void 0)if(e(this,W)?.[a]&&(clearTimeout(e(this,W)?.[a]),e(this,W)[a]=void 0),i=true,e(this,I)===1)c(this,n,jt).call(this,r);else {e(this,dt).call(this,a);let h=e(this,g)[a];if(c(this,n,v).call(this,h)?h.__abortController.abort(new Error("deleted")):(e(this,tt)||e(this,V))&&(e(this,tt)&&((s=e(this,k))==null||s.call(this,h,t,r)),e(this,V)&&e(this,N)?.push([h,t,r])),e(this,x).delete(t),e(this,O)[a]=void 0,e(this,g)[a]=void 0,a===e(this,C))u(this,C,e(this,Y)[a]);else if(a===e(this,M))u(this,M,e(this,L)[a]);else {let l=e(this,Y)[a];e(this,L)[l]=e(this,L)[a];let S=e(this,L)[a];e(this,Y)[S]=e(this,Y)[a];}Mt(this,I)._--,e(this,q).push(a);}}if(e(this,V)&&e(this,N)?.length){let a=e(this,N),h;for(;h=a?.shift();)(o=e(this,B))==null||o.call(this,...h);}return i},jt=function(t){var r,i;for(let s of c(this,n,nt).call(this,{allowStale:true})){let o=e(this,g)[s];if(c(this,n,v).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=e(this,O)[s];e(this,tt)&&((r=e(this,k))==null||r.call(this,o,a,t)),e(this,V)&&e(this,N)?.push([o,a,t]);}}if(e(this,x).clear(),e(this,g).fill(void 0),e(this,O).fill(void 0),e(this,K)&&e(this,Z)){e(this,K).fill(0),e(this,Z).fill(0);for(let s of e(this,W)??[])s!==void 0&&clearTimeout(s);e(this,W)?.fill(void 0);}if(e(this,Q)&&e(this,Q).fill(0),u(this,M,0),u(this,C,0),e(this,q).length=0,u(this,J,0),u(this,I,0),e(this,V)&&e(this,N)){let s=e(this,N),o;for(;o=s?.shift();)(i=e(this,B))==null||i.call(this,...o);}},vt);var ct=class{cache;map=new Map;constructor(t){this.cache=new te({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(t){let r=this.map.delete(t);return r&&this.cache.delete(t),r}get forEach(){return this.map.forEach}get(t){let r=this.cache.get(t);return r||this.map.get(t)}has(t){return this.map.has(t)}set(t,r){return this.map.set(t,r),this.cache.set(t,r),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var rt;(s=>(s.log=(o,...a)=>console.log(`[Pixi\u2019VN] ${o}`,...a),s.warn=(o,...a)=>console.warn(`[Pixi\u2019VN] ${o}`,...a),s.error=(o,...a)=>console.error(`[Pixi\u2019VN] ${o}`,...a),s.info=(o,...a)=>console.info(`[Pixi\u2019VN] ${o}`,...a)))(rt||={});function Nt(f){try{if(typeof f>"u")return f;let t=JSON.stringify(f);return JSON.parse(t)}catch(t){throw rt.error("Error creating exportable element",f,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var re;(d=>{d.storage=new ct({cacheSize:50}),d.defaultStorage=new ct({cacheSize:10}),d.tempStorageDeadlines=new Map;let i;function s(y){d.tempStorageDeadlines.forEach((T,E)=>{T>y&&(d.storage.delete(`${ft}:${E}`),i?.onClearOldTempVariable?.(E),d.tempStorageDeadlines.delete(E));});}d.clearOldTempVariables=s;function o(y){i=y;}d.setExternalStoreHandler=o;function a(y,T,E){E==null?d.storage.delete(`${y}:${T}`):d.storage.set(`${y}:${T}`,E),i?.onSetVariable?.(T,E);}d.setVariable=a;function h(y,T){let E=d.storage.get(`${y}:${T}`);return Nt(E)}d.getVariable=h;function l(y,T){d.storage.delete(`${y}:${T}`),i?.onRemoveVariable?.(T);}d.removeVariable=l;function S(y,T){let E=d.storage.get(Dt)||[];if(T)E.includes(y)||E.push(y);else {let b=E.indexOf(y);b>-1&&E.splice(b,1);}d.storage.set(Dt,E);}d.setFlag=S;function R(y){return (d.storage.get(Dt)||[]).includes(y)}d.getFlag=R;})(re||={});var m=re;var Ot=class{constructor(t,r){this.categoryId=t,this.id=r,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let r=m.getVariable(st,t);r&&(Object.entries(r).forEach(([i,s])=>{typeof s=="object"&&s!==null&&Object.entries(s).forEach(([o,a])=>{m.setVariable(this.categoryId,`${i}:${o}`,a);});}),m.removeVariable(st,t));}id;categoryId;setStorageProperty(t,r){m.setVariable(this.categoryId,`${this.id}:${t}`,r);}getStorageProperty(t,r=this.id){return m.getVariable(this.categoryId,`${r}:${t}`)}};var fe="@",wt=class extends Ot{sourceId;constructor(t,r=""){super(z.CHARACTER_CATEGORY_KEY,t+(r?fe+r:"")),this.sourceId=t,this.migrateOldStorage("___character___");}getStorageProperty(t){let r=super.getStorageProperty(t);return r===void 0&&(r=super.getStorageProperty(t,this.sourceId)),r}};var zt=class extends wt{constructor(t,r){super(typeof t=="string"?t:t.id,typeof t=="string"?"":t.emotion),this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this.icon=r.icon,this.color=r.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(t){this.setStorageProperty("name",t);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(t){this.setStorageProperty("surname",t);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(t){this.setStorageProperty("age",t);}icon;color};var pt=new ct({cacheSize:10}),ie;(a=>{function f(h){try{let l=pt.get(h);if(!l){rt.warn(`Character "${h}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return l}catch(l){rt.error(`Error while getting Character "${h}"`,l);return}}a.get=f;function t(...h){for(let l of h){if(Array.isArray(l)){t(...l);continue}pt.get(l.id)&&rt.info(`Character id "${l.id}" already exists, it will be overwritten`),pt.set(l.id,l);}}a.add=t;function r(){return Array.from(pt.values())}a.values=r;function i(h){return pt.has(h)}a.has=i;function s(){return Array.from(pt.keys())}a.keys=s;function o(){pt.clear();}a.clear=o;})(ie||={});var ue=ie;exports.CharacterBaseModel=zt;exports.CharacterStoredClass=wt;exports.RegisteredCharacters=ue;
@@ -1 +1 @@
1
- import {b}from'./chunk-GIYMPXBT.mjs';import {n as n$1}from'./chunk-IWAXXFXE.mjs';import {d,e}from'./chunk-HQQ5WH6C.mjs';var g="@",n=class extends b{sourceId;constructor(e,r=""){super(n$1.CHARACTER_CATEGORY_KEY,e+(r?g+r:"")),this.sourceId=e,this.migrateOldStorage("___character___");}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var i=class extends n{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion),this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this.icon=r.icon,this.color=r.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}icon;color};var o=new d({cacheSize:10}),h;(C=>{function c(a){try{let t=o.get(a);if(!t){e.warn(`Character "${a}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return t}catch(t){e.error(`Error while getting Character "${a}"`,t);return}}C.get=c;function e$1(...a){for(let t of a){if(Array.isArray(t)){e$1(...t);continue}o.get(t.id)&&e.info(`Character id "${t.id}" already exists, it will be overwritten`),o.set(t.id,t);}}C.add=e$1;function r(){return Array.from(o.values())}C.values=r;function m(a){return o.has(a)}C.has=m;function l(){return Array.from(o.keys())}C.keys=l;function y(){o.clear();}C.clear=y;})(h||={});var p=h;export{i as CharacterBaseModel,n as CharacterStoredClass,p as RegisteredCharacters};
1
+ import {b}from'./chunk-I7DOUH5V.mjs';import {m}from'./chunk-HD353M4B.mjs';import {d,e}from'./chunk-HQQ5WH6C.mjs';var g="@",n=class extends b{sourceId;constructor(e,r=""){super(m.CHARACTER_CATEGORY_KEY,e+(r?g+r:"")),this.sourceId=e,this.migrateOldStorage("___character___");}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var i=class extends n{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion),this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this.icon=r.icon,this.color=r.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}icon;color};var o=new d({cacheSize:10}),h;(C=>{function c(a){try{let t=o.get(a);if(!t){e.warn(`Character "${a}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return t}catch(t){e.error(`Error while getting Character "${a}"`,t);return}}C.get=c;function e$1(...a){for(let t of a){if(Array.isArray(t)){e$1(...t);continue}o.get(t.id)&&e.info(`Character id "${t.id}" already exists, it will be overwritten`),o.set(t.id,t);}}C.add=e$1;function r(){return Array.from(o.values())}C.values=r;function m(a){return o.has(a)}C.has=m;function l(){return Array.from(o.keys())}C.keys=l;function y(){o.clear();}C.clear=y;})(h||={});var p=h;export{i as CharacterBaseModel,n as CharacterStoredClass,p as RegisteredCharacters};
@@ -0,0 +1 @@
1
+ var _="__game_layer__",E="Container",A="ImageContainer",e="Image",t="Sprite",o="Text",T="Video",N="general",R="storage",I="temp",S="narration",O="flags",n={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};export{_ as a,E as b,A as c,e as d,t as e,o as f,T as g,N as h,R as i,I as j,S as k,O as l,n as m};
@@ -0,0 +1 @@
1
+ import {j,l,i,k,m}from'./chunk-HD353M4B.mjs';import {d as d$1,f,e}from'./chunk-HQQ5WH6C.mjs';import {GameUnifier}from'@drincs/pixi-vn/core';var I;(n=>{n.storage=new d$1({cacheSize:50}),n.defaultStorage=new d$1({cacheSize:10}),n.tempStorageDeadlines=new Map;let s;function S(r){n.tempStorageDeadlines.forEach((i,o)=>{i>r&&(n.storage.delete(`${j}:${o}`),s?.onClearOldTempVariable?.(o),n.tempStorageDeadlines.delete(o));});}n.clearOldTempVariables=S;function T(r){s=r;}n.setExternalStoreHandler=T;function h(r,i,o){o==null?n.storage.delete(`${r}:${i}`):n.storage.set(`${r}:${i}`,o),s?.onSetVariable?.(i,o);}n.setVariable=h;function V(r,i){let o=n.storage.get(`${r}:${i}`);return f(o)}n.getVariable=V;function O(r,i){n.storage.delete(`${r}:${i}`),s?.onRemoveVariable?.(i);}n.removeVariable=O;function M(r,i){let o=n.storage.get(l)||[];if(i)o.includes(r)||o.push(r);else {let y=o.indexOf(r);y>-1&&o.splice(y,1);}n.storage.set(l,o);}n.setFlag=M;function R(r){return (n.storage.get(l)||[]).includes(r)}n.getFlag=R;})(I||={});var a=I;var c=class{get base(){return a.storage.map}get cache(){return a.storage.cache}get tempStorageDeadlines(){return a.tempStorageDeadlines}set default(t){Object.entries(t).forEach(([e,s])=>{a.defaultStorage.map.set(e,s);});}temp={set:(t,e)=>this.setTemp(t,e),remove:t=>this.removeTemp(t),get deadlines(){return a.tempStorageDeadlines}};flags={set:(t,e)=>a.setFlag(t,e),get:t=>a.getFlag(t)};set(t,e){return a.setVariable(i,t,e)}get(t){let e=a.getVariable(j,t);return e===void 0&&(e=a.getVariable(i,t)),e===void 0&&(e=f(a.defaultStorage.get(t))),e}remove(t){return this.temp.remove(t),a.removeVariable(i,t)}setTemp(t,e){if(e==null){this.temp.remove(t);return}else a.setVariable(j,t,e),this.temp.deadlines.has(t)||this.temp.deadlines.set(t,GameUnifier.openedLabels);}removeTemp(t){a.removeVariable(j,t),this.temp.deadlines.has(t)&&this.temp.deadlines.delete(t);}setTempVariable(t,e){this.temp.set(t,e);}removeTempVariable(t){this.temp.remove(t);}setFlag(t,e){this.flags.set(t,e);}getFlag(t){return this.flags.get(t)}setStorageHandler(t){a.setExternalStoreHandler(t);}clear(){this.base.clear(),this.cache.clear(),this.temp.deadlines.clear();}export(){let t=[];[...this.base.keys()].forEach(s=>{t.push({key:s,value:this.base.get(s)});});let e=[];return [...this.temp.deadlines.keys()].forEach(s=>{e.push({key:s,value:this.temp.deadlines.get(s)});}),f({main:t,tempDeadlines:e})}restore(t){this.clear();try{t?(t.base?.forEach(e=>{switch(e.key){case "___current_dialogue_memory___":a.setVariable(k,m.CURRENT_DIALOGUE_MEMORY_KEY,e.value);break;case "___last_dialogue_added_in_step_memory___":a.setVariable(k,m.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "___current_menu_options_memory___":a.setVariable(k,m.CURRENT_MENU_OPTIONS_MEMORY_KEY,e.value);break;case "___last_menu_options_added_in_step_memory___":a.setVariable(k,m.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "_input_value_":a.setVariable(k,m.CURRENT_INPUT_VALUE_MEMORY_KEY,e.value);break;case "___last_input_added_in_step_memory___":a.setVariable(k,m.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "___current_input_info_memory___":a.setVariable(k,m.CURRENT_INPUT_INFO_MEMORY_KEY,e.value);break;case "___opened_labels_counter___":a.setVariable(k,m.OPENED_LABELS_COUNTER_KEY,e.value);break;case "___all_choices_made___":a.setVariable(k,m.ALL_CHOICES_MADE_KEY,e.value);break;case "___current_step_times_counter___":a.setVariable(k,m.CURRENT_STEP_TIMES_COUNTER_KEY,e.value);break;case "___last_step_glued___":a.setVariable(k,m.LAST_STEP_GLUED,e.value);break;default:a.setVariable(i,e.key,e.value);}}),t.temp?.forEach(e=>{a.setVariable(j,e.key,e.value);}),t.flags?.forEach(e=>{a.setFlag(e,!0);}),t.main?.forEach(e=>{this.base.set(e.key,e.value);}),t.tempDeadlines?.forEach(e=>{this.temp.deadlines.set(e.key,e.value);})):e.warn("No storage data found");}catch(e$1){e.error("Error importing data",e$1);}}};var d=class{constructor(t,e){this.categoryId=t,this.id=e,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let e=a.getVariable(i,t);e&&(Object.entries(e).forEach(([s,S])=>{typeof S=="object"&&S!==null&&Object.entries(S).forEach(([T,h])=>{a.setVariable(this.categoryId,`${s}:${T}`,h);});}),a.removeVariable(i,t));}id;categoryId;setStorageProperty(t,e){a.setVariable(this.categoryId,`${this.id}:${t}`,e);}getStorageProperty(t,e=this.id){return a.getVariable(this.categoryId,`${e}:${t}`)}};var w=new c;export{a,d as b,w as c};