@drincs/pixi-vn 1.9.2 → 1.9.3

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 {e,d as d$1,g as g$1,b,c as c$1,f as f$1,a as a$1}from'./chunk-HD353M4B.mjs';import {c,d,e as e$1,f as f$2}from'./chunk-HQQ5WH6C.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';import B,{Container}from'@drincs/pixi-vn/pixi.js';import {initDevtools}from'@pixi/devtools';var Fe={extension:{type:"sceneProperties",name:"additional-positions"},testNode(t){return "xAlign"in t||"yAlign"in t||"percentageX"in t||"percentageY"in t||"positionType"in t},testProp(t){switch(t){case "xAlign":case "yAlign":case "percentageX":case "percentageY":case "positionType":return true;default:return false}},setProperty(t,e,i){switch(e){case "xAlign":"xAlign"in t&&(t.xAlign=i/100);break;case "yAlign":"yAlign"in t&&(t.yAlign=i/100);break;case "percentageX":"percentageX"in t&&(t.percentageX=i/100);break;case "percentageY":"percentageY"in t&&(t.percentageY=i/100);break}},getProperties(t){return [{value:t.positionType,prop:"positionType",entry:{section:"Transform",type:"text",label:"Position Type"}},{value:t.xAlign*100,prop:"xAlign",entry:{section:"Transform",type:"range",label:"X Align",tooltip:"0% is left, 100% is right",options:{min:0,max:100}}},{value:t.yAlign*100,prop:"yAlign",entry:{section:"Transform",type:"range",label:"Y Align",tooltip:"0% is top, 100% is bottom",options:{min:0,max:100}}},{value:t.percentageX*100,prop:"percentageX",entry:{section:"Transform",type:"range",label:"X Percentage Position",tooltip:"0% is left, 100% is right",options:{min:0,max:100}}},{value:t.percentageY*100,prop:"percentageY",entry:{section:"Transform",type:"range",label:"Y Percentage Position",tooltip:"0% is top, 100% is bottom",options:{min:0,max:100}}}]}},be=Fe;function Ae(t,e){let i=0;return async(...n)=>{let r=Date.now();if(r-i>=e)return i=r,await t(...n)}}var _e=c(a(),1),g=class t{constructor(){}static _app=void 0;static get app(){if(!t._app)throw e$1.error("The canvas is not initialized"),new PixiError("invalid_usage","CanvasManagerStatic.app is undefined");return t._app}static get gameLayer(){let e=t.app.stage.getChildByLabel(a$1);return e||(e=new B.Container,e.label=a$1,t.app.stage.addChild(e)),e}static htmlLayers=[];static canvasWidth=300;static canvasHeight=300;static _isInitialized=false;static async init(e,i,n){let{id:r="pixi-vn-canvas",width:a=800,height:o=600,resolution:p=1,autoDensity:d=true,resizeMode:s="contain",...c}=i||{};return t.canvasWidth=a,t.canvasHeight=o,t._app=new B.Application,t.app.init({width:a,height:o,resolution:p,autoDensity:d,...c}).then(()=>{let{app:l=t.app,extensions:u=[],...y}=n||{};if(initDevtools({app:l,extensions:[be,...u],...y}),t._isInitialized=true,t.addCanvasIntoHTMLElement(e,r),s==="contain"){let x=Ae(async()=>{requestAnimationFrame(()=>t.resize());},10);new ResizeObserver(x).observe(e),t.resize(),setTimeout(()=>t.resize(),750);}t.gameLayer;})}static addCanvasIntoHTMLElement(e,i){t._isInitialized?(e.appendChild(t.app.canvas),t.app.canvas.id=i):e$1.error("GameWindowManager is not initialized");}static addHtmlLayer(e,i,n={}){let{position:r="absolute",pointerEvents:a="none",userSelect:o="none"}=n,p=document.createElement("div");p.setAttribute("id",e),p.style.position=r,p.style.pointerEvents=a,p.style.userSelect=o;let d=i.appendChild(p);return t.htmlLayers.push(p),t.resize(),d}static removeHtmlLayer(e){let i=t.htmlLayers.find(n=>n.id===e);i&&(i.remove(),t.htmlLayers=t.htmlLayers.filter(n=>n.id!==e));}static getHtmlLayer(e){return t.htmlLayers.find(i=>i.id===e)}static async resize(){let e=t.canvasWidth,i=t.canvasHeight,n=t.app.resizeTo,r=t.app.canvas.style;n instanceof HTMLElement||(n=document.documentElement);let a,o;if(n===document.body||n===document.documentElement)a=document.documentElement.clientWidth||window.innerWidth,o=document.documentElement.clientHeight||window.innerHeight;else {let u=n.getBoundingClientRect();a=u.width||n.clientWidth,o=u.height||n.clientHeight;}let p=Math.min(a/e,o/i),d=Math.floor(p*e),s=Math.floor(p*i);r.width=`${d}px`,r.height=`${s}px`;let c=(a-d)/2,l=(o-s)/2;r.marginLeft=`${c}px`,r.marginRight=`${c}px`,r.marginTop=`${l}px`,r.marginBottom=`${l}px`,t.htmlLayers.forEach(u=>{u.style.width=`${d}px`,u.style.height=`${s}px`,u.style.marginLeft=`${c}px`,u.style.marginRight=`${c}px`,u.style.marginTop=`${l}px`,u.style.marginBottom=`${l}px`;});}static get childrenAliasesOrder(){return t.gameLayer.children.filter(e=>e.label).sort((e,i)=>t.gameLayer.getChildIndex(e)-t.gameLayer.getChildIndex(i)).map(e=>e.label)}static get currentTickersWithoutCreatedBySteps(){return Object.fromEntries(Array.from(t._currentTickers.entries()).filter(([e,i])=>!i.createdByTicketSteps).map(([e,i])=>[e,{id:i.ticker.alias,args:i.ticker.args,canvasElementAliases:i.ticker.canvasElementAliases,priority:i.ticker.priority,duration:i.ticker.duration,paused:i.ticker.paused}]))}static _currentTickers=new Map;static _currentTickersSequence=new Map;static get currentTickersSequence(){return Object.fromEntries(Array.from(t._currentTickersSequence.entries()).map(([e,i])=>[e,Object.fromEntries(i)]))}static _currentTickersTimeouts=new Map;static _tickersToCompleteOnStepEnd={tikersIds:[],stepAlias:[]};static generateTickerId(...e){try{return `${(0,_e.default)(JSON.stringify(e)).toString()}_${Math.random().toString(36).substring(7)}`}catch(i){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${i}`)}}static addTickerTimeoutInfo(e,i,n,r){typeof e=="string"&&(e=[e]),t._currentTickersTimeouts.set(n,{aliases:e,ticker:i,canBeDeletedBeforeEnd:r});}static removeTickerTimeoutInfo(e){typeof e!="string"&&(e=e.toString()),t._currentTickersTimeouts.delete(e);}static removeTickerTimeout(e){typeof e!="string"&&(e=e.toString()),clearTimeout(Number(e)),t.removeTickerTimeoutInfo(e);}static removeTickerTimeoutsByAlias(e,i){t._currentTickersTimeouts.forEach((n,r)=>{let a=n.aliases.filter(o=>o!==e);if(a.length===0){let o=n.canBeDeletedBeforeEnd;(!i||o)&&t.removeTickerTimeout(r);}else n.aliases=a;});}};var ue=Symbol("SerializableEvent"),X=new d({cacheSize:5});function Ze(t){return (e,i,n)=>{let r=n.value;fe.add(r,t||`${i}`);}}var fe;(a=>{function t(o,p){o[ue]=p,X.get(p)&&e$1.info(`Event "${p}" already exists, it will be overwritten`),X.set(p,o);}a.add=t;function e(o){try{let p=X.get(o);if(!p){e$1.error(`Event "${o}" not found, did you forget to register it with the eventDecorator?`);return}return p}catch(p){e$1.error(`Error while getting Event "${o}"`,p);return}}a.get=e;function i(){return Array.from(X.values())}a.values=i;function n(o){return X.has(o)}a.has=n;function r(){return Array.from(X.keys())}a.keys=r;})(fe||={});var ge=fe;async function we(t,e){if("onEvents"in e)for(let i in e.onEvents){let n=e.onEvents[i],r=ge.get(n);r&&t.on(i,r);}}function Oe(t){let{onEventsHandlers:e={}}=t;return e}function O(t,e,i){let n=i[ue];return n&&typeof n=="string"?(e.onEventsHandlers[t]=n,true):(e$1.warn(`The event handler for event "${t}" is not registered with the eventDecorator, it will not be saved in the memory and it will not work after loading the game. Please register the event handler with the eventDecorator to avoid this warning. Read more about it here: https://pixi-vn.com/start/canvas-functions#add-a-listener-to-an-event`),false)}var q=new d({cacheSize:5}),Be=new d({cacheSize:2}),Le=new d({cacheSize:2});function Je(t={}){return e=>{he.add(e,t);}}async function S(t,e,i){let n=i?.ignoreScale||false,r=i?.end;"isRenderGroup"in e&&e.isRenderGroup!==void 0&&(t.isRenderGroup=e.isRenderGroup),"blendMode"in e&&e.blendMode!==void 0&&(t.blendMode=e.blendMode),"tint"in e&&e.tint!==void 0&&(t.tint=e.tint),"alpha"in e&&e.alpha!==void 0&&(t.alpha=e.alpha),"angle"in e&&e.angle!==void 0&&(t.angle=e.angle),"renderable"in e&&e.renderable!==void 0&&(t.renderable=e.renderable),"rotation"in e&&e.rotation!==void 0&&(t.rotation=e.rotation),!n&&"scale"in e&&e.scale!==void 0&&(typeof e.scale=="number"?t.scale.set(e.scale,e.scale):t.scale.set(e.scale.x,e.scale.y)),"pivot"in e&&e.pivot!==void 0&&(typeof e.pivot=="number"?t.pivot.set(e.pivot,e.pivot):t.pivot.set(e.pivot.x,e.pivot.y)),"position"in e&&e.position!==void 0&&t.position.set(e.position.x,e.position.y),"skew"in e&&e.skew!==void 0&&t.skew.set(e.skew.x,e.skew.y),"visible"in e&&e.visible!==void 0&&(t.visible=e.visible),"x"in e&&e.x!==void 0&&(t.x=e.x),"y"in e&&e.y!==void 0&&(t.y=e.y),"boundsArea"in e&&e.boundsArea!==void 0&&(t.boundsArea=e.boundsArea),"cursor"in e&&e.cursor!==void 0&&(t.cursor=e.cursor),"eventMode"in e&&e.eventMode!==void 0&&(t.eventMode=e.eventMode),"interactive"in e&&e.interactive!==void 0&&(t.interactive=e.interactive),"interactiveChildren"in e&&e.interactiveChildren!==void 0&&(t.interactiveChildren=e.interactiveChildren),"hitArea"in e&&e.hitArea!==void 0&&(t.hitArea=e.hitArea),we(t,e),"align"in e&&e.align!==void 0&&"align"in t&&(t.align=e.align),"percentagePosition"in e&&e.percentagePosition!==void 0&&"percentagePosition"in t&&(t.percentagePosition=e.percentagePosition),r&&await r(),n||("width"in e&&e.width!==void 0&&(t.width=e.width),"height"in e&&e.height!==void 0&&(t.height=e.height));}var he;(p=>{function t(d,s={}){let{name:c=d.name,getInstance:l=async(y,x)=>{let T=new y;return await T.setMemory(x),T},copyProperty:u=async(y,x)=>{await y.setMemory(x);}}=s;q.get(c)&&e$1.warn(`CanvasElement "${c}" already registered`),d.prototype.pixivnId=c,q.set(c,d),Be.set(c,l),Le.set(c,u);}p.add=t;function e(d){let s=q.get(d);if(!s){e$1.error(`CanvasElement "${d}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return s}p.get=e;async function i(d,s){let c=e(d),l=Be.get(d);if(!c||!l){e$1.error(`CanvasElement "${d}" not found, did you forget to register it with the canvasComponentDecorator?`);return}try{return await l(c,s)}catch(u){e$1.error(`Error while getting CanvasElement instance "${d}"`,u);}}p.getInstance=i;async function n(d,s,c){let l=Le.get(d);if(!l){e$1.error(`CanvasElement "${d}" not found, did you forget to register it with the canvasComponentDecorator?`);return}try{await l(s,c);}catch(u){e$1.error(`Error while copying properties of CanvasElement "${d}"`,u);}}p.copyProperty=n;function r(){return Array.from(q.values())}p.values=r;function a(d){return q.has(d)}p.has=a;function o(){return Array.from(q.keys())}p.keys=o;})(he||={});var k=he;async function J(t){let e=await k.getInstance(t.pixivnId,t);if(!e)throw new PixiError("unregistered_element",`The element ${t.pixivnId} could not be created`,"canvas",t);return e}function ye(t){return "memory"in t?t.memory:t instanceof B.Text?Te(t):t instanceof B.Sprite?xe(t):L(t)}function et(t){let e=t.parent;return {width:t.width,height:t.height,isRenderGroup:t.isRenderGroup,blendMode:t.blendMode,tint:t.tint,alpha:t.alpha,angle:t.angle,renderable:t.renderable,rotation:t.rotation,scale:{x:t.scale.x,y:t.scale.y},pivot:{x:t.pivot.x,y:t.pivot.y},position:{x:t.position.x,y:t.position.y},skew:{x:t.skew.x,y:t.skew.y},visible:t.visible,x:t.x,y:t.y,boundsArea:t.boundsArea,cursor:t.cursor,eventMode:t.eventMode,interactive:t.interactive,interactiveChildren:t.interactiveChildren,hitArea:t.hitArea,index:e?.getChildIndex(t),parentLabel:e?.label,label:t.label}}function me(t,e){return {url:t.source.label,alias:e===t.source.label?void 0:e}}function L(t,e){let i=tt(t,b),r=e?.childrenExport||false?t.children.sort((a,o)=>t.getChildIndex(a)-t.getChildIndex(o)).map(a=>ye(a)):[];return {pixivnId:i,elements:r,onEvents:Oe(t),...et(t)}}function xe(t){let e$1=L(t),i=e$1.pixivnId??e,n="assetsAliases"in t&&Array.isArray(t.assetsAliases)?me(t.texture,t.assetsAliases[0]):"textureAlias"in t?me(t.texture,t.textureAlias):me(t.texture);return {...e$1,pixivnId:i,textureData:n,anchor:{x:t.anchor.x,y:t.anchor.y},roundPixels:t.roundPixels}}function Te(t){let e=L(t),i=e.pixivnId??f$1;return {...e,pixivnId:i,anchor:{x:t.anchor.x,y:t.anchor.y},text:t.text,resolution:t.resolution,style:st(t.style),roundPixels:t.roundPixels}}function tt(t,e){return Object.hasOwn(t,"pixivnId")?t.pixivnId:e}function Q(t){switch(t.type){case "linear":return {type:"linear",colorStops:t.colorStops,end:{x:t.end.x,y:t.end.y},start:{x:t.start.x,y:t.start.y},textureSpace:t.textureSpace,wrapMode:t.texture.source.wrapMode,textureSize:t.texture.source.width/t.texture.source.height};case "radial":return {type:"radial",colorStops:t.colorStops,textureSpace:t.textureSpace,center:{x:t.center.x,y:t.center.y},innerRadius:t.innerRadius,outerCenter:{x:t.outerCenter.x,y:t.outerCenter.y},outerRadius:t.outerRadius,rotation:t.rotation,scale:t.scale,wrapMode:t.texture.source.wrapMode,textureSize:t.texture.source.width/t.texture.source.height}}}function it(t){if(t!=null){{if(typeof t=="number")return t;if(typeof t=="string"||Array.isArray(t))return t;if(t instanceof B.FillGradient)return Q(t);if(typeof t=="object"&&"fill"in t&&typeof t.fill!="function"&&t.fill){if(!(t.fill instanceof B.FillPattern))return Q(t.fill)}}e$1.warn("Unsupported property type for Text.style.fill.",t);}}function rt(t){if(typeof t=="number")return t;if(typeof t=="string")return t;if(Array.isArray(t))return t;if(t instanceof B.Color)return t.toNumber();e$1.warn("Unsupported color type.",t);}function nt(t){if(t!=null){{if(typeof t=="number")return t;if(typeof t=="string"||Array.isArray(t))return t;if(t instanceof B.FillGradient)return Q(t);if(typeof t=="object"&&"alignment"in t)return {alignment:t.alignment,alpha:t.alpha,color:rt(t.color),join:t.join,miterLimit:t.miterLimit,width:t.width,cap:t.cap,pixelLine:t.pixelLine,textureSpace:t.textureSpace};if(typeof t=="object"&&"fill"in t&&typeof t.fill!="function"&&t.fill){if(!(t.fill instanceof B.FillPattern))return Q(t.fill)}}e$1.warn("Unsupported property type for Text.style.stroke.",t);}}function st(t){return {align:t.align,breakWords:t.breakWords,dropShadow:t.dropShadow,fill:it(t.fill),fontFamily:t.fontFamily,fontSize:t.fontSize,fontStyle:t.fontStyle,fontVariant:t.fontVariant,fontWeight:t.fontWeight,leading:t.leading,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,padding:t.padding,stroke:nt(t.stroke),textBaseline:t.textBaseline,trim:t.trim,whiteSpace:t.whiteSpace,wordWrap:t.wordWrap,wordWrapWidth:t.wordWrapWidth}}var Re=c(a(),1);var ee=class{constructor(e,i){this.alias=this.constructor.prototype.id;let{duration:n,priority:r,id:a=this.generateTickerId(this.alias,i),canvasElementAliases:o=[]}=i||{};this.args=e,this.duration=n,this.priority=r,this.id=a,this.canvasElementAliases=o;}alias;id;args;duration;priority;ticker=new B.Ticker;canvasElementAliases=[];generateTickerId(...e){try{return (0,Re.default)(JSON.stringify(e)).toString()+"_"+Math.random().toString(36).substring(7)}catch(i){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${i}`)}}fnValue;complete(e){this.stop();}stop(){let e=this.fnValue;if(!e){e$1.warn("TickerBase.stop() called without fnValue set. This may cause issues.");return}this.ticker.remove(e,null);}start(){let e=this.id,i=()=>this.fn(this.ticker,this.args,this.canvasElementAliases,e);this.fnValue=i,this.ticker.add(i,null,this.priority),this.ticker.start();}pause(){this.ticker.stop();}play(){this.ticker.start();}get paused(){return !this.ticker.started}};var R=new d({cacheSize:5});function ct(t){return function(e){ve.add(e,t);}}var ve;(o=>{function t(p,d){d||(d=p.name),R.get(d)&&e$1.info(`Ticker "${d}" already exists, it will be overwritten`),p.prototype.id=d,R.set(d,p);}o.add=t;function e(p){try{let d=R.get(p);if(!d){e$1.error(`Event "${p}" not found, did you forget to register it with the tickerDecorator?`);return}return d}catch(d){e$1.error(`Error while getting Event "${p}"`,d);return}}o.get=e;function i(p,d,s){try{let c=R.get(p);if(!c){e$1.error(`Ticker "${p}" not found, did you forget to register it with the tickerDecorator?`);return}return new c(d,s)}catch(c){e$1.error(`Error while getting Ticker "${p}"`,c);return}}o.getInstance=i;function n(){return Array.from(R.values())}o.values=n;function r(p){return R.has(p)}o.has=r;function a(){return Array.from(R.keys())}o.keys=a;})(ve||={});var D=ve;var De="aliasToRemoveAfter";var G=class{tickersPausedByGameLayerRender=[];get app(){return g.app}get gameLayer(){return g.gameLayer}get isInitialized(){return g._isInitialized}get width(){return g.canvasWidth}get height(){return g.canvasHeight}get screen(){return this.app.screen}async init(e,i,n){return await g.init(e,i,n)}get children(){return g.gameLayer.children}async copyCanvasElementProperty(e,i,n={}){let r=["isRenderGroup","scale","visible","boundsArea","text","resolution","style","height","width"],{ignoreProperties:a=d=>d}=n;if(typeof i=="string"){let d=this.find(i);if(d)i=d;else {e$1.error(`Canvas element ${i} not found`);return}}if(typeof e=="string"){let d=this.find(e);if(d)e=d;else {e$1.error(`Canvas element ${e} not found`);return}}e instanceof B.Container&&(e=e.memory);let o=a(r),p={...e};o.forEach(d=>{d in p&&delete p[d];}),await k.copyProperty(i.pixivnId,i,p);}add(e,i,n={}){if(e===a$1){e$1.error(`The alias ${a$1} is reserved`);return}let r=this.find(e),a=n?.ignoreOldStyle;r&&!a&&this.copyCanvasElementProperty(r,i);let{zIndex:o=r?.parent?.getChildIndex(r)}=n;r&&!this.canvasElementIsOnCanvas(r)?e$1.error(`The canvas element ${e} exist in the memory but it is not on the canvas, so the zIndex is not set`):r&&this.remove(e,{ignoreTickers:true}),o!==void 0?(i.label=e,this.gameLayer.addChildAt(i,o)):(i.label=e,this.gameLayer.addChild(i));}remove(e,i={}){if(e===a$1){e$1.error(`The alias ${a$1} is reserved`);return}let n=i.ignoreTickers;typeof e=="string"&&(e=[e]),e.forEach(r=>{this.gameLayer.getChildrenByLabel(r).forEach(a=>{this.gameLayer.removeChild(a),!n&&this.unlinkComponentFromTickerInternal(r);});});}find(e){if(e===a$1)return this.gameLayer;let i=this.gameLayer.getChildByLabel(e);if(i)return i}canvasElementIsOnCanvas(e){return this.gameLayer.children.includes(e)}removeAll(){this.gameLayer.removeChildren();}editAlias(e,i,n={}){let r=this.find(e);r&&(r.label=i),!n.ignoreTickers&&this.transferTickersInternal(e,i,"move");}get currentTickers(){return this.tickers.currentTickers}get currentTickersSteps(){return this.tickers.currentTickersSteps}findTicker(e){return this.findTickerInternal(e)}findTickerInternal(e){let i=g._currentTickers.get(e);if(i)return i.ticker}addTicker(e,i){return this.addTickerInternal(e,i)}addTickerInternal(e,i){let n=i.id,r=i.alias;if(typeof e=="string"&&(e=[e]),i.canvasElementAliases=e,!D.has(r)){e$1.error(`Ticker ${r} not found`);return}let a={ticker:i};if(g._currentTickers.set(n,a),a.ticker.start(),i.duration){let o=setTimeout(()=>{g.removeTickerTimeoutInfo(o),g._currentTickersTimeouts.get(o.toString())&&a.ticker.complete({ignoreTickerSteps:true});},i.duration*1e3);g.addTickerTimeoutInfo(e,r,o.toString(),true);}return n}addTickersSequence(e,i,n=0){if(i.length===0){e$1.warn("The steps of the tickers is empty");return}g._currentTickersSequence.has(e)||g._currentTickersSequence.set(e,new Map);let r={currentStepNumber:n,steps:i.map(o=>({ticker:o.alias,args:f$2(o.args),duration:o.duration}))},a=g.generateTickerId(r);return g._currentTickersSequence.get(e)?.set(a,r),this.runTickersSequence(e,a),a}runTickersSequence(e,i){let n=g._currentTickersSequence.get(e);if(!n?.has(i))return;let r=n.get(i).steps[n.get(i).currentStepNumber],a=D.getInstance(r.ticker,r.args,{canvasElementAliases:[e],duration:r.duration,priority:r.priority});if(!a){e$1.error(`Ticker ${r.ticker} not found`);return}let o=a.alias,p=a.id;a.canvasElementAliases=[e];let d={createdByTicketSteps:{canvasElementAlias:e,id:i},ticker:a};if(g._currentTickers.set(p,d),d.ticker.start(),a.duration){let s=setTimeout(()=>{let c=g._currentTickersTimeouts.get(s.toString());c&&(d.ticker.complete({ignoreTickerSteps:true}),c.aliases.forEach(l=>{this.nextTickerStep(l,i);})),g.removeTickerTimeoutInfo(s);},a.duration*1e3);g.addTickerTimeoutInfo(e,o,s.toString(),false);}}nextTickerStep(e,i){let n=g._currentTickersSequence.get(e);if(n?.has(i)){let r=n.get(i);r.currentStepNumber+1<r.steps.length?(r.currentStepNumber++,n.set(i,r),this.runTickersSequence(e,i)):i&&n.has(i)&&(n.delete(i),g._currentTickers.forEach((a,o)=>{a.createdByTicketSteps?.canvasElementAlias===e&&a.createdByTicketSteps.id===i&&this.removeTickerInternal(o);}));}}onTickerComplete(e,i){return this.onTickerCompleteInternal(e,i)}onTickerCompleteInternal(e,i){let{stopTicker:n=true,aliasToRemoveAfter:r,tickerAliasToResume:a,tickerIdToResume:o}=i,p=g._currentTickers.get(e),d=i.ignoreTickerSteps||false;this.remove(r),a.forEach(s=>{this.resumeTickerInternal({canvasAlias:s});}),this.resumeTickerInternal({id:o}),p&&(this.removeTickerInternal(e,{stopTicker:n}),!d&&p.ticker.duration===void 0&&p.createdByTicketSteps&&this.nextTickerStep(p.createdByTicketSteps.canvasElementAlias,p.createdByTicketSteps.id));}unlinkComponentFromTicker(e,i){return this.unlinkComponentFromTickerInternal(e,i)}unlinkComponentFromTickerInternal(e,i){if(typeof e=="string"&&(e=[e]),!i){e.forEach(r=>{g._currentTickers.forEach((a,o)=>{a.ticker.canvasElementAliases.includes(r)&&(a.ticker.canvasElementAliases.length===1?this.removeTickerInternal(o):a.ticker.canvasElementAliases=a.ticker.canvasElementAliases.filter(p=>p!==r));}),g._currentTickersSequence.has(r)&&g._currentTickersSequence.delete(r),g.removeTickerTimeoutsByAlias(r,false);});return}let n;typeof i=="string"?n=i:n=i.prototype.id,e.forEach(r=>{let a=g._currentTickersSequence.get(r);a&&a.forEach((o,p)=>{o.steps.find(d=>typeof d=="object"&&"ticker"in d&&d.ticker===n)&&a.delete(p);});}),g._currentTickers.forEach(r=>{r.ticker.alias===n&&(r.ticker.canvasElementAliases=r.ticker.canvasElementAliases.filter(a=>!e.includes(a)));}),g._currentTickersTimeouts.forEach(r=>{r.ticker===n&&r.canBeDeletedBeforeEnd&&(r.aliases=r.aliases.filter(a=>!e.includes(a)));}),this.removeTickersWithoutAssociatedCanvasElement();}removeTickersWithoutAssociatedCanvasElement(){g._currentTickers.forEach(e=>{e.ticker.canvasElementAliases=e.ticker.canvasElementAliases.filter(i=>this.find(i)),e.ticker.canvasElementAliases.length===0&&e.ticker.complete({ignoreTickerSteps:true});}),g._currentTickersSequence.forEach((e,i)=>{e===void 0&&g._currentTickersSequence.delete(i);}),Array.from(g._currentTickersTimeouts.keys()).forEach(e=>{let i=g._currentTickersTimeouts.get(e);i&&i.aliases.length===0&&g.removeTickerTimeout(e);});}removeAllTickers(){return this.removeAllTickersInternal()}removeAllTickersInternal(){this.tickersPausedByGameLayerRender=[],g._currentTickersSequence.clear(),Array.from(g._currentTickers.keys()).forEach(e=>{this.removeTickerInternal(e);}),g._currentTickers.clear(),Array.from(g._currentTickersTimeouts.keys()).forEach(e=>{g.removeTickerTimeout(e);}),g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.stepAlias.length=0;}removeTicker(e,i={stopTicker:true}){return this.removeTickerInternal(e,i)}removeTickerInternal(e,i={stopTicker:true}){typeof e=="string"&&(e=[e]),e.forEach(n=>{let r=g._currentTickers.get(n);r&&(i.stopTicker&&r.ticker.stop(),g._currentTickers.delete(n));});}pauseTicker(e){return this.pauseTickerInternal(e)}pauseTickerInternal(e){let i=[];if("canvasAlias"in e){let{canvasAlias:n,tickerIdsExcluded:r=[]}=e;g._currentTickers.forEach((a,o)=>{a.ticker.canvasElementAliases.includes(n)&&!r.includes(a.ticker.alias)&&a.ticker.paused===false&&(a.ticker.pause(),i.push(o));});}else if("id"in e){let{id:n}=e;typeof n=="string"&&(n=[n]),[...new Set(n)].forEach(r=>{let a=g._currentTickers.get(r);a?a.ticker.paused===false&&(a.ticker.pause(),i.push(r)):e$1.error(`Ticker with id ${r} not found`);});}return i}resumeTicker(e){return this.resumeTickerInternal(e)}resumeTickerInternal(e){if("canvasAlias"in e){let{canvasAlias:i}=e;g._currentTickers.forEach(n=>{n.ticker.canvasElementAliases.includes(i)&&n.ticker.play();});}else if("id"in e){let{id:i}=e;typeof i=="string"&&(i=[i]),[...new Set(i)].forEach(n=>{let r=g._currentTickers.get(n);r?r.ticker.play():e$1.error(`Ticker with id ${n} not found`);});}}isTickerPaused(e,i){return this.isTickerPausedInternal(e,i)}isTickerPausedInternal(e,i){return false}pause(){this.gameLayer.renderable!==false&&(this.gameLayer.renderable=false,this.tickersPausedByGameLayerRender=this.pauseTickerInternal({id:Array.from(g._currentTickers.keys())}));}resume(){if(this.gameLayer.renderable===true)return;this.gameLayer.renderable=true;let e=this.tickersPausedByGameLayerRender.filter(i=>g._currentTickers.has(i));e.length>0&&this.resumeTickerInternal({id:e}),this.tickersPausedByGameLayerRender=[];}transferTickers(e,i,n="move"){return this.transferTickersInternal(e,i,n)}transferTickersInternal(e,i,n="move"){let r=g._currentTickersSequence.get(e);if(r){let o=new Map(Array.from(r.entries()).map(([p,d])=>[p,f$2(d)]));g._currentTickersSequence.set(i,o);}g._currentTickers.forEach((o,p)=>{if(o.createdByTicketSteps?.canvasElementAlias===e&&this.removeTickerInternal(p),o.ticker.canvasElementAliases.includes(e)){let d=D.getInstance(o.ticker.alias,f$2(o.ticker.args),{duration:o.ticker.duration,priority:o.ticker.priority,canvasElementAliases:[i]});if(d?(this.addTickerInternal(i,d),o.ticker.paused&&d.pause()):e$1.error(`Ticker ${o.ticker.alias} not found`),n==="move"&&(o.ticker.canvasElementAliases=o.ticker.canvasElementAliases.filter(s=>s!==e)),Object.hasOwn(o.ticker.args,De)){let s=o.ticker.args.aliasToRemoveAfter;typeof s=="string"&&(s=[s]),Array.isArray(s)&&(n==="move"?o.ticker.args.aliasToRemoveAfter=s.map(c=>c===e?i:c):n==="duplicate"&&s.find(c=>c===e)&&(o.ticker.args.aliasToRemoveAfter=[...s,i]));}}}),g._currentTickersTimeouts.forEach(o=>{o.aliases.includes(e)&&(n==="move"?o.aliases=o.aliases.map(p=>p===e?i:p):n==="duplicate"&&o.aliases.find(p=>p===e)&&o.aliases.push(i));});let a=g._currentTickersSequence.get(i);if(a&&a.forEach((o,p)=>{this.runTickersSequence(i,p);}),n==="duplicate"){let o=g._currentTickersSequence.get(e);o&&o.forEach((p,d)=>{this.runTickersSequence(e,d);});}}completeTickerOnStepEnd(e){return this.completeTickerOnStepEndInternal(e)}completeTickerOnStepEndInternal(e){e.alias?g._tickersToCompleteOnStepEnd.stepAlias.push({id:e.id,alias:e.alias}):g._tickersToCompleteOnStepEnd.tikersIds.push({id:e.id});}async forceCompletionOfTicker(e,i){return this.forceCompletionOfTickerInternal(e,i)}async forceCompletionOfTickerInternal(e,i){if(i){let n=g._currentTickersSequence.get(i),r=n?.get(e);if(n&&r){let a=r.steps.map(o=>{if(typeof o=="object"&&"ticker"in o){let p=D.getInstance(o.ticker,o.args,{duration:o.duration,canvasElementAliases:[i],priority:o.priority});if(p)return p.complete()}return Promise.resolve()});await Promise.all(a);}}else {let n=g._currentTickers.get(e);n&&await n.ticker.complete();}}tickers={transfer:(e,i,n)=>this.transferTickersInternal(e,i,n),get currentTickers(){return g._currentTickers},get currentTickersSteps(){return g._currentTickersSequence},find:e=>this.findTickerInternal(e),add:(e,i)=>this.addTickerInternal(e,i),addSequence:(e,i,n)=>this.addTickersSequence(e,i,n),unlinkComponent:(e,i)=>this.unlinkComponentFromTickerInternal(e,i),removeAll:()=>this.removeAllTickersInternal(),remove:e=>this.removeTickerInternal(e),pause:e=>this.pauseTickerInternal(e),resume:e=>this.resumeTickerInternal(e),isPaused:(e,i)=>this.isTickerPausedInternal(e,i),completeOnStepEnd:e=>this.completeTickerOnStepEndInternal(e),forceCompletion:(e,i)=>this.forceCompletionOfTickerInternal(e,i),onComplete:(e,i)=>this.onTickerCompleteInternal(e,i)};animate(e,i,n,r){return GameUnifier.animate(e,i,n,r)}addLayerInternal(e,i){if(e===a$1){e$1.error(`The alias ${a$1} is reserved`);return}return i.label=e,g.app.stage.addChild(i)}getLayerInternal(e){return g.app.stage.getChildByLabel(e)}removeLayerInternal(e){let i=g.app.stage.getChildByLabel(e);i&&g.app.stage.removeChild(i);}addHtmlLayerInternal(e,i,n){return g.addHtmlLayer(e,i,n)}removeHtmlLayerInternal(e){return g.removeHtmlLayer(e)}getHtmlLayerInternal(e){return g.getHtmlLayer(e)}addLayer(e,i){return this.addLayerInternal(e,i)}getLayer(e){return this.getLayerInternal(e)}removeLayer(e){return this.removeLayerInternal(e)}addHtmlLayer(e,i,n){return this.addHtmlLayerInternal(e,i,n)}removeHtmlLayer(e){return this.removeHtmlLayerInternal(e)}getHtmlLayer(e){return this.getHtmlLayerInternal(e)}layers={get gameLayer(){return g.gameLayer},add:(e,i)=>this.addLayerInternal(e,i),get:e=>this.getLayerInternal(e),remove:e=>this.removeLayerInternal(e)};htmlLayers={add:(e,i,n)=>this.addHtmlLayerInternal(e,i,n),get:e=>this.getHtmlLayerInternal(e),remove:e=>this.removeHtmlLayerInternal(e)};async extractImage(){let e=this.gameLayer.renderable===false;e&&this.resume();let i;try{i=this.app.renderer.extract.image(this.app.stage);}finally{e&&this.pause();}return (await i).src}clear(){this.removeAllTickersInternal(),this.removeAll();}export(){let e=this.gameLayer.renderable===false;e&&this.resume();try{let i={};return this.children.forEach(n=>{n.label&&(i[n.label]=ye(n));}),{tickers:f$2(g.currentTickersWithoutCreatedBySteps),tickersSteps:f$2(g.currentTickersSequence),elements:f$2(i),stage:f$2(L(this.gameLayer)),elementAliasesOrder:f$2(g.childrenAliasesOrder),tickersToCompleteOnStepEnd:f$2(g._tickersToCompleteOnStepEnd)}}finally{e&&this.pause();}}async restore(e){this.clear();try{if(Object.hasOwn(e,"elements")&&Object.hasOwn(e,"elementAliasesOrder")){let i=e.elementAliasesOrder,n={},r=Object.entries(e.elements).map(async([a,o])=>{n[a]=await J(o);});await Promise.all(r),i.forEach(a=>{let o=n[a];o&&this.add(a,o);});}else {e$1.error("The data does not have the properties elementAliasesOrder and elements");return}if(Object.hasOwn(e,"stage")&&Object.hasOwn(e,"stage")?S(this.gameLayer,e.stage,{ignoreScale:!0}):e$1.error("The data does not have the properties stage"),Object.hasOwn(e,"tickers")){let i=e.tickers;Object.entries(i).forEach(([n,r])=>{let a=r.canvasElementAliases;if(a.length!==0){let o=D.getInstance(r.id,r.args,{duration:r.duration,priority:r.priority,id:n,canvasElementAliases:a});o?(o.canvasElementAliases=a,this.addTickerInternal(a,o),r.paused&&o.pause()):e$1.error(`Ticker ${r.id} not found`);}});}if(Object.hasOwn(e,"tickersSteps")){let i=e.tickersSteps;Object.entries(i).forEach(([n,r])=>{g._currentTickersSequence.set(n,new Map(Object.entries(r))),Object.keys(r).forEach(a=>{this.runTickersSequence(n,a);});});}if(Object.hasOwn(e,"tickersToCompleteOnStepEnd")){let i=e.tickersToCompleteOnStepEnd,n=i.tikersIds,r=i.stepAlias.map(a=>({id:a.id,alias:a.alias}));g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.tikersIds.push(...n),g._tickersToCompleteOnStepEnd.stepAlias.length=0,g._tickersToCompleteOnStepEnd.stepAlias.push(...r);}}catch(i){e$1.error("Error importing data",i);}}};var I=class t{static init(e){t._getScreen=e.getScreen;}static _getScreen;static get screen(){return t._getScreen()}};var h;(d=>{function t(s,c,l,u,y,x=0){return y?s==="width"?c*(I.screen.width-l)+l-u-x*l:c*(I.screen.height-l)+l-u-x*l:s==="width"?c*(I.screen.width-l)+u+x*l:c*(I.screen.height-l)+u+x*l}d.calculatePositionByAlign=t;function e(s,c,l,u,y,x=0){return y?s==="width"?(c-l+u+x*l)/(I.screen.width-l):(c-l+u+x*l)/(I.screen.height-l):s==="width"?(c-u-x*l)/(I.screen.width-l):(c-u-x*l)/(I.screen.height-l)}d.calculateAlignByPosition=e;function i(s,c){return s==="width"?c*I.screen.width:c*I.screen.height}d.calculatePositionByPercentagePosition=i;function n(s,c){return s==="width"?c/I.screen.width:c/I.screen.height}d.calculatePercentagePositionByPosition=n;function r(s,c){if(c=c%360,c<0&&(c+=360),c===0)return {x:s.x,y:s.y};if(c===90)return {x:-s.y,y:s.x};if(c===180)return {x:-s.x,y:-s.y};if(c===270)return {x:s.y,y:-s.x};if(c>0&&c<90){let l=c*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=s.x*u-s.y*y,T=s.x*y+s.y*u;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(c>90&&c<180){let l=(c-90)*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=-s.y*y-s.x*u,T=s.y*u-s.x*y;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(c>180&&c<270){let l=(c-180)*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=-s.x*u+s.y*y,T=-s.x*y-s.y*u;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(c>270&&c<360){let l=(c-270)*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=s.y*y-s.x*u,T=-s.y*u-s.x*y;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}return {x:0,y:0}}d.getSuperPoint=r;function a(s,c){if(c=c%360,c<0&&(c+=360),c===0)return {x:s.x,y:s.y};if(c===90)return {x:s.y,y:-s.x};if(c===180)return {x:-s.x,y:-s.y};if(c===270)return {x:-s.y,y:s.x};if(c>0&&c<90){let l=c*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:s.x*u+s.y*y,y:-s.x*y+s.y*u}}else if(c>90&&c<180){let l=(c-90)*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:s.y*u-s.x*y,y:-s.y*y-s.x*u}}else if(c>180&&c<270){let l=(c-180)*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:-s.x*u-s.y*y,y:s.x*y-s.y*u}}else if(c>270&&c<360){let l=(c-270)*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:-s.y*u+s.x*y,y:s.y*y+s.x*u}}return {x:0,y:0}}d.getPointBySuperPoint=a;function o(s){let c=s.width,l=s.height,u=s.angle%360;return u<0&&(u+=360),u===0||u===180?c:u===90||u===270?l:Math.abs(c*Math.cos(u*Math.PI/180))+Math.abs(l*Math.sin(u*Math.PI/180))}d.getSuperWidth=o;function p(s){let c=s.width,l=s.height,u=s.angle%360;return u<0&&(u+=360),u===0||u===180?l:u===90||u===270?c:Math.abs(l*Math.cos(u*Math.PI/180))+Math.abs(c*Math.sin(u*Math.PI/180))}d.getSuperHeight=p;})(h||={});async function N(t){if(t!=="EMPTY"){if(!t)throw e$1.error("Texture not found",t),new PixiError("unregistered_asset","Texture not found");if(B.Assets.cache.has(t)){let e=B.Assets.get(t);if(e)return e}return B.Assets.load(t).then(e=>{if(!e)throw e$1.error("Texture not found",t),new PixiError("unregistered_asset","Texture not found");if(!(e instanceof B.Texture))throw e$1.error("File is not a Texture",t),new PixiError("unregistered_asset","File is not a Texture");return e}).catch(e=>{throw e$1.error("Error loading file",e),new PixiError("unknown_element","Error loading file")})}}function A(t){return t&&(typeof t.align!="number"&&(t.xAlign!==void 0&&(t.align===void 0?(t.align={x:t.xAlign},delete t.xAlign):(t.align.x=t.xAlign,delete t.xAlign)),t.yAlign!==void 0&&(t.align===void 0?(t.align={y:t.yAlign},delete t.yAlign):(t.align.y=t.yAlign,delete t.yAlign))),typeof t.percentagePosition!="number"&&(t.percentageX!==void 0&&(t.percentagePosition===void 0?(t.percentagePosition={x:t.percentageX},delete t.percentageX):(t.percentagePosition.x=t.percentageX,delete t.percentageX)),t.percentageY!==void 0&&(t.percentagePosition===void 0?(t.percentagePosition={y:t.percentageY},delete t.percentageY):(t.percentagePosition.y=t.percentageY,delete t.percentageY))),t)}var H=class t extends B.Sprite{constructor(e$1){if(e$1 instanceof B.Texture)super(e$1);else {let{align:i,percentagePosition:n,...r}=A(e$1)||{};super(r),i&&(this.align=i),n&&(this.percentagePosition=n);}this.pixivnId=this.constructor.prototype.pixivnId||e;}pixivnId=e;get memory(){return {...xe(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){return await ne(this,e)}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}}set xAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)}set yAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageX(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}set percentageY(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};k.add(H,{name:e,copyProperty:async(t,e)=>{await ne(t,e,{ignoreTexture:true});}});async function ne(t,e,i){e=A(e);let n=i?.ignoreTexture||false;if(await S(t,e),!n){let a;if("textureData"in e&&e.textureData&&(a=e.textureData),a&&a.url!=="EMPTY"){let o=a.url;a.alias&&B.Assets.resolver.hasKey(a.alias)&&(o=a.alias);try{let p=await N(o);p&&(t.texture=p);}catch(p){e$1.error("Error in Sprite.setMemorySprite() while loading texture"),p=new PixiError("unregistered_asset",`Error loading image ${o}`,"canvas",e),GameUnifier.runOnError(p,{});}}}let r=i?.half;r&&await r(),"anchor"in e&&e.anchor!==void 0&&(typeof e.anchor=="number"?t.anchor.set(e.anchor,e.anchor):t.anchor.set(e.anchor.x,e.anchor.y)),"align"in e&&e.align!==void 0&&(t.align=e.align),"percentagePosition"in e&&e.percentagePosition!==void 0&&(t.percentagePosition=e.percentagePosition),"roundPixels"in e&&e.roundPixels!==void 0&&(t.roundPixels=e.roundPixels);}var v=class t extends H{_textureAlias;get textureAlias(){return this._textureAlias?this._textureAlias:this.texture.source.label}pixivnId=d$1;constructor(e,i){super(e),i&&(this._textureAlias=i);}get memory(){return {...super.memory,pixivnId:this.pixivnId,loadIsStarted:this._loadIsStarted}}async setMemory(e){let i;"textureData"in e&&e.textureData&&(i=e.textureData),"assetsData"in e&&Array.isArray(e.assetsData)&&e.assetsData.length>0&&(i=e.assetsData[0]),i&&i.alias&&(this._textureAlias=i.alias),await se(this,e),this.reloadPosition();}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){return this._loadIsStarted=true,N(this.textureAlias).then(e=>{this._loadIsStarted=false,e&&(this.texture=e);}).catch(e=>{this._loadIsStarted=false,e$1.error("Error into ImageSprite.load()"),e=new PixiError("unregistered_asset",`Error loading image ${this.textureAlias}`,"canvas",{...this.memory,label:this.textureAlias},this),GameUnifier.runOnError(e,{});})}set texture(e){super.texture=e,this.reloadPosition();}get texture(){return super.texture}get haveEmptyTexture(){return this.texture._source.label==="EMPTY"}};k.add(v,{name:d$1,copyProperty:async(t,e)=>{await se(t,e,{ignoreTexture:true});}});async function se(t,e,i){return await ne(t,e,{half:async()=>{"loadIsStarted"in e&&e.loadIsStarted&&await t.load();},ignoreTexture:i?.ignoreTexture})}var M=class t extends v{constructor(e,i){if(e instanceof B.Texture){super(e,i);return}let{loop:n,paused:r,currentTime:a,...o}=e||{};super(o,i),n&&(this.loop=n),r&&(this.paused=r),a&&(this.currentTime=a);}pixivnId=g$1;get memory(){return {...super.memory,pixivnId:this.pixivnId,loop:this.loop,paused:this._paused,currentTime:this.currentTime}}async setMemory(e){await ze(this,e),this.reloadPosition();}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}async load(){await super.load(),this.loop=this._looop,this.currentTime=this._currentTime,this.paused=this._paused;}_looop=false;get loop(){return this.texture?.source?.resource?.loop||false}set loop(e){this._looop=e,this.texture?.source?.resource&&(this.texture.source.resource.loop=e);}_paused=false;get paused(){return this.texture?.source?.resource?.paused||false}set paused(e){e?this.pause():this.play();}pause(){this._paused=true,this.texture?.source?.resource&&this.texture.source.resource.pause();}play(){this._paused=false,this.texture?.source?.resource?.play&&typeof this.texture.source.resource.play=="function"&&this.texture.source.resource.play();}_currentTime=0;get currentTime(){return this.texture?.source?.resource?.currentTime||0}set currentTime(e){let i=this.duration;i&&e>=i&&(e=0),this._currentTime=e,this.texture?.source?.resource&&(this.texture.source.resource.currentTime=e);}restart(){this.currentTime=0;}get duration(){if(this.texture?.source?.resource)return this.texture.source.resource.duration||0}};k.add(M,{name:g$1,getInstance:async(t,e)=>{let i;"textureData"in e&&e.textureData&&(i=e.textureData);let n=new t(void 0,i?.alias);return await n.setMemory(e),n},copyProperty:async(t,e)=>{await ze(t,e,{ignoreTexture:true});}});async function ze(t,e,i){await se(t,e,{ignoreTexture:i?.ignoreTexture}),"loop"in e&&e.loop!==void 0&&(t.loop=e.loop),"currentTime"in e&&e.currentTime!==void 0&&(t.currentTime=e.currentTime),"paused"in e&&e.paused!==void 0&&(t.paused=e.paused);}var _=class extends Container{constructor(e){let{anchor:i,align:n,percentagePosition:r,...a}=A(e)||{};super(a),this.pixivnId=this.constructor.prototype.pixivnId||b,i&&(this.anchor=i),n&&(this.align=n),r&&(this.percentagePosition=r);}pixivnId=b;get memory(){return {...L(this,{childrenExport:true}),anchor:this._anchor?this.anchor:void 0,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){await this.importChildren(e),await S(this,e),this.reloadAnchor(),this.reloadPosition();}async importChildren(e){for(let i=0;i<e.elements.length;i++){let n=e.elements[i],r=await J(n);this.addChild(r);}}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_anchor;get anchor(){let e=super.pivot.x/this.width,i=super.pivot.y/this.height;return {x:e,y:i}}set anchor(e){typeof e=="number"?this._anchor={x:e,y:e}:this._anchor=e,this.reloadAnchor();}reloadAnchor(){this._anchor&&super.pivot.set(this._anchor.x*this.width,this._anchor.y*this.height);}get pivot(){return super.pivot}set pivot(e){this._anchor=void 0,super.pivot=e;}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0)}}set xAlign(e){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0)}set yAlign(e){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}set percentageX(e){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageY(e){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};k.add(_,{name:b,copyProperty:async(t,e)=>await S(t,e)});var yt=new Set(["mp4","webm","ogg","ogv","avi","mov","wmv","flv","mkv","m4v","3gp","3g2","ts","mts"]);function U(t){let e=B.Assets.cache.has(t)?B.Assets.get(t):null;return e instanceof B.Texture&&(t=e.source?.label||t),xt(t)}function xt(t){let e=t.split(".").pop()?.toLowerCase();return e!==void 0&&yt.has(e)}var P=class extends _{constructor(e,i){let{anchor:n,align:r,percentagePosition:a,...o}=A(e)||{};super(o),i&&i.forEach(p=>{U(p)?this.addChild(new M(void 0,p)):this.addChild(new v(void 0,p));}),n&&(this.anchor=n),r&&(this.align=r),a&&(this.percentagePosition=a);}get memory(){return {...super.memory,pixivnId:c$1,loadIsStarted:this._loadIsStarted}}async setMemory(e){await this.importChildren(e),await Ve(this,e),this.reloadAnchor(),this.reloadPosition();}pixivnId=c$1;_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){this._loadIsStarted=true;let e=this.children.map(i=>i.load());return Promise.all(e).then(()=>{this._loadIsStarted=false,this.reloadAnchor(),this.reloadPosition();}).catch(i=>{this._loadIsStarted=false,e$1.error("Error into ImageContainer.load()",i);})}get texture(){return this.children.length>0?this.children[0].texture:new B.Texture}get haveEmptyTexture(){return this.children.some(e=>e.texture._source.label==="EMPTY")}};k.add(P,{name:c$1,copyProperty:async(t,e)=>await Ve(t,e)});async function Ve(t,e){e=A(e)||{},S(t,e,{end:async()=>{"loadIsStarted"in e&&e.loadIsStarted&&await t.load();}});}var ae=class{constructor(...e){}get memory(){throw new PixiError("not_implemented","The method CanvasBaseItem.memory must be overridden")}setMemory(e){throw new PixiError("not_implemented","The method CanvasBaseItem.setMemory must be overridden")}pixivnId="canvas_element_id_not_set"};var z=class extends B.Text{constructor(e){let{align:i,percentagePosition:n,...r}=A(e)||{};super(r),this.pixivnId=this.constructor.prototype.pixivnId||f$1,i&&(this.align=i),n&&(this.percentagePosition=n);}pixivnId=f$1;get memory(){return {...Te(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){await Pt(this,e),this.reloadPosition();}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}}set xAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)}set yAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageX(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}set percentageY(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};k.add(z,{name:f$1});async function Pt(t,e){"text"in e&&e.text!==void 0&&(t.text=e.text),await S(t,e,{end:()=>{"style"in e&&e.style!==void 0&&(t.style=e.style);}}),"anchor"in e&&e.anchor!==void 0&&(typeof e.anchor=="number"?t.anchor.set(e.anchor,e.anchor):t.anchor.set(e.anchor.x,e.anchor.y)),"resolution"in e&&e.resolution!==void 0&&(t.resolution=e.resolution),"anchor"in e&&e.anchor!==void 0&&(typeof e.anchor=="number"?t.anchor.set(e.anchor,e.anchor):t.anchor.set(e.anchor.x,e.anchor.y)),"align"in e&&e.align!==void 0&&(t.align=e.align),"percentagePosition"in e&&e.percentagePosition!==void 0&&(t.percentagePosition=e.percentagePosition),"roundPixels"in e&&e.roundPixels!==void 0&&(t.roundPixels=e.roundPixels);}async function It(t,e={},i){let n=f.find(t);if(!n){e$1.error(`The element with the alias ${t} does not exist. So the shake effect can't be applied.`);return}let r={x:n.position.x,y:n.position.y},{shakeType:a="horizontal",maxShockSize:o=10,shocksNumber:p=10,...d}=e,s=p-1;if(s<2){e$1.error("The number of shocks must be at least 3.");return}let c=Math.floor(s/2),l=Math.ceil(s/2),u=[];for(let T=0;T<c;T++){let C=o*(T+1)/c;a==="horizontal"?T%2!==0?u.push(r.x+C):u.push(r.x-C):T%2!==0?u.push(r.y+C):u.push(r.y-C);}let y=c%2===0;for(let T=l;T>0;T--){let C=o*(T+1)/(l-1);a==="horizontal"?T%2===0&&!y||T%2!==0&&y?u.push(r.x-C):u.push(r.x+C):T%2===0&&!y||T%2!==0&&y?u.push(r.y-C):u.push(r.y+C);}let x;if(a==="horizontal"?(u.push(r.x),x=f.animate(t,{x:u},d,i)):(u.push(r.y),x=f.animate(t,{y:u},d,i)),x)return [x]}function oe(t,e,i){let n={...f.find(t)?.memory,...i},r=new P(i,e);return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function kt(t,e,i){let n={...f.find(t)?.memory,...i},r=new P(i,e);return r.label=t,await r.load(),n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function ce(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The image ${t} does not exist in the cache.`,"canvas",{pixivnId:d$1,...i,label:t});let n={...f.find(t)?.memory,...i},r=new v(i,e);return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function Ct(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The image ${t} does not exist in the cache.`,"canvas",{pixivnId:d$1,...i,label:t});let n={...f.find(t)?.memory,...i},r=new v(i,e);return r.label=t,await r.load(),n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function de(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The video ${t} does not exist in the cache.`,"canvas",{pixivnId:g$1,...i,label:t});let n={...f.find(t)?.memory,...i},r=new M(i,e);return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function St(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The video ${t} does not exist in the cache.`,"canvas",{pixivnId:g$1,...i,label:t});let n={...f.find(t)?.memory,...i},r=new M(i,e);return r.label=t,await r.load(),n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function Ie(t){switch(t.type){case "align":return {xAlign:t.x,yAlign:t.y};case "percentage":return {percentageX:t.x,percentageY:t.y};default:return {x:t.x,y:t.y}}}function F(t,e,i){if(typeof e=="string")return U(e)?de(t,e,i):ce(t,e,i);if(Array.isArray(e))return oe(t,e,i);if(typeof e=="object"&&"value"in e&&"options"in e){if(typeof e.value=="string")return U(e.value)?de(t,e.value,{...e.options,zIndex:i.zIndex}):ce(t,e.value,{...e.options,zIndex:i.zIndex});if(Array.isArray(e.value))return oe(t,e.value,{...e.options,zIndex:i.zIndex})}return f.add(t,e,i),e}async function qe(t,e,i={},n){let{completeOnContinue:r=true,tickerIdToResume:a=[],...o}=i,p=[];e||(e=t),typeof a=="string"&&(a=[a]);let d,s=f.find(t);if(s&&(d=`${t}_temp_disolve`,f.editAlias(t,d)),e=F(t,e,{zIndex:s?s.parent?.getChildIndex(s):void 0}),s?.parent?.setChildIndex(s,s.parent.getChildIndex(s)-.1),d&&f.copyCanvasElementProperty(d,t),d&&f.tickers.transfer(d,t,"duplicate"),e.alpha=0,d){let l=pe(d,{...i,autoplay:false,completeOnContinue:r},n);l&&(p.push(...l),a.push(...l));}let c=f.animate(t,{alpha:1},{...o,tickerIdToResume:a,completeOnContinue:r},n);if(c&&p.push(c),(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),p.length>0)return p}function pe(t,e={},i){let{completeOnContinue:n=true,aliasToRemoveAfter:r=[],...a}=e;typeof r=="string"&&(r=[r]),r.push(t);let o=f.animate(t,{alpha:0},{...a,aliasToRemoveAfter:r,completeOnContinue:n},i);if(o)return [o]}async function bt(t,e,i={},n){let{completeOnContinue:r=true,aliasToRemoveAfter:a=[],...o}=i,p=[];e||(e=t),typeof a=="string"&&(a=[a]);let d=f.find(t);if(!d)return qe(t,e,i,n);let s=`${t}_temp_fade`;f.editAlias(t,s),a.push(s),e=F(t,e,{zIndex:d?d.parent?.getChildIndex(d):void 0}),d?.parent?.setChildIndex(d,d.parent.getChildIndex(d)-.1),s&&f.copyCanvasElementProperty(s,t),s&&f.tickers.transfer(s,t,"duplicate"),e.alpha=0;let c=f.animate(t,{alpha:1},{...o,aliasToRemoveAfter:a,completeOnContinue:r},n);if(c){let l=pe(s,{...i,tickerIdToResume:c,completeOnContinue:r},n);l&&p.push(...l),p.push(c),f.tickers.pause({id:c});}if((e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),p.length>0)return p}function At(t,e={},i){return pe(t,e,i)}async function Et(t,e,i={},n){let{direction:r="right",completeOnContinue:a=true,tickerIdToResume:o=[],aliasToRemoveAfter:p=[],removeOldComponentWithMoveOut:d,...s}=i,c=[],l;e||(e=t),typeof o=="string"&&(o=[o]),typeof p=="string"&&(p=[p]);let u,y=f.find(t);if(y&&(u=`${t}_temp_movein`,f.editAlias(t,u),y instanceof v||y instanceof P?l=y.positionInfo:l={x:y.x,y:y.y,type:"pixel"}),e=F(t,e,{zIndex:y?y.parent?.getChildIndex(y):void 0}),y?.parent?.setChildIndex(y,y.parent.getChildIndex(y)-.1),u&&f.copyCanvasElementProperty(u,t),u&&f.tickers.transfer(u,t,"move"),l||(e instanceof v||e instanceof P?l=e.positionInfo:l={x:e.x,y:e.y,type:"pixel"}),u)if(d){let C=ke(u,{...i,autoplay:false,completeOnContinue:a},n);C&&(c.push(...C),o.push(...C));}else p.push(u);switch((e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),r){case "up":e.y=f.height+e.height;break;case "down":e.y=-e.height;break;case "left":e.x=f.width+e.width;break;case "right":e.x=-e.width;break}let x=f.tickers.pause({canvasAlias:t});o.push(...x);let T=f.animate(t,Ie(l),{...s,tickerIdToResume:o,aliasToRemoveAfter:p,completeOnContinue:a},n);if(T&&c.push(T),c.length>0)return c}function ke(t,e={},i){let{direction:n="right",completeOnContinue:r=true,aliasToRemoveAfter:a=[],...o}=e;typeof a=="string"&&(a=[a]),a.push(t);let p=f.find(t);if(!p){e$1.warn(`The canvas component "${t}" is not found.`);return}let d={x:p.x,y:p.y};switch(n){case "up":d.y=-p.height;break;case "down":d.y=f.height+p.height;break;case "left":d.x=-p.width;break;case "right":d.x=f.width+p.width;break}f.tickers.pause({canvasAlias:t});let s=f.animate(t,d,{...o,aliasToRemoveAfter:a,completeOnContinue:r},i);if(s)return [s]}async function Mt(t,e,i={},n){let{direction:r="right",completeOnContinue:a=true,tickerIdToResume:o=[],aliasToRemoveAfter:p=[],...d}=i,s=[],c;e||(e=t),typeof o=="string"&&(o=[o]),typeof p=="string"&&(p=[p]);let l,u=f.find(t);u&&(l=`${t}_temp_zoom`,f.editAlias(t,l),u instanceof v||u instanceof P?c=u.positionInfo:c={x:u.x,y:u.y,type:"pixel"}),e=F(t,e,{zIndex:u?u.parent?.getChildIndex(u):void 0}),u?.parent?.setChildIndex(u,u.parent.getChildIndex(u)-.1),l&&f.copyCanvasElementProperty(l,t),l&&f.tickers.transfer(l,t,"move"),c||(e instanceof v||e instanceof P?c=e.positionInfo:c={x:e.x,y:e.y,type:"pixel"});let y={x:e.pivot.x,y:e.pivot.y},x={x:e.scale.x,y:e.scale.y};if(l)if(i.removeOldComponentWithZoomOut){let le=Ge(l,{...i,autoplay:false,completeOnContinue:a},n);le&&(s.push(...le),o.push(...le));}else p.push(l);(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),r==="up"?(e.pivot.y=f.height-e.y,e.pivot.x=f.width/2-e.x,e.y=f.height,e.x=f.width/2):r==="down"?(e.pivot.y=0-e.y,e.pivot.x=f.width/2-e.x,e.y=0,e.x=f.width/2):r==="left"?(e.pivot.x=f.width-e.x,e.pivot.y=f.height/2-e.y,e.x=f.width,e.y=f.height/2):r==="right"&&(e.pivot.x=0-e.x,e.pivot.y=f.height/2-e.y,e.x=0,e.y=f.height/2),e.pivot=h.getPointBySuperPoint(e.pivot,e.angle),e.scale.set(0);let T=f.tickers.pause({canvasAlias:t});o.push(...T);let C=f.animate(t,{...Ie(c),pivotX:y.x,pivotY:y.y,scaleX:x.x,scaleY:x.y},{...d,tickerIdToResume:o,aliasToRemoveAfter:p,completeOnContinue:a},n);if(C&&s.push(C),s.length>0)return s}function Ge(t,e={},i){let{direction:n="right",completeOnContinue:r=true,aliasToRemoveAfter:a=[],...o}=e;typeof a=="string"&&(a=[a]),a.push(t);let p=f.find(t);if(!p){e$1.warn(`The canvas component "${t}" is not found.`);return}let d={x:p.x,y:p.y},s={x:p.pivot.x,y:p.pivot.y};n==="down"?(d.y=f.height,d.x=f.width/2,s.y=f.height-d.y,s.x=f.width/2-d.x):n==="up"?(d.y=0,d.x=f.width/2,s.y=0-d.y,s.x=f.width/2-d.x):n==="right"?(d.x=f.width,d.y=f.height/2,s.x=f.width-d.x,s.y=f.height/2-d.y):n==="left"&&(d.x=0,d.y=f.height/2,s.x=0-d.x,s.y=f.height/2-d.y),s=h.getPointBySuperPoint(s,p.angle),f.tickers.pause({canvasAlias:t});let c=f.animate(t,{...d,pivotX:s.x,pivotY:s.y,scaleX:0,scaleY:0},{...o,aliasToRemoveAfter:a,completeOnContinue:r},i);if(c)return [c]}async function _t(t,e,i={},n){let{direction:r="right",completeOnContinue:a=true,tickerIdToResume:o=[],...p}=i,d=[],s;e||(e=t),typeof o=="string"&&(o=[o]);let c,l=f.find(t);switch(l&&(c=`${t}_temp_push`,f.editAlias(t,c),l instanceof v||l instanceof P?s=l.positionInfo:s={x:l.x,y:l.y,type:"pixel"}),e=F(t,e,{zIndex:l?l.parent?.getChildIndex(l):void 0}),l?.parent?.setChildIndex(l,l.parent.getChildIndex(l)-.1),c&&f.copyCanvasElementProperty(c,t),c&&f.tickers.transfer(c,t,"move"),s||((e instanceof v||e instanceof P)&&e.haveEmptyTexture?s=e.positionInfo:s={x:e.x,y:e.y,type:"pixel"}),(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),r){case "up":e.y=f.height+e.height;break;case "down":e.y=-e.height;break;case "left":e.x=f.width+e.width;break;case "right":e.x=-e.width;break}let u=f.tickers.pause({canvasAlias:t});if(o.push(...u),c){let x=Ne(c,{...i,direction:r,completeOnContinue:a});x&&d.push(...x);}let y=f.animate(t,Ie(s),{...p,tickerIdToResume:o,completeOnContinue:a},n);if(y&&d.push(y),d.length>0)return d}function Ne(t,e={direction:"right"},i){return ke(t,e,i)}var K=class extends _{constructor(i){super(i);this._memory=i;this.pixivnId=i.pixivnId;}_memory;pixivnId;get memory(){return {...this._memory,...super.memory,elements:[],pixivnId:this.pixivnId}}};function wt(){return async(e,i)=>{try{let n=e.canvasElementInfo;if(n){let r=new K(n),a=n.zIndex;r.groupColor=16711680;let o=new B.Graphics;o.rect(0,0,300,100).fill({color:16711680,alpha:.5}),r.addChild(o);let p=new B.Text({text:`Error: ${n.label}`,x:10,y:10});r.addChild(p);let d=e.parent;if(d&&"addChild"in d)a!==void 0?d.addChildAt(r,a):d.addChild(r);else {let s=n.parentLabel?f.find(n.parentLabel):void 0;if(s)a!==void 0?s.addChildAt(r,a):s.addChild(r);else {let c=n.label??n.pixivnId;f.add(c,r,{zIndex:a});}}}}catch{}}}function Ot(t,e,i){let n={...f.find(t)?.memory,...i},r=new z({text:e,...i});return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}var {Assets:Mn,Color:_n,Rectangle:wn,TextStyle:On,Texture:Bn,UPDATE_PRIORITY:Ln}=B,f=new G;I.init({getScreen:()=>f.screen});GameUnifier.addOnPreContinue(async()=>{try{let t=g._tickersToCompleteOnStepEnd.tikersIds,e=g._tickersToCompleteOnStepEnd.stepAlias,i=(async()=>{for(;t.length;){let{id:r}=t.pop()||{};r&&await f.tickers.forceCompletion(r);}})(),n=(async()=>{for(;e.length;){let{alias:r,id:a}=e.pop()||{};r&&a&&await f.tickers.forceCompletion(a,r);}})();await Promise.all([i,n]),g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.stepAlias.length=0;}catch{}});
1
+ import {a}from'./chunk-7P46CLKX.mjs';import'./chunk-JMOSOAGB.mjs';import {a as a$1}from'./chunk-YBA63R27.mjs';import {c,q as q$1,h as h$1,g as g$1,j,e,f as f$1,i,r,d}from'./chunk-U5BSF6X3.mjs';import {GameUnifier,PixiError}from'@drincs/pixi-vn/core';import B,{Container}from'@drincs/pixi-vn/pixi.js';import {initDevtools}from'@pixi/devtools';var Fe={extension:{type:"sceneProperties",name:"additional-positions"},testNode(t){return "xAlign"in t||"yAlign"in t||"percentageX"in t||"percentageY"in t||"positionType"in t},testProp(t){switch(t){case "xAlign":case "yAlign":case "percentageX":case "percentageY":case "positionType":return true;default:return false}},setProperty(t,e,i){switch(e){case "xAlign":"xAlign"in t&&(t.xAlign=i/100);break;case "yAlign":"yAlign"in t&&(t.yAlign=i/100);break;case "percentageX":"percentageX"in t&&(t.percentageX=i/100);break;case "percentageY":"percentageY"in t&&(t.percentageY=i/100);break}},getProperties(t){return [{value:t.positionType,prop:"positionType",entry:{section:"Transform",type:"text",label:"Position Type"}},{value:t.xAlign*100,prop:"xAlign",entry:{section:"Transform",type:"range",label:"X Align",tooltip:"0% is left, 100% is right",options:{min:0,max:100}}},{value:t.yAlign*100,prop:"yAlign",entry:{section:"Transform",type:"range",label:"Y Align",tooltip:"0% is top, 100% is bottom",options:{min:0,max:100}}},{value:t.percentageX*100,prop:"percentageX",entry:{section:"Transform",type:"range",label:"X Percentage Position",tooltip:"0% is left, 100% is right",options:{min:0,max:100}}},{value:t.percentageY*100,prop:"percentageY",entry:{section:"Transform",type:"range",label:"Y Percentage Position",tooltip:"0% is top, 100% is bottom",options:{min:0,max:100}}}]}},be=Fe;function Ae(t,e){let i=0;return async(...n)=>{let r=Date.now();if(r-i>=e)return i=r,await t(...n)}}var _e=c(a(),1),g=class t{constructor(){}static _app=void 0;static get app(){if(!t._app)throw r.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(d);return e||(e=new B.Container,e.label=d,t.app.stage.addChild(e)),e}static htmlLayers=[];static canvasWidth=300;static canvasHeight=300;static _isInitialized=false;static async init(e,i,n){let{id:r="pixi-vn-canvas",width:a=800,height:o=600,resolution:p=1,autoDensity:d=true,resizeMode:s="contain",...c}=i||{};return t.canvasWidth=a,t.canvasHeight=o,t._app=new B.Application,t.app.init({width:a,height:o,resolution:p,autoDensity:d,...c}).then(()=>{let{app:l=t.app,extensions:u=[],...y}=n||{};if(initDevtools({app:l,extensions:[be,...u],...y}),t._isInitialized=true,t.addCanvasIntoHTMLElement(e,r),s==="contain"){let x=Ae(async()=>{requestAnimationFrame(()=>t.resize());},10);new ResizeObserver(x).observe(e),t.resize(),setTimeout(()=>t.resize(),750);}t.gameLayer;})}static addCanvasIntoHTMLElement(e,i){t._isInitialized?(e.appendChild(t.app.canvas),t.app.canvas.id=i):r.error("GameWindowManager is not initialized");}static addHtmlLayer(e,i,n={}){let{position:r="absolute",pointerEvents:a="none",userSelect:o="none"}=n,p=document.createElement("div");p.setAttribute("id",e),p.style.position=r,p.style.pointerEvents=a,p.style.userSelect=o;let d=i.appendChild(p);return t.htmlLayers.push(p),t.resize(),d}static removeHtmlLayer(e){let i=t.htmlLayers.find(n=>n.id===e);i&&(i.remove(),t.htmlLayers=t.htmlLayers.filter(n=>n.id!==e));}static getHtmlLayer(e){return t.htmlLayers.find(i=>i.id===e)}static async resize(){let e=t.canvasWidth,i=t.canvasHeight,n=t.app.resizeTo,r=t.app.canvas.style;n instanceof HTMLElement||(n=document.documentElement);let a,o;if(n===document.body||n===document.documentElement)a=document.documentElement.clientWidth||window.innerWidth,o=document.documentElement.clientHeight||window.innerHeight;else {let u=n.getBoundingClientRect();a=u.width||n.clientWidth,o=u.height||n.clientHeight;}let p=Math.min(a/e,o/i),d=Math.floor(p*e),s=Math.floor(p*i);r.width=`${d}px`,r.height=`${s}px`;let c=(a-d)/2,l=(o-s)/2;r.marginLeft=`${c}px`,r.marginRight=`${c}px`,r.marginTop=`${l}px`,r.marginBottom=`${l}px`,t.htmlLayers.forEach(u=>{u.style.width=`${d}px`,u.style.height=`${s}px`,u.style.marginLeft=`${c}px`,u.style.marginRight=`${c}px`,u.style.marginTop=`${l}px`,u.style.marginBottom=`${l}px`;});}static get childrenAliasesOrder(){return t.gameLayer.children.filter(e=>e.label).sort((e,i)=>t.gameLayer.getChildIndex(e)-t.gameLayer.getChildIndex(i)).map(e=>e.label)}static get currentTickersWithoutCreatedBySteps(){return Object.fromEntries(Array.from(t._currentTickers.entries()).filter(([e,i])=>!i.createdByTicketSteps).map(([e,i])=>[e,{id:i.ticker.alias,args:i.ticker.args,canvasElementAliases:i.ticker.canvasElementAliases,priority:i.ticker.priority,duration:i.ticker.duration,paused:i.ticker.paused}]))}static _currentTickers=new Map;static _currentTickersSequence=new Map;static get currentTickersSequence(){return Object.fromEntries(Array.from(t._currentTickersSequence.entries()).map(([e,i])=>[e,Object.fromEntries(i)]))}static _currentTickersTimeouts=new Map;static _tickersToCompleteOnStepEnd={tikersIds:[],stepAlias:[]};static generateTickerId(...e){try{return `${(0,_e.default)(JSON.stringify(e)).toString()}_${Math.random().toString(36).substring(7)}`}catch(i){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${i}`)}}static addTickerTimeoutInfo(e,i,n,r){typeof e=="string"&&(e=[e]),t._currentTickersTimeouts.set(n,{aliases:e,ticker:i,canBeDeletedBeforeEnd:r});}static removeTickerTimeoutInfo(e){typeof e!="string"&&(e=e.toString()),t._currentTickersTimeouts.delete(e);}static removeTickerTimeout(e){typeof e!="string"&&(e=e.toString()),clearTimeout(Number(e)),t.removeTickerTimeoutInfo(e);}static removeTickerTimeoutsByAlias(e,i){t._currentTickersTimeouts.forEach((n,r)=>{let a=n.aliases.filter(o=>o!==e);if(a.length===0){let o=n.canBeDeletedBeforeEnd;(!i||o)&&t.removeTickerTimeout(r);}else n.aliases=a;});}};var ue=Symbol("SerializableEvent"),X=new q$1({cacheSize:5});function Ze(t){return (e,i,n)=>{let r=n.value;fe.add(r,t||`${i}`);}}var fe;(a=>{function t(o,p){o[ue]=p,X.get(p)&&r.info(`Event "${p}" already exists, it will be overwritten`),X.set(p,o);}a.add=t;function e(o){try{let p=X.get(o);if(!p){r.error(`Event "${o}" not found, did you forget to register it with the eventDecorator?`);return}return p}catch(p){r.error(`Error while getting Event "${o}"`,p);return}}a.get=e;function i(){return Array.from(X.values())}a.values=i;function n(o){return X.has(o)}a.has=n;function r$1(){return Array.from(X.keys())}a.keys=r$1;})(fe||={});var ge=fe;async function we(t,e){if("onEvents"in e)for(let i in e.onEvents){let n=e.onEvents[i],r=ge.get(n);r&&t.on(i,r);}}function Oe(t){let{onEventsHandlers:e={}}=t;return e}function O(t,e,i){let n=i[ue];return n&&typeof n=="string"?(e.onEventsHandlers[t]=n,true):(r.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 q$1({cacheSize:5}),Be=new q$1({cacheSize:2}),Le=new q$1({cacheSize:2});function Je(t={}){return e=>{he.add(e,t);}}async function S(t,e,i){let n=i?.ignoreScale||false,r=i?.end;"isRenderGroup"in e&&e.isRenderGroup!==void 0&&(t.isRenderGroup=e.isRenderGroup),"blendMode"in e&&e.blendMode!==void 0&&(t.blendMode=e.blendMode),"tint"in e&&e.tint!==void 0&&(t.tint=e.tint),"alpha"in e&&e.alpha!==void 0&&(t.alpha=e.alpha),"angle"in e&&e.angle!==void 0&&(t.angle=e.angle),"renderable"in e&&e.renderable!==void 0&&(t.renderable=e.renderable),"rotation"in e&&e.rotation!==void 0&&(t.rotation=e.rotation),!n&&"scale"in e&&e.scale!==void 0&&(typeof e.scale=="number"?t.scale.set(e.scale,e.scale):t.scale.set(e.scale.x,e.scale.y)),"pivot"in e&&e.pivot!==void 0&&(typeof e.pivot=="number"?t.pivot.set(e.pivot,e.pivot):t.pivot.set(e.pivot.x,e.pivot.y)),"position"in e&&e.position!==void 0&&t.position.set(e.position.x,e.position.y),"skew"in e&&e.skew!==void 0&&t.skew.set(e.skew.x,e.skew.y),"visible"in e&&e.visible!==void 0&&(t.visible=e.visible),"x"in e&&e.x!==void 0&&(t.x=e.x),"y"in e&&e.y!==void 0&&(t.y=e.y),"boundsArea"in e&&e.boundsArea!==void 0&&(t.boundsArea=e.boundsArea),"cursor"in e&&e.cursor!==void 0&&(t.cursor=e.cursor),"eventMode"in e&&e.eventMode!==void 0&&(t.eventMode=e.eventMode),"interactive"in e&&e.interactive!==void 0&&(t.interactive=e.interactive),"interactiveChildren"in e&&e.interactiveChildren!==void 0&&(t.interactiveChildren=e.interactiveChildren),"hitArea"in e&&e.hitArea!==void 0&&(t.hitArea=e.hitArea),we(t,e),"align"in e&&e.align!==void 0&&"align"in t&&(t.align=e.align),"percentagePosition"in e&&e.percentagePosition!==void 0&&"percentagePosition"in t&&(t.percentagePosition=e.percentagePosition),r&&await r(),n||("width"in e&&e.width!==void 0&&(t.width=e.width),"height"in e&&e.height!==void 0&&(t.height=e.height));}var he;(p=>{function t(d,s={}){let{name:c=d.name,getInstance:l=async(y,x)=>{let T=new y;return await T.setMemory(x),T},copyProperty:u=async(y,x)=>{await y.setMemory(x);}}=s;q.get(c)&&r.warn(`CanvasElement "${c}" already registered`),d.prototype.pixivnId=c,q.set(c,d),Be.set(c,l),Le.set(c,u);}p.add=t;function e(d){let s=q.get(d);if(!s){r.error(`CanvasElement "${d}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return s}p.get=e;async function i(d,s){let c=e(d),l=Be.get(d);if(!c||!l){r.error(`CanvasElement "${d}" not found, did you forget to register it with the canvasComponentDecorator?`);return}try{return await l(c,s)}catch(u){r.error(`Error while getting CanvasElement instance "${d}"`,u);}}p.getInstance=i;async function n(d,s,c){let l=Le.get(d);if(!l){r.error(`CanvasElement "${d}" not found, did you forget to register it with the canvasComponentDecorator?`);return}try{await l(s,c);}catch(u){r.error(`Error while copying properties of CanvasElement "${d}"`,u);}}p.copyProperty=n;function r$1(){return Array.from(q.values())}p.values=r$1;function a(d){return q.has(d)}p.has=a;function o(){return Array.from(q.keys())}p.keys=o;})(he||={});var k=he;async function J(t){let e=await k.getInstance(t.pixivnId,t);if(!e)throw new PixiError("unregistered_element",`The element ${t.pixivnId} could not be created`,"canvas",t);return e}function ye(t){return "memory"in t?t.memory:t instanceof B.Text?Te(t):t instanceof B.Sprite?xe(t):L(t)}function et(t){let e=t.parent;return {width:t.width,height:t.height,isRenderGroup:t.isRenderGroup,blendMode:t.blendMode,tint:t.tint,alpha:t.alpha,angle:t.angle,renderable:t.renderable,rotation:t.rotation,scale:{x:t.scale.x,y:t.scale.y},pivot:{x:t.pivot.x,y:t.pivot.y},position:{x:t.position.x,y:t.position.y},skew:{x:t.skew.x,y:t.skew.y},visible:t.visible,x:t.x,y:t.y,boundsArea:t.boundsArea,cursor:t.cursor,eventMode:t.eventMode,interactive:t.interactive,interactiveChildren:t.interactiveChildren,hitArea:t.hitArea,index:e?.getChildIndex(t),parentLabel:e?.label,label:t.label}}function me(t,e){return {url:t.source.label,alias:e===t.source.label?void 0:e}}function L(t,e$1){let i=tt(t,e),r=e$1?.childrenExport||false?t.children.sort((a,o)=>t.getChildIndex(a)-t.getChildIndex(o)).map(a=>ye(a)):[];return {pixivnId:i,elements:r,onEvents:Oe(t),...et(t)}}function xe(t){let e=L(t),i=e.pixivnId??h$1,n="assetsAliases"in t&&Array.isArray(t.assetsAliases)?me(t.texture,t.assetsAliases[0]):"textureAlias"in t?me(t.texture,t.textureAlias):me(t.texture);return {...e,pixivnId:i,textureData:n,anchor:{x:t.anchor.x,y:t.anchor.y},roundPixels:t.roundPixels}}function Te(t){let e=L(t),i$1=e.pixivnId??i;return {...e,pixivnId:i$1,anchor:{x:t.anchor.x,y:t.anchor.y},text:t.text,resolution:t.resolution,style:st(t.style),roundPixels:t.roundPixels}}function tt(t,e){return Object.hasOwn(t,"pixivnId")?t.pixivnId:e}function Q(t){switch(t.type){case "linear":return {type:"linear",colorStops:t.colorStops,end:{x:t.end.x,y:t.end.y},start:{x:t.start.x,y:t.start.y},textureSpace:t.textureSpace,wrapMode:t.texture.source.wrapMode,textureSize:t.texture.source.width/t.texture.source.height};case "radial":return {type:"radial",colorStops:t.colorStops,textureSpace:t.textureSpace,center:{x:t.center.x,y:t.center.y},innerRadius:t.innerRadius,outerCenter:{x:t.outerCenter.x,y:t.outerCenter.y},outerRadius:t.outerRadius,rotation:t.rotation,scale:t.scale,wrapMode:t.texture.source.wrapMode,textureSize:t.texture.source.width/t.texture.source.height}}}function it(t){if(t!=null){{if(typeof t=="number")return t;if(typeof t=="string"||Array.isArray(t))return t;if(t instanceof B.FillGradient)return Q(t);if(typeof t=="object"&&"fill"in t&&typeof t.fill!="function"&&t.fill){if(!(t.fill instanceof B.FillPattern))return Q(t.fill)}}r.warn("Unsupported property type for Text.style.fill.",t);}}function rt(t){if(typeof t=="number")return t;if(typeof t=="string")return t;if(Array.isArray(t))return t;if(t instanceof B.Color)return t.toNumber();r.warn("Unsupported color type.",t);}function nt(t){if(t!=null){{if(typeof t=="number")return t;if(typeof t=="string"||Array.isArray(t))return t;if(t instanceof B.FillGradient)return Q(t);if(typeof t=="object"&&"alignment"in t)return {alignment:t.alignment,alpha:t.alpha,color:rt(t.color),join:t.join,miterLimit:t.miterLimit,width:t.width,cap:t.cap,pixelLine:t.pixelLine,textureSpace:t.textureSpace};if(typeof t=="object"&&"fill"in t&&typeof t.fill!="function"&&t.fill){if(!(t.fill instanceof B.FillPattern))return Q(t.fill)}}r.warn("Unsupported property type for Text.style.stroke.",t);}}function st(t){return {align:t.align,breakWords:t.breakWords,dropShadow:t.dropShadow,fill:it(t.fill),fontFamily:t.fontFamily,fontSize:t.fontSize,fontStyle:t.fontStyle,fontVariant:t.fontVariant,fontWeight:t.fontWeight,leading:t.leading,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,padding:t.padding,stroke:nt(t.stroke),textBaseline:t.textBaseline,trim:t.trim,whiteSpace:t.whiteSpace,wordWrap:t.wordWrap,wordWrapWidth:t.wordWrapWidth}}var Re=c(a(),1);var ee=class{constructor(e,i){this.alias=this.constructor.prototype.id;let{duration:n,priority:r,id:a=this.generateTickerId(this.alias,i),canvasElementAliases:o=[]}=i||{};this.args=e,this.duration=n,this.priority=r,this.id=a,this.canvasElementAliases=o;}alias;id;args;duration;priority;ticker=new B.Ticker;canvasElementAliases=[];generateTickerId(...e){try{return (0,Re.default)(JSON.stringify(e)).toString()+"_"+Math.random().toString(36).substring(7)}catch(i){throw new PixiError("not_json_serializable",`Error to generate ticker id: ${i}`)}}fnValue;complete(e){this.stop();}stop(){let e=this.fnValue;if(!e){r.warn("TickerBase.stop() called without fnValue set. This may cause issues.");return}this.ticker.remove(e,null);}start(){let e=this.id,i=()=>this.fn(this.ticker,this.args,this.canvasElementAliases,e);this.fnValue=i,this.ticker.add(i,null,this.priority),this.ticker.start();}pause(){this.ticker.stop();}play(){this.ticker.start();}get paused(){return !this.ticker.started}};var R=new q$1({cacheSize:5});function ct(t){return function(e){ve.add(e,t);}}var ve;(o=>{function t(p,d){d||(d=p.name),R.get(d)&&r.info(`Ticker "${d}" already exists, it will be overwritten`),p.prototype.id=d,R.set(d,p);}o.add=t;function e(p){try{let d=R.get(p);if(!d){r.error(`Event "${p}" not found, did you forget to register it with the tickerDecorator?`);return}return d}catch(d){r.error(`Error while getting Event "${p}"`,d);return}}o.get=e;function i(p,d,s){try{let c=R.get(p);if(!c){r.error(`Ticker "${p}" not found, did you forget to register it with the tickerDecorator?`);return}return new c(d,s)}catch(c){r.error(`Error while getting Ticker "${p}"`,c);return}}o.getInstance=i;function n(){return Array.from(R.values())}o.values=n;function r$1(p){return R.has(p)}o.has=r$1;function a(){return Array.from(R.keys())}o.keys=a;})(ve||={});var D=ve;var De="aliasToRemoveAfter";var G=class{tickersPausedByGameLayerRender=[];get app(){return g.app}get gameLayer(){return g.gameLayer}get isInitialized(){return g._isInitialized}get width(){return g.canvasWidth}get height(){return g.canvasHeight}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$1=["isRenderGroup","scale","visible","boundsArea","text","resolution","style","height","width"],{ignoreProperties:a=d=>d}=n;if(typeof i=="string"){let d=this.find(i);if(d)i=d;else {r.error(`Canvas element ${i} not found`);return}}if(typeof e=="string"){let d=this.find(e);if(d)e=d;else {r.error(`Canvas element ${e} not found`);return}}e instanceof B.Container&&(e=e.memory);let o=a(r$1),p={...e};o.forEach(d=>{d in p&&delete p[d];}),await k.copyProperty(i.pixivnId,i,p);}add(e,i,n={}){if(e===d){r.error(`The alias ${d} is reserved`);return}let r$1=this.find(e),a=n?.ignoreOldStyle;r$1&&!a&&this.copyCanvasElementProperty(r$1,i);let{zIndex:o=r$1?.parent?.getChildIndex(r$1)}=n;r$1&&!this.canvasElementIsOnCanvas(r$1)?r.error(`The canvas element ${e} exist in the memory but it is not on the canvas, so the zIndex is not set`):r$1&&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===d){r.error(`The alias ${d} is reserved`);return}let n=i.ignoreTickers;typeof e=="string"&&(e=[e]),e.forEach(r=>{this.gameLayer.getChildrenByLabel(r).forEach(a=>{this.gameLayer.removeChild(a),!n&&this.unlinkComponentFromTickerInternal(r);});});}find(e){if(e===d)return this.gameLayer;let i=this.gameLayer.getChildByLabel(e);if(i)return i}canvasElementIsOnCanvas(e){return this.gameLayer.children.includes(e)}removeAll(){this.gameLayer.removeChildren();}editAlias(e,i,n={}){let r=this.find(e);r&&(r.label=i),!n.ignoreTickers&&this.transferTickersInternal(e,i,"move");}get currentTickers(){return this.tickers.currentTickers}get currentTickersSteps(){return this.tickers.currentTickersSteps}findTicker(e){return this.findTickerInternal(e)}findTickerInternal(e){let i=g._currentTickers.get(e);if(i)return i.ticker}addTicker(e,i){return this.addTickerInternal(e,i)}addTickerInternal(e,i){let n=i.id,r$1=i.alias;if(typeof e=="string"&&(e=[e]),i.canvasElementAliases=e,!D.has(r$1)){r.error(`Ticker ${r$1} not found`);return}let a={ticker:i};if(g._currentTickers.set(n,a),a.ticker.start(),i.duration){let o=setTimeout(()=>{g.removeTickerTimeoutInfo(o),g._currentTickersTimeouts.get(o.toString())&&a.ticker.complete({ignoreTickerSteps:true});},i.duration*1e3);g.addTickerTimeoutInfo(e,r$1,o.toString(),true);}return n}addTickersSequence(e,i,n=0){if(i.length===0){r.warn("The steps of the tickers is empty");return}g._currentTickersSequence.has(e)||g._currentTickersSequence.set(e,new Map);let r$1={currentStepNumber:n,steps:i.map(o=>({ticker:o.alias,args:a$1(o.args),duration:o.duration}))},a=g.generateTickerId(r$1);return g._currentTickersSequence.get(e)?.set(a,r$1),this.runTickersSequence(e,a),a}runTickersSequence(e,i){let n=g._currentTickersSequence.get(e);if(!n?.has(i))return;let r$1=n.get(i).steps[n.get(i).currentStepNumber],a=D.getInstance(r$1.ticker,r$1.args,{canvasElementAliases:[e],duration:r$1.duration,priority:r$1.priority});if(!a){r.error(`Ticker ${r$1.ticker} not found`);return}let o=a.alias,p=a.id;a.canvasElementAliases=[e];let d={createdByTicketSteps:{canvasElementAlias:e,id:i},ticker:a};if(g._currentTickers.set(p,d),d.ticker.start(),a.duration){let s=setTimeout(()=>{let c=g._currentTickersTimeouts.get(s.toString());c&&(d.ticker.complete({ignoreTickerSteps:true}),c.aliases.forEach(l=>{this.nextTickerStep(l,i);})),g.removeTickerTimeoutInfo(s);},a.duration*1e3);g.addTickerTimeoutInfo(e,o,s.toString(),false);}}nextTickerStep(e,i){let n=g._currentTickersSequence.get(e);if(n?.has(i)){let r=n.get(i);r.currentStepNumber+1<r.steps.length?(r.currentStepNumber++,n.set(i,r),this.runTickersSequence(e,i)):i&&n.has(i)&&(n.delete(i),g._currentTickers.forEach((a,o)=>{a.createdByTicketSteps?.canvasElementAlias===e&&a.createdByTicketSteps.id===i&&this.removeTickerInternal(o);}));}}onTickerComplete(e,i){return this.onTickerCompleteInternal(e,i)}onTickerCompleteInternal(e,i){let{stopTicker:n=true,aliasToRemoveAfter:r,tickerAliasToResume:a,tickerIdToResume:o}=i,p=g._currentTickers.get(e),d=i.ignoreTickerSteps||false;this.remove(r),a.forEach(s=>{this.resumeTickerInternal({canvasAlias:s});}),this.resumeTickerInternal({id:o}),p&&(this.removeTickerInternal(e,{stopTicker:n}),!d&&p.ticker.duration===void 0&&p.createdByTicketSteps&&this.nextTickerStep(p.createdByTicketSteps.canvasElementAlias,p.createdByTicketSteps.id));}unlinkComponentFromTicker(e,i){return this.unlinkComponentFromTickerInternal(e,i)}unlinkComponentFromTickerInternal(e,i){if(typeof e=="string"&&(e=[e]),!i){e.forEach(r=>{g._currentTickers.forEach((a,o)=>{a.ticker.canvasElementAliases.includes(r)&&(a.ticker.canvasElementAliases.length===1?this.removeTickerInternal(o):a.ticker.canvasElementAliases=a.ticker.canvasElementAliases.filter(p=>p!==r));}),g._currentTickersSequence.has(r)&&g._currentTickersSequence.delete(r),g.removeTickerTimeoutsByAlias(r,false);});return}let n;typeof i=="string"?n=i:n=i.prototype.id,e.forEach(r=>{let a=g._currentTickersSequence.get(r);a&&a.forEach((o,p)=>{o.steps.find(d=>typeof d=="object"&&"ticker"in d&&d.ticker===n)&&a.delete(p);});}),g._currentTickers.forEach(r=>{r.ticker.alias===n&&(r.ticker.canvasElementAliases=r.ticker.canvasElementAliases.filter(a=>!e.includes(a)));}),g._currentTickersTimeouts.forEach(r=>{r.ticker===n&&r.canBeDeletedBeforeEnd&&(r.aliases=r.aliases.filter(a=>!e.includes(a)));}),this.removeTickersWithoutAssociatedCanvasElement();}removeTickersWithoutAssociatedCanvasElement(){g._currentTickers.forEach(e=>{e.ticker.canvasElementAliases=e.ticker.canvasElementAliases.filter(i=>this.find(i)),e.ticker.canvasElementAliases.length===0&&e.ticker.complete({ignoreTickerSteps:true});}),g._currentTickersSequence.forEach((e,i)=>{e===void 0&&g._currentTickersSequence.delete(i);}),Array.from(g._currentTickersTimeouts.keys()).forEach(e=>{let i=g._currentTickersTimeouts.get(e);i&&i.aliases.length===0&&g.removeTickerTimeout(e);});}removeAllTickers(){return this.removeAllTickersInternal()}removeAllTickersInternal(){this.tickersPausedByGameLayerRender=[],g._currentTickersSequence.clear(),Array.from(g._currentTickers.keys()).forEach(e=>{this.removeTickerInternal(e);}),g._currentTickers.clear(),Array.from(g._currentTickersTimeouts.keys()).forEach(e=>{g.removeTickerTimeout(e);}),g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.stepAlias.length=0;}removeTicker(e,i={stopTicker:true}){return this.removeTickerInternal(e,i)}removeTickerInternal(e,i={stopTicker:true}){typeof e=="string"&&(e=[e]),e.forEach(n=>{let r=g._currentTickers.get(n);r&&(i.stopTicker&&r.ticker.stop(),g._currentTickers.delete(n));});}pauseTicker(e){return this.pauseTickerInternal(e)}pauseTickerInternal(e){let i=[];if("canvasAlias"in e){let{canvasAlias:n,tickerIdsExcluded:r=[]}=e;g._currentTickers.forEach((a,o)=>{a.ticker.canvasElementAliases.includes(n)&&!r.includes(a.ticker.alias)&&a.ticker.paused===false&&(a.ticker.pause(),i.push(o));});}else if("id"in e){let{id:n}=e;typeof n=="string"&&(n=[n]),[...new Set(n)].forEach(r$1=>{let a=g._currentTickers.get(r$1);a?a.ticker.paused===false&&(a.ticker.pause(),i.push(r$1)):r.error(`Ticker with id ${r$1} not found`);});}return i}resumeTicker(e){return this.resumeTickerInternal(e)}resumeTickerInternal(e){if("canvasAlias"in e){let{canvasAlias:i}=e;g._currentTickers.forEach(n=>{n.ticker.canvasElementAliases.includes(i)&&n.ticker.play();});}else if("id"in e){let{id:i}=e;typeof i=="string"&&(i=[i]),[...new Set(i)].forEach(n=>{let r$1=g._currentTickers.get(n);r$1?r$1.ticker.play():r.error(`Ticker with id ${n} not found`);});}}isTickerPaused(e,i){return this.isTickerPausedInternal(e,i)}isTickerPausedInternal(e,i){return false}pause(){this.gameLayer.renderable!==false&&(this.gameLayer.renderable=false,this.tickersPausedByGameLayerRender=this.pauseTickerInternal({id:Array.from(g._currentTickers.keys())}));}resume(){if(this.gameLayer.renderable===true)return;this.gameLayer.renderable=true;let e=this.tickersPausedByGameLayerRender.filter(i=>g._currentTickers.has(i));e.length>0&&this.resumeTickerInternal({id:e}),this.tickersPausedByGameLayerRender=[];}transferTickers(e,i,n="move"){return this.transferTickersInternal(e,i,n)}transferTickersInternal(e,i,n="move"){let r$1=g._currentTickersSequence.get(e);if(r$1){let o=new Map(Array.from(r$1.entries()).map(([p,d])=>[p,a$1(d)]));g._currentTickersSequence.set(i,o);}g._currentTickers.forEach((o,p)=>{if(o.createdByTicketSteps?.canvasElementAlias===e&&this.removeTickerInternal(p),o.ticker.canvasElementAliases.includes(e)){let d=D.getInstance(o.ticker.alias,a$1(o.ticker.args),{duration:o.ticker.duration,priority:o.ticker.priority,canvasElementAliases:[i]});if(d?(this.addTickerInternal(i,d),o.ticker.paused&&d.pause()):r.error(`Ticker ${o.ticker.alias} not found`),n==="move"&&(o.ticker.canvasElementAliases=o.ticker.canvasElementAliases.filter(s=>s!==e)),Object.hasOwn(o.ticker.args,De)){let s=o.ticker.args.aliasToRemoveAfter;typeof s=="string"&&(s=[s]),Array.isArray(s)&&(n==="move"?o.ticker.args.aliasToRemoveAfter=s.map(c=>c===e?i:c):n==="duplicate"&&s.find(c=>c===e)&&(o.ticker.args.aliasToRemoveAfter=[...s,i]));}}}),g._currentTickersTimeouts.forEach(o=>{o.aliases.includes(e)&&(n==="move"?o.aliases=o.aliases.map(p=>p===e?i:p):n==="duplicate"&&o.aliases.find(p=>p===e)&&o.aliases.push(i));});let a=g._currentTickersSequence.get(i);if(a&&a.forEach((o,p)=>{this.runTickersSequence(i,p);}),n==="duplicate"){let o=g._currentTickersSequence.get(e);o&&o.forEach((p,d)=>{this.runTickersSequence(e,d);});}}completeTickerOnStepEnd(e){return this.completeTickerOnStepEndInternal(e)}completeTickerOnStepEndInternal(e){e.alias?g._tickersToCompleteOnStepEnd.stepAlias.push({id:e.id,alias:e.alias}):g._tickersToCompleteOnStepEnd.tikersIds.push({id:e.id});}async forceCompletionOfTicker(e,i){return this.forceCompletionOfTickerInternal(e,i)}async forceCompletionOfTickerInternal(e,i){if(i){let n=g._currentTickersSequence.get(i),r=n?.get(e);if(n&&r){let a=r.steps.map(o=>{if(typeof o=="object"&&"ticker"in o){let p=D.getInstance(o.ticker,o.args,{duration:o.duration,canvasElementAliases:[i],priority:o.priority});if(p)return p.complete()}return Promise.resolve()});await Promise.all(a);}}else {let n=g._currentTickers.get(e);n&&await n.ticker.complete();}}tickers={transfer:(e,i,n)=>this.transferTickersInternal(e,i,n),get currentTickers(){return g._currentTickers},get currentTickersSteps(){return g._currentTickersSequence},find:e=>this.findTickerInternal(e),add:(e,i)=>this.addTickerInternal(e,i),addSequence:(e,i,n)=>this.addTickersSequence(e,i,n),unlinkComponent:(e,i)=>this.unlinkComponentFromTickerInternal(e,i),removeAll:()=>this.removeAllTickersInternal(),remove:e=>this.removeTickerInternal(e),pause:e=>this.pauseTickerInternal(e),resume:e=>this.resumeTickerInternal(e),isPaused:(e,i)=>this.isTickerPausedInternal(e,i),completeOnStepEnd:e=>this.completeTickerOnStepEndInternal(e),forceCompletion:(e,i)=>this.forceCompletionOfTickerInternal(e,i),onComplete:(e,i)=>this.onTickerCompleteInternal(e,i)};animate(e,i,n,r){return GameUnifier.animate(e,i,n,r)}addLayerInternal(e,i){if(e===d){r.error(`The alias ${d} is reserved`);return}return i.label=e,g.app.stage.addChild(i)}getLayerInternal(e){return g.app.stage.getChildByLabel(e)}removeLayerInternal(e){let i=g.app.stage.getChildByLabel(e);i&&g.app.stage.removeChild(i);}addHtmlLayerInternal(e,i,n){return g.addHtmlLayer(e,i,n)}removeHtmlLayerInternal(e){return g.removeHtmlLayer(e)}getHtmlLayerInternal(e){return g.getHtmlLayer(e)}addLayer(e,i){return this.addLayerInternal(e,i)}getLayer(e){return this.getLayerInternal(e)}removeLayer(e){return this.removeLayerInternal(e)}addHtmlLayer(e,i,n){return this.addHtmlLayerInternal(e,i,n)}removeHtmlLayer(e){return this.removeHtmlLayerInternal(e)}getHtmlLayer(e){return this.getHtmlLayerInternal(e)}layers={get gameLayer(){return g.gameLayer},add:(e,i)=>this.addLayerInternal(e,i),get:e=>this.getLayerInternal(e),remove:e=>this.removeLayerInternal(e)};htmlLayers={add:(e,i,n)=>this.addHtmlLayerInternal(e,i,n),get:e=>this.getHtmlLayerInternal(e),remove:e=>this.removeHtmlLayerInternal(e)};async extractImage(){let e=this.gameLayer.renderable===false;e&&this.resume();let i;try{i=this.app.renderer.extract.image(this.app.stage);}finally{e&&this.pause();}return (await i).src}clear(){this.removeAllTickersInternal(),this.removeAll();}export(){let e=this.gameLayer.renderable===false;e&&this.resume();try{let i={};return this.children.forEach(n=>{n.label&&(i[n.label]=ye(n));}),{tickers:a$1(g.currentTickersWithoutCreatedBySteps),tickersSteps:a$1(g.currentTickersSequence),elements:a$1(i),stage:a$1(L(this.gameLayer)),elementAliasesOrder:a$1(g.childrenAliasesOrder),tickersToCompleteOnStepEnd:a$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([a,o])=>{n[a]=await J(o);});await Promise.all(r),i.forEach(a=>{let o=n[a];o&&this.add(a,o);});}else {r.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}):r.error("The data does not have the properties stage"),Object.hasOwn(e,"tickers")){let i=e.tickers;Object.entries(i).forEach(([n,r$1])=>{let a=r$1.canvasElementAliases;if(a.length!==0){let o=D.getInstance(r$1.id,r$1.args,{duration:r$1.duration,priority:r$1.priority,id:n,canvasElementAliases:a});o?(o.canvasElementAliases=a,this.addTickerInternal(a,o),r$1.paused&&o.pause()):r.error(`Ticker ${r$1.id} not found`);}});}if(Object.hasOwn(e,"tickersSteps")){let i=e.tickersSteps;Object.entries(i).forEach(([n,r])=>{g._currentTickersSequence.set(n,new Map(Object.entries(r))),Object.keys(r).forEach(a=>{this.runTickersSequence(n,a);});});}if(Object.hasOwn(e,"tickersToCompleteOnStepEnd")){let i=e.tickersToCompleteOnStepEnd,n=i.tikersIds,r=i.stepAlias.map(a=>({id:a.id,alias:a.alias}));g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.tikersIds.push(...n),g._tickersToCompleteOnStepEnd.stepAlias.length=0,g._tickersToCompleteOnStepEnd.stepAlias.push(...r);}}catch(i){r.error("Error importing data",i);}}};var I=class t{static init(e){t._getScreen=e.getScreen;}static _getScreen;static get screen(){return t._getScreen()}};var h;(d=>{function t(s,c,l,u,y,x=0){return y?s==="width"?c*(I.screen.width-l)+l-u-x*l:c*(I.screen.height-l)+l-u-x*l:s==="width"?c*(I.screen.width-l)+u+x*l:c*(I.screen.height-l)+u+x*l}d.calculatePositionByAlign=t;function e(s,c,l,u,y,x=0){return y?s==="width"?(c-l+u+x*l)/(I.screen.width-l):(c-l+u+x*l)/(I.screen.height-l):s==="width"?(c-u-x*l)/(I.screen.width-l):(c-u-x*l)/(I.screen.height-l)}d.calculateAlignByPosition=e;function i(s,c){return s==="width"?c*I.screen.width:c*I.screen.height}d.calculatePositionByPercentagePosition=i;function n(s,c){return s==="width"?c/I.screen.width:c/I.screen.height}d.calculatePercentagePositionByPosition=n;function r(s,c){if(c=c%360,c<0&&(c+=360),c===0)return {x:s.x,y:s.y};if(c===90)return {x:-s.y,y:s.x};if(c===180)return {x:-s.x,y:-s.y};if(c===270)return {x:s.y,y:-s.x};if(c>0&&c<90){let l=c*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=s.x*u-s.y*y,T=s.x*y+s.y*u;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(c>90&&c<180){let l=(c-90)*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=-s.y*y-s.x*u,T=s.y*u-s.x*y;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(c>180&&c<270){let l=(c-180)*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=-s.x*u+s.y*y,T=-s.x*y-s.y*u;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}else if(c>270&&c<360){let l=(c-270)*Math.PI/180,u=Math.cos(l),y=Math.sin(l),x=s.y*y-s.x*u,T=-s.y*u-s.x*y;return s.x!==0&&Math.sign(x)!==Math.sign(s.x)&&(x=-x),s.y!==0&&Math.sign(T)!==Math.sign(s.y)&&(T=-T),{x,y:T}}return {x:0,y:0}}d.getSuperPoint=r;function a(s,c){if(c=c%360,c<0&&(c+=360),c===0)return {x:s.x,y:s.y};if(c===90)return {x:s.y,y:-s.x};if(c===180)return {x:-s.x,y:-s.y};if(c===270)return {x:-s.y,y:s.x};if(c>0&&c<90){let l=c*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:s.x*u+s.y*y,y:-s.x*y+s.y*u}}else if(c>90&&c<180){let l=(c-90)*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:s.y*u-s.x*y,y:-s.y*y-s.x*u}}else if(c>180&&c<270){let l=(c-180)*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:-s.x*u-s.y*y,y:s.x*y-s.y*u}}else if(c>270&&c<360){let l=(c-270)*Math.PI/180,u=Math.cos(l),y=Math.sin(l);return {x:-s.y*u+s.x*y,y:s.y*y+s.x*u}}return {x:0,y:0}}d.getPointBySuperPoint=a;function o(s){let c=s.width,l=s.height,u=s.angle%360;return u<0&&(u+=360),u===0||u===180?c:u===90||u===270?l:Math.abs(c*Math.cos(u*Math.PI/180))+Math.abs(l*Math.sin(u*Math.PI/180))}d.getSuperWidth=o;function p(s){let c=s.width,l=s.height,u=s.angle%360;return u<0&&(u+=360),u===0||u===180?l:u===90||u===270?c:Math.abs(l*Math.cos(u*Math.PI/180))+Math.abs(c*Math.sin(u*Math.PI/180))}d.getSuperHeight=p;})(h||={});async function N(t){if(t!=="EMPTY"){if(!t)throw r.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 r.error("Texture not found",t),new PixiError("unregistered_asset","Texture not found");if(!(e instanceof B.Texture))throw r.error("File is not a Texture",t),new PixiError("unregistered_asset","File is not a Texture");return e}).catch(e=>{throw r.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||h$1;}pixivnId=h$1;get memory(){return {...xe(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){return await ne(this,e)}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}}set xAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)}set yAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageX(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}set percentageY(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};k.add(H,{name:h$1,copyProperty:async(t,e)=>{await ne(t,e,{ignoreTexture:true});}});async function ne(t,e,i){e=A(e);let n=i?.ignoreTexture||false;if(await S(t,e),!n){let a;if("textureData"in e&&e.textureData&&(a=e.textureData),a&&a.url!=="EMPTY"){let o=a.url;a.alias&&B.Assets.resolver.hasKey(a.alias)&&(o=a.alias);try{let p=await N(o);p&&(t.texture=p);}catch(p){r.error("Error in Sprite.setMemorySprite() while loading texture"),p=new PixiError("unregistered_asset",`Error loading image ${o}`,"canvas",e),GameUnifier.runOnError(p,{});}}}let r$1=i?.half;r$1&&await r$1(),"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=g$1;constructor(e,i){super(e),i&&(this._textureAlias=i);}get memory(){return {...super.memory,pixivnId:this.pixivnId,loadIsStarted:this._loadIsStarted}}async setMemory(e){let i;"textureData"in e&&e.textureData&&(i=e.textureData),"assetsData"in e&&Array.isArray(e.assetsData)&&e.assetsData.length>0&&(i=e.assetsData[0]),i&&i.alias&&(this._textureAlias=i.alias),await se(this,e),this.reloadPosition();}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){return this._loadIsStarted=true,N(this.textureAlias).then(e=>{this._loadIsStarted=false,e&&(this.texture=e);}).catch(e=>{this._loadIsStarted=false,r.error("Error into ImageSprite.load()"),e=new PixiError("unregistered_asset",`Error loading image ${this.textureAlias}`,"canvas",{...this.memory,label:this.textureAlias},this),GameUnifier.runOnError(e,{});})}set texture(e){super.texture=e,this.reloadPosition();}get texture(){return super.texture}get haveEmptyTexture(){return this.texture._source.label==="EMPTY"}};k.add(v,{name:g$1,copyProperty:async(t,e)=>{await se(t,e,{ignoreTexture:true});}});async function se(t,e,i){return await ne(t,e,{half:async()=>{"loadIsStarted"in e&&e.loadIsStarted&&await t.load();},ignoreTexture:i?.ignoreTexture})}var M=class t extends v{constructor(e,i){if(e instanceof B.Texture){super(e,i);return}let{loop:n,paused:r,currentTime:a,...o}=e||{};super(o,i),n&&(this.loop=n),r&&(this.paused=r),a&&(this.currentTime=a);}pixivnId=j;get memory(){return {...super.memory,pixivnId:this.pixivnId,loop:this.loop,paused:this._paused,currentTime:this.currentTime}}async setMemory(e){await ze(this,e),this.reloadPosition();}static from(e,i){let n=B.Sprite.from(e,i),r=new t;return r.texture=n.texture,r}async load(){await super.load(),this.loop=this._looop,this.currentTime=this._currentTime,this.paused=this._paused;}_looop=false;get loop(){return this.texture?.source?.resource?.loop||false}set loop(e){this._looop=e,this.texture?.source?.resource&&(this.texture.source.resource.loop=e);}_paused=false;get paused(){return this.texture?.source?.resource?.paused||false}set paused(e){e?this.pause():this.play();}pause(){this._paused=true,this.texture?.source?.resource&&this.texture.source.resource.pause();}play(){this._paused=false,this.texture?.source?.resource?.play&&typeof this.texture.source.resource.play=="function"&&this.texture.source.resource.play();}_currentTime=0;get currentTime(){return this.texture?.source?.resource?.currentTime||0}set currentTime(e){let i=this.duration;i&&e>=i&&(e=0),this._currentTime=e,this.texture?.source?.resource&&(this.texture.source.resource.currentTime=e);}restart(){this.currentTime=0;}get duration(){if(this.texture?.source?.resource)return this.texture.source.resource.duration||0}};k.add(M,{name:j,getInstance:async(t,e)=>{let i;"textureData"in e&&e.textureData&&(i=e.textureData);let n=new t(void 0,i?.alias);return await n.setMemory(e),n},copyProperty:async(t,e)=>{await ze(t,e,{ignoreTexture:true});}});async function ze(t,e,i){await se(t,e,{ignoreTexture:i?.ignoreTexture}),"loop"in e&&e.loop!==void 0&&(t.loop=e.loop),"currentTime"in e&&e.currentTime!==void 0&&(t.currentTime=e.currentTime),"paused"in e&&e.paused!==void 0&&(t.paused=e.paused);}var _=class extends Container{constructor(e$1){let{anchor:i,align:n,percentagePosition:r,...a}=A(e$1)||{};super(a),this.pixivnId=this.constructor.prototype.pixivnId||e,i&&(this.anchor=i),n&&(this.align=n),r&&(this.percentagePosition=r);}pixivnId=e;get memory(){return {...L(this,{childrenExport:true}),anchor:this._anchor?this.anchor:void 0,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){await this.importChildren(e),await S(this,e),this.reloadAnchor(),this.reloadPosition();}async importChildren(e){for(let i=0;i<e.elements.length;i++){let n=e.elements[i],r=await J(n);this.addChild(r);}}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_anchor;get anchor(){let e=super.pivot.x/this.width,i=super.pivot.y/this.height;return {x:e,y:i}}set anchor(e){typeof e=="number"?this._anchor={x:e,y:e}:this._anchor=e,this.reloadAnchor();}reloadAnchor(){this._anchor&&super.pivot.set(this._anchor.x*this.width,this._anchor.y*this.height);}get pivot(){return super.pivot}set pivot(e){this._anchor=void 0,super.pivot=e;}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0)}}set xAlign(e){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0)}set yAlign(e){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}set percentageX(e){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageY(e){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};k.add(_,{name:e,copyProperty:async(t,e)=>await S(t,e)});var yt=new Set(["mp4","webm","ogg","ogv","avi","mov","wmv","flv","mkv","m4v","3gp","3g2","ts","mts"]);function U(t){let e=B.Assets.cache.has(t)?B.Assets.get(t):null;return e instanceof B.Texture&&(t=e.source?.label||t),xt(t)}function xt(t){let e=t.split(".").pop()?.toLowerCase();return e!==void 0&&yt.has(e)}var P=class extends _{constructor(e,i){let{anchor:n,align:r,percentagePosition:a,...o}=A(e)||{};super(o),i&&i.forEach(p=>{U(p)?this.addChild(new M(void 0,p)):this.addChild(new v(void 0,p));}),n&&(this.anchor=n),r&&(this.align=r),a&&(this.percentagePosition=a);}get memory(){return {...super.memory,pixivnId:f$1,loadIsStarted:this._loadIsStarted}}async setMemory(e){await this.importChildren(e),await Ve(this,e),this.reloadAnchor(),this.reloadPosition();}pixivnId=f$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,r.error("Error into ImageContainer.load()",i);})}get texture(){return this.children.length>0?this.children[0].texture:new B.Texture}get haveEmptyTexture(){return this.children.some(e=>e.texture._source.label==="EMPTY")}};k.add(P,{name:f$1,copyProperty:async(t,e)=>await Ve(t,e)});async function Ve(t,e){e=A(e)||{},S(t,e,{end:async()=>{"loadIsStarted"in e&&e.loadIsStarted&&await t.load();}});}var ae=class{constructor(...e){}get memory(){throw new PixiError("not_implemented","The method CanvasBaseItem.memory must be overridden")}setMemory(e){throw new PixiError("not_implemented","The method CanvasBaseItem.setMemory must be overridden")}pixivnId="canvas_element_id_not_set"};var z=class extends B.Text{constructor(e){let{align:i$1,percentagePosition:n,...r}=A(e)||{};super(r),this.pixivnId=this.constructor.prototype.pixivnId||i,i$1&&(this.align=i$1),n&&(this.percentagePosition=n);}pixivnId=i;get memory(){return {...Te(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition}}async setMemory(e){await Pt(this,e),this.reloadPosition();}onEventsHandlers={};on(e,i,n){return O(e,this,i),super.on(e,(...r)=>i(...r,this),n)}_align=void 0;set align(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof e=="number"?(this._align.x=e,this._align.y=e):(e.x!==void 0&&(this._align.x=e.x),e.y!==void 0&&(this._align.y=e.y)),this.reloadPosition();}get align(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return {x:h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x),y:h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}}set xAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=e,this.reloadPosition();}get xAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("width",this.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)}set yAlign(e){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=e,this.reloadPosition();}get yAlign(){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);return h.calculateAlignByPosition("height",this.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof e=="number"?(this._percentagePosition.x=e,this._percentagePosition.y=e):(e.x!==void 0&&(this._percentagePosition.x=e.x),e.y!==void 0&&(this._percentagePosition.y=e.y)),this.reloadPosition();}get percentagePosition(){return {x:h.calculatePercentagePositionByPosition("width",this.x),y:h.calculatePercentagePositionByPosition("height",this.y)}}get percentageX(){return h.calculatePercentagePositionByPosition("width",this.x)}set percentageX(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=e,this.reloadPosition();}get percentageY(){return h.calculatePercentagePositionByPosition("height",this.y)}set percentageY(e){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=e,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){switch(this.positionType){case "align":return {x:this.xAlign,y:this.yAlign,type:"align"};case "percentage":return {x:this.percentageX,y:this.percentageY,type:"percentage"};default:return {x:this.x,y:this.y,type:"pixel"}}}set positionInfo(e){e.type==="align"?this.align={x:e.x,y:e.y}:e.type==="percentage"?this.percentagePosition={x:e.x,y:e.y}:this.position.set(e.x,e.y);}reloadPosition(){if(this._align){let e=h.getSuperPoint(this.pivot,this.angle),i=h.getSuperPoint(this.scale,this.angle);this._align.x!==void 0&&(super.x=h.calculatePositionByAlign("width",this._align.x,h.getSuperWidth(this),e.x,i.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=h.calculatePositionByAlign("height",this._align.y,h.getSuperHeight(this),e.y,i.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=h.calculatePositionByPercentagePosition("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=h.calculatePositionByPercentagePosition("height",this._percentagePosition.y)));}get position(){return super.position}set position(e){this._align=void 0,this._percentagePosition=void 0,super.position=e;}get x(){return super.x}set x(e){this._align=void 0,this._percentagePosition=void 0,super.x=e;}get y(){return super.y}set y(e){this._align=void 0,this._percentagePosition=void 0,super.y=e;}};k.add(z,{name:i});async function Pt(t,e){"text"in e&&e.text!==void 0&&(t.text=e.text),await S(t,e,{end:()=>{"style"in e&&e.style!==void 0&&(t.style=e.style);}}),"anchor"in e&&e.anchor!==void 0&&(typeof e.anchor=="number"?t.anchor.set(e.anchor,e.anchor):t.anchor.set(e.anchor.x,e.anchor.y)),"resolution"in e&&e.resolution!==void 0&&(t.resolution=e.resolution),"anchor"in e&&e.anchor!==void 0&&(typeof e.anchor=="number"?t.anchor.set(e.anchor,e.anchor):t.anchor.set(e.anchor.x,e.anchor.y)),"align"in e&&e.align!==void 0&&(t.align=e.align),"percentagePosition"in e&&e.percentagePosition!==void 0&&(t.percentagePosition=e.percentagePosition),"roundPixels"in e&&e.roundPixels!==void 0&&(t.roundPixels=e.roundPixels);}async function It(t,e={},i){let n=f.find(t);if(!n){r.error(`The element with the alias ${t} does not exist. So the shake effect can't be applied.`);return}let r$1={x:n.position.x,y:n.position.y},{shakeType:a="horizontal",maxShockSize:o=10,shocksNumber:p=10,...d}=e,s=p-1;if(s<2){r.error("The number of shocks must be at least 3.");return}let c=Math.floor(s/2),l=Math.ceil(s/2),u=[];for(let T=0;T<c;T++){let C=o*(T+1)/c;a==="horizontal"?T%2!==0?u.push(r$1.x+C):u.push(r$1.x-C):T%2!==0?u.push(r$1.y+C):u.push(r$1.y-C);}let y=c%2===0;for(let T=l;T>0;T--){let C=o*(T+1)/(l-1);a==="horizontal"?T%2===0&&!y||T%2!==0&&y?u.push(r$1.x-C):u.push(r$1.x+C):T%2===0&&!y||T%2!==0&&y?u.push(r$1.y-C):u.push(r$1.y+C);}let x;if(a==="horizontal"?(u.push(r$1.x),x=f.animate(t,{x:u},d,i)):(u.push(r$1.y),x=f.animate(t,{y:u},d,i)),x)return [x]}function oe(t,e,i){let n={...f.find(t)?.memory,...i},r=new P(i,e);return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function kt(t,e,i){let n={...f.find(t)?.memory,...i},r=new P(i,e);return r.label=t,await r.load(),n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function ce(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The image ${t} does not exist in the cache.`,"canvas",{pixivnId:g$1,...i,label:t});let n={...f.find(t)?.memory,...i},r=new v(i,e);return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function Ct(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The image ${t} does not exist in the cache.`,"canvas",{pixivnId:g$1,...i,label:t});let n={...f.find(t)?.memory,...i},r=new v(i,e);return r.label=t,await r.load(),n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function de(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The video ${t} does not exist in the cache.`,"canvas",{pixivnId:j,...i,label:t});let n={...f.find(t)?.memory,...i},r=new M(i,e);return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}async function St(t,e,i){if(!e)if(B.Assets.resolver.hasKey(t))e=t;else throw new PixiError("unregistered_asset",`The video ${t} does not exist in the cache.`,"canvas",{pixivnId:j,...i,label:t});let n={...f.find(t)?.memory,...i},r=new M(i,e);return r.label=t,await r.load(),n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}function Ie(t){switch(t.type){case "align":return {xAlign:t.x,yAlign:t.y};case "percentage":return {percentageX:t.x,percentageY:t.y};default:return {x:t.x,y:t.y}}}function F(t,e,i){if(typeof e=="string")return U(e)?de(t,e,i):ce(t,e,i);if(Array.isArray(e))return oe(t,e,i);if(typeof e=="object"&&"value"in e&&"options"in e){if(typeof e.value=="string")return U(e.value)?de(t,e.value,{...e.options,zIndex:i.zIndex}):ce(t,e.value,{...e.options,zIndex:i.zIndex});if(Array.isArray(e.value))return oe(t,e.value,{...e.options,zIndex:i.zIndex})}return f.add(t,e,i),e}async function qe(t,e,i={},n){let{completeOnContinue:r=true,tickerIdToResume:a=[],...o}=i,p=[];e||(e=t),typeof a=="string"&&(a=[a]);let d,s=f.find(t);if(s&&(d=`${t}_temp_disolve`,f.editAlias(t,d)),e=F(t,e,{zIndex:s?s.parent?.getChildIndex(s):void 0}),s?.parent?.setChildIndex(s,s.parent.getChildIndex(s)-.1),d&&f.copyCanvasElementProperty(d,t),d&&f.tickers.transfer(d,t,"duplicate"),e.alpha=0,d){let l=pe(d,{...i,autoplay:false,completeOnContinue:r},n);l&&(p.push(...l),a.push(...l));}let c=f.animate(t,{alpha:1},{...o,tickerIdToResume:a,completeOnContinue:r},n);if(c&&p.push(c),(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),p.length>0)return p}function pe(t,e={},i){let{completeOnContinue:n=true,aliasToRemoveAfter:r=[],...a}=e;typeof r=="string"&&(r=[r]),r.push(t);let o=f.animate(t,{alpha:0},{...a,aliasToRemoveAfter:r,completeOnContinue:n},i);if(o)return [o]}async function bt(t,e,i={},n){let{completeOnContinue:r=true,aliasToRemoveAfter:a=[],...o}=i,p=[];e||(e=t),typeof a=="string"&&(a=[a]);let d=f.find(t);if(!d)return qe(t,e,i,n);let s=`${t}_temp_fade`;f.editAlias(t,s),a.push(s),e=F(t,e,{zIndex:d?d.parent?.getChildIndex(d):void 0}),d?.parent?.setChildIndex(d,d.parent.getChildIndex(d)-.1),s&&f.copyCanvasElementProperty(s,t),s&&f.tickers.transfer(s,t,"duplicate"),e.alpha=0;let c=f.animate(t,{alpha:1},{...o,aliasToRemoveAfter:a,completeOnContinue:r},n);if(c){let l=pe(s,{...i,tickerIdToResume:c,completeOnContinue:r},n);l&&p.push(...l),p.push(c),f.tickers.pause({id:c});}if((e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),p.length>0)return p}function At(t,e={},i){return pe(t,e,i)}async function Et(t,e,i={},n){let{direction:r="right",completeOnContinue:a=true,tickerIdToResume:o=[],aliasToRemoveAfter:p=[],removeOldComponentWithMoveOut:d,...s}=i,c=[],l;e||(e=t),typeof o=="string"&&(o=[o]),typeof p=="string"&&(p=[p]);let u,y=f.find(t);if(y&&(u=`${t}_temp_movein`,f.editAlias(t,u),y instanceof v||y instanceof P?l=y.positionInfo:l={x:y.x,y:y.y,type:"pixel"}),e=F(t,e,{zIndex:y?y.parent?.getChildIndex(y):void 0}),y?.parent?.setChildIndex(y,y.parent.getChildIndex(y)-.1),u&&f.copyCanvasElementProperty(u,t),u&&f.tickers.transfer(u,t,"move"),l||(e instanceof v||e instanceof P?l=e.positionInfo:l={x:e.x,y:e.y,type:"pixel"}),u)if(d){let C=ke(u,{...i,autoplay:false,completeOnContinue:a},n);C&&(c.push(...C),o.push(...C));}else p.push(u);switch((e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),r){case "up":e.y=f.height+e.height;break;case "down":e.y=-e.height;break;case "left":e.x=f.width+e.width;break;case "right":e.x=-e.width;break}let x=f.tickers.pause({canvasAlias:t});o.push(...x);let T=f.animate(t,Ie(l),{...s,tickerIdToResume:o,aliasToRemoveAfter:p,completeOnContinue:a},n);if(T&&c.push(T),c.length>0)return c}function ke(t,e={},i){let{direction:n="right",completeOnContinue:r$1=true,aliasToRemoveAfter:a=[],...o}=e;typeof a=="string"&&(a=[a]),a.push(t);let p=f.find(t);if(!p){r.warn(`The canvas component "${t}" is not found.`);return}let d={x:p.x,y:p.y};switch(n){case "up":d.y=-p.height;break;case "down":d.y=f.height+p.height;break;case "left":d.x=-p.width;break;case "right":d.x=f.width+p.width;break}f.tickers.pause({canvasAlias:t});let s=f.animate(t,d,{...o,aliasToRemoveAfter:a,completeOnContinue:r$1},i);if(s)return [s]}async function Mt(t,e,i={},n){let{direction:r="right",completeOnContinue:a=true,tickerIdToResume:o=[],aliasToRemoveAfter:p=[],...d}=i,s=[],c;e||(e=t),typeof o=="string"&&(o=[o]),typeof p=="string"&&(p=[p]);let l,u=f.find(t);u&&(l=`${t}_temp_zoom`,f.editAlias(t,l),u instanceof v||u instanceof P?c=u.positionInfo:c={x:u.x,y:u.y,type:"pixel"}),e=F(t,e,{zIndex:u?u.parent?.getChildIndex(u):void 0}),u?.parent?.setChildIndex(u,u.parent.getChildIndex(u)-.1),l&&f.copyCanvasElementProperty(l,t),l&&f.tickers.transfer(l,t,"move"),c||(e instanceof v||e instanceof P?c=e.positionInfo:c={x:e.x,y:e.y,type:"pixel"});let y={x:e.pivot.x,y:e.pivot.y},x={x:e.scale.x,y:e.scale.y};if(l)if(i.removeOldComponentWithZoomOut){let le=Ge(l,{...i,autoplay:false,completeOnContinue:a},n);le&&(s.push(...le),o.push(...le));}else p.push(l);(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),r==="up"?(e.pivot.y=f.height-e.y,e.pivot.x=f.width/2-e.x,e.y=f.height,e.x=f.width/2):r==="down"?(e.pivot.y=0-e.y,e.pivot.x=f.width/2-e.x,e.y=0,e.x=f.width/2):r==="left"?(e.pivot.x=f.width-e.x,e.pivot.y=f.height/2-e.y,e.x=f.width,e.y=f.height/2):r==="right"&&(e.pivot.x=0-e.x,e.pivot.y=f.height/2-e.y,e.x=0,e.y=f.height/2),e.pivot=h.getPointBySuperPoint(e.pivot,e.angle),e.scale.set(0);let T=f.tickers.pause({canvasAlias:t});o.push(...T);let C=f.animate(t,{...Ie(c),pivotX:y.x,pivotY:y.y,scaleX:x.x,scaleY:x.y},{...d,tickerIdToResume:o,aliasToRemoveAfter:p,completeOnContinue:a},n);if(C&&s.push(C),s.length>0)return s}function Ge(t,e={},i){let{direction:n="right",completeOnContinue:r$1=true,aliasToRemoveAfter:a=[],...o}=e;typeof a=="string"&&(a=[a]),a.push(t);let p=f.find(t);if(!p){r.warn(`The canvas component "${t}" is not found.`);return}let d={x:p.x,y:p.y},s={x:p.pivot.x,y:p.pivot.y};n==="down"?(d.y=f.height,d.x=f.width/2,s.y=f.height-d.y,s.x=f.width/2-d.x):n==="up"?(d.y=0,d.x=f.width/2,s.y=0-d.y,s.x=f.width/2-d.x):n==="right"?(d.x=f.width,d.y=f.height/2,s.x=f.width-d.x,s.y=f.height/2-d.y):n==="left"&&(d.x=0,d.y=f.height/2,s.x=0-d.x,s.y=f.height/2-d.y),s=h.getPointBySuperPoint(s,p.angle),f.tickers.pause({canvasAlias:t});let c=f.animate(t,{...d,pivotX:s.x,pivotY:s.y,scaleX:0,scaleY:0},{...o,aliasToRemoveAfter:a,completeOnContinue:r$1},i);if(c)return [c]}async function _t(t,e,i={},n){let{direction:r="right",completeOnContinue:a=true,tickerIdToResume:o=[],...p}=i,d=[],s;e||(e=t),typeof o=="string"&&(o=[o]);let c,l=f.find(t);switch(l&&(c=`${t}_temp_push`,f.editAlias(t,c),l instanceof v||l instanceof P?s=l.positionInfo:s={x:l.x,y:l.y,type:"pixel"}),e=F(t,e,{zIndex:l?l.parent?.getChildIndex(l):void 0}),l?.parent?.setChildIndex(l,l.parent.getChildIndex(l)-.1),c&&f.copyCanvasElementProperty(c,t),c&&f.tickers.transfer(c,t,"move"),s||((e instanceof v||e instanceof P)&&e.haveEmptyTexture?s=e.positionInfo:s={x:e.x,y:e.y,type:"pixel"}),(e instanceof v||e instanceof P)&&e.haveEmptyTexture&&await e.load(),r){case "up":e.y=f.height+e.height;break;case "down":e.y=-e.height;break;case "left":e.x=f.width+e.width;break;case "right":e.x=-e.width;break}let u=f.tickers.pause({canvasAlias:t});if(o.push(...u),c){let x=Ne(c,{...i,direction:r,completeOnContinue:a});x&&d.push(...x);}let y=f.animate(t,Ie(s),{...p,tickerIdToResume:o,completeOnContinue:a},n);if(y&&d.push(y),d.length>0)return d}function Ne(t,e={direction:"right"},i){return ke(t,e,i)}var K=class extends _{constructor(i){super(i);this._memory=i;this.pixivnId=i.pixivnId;}_memory;pixivnId;get memory(){return {...this._memory,...super.memory,elements:[],pixivnId:this.pixivnId}}};function wt(){return async(e,i)=>{try{let n=e.canvasElementInfo;if(n){let r=new K(n),a=n.zIndex;r.groupColor=16711680;let o=new B.Graphics;o.rect(0,0,300,100).fill({color:16711680,alpha:.5}),r.addChild(o);let p=new B.Text({text:`Error: ${n.label}`,x:10,y:10});r.addChild(p);let d=e.parent;if(d&&"addChild"in d)a!==void 0?d.addChildAt(r,a):d.addChild(r);else {let s=n.parentLabel?f.find(n.parentLabel):void 0;if(s)a!==void 0?s.addChildAt(r,a):s.addChild(r);else {let c=n.label??n.pixivnId;f.add(c,r,{zIndex:a});}}}}catch{}}}function Ot(t,e,i){let n={...f.find(t)?.memory,...i},r=new z({text:e,...i});return n&&f.copyCanvasElementProperty(n,r),f.add(t,r,{ignoreOldStyle:true,zIndex:i?.zIndex}),r}var {Assets:Mn,Color:_n,Rectangle:wn,TextStyle:On,Texture:Bn,UPDATE_PRIORITY:Ln}=B,f=new G;I.init({getScreen:()=>f.screen});GameUnifier.addOnPreContinue(async()=>{try{let t=g._tickersToCompleteOnStepEnd.tikersIds,e=g._tickersToCompleteOnStepEnd.stepAlias,i=(async()=>{for(;t.length;){let{id:r}=t.pop()||{};r&&await f.tickers.forceCompletion(r);}})(),n=(async()=>{for(;e.length;){let{alias:r,id:a}=e.pop()||{};r&&a&&await f.tickers.forceCompletion(a,r);}})();await Promise.all([i,n]),g._tickersToCompleteOnStepEnd.tikersIds.length=0,g._tickersToCompleteOnStepEnd.stepAlias.length=0;}catch{}});
2
2
  export{Mn as Assets,ae as CanvasBaseItem,g as CanvasManagerStatic,h as CanvasPropertyUtility,_n as Color,_ as Container,P as ImageContainer,v as ImageSprite,wn as Rectangle,k as RegisteredCanvasComponents,ge as RegisteredEvents,D as RegisteredTickers,H as Sprite,z as Text,On as TextStyle,Bn as Texture,ee as TickerBase,Ln as UPDATE_PRIORITY,M as VideoSprite,ce as addImage,oe as addImageCointainer,O as addListenerHandler,de as addVideo,A as analizePositionsExtensionProps,f as canvas,Je as canvasComponentDecorator,wt as drawCanvasErrorHandler,Ze as eventDecorator,N as getTexture,Et as moveIn,ke as moveOut,_t as pushIn,Ne as pushOut,pe as removeWithDissolve,At as removeWithFade,S as setMemoryContainer,It as shakeEffect,Ct as showImage,kt as showImageContainer,Ot as showText,St as showVideo,qe as showWithDissolve,bt as showWithFade,ct as tickerDecorator,Mt as zoomIn,Ge as zoomOut};
@@ -1 +1 @@
1
- 'use strict';var core=require('@drincs/pixi-vn/core');var se=Object.defineProperty;var kt=f=>{throw TypeError(f)};var ae=(f,t,r)=>t in f?se(f,t,{enumerable:true,configurable:true,writable:true,value:r}):f[t]=r;var F=(f,t,r)=>ae(f,typeof t!="symbol"?t+"":t,r),Yt=(f,t,r)=>t.has(f)||kt("Cannot "+r);var e=(f,t,r)=>(Yt(f,t,"read from private field"),r?r.call(f):t.get(f)),_=(f,t,r)=>t.has(f)?kt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(f):t.set(f,r),u=(f,t,r,i)=>(Yt(f,t,"write to private field"),t.set(f,r),r),c=(f,t,r)=>(Yt(f,t,"access private method"),r);var Mt=(f,t,r,i)=>({set _(s){u(f,t,s);},get _(){return e(f,t,i)}});var st="storage",ft="temp",Dt="flags",z={CHARACTER_CATEGORY_KEY:"character"};var oe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,qt=new Set,Kt=typeof process=="object"&&process?process:{},Qt=(f,t,r,i)=>{typeof Kt.emitWarning=="function"?Kt.emitWarning(f,t,r,i):console.error(`[${r}] ${t}: ${f}`);},Ut=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof Ut>"u"){Bt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(r,i){this._onabort.push(i);}},Ut=class{constructor(){t();}signal=new Bt;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r);}}};let f=Kt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{f&&(f=false,Qt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var ne=f=>!qt.has(f);var at=f=>f&&f===Math.floor(f)&&f>0&&isFinite(f),Zt=f=>at(f)?f<=Math.pow(2,8)?Uint8Array:f<=Math.pow(2,16)?Uint16Array:f<=Math.pow(2,32)?Uint32Array:f<=Number.MAX_SAFE_INTEGER?Gt:null:null,Gt=class extends Array{constructor(f){super(f),this.fill(0);}},et,Et,he=(et=class{heap;length;static create(t){let r=Zt(t);if(!r)return [];u(et,Et,true);let i=new et(t,r);return u(et,Et,false),i}constructor(t,r){if(!e(et,Et))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Et=new WeakMap,_(et,Et,false),et),Xt,Jt,j,P,k,ut,B,Tt,yt,X,I,J,x,O,g,L,Y,M,C,q,N,Q,Z,K,W,tt,lt,V,bt,n,Wt,gt,it,Rt,H,ee,dt,At,Ct,ot,nt,Ht,Lt,Vt,v,$t,It,ht,jt,vt,te=(vt=class{constructor(t){_(this,n);_(this,j);_(this,P);_(this,k);_(this,ut);_(this,B);_(this,Tt);_(this,yt);_(this,X);F(this,"ttl");F(this,"ttlResolution");F(this,"ttlAutopurge");F(this,"updateAgeOnGet");F(this,"updateAgeOnHas");F(this,"allowStale");F(this,"noDisposeOnSet");F(this,"noUpdateTTL");F(this,"maxEntrySize");F(this,"sizeCalculation");F(this,"noDeleteOnFetchRejection");F(this,"noDeleteOnStaleGet");F(this,"allowStaleOnFetchAbort");F(this,"allowStaleOnFetchRejection");F(this,"ignoreFetchAbort");_(this,I);_(this,J);_(this,x);_(this,O);_(this,g);_(this,L);_(this,Y);_(this,M);_(this,C);_(this,q);_(this,N);_(this,Q);_(this,Z);_(this,K);_(this,W);_(this,tt);_(this,lt);_(this,V);_(this,bt);_(this,gt,()=>{});_(this,it,()=>{});_(this,Rt,()=>{});_(this,H,()=>false);_(this,dt,t=>{});_(this,At,(t,r,i)=>{});_(this,Ct,(t,r,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});F(this,Xt,"LRUCache");let{max:r=0,ttl:i,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:h,allowStale:l,dispose:S,onInsert:R,disposeAfter:d,noDisposeOnSet:y,noUpdateTTL:T,maxSize:E=0,maxEntrySize:b=0,sizeCalculation:A,fetchMethod:p,memoMethod:D,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:xt,ignoreFetchAbort:_t,perf:mt}=t;if(mt!==void 0&&typeof mt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,X,mt??oe),r!==0&&!at(r))throw new TypeError("max option must be a nonnegative integer");let St=r?Zt(r):Array;if(!St)throw new Error("invalid max value: "+r);if(u(this,j,r),u(this,P,E),this.maxEntrySize=b||e(this,P),this.sizeCalculation=A,this.sizeCalculation){if(!e(this,P)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(D!==void 0&&typeof D!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,yt,D),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,Tt,p),u(this,lt,!!p),u(this,x,new Map),u(this,O,new Array(r).fill(void 0)),u(this,g,new Array(r).fill(void 0)),u(this,L,new St(r)),u(this,Y,new St(r)),u(this,M,0),u(this,C,0),u(this,q,he.create(r)),u(this,I,0),u(this,J,0),typeof S=="function"&&u(this,k,S),typeof R=="function"&&u(this,ut,R),typeof d=="function"?(u(this,B,d),u(this,N,[])):(u(this,B,void 0),u(this,N,void 0)),u(this,tt,!!e(this,k)),u(this,bt,!!e(this,ut)),u(this,V,!!e(this,B)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!T,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!xt,this.ignoreFetchAbort=!!_t,this.maxEntrySize!==0){if(e(this,P)!==0&&!at(e(this,P)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");c(this,n,ee).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!h,this.ttlResolution=at(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");c(this,n,Wt).call(this);}if(e(this,j)===0&&this.ttl===0&&e(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,j)&&!e(this,P)){let Pt="LRU_CACHE_UNBOUNDED";ne(Pt)&&(qt.add(Pt),Qt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,vt));}}get perf(){return e(this,X)}static unsafeExposeInternals(t){return {starts:e(t,Z),ttls:e(t,K),autopurgeTimers:e(t,W),sizes:e(t,Q),keyMap:e(t,x),keyList:e(t,O),valList:e(t,g),next:e(t,L),prev:e(t,Y),get head(){return e(t,M)},get tail(){return e(t,C)},free:e(t,q),isBackgroundFetch:r=>{var i;return c(i=t,n,v).call(i,r)},backgroundFetch:(r,i,s,o)=>{var a;return c(a=t,n,Vt).call(a,r,i,s,o)},moveToTail:r=>{var i;return c(i=t,n,It).call(i,r)},indexes:r=>{var i;return c(i=t,n,ot).call(i,r)},rindexes:r=>{var i;return c(i=t,n,nt).call(i,r)},isStale:r=>{var i;return e(i=t,H).call(i,r)}}}get max(){return e(this,j)}get maxSize(){return e(this,P)}get calculatedSize(){return e(this,J)}get size(){return e(this,I)}get fetchMethod(){return e(this,Tt)}get memoMethod(){return e(this,yt)}get dispose(){return e(this,k)}get onInsert(){return e(this,ut)}get disposeAfter(){return e(this,B)}getRemainingTTL(t){return e(this,x).has(t)?1/0:0}*entries(){for(let t of c(this,n,ot).call(this))e(this,g)[t]!==void 0&&e(this,O)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield [e(this,O)[t],e(this,g)[t]]);}*rentries(){for(let t of c(this,n,nt).call(this))e(this,g)[t]!==void 0&&e(this,O)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield [e(this,O)[t],e(this,g)[t]]);}*keys(){for(let t of c(this,n,ot).call(this)){let r=e(this,O)[t];r!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield r);}}*rkeys(){for(let t of c(this,n,nt).call(this)){let r=e(this,O)[t];r!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield r);}}*values(){for(let t of c(this,n,ot).call(this))e(this,g)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}*rvalues(){for(let t of c(this,n,nt).call(this))e(this,g)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){return this.entries()}find(t,r={}){for(let i of c(this,n,ot).call(this)){let s=e(this,g)[i],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,e(this,O)[i],this))return this.get(e(this,O)[i],r)}}forEach(t,r=this){for(let i of c(this,n,ot).call(this)){let s=e(this,g)[i],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,e(this,O)[i],this);}}rforEach(t,r=this){for(let i of c(this,n,nt).call(this)){let s=e(this,g)[i],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,e(this,O)[i],this);}}purgeStale(){let t=false;for(let r of c(this,n,nt).call(this,{allowStale:true}))e(this,H).call(this,r)&&(c(this,n,ht).call(this,e(this,O)[r],"expire"),t=true);return t}info(t){let r=e(this,x).get(t);if(r===void 0)return;let i=e(this,g)[r],s=c(this,n,v).call(this,i)?i.__staleWhileFetching:i;if(s===void 0)return;let o={value:s};if(e(this,K)&&e(this,Z)){let a=e(this,K)[r],h=e(this,Z)[r];if(a&&h){let l=a-(e(this,X).now()-h);o.ttl=l,o.start=Date.now();}}return e(this,Q)&&(o.size=e(this,Q)[r]),o}dump(){let t=[];for(let r of c(this,n,ot).call(this,{allowStale:true})){let i=e(this,O)[r],s=e(this,g)[r],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||i===void 0)continue;let a={value:o};if(e(this,K)&&e(this,Z)){a.ttl=e(this,K)[r];let h=e(this,X).now()-e(this,Z)[r];a.start=Math.floor(Date.now()-h);}e(this,Q)&&(a.size=e(this,Q)[r]),t.unshift([i,a]);}return t}load(t){this.clear();for(let[r,i]of t){if(i.start){let s=Date.now()-i.start;i.start=e(this,X).now()-s;}this.set(r,i.value,i);}}set(t,r,i={}){var y,T,E,b;if(r===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:l}=i,{noUpdateTTL:S=this.noUpdateTTL}=i,R=e(this,Ct).call(this,t,r,i.size||0,h);if(this.maxEntrySize&&R>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),c(this,n,ht).call(this,t,"set"),this;let d=e(this,I)===0?void 0:e(this,x).get(t);if(d===void 0)d=e(this,I)===0?e(this,C):e(this,q).length!==0?e(this,q).pop():e(this,I)===e(this,j)?c(this,n,Lt).call(this,false):e(this,I),e(this,O)[d]=t,e(this,g)[d]=r,e(this,x).set(t,d),e(this,L)[e(this,C)]=d,e(this,Y)[d]=e(this,C),u(this,C,d),Mt(this,I)._++,e(this,At).call(this,d,R,l),l&&(l.set="add"),S=false,e(this,bt)&&((y=e(this,ut))==null||y.call(this,r,t,"add"));else {c(this,n,It).call(this,d);let A=e(this,g)[d];if(r!==A){if(e(this,lt)&&c(this,n,v).call(this,A)){A.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=A;p!==void 0&&!a&&(e(this,tt)&&((T=e(this,k))==null||T.call(this,p,t,"set")),e(this,V)&&e(this,N)?.push([p,t,"set"]));}else a||(e(this,tt)&&((E=e(this,k))==null||E.call(this,A,t,"set")),e(this,V)&&e(this,N)?.push([A,t,"set"]));if(e(this,dt).call(this,d),e(this,At).call(this,d,R,l),e(this,g)[d]=r,l){l.set="replace";let p=A&&c(this,n,v).call(this,A)?A.__staleWhileFetching:A;p!==void 0&&(l.oldValue=p);}}else l&&(l.set="update");e(this,bt)&&this.onInsert?.(r,t,r===A?"update":"replace");}if(s!==0&&!e(this,K)&&c(this,n,Wt).call(this),e(this,K)&&(S||e(this,Rt).call(this,d,s,o),l&&e(this,it).call(this,l,d)),!a&&e(this,V)&&e(this,N)){let A=e(this,N),p;for(;p=A?.shift();)(b=e(this,B))==null||b.call(this,...p);}return this}pop(){var t;try{for(;e(this,I);){let r=e(this,g)[e(this,M)];if(c(this,n,Lt).call(this,!0),c(this,n,v).call(this,r)){if(r.__staleWhileFetching)return r.__staleWhileFetching}else if(r!==void 0)return r}}finally{if(e(this,V)&&e(this,N)){let r=e(this,N),i;for(;i=r?.shift();)(t=e(this,B))==null||t.call(this,...i);}}}has(t,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=r,o=e(this,x).get(t);if(o!==void 0){let a=e(this,g)[o];if(c(this,n,v).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(e(this,H).call(this,o))s&&(s.has="stale",e(this,it).call(this,s,o));else return i&&e(this,gt).call(this,o),s&&(s.has="hit",e(this,it).call(this,s,o)),true}else s&&(s.has="miss");return false}peek(t,r={}){let{allowStale:i=this.allowStale}=r,s=e(this,x).get(t);if(s===void 0||!i&&e(this,H).call(this,s))return;let o=e(this,g)[s];return c(this,n,v).call(this,o)?o.__staleWhileFetching:o}async fetch(t,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:l=0,sizeCalculation:S=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:T=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:b,forceRefresh:A=false,status:p,signal:D}=r;if(!e(this,lt))return p&&(p.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:p});let U={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:h,size:l,sizeCalculation:S,noUpdateTTL:R,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:E,ignoreFetchAbort:T,status:p,signal:D},G=e(this,x).get(t);if(G===void 0){p&&(p.fetch="miss");let w=c(this,n,Vt).call(this,t,G,U,b);return w.__returned=w}else {let w=e(this,g)[G];if(c(this,n,v).call(this,w)){let St=i&&w.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",St&&(p.returnedStale=true)),St?w.__staleWhileFetching:w.__returned=w}let xt=e(this,H).call(this,G);if(!A&&!xt)return p&&(p.fetch="hit"),c(this,n,It).call(this,G),s&&e(this,gt).call(this,G),p&&e(this,it).call(this,p,G),w;let _t=c(this,n,Vt).call(this,t,G,U,b),mt=_t.__staleWhileFetching!==void 0&&i;return p&&(p.fetch=xt?"stale":"refresh",mt&&xt&&(p.returnedStale=true)),mt?_t.__staleWhileFetching:_t.__returned=_t}}async forceFetch(t,r={}){let i=await this.fetch(t,r);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,r={}){let i=e(this,yt);if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...a}=r,h=this.get(t,a);if(!o&&h!==void 0)return h;let l=i(t,h,{options:a,context:s});return this.set(t,l,a),l}get(t,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=r,h=e(this,x).get(t);if(h!==void 0){let l=e(this,g)[h],S=c(this,n,v).call(this,l);return a&&e(this,it).call(this,a,h),e(this,H).call(this,h)?(a&&(a.get="stale"),S?(a&&i&&l.__staleWhileFetching!==void 0&&(a.returnedStale=true),i?l.__staleWhileFetching:void 0):(o||c(this,n,ht).call(this,t,"expire"),a&&i&&(a.returnedStale=true),i?l:void 0)):(a&&(a.get="hit"),S?l.__staleWhileFetching:(c(this,n,It).call(this,h),s&&e(this,gt).call(this,h),l))}else a&&(a.get="miss");}delete(t){return c(this,n,ht).call(this,t,"delete")}clear(){return c(this,n,jt).call(this,"delete")}},j=new WeakMap,P=new WeakMap,k=new WeakMap,ut=new WeakMap,B=new WeakMap,Tt=new WeakMap,yt=new WeakMap,X=new WeakMap,I=new WeakMap,J=new WeakMap,x=new WeakMap,O=new WeakMap,g=new WeakMap,L=new WeakMap,Y=new WeakMap,M=new WeakMap,C=new WeakMap,q=new WeakMap,N=new WeakMap,Q=new WeakMap,Z=new WeakMap,K=new WeakMap,W=new WeakMap,tt=new WeakMap,lt=new WeakMap,V=new WeakMap,bt=new WeakMap,n=new WeakSet,Wt=function(){let t=new Gt(e(this,j)),r=new Gt(e(this,j));u(this,K,t),u(this,Z,r);let i=this.ttlAutopurge?new Array(e(this,j)):void 0;u(this,W,i),u(this,Rt,(h,l,S=e(this,X).now())=>{r[h]=l!==0?S:0,t[h]=l,s(h,l);}),u(this,gt,h=>{r[h]=t[h]!==0?e(this,X).now():0,s(h,t[h]);});let s=this.ttlAutopurge?(h,l)=>{if(i?.[h]&&(clearTimeout(i[h]),i[h]=void 0),l&&l!==0&&i){let S=setTimeout(()=>{e(this,H).call(this,h)&&c(this,n,ht).call(this,e(this,O)[h],"expire");},l+1);S.unref&&S.unref(),i[h]=S;}}:()=>{};u(this,it,(h,l)=>{if(t[l]){let S=t[l],R=r[l];if(!S||!R)return;h.ttl=S,h.start=R,h.now=o||a();let d=h.now-R;h.remainingTTL=S-d;}});let o=0,a=()=>{let h=e(this,X).now();if(this.ttlResolution>0){o=h;let l=setTimeout(()=>o=0,this.ttlResolution);l.unref&&l.unref();}return h};this.getRemainingTTL=h=>{let l=e(this,x).get(h);if(l===void 0)return 0;let S=t[l],R=r[l];if(!S||!R)return 1/0;let d=(o||a())-R;return S-d},u(this,H,h=>{let l=r[h],S=t[h];return !!S&&!!l&&(o||a())-l>S});},gt=new WeakMap,it=new WeakMap,Rt=new WeakMap,H=new WeakMap,ee=function(){let t=new Gt(e(this,j));u(this,J,0),u(this,Q,t),u(this,dt,r=>{u(this,J,e(this,J)-t[r]),t[r]=0;}),u(this,Ct,(r,i,s,o)=>{if(c(this,n,v).call(this,i))return 0;if(!at(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(i,r),!at(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s}),u(this,At,(r,i,s)=>{if(t[r]=i,e(this,P)){let o=e(this,P)-t[r];for(;e(this,J)>o;)c(this,n,Lt).call(this,true);}u(this,J,e(this,J)+t[r]),s&&(s.entrySize=i,s.totalCalculatedSize=e(this,J));});},dt=new WeakMap,At=new WeakMap,Ct=new WeakMap,ot=function*({allowStale:t=this.allowStale}={}){if(e(this,I))for(let r=e(this,C);!(!c(this,n,Ht).call(this,r)||((t||!e(this,H).call(this,r))&&(yield r),r===e(this,M)));)r=e(this,Y)[r];},nt=function*({allowStale:t=this.allowStale}={}){if(e(this,I))for(let r=e(this,M);!(!c(this,n,Ht).call(this,r)||((t||!e(this,H).call(this,r))&&(yield r),r===e(this,C)));)r=e(this,L)[r];},Ht=function(t){return t!==void 0&&e(this,x).get(e(this,O)[t])===t},Lt=function(t){var o;let r=e(this,M),i=e(this,O)[r],s=e(this,g)[r];return e(this,lt)&&c(this,n,v).call(this,s)?s.__abortController.abort(new Error("evicted")):(e(this,tt)||e(this,V))&&(e(this,tt)&&((o=e(this,k))==null||o.call(this,s,i,"evict")),e(this,V)&&e(this,N)?.push([s,i,"evict"])),e(this,dt).call(this,r),e(this,W)?.[r]&&(clearTimeout(e(this,W)[r]),e(this,W)[r]=void 0),t&&(e(this,O)[r]=void 0,e(this,g)[r]=void 0,e(this,q).push(r)),e(this,I)===1?(u(this,M,u(this,C,0)),e(this,q).length=0):u(this,M,e(this,L)[r]),e(this,x).delete(i),Mt(this,I)._--,r},Vt=function(t,r,i,s){let o=r===void 0?void 0:e(this,g)[r];if(c(this,n,v).call(this,o))return o;let a=new Ut,{signal:h}=i;h?.addEventListener("abort",()=>a.abort(h.reason),{signal:a.signal});let l={signal:a.signal,options:i,context:s},S=(b,A=false)=>{let{aborted:p}=a.signal,D=i.ignoreFetchAbort&&b!==void 0,U=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&b!==void 0);if(i.status&&(p&&!A?(i.status.fetchAborted=true,i.status.fetchError=a.signal.reason,D&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),p&&!D&&!A)return d(a.signal.reason,U);let G=T,w=e(this,g)[r];return (w===T||D&&A&&w===void 0)&&(b===void 0?G.__staleWhileFetching!==void 0?e(this,g)[r]=G.__staleWhileFetching:c(this,n,ht).call(this,t,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(t,b,l.options))),b},R=b=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=b),d(b,false)),d=(b,A)=>{let{aborted:p}=a.signal,D=p&&i.allowStaleOnFetchAbort,U=D||i.allowStaleOnFetchRejection,G=U||i.noDeleteOnFetchRejection,w=T;if(e(this,g)[r]===T&&(!G||!A&&w.__staleWhileFetching===void 0?c(this,n,ht).call(this,t,"fetch"):D||(e(this,g)[r]=w.__staleWhileFetching)),U)return i.status&&w.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),w.__staleWhileFetching;if(w.__returned===w)throw b},y=(b,A)=>{var D;let p=(D=e(this,Tt))==null?void 0:D.call(this,t,o,l);p&&p instanceof Promise&&p.then(U=>b(U===void 0?void 0:U),A),a.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(b(void 0),i.allowStaleOnFetchAbort&&(b=U=>S(U,true)));});};i.status&&(i.status.fetchDispatched=true);let T=new Promise(y).then(S,R),E=Object.assign(T,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(t,E,{...l.options,status:void 0}),r=e(this,x).get(t)):e(this,g)[r]=E,E},v=function(t){if(!e(this,lt))return false;let r=t;return !!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Ut},$t=function(t,r){e(this,Y)[r]=t,e(this,L)[t]=r;},It=function(t){t!==e(this,C)&&(t===e(this,M)?u(this,M,e(this,L)[t]):c(this,n,$t).call(this,e(this,Y)[t],e(this,L)[t]),c(this,n,$t).call(this,e(this,C),t),u(this,C,t));},ht=function(t,r){var s,o;let i=false;if(e(this,I)!==0){let a=e(this,x).get(t);if(a!==void 0)if(e(this,W)?.[a]&&(clearTimeout(e(this,W)?.[a]),e(this,W)[a]=void 0),i=true,e(this,I)===1)c(this,n,jt).call(this,r);else {e(this,dt).call(this,a);let h=e(this,g)[a];if(c(this,n,v).call(this,h)?h.__abortController.abort(new Error("deleted")):(e(this,tt)||e(this,V))&&(e(this,tt)&&((s=e(this,k))==null||s.call(this,h,t,r)),e(this,V)&&e(this,N)?.push([h,t,r])),e(this,x).delete(t),e(this,O)[a]=void 0,e(this,g)[a]=void 0,a===e(this,C))u(this,C,e(this,Y)[a]);else if(a===e(this,M))u(this,M,e(this,L)[a]);else {let l=e(this,Y)[a];e(this,L)[l]=e(this,L)[a];let S=e(this,L)[a];e(this,Y)[S]=e(this,Y)[a];}Mt(this,I)._--,e(this,q).push(a);}}if(e(this,V)&&e(this,N)?.length){let a=e(this,N),h;for(;h=a?.shift();)(o=e(this,B))==null||o.call(this,...h);}return i},jt=function(t){var r,i;for(let s of c(this,n,nt).call(this,{allowStale:true})){let o=e(this,g)[s];if(c(this,n,v).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=e(this,O)[s];e(this,tt)&&((r=e(this,k))==null||r.call(this,o,a,t)),e(this,V)&&e(this,N)?.push([o,a,t]);}}if(e(this,x).clear(),e(this,g).fill(void 0),e(this,O).fill(void 0),e(this,K)&&e(this,Z)){e(this,K).fill(0),e(this,Z).fill(0);for(let s of e(this,W)??[])s!==void 0&&clearTimeout(s);e(this,W)?.fill(void 0);}if(e(this,Q)&&e(this,Q).fill(0),u(this,M,0),u(this,C,0),e(this,q).length=0,u(this,J,0),u(this,I,0),e(this,V)&&e(this,N)){let s=e(this,N),o;for(;o=s?.shift();)(i=e(this,B))==null||i.call(this,...o);}},vt);var ct=class{cache;map=new Map;constructor(t){this.cache=new te({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(t){let r=this.map.delete(t);return r&&this.cache.delete(t),r}get forEach(){return this.map.forEach}get(t){let r=this.cache.get(t);return r||this.map.get(t)}has(t){return this.map.has(t)}set(t,r){return this.map.set(t,r),this.cache.set(t,r),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var rt;(s=>(s.log=(o,...a)=>console.log(`[Pixi\u2019VN] ${o}`,...a),s.warn=(o,...a)=>console.warn(`[Pixi\u2019VN] ${o}`,...a),s.error=(o,...a)=>console.error(`[Pixi\u2019VN] ${o}`,...a),s.info=(o,...a)=>console.info(`[Pixi\u2019VN] ${o}`,...a)))(rt||={});function Nt(f){try{if(typeof f>"u")return f;let t=JSON.stringify(f);return JSON.parse(t)}catch(t){throw rt.error("Error creating exportable element",f,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var re;(d=>{d.storage=new ct({cacheSize:50}),d.defaultStorage=new ct({cacheSize:10}),d.tempStorageDeadlines=new Map;let i;function s(y){d.tempStorageDeadlines.forEach((T,E)=>{T>y&&(d.storage.delete(`${ft}:${E}`),i?.onClearOldTempVariable?.(E),d.tempStorageDeadlines.delete(E));});}d.clearOldTempVariables=s;function o(y){i=y;}d.setExternalStoreHandler=o;function a(y,T,E){E==null?d.storage.delete(`${y}:${T}`):d.storage.set(`${y}:${T}`,E),i?.onSetVariable?.(T,E);}d.setVariable=a;function h(y,T){let E=d.storage.get(`${y}:${T}`);return Nt(E)}d.getVariable=h;function l(y,T){d.storage.delete(`${y}:${T}`),i?.onRemoveVariable?.(T);}d.removeVariable=l;function S(y,T){let E=d.storage.get(Dt)||[];if(T)E.includes(y)||E.push(y);else {let b=E.indexOf(y);b>-1&&E.splice(b,1);}d.storage.set(Dt,E);}d.setFlag=S;function R(y){return (d.storage.get(Dt)||[]).includes(y)}d.getFlag=R;})(re||={});var m=re;var Ot=class{constructor(t,r){this.categoryId=t,this.id=r,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let r=m.getVariable(st,t);r&&(Object.entries(r).forEach(([i,s])=>{typeof s=="object"&&s!==null&&Object.entries(s).forEach(([o,a])=>{m.setVariable(this.categoryId,`${i}:${o}`,a);});}),m.removeVariable(st,t));}id;categoryId;setStorageProperty(t,r){m.setVariable(this.categoryId,`${this.id}:${t}`,r);}getStorageProperty(t,r=this.id){return m.getVariable(this.categoryId,`${r}:${t}`)}};var fe="@",wt=class extends Ot{sourceId;constructor(t,r=""){super(z.CHARACTER_CATEGORY_KEY,t+(r?fe+r:"")),this.sourceId=t,this.migrateOldStorage("___character___");}getStorageProperty(t){let r=super.getStorageProperty(t);return r===void 0&&(r=super.getStorageProperty(t,this.sourceId)),r}};var zt=class extends wt{constructor(t,r){super(typeof t=="string"?t:t.id,typeof t=="string"?"":t.emotion),this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this.icon=r.icon,this.color=r.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(t){this.setStorageProperty("name",t);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(t){this.setStorageProperty("surname",t);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(t){this.setStorageProperty("age",t);}icon;color};var pt=new ct({cacheSize:10}),ie;(a=>{function f(h){try{let l=pt.get(h);if(!l){rt.warn(`Character "${h}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return l}catch(l){rt.error(`Error while getting Character "${h}"`,l);return}}a.get=f;function t(...h){for(let l of h){if(Array.isArray(l)){t(...l);continue}pt.get(l.id)&&rt.info(`Character id "${l.id}" already exists, it will be overwritten`),pt.set(l.id,l);}}a.add=t;function r(){return Array.from(pt.values())}a.values=r;function i(h){return pt.has(h)}a.has=i;function s(){return Array.from(pt.keys())}a.keys=s;function o(){pt.clear();}a.clear=o;})(ie||={});var ue=ie;exports.CharacterBaseModel=zt;exports.CharacterStoredClass=wt;exports.RegisteredCharacters=ue;
1
+ 'use strict';var core=require('@drincs/pixi-vn/core');require('@drincs/pixi-vn/worker');var se=Object.defineProperty;var kt=f=>{throw TypeError(f)};var ae=(f,t,r)=>t in f?se(f,t,{enumerable:true,configurable:true,writable:true,value:r}):f[t]=r;var M=(f,t,r)=>ae(f,typeof t!="symbol"?t+"":t,r),Yt=(f,t,r)=>t.has(f)||kt("Cannot "+r);var e=(f,t,r)=>(Yt(f,t,"read from private field"),r?r.call(f):t.get(f)),_=(f,t,r)=>t.has(f)?kt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(f):t.set(f,r),u=(f,t,r,i)=>(Yt(f,t,"write to private field"),t.set(f,r),r),c=(f,t,r)=>(Yt(f,t,"access private method"),r);var Mt=(f,t,r,i)=>({set _(s){u(f,t,s);},get _(){return e(f,t,i)}});var st="storage",ft="temp",Ft="flags",z={CHARACTER_CATEGORY_KEY:"character"};var oe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,qt=new Set,Kt=typeof process=="object"&&process?process:{},Qt=(f,t,r,i)=>{typeof Kt.emitWarning=="function"?Kt.emitWarning(f,t,r,i):console.error(`[${r}] ${t}: ${f}`);},Vt=globalThis.AbortController,Bt=globalThis.AbortSignal;if(typeof Vt>"u"){Bt=class{onabort;_onabort=[];reason;aborted=false;addEventListener(r,i){this._onabort.push(i);}},Vt=class{constructor(){t();}signal=new Bt;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=true;for(let i of this.signal._onabort)i(r);this.signal.onabort?.(r);}}};let f=Kt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{f&&(f=false,Qt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var ne=f=>!qt.has(f);var at=f=>f&&f===Math.floor(f)&&f>0&&isFinite(f),Zt=f=>at(f)?f<=Math.pow(2,8)?Uint8Array:f<=Math.pow(2,16)?Uint16Array:f<=Math.pow(2,32)?Uint32Array:f<=Number.MAX_SAFE_INTEGER?Dt:null:null,Dt=class extends Array{constructor(f){super(f),this.fill(0);}},et,Et,he=(et=class{heap;length;static create(t){let r=Zt(t);if(!r)return [];u(et,Et,true);let i=new et(t,r);return u(et,Et,false),i}constructor(t,r){if(!e(et,Et))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Et=new WeakMap,_(et,Et,false),et),Xt,Jt,j,P,k,ut,B,Tt,yt,X,I,J,x,O,g,L,Y,F,C,q,N,Q,Z,K,W,tt,lt,V,bt,n,Wt,gt,it,Rt,H,ee,dt,At,Ct,ot,nt,Ht,Gt,Lt,v,$t,It,ht,jt,vt,te=(vt=class{constructor(t){_(this,n);_(this,j);_(this,P);_(this,k);_(this,ut);_(this,B);_(this,Tt);_(this,yt);_(this,X);M(this,"ttl");M(this,"ttlResolution");M(this,"ttlAutopurge");M(this,"updateAgeOnGet");M(this,"updateAgeOnHas");M(this,"allowStale");M(this,"noDisposeOnSet");M(this,"noUpdateTTL");M(this,"maxEntrySize");M(this,"sizeCalculation");M(this,"noDeleteOnFetchRejection");M(this,"noDeleteOnStaleGet");M(this,"allowStaleOnFetchAbort");M(this,"allowStaleOnFetchRejection");M(this,"ignoreFetchAbort");_(this,I);_(this,J);_(this,x);_(this,O);_(this,g);_(this,L);_(this,Y);_(this,F);_(this,C);_(this,q);_(this,N);_(this,Q);_(this,Z);_(this,K);_(this,W);_(this,tt);_(this,lt);_(this,V);_(this,bt);_(this,gt,()=>{});_(this,it,()=>{});_(this,Rt,()=>{});_(this,H,()=>false);_(this,dt,t=>{});_(this,At,(t,r,i)=>{});_(this,Ct,(t,r,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});M(this,Xt,"LRUCache");let{max:r=0,ttl:i,ttlResolution:s=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:h,allowStale:l,dispose:S,onInsert:R,disposeAfter:d,noDisposeOnSet:y,noUpdateTTL:T,maxSize:E=0,maxEntrySize:b=0,sizeCalculation:A,fetchMethod:p,memoMethod:D,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:xt,ignoreFetchAbort:_t,perf:mt}=t;if(mt!==void 0&&typeof mt?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(u(this,X,mt??oe),r!==0&&!at(r))throw new TypeError("max option must be a nonnegative integer");let St=r?Zt(r):Array;if(!St)throw new Error("invalid max value: "+r);if(u(this,j,r),u(this,P,E),this.maxEntrySize=b||e(this,P),this.sizeCalculation=A,this.sizeCalculation){if(!e(this,P)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(D!==void 0&&typeof D!="function")throw new TypeError("memoMethod must be a function if defined");if(u(this,yt,D),p!==void 0&&typeof p!="function")throw new TypeError("fetchMethod must be a function if specified");if(u(this,Tt,p),u(this,lt,!!p),u(this,x,new Map),u(this,O,new Array(r).fill(void 0)),u(this,g,new Array(r).fill(void 0)),u(this,L,new St(r)),u(this,Y,new St(r)),u(this,F,0),u(this,C,0),u(this,q,he.create(r)),u(this,I,0),u(this,J,0),typeof S=="function"&&u(this,k,S),typeof R=="function"&&u(this,ut,R),typeof d=="function"?(u(this,B,d),u(this,N,[])):(u(this,B,void 0),u(this,N,void 0)),u(this,tt,!!e(this,k)),u(this,bt,!!e(this,ut)),u(this,V,!!e(this,B)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!T,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!xt,this.ignoreFetchAbort=!!_t,this.maxEntrySize!==0){if(e(this,P)!==0&&!at(e(this,P)))throw new TypeError("maxSize must be a positive integer if specified");if(!at(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");c(this,n,ee).call(this);}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!h,this.ttlResolution=at(s)||s===0?s:1,this.ttlAutopurge=!!o,this.ttl=i||0,this.ttl){if(!at(this.ttl))throw new TypeError("ttl must be a positive integer if specified");c(this,n,Wt).call(this);}if(e(this,j)===0&&this.ttl===0&&e(this,P)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!e(this,j)&&!e(this,P)){let Pt="LRU_CACHE_UNBOUNDED";ne(Pt)&&(qt.add(Pt),Qt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Pt,vt));}}get perf(){return e(this,X)}static unsafeExposeInternals(t){return {starts:e(t,Z),ttls:e(t,K),autopurgeTimers:e(t,W),sizes:e(t,Q),keyMap:e(t,x),keyList:e(t,O),valList:e(t,g),next:e(t,L),prev:e(t,Y),get head(){return e(t,F)},get tail(){return e(t,C)},free:e(t,q),isBackgroundFetch:r=>{var i;return c(i=t,n,v).call(i,r)},backgroundFetch:(r,i,s,o)=>{var a;return c(a=t,n,Lt).call(a,r,i,s,o)},moveToTail:r=>{var i;return c(i=t,n,It).call(i,r)},indexes:r=>{var i;return c(i=t,n,ot).call(i,r)},rindexes:r=>{var i;return c(i=t,n,nt).call(i,r)},isStale:r=>{var i;return e(i=t,H).call(i,r)}}}get max(){return e(this,j)}get maxSize(){return e(this,P)}get calculatedSize(){return e(this,J)}get size(){return e(this,I)}get fetchMethod(){return e(this,Tt)}get memoMethod(){return e(this,yt)}get dispose(){return e(this,k)}get onInsert(){return e(this,ut)}get disposeAfter(){return e(this,B)}getRemainingTTL(t){return e(this,x).has(t)?1/0:0}*entries(){for(let t of c(this,n,ot).call(this))e(this,g)[t]!==void 0&&e(this,O)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield [e(this,O)[t],e(this,g)[t]]);}*rentries(){for(let t of c(this,n,nt).call(this))e(this,g)[t]!==void 0&&e(this,O)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield [e(this,O)[t],e(this,g)[t]]);}*keys(){for(let t of c(this,n,ot).call(this)){let r=e(this,O)[t];r!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield r);}}*rkeys(){for(let t of c(this,n,nt).call(this)){let r=e(this,O)[t];r!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield r);}}*values(){for(let t of c(this,n,ot).call(this))e(this,g)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}*rvalues(){for(let t of c(this,n,nt).call(this))e(this,g)[t]!==void 0&&!c(this,n,v).call(this,e(this,g)[t])&&(yield e(this,g)[t]);}[(Jt=Symbol.iterator,Xt=Symbol.toStringTag,Jt)](){return this.entries()}find(t,r={}){for(let i of c(this,n,ot).call(this)){let s=e(this,g)[i],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;if(o!==void 0&&t(o,e(this,O)[i],this))return this.get(e(this,O)[i],r)}}forEach(t,r=this){for(let i of c(this,n,ot).call(this)){let s=e(this,g)[i],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,e(this,O)[i],this);}}rforEach(t,r=this){for(let i of c(this,n,nt).call(this)){let s=e(this,g)[i],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;o!==void 0&&t.call(r,o,e(this,O)[i],this);}}purgeStale(){let t=false;for(let r of c(this,n,nt).call(this,{allowStale:true}))e(this,H).call(this,r)&&(c(this,n,ht).call(this,e(this,O)[r],"expire"),t=true);return t}info(t){let r=e(this,x).get(t);if(r===void 0)return;let i=e(this,g)[r],s=c(this,n,v).call(this,i)?i.__staleWhileFetching:i;if(s===void 0)return;let o={value:s};if(e(this,K)&&e(this,Z)){let a=e(this,K)[r],h=e(this,Z)[r];if(a&&h){let l=a-(e(this,X).now()-h);o.ttl=l,o.start=Date.now();}}return e(this,Q)&&(o.size=e(this,Q)[r]),o}dump(){let t=[];for(let r of c(this,n,ot).call(this,{allowStale:true})){let i=e(this,O)[r],s=e(this,g)[r],o=c(this,n,v).call(this,s)?s.__staleWhileFetching:s;if(o===void 0||i===void 0)continue;let a={value:o};if(e(this,K)&&e(this,Z)){a.ttl=e(this,K)[r];let h=e(this,X).now()-e(this,Z)[r];a.start=Math.floor(Date.now()-h);}e(this,Q)&&(a.size=e(this,Q)[r]),t.unshift([i,a]);}return t}load(t){this.clear();for(let[r,i]of t){if(i.start){let s=Date.now()-i.start;i.start=e(this,X).now()-s;}this.set(r,i.value,i);}}set(t,r,i={}){var y,T,E,b;if(r===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:l}=i,{noUpdateTTL:S=this.noUpdateTTL}=i,R=e(this,Ct).call(this,t,r,i.size||0,h);if(this.maxEntrySize&&R>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=true),c(this,n,ht).call(this,t,"set"),this;let d=e(this,I)===0?void 0:e(this,x).get(t);if(d===void 0)d=e(this,I)===0?e(this,C):e(this,q).length!==0?e(this,q).pop():e(this,I)===e(this,j)?c(this,n,Gt).call(this,false):e(this,I),e(this,O)[d]=t,e(this,g)[d]=r,e(this,x).set(t,d),e(this,L)[e(this,C)]=d,e(this,Y)[d]=e(this,C),u(this,C,d),Mt(this,I)._++,e(this,At).call(this,d,R,l),l&&(l.set="add"),S=false,e(this,bt)&&((y=e(this,ut))==null||y.call(this,r,t,"add"));else {c(this,n,It).call(this,d);let A=e(this,g)[d];if(r!==A){if(e(this,lt)&&c(this,n,v).call(this,A)){A.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=A;p!==void 0&&!a&&(e(this,tt)&&((T=e(this,k))==null||T.call(this,p,t,"set")),e(this,V)&&e(this,N)?.push([p,t,"set"]));}else a||(e(this,tt)&&((E=e(this,k))==null||E.call(this,A,t,"set")),e(this,V)&&e(this,N)?.push([A,t,"set"]));if(e(this,dt).call(this,d),e(this,At).call(this,d,R,l),e(this,g)[d]=r,l){l.set="replace";let p=A&&c(this,n,v).call(this,A)?A.__staleWhileFetching:A;p!==void 0&&(l.oldValue=p);}}else l&&(l.set="update");e(this,bt)&&this.onInsert?.(r,t,r===A?"update":"replace");}if(s!==0&&!e(this,K)&&c(this,n,Wt).call(this),e(this,K)&&(S||e(this,Rt).call(this,d,s,o),l&&e(this,it).call(this,l,d)),!a&&e(this,V)&&e(this,N)){let A=e(this,N),p;for(;p=A?.shift();)(b=e(this,B))==null||b.call(this,...p);}return this}pop(){var t;try{for(;e(this,I);){let r=e(this,g)[e(this,F)];if(c(this,n,Gt).call(this,!0),c(this,n,v).call(this,r)){if(r.__staleWhileFetching)return r.__staleWhileFetching}else if(r!==void 0)return r}}finally{if(e(this,V)&&e(this,N)){let r=e(this,N),i;for(;i=r?.shift();)(t=e(this,B))==null||t.call(this,...i);}}}has(t,r={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=r,o=e(this,x).get(t);if(o!==void 0){let a=e(this,g)[o];if(c(this,n,v).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(e(this,H).call(this,o))s&&(s.has="stale",e(this,it).call(this,s,o));else return i&&e(this,gt).call(this,o),s&&(s.has="hit",e(this,it).call(this,s,o)),true}else s&&(s.has="miss");return false}peek(t,r={}){let{allowStale:i=this.allowStale}=r,s=e(this,x).get(t);if(s===void 0||!i&&e(this,H).call(this,s))return;let o=e(this,g)[s];return c(this,n,v).call(this,o)?o.__staleWhileFetching:o}async fetch(t,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:l=0,sizeCalculation:S=this.sizeCalculation,noUpdateTTL:R=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:T=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:b,forceRefresh:A=false,status:p,signal:D}=r;if(!e(this,lt))return p&&(p.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,status:p});let U={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:h,size:l,sizeCalculation:S,noUpdateTTL:R,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:E,ignoreFetchAbort:T,status:p,signal:D},G=e(this,x).get(t);if(G===void 0){p&&(p.fetch="miss");let w=c(this,n,Lt).call(this,t,G,U,b);return w.__returned=w}else {let w=e(this,g)[G];if(c(this,n,v).call(this,w)){let St=i&&w.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",St&&(p.returnedStale=true)),St?w.__staleWhileFetching:w.__returned=w}let xt=e(this,H).call(this,G);if(!A&&!xt)return p&&(p.fetch="hit"),c(this,n,It).call(this,G),s&&e(this,gt).call(this,G),p&&e(this,it).call(this,p,G),w;let _t=c(this,n,Lt).call(this,t,G,U,b),mt=_t.__staleWhileFetching!==void 0&&i;return p&&(p.fetch=xt?"stale":"refresh",mt&&xt&&(p.returnedStale=true)),mt?_t.__staleWhileFetching:_t.__returned=_t}}async forceFetch(t,r={}){let i=await this.fetch(t,r);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,r={}){let i=e(this,yt);if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:o,...a}=r,h=this.get(t,a);if(!o&&h!==void 0)return h;let l=i(t,h,{options:a,context:s});return this.set(t,l,a),l}get(t,r={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=r,h=e(this,x).get(t);if(h!==void 0){let l=e(this,g)[h],S=c(this,n,v).call(this,l);return a&&e(this,it).call(this,a,h),e(this,H).call(this,h)?(a&&(a.get="stale"),S?(a&&i&&l.__staleWhileFetching!==void 0&&(a.returnedStale=true),i?l.__staleWhileFetching:void 0):(o||c(this,n,ht).call(this,t,"expire"),a&&i&&(a.returnedStale=true),i?l:void 0)):(a&&(a.get="hit"),S?l.__staleWhileFetching:(c(this,n,It).call(this,h),s&&e(this,gt).call(this,h),l))}else a&&(a.get="miss");}delete(t){return c(this,n,ht).call(this,t,"delete")}clear(){return c(this,n,jt).call(this,"delete")}},j=new WeakMap,P=new WeakMap,k=new WeakMap,ut=new WeakMap,B=new WeakMap,Tt=new WeakMap,yt=new WeakMap,X=new WeakMap,I=new WeakMap,J=new WeakMap,x=new WeakMap,O=new WeakMap,g=new WeakMap,L=new WeakMap,Y=new WeakMap,F=new WeakMap,C=new WeakMap,q=new WeakMap,N=new WeakMap,Q=new WeakMap,Z=new WeakMap,K=new WeakMap,W=new WeakMap,tt=new WeakMap,lt=new WeakMap,V=new WeakMap,bt=new WeakMap,n=new WeakSet,Wt=function(){let t=new Dt(e(this,j)),r=new Dt(e(this,j));u(this,K,t),u(this,Z,r);let i=this.ttlAutopurge?new Array(e(this,j)):void 0;u(this,W,i),u(this,Rt,(h,l,S=e(this,X).now())=>{r[h]=l!==0?S:0,t[h]=l,s(h,l);}),u(this,gt,h=>{r[h]=t[h]!==0?e(this,X).now():0,s(h,t[h]);});let s=this.ttlAutopurge?(h,l)=>{if(i?.[h]&&(clearTimeout(i[h]),i[h]=void 0),l&&l!==0&&i){let S=setTimeout(()=>{e(this,H).call(this,h)&&c(this,n,ht).call(this,e(this,O)[h],"expire");},l+1);S.unref&&S.unref(),i[h]=S;}}:()=>{};u(this,it,(h,l)=>{if(t[l]){let S=t[l],R=r[l];if(!S||!R)return;h.ttl=S,h.start=R,h.now=o||a();let d=h.now-R;h.remainingTTL=S-d;}});let o=0,a=()=>{let h=e(this,X).now();if(this.ttlResolution>0){o=h;let l=setTimeout(()=>o=0,this.ttlResolution);l.unref&&l.unref();}return h};this.getRemainingTTL=h=>{let l=e(this,x).get(h);if(l===void 0)return 0;let S=t[l],R=r[l];if(!S||!R)return 1/0;let d=(o||a())-R;return S-d},u(this,H,h=>{let l=r[h],S=t[h];return !!S&&!!l&&(o||a())-l>S});},gt=new WeakMap,it=new WeakMap,Rt=new WeakMap,H=new WeakMap,ee=function(){let t=new Dt(e(this,j));u(this,J,0),u(this,Q,t),u(this,dt,r=>{u(this,J,e(this,J)-t[r]),t[r]=0;}),u(this,Ct,(r,i,s,o)=>{if(c(this,n,v).call(this,i))return 0;if(!at(s))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(s=o(i,r),!at(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s}),u(this,At,(r,i,s)=>{if(t[r]=i,e(this,P)){let o=e(this,P)-t[r];for(;e(this,J)>o;)c(this,n,Gt).call(this,true);}u(this,J,e(this,J)+t[r]),s&&(s.entrySize=i,s.totalCalculatedSize=e(this,J));});},dt=new WeakMap,At=new WeakMap,Ct=new WeakMap,ot=function*({allowStale:t=this.allowStale}={}){if(e(this,I))for(let r=e(this,C);!(!c(this,n,Ht).call(this,r)||((t||!e(this,H).call(this,r))&&(yield r),r===e(this,F)));)r=e(this,Y)[r];},nt=function*({allowStale:t=this.allowStale}={}){if(e(this,I))for(let r=e(this,F);!(!c(this,n,Ht).call(this,r)||((t||!e(this,H).call(this,r))&&(yield r),r===e(this,C)));)r=e(this,L)[r];},Ht=function(t){return t!==void 0&&e(this,x).get(e(this,O)[t])===t},Gt=function(t){var o;let r=e(this,F),i=e(this,O)[r],s=e(this,g)[r];return e(this,lt)&&c(this,n,v).call(this,s)?s.__abortController.abort(new Error("evicted")):(e(this,tt)||e(this,V))&&(e(this,tt)&&((o=e(this,k))==null||o.call(this,s,i,"evict")),e(this,V)&&e(this,N)?.push([s,i,"evict"])),e(this,dt).call(this,r),e(this,W)?.[r]&&(clearTimeout(e(this,W)[r]),e(this,W)[r]=void 0),t&&(e(this,O)[r]=void 0,e(this,g)[r]=void 0,e(this,q).push(r)),e(this,I)===1?(u(this,F,u(this,C,0)),e(this,q).length=0):u(this,F,e(this,L)[r]),e(this,x).delete(i),Mt(this,I)._--,r},Lt=function(t,r,i,s){let o=r===void 0?void 0:e(this,g)[r];if(c(this,n,v).call(this,o))return o;let a=new Vt,{signal:h}=i;h?.addEventListener("abort",()=>a.abort(h.reason),{signal:a.signal});let l={signal:a.signal,options:i,context:s},S=(b,A=false)=>{let{aborted:p}=a.signal,D=i.ignoreFetchAbort&&b!==void 0,U=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&b!==void 0);if(i.status&&(p&&!A?(i.status.fetchAborted=true,i.status.fetchError=a.signal.reason,D&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),p&&!D&&!A)return d(a.signal.reason,U);let G=T,w=e(this,g)[r];return (w===T||D&&A&&w===void 0)&&(b===void 0?G.__staleWhileFetching!==void 0?e(this,g)[r]=G.__staleWhileFetching:c(this,n,ht).call(this,t,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(t,b,l.options))),b},R=b=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=b),d(b,false)),d=(b,A)=>{let{aborted:p}=a.signal,D=p&&i.allowStaleOnFetchAbort,U=D||i.allowStaleOnFetchRejection,G=U||i.noDeleteOnFetchRejection,w=T;if(e(this,g)[r]===T&&(!G||!A&&w.__staleWhileFetching===void 0?c(this,n,ht).call(this,t,"fetch"):D||(e(this,g)[r]=w.__staleWhileFetching)),U)return i.status&&w.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),w.__staleWhileFetching;if(w.__returned===w)throw b},y=(b,A)=>{var D;let p=(D=e(this,Tt))==null?void 0:D.call(this,t,o,l);p&&p instanceof Promise&&p.then(U=>b(U===void 0?void 0:U),A),a.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(b(void 0),i.allowStaleOnFetchAbort&&(b=U=>S(U,true)));});};i.status&&(i.status.fetchDispatched=true);let T=new Promise(y).then(S,R),E=Object.assign(T,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return r===void 0?(this.set(t,E,{...l.options,status:void 0}),r=e(this,x).get(t)):e(this,g)[r]=E,E},v=function(t){if(!e(this,lt))return false;let r=t;return !!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof Vt},$t=function(t,r){e(this,Y)[r]=t,e(this,L)[t]=r;},It=function(t){t!==e(this,C)&&(t===e(this,F)?u(this,F,e(this,L)[t]):c(this,n,$t).call(this,e(this,Y)[t],e(this,L)[t]),c(this,n,$t).call(this,e(this,C),t),u(this,C,t));},ht=function(t,r){var s,o;let i=false;if(e(this,I)!==0){let a=e(this,x).get(t);if(a!==void 0)if(e(this,W)?.[a]&&(clearTimeout(e(this,W)?.[a]),e(this,W)[a]=void 0),i=true,e(this,I)===1)c(this,n,jt).call(this,r);else {e(this,dt).call(this,a);let h=e(this,g)[a];if(c(this,n,v).call(this,h)?h.__abortController.abort(new Error("deleted")):(e(this,tt)||e(this,V))&&(e(this,tt)&&((s=e(this,k))==null||s.call(this,h,t,r)),e(this,V)&&e(this,N)?.push([h,t,r])),e(this,x).delete(t),e(this,O)[a]=void 0,e(this,g)[a]=void 0,a===e(this,C))u(this,C,e(this,Y)[a]);else if(a===e(this,F))u(this,F,e(this,L)[a]);else {let l=e(this,Y)[a];e(this,L)[l]=e(this,L)[a];let S=e(this,L)[a];e(this,Y)[S]=e(this,Y)[a];}Mt(this,I)._--,e(this,q).push(a);}}if(e(this,V)&&e(this,N)?.length){let a=e(this,N),h;for(;h=a?.shift();)(o=e(this,B))==null||o.call(this,...h);}return i},jt=function(t){var r,i;for(let s of c(this,n,nt).call(this,{allowStale:true})){let o=e(this,g)[s];if(c(this,n,v).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=e(this,O)[s];e(this,tt)&&((r=e(this,k))==null||r.call(this,o,a,t)),e(this,V)&&e(this,N)?.push([o,a,t]);}}if(e(this,x).clear(),e(this,g).fill(void 0),e(this,O).fill(void 0),e(this,K)&&e(this,Z)){e(this,K).fill(0),e(this,Z).fill(0);for(let s of e(this,W)??[])s!==void 0&&clearTimeout(s);e(this,W)?.fill(void 0);}if(e(this,Q)&&e(this,Q).fill(0),u(this,F,0),u(this,C,0),e(this,q).length=0,u(this,J,0),u(this,I,0),e(this,V)&&e(this,N)){let s=e(this,N),o;for(;o=s?.shift();)(i=e(this,B))==null||i.call(this,...o);}},vt);var ct=class{cache;map=new Map;constructor(t){this.cache=new te({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(t){let r=this.map.delete(t);return r&&this.cache.delete(t),r}get forEach(){return this.map.forEach}get(t){let r=this.cache.get(t);return r||this.map.get(t)}has(t){return this.map.has(t)}set(t,r){return this.map.set(t,r),this.cache.set(t,r),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var rt;(s=>(s.log=(o,...a)=>console.log(`[Pixi\u2019VN] ${o}`,...a),s.warn=(o,...a)=>console.warn(`[Pixi\u2019VN] ${o}`,...a),s.error=(o,...a)=>console.error(`[Pixi\u2019VN] ${o}`,...a),s.info=(o,...a)=>console.info(`[Pixi\u2019VN] ${o}`,...a)))(rt||={});function Ut(f){try{if(typeof f>"u")return f;let t=JSON.stringify(f);return JSON.parse(t)}catch(t){throw rt.error("Error creating exportable element",f,t),new core.PixiError("not_json_serializable","Error creating exportable element")}}var re;(d=>{d.storage=new ct({cacheSize:50}),d.defaultStorage=new ct({cacheSize:10}),d.tempStorageDeadlines=new Map;let i;function s(y){d.tempStorageDeadlines.forEach((T,E)=>{T>y&&(d.storage.delete(`${ft}:${E}`),i?.onClearOldTempVariable?.(E),d.tempStorageDeadlines.delete(E));});}d.clearOldTempVariables=s;function o(y){i=y;}d.setExternalStoreHandler=o;function a(y,T,E){E==null?d.storage.delete(`${y}:${T}`):d.storage.set(`${y}:${T}`,E),i?.onSetVariable?.(T,E);}d.setVariable=a;function h(y,T){let E=d.storage.get(`${y}:${T}`);return Ut(E)}d.getVariable=h;function l(y,T){d.storage.delete(`${y}:${T}`),i?.onRemoveVariable?.(T);}d.removeVariable=l;function S(y,T){let E=d.storage.get(Ft)||[];if(T)E.includes(y)||E.push(y);else {let b=E.indexOf(y);b>-1&&E.splice(b,1);}d.storage.set(Ft,E);}d.setFlag=S;function R(y){return (d.storage.get(Ft)||[]).includes(y)}d.getFlag=R;})(re||={});var m=re;var Ot=class{constructor(t,r){this.categoryId=t,this.id=r,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let r=m.getVariable(st,t);r&&(Object.entries(r).forEach(([i,s])=>{typeof s=="object"&&s!==null&&Object.entries(s).forEach(([o,a])=>{m.setVariable(this.categoryId,`${i}:${o}`,a);});}),m.removeVariable(st,t));}id;categoryId;setStorageProperty(t,r){m.setVariable(this.categoryId,`${this.id}:${t}`,r);}getStorageProperty(t,r=this.id){return m.getVariable(this.categoryId,`${r}:${t}`)}};var ue="@",wt=class extends Ot{sourceId;constructor(t,r=""){super(z.CHARACTER_CATEGORY_KEY,t+(r?ue+r:"")),this.sourceId=t,this.migrateOldStorage("___character___");}getStorageProperty(t){let r=super.getStorageProperty(t);return r===void 0&&(r=super.getStorageProperty(t,this.sourceId)),r}};var zt=class extends wt{constructor(t,r){super(typeof t=="string"?t:t.id,typeof t=="string"?"":t.emotion),this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this.icon=r.icon,this.color=r.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(t){this.setStorageProperty("name",t);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(t){this.setStorageProperty("surname",t);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(t){this.setStorageProperty("age",t);}icon;color};var pt=new ct({cacheSize:10}),ie;(a=>{function f(h){try{let l=pt.get(h);if(!l){rt.warn(`Character "${h}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return l}catch(l){rt.error(`Error while getting Character "${h}"`,l);return}}a.get=f;function t(...h){for(let l of h){if(Array.isArray(l)){t(...l);continue}pt.get(l.id)&&rt.info(`Character id "${l.id}" already exists, it will be overwritten`),pt.set(l.id,l);}}a.add=t;function r(){return Array.from(pt.values())}a.values=r;function i(h){return pt.has(h)}a.has=i;function s(){return Array.from(pt.keys())}a.keys=s;function o(){pt.clear();}a.clear=o;})(ie||={});var ge=ie;exports.CharacterBaseModel=zt;exports.CharacterStoredClass=wt;exports.RegisteredCharacters=ge;
@@ -1 +1 @@
1
- import {b}from'./chunk-I7DOUH5V.mjs';import {m}from'./chunk-HD353M4B.mjs';import {d,e}from'./chunk-HQQ5WH6C.mjs';var g="@",n=class extends b{sourceId;constructor(e,r=""){super(m.CHARACTER_CATEGORY_KEY,e+(r?g+r:"")),this.sourceId=e,this.migrateOldStorage("___character___");}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var i=class extends n{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion),this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this.icon=r.icon,this.color=r.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}icon;color};var o=new d({cacheSize:10}),h;(C=>{function c(a){try{let t=o.get(a);if(!t){e.warn(`Character "${a}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return t}catch(t){e.error(`Error while getting Character "${a}"`,t);return}}C.get=c;function e$1(...a){for(let t of a){if(Array.isArray(t)){e$1(...t);continue}o.get(t.id)&&e.info(`Character id "${t.id}" already exists, it will be overwritten`),o.set(t.id,t);}}C.add=e$1;function r(){return Array.from(o.values())}C.values=r;function m(a){return o.has(a)}C.has=m;function l(){return Array.from(o.keys())}C.keys=l;function y(){o.clear();}C.clear=y;})(h||={});var p=h;export{i as CharacterBaseModel,n as CharacterStoredClass,p as RegisteredCharacters};
1
+ import {b}from'./chunk-QOBPVPCY.mjs';import'./chunk-YBA63R27.mjs';import {q,r,p as p$1}from'./chunk-U5BSF6X3.mjs';var g="@",n=class extends b{sourceId;constructor(e,r=""){super(p$1.CHARACTER_CATEGORY_KEY,e+(r?g+r:"")),this.sourceId=e,this.migrateOldStorage("___character___");}getStorageProperty(e){let r=super.getStorageProperty(e);return r===void 0&&(r=super.getStorageProperty(e,this.sourceId)),r}};var i=class extends n{constructor(e,r){super(typeof e=="string"?e:e.id,typeof e=="string"?"":e.emotion),this.defaultName=r.name,this.defaultSurname=r.surname,this.defaultAge=r.age,this.icon=r.icon,this.color=r.color;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName||this.id}set name(e){this.setStorageProperty("name",e);}defaultSurname;get surname(){return this.getStorageProperty("surname")||this.defaultSurname}set surname(e){this.setStorageProperty("surname",e);}defaultAge;get age(){return this.getStorageProperty("age")||this.defaultAge}set age(e){this.setStorageProperty("age",e);}icon;color};var o=new q({cacheSize:10}),h;(C=>{function c(a){try{let t=o.get(a);if(!t){r.warn(`Character "${a}" not found, did you forget to register it with the RegisteredCharacters.add?`);return}return t}catch(t){r.error(`Error while getting Character "${a}"`,t);return}}C.get=c;function e(...a){for(let t of a){if(Array.isArray(t)){e(...t);continue}o.get(t.id)&&r.info(`Character id "${t.id}" already exists, it will be overwritten`),o.set(t.id,t);}}C.add=e;function r$1(){return Array.from(o.values())}C.values=r$1;function m(a){return o.has(a)}C.has=m;function l(){return Array.from(o.keys())}C.keys=l;function y(){o.clear();}C.clear=y;})(h||={});var p=h;export{i as CharacterBaseModel,n as CharacterStoredClass,p as RegisteredCharacters};
@@ -1 +1 @@
1
- import {b,a}from'./chunk-HQQ5WH6C.mjs';var L=b((S,I)=>{(function(w,o){typeof S=="object"?I.exports=S=o():typeof define=="function"&&define.amd?define([],o):w.CryptoJS=o();})(S,function(){var w=w||(function(o,x){var a$1;if(typeof window<"u"&&window.crypto&&(a$1=window.crypto),typeof self<"u"&&self.crypto&&(a$1=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a$1=globalThis.crypto),!a$1&&typeof window<"u"&&window.msCrypto&&(a$1=window.msCrypto),!a$1&&typeof global<"u"&&global.crypto&&(a$1=global.crypto),!a$1&&typeof a=="function")try{a$1=a("crypto");}catch{}var _=function(){if(a$1){if(typeof a$1.getRandomValues=="function")try{return a$1.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a$1.randomBytes=="function")try{return a$1.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},C=Object.create||(function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}})(),d={},B=d.lib={},u=B.Base=(function(){return {extend:function(t){var e=C(this);return t&&e.mixIn(t),(!e.hasOwnProperty("init")||this.init===e.init)&&(e.init=function(){e.$super.init.apply(this,arguments);}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),l=B.WordArray=u.extend({init:function(t,e){t=this.words=t||[],e!=x?this.sigBytes=e:this.sigBytes=t.length*4;},toString:function(t){return (t||v).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,f=t.sigBytes;if(this.clamp(),r%4)for(var c=0;c<f;c++){var z=n[c>>>2]>>>24-c%4*8&255;e[r+c>>>2]|=z<<24-(r+c)%4*8;}else for(var g=0;g<f;g+=4)e[r+g>>>2]=n[g>>>2];return this.sigBytes+=f,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=o.ceil(e/4);},clone:function(){var t=u.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(_());return new l.init(e,t)}}),i=d.enc={},v=i.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],f=0;f<n;f++){var c=e[f>>>2]>>>24-f%4*8&255;r.push((c>>>4).toString(16)),r.push((c&15).toString(16));}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new l.init(n,e/2)}},h=i.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],f=0;f<n;f++){var c=e[f>>>2]>>>24-f%4*8&255;r.push(String.fromCharCode(c));}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(t.charCodeAt(r)&255)<<24-r%4*8;return new l.init(n,e)}},p=i.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},y=B.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.init,this._nDataBytes=0;},_append:function(t){typeof t=="string"&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes;},_process:function(t){var e,n=this._data,r=n.words,f=n.sigBytes,c=this.blockSize,z=c*4,g=f/z;t?g=o.ceil(g):g=o.max((g|0)-this._minBufferSize,0);var b=g*c,R=o.min(b*4,f);if(b){for(var A=0;A<b;A+=c)this._doProcessBlock(r,A);e=r.splice(0,b),n.sigBytes-=R;}return new l.init(e,R)},clone:function(){var t=u.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});B.Hasher=y.extend({cfg:u.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset();},reset:function(){y.reset.call(this),this._doReset();},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:512/32,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new s.HMAC.init(t,n).finalize(e)}}});var s=d.algo={};return d})(Math);return w});});var T=b((H,P)=>{(function(w,o){typeof H=="object"?P.exports=H=o(L()):typeof define=="function"&&define.amd?define(["./core"],o):o(w.CryptoJS);})(H,function(w){return (function(){var o=w,x=o.lib,a=x.WordArray,_=x.Hasher,C=o.algo,d=[],B=C.SHA1=_.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(u,l){for(var i=this._hash.words,v=i[0],h=i[1],p=i[2],y=i[3],m=i[4],s=0;s<80;s++){if(s<16)d[s]=u[l+s]|0;else {var t=d[s-3]^d[s-8]^d[s-14]^d[s-16];d[s]=t<<1|t>>>31;}var e=(v<<5|v>>>27)+m+d[s];s<20?e+=(h&p|~h&y)+1518500249:s<40?e+=(h^p^y)+1859775393:s<60?e+=(h&p|h&y|p&y)-1894007588:e+=(h^p^y)-899497514,m=y,y=p,p=h<<30|h>>>2,h=v,v=e;}i[0]=i[0]+v|0,i[1]=i[1]+h|0,i[2]=i[2]+p|0,i[3]=i[3]+y|0,i[4]=i[4]+m|0;},_doFinalize:function(){var u=this._data,l=u.words,i=this._nDataBytes*8,v=u.sigBytes*8;return l[v>>>5]|=128<<24-v%32,l[(v+64>>>9<<4)+14]=Math.floor(i/4294967296),l[(v+64>>>9<<4)+15]=i,u.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var u=_.clone.call(this);return u._hash=this._hash.clone(),u}});o.SHA1=_._createHelper(B),o.HmacSHA1=_._createHmacHelper(B);})(),w.SHA1});});export{T as a};
1
+ import {b,a}from'./chunk-U5BSF6X3.mjs';var L=b((S,I)=>{(function(w,o){typeof S=="object"?I.exports=S=o():typeof define=="function"&&define.amd?define([],o):w.CryptoJS=o();})(S,function(){var w=w||(function(o,x){var a$1;if(typeof window<"u"&&window.crypto&&(a$1=window.crypto),typeof self<"u"&&self.crypto&&(a$1=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a$1=globalThis.crypto),!a$1&&typeof window<"u"&&window.msCrypto&&(a$1=window.msCrypto),!a$1&&typeof global<"u"&&global.crypto&&(a$1=global.crypto),!a$1&&typeof a=="function")try{a$1=a("crypto");}catch{}var _=function(){if(a$1){if(typeof a$1.getRandomValues=="function")try{return a$1.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a$1.randomBytes=="function")try{return a$1.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},C=Object.create||(function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}})(),d={},B=d.lib={},u=B.Base=(function(){return {extend:function(t){var e=C(this);return t&&e.mixIn(t),(!e.hasOwnProperty("init")||this.init===e.init)&&(e.init=function(){e.$super.init.apply(this,arguments);}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),l=B.WordArray=u.extend({init:function(t,e){t=this.words=t||[],e!=x?this.sigBytes=e:this.sigBytes=t.length*4;},toString:function(t){return (t||v).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,f=t.sigBytes;if(this.clamp(),r%4)for(var c=0;c<f;c++){var z=n[c>>>2]>>>24-c%4*8&255;e[r+c>>>2]|=z<<24-(r+c)%4*8;}else for(var g=0;g<f;g+=4)e[r+g>>>2]=n[g>>>2];return this.sigBytes+=f,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=o.ceil(e/4);},clone:function(){var t=u.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(_());return new l.init(e,t)}}),i=d.enc={},v=i.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],f=0;f<n;f++){var c=e[f>>>2]>>>24-f%4*8&255;r.push((c>>>4).toString(16)),r.push((c&15).toString(16));}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new l.init(n,e/2)}},h=i.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],f=0;f<n;f++){var c=e[f>>>2]>>>24-f%4*8&255;r.push(String.fromCharCode(c));}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(t.charCodeAt(r)&255)<<24-r%4*8;return new l.init(n,e)}},p=i.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},y=B.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.init,this._nDataBytes=0;},_append:function(t){typeof t=="string"&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes;},_process:function(t){var e,n=this._data,r=n.words,f=n.sigBytes,c=this.blockSize,z=c*4,g=f/z;t?g=o.ceil(g):g=o.max((g|0)-this._minBufferSize,0);var b=g*c,R=o.min(b*4,f);if(b){for(var A=0;A<b;A+=c)this._doProcessBlock(r,A);e=r.splice(0,b),n.sigBytes-=R;}return new l.init(e,R)},clone:function(){var t=u.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});B.Hasher=y.extend({cfg:u.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset();},reset:function(){y.reset.call(this),this._doReset();},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:512/32,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new s.HMAC.init(t,n).finalize(e)}}});var s=d.algo={};return d})(Math);return w});});var T=b((H,P)=>{(function(w,o){typeof H=="object"?P.exports=H=o(L()):typeof define=="function"&&define.amd?define(["./core"],o):o(w.CryptoJS);})(H,function(w){return (function(){var o=w,x=o.lib,a=x.WordArray,_=x.Hasher,C=o.algo,d=[],B=C.SHA1=_.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(u,l){for(var i=this._hash.words,v=i[0],h=i[1],p=i[2],y=i[3],m=i[4],s=0;s<80;s++){if(s<16)d[s]=u[l+s]|0;else {var t=d[s-3]^d[s-8]^d[s-14]^d[s-16];d[s]=t<<1|t>>>31;}var e=(v<<5|v>>>27)+m+d[s];s<20?e+=(h&p|~h&y)+1518500249:s<40?e+=(h^p^y)+1859775393:s<60?e+=(h&p|h&y|p&y)-1894007588:e+=(h^p^y)-899497514,m=y,y=p,p=h<<30|h>>>2,h=v,v=e;}i[0]=i[0]+v|0,i[1]=i[1]+h|0,i[2]=i[2]+p|0,i[3]=i[3]+y|0,i[4]=i[4]+m|0;},_doFinalize:function(){var u=this._data,l=u.words,i=this._nDataBytes*8,v=u.sigBytes*8;return l[v>>>5]|=128<<24-v%32,l[(v+64>>>9<<4)+14]=Math.floor(i/4294967296),l[(v+64>>>9<<4)+15]=i,u.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var u=_.clone.call(this);return u._hash=this._hash.clone(),u}});o.SHA1=_._createHelper(B),o.HmacSHA1=_._createHmacHelper(B);})(),w.SHA1});});export{T as a};
@@ -0,0 +1 @@
1
+ var a=class extends Error{code;constructor(t,n,m,o,r){super(`[Pixi\u2019VN] ${n}`),this.code=t,m==="canvas"&&(this.canvasElementInfo=o,this.parent=r);}canvasElementInfo;parent};var i;(o=>(o.log=(r,...s)=>console.log(`[Pixi\u2019VN] ${r}`,...s),o.warn=(r,...s)=>console.warn(`[Pixi\u2019VN] ${r}`,...s),o.error=(r,...s)=>console.error(`[Pixi\u2019VN] ${r}`,...s),o.info=(r,...s)=>console.info(`[Pixi\u2019VN] ${r}`,...s)))(i||={});var l=class e{static init(t){t.navigate&&(e._navigate=t.navigate),e._getStepCounter=t.getStepCounter,e._setStepCounter=t.setStepCounter,e._getCurrentGameStepState=t.getCurrentGameStepState,e._restoreGameStepState=t.restoreGameStepState,e._getOpenedLabels=t.getOpenedLabels,e._processNavigationRequests=t.processNavigationRequests,e._getVariable=t.getVariable,e._setVariable=t.setVariable,e._removeVariable=t.removeVariable,e._getFlag=t.getFlag,e._setFlag=t.setFlag,t.onLabelClosing&&(e._onLabelClosing=t.onLabelClosing),e._addHistoryItem=t.addHistoryItem,e._getCharacter=t.getCharacter,e._animate=t.animate;}static _navigate=()=>{i.warn("Navigate function not initialized. You should add the navigate function in the Game.init() method.");};static get navigate(){return e._navigate}static set navigate(t){e._navigate=t;}static _getStepCounter=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static _setStepCounter=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get stepCounter(){return e._getStepCounter()}static set stepCounter(t){e._setStepCounter(t);}static _getCurrentGameStepState=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get currentGameStepState(){return e._getCurrentGameStepState()}static _restoreGameStepState=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get restoreGameStepState(){return e._restoreGameStepState}static _getOpenedLabels=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get openedLabels(){return e._getOpenedLabels()}static _onPreContinueHandlers=[];static addOnPreContinue(t){e._onPreContinueHandlers.push(t);}static removeOnPreContinue(t){e._onPreContinueHandlers=e._onPreContinueHandlers.filter(n=>n!==t);}static clearOnPreContinueHandlers(){e._onPreContinueHandlers=[];}static async runOnPreContinue(){let t=e._onPreContinueHandlers.slice();await Promise.all(t.map(n=>n()));}static get onPreContinue(){return e.runOnPreContinue}static navigationRequestsCount=0;static processNavigationLock=Promise.resolve();static get continueRequestsCount(){return e.navigationRequestsCount}static increaseContinueRequest(t=1){e.navigationRequestsCount+=t;}static get backRequestsCount(){return -1*e.navigationRequestsCount}static increaseBackRequest(t=1){e.navigationRequestsCount-=t;}static _processNavigationRequests=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static async processNavigationRequests(t){let n=e._processNavigationRequests(e.navigationRequestsCount,t);return e.navigationRequestsCount=n.newValue,await n.result}static _getVariable=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getVariable(){return e._getVariable}static _setVariable=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setVariable(){return e._setVariable}static _removeVariable=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get removeVariable(){return e._removeVariable}static _getFlag=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get getFlag(){return e._getFlag}static _setFlag=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get setFlag(){return e._setFlag}static _onLabelClosing=()=>{};static get onLabelClosing(){return e._onLabelClosing}static _addHistoryItem=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get addHistoryItem(){return e._addHistoryItem}static runningStepsCount=0;static _getCharacter=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented.")};static get getCharacter(){return e._getCharacter}static onEnd;static _onErrorHandlers=[];static addOnError(t){return e._onErrorHandlers.push(t),()=>e.removeOnError(t)}static removeOnError(t){e._onErrorHandlers=e._onErrorHandlers.filter(n=>n!==t);}static clearOnErrorHandlers(){e._onErrorHandlers.length=0;}static async runOnError(t,n){for(let m of e._onErrorHandlers.slice())try{await m(t,n);}catch(o){i.error("Error in onError handler",o);}}static _animate=()=>{throw i.error("Method not implemented, you should initialize the Game: Game.init()"),new a("not_implemented","Method not implemented, you should initialize the Game: Game.init()")};static get animate(){return e._animate}};export{a,i as b,l as c};
@@ -0,0 +1 @@
1
+ import {a as a$1}from'./chunk-YBA63R27.mjs';import {q,m,o,l,n,p,r}from'./chunk-U5BSF6X3.mjs';import {GameUnifier}from'@drincs/pixi-vn/core';import {cloneMaybeOffloaded}from'@drincs/pixi-vn/worker';var I;(n=>{n.storage=new q({cacheSize:50}),n.defaultStorage=new q({cacheSize:10}),n.tempStorageDeadlines=new Map;let s;function c(r){n.tempStorageDeadlines.forEach((i,o)=>{i>r&&(n.storage.delete(`${m}:${o}`),s?.onClearOldTempVariable?.(o),n.tempStorageDeadlines.delete(o));});}n.clearOldTempVariables=c;function T(r){s=r;}n.setExternalStoreHandler=T;function y(r,i,o){o==null?n.storage.delete(`${r}:${i}`):n.storage.set(`${r}:${i}`,o),s?.onSetVariable?.(i,o);}n.setVariable=y;function V(r,i){let o=n.storage.get(`${r}:${i}`);return a$1(o)}n.getVariable=V;function M(r,i){n.storage.delete(`${r}:${i}`),s?.onRemoveVariable?.(i);}n.removeVariable=M;function R(r,i){let o$1=n.storage.get(o)||[];if(i)o$1.includes(r)||o$1.push(r);else {let h=o$1.indexOf(r);h>-1&&o$1.splice(h,1);}n.storage.set(o,o$1);}n.setFlag=R;function v(r){return (n.storage.get(o)||[]).includes(r)}n.getFlag=v;})(I||={});var a=I;var _=class{get base(){return a.storage.map}get cache(){return a.storage.cache}get tempStorageDeadlines(){return a.tempStorageDeadlines}set default(t){Object.entries(t).forEach(([e,s])=>{a.defaultStorage.map.set(e,s);});}temp={set:(t,e)=>this.setTemp(t,e),remove:t=>this.removeTemp(t),get deadlines(){return a.tempStorageDeadlines}};flags={set:(t,e)=>a.setFlag(t,e),get:t=>a.getFlag(t)};set(t,e){return a.setVariable(l,t,e)}get(t){let e=a.getVariable(m,t);return e===void 0&&(e=a.getVariable(l,t)),e===void 0&&(e=a$1(a.defaultStorage.get(t))),e}remove(t){return this.temp.remove(t),a.removeVariable(l,t)}setTemp(t,e){if(e==null){this.temp.remove(t);return}else a.setVariable(m,t,e),this.temp.deadlines.has(t)||this.temp.deadlines.set(t,GameUnifier.openedLabels);}removeTemp(t){a.removeVariable(m,t),this.temp.deadlines.has(t)&&this.temp.deadlines.delete(t);}setTempVariable(t,e){this.temp.set(t,e);}removeTempVariable(t){this.temp.remove(t);}setFlag(t,e){this.flags.set(t,e);}getFlag(t){return this.flags.get(t)}setStorageHandler(t){a.setExternalStoreHandler(t);}clear(){this.base.clear(),this.cache.clear(),this.temp.deadlines.clear();}async export(){let t=[];[...this.base.keys()].forEach(s=>{t.push({key:s,value:this.base.get(s)});});let e=[];return [...this.temp.deadlines.keys()].forEach(s=>{e.push({key:s,value:this.temp.deadlines.get(s)});}),cloneMaybeOffloaded({main:t,tempDeadlines:e})}restore(t){this.clear();try{t?(t.base?.forEach(e=>{switch(e.key){case "___current_dialogue_memory___":a.setVariable(n,p.CURRENT_DIALOGUE_MEMORY_KEY,e.value);break;case "___last_dialogue_added_in_step_memory___":a.setVariable(n,p.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "___current_menu_options_memory___":a.setVariable(n,p.CURRENT_MENU_OPTIONS_MEMORY_KEY,e.value);break;case "___last_menu_options_added_in_step_memory___":a.setVariable(n,p.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "_input_value_":a.setVariable(n,p.CURRENT_INPUT_VALUE_MEMORY_KEY,e.value);break;case "___last_input_added_in_step_memory___":a.setVariable(n,p.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,e.value);break;case "___current_input_info_memory___":a.setVariable(n,p.CURRENT_INPUT_INFO_MEMORY_KEY,e.value);break;case "___opened_labels_counter___":a.setVariable(n,p.OPENED_LABELS_COUNTER_KEY,e.value);break;case "___all_choices_made___":a.setVariable(n,p.ALL_CHOICES_MADE_KEY,e.value);break;case "___current_step_times_counter___":a.setVariable(n,p.CURRENT_STEP_TIMES_COUNTER_KEY,e.value);break;case "___last_step_glued___":a.setVariable(n,p.LAST_STEP_GLUED,e.value);break;default:a.setVariable(l,e.key,e.value);}}),t.temp?.forEach(e=>{a.setVariable(m,e.key,e.value);}),t.flags?.forEach(e=>{a.setFlag(e,!0);}),t.main?.forEach(e=>{this.base.set(e.key,e.value);}),t.tempDeadlines?.forEach(e=>{this.temp.deadlines.set(e.key,e.value);})):r.warn("No storage data found");}catch(e){r.error("Error importing data",e);}}};var d=class{constructor(t,e){this.categoryId=t,this.id=e,this.migrateOldStorage();}migrateOldStorage(t=this.categoryId){let e=a.getVariable(l,t);e&&(Object.entries(e).forEach(([s,c])=>{typeof c=="object"&&c!==null&&Object.entries(c).forEach(([T,y])=>{a.setVariable(this.categoryId,`${s}:${T}`,y);});}),a.removeVariable(l,t));}id;categoryId;setStorageProperty(t,e){a.setVariable(this.categoryId,`${this.id}:${t}`,e);}getStorageProperty(t,e=this.id){return a.getVariable(this.categoryId,`${e}:${t}`)}};var k=new _;export{a,d as b,k as c};