@drincs/pixi-vn 1.8.1 → 1.8.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.
Files changed (39) hide show
  1. package/README.md +14 -58
  2. package/dist/{HistoryChoiceMenuOption-BP9Tsbyd.d.ts → HistoryChoiceMenuOption-CS41KG13.d.ts} +2 -2
  3. package/dist/{HistoryChoiceMenuOption-DSSNUXEq.d.cts → HistoryChoiceMenuOption-DdwePsOm.d.cts} +2 -2
  4. package/dist/{StorageElementType-DkJ394kq.d.cts → StorageElementType-C7ETezlL.d.cts} +1 -1
  5. package/dist/{StorageElementType-DkJ394kq.d.ts → StorageElementType-C7ETezlL.d.ts} +1 -1
  6. package/dist/{StoredClassModel-a4pvgJXD.d.ts → StoredClassModel-C9mQxPg-.d.cts} +9 -6
  7. package/dist/{StoredClassModel-LtyakzOw.d.cts → StoredClassModel-upXPNQTp.d.ts} +9 -6
  8. package/dist/canvas.cjs +1 -1
  9. package/dist/canvas.mjs +1 -1
  10. package/dist/characters.cjs +1 -1
  11. package/dist/characters.d.cts +55 -51
  12. package/dist/characters.d.ts +55 -51
  13. package/dist/characters.mjs +1 -1
  14. package/dist/chunk-K7JIC2F2.mjs +1 -0
  15. package/dist/{chunk-36I5IN5S.mjs → chunk-V34PMA2H.mjs} +1 -1
  16. package/dist/history.d.cts +2 -2
  17. package/dist/history.d.ts +2 -2
  18. package/dist/index.cjs +2 -2
  19. package/dist/index.d.cts +21 -6
  20. package/dist/index.d.ts +21 -6
  21. package/dist/index.mjs +2 -2
  22. package/dist/narration.cjs +2 -2
  23. package/dist/narration.d.cts +41 -10
  24. package/dist/narration.d.ts +41 -10
  25. package/dist/narration.mjs +2 -2
  26. package/dist/storage.cjs +1 -1
  27. package/dist/storage.d.cts +3 -3
  28. package/dist/storage.d.ts +3 -3
  29. package/dist/storage.mjs +1 -1
  30. package/dist/vite-listener.cjs +1 -1
  31. package/dist/vite-listener.d.cts +13 -4
  32. package/dist/vite-listener.d.ts +13 -4
  33. package/dist/vite-listener.mjs +1 -1
  34. package/dist/vite.cjs +1 -1
  35. package/dist/vite.d.cts +66 -36
  36. package/dist/vite.d.ts +66 -36
  37. package/dist/vite.mjs +1 -1
  38. package/package.json +15 -7
  39. package/dist/chunk-TTRUPDAB.mjs +0 -1
