@drincs/pixi-vn 1.8.16 → 1.8.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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();}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 function(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{}});
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
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};
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),et=require('@drincs/pixi-vn/history'),L=require('@drincs/pixi-vn/narration'),pt=require('@drincs/pixi-vn/sound'),G=require('@drincs/pixi-vn/storage'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var L__namespace=/*#__PURE__*/_interopNamespace(L);var pt__namespace=/*#__PURE__*/_interopNamespace(pt);var G__namespace=/*#__PURE__*/_interopNamespace(G);var Xt=Object.defineProperty;var Jt=h=>{throw TypeError(h)};var ue=(h,e,i)=>e in h?Xt(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var fe=(h,e)=>{for(var i in e)Xt(h,i,{get:e[i],enumerable:true});};var C=(h,e,i)=>ue(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Jt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),_=(h,e,i)=>e.has(h)?Jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Gt=typeof process=="object"&&process?process:{},ie=(h,e,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Nt>"u"){Qt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Qt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let h=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,ie("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",e));};}var ge=h=>!ee.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),se=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,_e=(it=class{heap;length;static create(e){let i=se(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}constructor(e,i){if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(it,St,false),it),Zt,te,K,M,q,ut,$,yt,xt,B,O,X,T,b,m,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,It,ft,ot,Tt,Y,oe,mt,bt,Ot,lt,ht,Mt,Lt,Ct,E,zt,At,ct,Vt,wt,re=(wt=class{constructor(e){_(this,l);_(this,K);_(this,M);_(this,q);_(this,ut);_(this,$);_(this,yt);_(this,xt);_(this,B);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");_(this,O);_(this,X);_(this,T);_(this,b);_(this,m);_(this,P);_(this,z);_(this,N);_(this,R);_(this,J);_(this,D);_(this,Q);_(this,Z);_(this,V);_(this,W);_(this,tt);_(this,dt);_(this,j);_(this,Et);_(this,ft,()=>{});_(this,ot,()=>{});_(this,Tt,()=>{});_(this,Y,()=>false);_(this,mt,e=>{});_(this,bt,(e,i,s)=>{});_(this,Ot,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});C(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:v,onInsert:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,B,_t??me),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?se(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,M,k),this.maxEntrySize=w||t(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,M)&&!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(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,dt,!!a),u(this,T,new Map),u(this,b,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,P,new vt(i)),u(this,z,new vt(i)),u(this,N,0),u(this,R,0),u(this,J,_e.create(i)),u(this,O,0),u(this,X,0),typeof v=="function"&&u(this,q,v),typeof U=="function"&&u(this,ut,U),typeof S=="function"?(u(this,$,S),u(this,D,[])):(u(this,$,void 0),u(this,D,void 0)),u(this,tt,!!t(this,q)),u(this,Et,!!t(this,ut)),u(this,j,!!t(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,M)!==0&&!at(t(this,M)))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");d(this,l,oe).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,l,It).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,M)){let Pt="LRU_CACHE_UNBOUNDED";ge(Pt)&&(ee.add(Pt),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return t(this,B)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,b),valList:t(e,m),next:t(e,P),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,R)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,E).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,At).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,X)}get size(){return t(this,O)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,xt)}get dispose(){return t(this,q)}get onInsert(){return t(this,ut)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(te=Symbol.iterator,Zt=Symbol.toStringTag,te)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,ct).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,E).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,B).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,b)[i],r=t(this,m)[i],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,B).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,B).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var rt,I,k,w;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,U=t(this,Ot).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&U>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,ct).call(this,e,"set"),this;let S=t(this,O)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,O)===0?t(this,R):t(this,J).length!==0?t(this,J).pop():t(this,O)===t(this,K)?d(this,l,Lt).call(this,false):t(this,O),t(this,b)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,P)[t(this,R)]=S,t(this,z)[S]=t(this,R),u(this,R,S),Rt(this,O)._++,t(this,bt).call(this,S,U,p),p&&(p.set="add"),v=false,t(this,Et)&&((rt=t(this,ut))==null||rt.call(this,i,e,"add"));else {d(this,l,At).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,dt)&&d(this,l,E).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((I=t(this,q))==null||I.call(this,a,e,"set")),t(this,j)&&t(this,D)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,j)&&t(this,D)?.push([y,e,"set"]));if(t(this,mt).call(this,S),t(this,bt).call(this,S,U,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,E).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,Et)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,It).call(this),t(this,V)&&(v||t(this,Tt).call(this,S,r,n),p&&t(this,ot).call(this,p,S)),!o&&t(this,j)&&t(this,D)){let y=t(this,D),a;for(;a=y?.shift();)(w=t(this,$))==null||w.call(this,...a);}return this}pop(){var e;try{for(;t(this,O);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,D)){let i=t(this,D),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,E).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,ot).call(this,r,n));else return s&&t(this,ft).call(this,n),r&&(r.has="hit",t(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,E).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:p=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!t(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:v,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let g=d(this,l,Ct).call(this,e,f,A,w);return g.__returned=g}else {let g=t(this,m)[f];if(d(this,l,E).call(this,g)){let vt=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?g.__staleWhileFetching:g.__returned=g}let F=t(this,Y).call(this,f);if(!y&&!F)return a&&(a.fetch="hit"),d(this,l,At).call(this,f),r&&t(this,ft).call(this,f),a&&t(this,ot).call(this,a,f),g;let H=d(this,l,Ct).call(this,e,f,A,w),_t=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",_t&&F&&(a.returnedStale=true)),_t?H.__staleWhileFetching:H.__returned=H}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=t(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],v=d(this,l,E).call(this,p);return o&&t(this,ot).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),v?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),v?p.__staleWhileFetching:(d(this,l,At).call(this,c),r&&t(this,ft).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,ct).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ut=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,m=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=new WeakMap,l=new WeakSet,It=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Tt,(c,p,v=t(this,B).now())=>{i[c]=p!==0?v:0,e[c]=p,r(c,p);}),u(this,ft,c=>{i[c]=e[c]!==0?t(this,B).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let v=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,ct).call(this,t(this,b)[c],"expire");},p+1);v.unref&&v.unref(),s[c]=v;}}:()=>{};u(this,ot,(c,p)=>{if(e[p]){let v=e[p],U=i[p];if(!v||!U)return;c.ttl=v,c.start=U,c.now=n||o();let S=c.now-U;c.remainingTTL=v-S;}});let n=0,o=()=>{let c=t(this,B).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let v=e[p],U=i[p];if(!v||!U)return 1/0;let S=(n||o())-U;return v-S},u(this,Y,c=>{let p=i[c],v=e[c];return !!v&&!!p&&(n||o())-p>v});},ft=new WeakMap,ot=new WeakMap,Tt=new WeakMap,Y=new WeakMap,oe=function(){let e=new Dt(t(this,K));u(this,X,0),u(this,Q,e),u(this,mt,i=>{u(this,X,t(this,X)-e[i]),e[i]=0;}),u(this,Ot,(i,s,r,n)=>{if(d(this,l,E).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(r))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 r}),u(this,bt,(i,s,r)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,X)>n;)d(this,l,Lt).call(this,true);}u(this,X,t(this,X)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,X));});},mt=new WeakMap,bt=new WeakMap,Ot=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,R);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,N);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,R)));)i=t(this,P)[i];},Mt=function(e){return e!==void 0&&t(this,T).get(t(this,b)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,b)[i],r=t(this,m)[i];return t(this,dt)&&d(this,l,E).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,j)&&t(this,D)?.push([r,s,"evict"])),t(this,mt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,O)===1?(u(this,N,u(this,R,0)),t(this,J).length=0):u(this,N,t(this,P)[i]),t(this,T).delete(s),Rt(this,O)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,E).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},v=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,A);let f=I,g=t(this,m)[i];return (g===I||x&&y&&g===void 0)&&(w===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,p.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,f=A||s.noDeleteOnFetchRejection,g=I;if(t(this,m)[i]===I&&(!f||!y&&g.__staleWhileFetching===void 0?d(this,l,ct).call(this,e,"fetch"):x||(t(this,m)[i]=g.__staleWhileFetching)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var x;let a=(x=t(this,yt))==null?void 0:x.call(this,e,n,p);a&&a instanceof Promise&&a.then(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},E=function(e){if(!t(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,P)[e]=i;},At=function(e){e!==t(this,R)&&(e===t(this,N)?u(this,N,t(this,P)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,P)[e]),d(this,l,zt).call(this,t(this,R),e),u(this,R,e));},ct=function(e,i){var r,n;let s=false;if(t(this,O)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,O)===1)d(this,l,Vt).call(this,i);else {t(this,mt).call(this,o);let c=t(this,m)[o];if(d(this,l,E).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,j)&&t(this,D)?.push([c,e,i])),t(this,T).delete(e),t(this,b)[o]=void 0,t(this,m)[o]=void 0,o===t(this,R))u(this,R,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,P)[o]);else {let p=t(this,z)[o];t(this,P)[p]=t(this,P)[o];let v=t(this,P)[o];t(this,z)[v]=t(this,z)[o];}Rt(this,O)._--,t(this,J).push(o);}}if(t(this,j)&&t(this,D)?.length){let o=t(this,D),c;for(;c=o?.shift();)(n=t(this,$))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,j)&&t(this,D)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,b).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,R,0),t(this,J).length=0,u(this,X,0),u(this,O,0),t(this,j)&&t(this,D)){let r=t(this,D),n;for(;n=r?.shift();)(s=t(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){this.cache=new re({max:e.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(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ut="1.8.16";var Wt={version:Ut};var Yt="repeat";function Ht(h){return {type:"pause",duration:h}}var Kt="__game_layer__";var ve={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"};var ae={};var kt={};fe(kt,{createExportableElement:()=>le});var gt;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(gt||={});function le(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ye=typeof window<"u"&&typeof document<"u",he=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],ce=31,xe="background:#2f90da;color:#fff;font-weight:bold;",Ee="background:#c832bb;color:#fff;font-weight:bold;",be="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function de(){if(!ye)return;let h=[],e=[];for(let i=0;i<he.length;i++){let s=he[i],r=s.endsWith(qt),n=r?s.slice(0,-qt.length):s,o=n.slice(0,ce),c=n.slice(ce),p=r?"%c%s%c%s%c%s":"%c%s%c%s";h.push(p),e.push(xe,o,Ee,c),r&&e.push(be,qt);}console.info(h.join(`
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var nt=require('@drincs/pixi-vn/canvas'),Bt=require('@drincs/pixi-vn/characters'),core=require('@drincs/pixi-vn/core'),et=require('@drincs/pixi-vn/history'),L=require('@drincs/pixi-vn/narration'),pt=require('@drincs/pixi-vn/sound'),G=require('@drincs/pixi-vn/storage'),motion=require('@drincs/pixi-vn/motion');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var nt__namespace=/*#__PURE__*/_interopNamespace(nt);var Bt__namespace=/*#__PURE__*/_interopNamespace(Bt);var et__namespace=/*#__PURE__*/_interopNamespace(et);var L__namespace=/*#__PURE__*/_interopNamespace(L);var pt__namespace=/*#__PURE__*/_interopNamespace(pt);var G__namespace=/*#__PURE__*/_interopNamespace(G);var Xt=Object.defineProperty;var Jt=h=>{throw TypeError(h)};var ue=(h,e,i)=>e in h?Xt(h,e,{enumerable:true,configurable:true,writable:true,value:i}):h[e]=i;var fe=(h,e)=>{for(var i in e)Xt(h,i,{get:e[i],enumerable:true});};var C=(h,e,i)=>ue(h,typeof e!="symbol"?e+"":e,i),jt=(h,e,i)=>e.has(h)||Jt("Cannot "+i);var t=(h,e,i)=>(jt(h,e,"read from private field"),i?i.call(h):e.get(h)),_=(h,e,i)=>e.has(h)?Jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,i),u=(h,e,i,s)=>(jt(h,e,"write to private field"),e.set(h,i),i),d=(h,e,i)=>(jt(h,e,"access private method"),i);var Rt=(h,e,i,s)=>({set _(r){u(h,e,r);},get _(){return t(h,e,s)}});var me=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ee=new Set,Gt=typeof process=="object"&&process?process:{},ie=(h,e,i,s)=>{typeof Gt.emitWarning=="function"?Gt.emitWarning(h,e,i,s):console.error(`[${i}] ${e}: ${h}`);},Nt=globalThis.AbortController,Qt=globalThis.AbortSignal;if(typeof Nt>"u"){Qt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Nt=class{constructor(){e();}signal=new Qt;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let h=Gt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{h&&(h=false,ie("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",e));};}var ge=h=>!ee.has(h);var at=h=>h&&h===Math.floor(h)&&h>0&&isFinite(h),se=h=>at(h)?h<=Math.pow(2,8)?Uint8Array:h<=Math.pow(2,16)?Uint16Array:h<=Math.pow(2,32)?Uint32Array:h<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(h){super(h),this.fill(0);}},it,St,_e=(it=class{heap;length;static create(e){let i=se(e);if(!i)return [];u(it,St,true);let s=new it(e,i);return u(it,St,false),s}constructor(e,i){if(!t(it,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,_(it,St,false),it),Zt,te,K,M,q,ut,$,yt,xt,B,O,X,T,b,m,P,z,N,R,J,D,Q,Z,V,W,tt,dt,j,Et,l,It,ft,ot,Tt,Y,oe,mt,bt,Ot,lt,ht,Mt,Lt,Ct,E,zt,At,ct,Vt,wt,re=(wt=class{constructor(e){_(this,l);_(this,K);_(this,M);_(this,q);_(this,ut);_(this,$);_(this,yt);_(this,xt);_(this,B);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");_(this,O);_(this,X);_(this,T);_(this,b);_(this,m);_(this,P);_(this,z);_(this,N);_(this,R);_(this,J);_(this,D);_(this,Q);_(this,Z);_(this,V);_(this,W);_(this,tt);_(this,dt);_(this,j);_(this,Et);_(this,ft,()=>{});_(this,ot,()=>{});_(this,Tt,()=>{});_(this,Y,()=>false);_(this,mt,e=>{});_(this,bt,(e,i,s)=>{});_(this,Ot,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});C(this,Zt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:c,allowStale:p,dispose:v,onInsert:U,disposeAfter:S,noDisposeOnSet:rt,noUpdateTTL:I,maxSize:k=0,maxEntrySize:w=0,sizeCalculation:y,fetchMethod:a,memoMethod:x,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:f,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:F,ignoreFetchAbort:H,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,B,_t??me),i!==0&&!at(i))throw new TypeError("max option must be a nonnegative integer");let vt=i?se(i):Array;if(!vt)throw new Error("invalid max value: "+i);if(u(this,K,i),u(this,M,k),this.maxEntrySize=w||t(this,M),this.sizeCalculation=y,this.sizeCalculation){if(!t(this,M)&&!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(x!==void 0&&typeof x!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,xt,x),a!==void 0&&typeof a!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,yt,a),u(this,dt,!!a),u(this,T,new Map),u(this,b,new Array(i).fill(void 0)),u(this,m,new Array(i).fill(void 0)),u(this,P,new vt(i)),u(this,z,new vt(i)),u(this,N,0),u(this,R,0),u(this,J,_e.create(i)),u(this,O,0),u(this,X,0),typeof v=="function"&&u(this,q,v),typeof U=="function"&&u(this,ut,U),typeof S=="function"?(u(this,$,S),u(this,D,[])):(u(this,$,void 0),u(this,D,void 0)),u(this,tt,!!t(this,q)),u(this,Et,!!t(this,ut)),u(this,j,!!t(this,$)),this.noDisposeOnSet=!!rt,this.noUpdateTTL=!!I,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!g,this.allowStaleOnFetchAbort=!!F,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(t(this,M)!==0&&!at(t(this,M)))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");d(this,l,oe).call(this);}if(this.allowStale=!!p,this.noDeleteOnStaleGet=!!f,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!c,this.ttlResolution=at(r)||r===0?r:1,this.ttlAutopurge=!!n,this.ttl=s||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");d(this,l,It).call(this);}if(t(this,K)===0&&this.ttl===0&&t(this,M)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,K)&&!t(this,M)){let Pt="LRU_CACHE_UNBOUNDED";ge(Pt)&&(ee.add(Pt),ie("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,wt));}}get perf(){return t(this,B)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,V),autopurgeTimers:t(e,W),sizes:t(e,Q),keyMap:t(e,T),keyList:t(e,b),valList:t(e,m),next:t(e,P),prev:t(e,z),get head(){return t(e,N)},get tail(){return t(e,R)},free:t(e,J),isBackgroundFetch:i=>{var s;return d(s=e,l,E).call(s,i)},backgroundFetch:(i,s,r,n)=>{var o;return d(o=e,l,Ct).call(o,i,s,r,n)},moveToTail:i=>{var s;return d(s=e,l,At).call(s,i)},indexes:i=>{var s;return d(s=e,l,lt).call(s,i)},rindexes:i=>{var s;return d(s=e,l,ht).call(s,i)},isStale:i=>{var s;return t(s=e,Y).call(s,i)}}}get max(){return t(this,K)}get maxSize(){return t(this,M)}get calculatedSize(){return t(this,X)}get size(){return t(this,O)}get fetchMethod(){return t(this,yt)}get memoMethod(){return t(this,xt)}get dispose(){return t(this,q)}get onInsert(){return t(this,ut)}get disposeAfter(){return t(this,$)}getRemainingTTL(e){return t(this,T).has(e)?1/0:0}*entries(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*rentries(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&t(this,b)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield [t(this,b)[e],t(this,m)[e]]);}*keys(){for(let e of d(this,l,lt).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*rkeys(){for(let e of d(this,l,ht).call(this)){let i=t(this,b)[e];i!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield i);}}*values(){for(let e of d(this,l,lt).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}*rvalues(){for(let e of d(this,l,ht).call(this))t(this,m)[e]!==void 0&&!d(this,l,E).call(this,t(this,m)[e])&&(yield t(this,m)[e]);}[(te=Symbol.iterator,Zt=Symbol.toStringTag,te)](){return this.entries()}find(e,i={}){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n!==void 0&&e(n,t(this,b)[s],this))return this.get(t(this,b)[s],i)}}forEach(e,i=this){for(let s of d(this,l,lt).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}rforEach(e,i=this){for(let s of d(this,l,ht).call(this)){let r=t(this,m)[s],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;n!==void 0&&e.call(i,n,t(this,b)[s],this);}}purgeStale(){let e=false;for(let i of d(this,l,ht).call(this,{allowStale:true}))t(this,Y).call(this,i)&&(d(this,l,ct).call(this,t(this,b)[i],"expire"),e=true);return e}info(e){let i=t(this,T).get(e);if(i===void 0)return;let s=t(this,m)[i],r=d(this,l,E).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let n={value:r};if(t(this,V)&&t(this,Z)){let o=t(this,V)[i],c=t(this,Z)[i];if(o&&c){let p=o-(t(this,B).now()-c);n.ttl=p,n.start=Date.now();}}return t(this,Q)&&(n.size=t(this,Q)[i]),n}dump(){let e=[];for(let i of d(this,l,lt).call(this,{allowStale:true})){let s=t(this,b)[i],r=t(this,m)[i],n=d(this,l,E).call(this,r)?r.__staleWhileFetching:r;if(n===void 0||s===void 0)continue;let o={value:n};if(t(this,V)&&t(this,Z)){o.ttl=t(this,V)[i];let c=t(this,B).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-c);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,B).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var rt,I,k,w;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:c=this.sizeCalculation,status:p}=s,{noUpdateTTL:v=this.noUpdateTTL}=s,U=t(this,Ot).call(this,e,i,s.size||0,c);if(this.maxEntrySize&&U>this.maxEntrySize)return p&&(p.set="miss",p.maxEntrySizeExceeded=true),d(this,l,ct).call(this,e,"set"),this;let S=t(this,O)===0?void 0:t(this,T).get(e);if(S===void 0)S=t(this,O)===0?t(this,R):t(this,J).length!==0?t(this,J).pop():t(this,O)===t(this,K)?d(this,l,Lt).call(this,false):t(this,O),t(this,b)[S]=e,t(this,m)[S]=i,t(this,T).set(e,S),t(this,P)[t(this,R)]=S,t(this,z)[S]=t(this,R),u(this,R,S),Rt(this,O)._++,t(this,bt).call(this,S,U,p),p&&(p.set="add"),v=false,t(this,Et)&&((rt=t(this,ut))==null||rt.call(this,i,e,"add"));else {d(this,l,At).call(this,S);let y=t(this,m)[S];if(i!==y){if(t(this,dt)&&d(this,l,E).call(this,y)){y.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:a}=y;a!==void 0&&!o&&(t(this,tt)&&((I=t(this,q))==null||I.call(this,a,e,"set")),t(this,j)&&t(this,D)?.push([a,e,"set"]));}else o||(t(this,tt)&&((k=t(this,q))==null||k.call(this,y,e,"set")),t(this,j)&&t(this,D)?.push([y,e,"set"]));if(t(this,mt).call(this,S),t(this,bt).call(this,S,U,p),t(this,m)[S]=i,p){p.set="replace";let a=y&&d(this,l,E).call(this,y)?y.__staleWhileFetching:y;a!==void 0&&(p.oldValue=a);}}else p&&(p.set="update");t(this,Et)&&this.onInsert?.(i,e,i===y?"update":"replace");}if(r!==0&&!t(this,V)&&d(this,l,It).call(this),t(this,V)&&(v||t(this,Tt).call(this,S,r,n),p&&t(this,ot).call(this,p,S)),!o&&t(this,j)&&t(this,D)){let y=t(this,D),a;for(;a=y?.shift();)(w=t(this,$))==null||w.call(this,...a);}return this}pop(){var e;try{for(;t(this,O);){let i=t(this,m)[t(this,N)];if(d(this,l,Lt).call(this,!0),d(this,l,E).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,j)&&t(this,D)){let i=t(this,D),s;for(;s=i?.shift();)(e=t(this,$))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,n=t(this,T).get(e);if(n!==void 0){let o=t(this,m)[n];if(d(this,l,E).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,Y).call(this,n))r&&(r.has="stale",t(this,ot).call(this,r,n));else return s&&t(this,ft).call(this,n),r&&(r.has="hit",t(this,ot).call(this,r,n)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,T).get(e);if(r===void 0||!s&&t(this,Y).call(this,r))return;let n=t(this,m)[r];return d(this,l,E).call(this,n)?n.__staleWhileFetching:n}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:c=this.noDisposeOnSet,size:p=0,sizeCalculation:v=this.sizeCalculation,noUpdateTTL:U=this.noUpdateTTL,noDeleteOnFetchRejection:S=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:rt=this.allowStaleOnFetchRejection,ignoreFetchAbort:I=this.ignoreFetchAbort,allowStaleOnFetchAbort:k=this.allowStaleOnFetchAbort,context:w,forceRefresh:y=false,status:a,signal:x}=i;if(!t(this,dt))return a&&(a.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,status:a});let A={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:c,size:p,sizeCalculation:v,noUpdateTTL:U,noDeleteOnFetchRejection:S,allowStaleOnFetchRejection:rt,allowStaleOnFetchAbort:k,ignoreFetchAbort:I,status:a,signal:x},f=t(this,T).get(e);if(f===void 0){a&&(a.fetch="miss");let g=d(this,l,Ct).call(this,e,f,A,w);return g.__returned=g}else {let g=t(this,m)[f];if(d(this,l,E).call(this,g)){let vt=s&&g.__staleWhileFetching!==void 0;return a&&(a.fetch="inflight",vt&&(a.returnedStale=true)),vt?g.__staleWhileFetching:g.__returned=g}let F=t(this,Y).call(this,f);if(!y&&!F)return a&&(a.fetch="hit"),d(this,l,At).call(this,f),r&&t(this,ft).call(this,f),a&&t(this,ot).call(this,a,f),g;let H=d(this,l,Ct).call(this,e,f,A,w),_t=H.__staleWhileFetching!==void 0&&s;return a&&(a.fetch=F?"stale":"refresh",_t&&F&&(a.returnedStale=true)),_t?H.__staleWhileFetching:H.__returned=H}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=t(this,xt);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:n,...o}=i,c=this.get(e,o);if(!n&&c!==void 0)return c;let p=s(e,c,{options:o,context:r});return this.set(e,p,o),p}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=i,c=t(this,T).get(e);if(c!==void 0){let p=t(this,m)[c],v=d(this,l,E).call(this,p);return o&&t(this,ot).call(this,o,c),t(this,Y).call(this,c)?(o&&(o.get="stale"),v?(o&&s&&p.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?p.__staleWhileFetching:void 0):(n||d(this,l,ct).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?p:void 0)):(o&&(o.get="hit"),v?p.__staleWhileFetching:(d(this,l,At).call(this,c),r&&t(this,ft).call(this,c),p))}else o&&(o.get="miss");}delete(e){return d(this,l,ct).call(this,e,"delete")}clear(){return d(this,l,Vt).call(this,"delete")}},K=new WeakMap,M=new WeakMap,q=new WeakMap,ut=new WeakMap,$=new WeakMap,yt=new WeakMap,xt=new WeakMap,B=new WeakMap,O=new WeakMap,X=new WeakMap,T=new WeakMap,b=new WeakMap,m=new WeakMap,P=new WeakMap,z=new WeakMap,N=new WeakMap,R=new WeakMap,J=new WeakMap,D=new WeakMap,Q=new WeakMap,Z=new WeakMap,V=new WeakMap,W=new WeakMap,tt=new WeakMap,dt=new WeakMap,j=new WeakMap,Et=new WeakMap,l=new WeakSet,It=function(){let e=new Dt(t(this,K)),i=new Dt(t(this,K));u(this,V,e),u(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,K)):void 0;u(this,W,s),u(this,Tt,(c,p,v=t(this,B).now())=>{i[c]=p!==0?v:0,e[c]=p,r(c,p);}),u(this,ft,c=>{i[c]=e[c]!==0?t(this,B).now():0,r(c,e[c]);});let r=this.ttlAutopurge?(c,p)=>{if(s?.[c]&&(clearTimeout(s[c]),s[c]=void 0),p&&p!==0&&s){let v=setTimeout(()=>{t(this,Y).call(this,c)&&d(this,l,ct).call(this,t(this,b)[c],"expire");},p+1);v.unref&&v.unref(),s[c]=v;}}:()=>{};u(this,ot,(c,p)=>{if(e[p]){let v=e[p],U=i[p];if(!v||!U)return;c.ttl=v,c.start=U,c.now=n||o();let S=c.now-U;c.remainingTTL=v-S;}});let n=0,o=()=>{let c=t(this,B).now();if(this.ttlResolution>0){n=c;let p=setTimeout(()=>n=0,this.ttlResolution);p.unref&&p.unref();}return c};this.getRemainingTTL=c=>{let p=t(this,T).get(c);if(p===void 0)return 0;let v=e[p],U=i[p];if(!v||!U)return 1/0;let S=(n||o())-U;return v-S},u(this,Y,c=>{let p=i[c],v=e[c];return !!v&&!!p&&(n||o())-p>v});},ft=new WeakMap,ot=new WeakMap,Tt=new WeakMap,Y=new WeakMap,oe=function(){let e=new Dt(t(this,K));u(this,X,0),u(this,Q,e),u(this,mt,i=>{u(this,X,t(this,X)-e[i]),e[i]=0;}),u(this,Ot,(i,s,r,n)=>{if(d(this,l,E).call(this,s))return 0;if(!at(r))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(r=n(s,i),!at(r))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 r}),u(this,bt,(i,s,r)=>{if(e[i]=s,t(this,M)){let n=t(this,M)-e[i];for(;t(this,X)>n;)d(this,l,Lt).call(this,true);}u(this,X,t(this,X)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,X));});},mt=new WeakMap,bt=new WeakMap,Ot=new WeakMap,lt=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,R);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,z)[i];},ht=function*({allowStale:e=this.allowStale}={}){if(t(this,O))for(let i=t(this,N);!(!d(this,l,Mt).call(this,i)||((e||!t(this,Y).call(this,i))&&(yield i),i===t(this,R)));)i=t(this,P)[i];},Mt=function(e){return e!==void 0&&t(this,T).get(t(this,b)[e])===e},Lt=function(e){var n;let i=t(this,N),s=t(this,b)[i],r=t(this,m)[i];return t(this,dt)&&d(this,l,E).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((n=t(this,q))==null||n.call(this,r,s,"evict")),t(this,j)&&t(this,D)?.push([r,s,"evict"])),t(this,mt).call(this,i),t(this,W)?.[i]&&(clearTimeout(t(this,W)[i]),t(this,W)[i]=void 0),e&&(t(this,b)[i]=void 0,t(this,m)[i]=void 0,t(this,J).push(i)),t(this,O)===1?(u(this,N,u(this,R,0)),t(this,J).length=0):u(this,N,t(this,P)[i]),t(this,T).delete(s),Rt(this,O)._--,i},Ct=function(e,i,s,r){let n=i===void 0?void 0:t(this,m)[i];if(d(this,l,E).call(this,n))return n;let o=new Nt,{signal:c}=s;c?.addEventListener("abort",()=>o.abort(c.reason),{signal:o.signal});let p={signal:o.signal,options:s,context:r},v=(w,y=false)=>{let{aborted:a}=o.signal,x=s.ignoreFetchAbort&&w!==void 0,A=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&w!==void 0);if(s.status&&(a&&!y?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,x&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),a&&!x&&!y)return S(o.signal.reason,A);let f=I,g=t(this,m)[i];return (g===I||x&&y&&g===void 0)&&(w===void 0?f.__staleWhileFetching!==void 0?t(this,m)[i]=f.__staleWhileFetching:d(this,l,ct).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,w,p.options))),w},U=w=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=w),S(w,false)),S=(w,y)=>{let{aborted:a}=o.signal,x=a&&s.allowStaleOnFetchAbort,A=x||s.allowStaleOnFetchRejection,f=A||s.noDeleteOnFetchRejection,g=I;if(t(this,m)[i]===I&&(!f||!y&&g.__staleWhileFetching===void 0?d(this,l,ct).call(this,e,"fetch"):x||(t(this,m)[i]=g.__staleWhileFetching)),A)return s.status&&g.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),g.__staleWhileFetching;if(g.__returned===g)throw w},rt=(w,y)=>{var x;let a=(x=t(this,yt))==null?void 0:x.call(this,e,n,p);a&&a instanceof Promise&&a.then(A=>w(A===void 0?void 0:A),y),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(w(void 0),s.allowStaleOnFetchAbort&&(w=A=>v(A,true)));});};s.status&&(s.status.fetchDispatched=true);let I=new Promise(rt).then(v,U),k=Object.assign(I,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return i===void 0?(this.set(e,k,{...p.options,status:void 0}),i=t(this,T).get(e)):t(this,m)[i]=k,k},E=function(e){if(!t(this,dt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Nt},zt=function(e,i){t(this,z)[i]=e,t(this,P)[e]=i;},At=function(e){e!==t(this,R)&&(e===t(this,N)?u(this,N,t(this,P)[e]):d(this,l,zt).call(this,t(this,z)[e],t(this,P)[e]),d(this,l,zt).call(this,t(this,R),e),u(this,R,e));},ct=function(e,i){var r,n;let s=false;if(t(this,O)!==0){let o=t(this,T).get(e);if(o!==void 0)if(t(this,W)?.[o]&&(clearTimeout(t(this,W)?.[o]),t(this,W)[o]=void 0),s=true,t(this,O)===1)d(this,l,Vt).call(this,i);else {t(this,mt).call(this,o);let c=t(this,m)[o];if(d(this,l,E).call(this,c)?c.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,j))&&(t(this,tt)&&((r=t(this,q))==null||r.call(this,c,e,i)),t(this,j)&&t(this,D)?.push([c,e,i])),t(this,T).delete(e),t(this,b)[o]=void 0,t(this,m)[o]=void 0,o===t(this,R))u(this,R,t(this,z)[o]);else if(o===t(this,N))u(this,N,t(this,P)[o]);else {let p=t(this,z)[o];t(this,P)[p]=t(this,P)[o];let v=t(this,P)[o];t(this,z)[v]=t(this,z)[o];}Rt(this,O)._--,t(this,J).push(o);}}if(t(this,j)&&t(this,D)?.length){let o=t(this,D),c;for(;c=o?.shift();)(n=t(this,$))==null||n.call(this,...c);}return s},Vt=function(e){var i,s;for(let r of d(this,l,ht).call(this,{allowStale:true})){let n=t(this,m)[r];if(d(this,l,E).call(this,n))n.__abortController.abort(new Error("deleted"));else {let o=t(this,b)[r];t(this,tt)&&((i=t(this,q))==null||i.call(this,n,o,e)),t(this,j)&&t(this,D)?.push([n,o,e]);}}if(t(this,T).clear(),t(this,m).fill(void 0),t(this,b).fill(void 0),t(this,V)&&t(this,Z)){t(this,V).fill(0),t(this,Z).fill(0);for(let r of t(this,W)??[])r!==void 0&&clearTimeout(r);t(this,W)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),u(this,N,0),u(this,R,0),t(this,J).length=0,u(this,X,0),u(this,O,0),t(this,j)&&t(this,D)){let r=t(this,D),n;for(;n=r?.shift();)(s=t(this,$))==null||s.call(this,...n);}},wt);var Ft=class{cache;map=new Map;constructor(e){this.cache=new re({max:e.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(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var Ut="1.8.17";var Wt={version:Ut};var Yt="repeat";function Ht(h){return {type:"pause",duration:h}}var Kt="__game_layer__";var ve={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"};var ae={};var kt={};fe(kt,{createExportableElement:()=>le});var gt;(r=>(r.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),r.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),r.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),r.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(gt||={});function le(h){try{if(typeof h>"u")return h;let e=JSON.stringify(h);return JSON.parse(e)}catch(e){throw gt.error("Error creating exportable element",h,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var ye=typeof window<"u"&&typeof document<"u",he=[" _______ _ _ _ ____ ____ ____ _____ ","|_ __ \\ (_) (_) | | |_ _| |_ _||_ \\|_ _|"," | |__) |__ _ __ __ \\_| \\ \\ / / | \\ | | "," | ___/[ | [ \\ [ ][ | \\ \\ / / | |\\ \\| | "," _| |_ | | > ' < | | \\ ' / _| |_\\ |_ ",`|_____| [___][__]\`\\_][___] \\_/ |_____|\\____| v${Wt.version}`],ce=31,xe="background:#2f90da;color:#fff;font-weight:bold;",Ee="background:#c832bb;color:#fff;font-weight:bold;",be="background:transparent;font-weight:bold;",qt=` v${Wt.version}`;function de(){if(!ye)return;let h=[],e=[];for(let i=0;i<he.length;i++){let s=he[i],r=s.endsWith(qt),n=r?s.slice(0,-qt.length):s,o=n.slice(0,ce),c=n.slice(ce),p=r?"%c%s%c%s%c%s":"%c%s%c%s";h.push(p),e.push(xe,o,Ee,c),r&&e.push(be,qt);}console.info(h.join(`
2
2
  `),...e);}function $t(){let h=window.location.pathname+window.location.hash;return h.includes("#")&&(h=h.split("#")[1]),h}de();exports.Game=void 0;(y=>{async function h(a,x,A){if(core.GameUnifier.init({navigate:x?.navigate,getCurrentGameStepState:()=>{let f={};try{f=nt__namespace.canvas.export();}catch{}return {path:$t(),storage:G__namespace.storage.export(),canvas:f,sound:pt__namespace.sound.export(),labelIndex:L__namespace.NarrationManagerStatic.currentLabelStepIndex||0,openedLabels:L__namespace.narration.openedLabels}},restoreGameStepState:async(f,g)=>{et__namespace.HistoryManagerStatic._originalStepData=f,L__namespace.NarrationManagerStatic.openedLabels=f.openedLabels,G__namespace.storage.restore(f.storage);try{await nt__namespace.canvas.restore(f.canvas),await pt__namespace.sound.restore(f.sound);}catch(F){gt.error("Error restoring game step state:",F);}await g(f.path);},getStepCounter:()=>L__namespace.narration.stepCounter,setStepCounter:f=>{L__namespace.NarrationManagerStatic._stepCounter=f;},getOpenedLabels:()=>L__namespace.narration.openedLabels.length,addHistoryItem:(f,g)=>et__namespace.stepHistory.add(f,g),getCharacter:f=>Bt__namespace.RegisteredCharacters.get(f),processNavigationRequests:(f,g)=>{let F=f,H=Promise.resolve();return f>0?(F--,H=L__namespace.narration.continue(g)):f<0&&(F=0,H=et__namespace.stepHistory.back(g,{steps:f*-1})),{newValue:F,result:H}},animate:(f,g,F,H)=>motion.motion.animate(f,g,F,H),getVariable:(f,g)=>G__namespace.StorageRegistry.getVariable(f,g),setVariable:(f,g,F)=>G__namespace.StorageRegistry.setVariable(f,g,F),removeVariable:(f,g)=>G__namespace.StorageRegistry.removeVariable(f,g),getFlag:f=>G__namespace.storage.getFlag(f),setFlag:(f,g)=>G__namespace.storage.setFlag(f,g),onLabelClosing:f=>G__namespace.StorageRegistry.clearOldTempVariables(f)}),!a||!x){gt.warn("The canvas element or options are not defined. The canvas will not be initialized.");return}return await nt__namespace.canvas.init(a,x,A)}y.init=h;function e(){G__namespace.storage.clear();try{nt__namespace.canvas.clear();}catch{}pt__namespace.sound.clear(),L__namespace.narration.clear(),et__namespace.stepHistory.clear();}y.clear=e;function i(){let a={};try{a=nt__namespace.canvas.export();}catch{}return {pixivn_version:Ut,stepData:L__namespace.narration.export(),storageData:G__namespace.storage.export(),canvasData:a,soundData:pt__namespace.sound.export(),historyData:et__namespace.stepHistory.export(),path:$t()}}y.exportGameState=i;async function s(a,x){et__namespace.stepHistory.restore(a.historyData);let A=et__namespace.stepHistory.lastKey;if(typeof A=="number"){let f=et__namespace.stepHistory.stepsInfoMap.get(A)||null;await L__namespace.narration.restore(a.stepData,f);}G__namespace.storage.restore(a.storageData);try{await nt__namespace.canvas.restore(a.canvasData),await pt__namespace.sound.restore(a.soundData);}catch{}x?await x(a.path):await core.GameUnifier.navigate(a.path);}y.restoreGameState=s;async function r(a,x){return y.clear(),await L__namespace.narration.call(a,x)}y.start=r;function n(a){return JSON.parse(a)}y.jsonToGameState=n;function o(a){core.GameUnifier.onEnd=a;}y.onEnd=o;function c(a){return gt.warn("Game.onError is deprecated. Use Game.addOnError / Game.removeOnError to register multiple handlers."),core.GameUnifier.addOnError((x,A)=>a("step",x,A))}y.onError=c;function p(a){return core.GameUnifier.addOnError(a)}y.addOnError=p;function v(a){return core.GameUnifier.removeOnError(a)}y.removeOnError=v;function U(a){L__namespace.NarrationManagerStatic.onStepStart=a;}y.onStepStart=U;function S(a){L__namespace.NarrationManagerStatic.onLoadingLabel=a;}y.onLoadingLabel=S;function rt(a){L__namespace.NarrationManagerStatic.onStepEnd=a;}y.onStepEnd=rt;function I(a){core.GameUnifier.navigate=a;}y.onNavigate=I;function k(a){return core.GameUnifier.addOnPreContinue(a)}y.addOnPreContinue=k;function w(a){return core.GameUnifier.removeOnPreContinue(a)}y.removeOnPreContinue=w;})(exports.Game||={});var Ze={characterUtils:Bt__namespace,canvasUtils:nt__namespace,narrationUtils:L__namespace,soundUtils:pt__namespace,CANVAS_APP_GAME_LAYER_ALIAS:Kt,Pause:Ht,Repeat:Yt,PIXIVN_VERSION:Ut,...kt,...ae,canvas:nt__namespace.canvas,narration:L__namespace.narration,sound:pt__namespace.sound,storage:G__namespace.storage,history:et__namespace.stepHistory,Game:exports.Game,GameUnifier:core.GameUnifier};exports.CANVAS_APP_GAME_LAYER_ALIAS=Kt;exports.CachedMap=Ft;exports.PIXIVN_VERSION=Ut;exports.Pause=Ht;exports.Repeat=Yt;exports.SYSTEM_RESERVED_STORAGE_KEYS=ve;exports.createExportableElement=le;exports.default=Ze;Object.keys(nt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return nt[k]}})});Object.keys(Bt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return Bt[k]}})});Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(et).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return et[k]}})});Object.keys(L).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return L[k]}})});Object.keys(pt).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return pt[k]}})});Object.keys(G).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return G[k]}})});
package/dist/index.d.cts CHANGED
@@ -29,7 +29,7 @@ import './HistoryStep-G9dUn0Lf.cjs';
29
29
  import 'microdiff';
30
30
  import './StorageElementType-C7ETezlL.cjs';
31
31
 
32
- var version = "1.8.16";
32
+ var version = "1.8.17";
33
33
 
34
34
  /**
35
35
  * @deprecated
package/dist/index.d.ts CHANGED
@@ -29,7 +29,7 @@ import './HistoryStep-G9dUn0Lf.js';
29
29
  import 'microdiff';
30
30
  import './StorageElementType-C7ETezlL.js';
31
31
 
32
- var version = "1.8.16";
32
+ var version = "1.8.17";
33
33
 
34
34
  /**
35
35
  * @deprecated