package/dist/storage.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var core=require('@drincs/pixi-vn/core');var te=Object.defineProperty;var jt=u=>{throw TypeError(u)};var ee=(u,e,i)=>e in u?te(u,e,{enumerable:true,configurable:true,writable:true,value:i}):u[e]=i;var E=(u,e,i)=>ee(u,typeof e!="symbol"?e+"":e,i),Ut=(u,e,i)=>e.has(u)||jt("Cannot "+i);var t=(u,e,i)=>(Ut(u,e,"read from private field"),i?i.call(u):e.get(u)),d=(u,e,i)=>e.has(u)?jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(u):e.set(u,i),f=(u,e,i,s)=>(Ut(u,e,"write to private field"),e.set(u,i),i),l=(u,e,i)=>(Ut(u,e,"access private method"),i);var It=(u,e,i,s)=>({set _(r){f(u,e,r);},get _(){return t(u,e,s)}});var st="storage",ht="temp",H="narration",Nt="flags",j={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var ie=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Xt=new Set,zt=typeof process=="object"&&process?process:{},Jt=(u,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(u,e,i,s):console.error(`[${i}] ${e}: ${u}`);},Gt=globalThis.AbortController,$t=globalThis.AbortSignal;if(typeof Gt>"u"){$t=class{constructor(){E(this,"onabort");E(this,"_onabort",[]);E(this,"reason");E(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Gt=class{constructor(){E(this,"signal",new $t);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let u=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{u&&(u=false,Jt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var se=u=>!Xt.has(u);var rt=u=>u&&u===Math.floor(u)&&u>0&&isFinite(u),qt=u=>rt(u)?u<=Math.pow(2,8)?Uint8Array:u<=Math.pow(2,16)?Uint16Array:u<=Math.pow(2,32)?Uint32Array:u<=Number.MAX_SAFE_INTEGER?Ft:null:null,Ft=class extends Array{constructor(u){super(u),this.fill(0);}},et,St,re=(et=class{constructor(e,i){E(this,"heap");E(this,"length");if(!t(et,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=qt(e);if(!i)return [];f(et,St,true);let s=new et(e,i);return f(et,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,d(et,St,false),et),kt,Bt,$,z,k,ct,B,mt,Et,X,D,J,R,w,p,V,Y,C,N,q,F,Q,Z,P,K,tt,lt,L,Tt,n,Yt,ut,it,wt,W,Zt,ft,bt,xt,ot,at,Pt,Ct,Mt,O,Kt,Ot,nt,Wt,yt,Qt=(yt=class{constructor(e){d(this,n);d(this,$);d(this,z);d(this,k);d(this,ct);d(this,B);d(this,mt);d(this,Et);d(this,X);E(this,"ttl");E(this,"ttlResolution");E(this,"ttlAutopurge");E(this,"updateAgeOnGet");E(this,"updateAgeOnHas");E(this,"allowStale");E(this,"noDisposeOnSet");E(this,"noUpdateTTL");E(this,"maxEntrySize");E(this,"sizeCalculation");E(this,"noDeleteOnFetchRejection");E(this,"noDeleteOnStaleGet");E(this,"allowStaleOnFetchAbort");E(this,"allowStaleOnFetchRejection");E(this,"ignoreFetchAbort");d(this,D);d(this,J);d(this,R);d(this,w);d(this,p);d(this,V);d(this,Y);d(this,C);d(this,N);d(this,q);d(this,F);d(this,Q);d(this,Z);d(this,P);d(this,K);d(this,tt);d(this,lt);d(this,L);d(this,Tt);d(this,ut,()=>{});d(this,it,()=>{});d(this,wt,()=>{});d(this,W,()=>false);d(this,ft,e=>{});d(this,bt,(e,i,s)=>{});d(this,xt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,kt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:a,updateAgeOnGet:o,updateAgeOnHas:h,allowStale:c,dispose:m,onInsert:I,disposeAfter:g,noDisposeOnSet:y,noUpdateTTL:b,maxSize:T=0,maxEntrySize:A=0,sizeCalculation:v,fetchMethod:_,memoMethod:M,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:vt,ignoreFetchAbort:gt,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,_t??ie),i!==0&&!rt(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?qt(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(f(this,$,i),f(this,z,T),this.maxEntrySize=A||t(this,z),this.sizeCalculation=v,this.sizeCalculation){if(!t(this,z)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(M!==void 0&&typeof M!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Et,M),_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,mt,_),f(this,lt,!!_),f(this,R,new Map),f(this,w,new Array(i).fill(void 0)),f(this,p,new Array(i).fill(void 0)),f(this,V,new dt(i)),f(this,Y,new dt(i)),f(this,C,0),f(this,N,0),f(this,q,re.create(i)),f(this,D,0),f(this,J,0),typeof m=="function"&&f(this,k,m),typeof I=="function"&&f(this,ct,I),typeof g=="function"?(f(this,B,g),f(this,F,[])):(f(this,B,void 0),f(this,F,void 0)),f(this,tt,!!t(this,k)),f(this,Tt,!!t(this,ct)),f(this,L,!!t(this,B)),this.noDisposeOnSet=!!y,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!vt,this.ignoreFetchAbort=!!gt,this.maxEntrySize!==0){if(t(this,z)!==0&&!rt(t(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!rt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");l(this,n,Zt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!h,this.ttlResolution=rt(r)||r===0?r:1,this.ttlAutopurge=!!a,this.ttl=s||0,this.ttl){if(!rt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");l(this,n,Yt).call(this);}if(t(this,$)===0&&this.ttl===0&&t(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,$)&&!t(this,z)){let Lt="LRU_CACHE_UNBOUNDED";se(Lt)&&(Xt.add(Lt),Jt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Lt,yt));}}get perf(){return t(this,X)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,P),autopurgeTimers:t(e,K),sizes:t(e,Q),keyMap:t(e,R),keyList:t(e,w),valList:t(e,p),next:t(e,V),prev:t(e,Y),get head(){return t(e,C)},get tail(){return t(e,N)},free:t(e,q),isBackgroundFetch:i=>{var s;return l(s=e,n,O).call(s,i)},backgroundFetch:(i,s,r,a)=>{var o;return l(o=e,n,Mt).call(o,i,s,r,a)},moveToTail:i=>{var s;return l(s=e,n,Ot).call(s,i)},indexes:i=>{var s;return l(s=e,n,ot).call(s,i)},rindexes:i=>{var s;return l(s=e,n,at).call(s,i)},isStale:i=>{var s;return t(s=e,W).call(s,i)}}}get max(){return t(this,$)}get maxSize(){return t(this,z)}get calculatedSize(){return t(this,J)}get size(){return t(this,D)}get fetchMethod(){return t(this,mt)}get memoMethod(){return t(this,Et)}get dispose(){return t(this,k)}get onInsert(){return t(this,ct)}get disposeAfter(){return t(this,B)}getRemainingTTL(e){return t(this,R).has(e)?1/0:0}*entries(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&t(this,w)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield [t(this,w)[e],t(this,p)[e]]);}*rentries(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&t(this,w)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield [t(this,w)[e],t(this,p)[e]]);}*keys(){for(let e of l(this,n,ot).call(this)){let i=t(this,w)[e];i!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of l(this,n,at).call(this)){let i=t(this,w)[e];i!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&!l(this,n,O).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}[(Bt=Symbol.iterator,kt=Symbol.toStringTag,Bt)](){return this.entries()}find(e,i={}){for(let s of l(this,n,ot).call(this)){let r=t(this,p)[s],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;if(a!==void 0&&e(a,t(this,w)[s],this))return this.get(t(this,w)[s],i)}}forEach(e,i=this){for(let s of l(this,n,ot).call(this)){let r=t(this,p)[s],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&e.call(i,a,t(this,w)[s],this);}}rforEach(e,i=this){for(let s of l(this,n,at).call(this)){let r=t(this,p)[s],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;a!==void 0&&e.call(i,a,t(this,w)[s],this);}}purgeStale(){let e=false;for(let i of l(this,n,at).call(this,{allowStale:true}))t(this,W).call(this,i)&&(l(this,n,nt).call(this,t(this,w)[i],"expire"),e=true);return e}info(e){let i=t(this,R).get(e);if(i===void 0)return;let s=t(this,p)[i],r=l(this,n,O).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let a={value:r};if(t(this,P)&&t(this,Z)){let o=t(this,P)[i],h=t(this,Z)[i];if(o&&h){let c=o-(t(this,X).now()-h);a.ttl=c,a.start=Date.now();}}return t(this,Q)&&(a.size=t(this,Q)[i]),a}dump(){let e=[];for(let i of l(this,n,ot).call(this,{allowStale:true})){let s=t(this,w)[i],r=t(this,p)[i],a=l(this,n,O).call(this,r)?r.__staleWhileFetching:r;if(a===void 0||s===void 0)continue;let o={value:a};if(t(this,P)&&t(this,Z)){o.ttl=t(this,P)[i];let h=t(this,X).now()-t(this,Z)[i];o.start=Math.floor(Date.now()-h);}t(this,Q)&&(o.size=t(this,Q)[i]),e.unshift([s,o]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,X).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var y,b,T,A;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:a,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:c}=s,{noUpdateTTL:m=this.noUpdateTTL}=s,I=t(this,xt).call(this,e,i,s.size||0,h);if(this.maxEntrySize&&I>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),l(this,n,nt).call(this,e,"set"),this;let g=t(this,D)===0?void 0:t(this,R).get(e);if(g===void 0)g=t(this,D)===0?t(this,N):t(this,q).length!==0?t(this,q).pop():t(this,D)===t(this,$)?l(this,n,Ct).call(this,false):t(this,D),t(this,w)[g]=e,t(this,p)[g]=i,t(this,R).set(e,g),t(this,V)[t(this,N)]=g,t(this,Y)[g]=t(this,N),f(this,N,g),It(this,D)._++,t(this,bt).call(this,g,I,c),c&&(c.set="add"),m=false,t(this,Tt)&&((y=t(this,ct))==null||y.call(this,i,e,"add"));else {l(this,n,Ot).call(this,g);let v=t(this,p)[g];if(i!==v){if(t(this,lt)&&l(this,n,O).call(this,v)){v.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:_}=v;_!==void 0&&!o&&(t(this,tt)&&((b=t(this,k))==null||b.call(this,_,e,"set")),t(this,L)&&t(this,F)?.push([_,e,"set"]));}else o||(t(this,tt)&&((T=t(this,k))==null||T.call(this,v,e,"set")),t(this,L)&&t(this,F)?.push([v,e,"set"]));if(t(this,ft).call(this,g),t(this,bt).call(this,g,I,c),t(this,p)[g]=i,c){c.set="replace";let _=v&&l(this,n,O).call(this,v)?v.__staleWhileFetching:v;_!==void 0&&(c.oldValue=_);}}else c&&(c.set="update");t(this,Tt)&&this.onInsert?.(i,e,i===v?"update":"replace");}if(r!==0&&!t(this,P)&&l(this,n,Yt).call(this),t(this,P)&&(m||t(this,wt).call(this,g,r,a),c&&t(this,it).call(this,c,g)),!o&&t(this,L)&&t(this,F)){let v=t(this,F),_;for(;_=v?.shift();)(A=t(this,B))==null||A.call(this,..._);}return this}pop(){var e;try{for(;t(this,D);){let i=t(this,p)[t(this,C)];if(l(this,n,Ct).call(this,!0),l(this,n,O).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,L)&&t(this,F)){let i=t(this,F),s;for(;s=i?.shift();)(e=t(this,B))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,a=t(this,R).get(e);if(a!==void 0){let o=t(this,p)[a];if(l(this,n,O).call(this,o)&&o.__staleWhileFetching===void 0)return false;if(t(this,W).call(this,a))r&&(r.has="stale",t(this,it).call(this,r,a));else return s&&t(this,ut).call(this,a),r&&(r.has="hit",t(this,it).call(this,r,a)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,R).get(e);if(r===void 0||!s&&t(this,W).call(this,r))return;let a=t(this,p)[r];return l(this,n,O).call(this,a)?a.__staleWhileFetching:a}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:c=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:I=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:y=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:A,forceRefresh:v=false,status:_,signal:M}=i;if(!t(this,lt))return _&&(_.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:a,status:_});let U={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:a,ttl:o,noDisposeOnSet:h,size:c,sizeCalculation:m,noUpdateTTL:I,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:y,allowStaleOnFetchAbort:T,ignoreFetchAbort:b,status:_,signal:M},G=t(this,R).get(e);if(G===void 0){_&&(_.fetch="miss");let x=l(this,n,Mt).call(this,e,G,U,A);return x.__returned=x}else {let x=t(this,p)[G];if(l(this,n,O).call(this,x)){let dt=s&&x.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",dt&&(_.returnedStale=true)),dt?x.__staleWhileFetching:x.__returned=x}let vt=t(this,W).call(this,G);if(!v&&!vt)return _&&(_.fetch="hit"),l(this,n,Ot).call(this,G),r&&t(this,ut).call(this,G),_&&t(this,it).call(this,_,G),x;let gt=l(this,n,Mt).call(this,e,G,U,A),_t=gt.__staleWhileFetching!==void 0&&s;return _&&(_.fetch=vt?"stale":"refresh",_t&&vt&&(_.returnedStale=true)),_t?gt.__staleWhileFetching:gt.__returned=gt}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=t(this,Et);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:a,...o}=i,h=this.get(e,o);if(!a&&h!==void 0)return h;let c=s(e,h,{options:o,context:r});return this.set(e,c,o),c}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:o}=i,h=t(this,R).get(e);if(h!==void 0){let c=t(this,p)[h],m=l(this,n,O).call(this,c);return o&&t(this,it).call(this,o,h),t(this,W).call(this,h)?(o&&(o.get="stale"),m?(o&&s&&c.__staleWhileFetching!==void 0&&(o.returnedStale=true),s?c.__staleWhileFetching:void 0):(a||l(this,n,nt).call(this,e,"expire"),o&&s&&(o.returnedStale=true),s?c:void 0)):(o&&(o.get="hit"),m?c.__staleWhileFetching:(l(this,n,Ot).call(this,h),r&&t(this,ut).call(this,h),c))}else o&&(o.get="miss");}delete(e){return l(this,n,nt).call(this,e,"delete")}clear(){return l(this,n,Wt).call(this,"delete")}},$=new WeakMap,z=new WeakMap,k=new WeakMap,ct=new WeakMap,B=new WeakMap,mt=new WeakMap,Et=new WeakMap,X=new WeakMap,D=new WeakMap,J=new WeakMap,R=new WeakMap,w=new WeakMap,p=new WeakMap,V=new WeakMap,Y=new WeakMap,C=new WeakMap,N=new WeakMap,q=new WeakMap,F=new WeakMap,Q=new WeakMap,Z=new WeakMap,P=new WeakMap,K=new WeakMap,tt=new WeakMap,lt=new WeakMap,L=new WeakMap,Tt=new WeakMap,n=new WeakSet,Yt=function(){let e=new Ft(t(this,$)),i=new Ft(t(this,$));f(this,P,e),f(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,$)):void 0;f(this,K,s),f(this,wt,(h,c,m=t(this,X).now())=>{i[h]=c!==0?m:0,e[h]=c,r(h,c);}),f(this,ut,h=>{i[h]=e[h]!==0?t(this,X).now():0,r(h,e[h]);});let r=this.ttlAutopurge?(h,c)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),c&&c!==0&&s){let m=setTimeout(()=>{t(this,W).call(this,h)&&l(this,n,nt).call(this,t(this,w)[h],"expire");},c+1);m.unref&&m.unref(),s[h]=m;}}:()=>{};f(this,it,(h,c)=>{if(e[c]){let m=e[c],I=i[c];if(!m||!I)return;h.ttl=m,h.start=I,h.now=a||o();let g=h.now-I;h.remainingTTL=m-g;}});let a=0,o=()=>{let h=t(this,X).now();if(this.ttlResolution>0){a=h;let c=setTimeout(()=>a=0,this.ttlResolution);c.unref&&c.unref();}return h};this.getRemainingTTL=h=>{let c=t(this,R).get(h);if(c===void 0)return 0;let m=e[c],I=i[c];if(!m||!I)return 1/0;let g=(a||o())-I;return m-g},f(this,W,h=>{let c=i[h],m=e[h];return !!m&&!!c&&(a||o())-c>m});},ut=new WeakMap,it=new WeakMap,wt=new WeakMap,W=new WeakMap,Zt=function(){let e=new Ft(t(this,$));f(this,J,0),f(this,Q,e),f(this,ft,i=>{f(this,J,t(this,J)-e[i]),e[i]=0;}),f(this,xt,(i,s,r,a)=>{if(l(this,n,O).call(this,s))return 0;if(!rt(r))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(r=a(s,i),!rt(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),f(this,bt,(i,s,r)=>{if(e[i]=s,t(this,z)){let a=t(this,z)-e[i];for(;t(this,J)>a;)l(this,n,Ct).call(this,true);}f(this,J,t(this,J)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,J));});},ft=new WeakMap,bt=new WeakMap,xt=new WeakMap,ot=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,N);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,C)));)i=t(this,Y)[i];},at=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,C);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,V)[i];},Pt=function(e){return e!==void 0&&t(this,R).get(t(this,w)[e])===e},Ct=function(e){var a;let i=t(this,C),s=t(this,w)[i],r=t(this,p)[i];return t(this,lt)&&l(this,n,O).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((a=t(this,k))==null||a.call(this,r,s,"evict")),t(this,L)&&t(this,F)?.push([r,s,"evict"])),t(this,ft).call(this,i),t(this,K)?.[i]&&(clearTimeout(t(this,K)[i]),t(this,K)[i]=void 0),e&&(t(this,w)[i]=void 0,t(this,p)[i]=void 0,t(this,q).push(i)),t(this,D)===1?(f(this,C,f(this,N,0)),t(this,q).length=0):f(this,C,t(this,V)[i]),t(this,R).delete(s),It(this,D)._--,i},Mt=function(e,i,s,r){let a=i===void 0?void 0:t(this,p)[i];if(l(this,n,O).call(this,a))return a;let o=new Gt,{signal:h}=s;h?.addEventListener("abort",()=>o.abort(h.reason),{signal:o.signal});let c={signal:o.signal,options:s,context:r},m=(A,v=false)=>{let{aborted:_}=o.signal,M=s.ignoreFetchAbort&&A!==void 0,U=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&A!==void 0);if(s.status&&(_&&!v?(s.status.fetchAborted=true,s.status.fetchError=o.signal.reason,M&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),_&&!M&&!v)return g(o.signal.reason,U);let G=b,x=t(this,p)[i];return (x===b||M&&v&&x===void 0)&&(A===void 0?G.__staleWhileFetching!==void 0?t(this,p)[i]=G.__staleWhileFetching:l(this,n,nt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,A,c.options))),A},I=A=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=A),g(A,false)),g=(A,v)=>{let{aborted:_}=o.signal,M=_&&s.allowStaleOnFetchAbort,U=M||s.allowStaleOnFetchRejection,G=U||s.noDeleteOnFetchRejection,x=b;if(t(this,p)[i]===b&&(!G||!v&&x.__staleWhileFetching===void 0?l(this,n,nt).call(this,e,"fetch"):M||(t(this,p)[i]=x.__staleWhileFetching)),U)return s.status&&x.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw A},y=(A,v)=>{var M;let _=(M=t(this,mt))==null?void 0:M.call(this,e,a,c);_&&_ instanceof Promise&&_.then(U=>A(U===void 0?void 0:U),v),o.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(A(void 0),s.allowStaleOnFetchAbort&&(A=U=>m(U,true)));});};s.status&&(s.status.fetchDispatched=true);let b=new Promise(y).then(m,I),T=Object.assign(b,{__abortController:o,__staleWhileFetching:a,__returned:void 0});return i===void 0?(this.set(e,T,{...c.options,status:void 0}),i=t(this,R).get(e)):t(this,p)[i]=T,T},O=function(e){if(!t(this,lt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Gt},Kt=function(e,i){t(this,Y)[i]=e,t(this,V)[e]=i;},Ot=function(e){e!==t(this,N)&&(e===t(this,C)?f(this,C,t(this,V)[e]):l(this,n,Kt).call(this,t(this,Y)[e],t(this,V)[e]),l(this,n,Kt).call(this,t(this,N),e),f(this,N,e));},nt=function(e,i){var r,a;let s=false;if(t(this,D)!==0){let o=t(this,R).get(e);if(o!==void 0)if(t(this,K)?.[o]&&(clearTimeout(t(this,K)?.[o]),t(this,K)[o]=void 0),s=true,t(this,D)===1)l(this,n,Wt).call(this,i);else {t(this,ft).call(this,o);let h=t(this,p)[o];if(l(this,n,O).call(this,h)?h.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((r=t(this,k))==null||r.call(this,h,e,i)),t(this,L)&&t(this,F)?.push([h,e,i])),t(this,R).delete(e),t(this,w)[o]=void 0,t(this,p)[o]=void 0,o===t(this,N))f(this,N,t(this,Y)[o]);else if(o===t(this,C))f(this,C,t(this,V)[o]);else {let c=t(this,Y)[o];t(this,V)[c]=t(this,V)[o];let m=t(this,V)[o];t(this,Y)[m]=t(this,Y)[o];}It(this,D)._--,t(this,q).push(o);}}if(t(this,L)&&t(this,F)?.length){let o=t(this,F),h;for(;h=o?.shift();)(a=t(this,B))==null||a.call(this,...h);}return s},Wt=function(e){var i,s;for(let r of l(this,n,at).call(this,{allowStale:true})){let a=t(this,p)[r];if(l(this,n,O).call(this,a))a.__abortController.abort(new Error("deleted"));else {let o=t(this,w)[r];t(this,tt)&&((i=t(this,k))==null||i.call(this,a,o,e)),t(this,L)&&t(this,F)?.push([a,o,e]);}}if(t(this,R).clear(),t(this,p).fill(void 0),t(this,w).fill(void 0),t(this,P)&&t(this,Z)){t(this,P).fill(0),t(this,Z).fill(0);for(let r of t(this,K)??[])r!==void 0&&clearTimeout(r);t(this,K)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),f(this,C,0),f(this,N,0),t(this,q).length=0,f(this,J,0),f(this,D,0),t(this,L)&&t(this,F)){let r=t(this,F),a;for(;a=r?.shift();)(s=t(this,B))==null||s.call(this,...a);}},yt);var At=class{constructor(e){E(this,"cache");E(this,"map",new Map);this.cache=new Qt({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var pt;(r=>(r.log=(a,...o)=>console.log(`[Pixi\u2019VN] ${a}`,...o),r.warn=(a,...o)=>console.warn(`[Pixi\u2019VN] ${a}`,...o),r.error=(a,...o)=>console.error(`[Pixi\u2019VN] ${a}`,...o),r.info=(a,...o)=>console.info(`[Pixi\u2019VN] ${a}`,...o)))(pt||(pt={}));function Rt(u){try{if(typeof u>"u")return u;let e=JSON.stringify(u);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",u,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var Ht;(g=>{g.storage=new At({cacheSize:50}),g.defaultStorage=new At({cacheSize:10}),g.tempStorageDeadlines=new Map;let s;function r(y){g.tempStorageDeadlines.forEach((b,T)=>{b>y&&(g.storage.delete(`${ht}:${T}`),s?.onClearOldTempVariable?.(T),g.tempStorageDeadlines.delete(T));});}g.clearOldTempVariables=r;function a(y){s=y;}g.setExternalStoreHandler=a;function o(y,b,T){T==null?g.storage.delete(`${y}:${b}`):g.storage.set(`${y}:${b}`,T),s?.onSetVariable?.(b,T);}g.setVariable=o;function h(y,b){let T=g.storage.get(`${y}:${b}`);return Rt(T)}g.getVariable=h;function c(y,b){g.storage.delete(`${y}:${b}`),s?.onRemoveVariable?.(b);}g.removeVariable=c;function m(y,b){let T=g.storage.get(Nt)||[];if(b)T.includes(y)||T.push(y);else {let A=T.indexOf(y);A>-1&&T.splice(A,1);}g.storage.set(Nt,T);}g.setFlag=m;function I(y){return (g.storage.get(Nt)||[]).includes(y)}g.getFlag=I;})(Ht||(Ht={}));var S=Ht;var Dt=class{get base(){return S.storage.map}get cache(){return S.storage.cache}get tempStorageDeadlines(){return S.tempStorageDeadlines}set default(e){Object.entries(e).forEach(([i,s])=>{S.defaultStorage.map.set(i,s);});}set(e,i){return S.setVariable(st,e,i)}get(e){let i=S.getVariable(ht,e);return i===void 0&&(i=S.getVariable(st,e)),i===void 0&&(i=Rt(S.defaultStorage.get(e))),i}remove(e){return this.removeTempVariable(e),S.removeVariable(st,e)}setTempVariable(e,i){if(i==null){this.removeTempVariable(e);return}else S.setVariable(ht,e,i),this.tempStorageDeadlines.has(e)||this.tempStorageDeadlines.set(e,core.GameUnifier.openedLabels);}removeTempVariable(e){S.removeVariable(ht,e),this.tempStorageDeadlines.has(e)&&this.tempStorageDeadlines.delete(e);}setFlag(e,i){return S.setFlag(e,i)}getFlag(e){return S.getFlag(e)}setStorageHandler(e){S.setExternalStoreHandler(e);}clear(){this.base.clear(),this.cache.clear(),this.tempStorageDeadlines.clear();}export(){let e=[];[...this.base.keys()].forEach(s=>{e.push({key:s,value:this.base.get(s)});});let i=[];return [...S.tempStorageDeadlines.keys()].forEach(s=>{i.push({key:s,value:this.tempStorageDeadlines.get(s)});}),Rt({main:e,tempDeadlines:i})}restore(e){this.clear();try{e?(e.base?.forEach(i=>{switch(i.key){case "___current_dialogue_memory___":S.setVariable(H,j.CURRENT_DIALOGUE_MEMORY_KEY,i.value);break;case "___last_dialogue_added_in_step_memory___":S.setVariable(H,j.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_menu_options_memory___":S.setVariable(H,j.CURRENT_MENU_OPTIONS_MEMORY_KEY,i.value);break;case "___last_menu_options_added_in_step_memory___":S.setVariable(H,j.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "_input_value_":S.setVariable(H,j.CURRENT_INPUT_VALUE_MEMORY_KEY,i.value);break;case "___last_input_added_in_step_memory___":S.setVariable(H,j.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_input_info_memory___":S.setVariable(H,j.CURRENT_INPUT_INFO_MEMORY_KEY,i.value);break;case "___opened_labels_counter___":S.setVariable(H,j.OPENED_LABELS_COUNTER_KEY,i.value);break;case "___all_choices_made___":S.setVariable(H,j.ALL_CHOICES_MADE_KEY,i.value);break;case "___current_step_times_counter___":S.setVariable(H,j.CURRENT_STEP_TIMES_COUNTER_KEY,i.value);break;case "___last_step_glued___":S.setVariable(H,j.LAST_STEP_GLUED,i.value);break;default:S.setVariable(st,i.key,i.value);}}),e.temp?.forEach(i=>{S.setVariable(ht,i.key,i.value);}),e.flags?.forEach(i=>{S.setFlag(i,!0);}),e.main?.forEach(i=>{this.base.set(i.key,i.value);}),e.tempDeadlines?.forEach(i=>{this.tempStorageDeadlines.set(i.key,i.value);})):pt.warn("No storage data found");}catch(i){pt.error("Error importing data",i);}}};var Vt=class{constructor(e,i){E(this,"id");E(this,"categoryId");this.categoryId=e,this.id=i,this.migrateOldStorage();}migrateOldStorage(e=this.categoryId){let i=S.getVariable(st,e);i&&(Object.entries(i).forEach(([s,r])=>{typeof r=="object"&&r!==null&&Object.entries(r).forEach(([a,o])=>{S.setVariable(this.categoryId,`${s}:${a}`,o);});}),S.removeVariable(st,e));}setStorageProperty(e,i){S.setVariable(this.categoryId,`${this.id}:${e}`,i);}getStorageProperty(e,i=this.id){return S.getVariable(this.categoryId,`${i}:${e}`)}};var Ve=new Dt;exports.StorageRegistry=S;exports.StoredClassModel=Vt;exports.storage=Ve;
1
+ 'use strict';var core=require('@drincs/pixi-vn/core');var te=Object.defineProperty;var jt=u=>{throw TypeError(u)};var ee=(u,e,i)=>e in u?te(u,e,{enumerable:true,configurable:true,writable:true,value:i}):u[e]=i;var E=(u,e,i)=>ee(u,typeof e!="symbol"?e+"":e,i),Ut=(u,e,i)=>e.has(u)||jt("Cannot "+i);var t=(u,e,i)=>(Ut(u,e,"read from private field"),i?i.call(u):e.get(u)),d=(u,e,i)=>e.has(u)?jt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(u):e.set(u,i),f=(u,e,i,s)=>(Ut(u,e,"write to private field"),e.set(u,i),i),l=(u,e,i)=>(Ut(u,e,"access private method"),i);var It=(u,e,i,s)=>({set _(r){f(u,e,r);},get _(){return t(u,e,s)}});var st="storage",ht="temp",H="narration",Nt="flags",j={CURRENT_DIALOGUE_MEMORY_KEY:"dialogue",LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY:"dialogue:step_counter",CURRENT_MENU_OPTIONS_MEMORY_KEY:"choice:options",LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY:"choice:step_counter",CURRENT_INPUT_VALUE_MEMORY_KEY:"input:value",LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY:"input:step_counter",CURRENT_INPUT_INFO_MEMORY_KEY:"input:info",CHARACTER_CATEGORY_KEY:"character",ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY:"___glue___",OPENED_LABELS_COUNTER_KEY:"label:opened",ALL_CHOICES_MADE_KEY:"choices:made",CURRENT_STEP_TIMES_COUNTER_KEY:"label:history",LAST_STEP_GLUED:"glue:last_step"};var ie=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Xt=new Set,zt=typeof process=="object"&&process?process:{},Jt=(u,e,i,s)=>{typeof zt.emitWarning=="function"?zt.emitWarning(u,e,i,s):console.error(`[${i}] ${e}: ${u}`);},Gt=globalThis.AbortController,$t=globalThis.AbortSignal;if(typeof Gt>"u"){$t=class{constructor(){E(this,"onabort");E(this,"_onabort",[]);E(this,"reason");E(this,"aborted",false);}addEventListener(i,s){this._onabort.push(s);}},Gt=class{constructor(){E(this,"signal",new $t);e();}abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let u=zt.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{u&&(u=false,Jt("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e));};}var se=u=>!Xt.has(u);var rt=u=>u&&u===Math.floor(u)&&u>0&&isFinite(u),qt=u=>rt(u)?u<=Math.pow(2,8)?Uint8Array:u<=Math.pow(2,16)?Uint16Array:u<=Math.pow(2,32)?Uint32Array:u<=Number.MAX_SAFE_INTEGER?Ft:null:null,Ft=class extends Array{constructor(u){super(u),this.fill(0);}},et,St,re=(et=class{constructor(e,i){E(this,"heap");E(this,"length");if(!t(et,St))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new i(e),this.length=0;}static create(e){let i=qt(e);if(!i)return [];f(et,St,true);let s=new et(e,i);return f(et,St,false),s}push(e){this.heap[this.length++]=e;}pop(){return this.heap[--this.length]}},St=new WeakMap,d(et,St,false),et),kt,Bt,$,z,k,ct,B,mt,Et,X,D,J,R,v,p,V,Y,C,N,q,F,Q,Z,P,K,tt,lt,L,Tt,n,Yt,ut,it,vt,W,Zt,ft,bt,xt,at,ot,Pt,Ct,Mt,w,Kt,wt,nt,Wt,At,Qt=(At=class{constructor(e){d(this,n);d(this,$);d(this,z);d(this,k);d(this,ct);d(this,B);d(this,mt);d(this,Et);d(this,X);E(this,"ttl");E(this,"ttlResolution");E(this,"ttlAutopurge");E(this,"updateAgeOnGet");E(this,"updateAgeOnHas");E(this,"allowStale");E(this,"noDisposeOnSet");E(this,"noUpdateTTL");E(this,"maxEntrySize");E(this,"sizeCalculation");E(this,"noDeleteOnFetchRejection");E(this,"noDeleteOnStaleGet");E(this,"allowStaleOnFetchAbort");E(this,"allowStaleOnFetchRejection");E(this,"ignoreFetchAbort");d(this,D);d(this,J);d(this,R);d(this,v);d(this,p);d(this,V);d(this,Y);d(this,C);d(this,N);d(this,q);d(this,F);d(this,Q);d(this,Z);d(this,P);d(this,K);d(this,tt);d(this,lt);d(this,L);d(this,Tt);d(this,ut,()=>{});d(this,it,()=>{});d(this,vt,()=>{});d(this,W,()=>false);d(this,ft,e=>{});d(this,bt,(e,i,s)=>{});d(this,xt,(e,i,s,r)=>{if(s||r)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});E(this,kt,"LRUCache");let{max:i=0,ttl:s,ttlResolution:r=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:h,allowStale:c,dispose:m,onInsert:I,disposeAfter:g,noDisposeOnSet:A,noUpdateTTL:b,maxSize:T=0,maxEntrySize:y=0,sizeCalculation:O,fetchMethod:_,memoMethod:M,noDeleteOnFetchRejection:U,noDeleteOnStaleGet:G,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:Ot,ignoreFetchAbort:gt,perf:_t}=e;if(_t!==void 0&&typeof _t?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(f(this,X,_t??ie),i!==0&&!rt(i))throw new TypeError("max option must be a nonnegative integer");let dt=i?qt(i):Array;if(!dt)throw new Error("invalid max value: "+i);if(f(this,$,i),f(this,z,T),this.maxEntrySize=y||t(this,z),this.sizeCalculation=O,this.sizeCalculation){if(!t(this,z)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(M!==void 0&&typeof M!="function")throw new TypeError("memoMethod must be a function if defined");if(f(this,Et,M),_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(f(this,mt,_),f(this,lt,!!_),f(this,R,new Map),f(this,v,new Array(i).fill(void 0)),f(this,p,new Array(i).fill(void 0)),f(this,V,new dt(i)),f(this,Y,new dt(i)),f(this,C,0),f(this,N,0),f(this,q,re.create(i)),f(this,D,0),f(this,J,0),typeof m=="function"&&f(this,k,m),typeof I=="function"&&f(this,ct,I),typeof g=="function"?(f(this,B,g),f(this,F,[])):(f(this,B,void 0),f(this,F,void 0)),f(this,tt,!!t(this,k)),f(this,Tt,!!t(this,ct)),f(this,L,!!t(this,B)),this.noDisposeOnSet=!!A,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!U,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!Ot,this.ignoreFetchAbort=!!gt,this.maxEntrySize!==0){if(t(this,z)!==0&&!rt(t(this,z)))throw new TypeError("maxSize must be a positive integer if specified");if(!rt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");l(this,n,Zt).call(this);}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!G,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!h,this.ttlResolution=rt(r)||r===0?r:1,this.ttlAutopurge=!!o,this.ttl=s||0,this.ttl){if(!rt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");l(this,n,Yt).call(this);}if(t(this,$)===0&&this.ttl===0&&t(this,z)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!t(this,$)&&!t(this,z)){let Lt="LRU_CACHE_UNBOUNDED";se(Lt)&&(Xt.add(Lt),Jt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",Lt,At));}}get perf(){return t(this,X)}static unsafeExposeInternals(e){return {starts:t(e,Z),ttls:t(e,P),autopurgeTimers:t(e,K),sizes:t(e,Q),keyMap:t(e,R),keyList:t(e,v),valList:t(e,p),next:t(e,V),prev:t(e,Y),get head(){return t(e,C)},get tail(){return t(e,N)},free:t(e,q),isBackgroundFetch:i=>{var s;return l(s=e,n,w).call(s,i)},backgroundFetch:(i,s,r,o)=>{var a;return l(a=e,n,Mt).call(a,i,s,r,o)},moveToTail:i=>{var s;return l(s=e,n,wt).call(s,i)},indexes:i=>{var s;return l(s=e,n,at).call(s,i)},rindexes:i=>{var s;return l(s=e,n,ot).call(s,i)},isStale:i=>{var s;return t(s=e,W).call(s,i)}}}get max(){return t(this,$)}get maxSize(){return t(this,z)}get calculatedSize(){return t(this,J)}get size(){return t(this,D)}get fetchMethod(){return t(this,mt)}get memoMethod(){return t(this,Et)}get dispose(){return t(this,k)}get onInsert(){return t(this,ct)}get disposeAfter(){return t(this,B)}getRemainingTTL(e){return t(this,R).has(e)?1/0:0}*entries(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&t(this,v)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield [t(this,v)[e],t(this,p)[e]]);}*rentries(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&t(this,v)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield [t(this,v)[e],t(this,p)[e]]);}*keys(){for(let e of l(this,n,at).call(this)){let i=t(this,v)[e];i!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield i);}}*rkeys(){for(let e of l(this,n,ot).call(this)){let i=t(this,v)[e];i!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield i);}}*values(){for(let e of l(this,n,at).call(this))t(this,p)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}*rvalues(){for(let e of l(this,n,ot).call(this))t(this,p)[e]!==void 0&&!l(this,n,w).call(this,t(this,p)[e])&&(yield t(this,p)[e]);}[(Bt=Symbol.iterator,kt=Symbol.toStringTag,Bt)](){return this.entries()}find(e,i={}){for(let s of l(this,n,at).call(this)){let r=t(this,p)[s],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;if(o!==void 0&&e(o,t(this,v)[s],this))return this.get(t(this,v)[s],i)}}forEach(e,i=this){for(let s of l(this,n,at).call(this)){let r=t(this,p)[s],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,v)[s],this);}}rforEach(e,i=this){for(let s of l(this,n,ot).call(this)){let r=t(this,p)[s],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;o!==void 0&&e.call(i,o,t(this,v)[s],this);}}purgeStale(){let e=false;for(let i of l(this,n,ot).call(this,{allowStale:true}))t(this,W).call(this,i)&&(l(this,n,nt).call(this,t(this,v)[i],"expire"),e=true);return e}info(e){let i=t(this,R).get(e);if(i===void 0)return;let s=t(this,p)[i],r=l(this,n,w).call(this,s)?s.__staleWhileFetching:s;if(r===void 0)return;let o={value:r};if(t(this,P)&&t(this,Z)){let a=t(this,P)[i],h=t(this,Z)[i];if(a&&h){let c=a-(t(this,X).now()-h);o.ttl=c,o.start=Date.now();}}return t(this,Q)&&(o.size=t(this,Q)[i]),o}dump(){let e=[];for(let i of l(this,n,at).call(this,{allowStale:true})){let s=t(this,v)[i],r=t(this,p)[i],o=l(this,n,w).call(this,r)?r.__staleWhileFetching:r;if(o===void 0||s===void 0)continue;let a={value:o};if(t(this,P)&&t(this,Z)){a.ttl=t(this,P)[i];let h=t(this,X).now()-t(this,Z)[i];a.start=Math.floor(Date.now()-h);}t(this,Q)&&(a.size=t(this,Q)[i]),e.unshift([s,a]);}return e}load(e){this.clear();for(let[i,s]of e){if(s.start){let r=Date.now()-s.start;s.start=t(this,X).now()-r;}this.set(i,s.value,s);}}set(e,i,s={}){var A,b,T,y;if(i===void 0)return this.delete(e),this;let{ttl:r=this.ttl,start:o,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:h=this.sizeCalculation,status:c}=s,{noUpdateTTL:m=this.noUpdateTTL}=s,I=t(this,xt).call(this,e,i,s.size||0,h);if(this.maxEntrySize&&I>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=true),l(this,n,nt).call(this,e,"set"),this;let g=t(this,D)===0?void 0:t(this,R).get(e);if(g===void 0)g=t(this,D)===0?t(this,N):t(this,q).length!==0?t(this,q).pop():t(this,D)===t(this,$)?l(this,n,Ct).call(this,false):t(this,D),t(this,v)[g]=e,t(this,p)[g]=i,t(this,R).set(e,g),t(this,V)[t(this,N)]=g,t(this,Y)[g]=t(this,N),f(this,N,g),It(this,D)._++,t(this,bt).call(this,g,I,c),c&&(c.set="add"),m=false,t(this,Tt)&&((A=t(this,ct))==null||A.call(this,i,e,"add"));else {l(this,n,wt).call(this,g);let O=t(this,p)[g];if(i!==O){if(t(this,lt)&&l(this,n,w).call(this,O)){O.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:_}=O;_!==void 0&&!a&&(t(this,tt)&&((b=t(this,k))==null||b.call(this,_,e,"set")),t(this,L)&&t(this,F)?.push([_,e,"set"]));}else a||(t(this,tt)&&((T=t(this,k))==null||T.call(this,O,e,"set")),t(this,L)&&t(this,F)?.push([O,e,"set"]));if(t(this,ft).call(this,g),t(this,bt).call(this,g,I,c),t(this,p)[g]=i,c){c.set="replace";let _=O&&l(this,n,w).call(this,O)?O.__staleWhileFetching:O;_!==void 0&&(c.oldValue=_);}}else c&&(c.set="update");t(this,Tt)&&this.onInsert?.(i,e,i===O?"update":"replace");}if(r!==0&&!t(this,P)&&l(this,n,Yt).call(this),t(this,P)&&(m||t(this,vt).call(this,g,r,o),c&&t(this,it).call(this,c,g)),!a&&t(this,L)&&t(this,F)){let O=t(this,F),_;for(;_=O?.shift();)(y=t(this,B))==null||y.call(this,..._);}return this}pop(){var e;try{for(;t(this,D);){let i=t(this,p)[t(this,C)];if(l(this,n,Ct).call(this,!0),l(this,n,w).call(this,i)){if(i.__staleWhileFetching)return i.__staleWhileFetching}else if(i!==void 0)return i}}finally{if(t(this,L)&&t(this,F)){let i=t(this,F),s;for(;s=i?.shift();)(e=t(this,B))==null||e.call(this,...s);}}}has(e,i={}){let{updateAgeOnHas:s=this.updateAgeOnHas,status:r}=i,o=t(this,R).get(e);if(o!==void 0){let a=t(this,p)[o];if(l(this,n,w).call(this,a)&&a.__staleWhileFetching===void 0)return false;if(t(this,W).call(this,o))r&&(r.has="stale",t(this,it).call(this,r,o));else return s&&t(this,ut).call(this,o),r&&(r.has="hit",t(this,it).call(this,r,o)),true}else r&&(r.has="miss");return false}peek(e,i={}){let{allowStale:s=this.allowStale}=i,r=t(this,R).get(e);if(r===void 0||!s&&t(this,W).call(this,r))return;let o=t(this,p)[r];return l(this,n,w).call(this,o)?o.__staleWhileFetching:o}async fetch(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:h=this.noDisposeOnSet,size:c=0,sizeCalculation:m=this.sizeCalculation,noUpdateTTL:I=this.noUpdateTTL,noDeleteOnFetchRejection:g=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:A=this.allowStaleOnFetchRejection,ignoreFetchAbort:b=this.ignoreFetchAbort,allowStaleOnFetchAbort:T=this.allowStaleOnFetchAbort,context:y,forceRefresh:O=false,status:_,signal:M}=i;if(!t(this,lt))return _&&(_.fetch="get"),this.get(e,{allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,status:_});let U={allowStale:s,updateAgeOnGet:r,noDeleteOnStaleGet:o,ttl:a,noDisposeOnSet:h,size:c,sizeCalculation:m,noUpdateTTL:I,noDeleteOnFetchRejection:g,allowStaleOnFetchRejection:A,allowStaleOnFetchAbort:T,ignoreFetchAbort:b,status:_,signal:M},G=t(this,R).get(e);if(G===void 0){_&&(_.fetch="miss");let x=l(this,n,Mt).call(this,e,G,U,y);return x.__returned=x}else {let x=t(this,p)[G];if(l(this,n,w).call(this,x)){let dt=s&&x.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",dt&&(_.returnedStale=true)),dt?x.__staleWhileFetching:x.__returned=x}let Ot=t(this,W).call(this,G);if(!O&&!Ot)return _&&(_.fetch="hit"),l(this,n,wt).call(this,G),r&&t(this,ut).call(this,G),_&&t(this,it).call(this,_,G),x;let gt=l(this,n,Mt).call(this,e,G,U,y),_t=gt.__staleWhileFetching!==void 0&&s;return _&&(_.fetch=Ot?"stale":"refresh",_t&&Ot&&(_.returnedStale=true)),_t?gt.__staleWhileFetching:gt.__returned=gt}}async forceFetch(e,i={}){let s=await this.fetch(e,i);if(s===void 0)throw new Error("fetch() returned undefined");return s}memo(e,i={}){let s=t(this,Et);if(!s)throw new Error("no memoMethod provided to constructor");let{context:r,forceRefresh:o,...a}=i,h=this.get(e,a);if(!o&&h!==void 0)return h;let c=s(e,h,{options:a,context:r});return this.set(e,c,a),c}get(e,i={}){let{allowStale:s=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:a}=i,h=t(this,R).get(e);if(h!==void 0){let c=t(this,p)[h],m=l(this,n,w).call(this,c);return a&&t(this,it).call(this,a,h),t(this,W).call(this,h)?(a&&(a.get="stale"),m?(a&&s&&c.__staleWhileFetching!==void 0&&(a.returnedStale=true),s?c.__staleWhileFetching:void 0):(o||l(this,n,nt).call(this,e,"expire"),a&&s&&(a.returnedStale=true),s?c:void 0)):(a&&(a.get="hit"),m?c.__staleWhileFetching:(l(this,n,wt).call(this,h),r&&t(this,ut).call(this,h),c))}else a&&(a.get="miss");}delete(e){return l(this,n,nt).call(this,e,"delete")}clear(){return l(this,n,Wt).call(this,"delete")}},$=new WeakMap,z=new WeakMap,k=new WeakMap,ct=new WeakMap,B=new WeakMap,mt=new WeakMap,Et=new WeakMap,X=new WeakMap,D=new WeakMap,J=new WeakMap,R=new WeakMap,v=new WeakMap,p=new WeakMap,V=new WeakMap,Y=new WeakMap,C=new WeakMap,N=new WeakMap,q=new WeakMap,F=new WeakMap,Q=new WeakMap,Z=new WeakMap,P=new WeakMap,K=new WeakMap,tt=new WeakMap,lt=new WeakMap,L=new WeakMap,Tt=new WeakMap,n=new WeakSet,Yt=function(){let e=new Ft(t(this,$)),i=new Ft(t(this,$));f(this,P,e),f(this,Z,i);let s=this.ttlAutopurge?new Array(t(this,$)):void 0;f(this,K,s),f(this,vt,(h,c,m=t(this,X).now())=>{i[h]=c!==0?m:0,e[h]=c,r(h,c);}),f(this,ut,h=>{i[h]=e[h]!==0?t(this,X).now():0,r(h,e[h]);});let r=this.ttlAutopurge?(h,c)=>{if(s?.[h]&&(clearTimeout(s[h]),s[h]=void 0),c&&c!==0&&s){let m=setTimeout(()=>{t(this,W).call(this,h)&&l(this,n,nt).call(this,t(this,v)[h],"expire");},c+1);m.unref&&m.unref(),s[h]=m;}}:()=>{};f(this,it,(h,c)=>{if(e[c]){let m=e[c],I=i[c];if(!m||!I)return;h.ttl=m,h.start=I,h.now=o||a();let g=h.now-I;h.remainingTTL=m-g;}});let o=0,a=()=>{let h=t(this,X).now();if(this.ttlResolution>0){o=h;let c=setTimeout(()=>o=0,this.ttlResolution);c.unref&&c.unref();}return h};this.getRemainingTTL=h=>{let c=t(this,R).get(h);if(c===void 0)return 0;let m=e[c],I=i[c];if(!m||!I)return 1/0;let g=(o||a())-I;return m-g},f(this,W,h=>{let c=i[h],m=e[h];return !!m&&!!c&&(o||a())-c>m});},ut=new WeakMap,it=new WeakMap,vt=new WeakMap,W=new WeakMap,Zt=function(){let e=new Ft(t(this,$));f(this,J,0),f(this,Q,e),f(this,ft,i=>{f(this,J,t(this,J)-e[i]),e[i]=0;}),f(this,xt,(i,s,r,o)=>{if(l(this,n,w).call(this,s))return 0;if(!rt(r))if(o){if(typeof o!="function")throw new TypeError("sizeCalculation must be a function");if(r=o(s,i),!rt(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return r}),f(this,bt,(i,s,r)=>{if(e[i]=s,t(this,z)){let o=t(this,z)-e[i];for(;t(this,J)>o;)l(this,n,Ct).call(this,true);}f(this,J,t(this,J)+e[i]),r&&(r.entrySize=s,r.totalCalculatedSize=t(this,J));});},ft=new WeakMap,bt=new WeakMap,xt=new WeakMap,at=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,N);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,C)));)i=t(this,Y)[i];},ot=function*({allowStale:e=this.allowStale}={}){if(t(this,D))for(let i=t(this,C);!(!l(this,n,Pt).call(this,i)||((e||!t(this,W).call(this,i))&&(yield i),i===t(this,N)));)i=t(this,V)[i];},Pt=function(e){return e!==void 0&&t(this,R).get(t(this,v)[e])===e},Ct=function(e){var o;let i=t(this,C),s=t(this,v)[i],r=t(this,p)[i];return t(this,lt)&&l(this,n,w).call(this,r)?r.__abortController.abort(new Error("evicted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((o=t(this,k))==null||o.call(this,r,s,"evict")),t(this,L)&&t(this,F)?.push([r,s,"evict"])),t(this,ft).call(this,i),t(this,K)?.[i]&&(clearTimeout(t(this,K)[i]),t(this,K)[i]=void 0),e&&(t(this,v)[i]=void 0,t(this,p)[i]=void 0,t(this,q).push(i)),t(this,D)===1?(f(this,C,f(this,N,0)),t(this,q).length=0):f(this,C,t(this,V)[i]),t(this,R).delete(s),It(this,D)._--,i},Mt=function(e,i,s,r){let o=i===void 0?void 0:t(this,p)[i];if(l(this,n,w).call(this,o))return o;let a=new Gt,{signal:h}=s;h?.addEventListener("abort",()=>a.abort(h.reason),{signal:a.signal});let c={signal:a.signal,options:s,context:r},m=(y,O=false)=>{let{aborted:_}=a.signal,M=s.ignoreFetchAbort&&y!==void 0,U=s.ignoreFetchAbort||!!(s.allowStaleOnFetchAbort&&y!==void 0);if(s.status&&(_&&!O?(s.status.fetchAborted=true,s.status.fetchError=a.signal.reason,M&&(s.status.fetchAbortIgnored=true)):s.status.fetchResolved=true),_&&!M&&!O)return g(a.signal.reason,U);let G=b,x=t(this,p)[i];return (x===b||M&&O&&x===void 0)&&(y===void 0?G.__staleWhileFetching!==void 0?t(this,p)[i]=G.__staleWhileFetching:l(this,n,nt).call(this,e,"fetch"):(s.status&&(s.status.fetchUpdated=true),this.set(e,y,c.options))),y},I=y=>(s.status&&(s.status.fetchRejected=true,s.status.fetchError=y),g(y,false)),g=(y,O)=>{let{aborted:_}=a.signal,M=_&&s.allowStaleOnFetchAbort,U=M||s.allowStaleOnFetchRejection,G=U||s.noDeleteOnFetchRejection,x=b;if(t(this,p)[i]===b&&(!G||!O&&x.__staleWhileFetching===void 0?l(this,n,nt).call(this,e,"fetch"):M||(t(this,p)[i]=x.__staleWhileFetching)),U)return s.status&&x.__staleWhileFetching!==void 0&&(s.status.returnedStale=true),x.__staleWhileFetching;if(x.__returned===x)throw y},A=(y,O)=>{var M;let _=(M=t(this,mt))==null?void 0:M.call(this,e,o,c);_&&_ instanceof Promise&&_.then(U=>y(U===void 0?void 0:U),O),a.signal.addEventListener("abort",()=>{(!s.ignoreFetchAbort||s.allowStaleOnFetchAbort)&&(y(void 0),s.allowStaleOnFetchAbort&&(y=U=>m(U,true)));});};s.status&&(s.status.fetchDispatched=true);let b=new Promise(A).then(m,I),T=Object.assign(b,{__abortController:a,__staleWhileFetching:o,__returned:void 0});return i===void 0?(this.set(e,T,{...c.options,status:void 0}),i=t(this,R).get(e)):t(this,p)[i]=T,T},w=function(e){if(!t(this,lt))return false;let i=e;return !!i&&i instanceof Promise&&i.hasOwnProperty("__staleWhileFetching")&&i.__abortController instanceof Gt},Kt=function(e,i){t(this,Y)[i]=e,t(this,V)[e]=i;},wt=function(e){e!==t(this,N)&&(e===t(this,C)?f(this,C,t(this,V)[e]):l(this,n,Kt).call(this,t(this,Y)[e],t(this,V)[e]),l(this,n,Kt).call(this,t(this,N),e),f(this,N,e));},nt=function(e,i){var r,o;let s=false;if(t(this,D)!==0){let a=t(this,R).get(e);if(a!==void 0)if(t(this,K)?.[a]&&(clearTimeout(t(this,K)?.[a]),t(this,K)[a]=void 0),s=true,t(this,D)===1)l(this,n,Wt).call(this,i);else {t(this,ft).call(this,a);let h=t(this,p)[a];if(l(this,n,w).call(this,h)?h.__abortController.abort(new Error("deleted")):(t(this,tt)||t(this,L))&&(t(this,tt)&&((r=t(this,k))==null||r.call(this,h,e,i)),t(this,L)&&t(this,F)?.push([h,e,i])),t(this,R).delete(e),t(this,v)[a]=void 0,t(this,p)[a]=void 0,a===t(this,N))f(this,N,t(this,Y)[a]);else if(a===t(this,C))f(this,C,t(this,V)[a]);else {let c=t(this,Y)[a];t(this,V)[c]=t(this,V)[a];let m=t(this,V)[a];t(this,Y)[m]=t(this,Y)[a];}It(this,D)._--,t(this,q).push(a);}}if(t(this,L)&&t(this,F)?.length){let a=t(this,F),h;for(;h=a?.shift();)(o=t(this,B))==null||o.call(this,...h);}return s},Wt=function(e){var i,s;for(let r of l(this,n,ot).call(this,{allowStale:true})){let o=t(this,p)[r];if(l(this,n,w).call(this,o))o.__abortController.abort(new Error("deleted"));else {let a=t(this,v)[r];t(this,tt)&&((i=t(this,k))==null||i.call(this,o,a,e)),t(this,L)&&t(this,F)?.push([o,a,e]);}}if(t(this,R).clear(),t(this,p).fill(void 0),t(this,v).fill(void 0),t(this,P)&&t(this,Z)){t(this,P).fill(0),t(this,Z).fill(0);for(let r of t(this,K)??[])r!==void 0&&clearTimeout(r);t(this,K)?.fill(void 0);}if(t(this,Q)&&t(this,Q).fill(0),f(this,C,0),f(this,N,0),t(this,q).length=0,f(this,J,0),f(this,D,0),t(this,L)&&t(this,F)){let r=t(this,F),o;for(;o=r?.shift();)(s=t(this,B))==null||s.call(this,...o);}},At);var yt=class{constructor(e){E(this,"cache");E(this,"map",new Map);this.cache=new Qt({max:e.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){this.cache.clear(),this.map.clear();}delete(e){let i=this.map.delete(e);return i&&this.cache.delete(e),i}get forEach(){return this.map.forEach}get(e){let i=this.cache.get(e);return i||this.map.get(e)}has(e){return this.map.has(e)}set(e,i){return this.map.set(e,i),this.cache.set(e,i),this}get size(){return this.map.size}entries(){return this.map.entries()}keys(){return this.map.keys()}values(){return this.map.values()}};var pt;(r=>(r.log=(o,...a)=>console.log(`[Pixi\u2019VN] ${o}`,...a),r.warn=(o,...a)=>console.warn(`[Pixi\u2019VN] ${o}`,...a),r.error=(o,...a)=>console.error(`[Pixi\u2019VN] ${o}`,...a),r.info=(o,...a)=>console.info(`[Pixi\u2019VN] ${o}`,...a)))(pt||(pt={}));function Rt(u){try{if(typeof u>"u")return u;let e=JSON.stringify(u);return JSON.parse(e)}catch(e){throw pt.error("Error creating exportable element",u,e),new core.PixiError("not_json_serializable","Error creating exportable element")}}var Ht;(g=>{g.storage=new yt({cacheSize:50}),g.defaultStorage=new yt({cacheSize:10}),g.tempStorageDeadlines=new Map;let s;function r(A){g.tempStorageDeadlines.forEach((b,T)=>{b>A&&(g.storage.delete(`${ht}:${T}`),s?.onClearOldTempVariable?.(T),g.tempStorageDeadlines.delete(T));});}g.clearOldTempVariables=r;function o(A){s=A;}g.setExternalStoreHandler=o;function a(A,b,T){T==null?g.storage.delete(`${A}:${b}`):g.storage.set(`${A}:${b}`,T),s?.onSetVariable?.(b,T);}g.setVariable=a;function h(A,b){let T=g.storage.get(`${A}:${b}`);return Rt(T)}g.getVariable=h;function c(A,b){g.storage.delete(`${A}:${b}`),s?.onRemoveVariable?.(b);}g.removeVariable=c;function m(A,b){let T=g.storage.get(Nt)||[];if(b)T.includes(A)||T.push(A);else {let y=T.indexOf(A);y>-1&&T.splice(y,1);}g.storage.set(Nt,T);}g.setFlag=m;function I(A){return (g.storage.get(Nt)||[]).includes(A)}g.getFlag=I;})(Ht||(Ht={}));var S=Ht;var Dt=class{get base(){return S.storage.map}get cache(){return S.storage.cache}get tempStorageDeadlines(){return S.tempStorageDeadlines}set default(e){Object.entries(e).forEach(([i,s])=>{S.defaultStorage.map.set(i,s);});}set(e,i){return S.setVariable(st,e,i)}get(e){let i=S.getVariable(ht,e);return i===void 0&&(i=S.getVariable(st,e)),i===void 0&&(i=Rt(S.defaultStorage.get(e))),i}remove(e){return this.removeTempVariable(e),S.removeVariable(st,e)}setTempVariable(e,i){if(i==null){this.removeTempVariable(e);return}else S.setVariable(ht,e,i),this.tempStorageDeadlines.has(e)||this.tempStorageDeadlines.set(e,core.GameUnifier.openedLabels);}removeTempVariable(e){S.removeVariable(ht,e),this.tempStorageDeadlines.has(e)&&this.tempStorageDeadlines.delete(e);}setFlag(e,i){return S.setFlag(e,i)}getFlag(e){return S.getFlag(e)}setStorageHandler(e){S.setExternalStoreHandler(e);}clear(){this.base.clear(),this.cache.clear(),this.tempStorageDeadlines.clear();}export(){let e=[];[...this.base.keys()].forEach(s=>{e.push({key:s,value:this.base.get(s)});});let i=[];return [...S.tempStorageDeadlines.keys()].forEach(s=>{i.push({key:s,value:this.tempStorageDeadlines.get(s)});}),Rt({main:e,tempDeadlines:i})}restore(e){this.clear();try{e?(e.base?.forEach(i=>{switch(i.key){case "___current_dialogue_memory___":S.setVariable(H,j.CURRENT_DIALOGUE_MEMORY_KEY,i.value);break;case "___last_dialogue_added_in_step_memory___":S.setVariable(H,j.LAST_DIALOGUE_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_menu_options_memory___":S.setVariable(H,j.CURRENT_MENU_OPTIONS_MEMORY_KEY,i.value);break;case "___last_menu_options_added_in_step_memory___":S.setVariable(H,j.LAST_MENU_OPTIONS_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "_input_value_":S.setVariable(H,j.CURRENT_INPUT_VALUE_MEMORY_KEY,i.value);break;case "___last_input_added_in_step_memory___":S.setVariable(H,j.LAST_INPUT_ADDED_IN_STEP_MEMORY_KEY,i.value);break;case "___current_input_info_memory___":S.setVariable(H,j.CURRENT_INPUT_INFO_MEMORY_KEY,i.value);break;case "___opened_labels_counter___":S.setVariable(H,j.OPENED_LABELS_COUNTER_KEY,i.value);break;case "___all_choices_made___":S.setVariable(H,j.ALL_CHOICES_MADE_KEY,i.value);break;case "___current_step_times_counter___":S.setVariable(H,j.CURRENT_STEP_TIMES_COUNTER_KEY,i.value);break;case "___last_step_glued___":S.setVariable(H,j.LAST_STEP_GLUED,i.value);break;default:S.setVariable(st,i.key,i.value);}}),e.temp?.forEach(i=>{S.setVariable(ht,i.key,i.value);}),e.flags?.forEach(i=>{S.setFlag(i,!0);}),e.main?.forEach(i=>{this.base.set(i.key,i.value);}),e.tempDeadlines?.forEach(i=>{this.tempStorageDeadlines.set(i.key,i.value);})):pt.warn("No storage data found");}catch(i){pt.error("Error importing data",i);}}};var Vt=class{constructor(e,i){E(this,"id");E(this,"categoryId");this.categoryId=e,this.id=i,this.migrateOldStorage();}migrateOldStorage(e=this.categoryId){let i=S.getVariable(st,e);i&&(Object.entries(i).forEach(([s,r])=>{typeof r=="object"&&r!==null&&Object.entries(r).forEach(([o,a])=>{S.setVariable(this.categoryId,`${s}:${o}`,a);});}),S.removeVariable(st,e));}setStorageProperty(e,i){S.setVariable(this.categoryId,`${this.id}:${e}`,i);}getStorageProperty(e,i=this.id){return S.getVariable(this.categoryId,`${i}:${e}`)}};var Ve=new Dt;exports.StorageRegistry=S;exports.StoredClassModel=Vt;exports.storage=Ve;
@@ -1,7 +1,7 @@
1
1
  import { LRUCache } from 'lru-cache';
2
- import { a as StorageElementType } from './StorageElementType-DkJ394kq.cjs';
3
- export { S as StorageObjectType } from './StorageElementType-DkJ394kq.cjs';
4
- export { S as StoredClassModel } from './StoredClassModel-LtyakzOw.cjs';
2
+ import { S as StorageElementType } from './StorageElementType-C7ETezlL.cjs';
3
+ export { a as StorageObjectType } from './StorageElementType-C7ETezlL.cjs';
4
+ export { S as StoredClassModel } from './StoredClassModel-C9mQxPg-.cjs';
5
5
  import { C as CachedMap } from './CachedMap-DZLvJAnA.cjs';
6
6
 
7
7
  interface StorageExternalStoreHandler {
package/dist/storage.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { LRUCache } from 'lru-cache';
2
- import { a as StorageElementType } from './StorageElementType-DkJ394kq.js';
3
- export { S as StorageObjectType } from './StorageElementType-DkJ394kq.js';
4
- export { S as StoredClassModel } from './StoredClassModel-a4pvgJXD.js';
2
+ import { S as StorageElementType } from './StorageElementType-C7ETezlL.js';
3
+ export { a as StorageObjectType } from './StorageElementType-C7ETezlL.js';
4
+ export { S as StoredClassModel } from './StoredClassModel-upXPNQTp.js';
5
5
  import { C as CachedMap } from './CachedMap-DZLvJAnA.js';
6
6
 
7
7
  interface StorageExternalStoreHandler {
package/dist/storage.mjs CHANGED
@@ -1 +1 @@
1
- export{a as StorageRegistry,b as StoredClassModel,c as storage}from'./chunk-36I5IN5S.mjs';import'./chunk-IWAXXFXE.mjs';import'./chunk-Z4GZCINS.mjs';
1
+ export{a as StorageRegistry,b as StoredClassModel,c as storage}from'./chunk-V34PMA2H.mjs';import'./chunk-IWAXXFXE.mjs';import'./chunk-Z4GZCINS.mjs';
@@ -1 +1 @@
1
- 'use strict';var canvas=require('@drincs/pixi-vn/canvas'),characters=require('@drincs/pixi-vn/characters'),narration=require('@drincs/pixi-vn/narration'),l=require('@drincs/pixi-vn/pixi.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var l__default=/*#__PURE__*/_interopDefault(l);var o="/__pixi-vn/characters",i="/__pixi-vn/labels",a="/__pixi-vn/assets/manifest",c="/__pixi-vn/canvas-options";function f(){try{return new Function('return typeof import !== "undefined" && typeof import.meta !== "undefined" && import.meta.env?.DEV === true')()}catch{return false}}function r(t,n,s="data"){try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).catch(e=>{console.warn(`Failed to send ${s} to ${t}:`,e);});}catch(e){console.warn(`Error sending ${s} to ${t}:`,e);}}function m(){let t=l__default.default.Assets.resolver._assetMap,n=l__default.default.Assets.resolver._bundles;return {bundles:Object.entries(n).map(([s,e])=>({name:s,assets:e.flatMap(_=>t[_]??[])}))}}function P(){if(f()){try{let t=characters.RegisteredCharacters.values();r(o,t,"characters");}catch(t){console.warn("Error collecting characters:",t);}try{let t=narration.RegisteredLabels.keys();r(i,t,"labels");}catch(t){console.warn("Error collecting labels:",t);}try{let t=m();r(a,t,"assets manifest");}catch(t){console.warn("Error collecting assets manifest:",t);}try{let t={height:canvas.canvas.app.screen.height,width:canvas.canvas.app.screen.width};r(c,t,"canvas options");}catch(t){console.warn("Error collecting canvas options:",t);}}}exports.setupPixivnViteData=P;
1
+ 'use strict';var canvas=require('@drincs/pixi-vn/canvas'),characters=require('@drincs/pixi-vn/characters'),narration=require('@drincs/pixi-vn/narration'),l=require('@drincs/pixi-vn/pixi.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var l__default=/*#__PURE__*/_interopDefault(l);var i="/__pixi-vn/characters",a="/__pixi-vn/labels",c="/__pixi-vn/assets/manifest",p="/__pixi-vn/canvas-options";async function e(t,s,r="data"){try{await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});}catch(n){console.warn(`Failed to send ${r} to ${t}:`,n);}}function d(){let t=l__default.default.Assets.resolver._assetMap,s=l__default.default.Assets.resolver._bundles;return {bundles:Object.entries(s).map(([r,n])=>({name:r,assets:n.flatMap(I=>t[I]??[])}))}}function _(){return typeof window>"u"||typeof document>"u"?false:!!document.querySelector('script[src^="/@vite/client"]')}async function m(){if(_()){try{let t=characters.RegisteredCharacters.values();await e(i,t,"characters");}catch(t){console.warn("Error collecting characters:",t);}try{let t=narration.RegisteredLabels.keys();await e(a,t,"labels");}catch(t){console.warn("Error collecting labels:",t);}try{let t=d();await e(c,t,"assets manifest");}catch(t){console.warn("Error collecting assets manifest:",t);}if(canvas.canvas.isInitialized)try{let t={height:canvas.canvas.app.screen.height,width:canvas.canvas.app.screen.width};await e(p,t,"canvas options");}catch(t){console.warn("Error collecting canvas options:",t);}}}exports.isViteDevelopmentMode=_;exports.setupPixivnViteData=m;
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Checks if the current runtime is Vite development mode.
3
+ * Detects Vite dev client script injected in development.
4
+ * Assumes default Vite client path starts with `/@vite/client`.
5
+ *
6
+ * @returns {boolean}
7
+ * @public
8
+ */
9
+ declare function isViteDevelopmentMode(): boolean;
1
10
  /**
2
11
  * Initializes Pixi VN development tools by syncing game state with the Vite dev server.
3
12
  * Sends registered characters, labels, assets manifest, and canvas options.
@@ -14,12 +23,12 @@
14
23
  *
15
24
  * await Promise.all([import("@/content")]);
16
25
  * // After game setup
17
- * setupPixivnViteData();
26
+ * await setupPixivnViteData();
18
27
  * ```
19
28
  *
20
- * @returns {void}
29
+ * @returns {Promise<void>}
21
30
  * @public
22
31
  */
23
- declare function setupPixivnViteData(): void;
32
+ declare function setupPixivnViteData(): Promise<void>;
24
33
 
25
- export { setupPixivnViteData };
34
+ export { isViteDevelopmentMode, setupPixivnViteData };
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Checks if the current runtime is Vite development mode.
3
+ * Detects Vite dev client script injected in development.
4
+ * Assumes default Vite client path starts with `/@vite/client`.
5
+ *
6
+ * @returns {boolean}
7
+ * @public
8
+ */
9
+ declare function isViteDevelopmentMode(): boolean;
1
10
  /**
2
11
  * Initializes Pixi VN development tools by syncing game state with the Vite dev server.
3
12
  * Sends registered characters, labels, assets manifest, and canvas options.
@@ -14,12 +23,12 @@
14
23
  *
15
24
  * await Promise.all([import("@/content")]);
16
25
  * // After game setup
17
- * setupPixivnViteData();
26
+ * await setupPixivnViteData();
18
27
  * ```
19
28
  *
20
- * @returns {void}
29
+ * @returns {Promise<void>}
21
30
  * @public
22
31
  */
23
- declare function setupPixivnViteData(): void;
32
+ declare function setupPixivnViteData(): Promise<void>;
24
33
 
25
- export { setupPixivnViteData };
34
+ export { isViteDevelopmentMode, setupPixivnViteData };
@@ -1 +1 @@
1
- import {a,b,c,d}from'./chunk-3BBZHKU4.mjs';import'./chunk-TTRUPDAB.mjs';import {canvas}from'@drincs/pixi-vn/canvas';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';import {RegisteredLabels}from'@drincs/pixi-vn/narration';import p from'@drincs/pixi-vn/pixi.js';function u(){try{return new Function('return typeof import !== "undefined" && typeof import.meta !== "undefined" && import.meta.env?.DEV === true')()}catch{return false}}function s(t,n,r="data"){try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).catch(e=>{console.warn(`Failed to send ${r} to ${t}:`,e);});}catch(e){console.warn(`Error sending ${r} to ${t}:`,e);}}function h(){let t=p.Assets.resolver._assetMap,n=p.Assets.resolver._bundles;return {bundles:Object.entries(n).map(([r,e])=>({name:r,assets:e.flatMap(f=>t[f]??[])}))}}function A(){if(u()){try{let t=RegisteredCharacters.values();s(a,t,"characters");}catch(t){console.warn("Error collecting characters:",t);}try{let t=RegisteredLabels.keys();s(b,t,"labels");}catch(t){console.warn("Error collecting labels:",t);}try{let t=h();s(c,t,"assets manifest");}catch(t){console.warn("Error collecting assets manifest:",t);}try{let t={height:canvas.app.screen.height,width:canvas.app.screen.width};s(d,t,"canvas options");}catch(t){console.warn("Error collecting canvas options:",t);}}}export{A as setupPixivnViteData};
1
+ import {a,b,c,d}from'./chunk-3BBZHKU4.mjs';import'./chunk-K7JIC2F2.mjs';import {canvas}from'@drincs/pixi-vn/canvas';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';import {RegisteredLabels}from'@drincs/pixi-vn/narration';import p from'@drincs/pixi-vn/pixi.js';async function t(e,s,r="data"){try{await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});}catch(o){console.warn(`Failed to send ${r} to ${e}:`,o);}}function A(){let e=p.Assets.resolver._assetMap,s=p.Assets.resolver._bundles;return {bundles:Object.entries(s).map(([r,o])=>({name:r,assets:o.flatMap(d=>e[d]??[])}))}}function f(){return typeof window>"u"||typeof document>"u"?false:!!document.querySelector('script[src^="/@vite/client"]')}async function h(){if(f()){try{let e=RegisteredCharacters.values();await t(a,e,"characters");}catch(e){console.warn("Error collecting characters:",e);}try{let e=RegisteredLabels.keys();await t(b,e,"labels");}catch(e){console.warn("Error collecting labels:",e);}try{let e=A();await t(c,e,"assets manifest");}catch(e){console.warn("Error collecting assets manifest:",e);}if(canvas.isInitialized)try{let e={height:canvas.app.screen.height,width:canvas.app.screen.width};await t(d,e,"canvas options");}catch(e){console.warn("Error collecting canvas options:",e);}}}export{f as isViteDevelopmentMode,h as setupPixivnViteData};
package/dist/vite.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var s="/__pixi-vn/characters",o="/__pixi-vn/labels",a="/__pixi-vn/assets/manifest",_="/__pixi-vn/canvas-options";var p=null,c=null,u=null,A=null;function S(){let t=(e,r)=>(i,n)=>{if(n.setHeader("Content-Type","application/json"),i.method==="GET"){if(e.current===null){n.statusCode=404,n.end(JSON.stringify({error:`${r} not initialized`}));return}n.statusCode=200,n.end(JSON.stringify(e.current));return}if(i.method==="POST"){let l="";i.on("data",I=>l+=I),i.on("end",()=>{try{e.current=JSON.parse(l),n.statusCode=201,n.end(JSON.stringify({message:`${r} updated successfully`}));}catch{n.statusCode=400,n.end(JSON.stringify({error:`Invalid JSON format for ${r}`}));}});}};return {name:"vite-plugin-pixi-vn",apply:"serve",configureServer(e){e.middlewares.use(s,t({current:p},"Characters")),e.middlewares.use(o,t({current:c},"Labels")),e.middlewares.use(a,t({current:u},"Manifest")),e.middlewares.use(_,t({current:A},"Canvas options"));}}}exports.PIXIVN_DEV_API_ASSETS_MANIFEST=a;exports.PIXIVN_DEV_API_CANVAS_OPTIONS=_;exports.PIXIVN_DEV_API_CHARACTERS=s;exports.PIXIVN_DEV_API_LABELS=o;exports.vitePluginPixivn=S;
1
+ 'use strict';var fs=require('fs'),tinyglobby=require('tinyglobby');var D=Object.create;var V=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var k=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var G=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var J=(e,t,s,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of X(t))!$.call(e,i)&&i!==s&&V(e,i,{get:()=>t[i],enumerable:!(c=F(t,i))||c.enumerable});return e};var H=(e,t,s)=>(s=e!=null?D(k(e)):{},J(V(s,"default",{value:e,enumerable:true}),e));var N=G((q,S)=>{var f=process||{},O=f.argv||[],u=f.env||{},j=!(u.NO_COLOR||O.includes("--no-color"))&&(!!u.FORCE_COLOR||O.includes("--color")||f.platform==="win32"||(f.stdout||{}).isTTY&&u.TERM!=="dumb"||!!u.CI),z=(e,t,s=e)=>c=>{let i=""+c,a=i.indexOf(t,e.length);return ~a?e+Y(i,t,s,a)+t:e+i+t},Y=(e,t,s,c)=>{let i="",a=0;do i+=e.substring(a,c)+s,a=c+t.length,c=e.indexOf(t,a);while(~c);return i+e.substring(a)},R=(e=j)=>{let t=e?z:()=>String;return {isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};S.exports=R();S.exports.createColors=R;});var p="/__pixi-vn/characters",I="/__pixi-vn/labels",v="/__pixi-vn/assets/manifest",_="/__pixi-vn/canvas-options";var y=H(N());var L=y.default.cyan("(pixi-vn)");function P(e){return e?Array.isArray(e)?e:[e]:[]}function W(e){let t=[],s=[];for(let c of e)try{let i=fs.readFileSync(c,"utf-8"),a=/newLabel\(\s*["']([^"']+)["']/g,d;for(;(d=a.exec(i))!==null;)s.push(d[1]);let g=/new\s+\w*[Cc]haracter\(\s*["']([^"']+)["']/g;for(;(d=g.exec(i))!==null;)t.push(d[1]);}catch{}return {charIds:t,labelIds:s}}function K(e){let t,s,c=new Promise(r=>{s=r;}),i=[...P(e?.content),...P(e?.characters),...P(e?.labels)],a=[],d=[],g=new Set,C=[];async function A(r,o=[]){try{a=(await r("@drincs/pixi-vn")).RegisteredCharacters?.values()??[];}catch{a=[];}try{d=(await r("@drincs/pixi-vn")).RegisteredLabels?.keys()??[];}catch{d=[];}if(o.length>0){let{charIds:n,labelIds:m}=W(o),h=new Set(a.map(b=>b.id)),M=new Set(d);for(let b of n)h.has(b)||a.push({id:b});for(let b of m)M.has(b)||d.push(b);}let l=a.map(n=>n.id).join(", ")||"none";t?.logger.info(`${L} ${y.default.dim(`${a.length} character(s): [${l}], ${d.length} label(s)`)}`,{timestamp:true});}async function w(r,o){let l=await tinyglobby.glob(i,{cwd:o,absolute:true,onlyFiles:true}),n=[];for(let m of l){g.add(m);try{await r(m);}catch{n.push(m);}}await A(r,n),s();}async function T(r){for(let n of g)for(let m of r.moduleGraph.getModulesByFile(n)??[])r.moduleGraph.invalidateModule(m);try{(await r.ssrLoadModule("@drincs/pixi-vn/characters")).registeredCharacters?.clear?.();}catch{}let o=await tinyglobby.glob(i,{cwd:t.root,absolute:true,onlyFiles:true}),l=[];for(let n of o){g.add(n);try{await r.ssrLoadModule(n);}catch{l.push(n);}}await A(n=>r.ssrLoadModule(n),l);for(let n of C)n();}let E={characters:null,labels:null,manifest:null,canvasOptions:null};function x(r,o){return (l,n)=>{if(n.setHeader("Content-Type","application/json"),l.method==="GET"){let m=E[r];if(m===null){n.statusCode=404,n.end(JSON.stringify({error:`${o} not initialized`}));return}n.statusCode=200,n.end(JSON.stringify(m));return}if(l.method==="POST"){let m="";l.on("data",h=>{m+=h.toString();}),l.on("end",()=>{try{E[r]=JSON.parse(m),n.statusCode=201,n.end(JSON.stringify({message:`${o} updated successfully`}));}catch{n.statusCode=400,n.end(JSON.stringify({error:`Invalid JSON format for ${o}`}));}});}}}return {name:"vite-plugin-pixi-vn",enforce:"pre",api:{contentLoaded:c,get characters(){return a},onReload(r){C.push(r);}},configResolved(r){t=r,i.length===0&&s();},async buildStart(){if(t?.command!=="build"||i.length===0)return;let{createServer:r}=await import('vite'),o=await r({root:t.root,configFile:false,server:{middlewareMode:true},appType:"custom",logLevel:"silent",optimizeDeps:{noDiscovery:true}});try{await w(l=>o.ssrLoadModule(l),t.root);}catch{s();}finally{await o.close();}},configureServer(r){i.length>0&&w(o=>r.ssrLoadModule(o),t.root).catch(()=>{s();}),r.middlewares.use(p,x("characters","Characters")),r.middlewares.use(I,x("labels","Labels")),r.middlewares.use(v,x("manifest","Manifest")),r.middlewares.use(_,x("canvasOptions","Canvas options"));},hotUpdate({file:r,server:o}){if(i.length>0&&g.has(r))return T(o).catch(l=>{t?.logger.error(`${L} Failed to reload content.`,{error:l instanceof Error?l:new Error(String(l)),timestamp:true});}),[]}}}exports.PIXIVN_DEV_API_ASSETS_MANIFEST=v;exports.PIXIVN_DEV_API_CANVAS_OPTIONS=_;exports.PIXIVN_DEV_API_CHARACTERS=p;exports.PIXIVN_DEV_API_LABELS=I;exports.vitePluginPixivn=K;
package/dist/vite.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { IncomingMessage, ServerResponse } from 'node:http';
1
+ import { Plugin } from 'vite';
2
2
 
3
3
  /** @const {string} API endpoint for characters data - GET to retrieve, POST to update */
4
4
  declare const PIXIVN_DEV_API_CHARACTERS = "/__pixi-vn/characters";
@@ -10,54 +10,84 @@ declare const PIXIVN_DEV_API_ASSETS_MANIFEST = "/__pixi-vn/assets/manifest";
10
10
  declare const PIXIVN_DEV_API_CANVAS_OPTIONS = "/__pixi-vn/canvas-options";
11
11
 
12
12
  /**
13
- * Represents a Vite plugin configuration object.
14
- * Defines the structure for registering middleware and handling server requests.
15
- *
16
- * @typedef {Object} Plugin
17
- * @property {string} name - Unique identifier for the plugin
18
- * @property {"serve"} apply - Plugin application scope (development server only)
19
- * @property {Function} configureServer - Middleware configuration function
13
+ * Options for {@link vitePluginPixivn}.
20
14
  */
21
- type Plugin = {
22
- name: string;
23
- apply: "serve";
24
- configureServer: (server: {
25
- middlewares: {
26
- use: (path: string, handler: (req: IncomingMessage, res: ServerResponse) => void) => void;
27
- };
28
- }) => void;
29
- };
15
+ interface VitePluginPixivnOptions {
16
+ /**
17
+ * Glob / path of module(s) that set up all game content as side effects:
18
+ * characters, labels, hashtag-command handlers, text-replace handlers, etc.
19
+ *
20
+ * The plugin loads these files server-side (via Vite SSR) at startup so that
21
+ * every downstream plugin that depends on the registered data — most notably
22
+ * `vitePluginInk` for JSON compilation — has the full registry available
23
+ * before it runs. This also works during `vite build`.
24
+ *
25
+ * Pointing to a barrel file that re-exports everything is the simplest option.
26
+ * All patterns are resolved relative to Vite `root`.
27
+ *
28
+ * @example "./src/content/index.ts"
29
+ * @example "./src/content/*.ts"
30
+ */
31
+ content?: string | string[];
32
+ /**
33
+ * Glob / path of module(s) whose side effects register characters via
34
+ * `RegisteredCharacters.add(...)`.
35
+ *
36
+ * Use when characters are defined separately from other content.
37
+ *
38
+ * @example "./src/characters.ts"
39
+ */
40
+ characters?: string | string[];
41
+ /**
42
+ * Glob / path of module(s) whose side effects register narration labels via
43
+ * `RegisteredLabels.register(...)`.
44
+ *
45
+ * @example "./src/*.label.ts"
46
+ */
47
+ labels?: string | string[];
48
+ }
30
49
  /**
31
- * Creates a Vite development server plugin for Pixi VN integration.
50
+ * Creates a Vite plugin for Pixi'VN integration.
51
+ *
52
+ * **Static content loading**
53
+ *
54
+ * When {@link VitePluginPixivnOptions.content}, {@link VitePluginPixivnOptions.characters}, or
55
+ * {@link VitePluginPixivnOptions.labels} are provided, the matched files are executed server-side
56
+ * via Vite SSR at startup, populating `RegisteredCharacters`, `RegisteredLabels`, and any other
57
+ * singletons before downstream plugins (such as `vitePluginInk`) run — including during
58
+ * `vite build`.
32
59
  *
33
- * This plugin provides four API endpoints to sync game state between the client
34
- * and the development server. Only active in development mode (serve).
60
+ * **Dev-server HTTP endpoints**
35
61
  *
36
- * **Endpoints:**
37
- * - `GET /__pixi-vn/characters` - Retrieve cached registered characters
38
- * - `POST /__pixi-vn/characters` - Update registered characters from client
39
- * - `GET /__pixi-vn/labels` - Retrieve cached narration labels
40
- * - `POST /__pixi-vn/labels` - Update narration labels from client
41
- * - `GET /__pixi-vn/assets/manifest` - Retrieve PIXI assets manifest
42
- * - `POST /__pixi-vn/assets/manifest` - Update assets manifest from client
43
- * - `GET /__pixi-vn/canvas-options` - Retrieve canvas rendering options
44
- * - `POST /__pixi-vn/canvas-options` - Update canvas options from client
62
+ * - `GET /__pixi-vn/characters` — retrieve registered characters
63
+ * - `POST /__pixi-vn/characters` *(deprecated)* update from client; use the `characters` option instead
64
+ * - `GET /__pixi-vn/labels` retrieve narration labels
65
+ * - `POST /__pixi-vn/labels` *(deprecated)* update from client; use the `labels` / `content` option instead
66
+ * - `GET /__pixi-vn/assets/manifest` retrieve PIXI assets manifest
67
+ * - `POST /__pixi-vn/assets/manifest` update assets manifest from client
68
+ * - `GET /__pixi-vn/canvas-options` retrieve canvas rendering options
69
+ * - `POST /__pixi-vn/canvas-options` update canvas options from client
45
70
  *
46
- * @returns {Plugin} Configured Vite plugin object
71
+ * **Plugin API** (consumed by `vitePluginInk`):
72
+ * - `api.contentLoaded` — `Promise<void>` that resolves once all content modules have finished
73
+ * loading. Await this before generating JSON files.
47
74
  *
48
75
  * @example
49
76
  * ```typescript
50
77
  * // vite.config.ts
51
- * import { defineConfig } from 'vite';
52
- * import { vitePluginPixivn } from '@drincs/pixi-vn/vite';
78
+ * import { defineConfig } from "vite";
79
+ * import { vitePluginPixivn } from "@drincs/pixi-vn/vite";
53
80
  *
54
81
  * export default defineConfig({
55
- * plugins: [vitePluginPixivn()],
82
+ * plugins: [
83
+ * vitePluginPixivn({ content: "./src/content/index.ts" }),
84
+ * ],
56
85
  * });
57
86
  * ```
58
87
  *
59
- * @public
88
+ * @param options - Optional plugin configuration.
89
+ * @returns A Vite plugin.
60
90
  */
61
- declare function vitePluginPixivn(): Plugin;
91
+ declare function vitePluginPixivn(options?: VitePluginPixivnOptions): Plugin;
62
92
 
63
- export { PIXIVN_DEV_API_ASSETS_MANIFEST, PIXIVN_DEV_API_CANVAS_OPTIONS, PIXIVN_DEV_API_CHARACTERS, PIXIVN_DEV_API_LABELS, vitePluginPixivn };
93
+ export { PIXIVN_DEV_API_ASSETS_MANIFEST, PIXIVN_DEV_API_CANVAS_OPTIONS, PIXIVN_DEV_API_CHARACTERS, PIXIVN_DEV_API_LABELS, type VitePluginPixivnOptions, vitePluginPixivn };
package/dist/vite.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IncomingMessage, ServerResponse } from 'node:http';
1
+ import { Plugin } from 'vite';
2
2
 
3
3
  /** @const {string} API endpoint for characters data - GET to retrieve, POST to update */
4
4
  declare const PIXIVN_DEV_API_CHARACTERS = "/__pixi-vn/characters";
@@ -10,54 +10,84 @@ declare const PIXIVN_DEV_API_ASSETS_MANIFEST = "/__pixi-vn/assets/manifest";
10
10
  declare const PIXIVN_DEV_API_CANVAS_OPTIONS = "/__pixi-vn/canvas-options";
11
11
 
12
12
  /**
13
- * Represents a Vite plugin configuration object.
14
- * Defines the structure for registering middleware and handling server requests.
15
- *
16
- * @typedef {Object} Plugin
17
- * @property {string} name - Unique identifier for the plugin
18
- * @property {"serve"} apply - Plugin application scope (development server only)
19
- * @property {Function} configureServer - Middleware configuration function
13
+ * Options for {@link vitePluginPixivn}.
20
14
  */
21
- type Plugin = {
22
- name: string;
23
- apply: "serve";
24
- configureServer: (server: {
25
- middlewares: {
26
- use: (path: string, handler: (req: IncomingMessage, res: ServerResponse) => void) => void;
27
- };
28
- }) => void;
29
- };
15
+ interface VitePluginPixivnOptions {
16
+ /**
17
+ * Glob / path of module(s) that set up all game content as side effects:
18
+ * characters, labels, hashtag-command handlers, text-replace handlers, etc.
19
+ *
20
+ * The plugin loads these files server-side (via Vite SSR) at startup so that
21
+ * every downstream plugin that depends on the registered data — most notably
22
+ * `vitePluginInk` for JSON compilation — has the full registry available
23
+ * before it runs. This also works during `vite build`.
24
+ *
25
+ * Pointing to a barrel file that re-exports everything is the simplest option.
26
+ * All patterns are resolved relative to Vite `root`.
27
+ *
28
+ * @example "./src/content/index.ts"
29
+ * @example "./src/content/*.ts"
30
+ */
31
+ content?: string | string[];
32
+ /**
33
+ * Glob / path of module(s) whose side effects register characters via
34
+ * `RegisteredCharacters.add(...)`.
35
+ *
36
+ * Use when characters are defined separately from other content.
37
+ *
38
+ * @example "./src/characters.ts"
39
+ */
40
+ characters?: string | string[];
41
+ /**
42
+ * Glob / path of module(s) whose side effects register narration labels via
43
+ * `RegisteredLabels.register(...)`.
44
+ *
45
+ * @example "./src/*.label.ts"
46
+ */
47
+ labels?: string | string[];
48
+ }
30
49
  /**
31
- * Creates a Vite development server plugin for Pixi VN integration.
50
+ * Creates a Vite plugin for Pixi'VN integration.
51
+ *
52
+ * **Static content loading**
53
+ *
54
+ * When {@link VitePluginPixivnOptions.content}, {@link VitePluginPixivnOptions.characters}, or
55
+ * {@link VitePluginPixivnOptions.labels} are provided, the matched files are executed server-side
56
+ * via Vite SSR at startup, populating `RegisteredCharacters`, `RegisteredLabels`, and any other
57
+ * singletons before downstream plugins (such as `vitePluginInk`) run — including during
58
+ * `vite build`.
32
59
  *
33
- * This plugin provides four API endpoints to sync game state between the client
34
- * and the development server. Only active in development mode (serve).
60
+ * **Dev-server HTTP endpoints**
35
61
  *
36
- * **Endpoints:**
37
- * - `GET /__pixi-vn/characters` - Retrieve cached registered characters
38
- * - `POST /__pixi-vn/characters` - Update registered characters from client
39
- * - `GET /__pixi-vn/labels` - Retrieve cached narration labels
40
- * - `POST /__pixi-vn/labels` - Update narration labels from client
41
- * - `GET /__pixi-vn/assets/manifest` - Retrieve PIXI assets manifest
42
- * - `POST /__pixi-vn/assets/manifest` - Update assets manifest from client
43
- * - `GET /__pixi-vn/canvas-options` - Retrieve canvas rendering options
44
- * - `POST /__pixi-vn/canvas-options` - Update canvas options from client
62
+ * - `GET /__pixi-vn/characters` — retrieve registered characters
63
+ * - `POST /__pixi-vn/characters` *(deprecated)* update from client; use the `characters` option instead
64
+ * - `GET /__pixi-vn/labels` retrieve narration labels
65
+ * - `POST /__pixi-vn/labels` *(deprecated)* update from client; use the `labels` / `content` option instead
66
+ * - `GET /__pixi-vn/assets/manifest` retrieve PIXI assets manifest
67
+ * - `POST /__pixi-vn/assets/manifest` update assets manifest from client
68
+ * - `GET /__pixi-vn/canvas-options` retrieve canvas rendering options
69
+ * - `POST /__pixi-vn/canvas-options` update canvas options from client
45
70
  *
46
- * @returns {Plugin} Configured Vite plugin object
71
+ * **Plugin API** (consumed by `vitePluginInk`):
72
+ * - `api.contentLoaded` — `Promise<void>` that resolves once all content modules have finished
73
+ * loading. Await this before generating JSON files.
47
74
  *
48
75
  * @example
49
76
  * ```typescript
50
77
  * // vite.config.ts
51
- * import { defineConfig } from 'vite';
52
- * import { vitePluginPixivn } from '@drincs/pixi-vn/vite';
78
+ * import { defineConfig } from "vite";
79
+ * import { vitePluginPixivn } from "@drincs/pixi-vn/vite";
53
80
  *
54
81
  * export default defineConfig({
55
- * plugins: [vitePluginPixivn()],
82
+ * plugins: [
83
+ * vitePluginPixivn({ content: "./src/content/index.ts" }),
84
+ * ],
56
85
  * });
57
86
  * ```
58
87
  *
59
- * @public
88
+ * @param options - Optional plugin configuration.
89
+ * @returns A Vite plugin.
60
90
  */
61
- declare function vitePluginPixivn(): Plugin;
91
+ declare function vitePluginPixivn(options?: VitePluginPixivnOptions): Plugin;
62
92
 
63
- export { PIXIVN_DEV_API_ASSETS_MANIFEST, PIXIVN_DEV_API_CANVAS_OPTIONS, PIXIVN_DEV_API_CHARACTERS, PIXIVN_DEV_API_LABELS, vitePluginPixivn };
93
+ export { PIXIVN_DEV_API_ASSETS_MANIFEST, PIXIVN_DEV_API_CANVAS_OPTIONS, PIXIVN_DEV_API_CHARACTERS, PIXIVN_DEV_API_LABELS, type VitePluginPixivnOptions, vitePluginPixivn };
package/dist/vite.mjs CHANGED
@@ -1 +1 @@
1
- import {a,b,c as c$1,d as d$1}from'./chunk-3BBZHKU4.mjs';export{c as PIXIVN_DEV_API_ASSETS_MANIFEST,d as PIXIVN_DEV_API_CANVAS_OPTIONS,a as PIXIVN_DEV_API_CHARACTERS,b as PIXIVN_DEV_API_LABELS}from'./chunk-3BBZHKU4.mjs';import'./chunk-TTRUPDAB.mjs';var c=null,d=null,I=null,S=null;function _(){let t=(n,i)=>(r,e)=>{if(e.setHeader("Content-Type","application/json"),r.method==="GET"){if(n.current===null){e.statusCode=404,e.end(JSON.stringify({error:`${i} not initialized`}));return}e.statusCode=200,e.end(JSON.stringify(n.current));return}if(r.method==="POST"){let u="";r.on("data",p=>u+=p),r.on("end",()=>{try{n.current=JSON.parse(u),e.statusCode=201,e.end(JSON.stringify({message:`${i} updated successfully`}));}catch{e.statusCode=400,e.end(JSON.stringify({error:`Invalid JSON format for ${i}`}));}});}};return {name:"vite-plugin-pixi-vn",apply:"serve",configureServer(n){n.middlewares.use(a,t({current:c},"Characters")),n.middlewares.use(b,t({current:d},"Labels")),n.middlewares.use(c$1,t({current:I},"Manifest")),n.middlewares.use(d$1,t({current:S},"Canvas options"));}}}export{_ as vitePluginPixivn};
1
+ import {a as a$1,b,c as c$1,d}from'./chunk-3BBZHKU4.mjs';export{c as PIXIVN_DEV_API_ASSETS_MANIFEST,d as PIXIVN_DEV_API_CANVAS_OPTIONS,a as PIXIVN_DEV_API_CHARACTERS,b as PIXIVN_DEV_API_LABELS}from'./chunk-3BBZHKU4.mjs';import {a,c}from'./chunk-K7JIC2F2.mjs';import {readFileSync}from'fs';import {glob}from'tinyglobby';var E=a((H,C)=>{var f=process||{},R=f.argv||[],u=f.env||{},D=!(u.NO_COLOR||R.includes("--no-color"))&&(!!u.FORCE_COLOR||R.includes("--color")||f.platform==="win32"||(f.stdout||{}).isTTY&&u.TERM!=="dumb"||!!u.CI),k=(n,t,c=n)=>m=>{let o=""+m,i=o.indexOf(t,n.length);return ~i?n+X(o,t,c,i)+t:n+o+t},X=(n,t,c,m)=>{let o="",i=0;do o+=n.substring(i,m)+c,i=m+t.length,m=n.indexOf(t,i);while(~m);return o+n.substring(i)},B=(n=D)=>{let t=n?k:()=>String;return {isColorSupported:n,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};C.exports=B();C.exports.createColors=B;});var w=c(E(),1);var L=w.default.cyan("(pixi-vn)");function S(n){return n?Array.isArray(n)?n:[n]:[]}function G(n){let t=[],c=[];for(let m of n)try{let o=readFileSync(m,"utf-8"),i=/newLabel\(\s*["']([^"']+)["']/g,d;for(;(d=i.exec(o))!==null;)c.push(d[1]);let g=/new\s+\w*[Cc]haracter\(\s*["']([^"']+)["']/g;for(;(d=g.exec(o))!==null;)t.push(d[1]);}catch{}return {charIds:t,labelIds:c}}function J(n){let t,c,m=new Promise(e=>{c=e;}),o=[...S(n?.content),...S(n?.characters),...S(n?.labels)],i=[],d$1=[],g=new Set,P=[];async function A(e,s=[]){try{i=(await e("@drincs/pixi-vn")).RegisteredCharacters?.values()??[];}catch{i=[];}try{d$1=(await e("@drincs/pixi-vn")).RegisteredLabels?.keys()??[];}catch{d$1=[];}if(s.length>0){let{charIds:r,labelIds:l}=G(s),h=new Set(i.map(b=>b.id)),M=new Set(d$1);for(let b of r)h.has(b)||i.push({id:b});for(let b of l)M.has(b)||d$1.push(b);}let a=i.map(r=>r.id).join(", ")||"none";t?.logger.info(`${L} ${w.default.dim(`${i.length} character(s): [${a}], ${d$1.length} label(s)`)}`,{timestamp:true});}async function _(e,s){let a=await glob(o,{cwd:s,absolute:true,onlyFiles:true}),r=[];for(let l of a){g.add(l);try{await e(l);}catch{r.push(l);}}await A(e,r),c();}async function N(e){for(let r of g)for(let l of e.moduleGraph.getModulesByFile(r)??[])e.moduleGraph.invalidateModule(l);try{(await e.ssrLoadModule("@drincs/pixi-vn/characters")).registeredCharacters?.clear?.();}catch{}let s=await glob(o,{cwd:t.root,absolute:true,onlyFiles:true}),a=[];for(let r of s){g.add(r);try{await e.ssrLoadModule(r);}catch{a.push(r);}}await A(r=>e.ssrLoadModule(r),a);for(let r of P)r();}let O={characters:null,labels:null,manifest:null,canvasOptions:null};function x(e,s){return (a,r)=>{if(r.setHeader("Content-Type","application/json"),a.method==="GET"){let l=O[e];if(l===null){r.statusCode=404,r.end(JSON.stringify({error:`${s} not initialized`}));return}r.statusCode=200,r.end(JSON.stringify(l));return}if(a.method==="POST"){let l="";a.on("data",h=>{l+=h.toString();}),a.on("end",()=>{try{O[e]=JSON.parse(l),r.statusCode=201,r.end(JSON.stringify({message:`${s} updated successfully`}));}catch{r.statusCode=400,r.end(JSON.stringify({error:`Invalid JSON format for ${s}`}));}});}}}return {name:"vite-plugin-pixi-vn",enforce:"pre",api:{contentLoaded:m,get characters(){return i},onReload(e){P.push(e);}},configResolved(e){t=e,o.length===0&&c();},async buildStart(){if(t?.command!=="build"||o.length===0)return;let{createServer:e}=await import('vite'),s=await e({root:t.root,configFile:false,server:{middlewareMode:true},appType:"custom",logLevel:"silent",optimizeDeps:{noDiscovery:true}});try{await _(a=>s.ssrLoadModule(a),t.root);}catch{c();}finally{await s.close();}},configureServer(e){o.length>0&&_(s=>e.ssrLoadModule(s),t.root).catch(()=>{c();}),e.middlewares.use(a$1,x("characters","Characters")),e.middlewares.use(b,x("labels","Labels")),e.middlewares.use(c$1,x("manifest","Manifest")),e.middlewares.use(d,x("canvasOptions","Canvas options"));},hotUpdate({file:e,server:s}){if(o.length>0&&g.has(e))return N(s).catch(a=>{t?.logger.error(`${L} Failed to reload content.`,{error:a instanceof Error?a:new Error(String(a)),timestamp:true});}),[]}}}export{J as vitePluginPixivn};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "type": "module",
5
5
  "description": "Pixi'VN is a npm package that provides various features for creating visual novels.",
6
6
  "main": "./dist/index.cjs",
@@ -138,19 +138,26 @@
138
138
  "bugs": {
139
139
  "url": "https://github.com/DRincs-Productions/pixi-vn/issues"
140
140
  },
141
- "homepage": "https://pixi-vn.web.app/",
141
+ "homepage": "https://pixi-vn.com/",
142
142
  "funding": "https://github.com/DRincs-Productions/pixi-vn?sponsor=1",
143
143
  "dependencies": {
144
- "@pixi/devtools": "^2.0.1",
145
- "motion": "^12.38.0",
146
- "pixi.js": "^8.18.1",
147
- "tone": "^15.1.22"
144
+ "@pixi/devtools": ">=2.0.0",
145
+ "motion": ">=12.38.0",
146
+ "pixi.js": ">=8.17.0",
147
+ "tinyglobby": "^0.2.16",
148
+ "tone": ">=15.1.0"
148
149
  },
149
150
  "peerDependencies": {
150
151
  "@pixi/devtools": ">=2.0.0",
151
152
  "motion": ">=12.38.0",
152
153
  "pixi.js": ">=8.17.0",
153
- "tone": ">=15.1.0"
154
+ "tone": ">=15.1.0",
155
+ "vite": ">=5.0.0"
156
+ },
157
+ "peerDependenciesMeta": {
158
+ "vite": {
159
+ "optional": true
160
+ }
154
161
  },
155
162
  "devDependencies": {
156
163
  "@biomejs/biome": "^2.4.12",
@@ -162,6 +169,7 @@
162
169
  "lru-cache": "11.2.7",
163
170
  "microdiff": "^1.5.0",
164
171
  "mime-db": "^1.54.0",
172
+ "picocolors": "^1.1.1",
165
173
  "ts-node": "^10.9.2",
166
174
  "tsconfig-paths": "^4.2.0",
167
175
  "tsup": "^8.5.1",
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var g=a=>{throw TypeError(a)};var i=(a,b,c)=>b in a?f(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c;var l=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:true});};var m=(a,b,c)=>i(a,typeof b!="symbol"?b+"":b,c),e=(a,b,c)=>b.has(a)||g("Cannot "+c);var j=(a,b,c)=>(e(a,b,"read from private field"),c?c.call(a):b.get(a)),n=(a,b,c)=>b.has(a)?g("Cannot add the same private member more than once"):b instanceof WeakSet?b.add(a):b.set(a,c),k=(a,b,c,d)=>(e(a,b,"write to private field"),d?d.call(a,c):b.set(a,c),c),o=(a,b,c)=>(e(a,b,"access private method"),c);var p=(a,b,c,d)=>({set _(h){k(a,b,h,c);},get _(){return j(a,b,d)}});export{l as a,m as b,j as c,n as d,k as e,o as f,p as g};