@drincs/nqtr 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
+ import { T as TimeSchedulingInterface, D as DateSchedulingInterface, C as CommitmentInterface, E as ExecutionType, O as OnRunEvent, A as ActivityInterface, Q as QuestInterface, a as QuestsRequiredType, S as StageInterface, R as RoomInterface, b as OnRunProps, c as ActivityBaseInternalInterface, d as ActiveScheduling, e as OnRunAsyncFunction, f as CommitmentBaseInternalInterface, N as NavigationAbstractInterface, L as LocationInternalInterface, M as MapInterface, g as MapBaseInternalInterface, h as LocationInterface, i as RoomBaseInternalInterface, j as QuestBaseInternalInterface, k as StageBaseInternalInterface } from './StageInterface-DzhX29F-.js';
2
+ export { l as OnRunFunction } from './StageInterface-DzhX29F-.js';
1
3
  export * from '@drincs/nqtr/handlers';
2
4
  import * as registries from '@drincs/nqtr/registries';
3
5
  import { ActivityIdType, CommitmentIdType } from '@drincs/nqtr/registries';
4
6
  export { ActivityIdType, CommitmentIdType, LocationIdType, MapIdType, NqtrActivityIds, NqtrCommitmentIds, NqtrLocationIds, NqtrMapIds, NqtrQuestIds, NqtrRoomIds, QuestIdType, RegisteredActivities, RegisteredCommitments, RegisteredLocations, RegisteredMaps, RegisteredQuests, RegisteredRooms, RoomIdType } from '@drincs/nqtr/registries';
5
- import { T as TimeSchedulingInterface, D as DateSchedulingInterface, C as CommitmentInterface, E as ExecutionType, O as OnRunEvent, A as ActivityInterface, Q as QuestInterface, a as QuestsRequiredType, S as StageInterface, b as ActivityBaseInternalInterface, c as ActiveScheduling, d as OnRunAsyncFunction, e as CommitmentBaseInternalInterface, f as OnRunProps, N as NavigationAbstractInterface, L as LocationInternalInterface, M as MapInterface, R as RoomInterface, g as MapBaseInternalInterface, h as LocationInterface, i as RoomBaseInternalInterface, j as QuestBaseInternalInterface, k as StageBaseInternalInterface } from './StageInterface-B8NCX3T6.js';
6
- export { l as OnRunFunction } from './StageInterface-B8NCX3T6.js';
7
7
  import { StoredClassModel } from '@drincs/pixi-vn/storage';
8
8
  import { CharacterInterface, CharacterIdType } from '@drincs/pixi-vn/characters';
9
9
  import { CharacterInterface as CharacterInterface$1, CharacterIdType as CharacterIdType$1 } from '@drincs/pixi-vn';
10
- import { h as handlers$1 } from './index-C2ZYWKtA.js';
11
- export { T as ITimeStlot, N as NavigatorHandlerInterface, Q as QuestHandlerInterface, R as RoutineHandlerInterface, a as TimeHandlerInterface, b as TimeSettings } from './index-C2ZYWKtA.js';
10
+ import { h as handlers$1 } from './index-DehHTT06.js';
11
+ export { T as ITimeStlot, N as NavigatorHandlerInterface, Q as QuestHandlerInterface, R as RoutineHandlerInterface, a as TimeHandlerInterface, b as TimeSettings } from './index-DehHTT06.js';
12
12
  import '@drincs/nqtr';
13
13
 
14
14
  interface ActivityProps {
@@ -290,6 +290,40 @@ interface StageProps {
290
290
  onEnd?: OnRunEvent<StageInterface>;
291
291
  }
292
292
 
293
+ /** Actions applications can replace with their UI-aware implementations. */
294
+ interface NqtrTestingActions {
295
+ goToRoom(roomId: string): Promise<void>;
296
+ increaseTime(amount: number): Promise<void>;
297
+ increaseDate(days: number, hour?: number): Promise<void>;
298
+ addActivity(roomId: string, activityId: string): Promise<void>;
299
+ removeActivity(roomId: string, activityId: string): Promise<void>;
300
+ addCommitment(roomId: string, commitmentId: string): Promise<void>;
301
+ removeRoutine(commitmentId: string): Promise<void>;
302
+ runActivity(activityId: string): Promise<unknown>;
303
+ runCommitment(commitmentId: string): Promise<unknown>;
304
+ startQuest(questId: string): Promise<void>;
305
+ continueQuest(questId: string): Promise<boolean>;
306
+ }
307
+ /** Direct reads return registered domain objects; no React hook or cache is involved. */
308
+ interface NqtrTestingAPI extends NqtrTestingActions {
309
+ getCurrentRoom(): RoomInterface | undefined;
310
+ getRooms(): RoomInterface[];
311
+ getActivities(): ActivityInterface[];
312
+ getCommitments(): CommitmentInterface[];
313
+ getRoutine(): CommitmentInterface[];
314
+ getQuests(): QuestInterface[];
315
+ }
316
+ /** Opt-in browser testing bridge. Keep props and overrides fresh in the application. */
317
+ declare const testing: {
318
+ setProps(value: OnRunProps): void;
319
+ setActions(value: Partial<NqtrTestingActions>): void;
320
+ enable: (options?: {
321
+ windowKey?: string;
322
+ }) => NqtrTestingAPI;
323
+ disable: () => void;
324
+ isEnabled: () => boolean;
325
+ };
326
+
293
327
  interface ActivityStoredClassProps extends ActiveScheduling {
294
328
  }
295
329
  declare class ActivityStoredClass<OnRunEventType = ActivityInterface> extends StoredClassModel implements ActivityBaseInternalInterface {
@@ -827,6 +861,16 @@ declare const nqtr: {
827
861
  QuestStoredClass: typeof QuestStoredClass;
828
862
  StageBaseModel: typeof StageBaseModel;
829
863
  StageStoredClass: typeof StageStoredClass;
864
+ testing: {
865
+ setProps(value: OnRunProps): void;
866
+ setActions(value: Partial<NqtrTestingActions>): void;
867
+ enable: (options?: {
868
+ windowKey?: string;
869
+ }) => NqtrTestingAPI;
870
+ disable: () => void;
871
+ isEnabled: () => boolean;
872
+ };
830
873
  };
831
874
 
832
- export { ActiveScheduling, ActivityBaseModel, ActivityInterface, type ActivityProps, ActivityStoredClass, type ActivityStoredClassProps, CommitmentBaseModel, type CommitmentInfo, CommitmentInterface, type CommitmentProps, CommitmentStoredClass, type CommitmentStoredClassProps, DateSchedulingInterface, ExecutionType, LocationBaseModel, type LocationBaseModelProps, LocationInterface, LocationStoredClass, MapBaseModel, type MapBaseModelProps, MapInterface, MapStoredClass, OnRunAsyncFunction, OnRunEvent, OnRunProps, QuestBaseModel, QuestInterface, type QuestProps, QuestStoredClass, type QuestStoredClassProps, QuestsRequiredType, RoomBaseModel, type RoomBaseModelProps, RoomInterface, RoomStoredClass, StageBaseModel, StageInterface, type StageProps, StageStoredClass, type StageStoredClassProps, TimeSchedulingInterface, nqtr as default };
875
+ export { ActiveScheduling, ActivityBaseModel, ActivityInterface, ActivityStoredClass, CommitmentBaseModel, CommitmentInterface, CommitmentStoredClass, DateSchedulingInterface, ExecutionType, LocationBaseModel, LocationInterface, LocationStoredClass, MapBaseModel, MapInterface, MapStoredClass, OnRunAsyncFunction, OnRunEvent, OnRunProps, QuestBaseModel, QuestInterface, QuestStoredClass, QuestsRequiredType, RoomBaseModel, RoomInterface, RoomStoredClass, StageBaseModel, StageInterface, StageStoredClass, TimeSchedulingInterface, nqtr as default, testing };
876
+ export type { ActivityProps, ActivityStoredClassProps, CommitmentInfo, CommitmentProps, CommitmentStoredClassProps, LocationBaseModelProps, MapBaseModelProps, NqtrTestingAPI, NqtrTestingActions, QuestProps, QuestStoredClassProps, RoomBaseModelProps, StageProps, StageStoredClassProps };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import {timeTracker,navigator,routine}from'@drincs/nqtr/handlers';export*from'@drincs/nqtr/handlers';import*as Qe from'@drincs/nqtr/registries';import {fixedCommitments,RegisteredRooms,RegisteredLocations,RegisteredMaps,RegisteredQuests,RegisteredCommitments,RegisteredActivities}from'@drincs/nqtr/registries';export{RegisteredActivities,RegisteredCommitments,RegisteredLocations,RegisteredMaps,RegisteredQuests,RegisteredRooms}from'@drincs/nqtr/registries';import {narration}from'@drincs/pixi-vn/narration';import {StoredClassModel,storage}from'@drincs/pixi-vn/storage';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';import {PixiError}from'@drincs/pixi-vn/core';var ce=Object.defineProperty;var K=(s,e)=>{for(var t in e)ce(s,t,{get:e[t],enumerable:true});};var B={};K(B,{ActivityBaseModel:()=>_,ActivityStoredClass:()=>m,CommitmentBaseModel:()=>A,CommitmentStoredClass:()=>p,LocationBaseModel:()=>b,LocationStoredClass:()=>h,MapBaseModel:()=>C,MapStoredClass:()=>y,QuestBaseModel:()=>P,QuestStoredClass:()=>S,RoomBaseModel:()=>E,RoomStoredClass:()=>v,StageBaseModel:()=>D,StageStoredClass:()=>I});var fe="__nqtr-activity__",m=class extends StoredClassModel{constructor(t,r,i,n=fe){super(n,t);this._onRun=r;this._timeSlot=i.timeSlot,this._dateScheduling=i.dateScheduling;}_onRun;_timeSlot;get timeSlot(){return this._timeSlot}_dateScheduling;get dateScheduling(){return this._dateScheduling}async addTempHistoryItem(){return await narration.addCurrentStepToHistory()}get run(){return async t=>(await this.addTempHistoryItem(),await this._onRun(this,t))}get expired(){return !!(this.dateScheduling?.to&&this.dateScheduling.to<=timeTracker.currentDate)}isActive(t={}){let{timeSlot:r=this.timeSlot,dateScheduling:i=this.dateScheduling}=t;if(i?.from!=null&&i.from>timeTracker.currentDate||i?.to!=null&&i.to<timeTracker.currentDate)return false;r&&!Array.isArray(r)&&(r=[r]);for(let n of r||[])if(!timeTracker.nowIsBetween(n?.from,n?.to))return false;return true}};var _=class extends m{constructor(e,t,r){super(e,t,{dateScheduling:r.dateScheduling,timeSlot:r.timeSlot}),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.renderIcon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var u="___nqtr-time_manager_data___",g="___nqtr-current_room_memory___",L="___nqtr-last_event_memory___";function R(s){storage.set(L,s);}function j(){return storage.get(L)}var he="__nqtr-commitment__",p=class extends m{constructor(e,t,r,i){r=r||(()=>{}),super(e,r,i,he),this.defaultExecutionType=i.executionType||"interaction",this.defaultPriority=i.priority,this.characters=t.reduce((n,a)=>{if(typeof a=="string"){let c=RegisteredCharacters.get(a);c?n.push(c):console.warn(`Character with id ${a} not found for commitment ${e}`);}else n.push(a);return n},[]);}defaultExecutionType;defaultPriority;characters;get executionType(){return this.getStorageProperty("executionType")||this.defaultExecutionType}set executionType(e){this.setStorageProperty("executionType",e);}get priority(){return this.getStorageProperty("priority")||this.defaultPriority||0}set priority(e){this.setStorageProperty("priority",e);}async addTempHistoryItem(){let e=navigator.currentRoom;if(!e||this.executionType!=="automatic")return await super.addTempHistoryItem();let t=j();switch(t?.type){case "editroom":storage.set(g,t.prev),await super.addTempHistoryItem(),storage.set(g,e.id);break;case "edittime":{let r=storage.get(u)||{};storage.set(u,t.prev),await super.addTempHistoryItem(),storage.set(u,r);break}}}runOptions;get run(){return async(e,t)=>{let r=t?.removeFromRoutine??this.executionType==="automatic";return await this.addTempHistoryItem(),r&&routine.remove(this.id),await this._onRun(this,e)}}};var A=class extends p{constructor(e,t,r){super(e,t?Array.isArray(t)?t:[t]:[],r.onRun,{executionType:r.executionType,priority:r.priority,timeSlot:r.timeSlot,dateScheduling:r.dateScheduling}),this._name=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}_name;get name(){return this._name}_image;get image(){return this._image}_icon;get icon(){return this._icon}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}};var o;(i=>(i.log=(n,...a)=>console.log(`[NQTR] ${n}`,...a),i.warn=(n,...a)=>console.warn(`[NQTR] ${n}`,...a),i.error=(n,...a)=>console.error(`[NQTR] ${n}`,...a),i.info=(n,...a)=>console.info(`[NQTR] ${n}`,...a)))(o||={});var f=class extends StoredClassModel{constructor(e,t,r=[]){super(e,t),this.defaultActivitiesIds=r.map(i=>typeof i=="string"?i:i.id);}defaultActivitiesIds;get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(e){let t=this.activeActivityScheduling;delete t[e],this.setStorageProperty("activeActivityScheduling",t);let r=this.excludedActivitiesScheduling;delete r[e],this.setStorageProperty("excludedActivitiesScheduling",r);}editActivityScheduling(e,t){this.removeActivityScheduling(e);let r=this.activeActivityScheduling;r[e]=t,this.setStorageProperty("activeActivityScheduling",r);}editExcludedActivityScheduling(e,t){this.removeActivityScheduling(e);let r=this.excludedActivitiesScheduling;r[e]=t,this.setStorageProperty("excludedActivitiesScheduling",r);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}get activitiesIds(){return this.additionalActivitiesIds.concat(this.defaultActivitiesIds)}addActivity(e,t={}){let r=typeof e=="string"?RegisteredActivities.get(e):e;if(!r)throw o.error(`Activity with id ${e} not found.`),new PixiError("unknown_element",`Activity with id ${e} not found.`);let{timeSlot:i,dateScheduling:n}=t;if(i&&!Array.isArray(i)&&(i=[i]),i?.forEach(c=>{let{to:l=timeTracker.dayEndTime+1}=c||{};if(c&&c.from>=l)throw o.error("The from time must be less than the to time."),new PixiError("invalid_usage","The from time must be less than the to time.")}),n?.from!==void 0&&n?.to!==void 0&&n?.from>=n?.to)throw o.error("The from day/date must be less than the to day/date."),new PixiError("invalid_usage","The from day/date must be less than the to day/date.");let a=this.additionalActivitiesIds;this.defaultActivitiesIds.includes(r.id)||a.includes(r.id)?o.info(`Activity with id ${r.id} already exists in the ${this.id}, so it will be updated with the new scheduling options if they are provided.`):(a.push(r.id),this.setStorageProperty("additionalActivitiesIds",a)),this.excludedActivitiesIds.includes(r.id)&&(this.removeActivityScheduling(r.id),o.log(`Activity with id ${r.id} was excluded from the ${this.id}, but now it will be added again with the new scheduling options. So it will be removed from the excluded activities list.`)),(i||n)&&this.editActivityScheduling(r.id,{timeSlot:i,dateScheduling:n});}removeActivity(e){let t=typeof e=="string"?e:e.id,r=this.additionalActivitiesIds;if(r.includes(t))r=r.filter(i=>i!==t),this.setStorageProperty("additionalActivitiesIds",r);else if(this.defaultActivitiesIds.includes(t)){let i=this.excludedActivitiesIds;i.push(t),this.setStorageProperty("excludedActivitiesIds",i);}else o.warn(`Activity with id ${t} not found, so it will be ignored.`);}clearExpiredActivities(){let e=this.activeActivityScheduling,t=this.excludedActivitiesScheduling,r=this.additionalActivitiesIds,i=this.excludedActivitiesIds;r.forEach(n=>{if(n in e){let{to:a}=e[n].dateScheduling||{};a&&a<timeTracker.currentDate&&(this.removeActivityScheduling(n),r=r.filter(c=>c!==n));}}),i.forEach(n=>{n in t&&t[n]&&(this.removeActivityScheduling(n),i=i.filter(a=>a!==n));});}get activities(){return [...new Set([...this.additionalActivitiesIds,...this.defaultActivitiesIds])].reduce((e,t)=>{let r=RegisteredActivities.get(t);return r?.isActive(this.activeActivityScheduling[t])&&!this.excludedActivitiesScheduling[t]&&e.push(r),e},[])}};var Se="__nqtr-location__",h=class extends f{constructor(t,r,i=[]){super(Se,t,i);this._map=r;}_map;get map(){return this._map}get rooms(){return navigator.rooms.filter(t=>t.location.id===this.id)}};var b=class extends h{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var Te="__nqtr-map__",y=class extends f{constructor(e,t=[]){super(Te,e,t);}get locations(){return navigator.locations.filter(e=>e.map.id===this.id)}};var C=class extends y{constructor(e,t={}){super(e,t.activities||[]),this.defaultName=t.name||"",this._image=t.image;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}};var te="__nqtr-room__",v=class extends f{_location;constructor(e,t,r=[]){Array.isArray(r)?super(te,e,r):(super(te,e,r.activities),r.routine.forEach(i=>{let n=typeof i=="string"?i:i.id;fixedCommitments.set(n,e);})),this._location=t;}get routine(){return routine.roomCommitments[this.id]||[]}addCommitment(e,t={}){let{timeSlot:r,dateScheduling:i}=t;if(r&&!Array.isArray(r)&&(r=[r]),r?.forEach(n=>{let{to:a=timeTracker.dayEndTime+1}=n||{};if(n&&n.from>=a)throw o.error("The from time must be less than the to time."),new PixiError("invalid_usage","The from time must be less than the to time.")}),i?.from!==void 0&&i?.to!==void 0&&i?.from>=i?.to)throw o.error("The from day/date must be less than the to day/date."),new PixiError("invalid_usage","The from day/date must be less than the to day/date.");routine.add(e,this.id,{timeSlot:r,dateScheduling:i});}removeCommitment(e){routine.remove(e,this.id);}get location(){return this._location}get characters(){return this.routine.reduce((e,t)=>(e.push(...t.characters),e),[])}get automaticFunctions(){return this.routine.reduce((e,t)=>{if(t.executionType==="automatic"&&t.run){let r=async i=>{await t.run(i);};e.push(r);}return e},[])}};var E=class extends v{constructor(e,t,r={}){super(e,t,{activities:r.activities||[],routine:r.routine||[]}),this.defaultName=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var Ae="__nqtr-quest__",S=class extends StoredClassModel{constructor(t,r,i={}){super(Ae,t);this._stages=r;this._onStart=i.onStart,this._onContinue=i.onContinue||i.onNextStage;}_stages;get stages(){return this._stages}get currentStageIndex(){return this.getStorageProperty("currentStageIndex")}set currentStageIndex(t){this.setStorageProperty("currentStageIndex",t);}get currentStage(){let t=this.currentStageIndex;if(!(t===void 0||t>=this.stages.length))return this.stages[t]}get started(){return this.currentStageIndex!==void 0}get completed(){return this.currentStageIndex===void 0?false:this.currentStageIndex>this.stages.length-1}get inProgress(){return this.completed||this.failed?false:this.started}get failed(){return this.getStorageProperty("failed")||false}set failed(t){this.setStorageProperty("failed",t);}_onStart;get onStart(){return this._onStart}_onContinue;get onContinue(){return this._onContinue}get onNextStage(){return this._onContinue}async start(t){if(this.started){console.warn(`[NQTR] Quest ${this.id} is already started`);return}if(this.stages.length===0){o.error(`Quest ${this.id} has no stages`);return}this.currentStageIndex=0;let r=this.currentStage;if(r?.start)return this.onStart&&await this.onStart(this,t),await r.start(t);o.error(`Quest ${this.id} has no start stage`);}async goNextIfCompleted(t){return await this.advanceIfCompleted(t)}async advanceIfCompleted(t){if(!this.inProgress)return false;let r=this.currentStage;return r?r.completed?await this.advanceUnconditionally(t):false:(o.error(`Quest ${this.id} has no current stage`),false)}async goNext(t){return await this.continue(t)}async continue(t){let r=this.currentStage;return r?(r.completed=true,await this.advanceUnconditionally(t)):(o.error(`Quest ${this.id} has no current stage`),false)}async forceGoNext(t){return await this.advanceUnconditionally(t)}async advanceUnconditionally(t){if(!this.inProgress)return console.warn(`[NQTR] Quest ${this.id} is not in progress`),false;let r=this.currentStage,i=this.currentStageIndex;if(!r||i===void 0)return o.error(`Quest ${this.id} has no current stage`),false;this.currentStageIndex=i+1,this.onContinue&&await this.onContinue(this,t),r?.onEnd&&await r.onEnd(r,t);let n=this.currentStage;return n&&(n.inizialize(),this.currentStageMustStart&&await this.startCurrentStage(t)),true}get currentStageMustStart(){let t=this.currentStage;return t?!t.started&&t.canStart&&!t.completed:false}async startCurrentStage(t){let r=this.currentStage;r&&this.currentStageMustStart?await r.start(t):console.warn(`[NQTR] Quest ${this.id} can't start the current stage`);}};var P=class extends S{constructor(e,t,r){super(e,t,{onStart:r.onStart,onContinue:r.onContinue||r.onNextStage}),this._name=r.name||"",this._description=r.description||"",this._icon=r.icon,this._image=r.image,this._inDevelopment=r.inDevelopment||false;}_name;get name(){return this._name}_description;get description(){return this._description}_icon;get icon(){return this._icon}_image;get image(){return this._image}_inDevelopment;get inDevelopment(){return this._inDevelopment}};var Ce="__nqtr-stage__",I=class extends StoredClassModel{constructor(e,t={}){super(Ce,e),this._onStart=t.onStart,this._onEnd=t.onEnd,this._deltaDateRequired=t.deltaDateRequired,this._questsRequired=t.questsRequired||[];}_onStart;get onStart(){return this._onStart}_onEnd;get onEnd(){return this._onEnd}get completed(){return this.getStorageProperty("completed")||false}set completed(e){this.setStorageProperty("completed",e);}get started(){return this.getStorageProperty("started")||false}set started(e){this.setStorageProperty("started",e);}get inizializeDate(){return this.getStorageProperty("inizializeDate")}set inizializeDate(e){this.setStorageProperty("inizializeDate",e);}get startDate(){let e=this.inizializeDate;if(e!==void 0)return e+this.deltaDateRequired}get canStart(){let e=this.deltaDateRequired;if(e>0){let t=this.inizializeDate;if(t===void 0||t+e>timeTracker.currentDate)return false}return !(this.questsRequired.length>0&&!this.questsRequired.every(t=>t.quest.currentStageIndex&&t.quest.currentStageIndex>=t.stageNumber))}inizialize(){this.deltaDateRequired>0&&(this.inizializeDate=timeTracker.currentDate,console.log(`[NQTR] Stage ${this.id} will start on date ${this.startDate}`));}async start(e){this.canStart?(this.started=true,this.onStart&&await this.onStart(this,e)):console.warn(`[NQTR] Stage ${this.id} can't start`);}_deltaDateRequired;get deltaDateRequired(){return this._deltaDateRequired||0}_questsRequired;get questsRequired(){return this._questsRequired||[]}};var D=class extends I{constructor(e,t){super(e,{onStart:t.onStart,onEnd:t.onEnd,deltaDateRequired:t.deltaDateRequired,questsRequired:t.questsRequired}),this._name=t.name||"",this._flags=t.flags||[],this._description=t.description||"",this._adviceDescription=t.adviceDescription||"",this._image=t.image,this._flagsRequired=t.flagsRequired||[],this._requestDescriptionToStart=t.requestDescriptionToStart||"";}_name;get name(){return this._name}_description;get description(){return this._description}_adviceDescription;get adviceDescription(){return this._adviceDescription}_image;get image(){return this._image}_flags;get flags(){return this._flags}_flagsRequired;get flagsRequired(){return this._flagsRequired}_requestDescriptionToStart;get requestDescriptionToStart(){return this._requestDescriptionToStart}get completed(){return super.completed?true:this.flags.length>0?!!this.flags.every(e=>storage.getFlag(e.flag)):false}set completed(e){super.completed=e;}get canStart(){return this.flagsRequired.length>0&&!this.flagsRequired.every(e=>storage.getFlag(e.flag))?false:super.canStart}};var ae={};var oe={};var G={};K(G,{navigator:()=>qe,questsNotebook:()=>Ne,routine:()=>Me,timeTracker:()=>Oe});var w=class{get rooms(){return RegisteredRooms.values()}get locations(){return RegisteredLocations.values()}get maps(){return RegisteredMaps.values()}get currentRoomId(){return storage.get(g)}get currentRoom(){let e=this.currentRoomId;if(!e){o.error("The current room has not yet been set");return}let t=RegisteredRooms.get(e);if(!t){o.error(`Current room ${e} not found`);return}return t}set currentRoom(e){if(typeof e!="string"&&(e=e.id),!RegisteredRooms.get(e)){o.error(`The room ${e} is not registered, so it can't be set as current room`);return}let r=storage.get(g);r!==e&&(R({type:"editroom",prev:r,value:e}),storage.set(g,e));}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){RegisteredRooms.values().forEach(e=>{e.clearExpiredActivities();});}};var O=class{get quests(){return RegisteredQuests.values()}get startedQuests(){return this.quests.filter(e=>e.started)}get inProgressQuests(){return this.quests.filter(e=>e.inProgress)}get completedQuests(){return this.quests.filter(e=>e.completed)}get failedQuests(){return this.quests.filter(e=>e.failed)}get notStartedQuests(){return this.quests.filter(e=>!e.started)}find(e){return RegisteredQuests.get(e)}async startsStageMustBeStarted(e){let t=this.quests.map(r=>r.currentStageMustStart?r.startCurrentStage(e):Promise.resolve());await Promise.all(t);}};var z="___nqtr-temporary_commitment___",q=class{get temporaryRoutine(){let e=storage.get(z);if(e){if(Array.isArray(e)){if(e.length>0)throw new PixiError("obsolete_save","The save you loaded is not compatible with the current version of NQTR. Please delete the save and start a new game.");return {}}}else return {};return e}get commitmentsIds(){return [...fixedCommitments.keys(),...Object.keys(this.temporaryRoutine)]}add(e,t,r={}){Array.isArray(e)||(e=[e]);let i=this.temporaryRoutine;e.forEach(n=>{let a=typeof n=="string"?n:n.id;i[a]={id:a,roomId:t,...r};}),storage.set(z,i);}find(e){return RegisteredCommitments.get(e)}remove(e,t){typeof e!="string"&&(e=e.id);let r=this.temporaryRoutine;r[e]?(!t||r[e].roomId===t)&&delete r[e]:o.warn(`The commitment ${e} was not found in the temporary routine, so it will be ignored. If you want to remove a fixed commitment, you can add it to the temporary routine with a same character.`),storage.set(z,r);}clearExpiredRoutine(){RegisteredCommitments.values().forEach(e=>{e.expired&&this.remove(e);});}get characterCommitments(){let e=this.temporaryRoutine;return this.commitmentsIds.reduce((t,r)=>{let i=RegisteredCommitments.get(r),n=e[r],a=n?.roomId||fixedCommitments.get(r);return a&&i?.isActive(n)&&(i.characters.length>0?i.characters.every(l=>!t[l.id]||i.priority>t[l.id][0].priority)&&i.characters.forEach(l=>{t[l.id]=[i,a];}):o.error(`The commitment ${i.id} has no characters assigned`)),t},{})}get currentRoutine(){return Object.values(this.characterCommitments).map(([e])=>e)}get roomCommitments(){return Object.values(this.characterCommitments).reduce((e,t)=>{let r=t[1];return e[r]||(e[r]=[]),e[r].push(t[0]),e},{})}getCommitmentByCharacter(e){let t=typeof e=="string"?e:e.id;return this.currentRoutine.find(r=>{if(r.characters.map(i=>i.id).includes(t))return r})}};var we={dayStartTime:0,dayEndTime:24,defaultTimeSpent:1,timeSlots:[],weekLength:7,weekendStartDay:6,getDayName:void 0},d=we;var M=class{initialize(e){let{dayStartTime:t=0,dayEndTime:r=24,defaultTimeSpent:i=1,timeSlots:n=[],weekLength:a=7,weekendStartDay:c=a-1,getDayName:l}=e;d.dayStartTime=t,d.dayEndTime=r,d.defaultTimeSpent=i,d.timeSlots=n,d.weekLength=a,c>=d.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${a}, so will be ignored`):d.weekendStartDay=c,d.getDayName=l;}get dayStartTime(){return d.dayStartTime}get dayEndTime(){return d.dayEndTime}get defaultTimeSpent(){return d.defaultTimeSpent}get timeSlots(){return d.timeSlots}get weekLength(){return d.weekLength}get weekendStartDay(){return d.weekendStartDay}get getDayName(){return d.getDayName}get currentTime(){let e=storage.get(u)||{};return Object.hasOwn(e,"currentTime")&&typeof e.currentTime=="number"?e.currentTime:this.dayStartTime}set currentTime(e){let t=storage.get(u)||{},r={...t};typeof e=="number"?r.currentTime=e:delete r.currentTime,R({type:"edittime",prev:t,value:r}),storage.set(u,r);}get currentDate(){let e=storage.get(u)||{};return Object.hasOwn(e,"currentDate")&&typeof e.currentDate=="number"?e.currentDate:0}set currentDate(e){let t=storage.get(u)||{},r={...t};typeof e=="number"?r.currentDate=e:delete r.currentDate,R({type:"edittime",prev:t,value:r}),storage.set(u,r);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDate%this.weekLength+1}get currentDayName(){return this.getDayName?this.getDayName(this.currentWeekDayNumber-1):(console.warn("[NQTR] Week days names are not defined, so currentDayName will be empty"),"")}get currentTimeSlot(){if(this.timeSlots.length===0)return console.warn("[NQTR] Time slots are not defined"),0;for(let e=0;e<this.timeSlots.length;e++){let t=this.timeSlots[e];if(this.timeSlots.length>e+1&&this.nowIsBetween(t.startTime,this.timeSlots[e+1].startTime))return e}return this.timeSlots.length-1}increaseTime(e=this.defaultTimeSpent){let t=this.currentTime+e;return t>=this.dayEndTime&&(this.increaseDate(),t=this.dayStartTime+(t-this.dayEndTime)),this.currentTime=t,this.currentTime}increaseDate(e=1,t=this.dayStartTime){let r=this.currentDate+e;return this.currentDate=r,this.currentTime=t,this.currentDate}nowIsBetween(e,t){e===void 0&&(e=this.dayStartTime-1),t===void 0&&(t=this.dayEndTime+1);let r=this.currentTime;return e<t?r>=e&&r<t:r>=e||r<t}};var Oe=new M,qe=new w,Me=new q,Ne=new O;var Le={...B,...ae,...oe,handlers:G,registries:Qe},wr=Le;export{_ as ActivityBaseModel,m as ActivityStoredClass,A as CommitmentBaseModel,p as CommitmentStoredClass,b as LocationBaseModel,h as LocationStoredClass,C as MapBaseModel,y as MapStoredClass,P as QuestBaseModel,S as QuestStoredClass,E as RoomBaseModel,v as RoomStoredClass,D as StageBaseModel,I as StageStoredClass,wr as default};
1
+ import {timeTracker,navigator,routine}from'@drincs/nqtr/handlers';export*from'@drincs/nqtr/handlers';import*as tt from'@drincs/nqtr/registries';import {fixedCommitments,RegisteredRooms,RegisteredLocations,RegisteredMaps,RegisteredQuests,RegisteredCommitments,RegisteredActivities}from'@drincs/nqtr/registries';export{RegisteredActivities,RegisteredCommitments,RegisteredLocations,RegisteredMaps,RegisteredQuests,RegisteredRooms}from'@drincs/nqtr/registries';import {narration}from'@drincs/pixi-vn/narration';import {StoredClassModel,storage}from'@drincs/pixi-vn/storage';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';import {PixiError}from'@drincs/pixi-vn/core';var Ce=Object.defineProperty;var te=(s,e)=>{for(var t in e)Ce(s,t,{get:e[t],enumerable:true});};function k(s,e,t){if(!s.has(e))throw new Error(`NQTR testing: unknown ${t} "${e}".`);let r=s.get(e);if(!r)throw new Error(`NQTR testing: unavailable ${t} "${e}".`);return r}function Pe(){let s={},e={},t,r=a=>k(RegisteredRooms,a,"room"),i=a=>k(RegisteredActivities,a,"activity"),n=a=>k(RegisteredCommitments,a,"commitment"),o=a=>k(RegisteredQuests,a,"quest"),u={async goToRoom(a){navigator.currentRoom=r(a);},async increaseTime(a){timeTracker.increaseTime(a);},async increaseDate(a,p){timeTracker.increaseDate(a,p);},async addActivity(a,p){r(a).addActivity(i(p));},async removeActivity(a,p){r(a).removeActivity(i(p));},async addCommitment(a,p){r(a).addCommitment(n(p));},async removeRoutine(a){routine.remove(n(a));},async runActivity(a){return await i(a).run(s)},async runCommitment(a){return await n(a).run(s)},async startQuest(a){await o(a).start(s);},async continueQuest(a){return await o(a).continue(s)}},f={getCurrentRoom:()=>navigator.currentRoomId?navigator.currentRoom:void 0,getRooms:()=>RegisteredRooms.values(),getActivities:()=>RegisteredActivities.values(),getCommitments:()=>RegisteredCommitments.values(),getRoutine:()=>[...new Set(routine.currentRoutine)],getQuests:()=>RegisteredQuests.values()};function X(){if(t&&typeof window<"u"){let a=window;a[t.key]===t.api&&delete a[t.key];}t=void 0;}function _e(a){X();let $={...Object.fromEntries(Object.entries(u).map(([ee,xe])=>[ee,(...be)=>Promise.resolve().then(()=>(e[ee]??xe)(...be))])),...f},Z=a?.windowKey??"nqtr";return typeof window<"u"&&(window[Z]=$),t={key:Z,api:$},$}return {setProps(a){s=a;},setActions(a){e={...a};},enable:_e,disable:X,isEnabled:()=>t!==void 0}}var F=Pe();var G={};te(G,{ActivityBaseModel:()=>_,ActivityStoredClass:()=>l,CommitmentBaseModel:()=>C,CommitmentStoredClass:()=>y,LocationBaseModel:()=>P,LocationStoredClass:()=>v,MapBaseModel:()=>w,MapStoredClass:()=>I,QuestBaseModel:()=>D,QuestStoredClass:()=>T,RoomBaseModel:()=>E,RoomStoredClass:()=>S,StageBaseModel:()=>q,StageStoredClass:()=>R});var De="__nqtr-activity__",l=class extends StoredClassModel{constructor(t,r,i,n=De){super(n,t);this._onRun=r;this._timeSlot=i.timeSlot,this._dateScheduling=i.dateScheduling;}_onRun;_timeSlot;get timeSlot(){return this._timeSlot}_dateScheduling;get dateScheduling(){return this._dateScheduling}async addTempHistoryItem(){return await narration.addCurrentStepToHistory()}get run(){return async t=>(await this.addTempHistoryItem(),await this._onRun(this,t))}get expired(){return !!(this.dateScheduling?.to&&this.dateScheduling.to<=timeTracker.currentDate)}isActive(t={}){let{timeSlot:r=this.timeSlot,dateScheduling:i=this.dateScheduling}=t;if(i?.from!=null&&i.from>timeTracker.currentDate||i?.to!=null&&i.to<timeTracker.currentDate)return false;r&&!Array.isArray(r)&&(r=[r]);for(let n of r||[])if(!timeTracker.nowIsBetween(n?.from,n?.to))return false;return true}};var _=class extends l{constructor(e,t,r){super(e,t,{dateScheduling:r.dateScheduling,timeSlot:r.timeSlot}),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.renderIcon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var m="___nqtr-time_manager_data___",h="___nqtr-current_room_memory___",Y="___nqtr-last_event_memory___";function x(s){storage.set(Y,s);}function ue(){return storage.get(Y)}var Qe="__nqtr-commitment__",y=class extends l{constructor(e,t,r,i){r=r||(()=>{}),super(e,r,i,Qe),this.defaultExecutionType=i.executionType||"interaction",this.defaultPriority=i.priority,this.characters=t.reduce((n,o)=>{if(typeof o=="string"){let u=RegisteredCharacters.get(o);u?n.push(u):console.warn(`Character with id ${o} not found for commitment ${e}`);}else n.push(o);return n},[]);}defaultExecutionType;defaultPriority;characters;get executionType(){return this.getStorageProperty("executionType")||this.defaultExecutionType}set executionType(e){this.setStorageProperty("executionType",e);}get priority(){return this.getStorageProperty("priority")||this.defaultPriority||0}set priority(e){this.setStorageProperty("priority",e);}async addTempHistoryItem(){let e=navigator.currentRoom;if(!e||this.executionType!=="automatic")return await super.addTempHistoryItem();let t=ue();switch(t?.type){case "editroom":storage.set(h,t.prev),await super.addTempHistoryItem(),storage.set(h,e.id);break;case "edittime":{let r=storage.get(m)||{};storage.set(m,t.prev),await super.addTempHistoryItem(),storage.set(m,r);break}}}runOptions;get run(){return async(e,t)=>{let r=t?.removeFromRoutine??this.executionType==="automatic";return await this.addTempHistoryItem(),r&&routine.remove(this.id),await this._onRun(this,e)}}};var C=class extends y{constructor(e,t,r){super(e,t?Array.isArray(t)?t:[t]:[],r.onRun,{executionType:r.executionType,priority:r.priority,timeSlot:r.timeSlot,dateScheduling:r.dateScheduling}),this._name=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}_name;get name(){return this._name}_image;get image(){return this._image}_icon;get icon(){return this._icon}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}};var d;(i=>(i.log=(n,...o)=>console.log(`[NQTR] ${n}`,...o),i.warn=(n,...o)=>console.warn(`[NQTR] ${n}`,...o),i.error=(n,...o)=>console.error(`[NQTR] ${n}`,...o),i.info=(n,...o)=>console.info(`[NQTR] ${n}`,...o)))(d||={});var g=class extends StoredClassModel{constructor(e,t,r=[]){super(e,t),this.defaultActivitiesIds=r.map(i=>typeof i=="string"?i:i.id);}defaultActivitiesIds;get activeActivityScheduling(){return this.getStorageProperty("activeActivityScheduling")||{}}get excludedActivitiesScheduling(){return this.getStorageProperty("excludedActivitiesScheduling")||{}}removeActivityScheduling(e){let t=this.activeActivityScheduling;delete t[e],this.setStorageProperty("activeActivityScheduling",t);let r=this.excludedActivitiesScheduling;delete r[e],this.setStorageProperty("excludedActivitiesScheduling",r);}editActivityScheduling(e,t){this.removeActivityScheduling(e);let r=this.activeActivityScheduling;r[e]=t,this.setStorageProperty("activeActivityScheduling",r);}editExcludedActivityScheduling(e,t){this.removeActivityScheduling(e);let r=this.excludedActivitiesScheduling;r[e]=t,this.setStorageProperty("excludedActivitiesScheduling",r);}get additionalActivitiesIds(){return this.getStorageProperty("additionalActivitiesIds")||[]}get excludedActivitiesIds(){return this.getStorageProperty("excludedActivitiesIds")||[]}get activitiesIds(){return this.additionalActivitiesIds.concat(this.defaultActivitiesIds)}addActivity(e,t={}){let r=typeof e=="string"?RegisteredActivities.get(e):e;if(!r)throw d.error(`Activity with id ${e} not found.`),new PixiError("unknown_element",`Activity with id ${e} not found.`);let{timeSlot:i,dateScheduling:n}=t;if(i&&!Array.isArray(i)&&(i=[i]),i?.forEach(u=>{let{to:f=timeTracker.dayEndTime+1}=u||{};if(u&&u.from>=f)throw d.error("The from time must be less than the to time."),new PixiError("invalid_usage","The from time must be less than the to time.")}),n?.from!==void 0&&n?.to!==void 0&&n?.from>=n?.to)throw d.error("The from day/date must be less than the to day/date."),new PixiError("invalid_usage","The from day/date must be less than the to day/date.");let o=this.additionalActivitiesIds;this.defaultActivitiesIds.includes(r.id)||o.includes(r.id)?d.info(`Activity with id ${r.id} already exists in the ${this.id}, so it will be updated with the new scheduling options if they are provided.`):(o.push(r.id),this.setStorageProperty("additionalActivitiesIds",o)),this.excludedActivitiesIds.includes(r.id)&&(this.removeActivityScheduling(r.id),d.log(`Activity with id ${r.id} was excluded from the ${this.id}, but now it will be added again with the new scheduling options. So it will be removed from the excluded activities list.`)),(i||n)&&this.editActivityScheduling(r.id,{timeSlot:i,dateScheduling:n});}removeActivity(e){let t=typeof e=="string"?e:e.id,r=this.additionalActivitiesIds;if(r.includes(t))r=r.filter(i=>i!==t),this.setStorageProperty("additionalActivitiesIds",r);else if(this.defaultActivitiesIds.includes(t)){let i=this.excludedActivitiesIds;i.push(t),this.setStorageProperty("excludedActivitiesIds",i);}else d.warn(`Activity with id ${t} not found, so it will be ignored.`);}clearExpiredActivities(){let e=this.activeActivityScheduling,t=this.excludedActivitiesScheduling,r=this.additionalActivitiesIds,i=this.excludedActivitiesIds;r.forEach(n=>{if(n in e){let{to:o}=e[n].dateScheduling||{};o&&o<timeTracker.currentDate&&(this.removeActivityScheduling(n),r=r.filter(u=>u!==n));}}),i.forEach(n=>{n in t&&t[n]&&(this.removeActivityScheduling(n),i=i.filter(o=>o!==n));});}get activities(){return [...new Set([...this.additionalActivitiesIds,...this.defaultActivitiesIds])].reduce((e,t)=>{let r=RegisteredActivities.get(t);return r?.isActive(this.activeActivityScheduling[t])&&!this.excludedActivitiesScheduling[t]&&e.push(r),e},[])}};var Le="__nqtr-location__",v=class extends g{constructor(t,r,i=[]){super(Le,t,i);this._map=r;}_map;get map(){return this._map}get rooms(){return navigator.rooms.filter(t=>t.location.id===this.id)}};var P=class extends v{constructor(e,t,r={}){super(e,t,r.activities||[]),this.defaultName=r.name||"",this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var $e="__nqtr-map__",I=class extends g{constructor(e,t=[]){super($e,e,t);}get locations(){return navigator.locations.filter(e=>e.map.id===this.id)}};var w=class extends I{constructor(e,t={}){super(e,t.activities||[]),this.defaultName=t.name||"",this._image=t.image;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}};var he="__nqtr-room__",S=class extends g{_location;constructor(e,t,r=[]){Array.isArray(r)?super(he,e,r):(super(he,e,r.activities),r.routine.forEach(i=>{let n=typeof i=="string"?i:i.id;fixedCommitments.set(n,e);})),this._location=t;}get routine(){return routine.roomCommitments[this.id]||[]}addCommitment(e,t={}){let{timeSlot:r,dateScheduling:i}=t;if(r&&!Array.isArray(r)&&(r=[r]),r?.forEach(n=>{let{to:o=timeTracker.dayEndTime+1}=n||{};if(n&&n.from>=o)throw d.error("The from time must be less than the to time."),new PixiError("invalid_usage","The from time must be less than the to time.")}),i?.from!==void 0&&i?.to!==void 0&&i?.from>=i?.to)throw d.error("The from day/date must be less than the to day/date."),new PixiError("invalid_usage","The from day/date must be less than the to day/date.");routine.add(e,this.id,{timeSlot:r,dateScheduling:i});}removeCommitment(e){routine.remove(e,this.id);}get location(){return this._location}get characters(){return this.routine.reduce((e,t)=>(e.push(...t.characters),e),[])}get automaticFunctions(){return this.routine.reduce((e,t)=>{if(t.executionType==="automatic"&&t.run){let r=async i=>{await t.run(i);};e.push(r);}return e},[])}};var E=class extends S{constructor(e,t,r={}){super(e,t,{activities:r.activities||[],routine:r.routine||[]}),this.defaultName=r.name||"",this._image=r.image,this.defaultDisabled=r.disabled||false,this.defaultHidden=r.hidden||false,this._icon=r.icon;}defaultName;get name(){return this.getStorageProperty("name")||this.defaultName}set name(e){this.setStorageProperty("name",e);}_image;get image(){return this._image}defaultDisabled;get disabled(){let e=this.getStorageProperty("disabled")||this.defaultDisabled;return typeof e=="string"?storage.getFlag(e):e}set disabled(e){this.setStorageProperty("disabled",e);}defaultHidden;get hidden(){let e=this.getStorageProperty("hidden")||this.defaultHidden;return typeof e=="string"?storage.getFlag(e):e}set hidden(e){this.setStorageProperty("hidden",e);}_icon;get icon(){return this._icon}};var ze="__nqtr-quest__",T=class extends StoredClassModel{constructor(t,r,i={}){super(ze,t);this._stages=r;this._onStart=i.onStart,this._onContinue=i.onContinue||i.onNextStage;}_stages;get stages(){return this._stages}get currentStageIndex(){return this.getStorageProperty("currentStageIndex")}set currentStageIndex(t){this.setStorageProperty("currentStageIndex",t);}get currentStage(){let t=this.currentStageIndex;if(!(t===void 0||t>=this.stages.length))return this.stages[t]}get started(){return this.currentStageIndex!==void 0}get completed(){return this.currentStageIndex===void 0?false:this.currentStageIndex>this.stages.length-1}get inProgress(){return this.completed||this.failed?false:this.started}get failed(){return this.getStorageProperty("failed")||false}set failed(t){this.setStorageProperty("failed",t);}_onStart;get onStart(){return this._onStart}_onContinue;get onContinue(){return this._onContinue}get onNextStage(){return this._onContinue}async start(t){if(this.started){console.warn(`[NQTR] Quest ${this.id} is already started`);return}if(this.stages.length===0){d.error(`Quest ${this.id} has no stages`);return}this.currentStageIndex=0;let r=this.currentStage;if(r?.start)return this.onStart&&await this.onStart(this,t),await r.start(t);d.error(`Quest ${this.id} has no start stage`);}async goNextIfCompleted(t){return await this.advanceIfCompleted(t)}async advanceIfCompleted(t){if(!this.inProgress)return false;let r=this.currentStage;return r?r.completed?await this.advanceUnconditionally(t):false:(d.error(`Quest ${this.id} has no current stage`),false)}async goNext(t){return await this.continue(t)}async continue(t){let r=this.currentStage;return r?(r.completed=true,await this.advanceUnconditionally(t)):(d.error(`Quest ${this.id} has no current stage`),false)}async forceGoNext(t){return await this.advanceUnconditionally(t)}async advanceUnconditionally(t){if(!this.inProgress)return console.warn(`[NQTR] Quest ${this.id} is not in progress`),false;let r=this.currentStage,i=this.currentStageIndex;if(!r||i===void 0)return d.error(`Quest ${this.id} has no current stage`),false;this.currentStageIndex=i+1,this.onContinue&&await this.onContinue(this,t),r?.onEnd&&await r.onEnd(r,t);let n=this.currentStage;return n&&(n.inizialize(),this.currentStageMustStart&&await this.startCurrentStage(t)),true}get currentStageMustStart(){let t=this.currentStage;return t?!t.started&&t.canStart&&!t.completed:false}async startCurrentStage(t){let r=this.currentStage;r&&this.currentStageMustStart?await r.start(t):console.warn(`[NQTR] Quest ${this.id} can't start the current stage`);}};var D=class extends T{constructor(e,t,r){super(e,t,{onStart:r.onStart,onContinue:r.onContinue||r.onNextStage}),this._name=r.name||"",this._description=r.description||"",this._icon=r.icon,this._image=r.image,this._inDevelopment=r.inDevelopment||false;}_name;get name(){return this._name}_description;get description(){return this._description}_icon;get icon(){return this._icon}_image;get image(){return this._image}_inDevelopment;get inDevelopment(){return this._inDevelopment}};var Ge="__nqtr-stage__",R=class extends StoredClassModel{constructor(e,t={}){super(Ge,e),this._onStart=t.onStart,this._onEnd=t.onEnd,this._deltaDateRequired=t.deltaDateRequired,this._questsRequired=t.questsRequired||[];}_onStart;get onStart(){return this._onStart}_onEnd;get onEnd(){return this._onEnd}get completed(){return this.getStorageProperty("completed")||false}set completed(e){this.setStorageProperty("completed",e);}get started(){return this.getStorageProperty("started")||false}set started(e){this.setStorageProperty("started",e);}get inizializeDate(){return this.getStorageProperty("inizializeDate")}set inizializeDate(e){this.setStorageProperty("inizializeDate",e);}get startDate(){let e=this.inizializeDate;if(e!==void 0)return e+this.deltaDateRequired}get canStart(){let e=this.deltaDateRequired;if(e>0){let t=this.inizializeDate;if(t===void 0||t+e>timeTracker.currentDate)return false}return !(this.questsRequired.length>0&&!this.questsRequired.every(t=>t.quest.currentStageIndex&&t.quest.currentStageIndex>=t.stageNumber))}inizialize(){this.deltaDateRequired>0&&(this.inizializeDate=timeTracker.currentDate,console.log(`[NQTR] Stage ${this.id} will start on date ${this.startDate}`));}async start(e){this.canStart?(this.started=true,this.onStart&&await this.onStart(this,e)):console.warn(`[NQTR] Stage ${this.id} can't start`);}_deltaDateRequired;get deltaDateRequired(){return this._deltaDateRequired||0}_questsRequired;get questsRequired(){return this._questsRequired||[]}};var q=class extends R{constructor(e,t){super(e,{onStart:t.onStart,onEnd:t.onEnd,deltaDateRequired:t.deltaDateRequired,questsRequired:t.questsRequired}),this._name=t.name||"",this._flags=t.flags||[],this._description=t.description||"",this._adviceDescription=t.adviceDescription||"",this._image=t.image,this._flagsRequired=t.flagsRequired||[],this._requestDescriptionToStart=t.requestDescriptionToStart||"";}_name;get name(){return this._name}_description;get description(){return this._description}_adviceDescription;get adviceDescription(){return this._adviceDescription}_image;get image(){return this._image}_flags;get flags(){return this._flags}_flagsRequired;get flagsRequired(){return this._flagsRequired}_requestDescriptionToStart;get requestDescriptionToStart(){return this._requestDescriptionToStart}get completed(){return super.completed?true:this.flags.length>0?!!this.flags.every(e=>storage.getFlag(e.flag)):false}set completed(e){super.completed=e;}get canStart(){return this.flagsRequired.length>0&&!this.flagsRequired.every(e=>storage.getFlag(e.flag))?false:super.canStart}};var Se={};var Te={};var J={};te(J,{navigator:()=>Xe,questsNotebook:()=>et,routine:()=>Ze,timeTracker:()=>Je});var O=class{get rooms(){return RegisteredRooms.values()}get locations(){return RegisteredLocations.values()}get maps(){return RegisteredMaps.values()}get currentRoomId(){return storage.get(h)}get currentRoom(){let e=this.currentRoomId;if(!e){d.error("The current room has not yet been set");return}let t=RegisteredRooms.get(e);if(!t){d.error(`Current room ${e} not found`);return}return t}set currentRoom(e){if(typeof e!="string"&&(e=e.id),!RegisteredRooms.get(e)){d.error(`The room ${e} is not registered, so it can't be set as current room`);return}let r=storage.get(h);r!==e&&(x({type:"editroom",prev:r,value:e}),storage.set(h,e));}get currentLocation(){return this.currentRoom?.location}get currentMap(){return this.currentRoom?.location.map}clearExpiredActivities(){RegisteredRooms.values().forEach(e=>{e.clearExpiredActivities();});}};var N=class{get quests(){return RegisteredQuests.values()}get startedQuests(){return this.quests.filter(e=>e.started)}get inProgressQuests(){return this.quests.filter(e=>e.inProgress)}get completedQuests(){return this.quests.filter(e=>e.completed)}get failedQuests(){return this.quests.filter(e=>e.failed)}get notStartedQuests(){return this.quests.filter(e=>!e.started)}find(e){return RegisteredQuests.get(e)}async startsStageMustBeStarted(e){let t=this.quests.map(r=>r.currentStageMustStart?r.startCurrentStage(e):Promise.resolve());await Promise.all(t);}};var V="___nqtr-temporary_commitment___",Q=class{get temporaryRoutine(){let e=storage.get(V);if(e){if(Array.isArray(e)){if(e.length>0)throw new PixiError("obsolete_save","The save you loaded is not compatible with the current version of NQTR. Please delete the save and start a new game.");return {}}}else return {};return e}get commitmentsIds(){return [...fixedCommitments.keys(),...Object.keys(this.temporaryRoutine)]}add(e,t,r={}){Array.isArray(e)||(e=[e]);let i=this.temporaryRoutine;e.forEach(n=>{let o=typeof n=="string"?n:n.id;i[o]={id:o,roomId:t,...r};}),storage.set(V,i);}find(e){return RegisteredCommitments.get(e)}remove(e,t){typeof e!="string"&&(e=e.id);let r=this.temporaryRoutine;r[e]?(!t||r[e].roomId===t)&&delete r[e]:d.warn(`The commitment ${e} was not found in the temporary routine, so it will be ignored. If you want to remove a fixed commitment, you can add it to the temporary routine with a same character.`),storage.set(V,r);}clearExpiredRoutine(){RegisteredCommitments.values().forEach(e=>{e.expired&&this.remove(e);});}get characterCommitments(){let e=this.temporaryRoutine;return this.commitmentsIds.reduce((t,r)=>{let i=RegisteredCommitments.get(r),n=e[r],o=n?.roomId||fixedCommitments.get(r);return o&&i?.isActive(n)&&(i.characters.length>0?i.characters.every(f=>!t[f.id]||i.priority>t[f.id][0].priority)&&i.characters.forEach(f=>{t[f.id]=[i,o];}):d.error(`The commitment ${i.id} has no characters assigned`)),t},{})}get currentRoutine(){return Object.values(this.characterCommitments).map(([e])=>e)}get roomCommitments(){return Object.values(this.characterCommitments).reduce((e,t)=>{let r=t[1];return e[r]||(e[r]=[]),e[r].push(t[0]),e},{})}getCommitmentByCharacter(e){let t=typeof e=="string"?e:e.id;return this.currentRoutine.find(r=>{if(r.characters.map(i=>i.id).includes(t))return r})}};var Ve={dayStartTime:0,dayEndTime:24,defaultTimeSpent:1,timeSlots:[],weekLength:7,weekendStartDay:6,getDayName:void 0},c=Ve;var M=class{initialize(e){let{dayStartTime:t=0,dayEndTime:r=24,defaultTimeSpent:i=1,timeSlots:n=[],weekLength:o=7,weekendStartDay:u=o-1,getDayName:f}=e;c.dayStartTime=t,c.dayEndTime=r,c.defaultTimeSpent=i,c.timeSlots=n,c.weekLength=o,u>=c.weekLength?console.warn(`[NQTR] Weekend start day should be less than week length ${o}, so will be ignored`):c.weekendStartDay=u,c.getDayName=f;}get dayStartTime(){return c.dayStartTime}get dayEndTime(){return c.dayEndTime}get defaultTimeSpent(){return c.defaultTimeSpent}get timeSlots(){return c.timeSlots}get weekLength(){return c.weekLength}get weekendStartDay(){return c.weekendStartDay}get getDayName(){return c.getDayName}get currentTime(){let e=storage.get(m)||{};return Object.hasOwn(e,"currentTime")&&typeof e.currentTime=="number"?e.currentTime:this.dayStartTime}set currentTime(e){let t=storage.get(m)||{},r={...t};typeof e=="number"?r.currentTime=e:delete r.currentTime,x({type:"edittime",prev:t,value:r}),storage.set(m,r);}get currentDate(){let e=storage.get(m)||{};return Object.hasOwn(e,"currentDate")&&typeof e.currentDate=="number"?e.currentDate:0}set currentDate(e){let t=storage.get(m)||{},r={...t};typeof e=="number"?r.currentDate=e:delete r.currentDate,x({type:"edittime",prev:t,value:r}),storage.set(m,r);}get isWeekend(){return this.currentWeekDayNumber>=this.weekendStartDay}get currentWeekDayNumber(){return this.currentDate%this.weekLength+1}get currentDayName(){return this.getDayName?this.getDayName(this.currentWeekDayNumber-1):(console.warn("[NQTR] Week days names are not defined, so currentDayName will be empty"),"")}get currentTimeSlot(){if(this.timeSlots.length===0)return console.warn("[NQTR] Time slots are not defined"),0;for(let e=0;e<this.timeSlots.length;e++){let t=this.timeSlots[e];if(this.timeSlots.length>e+1&&this.nowIsBetween(t.startTime,this.timeSlots[e+1].startTime))return e}return this.timeSlots.length-1}increaseTime(e=this.defaultTimeSpent){let t=this.currentTime+e;return t>=this.dayEndTime&&(this.increaseDate(),t=this.dayStartTime+(t-this.dayEndTime)),this.currentTime=t,this.currentTime}increaseDate(e=1,t=this.dayStartTime){let r=this.currentDate+e;return this.currentDate=r,this.currentTime=t,this.currentDate}nowIsBetween(e,t){e===void 0&&(e=this.dayStartTime-1),t===void 0&&(t=this.dayEndTime+1);let r=this.currentTime;return e<t?r>=e&&r<t:r>=e||r<t}};var Je=new M,Xe=new O,Ze=new Q,et=new N;var rt={testing:F,...G,...Se,...Te,handlers:J,registries:tt},ti=rt;export{_ as ActivityBaseModel,l as ActivityStoredClass,C as CommitmentBaseModel,y as CommitmentStoredClass,P as LocationBaseModel,v as LocationStoredClass,w as MapBaseModel,I as MapStoredClass,D as QuestBaseModel,T as QuestStoredClass,E as RoomBaseModel,S as RoomStoredClass,q as StageBaseModel,R as StageStoredClass,ti as default,F as testing};
@@ -1,4 +1,4 @@
1
- import { A as ActivityInterface, C as CommitmentInterface, h as LocationInterface, M as MapInterface, Q as QuestInterface, R as RoomInterface } from './StageInterface-B8NCX3T6.mjs';
1
+ import { ActivityInterface, CommitmentInterface, LocationInterface, MapInterface, QuestInterface, RoomInterface } from './index.mjs';
2
2
  import { CachedMap } from '@drincs/pixi-vn';
3
3
  import '@drincs/pixi-vn/storage';
4
4
  import '@drincs/nqtr/registries';
@@ -298,4 +298,5 @@ declare namespace RegisteredRooms {
298
298
  function clear(): void;
299
299
  }
300
300
 
301
- export { type ActivityIdType, type CommitmentIdType, type LocationIdType, type MapIdType, type NqtrActivityIds, type NqtrCommitmentIds, type NqtrLocationIds, type NqtrMapIds, type NqtrQuestIds, type NqtrRoomIds, type QuestIdType, RegisteredActivities, RegisteredCommitments, RegisteredLocations, RegisteredMaps, RegisteredQuest as RegisteredQuests, RegisteredRooms, type RoomIdType, fixedCommitments, registeredActivities, registeredCommitments, registeredLocations, registeredMaps, registeredQuests, registeredRooms };
301
+ export { RegisteredActivities, RegisteredCommitments, RegisteredLocations, RegisteredMaps, RegisteredQuest as RegisteredQuests, RegisteredRooms, fixedCommitments, registeredActivities, registeredCommitments, registeredLocations, registeredMaps, registeredQuests, registeredRooms };
302
+ export type { ActivityIdType, CommitmentIdType, LocationIdType, MapIdType, NqtrActivityIds, NqtrCommitmentIds, NqtrLocationIds, NqtrMapIds, NqtrQuestIds, NqtrRoomIds, QuestIdType, RoomIdType };
@@ -1,4 +1,4 @@
1
- import { A as ActivityInterface, C as CommitmentInterface, h as LocationInterface, M as MapInterface, Q as QuestInterface, R as RoomInterface } from './StageInterface-B8NCX3T6.js';
1
+ import { ActivityInterface, CommitmentInterface, LocationInterface, MapInterface, QuestInterface, RoomInterface } from './index.js';
2
2
  import { CachedMap } from '@drincs/pixi-vn';
3
3
  import '@drincs/pixi-vn/storage';
4
4
  import '@drincs/nqtr/registries';
@@ -298,4 +298,5 @@ declare namespace RegisteredRooms {
298
298
  function clear(): void;
299
299
  }
300
300
 
301
- export { type ActivityIdType, type CommitmentIdType, type LocationIdType, type MapIdType, type NqtrActivityIds, type NqtrCommitmentIds, type NqtrLocationIds, type NqtrMapIds, type NqtrQuestIds, type NqtrRoomIds, type QuestIdType, RegisteredActivities, RegisteredCommitments, RegisteredLocations, RegisteredMaps, RegisteredQuest as RegisteredQuests, RegisteredRooms, type RoomIdType, fixedCommitments, registeredActivities, registeredCommitments, registeredLocations, registeredMaps, registeredQuests, registeredRooms };
301
+ export { RegisteredActivities, RegisteredCommitments, RegisteredLocations, RegisteredMaps, RegisteredQuest as RegisteredQuests, RegisteredRooms, fixedCommitments, registeredActivities, registeredCommitments, registeredLocations, registeredMaps, registeredQuests, registeredRooms };
302
+ export type { ActivityIdType, CommitmentIdType, LocationIdType, MapIdType, NqtrActivityIds, NqtrCommitmentIds, NqtrLocationIds, NqtrMapIds, NqtrQuestIds, NqtrRoomIds, QuestIdType, RoomIdType };
package/dist/vite.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var Ge=require('fs'),path=require('path'),url=require('url'),module$1=require('module');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Ge__namespace=/*#__PURE__*/_interopNamespace(Ge);var Le=Object.create;var Pt=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var we=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty;var J=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Pe=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of we(e))!Te.call(t,n)&&n!==s&&Pt(t,n,{get:()=>e[n],enumerable:!(r=Ie(e,n))||r.enumerable});return t};var Ht=(t,e,s)=>(s=t!=null?Le(Oe(t)):{},Pe(e||!t||!t.__esModule?Pt(s,"default",{value:t,enumerable:true}):s,t));var Dt=J((tn,yt)=>{var ht=process||{},kt=ht.argv||[],ft=ht.env||{},He=!(ft.NO_COLOR||kt.includes("--no-color"))&&(!!ft.FORCE_COLOR||kt.includes("--color")||ht.platform==="win32"||(ht.stdout||{}).isTTY&&ft.TERM!=="dumb"||!!ft.CI),ke=(t,e,s=t)=>r=>{let n=""+r,i=n.indexOf(e,t.length);return ~i?t+Ne(n,e,s,i)+e:t+n+e},Ne=(t,e,s,r)=>{let n="",i=0;do n+=t.substring(i,r)+s,i=r+e.length,r=t.indexOf(e,i);while(~r);return n+t.substring(i)},Nt=(t=He)=>{let e=t?ke:()=>String;return {isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};yt.exports=Nt();yt.exports.createColors=Nt;});var ut=J((pn,Zt)=>{var zt="[^\\\\/]",Ns="(?=.)",Yt="[^/]",At="(?:\\/|$)",Vt="(?:^|\\/)",St=`\\.{1,2}${At}`,Ds="(?!\\.)",Bs=`(?!${Vt}${St})`,Ms=`(?!\\.{0,1}${At})`,qs=`(?!${St})`,Fs="[^.\\/]",Gs=`${Yt}*?`,Ws="/",Jt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:Ns,QMARK:Yt,END_ANCHOR:At,DOTS_SLASH:St,NO_DOT:Ds,NO_DOTS:Bs,NO_DOT_SLASH:Ms,NO_DOTS_SLASH:qs,QMARK_NO_DOT:Fs,STAR:Gs,START_ANCHOR:Vt,SEP:Ws},Us={...Jt,SLASH_LITERAL:"[\\\\/]",QMARK:zt,STAR:`${zt}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Ks={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Zt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Ks,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===true?Us:Jt}};});var at=J(U=>{var{REGEX_BACKSLASH:Xs,REGEX_REMOVE_BACKSLASH:Qs,REGEX_SPECIAL_CHARS:js,REGEX_SPECIAL_CHARS_GLOBAL:zs}=ut();U.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);U.hasRegexChars=t=>js.test(t);U.isRegexChar=t=>t.length===1&&U.hasRegexChars(t);U.escapeRegex=t=>t.replace(zs,"\\$1");U.toPosixSlashes=t=>t.replace(Xs,"/");U.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":false};U.removeBackslashes=t=>t.replace(Qs,e=>e==="\\"?"":e);U.escapeLast=(t,e,s)=>{let r=t.lastIndexOf(e,s);return r===-1?t:t[r-1]==="\\"?U.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`};U.removePrefix=(t,e={})=>{let s=t;return s.startsWith("./")&&(s=s.slice(2),e.prefix="./"),s};U.wrapOutput=(t,e={},s={})=>{let r=s.contains?"":"^",n=s.contains?"":"$",i=`${r}(?:${t})${n}`;return e.negated===true&&(i=`(?:^(?!${i}).*$)`),i};U.basename=(t,{windows:e}={})=>{let s=t.split(e?/[\\/]/:"/"),r=s[s.length-1];return r===""?s[s.length-2]:r};});var ue=J((hn,oe)=>{var te=at(),{CHAR_ASTERISK:_t,CHAR_AT:Ys,CHAR_BACKWARD_SLASH:st,CHAR_COMMA:Vs,CHAR_DOT:Et,CHAR_EXCLAMATION_MARK:vt,CHAR_FORWARD_SLASH:ie,CHAR_LEFT_CURLY_BRACE:Ct,CHAR_LEFT_PARENTHESES:gt,CHAR_LEFT_SQUARE_BRACKET:Js,CHAR_PLUS:Zs,CHAR_QUESTION_MARK:ee,CHAR_RIGHT_CURLY_BRACE:tr,CHAR_RIGHT_PARENTHESES:se,CHAR_RIGHT_SQUARE_BRACKET:er}=ut(),re=t=>t===ie||t===st,ne=t=>{t.isPrefix!==true&&(t.depth=t.isGlobstar?1/0:1);},sr=(t,e)=>{let s=e||{},r=t.length-1,n=s.parts===true||s.tokens===true||s.scanToEnd===true,i=[],o=[],l=[],b=t,x=-1,y=0,R=0,_=false,E=false,A=false,g=false,p=false,m=false,d=false,q=false,F=false,O=false,I=0,L,S,$={value:"",depth:0,isGlob:false},u=()=>x>=r,G=()=>b.charCodeAt(x+1),D=()=>(L=S,b.charCodeAt(++x));for(;x<r;){S=D();let w;if(S===st){d=$.backslashes=true,S=D(),S===Ct&&(m=true);continue}if(m===true||S===Ct){for(I++;u()!==true&&(S=D());){if(S===st){d=$.backslashes=true,D();continue}if(S===Ct){I++;continue}if(m!==true&&S===Et&&(S=D())===Et){if(_=$.isBrace=true,A=$.isGlob=true,O=true,n===true)continue;break}if(m!==true&&S===Vs){if(_=$.isBrace=true,A=$.isGlob=true,O=true,n===true)continue;break}if(S===tr&&(I--,I===0)){m=false,_=$.isBrace=true,O=true;break}}if(n===true)continue;break}if(S===ie){if(i.push(x),o.push($),$={value:"",depth:0,isGlob:false},O===true)continue;if(L===Et&&x===y+1){y+=2;continue}R=x+1;continue}if(s.noext!==true&&(S===Zs||S===Ys||S===_t||S===ee||S===vt)===true&&G()===gt){if(A=$.isGlob=true,g=$.isExtglob=true,O=true,S===vt&&x===y&&(F=true),n===true){let K=0;for(;u()!==true&&(S=D());){if(S===st){d=$.backslashes=true,D();continue}if(S===gt){K++;continue}if(S===se&&--K===0){O=true;break}}continue}break}if(S===_t){if(L===_t&&(p=$.isGlobstar=true),A=$.isGlob=true,O=true,n===true)continue;break}if(S===ee){if(A=$.isGlob=true,O=true,n===true)continue;break}if(S===Js){for(;u()!==true&&(w=D());){if(w===st){d=$.backslashes=true,D();continue}if(w===er){E=$.isBracket=true,A=$.isGlob=true,O=true;break}}if(n===true)continue;break}if(s.nonegate!==true&&S===vt&&x===y){q=$.negated=true,y++;continue}if(s.noparen!==true&&S===gt){if(A=$.isGlob=true,n===true){let W=1;for(;u()!==true&&(S=D());){if(S===st){d=$.backslashes=true,D();continue}if(S===gt){W++;continue}if(S===se&&--W===0){O=true;break}}continue}break}if(A===true){if(O=true,n===true)continue;break}}s.noext===true&&(g=false,A=false);let k=b,c="",a="";y>0&&(c=b.slice(0,y),b=b.slice(y),R-=y),k&&A===true&&R>0?(k=b.slice(0,R),a=b.slice(R)):A===true?(k="",a=b):k=b,k&&k!==""&&k!=="/"&&k!==b&&re(k.charCodeAt(k.length-1))&&(k=k.slice(0,-1)),s.unescape===true&&(a&&(a=te.removeBackslashes(a)),k&&d===true&&(k=te.removeBackslashes(k)));let Q={prefix:c,input:t,start:y,base:k,glob:a,isBrace:_,isBracket:E,isGlob:A,isExtglob:g,isGlobstar:p,negated:q,negatedExtglob:F};if(s.tokens===true&&(Q.maxDepth=0,re(S)||o.push($),Q.tokens=o),s.parts===true||s.tokens===true){let w;for(let B=0;B<i.length;B++){let tt=w!==void 0?w+1:y,ot=i[B],Y=t.slice(tt,ot);s.tokens&&(B===0&&y!==0?(o[B].isPrefix=true,o[B].value=c):o[B].value=Y,ne(o[B]),Q.maxDepth+=o[B].depth),ot>=y&&(l.push(Y),w=ot);}let W=w!==void 0?w+1:y,K=t.slice(W);l.push(K),s.tokens&&w&&w+1<t.length&&(o[o.length-1].value=K,ne(o[o.length-1]),Q.maxDepth+=o[o.length-1].depth),Q.slashes=i,Q.parts=l;}return Q};oe.exports=sr;});var pe=J((dn,le)=>{var ct=ut(),X=at(),{MAX_LENGTH:mt,POSIX_REGEX_SOURCE:rr,REGEX_NON_SPECIAL_CHARS:nr,REGEX_SPECIAL_CHARS_BACKREF:ir,REPLACEMENTS:ae}=ct,or=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let s=`[${t.join("-")}]`;try{new RegExp(s);}catch{return t.map(n=>X.escapeRegex(n)).join("..")}return s},rt=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,ce=t=>{let e=[],s=0,r=0,n=0,i="",o=false;for(let l of t){if(o===true){i+=l,o=false;continue}if(l==="\\"){i+=l,o=true;continue}if(l==='"'){n=n===1?0:1,i+=l;continue}if(n===0){if(l==="[")s++;else if(l==="]"&&s>0)s--;else if(s===0){if(l==="(")r++;else if(l===")"&&r>0)r--;else if(l==="|"&&r===0){e.push(i),i="";continue}}}i+=l;}return e.push(i),e},ur=t=>{let e=false;for(let s of t){if(e===true){e=false;continue}if(s==="\\"){e=true;continue}if(/[?*+@!()[\]{}]/.test(s))return false}return true},Lt=t=>{let e=t.trim(),s=true;for(;s===true;)s=false,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),s=true);if(ur(e))return e.replace(/\\(.)/g,"$1")},ar=t=>{let e=t.map(Lt).filter(Boolean);for(let s=0;s<e.length;s++)for(let r=s+1;r<e.length;r++){let n=e[s],i=e[r],o=n[0];if(!(!o||n!==o.repeat(n.length)||i!==o.repeat(i.length))&&(n===i||n.startsWith(i)||i.startsWith(n)))return true}return false},$t=(t,e=true)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let s=0,r=0,n=0,i=false;for(let o=1;o<t.length;o++){let l=t[o];if(i===true){i=false;continue}if(l==="\\"){i=true;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){s++;continue}if(l==="]"&&s>0){s--;continue}if(!(s>0)){if(l==="("){r++;continue}if(l===")"&&(r--,r===0))return e===true&&o!==t.length-1?void 0:{type:t[0],body:t.slice(2,o),end:o}}}}},cr=t=>`${t.length===1?X.escapeRegex(t[0]):`[${t.map(s=>X.escapeRegex(s)).join("")}]`}*`,lr=t=>{let e=0,s=[];for(;e<t.length;){let r=$t(t.slice(e),false);if(!r||r.type!=="*")return;let n=ce(r.body).map(o=>o.trim());if(n.length!==1)return;let i=Lt(n[0]);if(!i||i.length!==1)return;s.push(i),e+=r.end+1;}if(!(s.length<1))return s},pr=t=>{let e=0,s=t.trim(),r=$t(s);for(;r;)e++,s=r.body.trim(),r=$t(s);return e},fr=(t,e)=>{if(e.maxExtglobRecursion===false)return {risky:false};let s=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ct.DEFAULT_MAX_EXTGLOB_RECURSION,r=ce(t).map(l=>l.trim());if(r.length>1&&(r.some(l=>l==="")||r.some(l=>/^[*?]+$/.test(l))||ar(r)))return {risky:true};let n=[],i=false,o=true;for(let l of r){let b=lr(l);if(b){i=true,n.push(...b);continue}let x=Lt(l);if(x&&x.length===1){n.push(x);continue}if(o=false,pr(l)>s)return {risky:true}}return i?o?{risky:true,safeOutput:cr([...new Set(n)])}:{risky:true}:{risky:false}},It=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=ae[t]||t;let s={...e},r=typeof s.maxLength=="number"?Math.min(mt,s.maxLength):mt,n=t.length;if(n>r)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${r}`);let i={type:"bos",value:"",output:s.prepend||""},o=[i],l=s.capture?"":"?:",b=ct.globChars(s.windows),x=ct.extglobChars(b),{DOT_LITERAL:y,PLUS_LITERAL:R,SLASH_LITERAL:_,ONE_CHAR:E,DOTS_SLASH:A,NO_DOT:g,NO_DOT_SLASH:p,NO_DOTS_SLASH:m,QMARK:d,QMARK_NO_DOT:q,STAR:F,START_ANCHOR:O}=b,I=h=>`(${l}(?:(?!${O}${h.dot?A:y}).)*?)`,L=s.dot?"":g,S=s.dot?d:q,$=s.bash===true?I(s):F;s.capture&&($=`(${$})`),typeof s.noext=="boolean"&&(s.noextglob=s.noext);let u={input:t,index:-1,start:0,dot:s.dot===true,consumed:"",output:"",prefix:"",backtrack:false,negated:false,brackets:0,braces:0,parens:0,quotes:0,globstar:false,tokens:o};t=X.removePrefix(t,u),n=t.length;let G=[],D=[],k=[],c=i,a,Q=()=>u.index===n-1,w=u.peek=(h=1)=>t[u.index+h],W=u.advance=()=>t[++u.index]||"",K=()=>t.slice(u.index+1),B=(h="",H=0)=>{u.consumed+=h,u.index+=H;},tt=h=>{u.output+=h.output!=null?h.output:h.value,B(h.value);},ot=()=>{let h=1;for(;w()==="!"&&(w(2)!=="("||w(3)==="?");)W(),u.start++,h++;return h%2===0?false:(u.negated=true,u.start++,true)},Y=h=>{u[h]++,k.push(h);},z=h=>{u[h]--,k.pop();},v=h=>{if(c.type==="globstar"){let H=u.braces>0&&(h.type==="comma"||h.type==="brace"),f=h.extglob===true||G.length&&(h.type==="pipe"||h.type==="paren");h.type!=="slash"&&h.type!=="paren"&&!H&&!f&&(u.output=u.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=$,u.output+=c.output);}if(G.length&&h.type!=="paren"&&(G[G.length-1].inner+=h.value),(h.value||h.output)&&tt(h),c&&c.type==="text"&&h.type==="text"){c.output=(c.output||c.value)+h.value,c.value+=h.value;return}h.prev=c,o.push(h),c=h;},pt=(h,H)=>{let f={...x[H],conditions:1,inner:""};f.prev=c,f.parens=u.parens,f.output=u.output,f.startIndex=u.index,f.tokensIndex=o.length;let C=(s.capture?"(":"")+f.open;Y("parens"),v({type:h,value:H,output:u.output?"":E}),v({type:"paren",extglob:true,value:W(),output:C}),G.push(f);},$e=h=>{let H=t.slice(h.startIndex,u.index+1),f=t.slice(h.startIndex+2,u.index),C=fr(f,s);if((h.type==="plus"||h.type==="star")&&C.risky){let T=C.safeOutput?(h.output?"":E)+(s.capture?`(${C.safeOutput})`:C.safeOutput):void 0,j=o[h.tokensIndex];j.type="text",j.value=H,j.output=T||X.escapeRegex(H);for(let V=h.tokensIndex+1;V<o.length;V++)o[V].value="",o[V].output="",delete o[V].suffix;u.output=h.output+j.output,u.backtrack=true,v({type:"paren",extglob:true,value:a,output:""}),z("parens");return}let P=h.close+(s.capture?")":""),M;if(h.type==="negate"){let T=$;if(h.inner&&h.inner.length>1&&h.inner.includes("/")&&(T=I(s)),(T!==$||Q()||/^\)+$/.test(K()))&&(P=h.close=`)$))${T}`),h.inner.includes("*")&&(M=K())&&/^\.[^\\/.]+$/.test(M)){let j=It(M,{...e,fastpaths:false}).output;P=h.close=`)${j})${T})`;}h.prev.type==="bos"&&(u.negatedExtglob=true);}v({type:"paren",extglob:true,value:a,output:P}),z("parens");};if(s.fastpaths!==false&&!/(^[*!]|[/()[\]{}"])/.test(t)){let h=false,H=t.replace(ir,(f,C,P,M,T,j)=>M==="\\"?(h=true,f):M==="?"?C?C+M+(T?d.repeat(T.length):""):j===0?S+(T?d.repeat(T.length):""):d.repeat(P.length):M==="."?y.repeat(P.length):M==="*"?C?C+M+(T?$:""):$:C?f:`\\${f}`);return h===true&&(s.unescape===true?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,f=>f.length%2===0?"\\\\":f?"\\":"")),H===t&&s.contains===true?(u.output=t,u):(u.output=X.wrapOutput(H,u,e),u)}for(;!Q();){if(a=W(),a==="\0")continue;if(a==="\\"){let f=w();if(f==="/"&&s.bash!==true||f==="."||f===";")continue;if(!f){a+="\\",v({type:"text",value:a});continue}let C=/^\\+/.exec(K()),P=0;if(C&&C[0].length>2&&(P=C[0].length,u.index+=P,P%2!==0&&(a+="\\")),s.unescape===true?a=W():a+=W(),u.brackets===0){v({type:"text",value:a});continue}}if(u.brackets>0&&(a!=="]"||c.value==="["||c.value==="[^")){if(s.posix!==false&&a===":"){let f=c.value.slice(1);if(f.includes("[")&&(c.posix=true,f.includes(":"))){let C=c.value.lastIndexOf("["),P=c.value.slice(0,C),M=c.value.slice(C+2),T=rr[M];if(T){c.value=P+T,u.backtrack=true,W(),!i.output&&o.indexOf(c)===1&&(i.output=E);continue}}}(a==="["&&w()!==":"||a==="-"&&w()==="]")&&(a=`\\${a}`),a==="]"&&(c.value==="["||c.value==="[^")&&(a=`\\${a}`),s.posix===true&&a==="!"&&c.value==="["&&(a="^"),c.value+=a,tt({value:a});continue}if(u.quotes===1&&a!=='"'){a=X.escapeRegex(a),c.value+=a,tt({value:a});continue}if(a==='"'){u.quotes=u.quotes===1?0:1,s.keepQuotes===true&&v({type:"text",value:a});continue}if(a==="("){Y("parens"),v({type:"paren",value:a});continue}if(a===")"){if(u.parens===0&&s.strictBrackets===true)throw new SyntaxError(rt("opening","("));let f=G[G.length-1];if(f&&u.parens===f.parens+1){$e(G.pop());continue}v({type:"paren",value:a,output:u.parens?")":"\\)"}),z("parens");continue}if(a==="["){if(s.nobracket===true||!K().includes("]")){if(s.nobracket!==true&&s.strictBrackets===true)throw new SyntaxError(rt("closing","]"));a=`\\${a}`;}else Y("brackets");v({type:"bracket",value:a});continue}if(a==="]"){if(s.nobracket===true||c&&c.type==="bracket"&&c.value.length===1){v({type:"text",value:a,output:`\\${a}`});continue}if(u.brackets===0){if(s.strictBrackets===true)throw new SyntaxError(rt("opening","["));v({type:"text",value:a,output:`\\${a}`});continue}z("brackets");let f=c.value.slice(1);if(c.posix!==true&&f[0]==="^"&&!f.includes("/")&&(a=`/${a}`),c.value+=a,tt({value:a}),s.literalBrackets===false||X.hasRegexChars(f))continue;let C=X.escapeRegex(c.value);if(u.output=u.output.slice(0,-c.value.length),s.literalBrackets===true){u.output+=C,c.value=C;continue}c.value=`(${l}${C}|${c.value})`,u.output+=c.value;continue}if(a==="{"&&s.nobrace!==true){Y("braces");let f={type:"brace",value:a,output:"(",outputIndex:u.output.length,tokensIndex:u.tokens.length};D.push(f),v(f);continue}if(a==="}"){let f=D[D.length-1];if(s.nobrace===true||!f){v({type:"text",value:a,output:a});continue}let C=")";if(f.dots===true){let P=o.slice(),M=[];for(let T=P.length-1;T>=0&&(o.pop(),P[T].type!=="brace");T--)P[T].type!=="dots"&&M.unshift(P[T].value);C=or(M,s),u.backtrack=true;}if(f.comma!==true&&f.dots!==true){let P=u.output.slice(0,f.outputIndex),M=u.tokens.slice(f.tokensIndex);f.value=f.output="\\{",a=C="\\}",u.output=P;for(let T of M)u.output+=T.output||T.value;}v({type:"brace",value:a,output:C}),z("braces"),D.pop();continue}if(a==="|"){G.length>0&&G[G.length-1].conditions++,v({type:"text",value:a});continue}if(a===","){let f=a,C=D[D.length-1];C&&k[k.length-1]==="braces"&&(C.comma=true,f="|"),v({type:"comma",value:a,output:f});continue}if(a==="/"){if(c.type==="dot"&&u.index===u.start+1){u.start=u.index+1,u.consumed="",u.output="",o.pop(),c=i;continue}v({type:"slash",value:a,output:_});continue}if(a==="."){if(u.braces>0&&c.type==="dot"){c.value==="."&&(c.output=y);let f=D[D.length-1];c.type="dots",c.output+=a,c.value+=a,f.dots=true;continue}if(u.braces+u.parens===0&&c.type!=="bos"&&c.type!=="slash"){v({type:"text",value:a,output:y});continue}v({type:"dot",value:a,output:y});continue}if(a==="?"){if(!(c&&c.value==="(")&&s.noextglob!==true&&w()==="("&&w(2)!=="?"){pt("qmark",a);continue}if(c&&c.type==="paren"){let C=w(),P=a;(c.value==="("&&!/[!=<:]/.test(C)||C==="<"&&!/<([!=]|\w+>)/.test(K()))&&(P=`\\${a}`),v({type:"text",value:a,output:P});continue}if(s.dot!==true&&(c.type==="slash"||c.type==="bos")){v({type:"qmark",value:a,output:q});continue}v({type:"qmark",value:a,output:d});continue}if(a==="!"){if(s.noextglob!==true&&w()==="("&&(w(2)!=="?"||!/[!=<:]/.test(w(3)))){pt("negate",a);continue}if(s.nonegate!==true&&u.index===0){ot();continue}}if(a==="+"){if(s.noextglob!==true&&w()==="("&&w(2)!=="?"){pt("plus",a);continue}if(c&&c.value==="("||s.regex===false){v({type:"plus",value:a,output:R});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||u.parens>0){v({type:"plus",value:a});continue}v({type:"plus",value:R});continue}if(a==="@"){if(s.noextglob!==true&&w()==="("&&w(2)!=="?"){v({type:"at",extglob:true,value:a,output:""});continue}v({type:"text",value:a});continue}if(a!=="*"){(a==="$"||a==="^")&&(a=`\\${a}`);let f=nr.exec(K());f&&(a+=f[0],u.index+=f[0].length),v({type:"text",value:a});continue}if(c&&(c.type==="globstar"||c.star===true)){c.type="star",c.star=true,c.value+=a,c.output=$,u.backtrack=true,u.globstar=true,B(a);continue}let h=K();if(s.noextglob!==true&&/^\([^?]/.test(h)){pt("star",a);continue}if(c.type==="star"){if(s.noglobstar===true){B(a);continue}let f=c.prev,C=f.prev,P=f.type==="slash"||f.type==="bos",M=C&&(C.type==="star"||C.type==="globstar");if(s.bash===true&&(!P||h[0]&&h[0]!=="/")){v({type:"star",value:a,output:""});continue}let T=u.braces>0&&(f.type==="comma"||f.type==="brace"),j=G.length&&(f.type==="pipe"||f.type==="paren");if(!P&&f.type!=="paren"&&!T&&!j){v({type:"star",value:a,output:""});continue}for(;h.slice(0,3)==="/**";){let et=t[u.index+4];if(et&&et!=="/")break;h=h.slice(3),B("/**",3);}let V=Q()||u.parens>0&&h===")".repeat(u.parens)&&!G.some(et=>et.type==="negate");if(f.type==="bos"&&Q()){c.type="globstar",c.value+=a,c.output=I(s),u.output=c.output,u.globstar=true,B(a);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&!M&&V){u.output=u.output.slice(0,-(f.output+c.output).length),f.output=`(?:${f.output}`,c.type="globstar",c.output=I(s)+(s.strictSlashes?")":"|$)"),c.value+=a,u.globstar=true,u.output+=f.output+c.output,B(a);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&h[0]==="/"){let et=h[1]!==void 0?"|$":"";u.output=u.output.slice(0,-(f.output+c.output).length),f.output=`(?:${f.output}`,c.type="globstar",c.output=`${I(s)}${_}|${_}${et})`,c.value+=a,u.output+=f.output+c.output,u.globstar=true,B(a+W()),v({type:"slash",value:"/",output:""});continue}if(f.type==="bos"&&h[0]==="/"){c.type="globstar",c.value+=a,c.output=`(?:^|${_}|${I(s)}${_})`,u.output=c.output,u.globstar=true,B(a+W()),v({type:"slash",value:"/",output:""});continue}u.output=u.output.slice(0,-c.output.length),c.type="globstar",c.output=I(s),c.value+=a,u.output+=c.output,u.globstar=true,B(a);continue}let H={type:"star",value:a,output:$};if(s.bash===true){H.output=".*?",(c.type==="bos"||c.type==="slash")&&(H.output=L+H.output),v(H);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&s.regex===true){H.output=a,v(H);continue}(u.index===u.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(u.output+=p,c.output+=p):s.dot===true?(u.output+=m,c.output+=m):(u.output+=L,c.output+=L),w()!=="*"&&(u.output+=E,c.output+=E)),v(H);}for(;u.brackets>0;){if(s.strictBrackets===true)throw new SyntaxError(rt("closing","]"));u.output=X.escapeLast(u.output,"["),z("brackets");}for(;u.parens>0;){if(s.strictBrackets===true)throw new SyntaxError(rt("closing",")"));u.output=X.escapeLast(u.output,"("),z("parens");}for(;u.braces>0;){if(s.strictBrackets===true)throw new SyntaxError(rt("closing","}"));u.output=X.escapeLast(u.output,"{"),z("braces");}if(s.strictSlashes!==true&&(c.type==="star"||c.type==="bracket")&&v({type:"maybe_slash",value:"",output:`${_}?`}),u.backtrack===true){u.output="";for(let h of u.tokens)u.output+=h.output!=null?h.output:h.value,h.suffix&&(u.output+=h.suffix);}return u};It.fastpaths=(t,e)=>{let s={...e},r=typeof s.maxLength=="number"?Math.min(mt,s.maxLength):mt,n=t.length;if(n>r)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${r}`);t=ae[t]||t;let{DOT_LITERAL:i,SLASH_LITERAL:o,ONE_CHAR:l,DOTS_SLASH:b,NO_DOT:x,NO_DOTS:y,NO_DOTS_SLASH:R,STAR:_,START_ANCHOR:E}=ct.globChars(s.windows),A=s.dot?y:x,g=s.dot?R:x,p=s.capture?"":"?:",m={negated:false,prefix:""},d=s.bash===true?".*?":_;s.capture&&(d=`(${d})`);let q=L=>L.noglobstar===true?d:`(${p}(?:(?!${E}${L.dot?b:i}).)*?)`,F=L=>{switch(L){case "*":return `${A}${l}${d}`;case ".*":return `${i}${l}${d}`;case "*.*":return `${A}${d}${i}${l}${d}`;case "*/*":return `${A}${d}${o}${l}${g}${d}`;case "**":return A+q(s);case "**/*":return `(?:${A}${q(s)}${o})?${g}${l}${d}`;case "**/*.*":return `(?:${A}${q(s)}${o})?${g}${d}${i}${l}${d}`;case "**/.*":return `(?:${A}${q(s)}${o})?${i}${l}${d}`;default:{let S=/^(.*?)\.(\w+)$/.exec(L);if(!S)return;let $=F(S[1]);return $?$+i+S[2]:void 0}}},O=X.removePrefix(t,m),I=F(O);return I&&s.strictSlashes!==true&&(I+=`${o}?`),I};le.exports=It;});var de=J((gn,he)=>{var hr=ue(),wt=pe(),fe=at(),dr=ut(),gr=t=>t&&typeof t=="object"&&!Array.isArray(t),N=(t,e,s=false)=>{if(Array.isArray(t)){let y=t.map(_=>N(_,e,s));return _=>{for(let E of y){let A=E(_);if(A)return A}return false}}let r=gr(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let n=e||{},i=n.windows,o=r?N.compileRe(t,e):N.makeRe(t,e,false,true),l=o.state;delete o.state;let b=()=>false;if(n.ignore){let y={...e,ignore:null,onMatch:null,onResult:null};b=N(n.ignore,y,s);}let x=(y,R=false)=>{let{isMatch:_,match:E,output:A}=N.test(y,o,e,{glob:t,posix:i}),g={glob:t,state:l,regex:o,posix:i,input:y,output:A,match:E,isMatch:_};return typeof n.onResult=="function"&&n.onResult(g),_===false?(g.isMatch=false,R?g:false):b(y)?(typeof n.onIgnore=="function"&&n.onIgnore(g),g.isMatch=false,R?g:false):(typeof n.onMatch=="function"&&n.onMatch(g),R?g:true)};return s&&(x.state=l),x};N.test=(t,e,s,{glob:r,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return {isMatch:false,output:""};let i=s||{},o=i.format||(n?fe.toPosixSlashes:null),l=t===r,b=l&&o?o(t):t;return l===false&&(b=o?o(t):t,l=b===r),(l===false||i.capture===true)&&(i.matchBase===true||i.basename===true?l=N.matchBase(t,e,s,n):l=e.exec(b)),{isMatch:!!l,match:l,output:b}};N.matchBase=(t,e,s,r=s&&s.windows)=>(e instanceof RegExp?e:N.makeRe(e,s)).test(fe.basename(t,{windows:r}));N.isMatch=(t,e,s)=>N(e,s)(t);N.parse=(t,e)=>Array.isArray(t)?t.map(s=>N.parse(s,e)):wt(t,{...e,fastpaths:false});N.scan=(t,e)=>hr(t,e);N.compileRe=(t,e,s=false,r=false)=>{if(s===true)return t.output;let n=e||{},i=n.contains?"":"^",o=n.contains?"":"$",l=`${i}(?:${t.output})${o}`;t&&t.negated===true&&(l=`^(?!${l}).*$`);let b=N.toRegex(l,e);return r===true&&(b.state=t),b};N.makeRe=(t,e={},s=false,r=false)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:false,fastpaths:true};return e.fastpaths!==false&&(t[0]==="."||t[0]==="*")&&(n.output=wt.fastpaths(t,e)),n.output||(n=wt(t,e)),N.compileRe(n,e,s,r)};N.toRegex=(t,e)=>{try{let s=e||{};return new RegExp(t,s.flags||(s.nocase?"i":""))}catch(s){if(e&&e.debug===true)throw s;return /$^/}};N.constants=dr;he.exports=N;});var ye=J((mn,be)=>{var ge=de(),mr=at();function me(t,e,s=false){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:mr.isWindows()}),ge(t,e,s)}Object.assign(me,ge);be.exports=me;});var Tt=Ht(Dt());var Bt=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.cjs', document.baseURI).href)));function We(t){let e=path.normalize(t);return e.length>1&&e[e.length-1]===path.sep&&(e=e.substring(0,e.length-1)),e}var Ue=/[\\/]/g;function Ft(t,e){return t.replace(Ue,e)}var Ke=/^[a-z]:[\\/]$/i;function Xe(t){return t==="/"||Ke.test(t)}function Rt(t,e){let{resolvePaths:s,normalizePath:r,pathSeparator:n}=e,i=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(s&&(t=path.resolve(t)),(r||i)&&(t=We(t)),t===".")return "";let o=t[t.length-1]!==n;return Ft(o?t+n:t,n)}function Gt(t,e){return e+t}function Qe(t,e){return function(s,r){return r.startsWith(t)?r.slice(t.length)+s:Ft(path.relative(t,r),e.pathSeparator)+e.pathSeparator+s}}function je(t){return t}function ze(t,e,s){return e+t+s}function Ye(t,e){let{relativePaths:s,includeBasePath:r}=e;return s&&t?Qe(t,e):r?Gt:je}function Ve(t){return function(e,s){s.push(e.substring(t.length)||".");}}function Je(t){return function(e,s,r){let n=e.substring(t.length)||".";r.every(i=>i(n,true))&&s.push(n);}}var Ze=(t,e)=>{e.push(t||".");},ts=(t,e,s)=>{let r=t||".";s.every(n=>n(r,true))&&e.push(r);},es=()=>{};function ss(t,e){let{includeDirs:s,filters:r,relativePaths:n}=e;return s?n?r&&r.length?Je(t):Ve(t):r&&r.length?ts:Ze:es}var rs=(t,e,s,r)=>{r.every(n=>n(t,false))&&s.files++;},ns=(t,e,s,r)=>{r.every(n=>n(t,false))&&e.push(t);},is=(t,e,s,r)=>{s.files++;},os=(t,e)=>{e.push(t);},us=()=>{};function as(t){let{excludeFiles:e,filters:s,onlyCounts:r}=t;return e?us:s&&s.length?r?rs:ns:r?is:os}var cs=t=>t,ls=()=>[""].slice(0,0);function ps(t){return t.group?ls:cs}var fs=(t,e,s)=>{t.push({directory:e,files:s,dir:e});},hs=()=>{};function ds(t){return t.group?fs:hs}var gs=function(t,e,s){let{queue:r,fs:n,options:{suppressErrors:i}}=e;r.enqueue(),n.realpath(t,(o,l)=>{if(o)return r.dequeue(i?null:o,e);n.stat(l,(b,x)=>{if(b)return r.dequeue(i?null:b,e);if(x.isDirectory()&&Wt(t,l,e))return r.dequeue(null,e);s(x,l),r.dequeue(null,e);});});},ms=function(t,e,s){let{queue:r,fs:n,options:{suppressErrors:i}}=e;r.enqueue();try{let o=n.realpathSync(t),l=n.statSync(o);if(l.isDirectory()&&Wt(t,o,e))return;s(l,o);}catch(o){if(!i)throw o}};function bs(t,e){return !t.resolveSymlinks||t.excludeSymlinks?null:e?ms:gs}function Wt(t,e,s){if(s.options.useRealPaths)return ys(e,s);let r=path.dirname(t),n=1;for(;r!==s.root&&n<2;){let i=s.symlinks.get(r);!!i&&(i===e||i.startsWith(e)||e.startsWith(i))?n++:r=path.dirname(r);}return s.symlinks.set(t,e),n>1}function ys(t,e){return e.visited.includes(t+e.options.pathSeparator)}var Rs=t=>t.counts,xs=t=>t.groups,As=t=>t.paths,Ss=t=>t.paths.slice(0,t.options.maxFiles),_s=(t,e,s)=>(dt(e,s,t.counts,t.options.suppressErrors),null),Es=(t,e,s)=>(dt(e,s,t.paths,t.options.suppressErrors),null),vs=(t,e,s)=>(dt(e,s,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),Cs=(t,e,s)=>(dt(e,s,t.groups,t.options.suppressErrors),null);function dt(t,e,s,r){e(t&&!r?t:null,s);}function $s(t,e){let{onlyCounts:s,group:r,maxFiles:n}=t;return s?e?Rs:_s:r?e?xs:Cs:n?e?Ss:vs:e?As:Es}var Ut={withFileTypes:true},Ls=(t,e,s,r,n)=>{if(t.queue.enqueue(),r<0)return t.queue.dequeue(null,t);let{fs:i}=t;t.visited.push(e),t.counts.directories++,i.readdir(e||".",Ut,(o,l=[])=>{n(l,s,r),t.queue.dequeue(t.options.suppressErrors?null:o,t);});},Is=(t,e,s,r,n)=>{let{fs:i}=t;if(r<0)return;t.visited.push(e),t.counts.directories++;let o=[];try{o=i.readdirSync(e||".",Ut);}catch(l){if(!t.options.suppressErrors)throw l}n(o,s,r);};function ws(t){return t?Is:Ls}var Os=class{count=0;constructor(t){this.onQueueEmpty=t;}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0));}},Ts=class{_files=0;_directories=0;set files(t){this._files=t;}get files(){return this._files}set directories(t){this._directories=t;}get directories(){return this._directories}get dirs(){return this._directories}},Ps=class{aborted=false;abort(){this.aborted=true;}},Kt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,s){this.isSynchronous=!s,this.callbackInvoker=$s(e,this.isSynchronous),this.root=Rt(t,e),this.state={root:Xe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new Ts,options:e,queue:new Os((r,n)=>this.callbackInvoker(n,r,s)),symlinks:new Map,visited:[""].slice(0,0),controller:new Ps,fs:e.fs||Ge__namespace},this.joinPath=Ye(this.root,e),this.pushDirectory=ss(this.root,e),this.pushFile=as(e),this.getArray=ps(e),this.groupFiles=ds(e),this.resolveSymlink=bs(e,this.isSynchronous),this.walkDirectory=ws(this.isSynchronous);}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,s)=>{let{paths:r,options:{filters:n,resolveSymlinks:i,excludeSymlinks:o,exclude:l,maxFiles:b,signal:x,useRealPaths:y,pathSeparator:R},controller:_}=this.state;if(_.aborted||x&&x.aborted||b&&r.length>b)return;let E=this.getArray(this.state.paths);for(let A=0;A<t.length;++A){let g=t[A];if(g.isFile()||g.isSymbolicLink()&&!i&&!o){let p=this.joinPath(g.name,e);this.pushFile(p,E,this.state.counts,n);}else if(g.isDirectory()){let p=ze(g.name,e,this.state.options.pathSeparator);if(l&&l(g.name,p))continue;this.pushDirectory(p,r,n),this.walkDirectory(this.state,p,p,s-1,this.walk);}else if(this.resolveSymlink&&g.isSymbolicLink()){let p=Gt(g.name,e);this.resolveSymlink(p,this.state,(m,d)=>{if(m.isDirectory()){if(d=Rt(d,this.state.options),l&&l(g.name,y?d:p+R))return;this.walkDirectory(this.state,d,y?d:p+R,s-1,this.walk);}else {d=y?d:p;let q=path.basename(d),F=Rt(path.dirname(d),this.state.options);d=this.joinPath(q,F),this.pushFile(d,E,this.state.counts,n);}});}}this.groupFiles(this.state.groups,e,E);}};function Hs(t,e){return new Promise((s,r)=>{Xt(t,e,(n,i)=>{if(n)return r(n);s(i);});})}function Xt(t,e,s){new Kt(t,e,s).start();}function ks(t,e){return new Kt(t,e).start()}var Mt=class{constructor(t,e){this.root=t,this.options=e;}withPromise(){return Hs(this.root,this.options)}withCallback(t){Xt(this.root,this.options,t);}sync(){return ks(this.root,this.options)}},Qt=null;try{Bt.resolve("picomatch"),Qt=Bt("picomatch");}catch{}var jt=class{globCache={};options={maxDepth:1/0,suppressErrors:true,pathSeparator:path.sep,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction;}group(){return this.options.group=true,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=true,this}withRelativePaths(){return this.options.relativePaths=true,this}withDirs(){return this.options.includeDirs=true,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=true,this.options.includeBasePath=true,this}withErrors(){return this.options.suppressErrors=false,this}withSymlinks({resolvePaths:t=true}={}){return this.options.resolveSymlinks=true,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=true,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=true,this.options.includeDirs=true,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=true,this}crawl(t){return new Mt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new Mt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:true})}globWithOptions(t,...e){let s=this.globFunction||Qt;if(!s)throw new Error("Please specify a glob function to use glob matching.");var r=this.globCache[t.join("\0")];return r||(r=s(t,...e),this.globCache[t.join("\0")]=r),this.options.filters.push(n=>r(n)),this}};var nt=Ht(ye(),1),Cr=Array.isArray,Se=/\\/g,$r=/^[A-Za-z]:$/,_e=process.platform==="win32",Lr=/^(\/?\.\.)+$/;function Ir(t,e={}){let s=t.length,r=Array(s),n=Array(s),i,o;for(i=0;i<s;i++){let l=Ee(t[i]);r[i]=l;let b=l.length,x=Array(b);for(o=0;o<b;o++)x[o]=(0, nt.default)(l[o],e);n[i]=x;}return l=>{let b=l.split("/");if(b[0]===".."&&Lr.test(l))return true;for(i=0;i<s;i++){let x=r[i],y=n[i],R=b.length,_=Math.min(R,x.length);for(o=0;o<_;){let E=x[o];if(E.includes("/"))return true;if(!y[o](b[o]))break;if(!e.noglobstar&&E==="**")return true;o++;}if(o===R)return true}return false}}var wr=/^[A-Z]:\/$/i,Or=_e?t=>wr.test(t):t=>t==="/";function Re(t,e,s){if(t===e||e.startsWith(`${t}/`)){if(s){let n=t.length+ +!Or(t);return (i,o)=>i.slice(n,o?-1:void 0)||"."}let r=e.slice(t.length+1);return r?(n,i)=>{if(n===".")return r;let o=`${r}/${n}`;return i?o.slice(0,-1):o}:(n,i)=>i&&n!=="."?n.slice(0,-1):n}return s?r=>path.posix.relative(t,r)||".":r=>path.posix.relative(t,`${e}/${r}`)||"."}function Tr(t,e){if(e.startsWith(`${t}/`)){let s=e.slice(t.length+1);return r=>`${s}/${r}`}return s=>{let r=path.posix.relative(t,`${e}/${s}`);return s[s.length-1]==="/"&&r!==""?`${r}/`:r||"."}}function xe(t){return t.replace($r,e=>`${e}/`)}var Pr={parts:true};function Ee(t){var e;let s=nt.default.scan(t,Pr);return !((e=s.parts)===null||e===void 0)&&e.length?s.parts:[t]}var Hr=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,kr=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,Nr=t=>t.replace(Hr,"\\$&"),Dr=t=>t.replace(kr,"\\$&"),Br=_e?Dr:Nr;function Mr(t,e){let s=nt.default.scan(t);return s.isGlob||s.negated}function lt(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t);}function ve(t){return typeof t=="string"?[t]:t??[]}var qr=/^(\/?\.\.)+/,Fr=/\\(?=[()[\]{}!*+?@|])/g;function Ot(t,e,s,r){var n;let i=e.cwd,o=t;t[t.length-1]==="/"&&(o=t.slice(0,-1)),o[o.length-1]!=="*"&&e.expandDirectories&&(o+="/**");let l=Br(i);o=path.isAbsolute(o.replace(Fr,""))?path.posix.relative(l,o):path.posix.normalize(o);let b=(n=qr.exec(o))===null||n===void 0?void 0:n[0],x=Ee(o);if(b){let R=(b.length+1)/3,_=0,E=l.split("/");for(;_<R&&x[_+R]===E[E.length+_-R];)o=o.slice(0,(R-_-1)*3)+o.slice((R-_)*3+x[_+R].length+1)||".",_++;let A=path.posix.join(i,b.slice(_*3));A[0]!=="."&&s.root.length>A.length&&(s.root=xe(A),s.depthOffset=-R+_);}if(!r&&s.depthOffset>=0){var y;(y=s.commonPath)!==null&&y!==void 0||(s.commonPath=x);let R=[],_=Math.min(s.commonPath.length,x.length);for(let E=0;E<_;E++){let A=x[E];if(A==="**"&&!x[E+1]){R.pop();break}if(E===x.length-1||A!==s.commonPath[E]||Mr(A))break;R.push(A);}s.depthOffset=R.length,s.commonPath=R,s.root=xe(R.length>0?path.posix.join(i,...R):i);}return o}function Gr(t,e,s){let r=[],n=[];for(let i of t.ignore)i&&(i[0]!=="!"||i[1]==="(")&&n.push(Ot(i,t,s,true));for(let i of e)i&&(i[0]!=="!"||i[1]==="("?r.push(Ot(i,t,s,false)):(i[1]!=="!"||i[2]==="(")&&n.push(Ot(i.slice(1),t,s,true)));return {match:r,ignore:n}}function Wr(t,e){let s=t.cwd,r={root:s,depthOffset:0},n=Gr(t,e,r);t.debug&&lt("internal processing patterns:",n);let{absolute:i,caseSensitiveMatch:o,debug:l,dot:b,followSymbolicLinks:x,onlyDirectories:y}=t,R=r.root.replace(Se,""),_={dot:b,nobrace:t.braceExpansion===false,nocase:!o,noextglob:t.extglob===false,noglobstar:t.globstar===false,posix:true},E=(0, nt.default)(n.match,_),A=(0, nt.default)(n.ignore,_),g=Ir(n.match,_),p=Re(s,R,i),m=i?p:Re(s,R,true),d=(O,I)=>{let L=m(I,true);return L!=="."&&!g(L)||A(L)},q;t.deep!==void 0&&(q=Math.round(t.deep-r.depthOffset));let F=new jt({filters:[l?(O,I)=>{let L=p(O,I),S=E(L)&&!A(L);return S&&lt(`matched ${L}`),S}:(O,I)=>{let L=p(O,I);return E(L)&&!A(L)}],exclude:l?(O,I)=>{let L=d(O,I);return lt(`${L?"skipped":"crawling"} ${I}`),L}:d,fs:t.fs,pathSeparator:"/",relativePaths:!i,resolvePaths:i,includeBasePath:i,resolveSymlinks:x,excludeSymlinks:!x,excludeFiles:y,includeDirs:y||!t.onlyFiles,maxDepth:q,signal:t.signal}).crawl(R);return t.debug&&lt("internal properties:",{...r,root:R}),[F,s!==R&&!i&&Tr(s,R)]}function Ur(t,e){if(e)for(let s=t.length-1;s>=0;s--)t[s]=e(t[s]);return t}var Ae={caseSensitiveMatch:true,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:true,followSymbolicLinks:true,onlyFiles:true};function Kr(t){let e=Object.assign({},t);for(let s in Ae)e[s]===void 0&&Object.assign(e,{[s]:Ae[s]});return e.cwd=(e.cwd instanceof URL?url.fileURLToPath(e.cwd):path.resolve(e.cwd||process.cwd())).replace(Se,"/"),e.ignore=ve(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||Ge.readdir,readdirSync:e.fs.readdirSync||Ge.readdirSync,realpath:e.fs.realpath||Ge.realpath,realpathSync:e.fs.realpathSync||Ge.realpathSync,stat:e.fs.stat||Ge.stat,statSync:e.fs.statSync||Ge.statSync}),e.debug&&lt("globbing with options:",e),e}function Xr(t,e={}){var s;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let r=Cr(t)||typeof t=="string",n=ve((s=r?t:t.patterns)!==null&&s!==void 0?s:"**/*"),i=Kr(r?e:t);return n.length>0?Wr(i,n):[]}async function Ce(t,e){let[s,r]=Xr(t,e);return s?Ur(await s.withPromise(),r):[]}var bt=Tt.default.cyan("(nqtr)");function it(t){return t?Array.isArray(t)?t:[t]:[]}function Jr(t){return t?.find(e=>e.name==="vite-plugin-pixi-vn")}function vn(t){let e,s,r,n=new Promise(g=>{r=g;}),i=[...it(t?.activities),...it(t?.commitments),...it(t?.locations),...it(t?.maps),...it(t?.quests),...it(t?.rooms)],o=new Set,l={activityIds:[],commitmentIds:[],locationIds:[],mapIds:[],questIds:[],roomIds:[]};function b(){if(!t?.typeFilePath||!e)return null;let g=t.typeFilePath;return path.isAbsolute(g)?g:path.resolve(e.root,g)}function x(g,p){Ge.mkdirSync(path.dirname(g),{recursive:true});let m=["// @ts-nocheck","/* eslint-disable */","// noinspection JSUnusedGlobalSymbols","// This file is auto-generated by @drincs/nqtr vite plugin. Do not edit manually.","",`export const nqtrActivityIds = ${JSON.stringify(p.activityIds)} as const;`,`export const nqtrCommitmentIds = ${JSON.stringify(p.commitmentIds)} as const;`,`export const nqtrLocationIds = ${JSON.stringify(p.locationIds)} as const;`,`export const nqtrMapIds = ${JSON.stringify(p.mapIds)} as const;`,`export const nqtrQuestIds = ${JSON.stringify(p.questIds)} as const;`,`export const nqtrRoomIds = ${JSON.stringify(p.roomIds)} as const;`,""],d=[["nqtrActivityIdsEnum",p.activityIds],["nqtrCommitmentIdsEnum",p.commitmentIds],["nqtrLocationIdsEnum",p.locationIds],["nqtrMapIdsEnum",p.mapIds],["nqtrQuestIdsEnum",p.questIds],["nqtrRoomIdsEnum",p.roomIds]];for(let[F,O]of d){if(O.length===0){m.push(`export const ${F} = {} as const;`);continue}let I=O.map(L=>`${JSON.stringify(L)}: ${JSON.stringify(L)}`).join(", ");m.push(`export const ${F} = { ${I} } as const;`);}m.push(""),m.push('declare module "@drincs/nqtr/registries" {');let q=[["NqtrActivityIds",p.activityIds],["NqtrCommitmentIds",p.commitmentIds],["NqtrLocationIds",p.locationIds],["NqtrMapIds",p.mapIds],["NqtrQuestIds",p.questIds],["NqtrRoomIds",p.roomIds]];for(let[F,O]of q)if(O.length!==0){m.push(` interface ${F} {`);for(let I of O)m.push(` ${JSON.stringify(I)}: never;`);m.push(" }");}m.push("}"),m.push(""),Ge.writeFileSync(g,m.join(`
2
- `),"utf-8");}function y(){let g=b();if(g)try{x(g,l);}catch(p){e?.logger.error(`${bt} Failed to write type file "${g}".`,{error:p instanceof Error?p:new Error(String(p)),timestamp:true});}}async function R(g){let p={};try{p=await g("@drincs/nqtr/registries");}catch{}l={activityIds:p.RegisteredActivities?.values().map(d=>d.id)??[],commitmentIds:p.RegisteredCommitments?.values().map(d=>d.id)??[],locationIds:p.RegisteredLocations?.values().map(d=>d.id)??[],mapIds:p.RegisteredMaps?.values().map(d=>d.id)??[],questIds:p.RegisteredQuests?.values().map(d=>d.id)??[],roomIds:p.RegisteredRooms?.values().map(d=>d.id)??[]};let m=l.activityIds.length+l.commitmentIds.length+l.locationIds.length+l.mapIds.length+l.questIds.length+l.roomIds.length;e?.logger.info(`${bt} ${Tt.default.dim(`${m} NQTR id(s) \u2014 activities: ${l.activityIds.length}, commitments: ${l.commitmentIds.length}, locations: ${l.locationIds.length}, maps: ${l.mapIds.length}, quests: ${l.questIds.length}, rooms: ${l.roomIds.length}`)}`,{timestamp:true});}async function _(g){try{let p=await g("@drincs/nqtr/registries");p.RegisteredActivities?.clear?.(),p.RegisteredCommitments?.clear?.(),p.RegisteredLocations?.clear?.(),p.RegisteredMaps?.clear?.(),p.RegisteredQuests?.clear?.(),p.RegisteredRooms?.clear?.();}catch{}}async function E(g,p){let m=await Ce(i,{cwd:p,absolute:true,onlyFiles:true});for(let d of m){o.add(d);try{await g(d);}catch{}}}async function A(g){for(let p of o)for(let m of g.moduleGraph.getModulesByFile(p)??[])g.moduleGraph.invalidateModule(m);await _(p=>g.ssrLoadModule(p)),await E(p=>g.ssrLoadModule(p),e.root),await R(p=>g.ssrLoadModule(p)),y();}return {name:"vite-plugin-nqtr",enforce:"pre",api:{contentLoaded:n},config(g,p){if(p.command==="serve"&&i.length>0)return {ssr:{noExternal:["@drincs/nqtr","@drincs/pixi-vn"]}}},configResolved(g){e=g,s=Jr(g.plugins),i.length===0&&!s?.api?.contentLoaded&&r();},async buildStart(){if(e?.command!=="build")return;let g=s?.api?.contentLoaded;if(g&&await g,i.length>0){let{createServer:p}=await import('vite'),m=await p({root:e.root,configFile:false,resolve:e.resolve,server:{middlewareMode:true},appType:"custom",logLevel:"silent",optimizeDeps:{noDiscovery:true},ssr:{noExternal:["@drincs/nqtr","@drincs/pixi-vn"]}});try{await E(d=>m.ssrLoadModule(d),e.root),await R(d=>m.ssrLoadModule(d)),y(),r();}catch{r();}finally{await m.close();}}else if(g){try{let p=await import('@drincs/nqtr/registries');l={activityIds:p.RegisteredActivities?.values().map(m=>m.id)??[],commitmentIds:p.RegisteredCommitments?.values().map(m=>m.id)??[],locationIds:p.RegisteredLocations?.values().map(m=>m.id)??[],mapIds:p.RegisteredMaps?.values().map(m=>m.id)??[],questIds:p.RegisteredQuests?.values().map(m=>m.id)??[],roomIds:p.RegisteredRooms?.values().map(m=>m.id)??[]},y();}catch{}r();}else r();},configureServer(g){(async()=>{let m=s?.api?.contentLoaded;m&&await m,i.length>0&&await E(d=>g.ssrLoadModule(d),e.root),await R(d=>g.ssrLoadModule(d)),y(),r(),s?.api?.onReload?.(()=>{R(d=>g.ssrLoadModule(d)).then(()=>y()).catch(d=>{e?.logger.error(`${bt} Failed to regenerate types after pixi-vn reload.`,{error:d instanceof Error?d:new Error(String(d)),timestamp:true});});});})().catch(()=>r());},hotUpdate({file:g,server:p}){let m=b();if(m&&g===m)return [];if(i.length>0&&o.has(g))return A(p).catch(d=>{e?.logger.error(`${bt} Failed to reload NQTR content.`,{error:d instanceof Error?d:new Error(String(d)),timestamp:true});}),[]}}}exports.vitePluginNqtr=vn;
1
+ 'use strict';var Fe=require('fs'),path=require('path'),url=require('url'),module$1=require('module');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var Fe__namespace=/*#__PURE__*/_interopNamespace(Fe);var $e=Object.create;var wt=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,Oe=Object.prototype.hasOwnProperty;var J=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(s){throw e=0,s}};var Te=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ie(e))!Oe.call(t,n)&&n!==s&&wt(t,n,{get:()=>e[n],enumerable:!(r=Le(e,n))||r.enumerable});return t};var Ot=(t,e,s)=>(s=t!=null?$e(we(t)):{},Te(e||!t||!t.__esModule?wt(s,"default",{value:t,enumerable:true}):s,t));var Ht=J((Jr,gt)=>{"use strict";var pt=process||{},Tt=pt.argv||[],lt=pt.env||{},Pe=!(lt.NO_COLOR||Tt.includes("--no-color"))&&(!!lt.FORCE_COLOR||Tt.includes("--color")||pt.platform==="win32"||(pt.stdout||{}).isTTY&&lt.TERM!=="dumb"||!!lt.CI),He=(t,e,s=t)=>r=>{let n=""+r,i=n.indexOf(e,t.length);return ~i?t+ke(n,e,s,i)+e:t+n+e},ke=(t,e,s,r)=>{let n="",i=0;do n+=t.substring(i,r)+s,i=r+e.length,r=t.indexOf(e,i);while(~r);return n+t.substring(i)},Pt=(t=Pe)=>{let e=t?He:()=>String;return {isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};gt.exports=Pt();gt.exports.createColors=Pt;});var rt=J((cn,Yt)=>{"use strict";var Xt="[^\\\\/]",ks="(?=.)",Qt="[^/]",yt="(?:\\/|$)",jt="(?:^|\\/)",Rt=`\\.{1,2}${yt}`,Ns="(?!\\.)",Ds=`(?!${jt}${Rt})`,Bs=`(?!\\.{0,1}${yt})`,Ms=`(?!${Rt})`,qs="[^.\\/]",Fs=`${Qt}*?`,Gs="/",zt={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:ks,QMARK:Qt,END_ANCHOR:yt,DOTS_SLASH:Rt,NO_DOT:Ns,NO_DOTS:Ds,NO_DOT_SLASH:Bs,NO_DOTS_SLASH:Ms,QMARK_NO_DOT:qs,STAR:Fs,START_ANCHOR:jt,SEP:Gs},Ws={...zt,SLASH_LITERAL:"[\\\\/]",QMARK:Xt,STAR:`${Xt}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},Us={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Yt.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Us,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(t){return {"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Ws:zt}};});var nt=J(W=>{"use strict";var{REGEX_BACKSLASH:Ks,REGEX_REMOVE_BACKSLASH:Xs,REGEX_SPECIAL_CHARS:Qs,REGEX_SPECIAL_CHARS_GLOBAL:js}=rt();W.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);W.hasRegexChars=t=>Qs.test(t);W.isRegexChar=t=>t.length===1&&W.hasRegexChars(t);W.escapeRegex=t=>t.replace(js,"\\$1");W.toPosixSlashes=t=>t.replace(Ks,"/");W.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){let t=navigator.platform.toLowerCase();return t==="win32"||t==="windows"}return typeof process<"u"&&process.platform?process.platform==="win32":!1};W.removeBackslashes=t=>t.replace(Xs,e=>e==="\\"?"":e);W.escapeLast=(t,e,s)=>{let r=t.lastIndexOf(e,s);return r===-1?t:t[r-1]==="\\"?W.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`};W.removePrefix=(t,e={})=>{let s=t;return s.startsWith("./")&&(s=s.slice(2),e.prefix="./"),s};W.wrapOutput=(t,e={},s={})=>{let r=s.contains?"":"^",n=s.contains?"":"$",i=`${r}(?:${t})${n}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i};W.basename=(t,{windows:e}={})=>{let s=t.split(e?/[\\/]/:"/"),r=s[s.length-1];return r===""?s[s.length-2]:r};});var ne=J((pn,re)=>{"use strict";var Vt=nt(),{CHAR_ASTERISK:xt,CHAR_AT:zs,CHAR_BACKWARD_SLASH:it,CHAR_COMMA:Ys,CHAR_DOT:At,CHAR_EXCLAMATION_MARK:St,CHAR_FORWARD_SLASH:se,CHAR_LEFT_CURLY_BRACE:_t,CHAR_LEFT_PARENTHESES:Et,CHAR_LEFT_SQUARE_BRACKET:Vs,CHAR_PLUS:Js,CHAR_QUESTION_MARK:Jt,CHAR_RIGHT_CURLY_BRACE:Zs,CHAR_RIGHT_PARENTHESES:Zt,CHAR_RIGHT_SQUARE_BRACKET:tr}=rt(),te=t=>t===se||t===it,ee=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1);},er=(t,e)=>{let s=e||{},r=t.length-1,n=s.parts===!0||s.scanToEnd===!0,i=[],o=[],l=[],b=t,S=-1,x=0,y=0,_=!1,E=!1,R=!1,g=!1,p=!1,m=!1,h=!1,q=!1,F=!1,w=!1,I=0,L,A,$={value:"",depth:0,isGlob:!1},c=()=>S>=r,G=()=>b.charCodeAt(S+1),B=()=>(L=A,b.charCodeAt(++S));for(;S<r;){A=B();let O;if(A===it){h=$.backslashes=!0,A=B(),A===_t&&(m=!0);continue}if(m===!0||A===_t){for(I++;c()!==!0&&(A=B());){if(A===it){h=$.backslashes=!0,B();continue}if(A===_t){I++;continue}if(m!==!0&&A===At&&(A=B())===At){if(_=$.isBrace=!0,R=$.isGlob=!0,w=!0,n===!0)continue;break}if(m!==!0&&A===Ys){if(_=$.isBrace=!0,R=$.isGlob=!0,w=!0,n===!0)continue;break}if(A===Zs&&(I--,I===0)){m=!1,_=$.isBrace=!0,w=!0;break}}if(n===!0)continue;break}if(A===se){if(i.push(S),o.push($),$={value:"",depth:0,isGlob:!1},w===!0)continue;if(L===At&&S===x+1){x+=2;continue}y=S+1;continue}if(s.noext!==!0&&(A===Js||A===zs||A===xt||A===Jt||A===St)===!0&&G()===Et){if(R=$.isGlob=!0,g=$.isExtglob=!0,w=!0,A===St&&S===x&&(F=!0),n===!0){for(;c()!==!0&&(A=B());){if(A===it){h=$.backslashes=!0,A=B();continue}if(A===Zt){R=$.isGlob=!0,w=!0;break}}continue}break}if(A===xt){if(L===xt&&(p=$.isGlobstar=!0),R=$.isGlob=!0,w=!0,n===!0)continue;break}if(A===Jt){if(R=$.isGlob=!0,w=!0,n===!0)continue;break}if(A===Vs){for(;c()!==!0&&(O=B());){if(O===it){h=$.backslashes=!0,B();continue}if(O===tr){E=$.isBracket=!0,R=$.isGlob=!0,w=!0;break}}if(n===!0)continue;break}if(s.nonegate!==!0&&A===St&&S===x){q=$.negated=!0,x++;continue}if(s.noparen!==!0&&A===Et){if(R=$.isGlob=!0,n===!0){for(;c()!==!0&&(A=B());){if(A===Et){h=$.backslashes=!0,A=B();continue}if(A===Zt){w=!0;break}}continue}break}if(R===!0){if(w=!0,n===!0)continue;break}}s.noext===!0&&(g=!1,R=!1);let N=b,a="",u="";x>0&&(a=b.slice(0,x),b=b.slice(x),y-=x),N&&R===!0&&y>0?(N=b.slice(0,y),u=b.slice(y)):R===!0?(N="",u=b):N=b,N&&N!==""&&N!=="/"&&N!==b&&te(N.charCodeAt(N.length-1))&&(N=N.slice(0,-1)),s.unescape===!0&&(u&&(u=Vt.removeBackslashes(u)),N&&h===!0&&(N=Vt.removeBackslashes(N)));let K={prefix:a,input:t,start:x,base:N,glob:u,isBrace:_,isBracket:E,isGlob:R,isExtglob:g,isGlobstar:p,negated:q,negatedExtglob:F};if(s.tokens===!0&&(K.maxDepth=0,te(A)||o.push($),K.tokens=o),s.parts===!0||s.tokens===!0){let O;for(let k=0;k<i.length;k++){let z=O?O+1:x,X=i[k],Y=t.slice(z,X);s.tokens&&(k===0&&x!==0?(o[k].isPrefix=!0,o[k].value=a):o[k].value=Y,ee(o[k]),K.maxDepth+=o[k].depth),(k!==0||Y!=="")&&l.push(Y),O=X;}if(O&&O+1<t.length){let k=t.slice(O+1);l.push(k),s.tokens&&(o[o.length-1].value=k,ee(o[o.length-1]),K.maxDepth+=o[o.length-1].depth);}K.slashes=i,K.parts=l;}return K};re.exports=er;});var ce=J((fn,ae)=>{"use strict";var ot=rt(),U=nt(),{MAX_LENGTH:ht,POSIX_REGEX_SOURCE:sr,REGEX_NON_SPECIAL_CHARS:rr,REGEX_SPECIAL_CHARS_BACKREF:nr,REPLACEMENTS:ie}=ot,ir=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let s=`[${t.join("-")}]`;try{new RegExp(s);}catch{return t.map(n=>U.escapeRegex(n)).join("..")}return s},tt=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,oe=t=>{let e=[],s=0,r=0,n=0,i="",o=!1;for(let l of t){if(o===!0){i+=l,o=!1;continue}if(l==="\\"){i+=l,o=!0;continue}if(l==='"'){n=n===1?0:1,i+=l;continue}if(n===0){if(l==="[")s++;else if(l==="]"&&s>0)s--;else if(s===0){if(l==="(")r++;else if(l===")"&&r>0)r--;else if(l==="|"&&r===0){e.push(i),i="";continue}}}i+=l;}return e.push(i),e},or=t=>{let e=!1;for(let s of t){if(e===!0){e=!1;continue}if(s==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(s))return !1}return !0},ue=t=>{let e=t.trim(),s=!0;for(;s===!0;)s=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),s=!0);if(or(e))return e.replace(/\\(.)/g,"$1")},ur=t=>{let e=t.map(ue).filter(Boolean);for(let s=0;s<e.length;s++)for(let r=s+1;r<e.length;r++){let n=e[s],i=e[r],o=n[0];if(!(!o||n!==o.repeat(n.length)||i!==o.repeat(i.length))&&(n===i||n.startsWith(i)||i.startsWith(n)))return !0}return !1},vt=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let s=0,r=0,n=0,i=!1;for(let o=1;o<t.length;o++){let l=t[o];if(i===!0){i=!1;continue}if(l==="\\"){i=!0;continue}if(l==='"'){n=n===1?0:1;continue}if(n!==1){if(l==="["){s++;continue}if(l==="]"&&s>0){s--;continue}if(!(s>0)){if(l==="("){r++;continue}if(l===")"&&(r--,r===0))return e===!0&&o!==t.length-1?void 0:{type:t[0],body:t.slice(2,o),end:o}}}}},ar=t=>{let e=0,s=[];for(;e<t.length;){let n=vt(t.slice(e),!1);if(!n||n.type!=="*")return;let i=oe(n.body).map(l=>l.trim());if(i.length!==1)return;let o=ue(i[0]);if(!o||o.length!==1)return;s.push(o),e+=n.end+1;}return s.length<1?void 0:`${s.length===1?U.escapeRegex(s[0]):`[${s.map(n=>U.escapeRegex(n)).join("")}]`}*`},cr=t=>{let e=0,s=t.trim(),r=vt(s);for(;r;)e++,s=r.body.trim(),r=vt(s);return e},lr=(t,e)=>{if(e.maxExtglobRecursion===!1)return {risky:!1};let s=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:ot.DEFAULT_MAX_EXTGLOB_RECURSION,r=oe(t).map(n=>n.trim());if(r.length>1&&(r.some(n=>n==="")||r.some(n=>/^[*?]+$/.test(n))||ur(r)))return {risky:!0};for(let n of r){let i=ar(n);if(i)return {risky:!0,safeOutput:i};if(cr(n)>s)return {risky:!0}}return {risky:!1}},Ct=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=ie[t]||t;let s={...e},r=typeof s.maxLength=="number"?Math.min(ht,s.maxLength):ht,n=t.length;if(n>r)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${r}`);let i={type:"bos",value:"",output:s.prepend||""},o=[i],l=s.capture?"":"?:",b=ot.globChars(s.windows),S=ot.extglobChars(b),{DOT_LITERAL:x,PLUS_LITERAL:y,SLASH_LITERAL:_,ONE_CHAR:E,DOTS_SLASH:R,NO_DOT:g,NO_DOT_SLASH:p,NO_DOTS_SLASH:m,QMARK:h,QMARK_NO_DOT:q,STAR:F,START_ANCHOR:w}=b,I=d=>`(${l}(?:(?!${w}${d.dot?R:x}).)*?)`,L=s.dot?"":g,A=s.dot?h:q,$=s.bash===!0?I(s):F;s.capture&&($=`(${$})`),typeof s.noext=="boolean"&&(s.noextglob=s.noext);let c={input:t,index:-1,start:0,dot:s.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};t=U.removePrefix(t,c),n=t.length;let G=[],B=[],N=[],a=i,u,K=()=>c.index===n-1,O=c.peek=(d=1)=>t[c.index+d],k=c.advance=()=>t[++c.index]||"",z=()=>t.slice(c.index+1),X=(d="",H=0)=>{c.consumed+=d,c.index+=H;},Y=d=>{c.output+=d.output!=null?d.output:d.value,X(d.value);},ve=()=>{let d=1;for(;O()==="!"&&(O(2)!=="("||O(3)==="?");)k(),c.start++,d++;return d%2===0?!1:(c.negated=!0,c.start++,!0)},at=d=>{c[d]++,N.push(d);},V=d=>{c[d]--,N.pop();},v=d=>{if(a.type==="globstar"){let H=c.braces>0&&(d.type==="comma"||d.type==="brace"),f=d.extglob===!0||G.length&&(d.type==="pipe"||d.type==="paren");d.type!=="slash"&&d.type!=="paren"&&!H&&!f&&(c.output=c.output.slice(0,-a.output.length),a.type="star",a.value="*",a.output=$,c.output+=a.output);}if(G.length&&d.type!=="paren"&&(G[G.length-1].inner+=d.value),(d.value||d.output)&&Y(d),a&&a.type==="text"&&d.type==="text"){a.output=(a.output||a.value)+d.value,a.value+=d.value;return}d.prev=a,o.push(d),a=d;},ct=(d,H)=>{let f={...S[H],conditions:1,inner:""};f.prev=a,f.parens=c.parens,f.output=c.output,f.startIndex=c.index,f.tokensIndex=o.length;let C=(s.capture?"(":"")+f.open;at("parens"),v({type:d,value:H,output:c.output?"":E}),v({type:"paren",extglob:!0,value:k(),output:C}),G.push(f);},Ce=d=>{let H=t.slice(d.startIndex,c.index+1),f=t.slice(d.startIndex+2,c.index),C=lr(f,s);if((d.type==="plus"||d.type==="star")&&C.risky){let T=C.safeOutput?(d.output?"":E)+(s.capture?`(${C.safeOutput})`:C.safeOutput):void 0,Q=o[d.tokensIndex];Q.type="text",Q.value=H,Q.output=T||U.escapeRegex(H);for(let j=d.tokensIndex+1;j<o.length;j++)o[j].value="",o[j].output="",delete o[j].suffix;c.output=d.output+Q.output,c.backtrack=!0,v({type:"paren",extglob:!0,value:u,output:""}),V("parens");return}let P=d.close+(s.capture?")":""),M;if(d.type==="negate"){let T=$;if(d.inner&&d.inner.length>1&&d.inner.includes("/")&&(T=I(s)),(T!==$||K()||/^\)+$/.test(z()))&&(P=d.close=`)$))${T}`),d.inner.includes("*")&&(M=z())&&/^\.[^\\/.]+$/.test(M)){let Q=Ct(M,{...e,fastpaths:!1}).output;P=d.close=`)${Q})${T})`;}d.prev.type==="bos"&&(c.negatedExtglob=!0);}v({type:"paren",extglob:!0,value:u,output:P}),V("parens");};if(s.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let d=!1,H=t.replace(nr,(f,C,P,M,T,Q)=>M==="\\"?(d=!0,f):M==="?"?C?C+M+(T?h.repeat(T.length):""):Q===0?A+(T?h.repeat(T.length):""):h.repeat(P.length):M==="."?x.repeat(P.length):M==="*"?C?C+M+(T?$:""):$:C?f:`\\${f}`);return d===!0&&(s.unescape===!0?H=H.replace(/\\/g,""):H=H.replace(/\\+/g,f=>f.length%2===0?"\\\\":f?"\\":"")),H===t&&s.contains===!0?(c.output=t,c):(c.output=U.wrapOutput(H,c,e),c)}for(;!K();){if(u=k(),u==="\0")continue;if(u==="\\"){let f=O();if(f==="/"&&s.bash!==!0||f==="."||f===";")continue;if(!f){u+="\\",v({type:"text",value:u});continue}let C=/^\\+/.exec(z()),P=0;if(C&&C[0].length>2&&(P=C[0].length,c.index+=P,P%2!==0&&(u+="\\")),s.unescape===!0?u=k():u+=k(),c.brackets===0){v({type:"text",value:u});continue}}if(c.brackets>0&&(u!=="]"||a.value==="["||a.value==="[^")){if(s.posix!==!1&&u===":"){let f=a.value.slice(1);if(f.includes("[")&&(a.posix=!0,f.includes(":"))){let C=a.value.lastIndexOf("["),P=a.value.slice(0,C),M=a.value.slice(C+2),T=sr[M];if(T){a.value=P+T,c.backtrack=!0,k(),!i.output&&o.indexOf(a)===1&&(i.output=E);continue}}}(u==="["&&O()!==":"||u==="-"&&O()==="]")&&(u=`\\${u}`),u==="]"&&(a.value==="["||a.value==="[^")&&(u=`\\${u}`),s.posix===!0&&u==="!"&&a.value==="["&&(u="^"),a.value+=u,Y({value:u});continue}if(c.quotes===1&&u!=='"'){u=U.escapeRegex(u),a.value+=u,Y({value:u});continue}if(u==='"'){c.quotes=c.quotes===1?0:1,s.keepQuotes===!0&&v({type:"text",value:u});continue}if(u==="("){at("parens"),v({type:"paren",value:u});continue}if(u===")"){if(c.parens===0&&s.strictBrackets===!0)throw new SyntaxError(tt("opening","("));let f=G[G.length-1];if(f&&c.parens===f.parens+1){Ce(G.pop());continue}v({type:"paren",value:u,output:c.parens?")":"\\)"}),V("parens");continue}if(u==="["){if(s.nobracket===!0||!z().includes("]")){if(s.nobracket!==!0&&s.strictBrackets===!0)throw new SyntaxError(tt("closing","]"));u=`\\${u}`;}else at("brackets");v({type:"bracket",value:u});continue}if(u==="]"){if(s.nobracket===!0||a&&a.type==="bracket"&&a.value.length===1){v({type:"text",value:u,output:`\\${u}`});continue}if(c.brackets===0){if(s.strictBrackets===!0)throw new SyntaxError(tt("opening","["));v({type:"text",value:u,output:`\\${u}`});continue}V("brackets");let f=a.value.slice(1);if(a.posix!==!0&&f[0]==="^"&&!f.includes("/")&&(u=`/${u}`),a.value+=u,Y({value:u}),s.literalBrackets===!1||U.hasRegexChars(f))continue;let C=U.escapeRegex(a.value);if(c.output=c.output.slice(0,-a.value.length),s.literalBrackets===!0){c.output+=C,a.value=C;continue}a.value=`(${l}${C}|${a.value})`,c.output+=a.value;continue}if(u==="{"&&s.nobrace!==!0){at("braces");let f={type:"brace",value:u,output:"(",outputIndex:c.output.length,tokensIndex:c.tokens.length};B.push(f),v(f);continue}if(u==="}"){let f=B[B.length-1];if(s.nobrace===!0||!f){v({type:"text",value:u,output:u});continue}let C=")";if(f.dots===!0){let P=o.slice(),M=[];for(let T=P.length-1;T>=0&&(o.pop(),P[T].type!=="brace");T--)P[T].type!=="dots"&&M.unshift(P[T].value);C=ir(M,s),c.backtrack=!0;}if(f.comma!==!0&&f.dots!==!0){let P=c.output.slice(0,f.outputIndex),M=c.tokens.slice(f.tokensIndex);f.value=f.output="\\{",u=C="\\}",c.output=P;for(let T of M)c.output+=T.output||T.value;}v({type:"brace",value:u,output:C}),V("braces"),B.pop();continue}if(u==="|"){G.length>0&&G[G.length-1].conditions++,v({type:"text",value:u});continue}if(u===","){let f=u,C=B[B.length-1];C&&N[N.length-1]==="braces"&&(C.comma=!0,f="|"),v({type:"comma",value:u,output:f});continue}if(u==="/"){if(a.type==="dot"&&c.index===c.start+1){c.start=c.index+1,c.consumed="",c.output="",o.pop(),a=i;continue}v({type:"slash",value:u,output:_});continue}if(u==="."){if(c.braces>0&&a.type==="dot"){a.value==="."&&(a.output=x);let f=B[B.length-1];a.type="dots",a.output+=u,a.value+=u,f.dots=!0;continue}if(c.braces+c.parens===0&&a.type!=="bos"&&a.type!=="slash"){v({type:"text",value:u,output:x});continue}v({type:"dot",value:u,output:x});continue}if(u==="?"){if(!(a&&a.value==="(")&&s.noextglob!==!0&&O()==="("&&O(2)!=="?"){ct("qmark",u);continue}if(a&&a.type==="paren"){let C=O(),P=u;(a.value==="("&&!/[!=<:]/.test(C)||C==="<"&&!/<([!=]|\w+>)/.test(z()))&&(P=`\\${u}`),v({type:"text",value:u,output:P});continue}if(s.dot!==!0&&(a.type==="slash"||a.type==="bos")){v({type:"qmark",value:u,output:q});continue}v({type:"qmark",value:u,output:h});continue}if(u==="!"){if(s.noextglob!==!0&&O()==="("&&(O(2)!=="?"||!/[!=<:]/.test(O(3)))){ct("negate",u);continue}if(s.nonegate!==!0&&c.index===0){ve();continue}}if(u==="+"){if(s.noextglob!==!0&&O()==="("&&O(2)!=="?"){ct("plus",u);continue}if(a&&a.value==="("||s.regex===!1){v({type:"plus",value:u,output:y});continue}if(a&&(a.type==="bracket"||a.type==="paren"||a.type==="brace")||c.parens>0){v({type:"plus",value:u});continue}v({type:"plus",value:y});continue}if(u==="@"){if(s.noextglob!==!0&&O()==="("&&O(2)!=="?"){v({type:"at",extglob:!0,value:u,output:""});continue}v({type:"text",value:u});continue}if(u!=="*"){(u==="$"||u==="^")&&(u=`\\${u}`);let f=rr.exec(z());f&&(u+=f[0],c.index+=f[0].length),v({type:"text",value:u});continue}if(a&&(a.type==="globstar"||a.star===!0)){a.type="star",a.star=!0,a.value+=u,a.output=$,c.backtrack=!0,c.globstar=!0,X(u);continue}let d=z();if(s.noextglob!==!0&&/^\([^?]/.test(d)){ct("star",u);continue}if(a.type==="star"){if(s.noglobstar===!0){X(u);continue}let f=a.prev,C=f.prev,P=f.type==="slash"||f.type==="bos",M=C&&(C.type==="star"||C.type==="globstar");if(s.bash===!0&&(!P||d[0]&&d[0]!=="/")){v({type:"star",value:u,output:""});continue}let T=c.braces>0&&(f.type==="comma"||f.type==="brace"),Q=G.length&&(f.type==="pipe"||f.type==="paren");if(!P&&f.type!=="paren"&&!T&&!Q){v({type:"star",value:u,output:""});continue}for(;d.slice(0,3)==="/**";){let j=t[c.index+4];if(j&&j!=="/")break;d=d.slice(3),X("/**",3);}if(f.type==="bos"&&K()){a.type="globstar",a.value+=u,a.output=I(s),c.output=a.output,c.globstar=!0,X(u);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&!M&&K()){c.output=c.output.slice(0,-(f.output+a.output).length),f.output=`(?:${f.output}`,a.type="globstar",a.output=I(s)+(s.strictSlashes?")":"|$)"),a.value+=u,c.globstar=!0,c.output+=f.output+a.output,X(u);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&d[0]==="/"){let j=d[1]!==void 0?"|$":"";c.output=c.output.slice(0,-(f.output+a.output).length),f.output=`(?:${f.output}`,a.type="globstar",a.output=`${I(s)}${_}|${_}${j})`,a.value+=u,c.output+=f.output+a.output,c.globstar=!0,X(u+k()),v({type:"slash",value:"/",output:""});continue}if(f.type==="bos"&&d[0]==="/"){a.type="globstar",a.value+=u,a.output=`(?:^|${_}|${I(s)}${_})`,c.output=a.output,c.globstar=!0,X(u+k()),v({type:"slash",value:"/",output:""});continue}c.output=c.output.slice(0,-a.output.length),a.type="globstar",a.output=I(s),a.value+=u,c.output+=a.output,c.globstar=!0,X(u);continue}let H={type:"star",value:u,output:$};if(s.bash===!0){H.output=".*?",(a.type==="bos"||a.type==="slash")&&(H.output=L+H.output),v(H);continue}if(a&&(a.type==="bracket"||a.type==="paren")&&s.regex===!0){H.output=u,v(H);continue}(c.index===c.start||a.type==="slash"||a.type==="dot")&&(a.type==="dot"?(c.output+=p,a.output+=p):s.dot===!0?(c.output+=m,a.output+=m):(c.output+=L,a.output+=L),O()!=="*"&&(c.output+=E,a.output+=E)),v(H);}for(;c.brackets>0;){if(s.strictBrackets===!0)throw new SyntaxError(tt("closing","]"));c.output=U.escapeLast(c.output,"["),V("brackets");}for(;c.parens>0;){if(s.strictBrackets===!0)throw new SyntaxError(tt("closing",")"));c.output=U.escapeLast(c.output,"("),V("parens");}for(;c.braces>0;){if(s.strictBrackets===!0)throw new SyntaxError(tt("closing","}"));c.output=U.escapeLast(c.output,"{"),V("braces");}if(s.strictSlashes!==!0&&(a.type==="star"||a.type==="bracket")&&v({type:"maybe_slash",value:"",output:`${_}?`}),c.backtrack===!0){c.output="";for(let d of c.tokens)c.output+=d.output!=null?d.output:d.value,d.suffix&&(c.output+=d.suffix);}return c};Ct.fastpaths=(t,e)=>{let s={...e},r=typeof s.maxLength=="number"?Math.min(ht,s.maxLength):ht,n=t.length;if(n>r)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${r}`);t=ie[t]||t;let{DOT_LITERAL:i,SLASH_LITERAL:o,ONE_CHAR:l,DOTS_SLASH:b,NO_DOT:S,NO_DOTS:x,NO_DOTS_SLASH:y,STAR:_,START_ANCHOR:E}=ot.globChars(s.windows),R=s.dot?x:S,g=s.dot?y:S,p=s.capture?"":"?:",m={negated:!1,prefix:""},h=s.bash===!0?".*?":_;s.capture&&(h=`(${h})`);let q=L=>L.noglobstar===!0?h:`(${p}(?:(?!${E}${L.dot?b:i}).)*?)`,F=L=>{switch(L){case "*":return `${R}${l}${h}`;case ".*":return `${i}${l}${h}`;case "*.*":return `${R}${h}${i}${l}${h}`;case "*/*":return `${R}${h}${o}${l}${g}${h}`;case "**":return R+q(s);case "**/*":return `(?:${R}${q(s)}${o})?${g}${l}${h}`;case "**/*.*":return `(?:${R}${q(s)}${o})?${g}${h}${i}${l}${h}`;case "**/.*":return `(?:${R}${q(s)}${o})?${i}${l}${h}`;default:{let A=/^(.*?)\.(\w+)$/.exec(L);if(!A)return;let $=F(A[1]);return $?$+i+A[2]:void 0}}},w=U.removePrefix(t,m),I=F(w);return I&&s.strictSlashes!==!0&&(I+=`${o}?`),I};ae.exports=Ct;});var fe=J((hn,pe)=>{"use strict";var pr=ne(),$t=ce(),le=nt(),fr=rt(),hr=t=>t&&typeof t=="object"&&!Array.isArray(t),D=(t,e,s=!1)=>{if(Array.isArray(t)){let x=t.map(_=>D(_,e,s));return _=>{for(let E of x){let R=E(_);if(R)return R}return !1}}let r=hr(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let n=e||{},i=n.windows,o=r?D.compileRe(t,e):D.makeRe(t,e,!1,!0),l=o.state;delete o.state;let b=()=>!1;if(n.ignore){let x={...e,ignore:null,onMatch:null,onResult:null};b=D(n.ignore,x,s);}let S=(x,y=!1)=>{let{isMatch:_,match:E,output:R}=D.test(x,o,e,{glob:t,posix:i}),g={glob:t,state:l,regex:o,posix:i,input:x,output:R,match:E,isMatch:_};return typeof n.onResult=="function"&&n.onResult(g),_===!1?(g.isMatch=!1,y?g:!1):b(x)?(typeof n.onIgnore=="function"&&n.onIgnore(g),g.isMatch=!1,y?g:!1):(typeof n.onMatch=="function"&&n.onMatch(g),y?g:!0)};return s&&(S.state=l),S};D.test=(t,e,s,{glob:r,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return {isMatch:!1,output:""};let i=s||{},o=i.format||(n?le.toPosixSlashes:null),l=t===r,b=l&&o?o(t):t;return l===!1&&(b=o?o(t):t,l=b===r),(l===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?l=D.matchBase(t,e,s,n):l=e.exec(b)),{isMatch:!!l,match:l,output:b}};D.matchBase=(t,e,s)=>(e instanceof RegExp?e:D.makeRe(e,s)).test(le.basename(t));D.isMatch=(t,e,s)=>D(e,s)(t);D.parse=(t,e)=>Array.isArray(t)?t.map(s=>D.parse(s,e)):$t(t,{...e,fastpaths:!1});D.scan=(t,e)=>pr(t,e);D.compileRe=(t,e,s=!1,r=!1)=>{if(s===!0)return t.output;let n=e||{},i=n.contains?"":"^",o=n.contains?"":"$",l=`${i}(?:${t.output})${o}`;t&&t.negated===!0&&(l=`^(?!${l}).*$`);let b=D.toRegex(l,e);return r===!0&&(b.state=t),b};D.makeRe=(t,e={},s=!1,r=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=$t.fastpaths(t,e)),n.output||(n=$t(t,e)),D.compileRe(n,e,s,r)};D.toRegex=(t,e)=>{try{let s=e||{};return new RegExp(t,s.flags||(s.nocase?"i":""))}catch(s){if(e&&e.debug===!0)throw s;return /$^/}};D.constants=fr;pe.exports=D;});var me=J((dn,ge)=>{"use strict";var he=fe(),dr=nt();function de(t,e,s=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:dr.isWindows()}),he(t,e,s)}Object.assign(de,he);ge.exports=de;});var It=Ot(Ht());var kt=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite.cjs', document.baseURI).href)));function Ge(t){let e=path.normalize(t);return e.length>1&&e[e.length-1]===path.sep&&(e=e.substring(0,e.length-1)),e}var We=/[\\/]/g;function Bt(t,e){return t.replace(We,e)}var Ue=/^[a-z]:[\\/]$/i;function Ke(t){return t==="/"||Ue.test(t)}function mt(t,e){let{resolvePaths:s,normalizePath:r,pathSeparator:n}=e,i=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(s&&(t=path.resolve(t)),(r||i)&&(t=Ge(t)),t===".")return "";let o=t[t.length-1]!==n;return Bt(o?t+n:t,n)}function Mt(t,e){return e+t}function Xe(t,e){return function(s,r){return r.startsWith(t)?r.slice(t.length)+s:Bt(path.relative(t,r),e.pathSeparator)+e.pathSeparator+s}}function Qe(t){return t}function je(t,e,s){return e+t+s}function ze(t,e){let{relativePaths:s,includeBasePath:r}=e;return s&&t?Xe(t,e):r?Mt:Qe}function Ye(t){return function(e,s){s.push(e.substring(t.length)||".");}}function Ve(t){return function(e,s,r){let n=e.substring(t.length)||".";r.every(i=>i(n,true))&&s.push(n);}}var Je=(t,e)=>{e.push(t||".");},Ze=(t,e,s)=>{let r=t||".";s.every(n=>n(r,true))&&e.push(r);},ts=()=>{};function es(t,e){let{includeDirs:s,filters:r,relativePaths:n}=e;return s?n?r&&r.length?Ve(t):Ye(t):r&&r.length?Ze:Je:ts}var ss=(t,e,s,r)=>{r.every(n=>n(t,false))&&s.files++;},rs=(t,e,s,r)=>{r.every(n=>n(t,false))&&e.push(t);},ns=(t,e,s,r)=>{s.files++;},is=(t,e)=>{e.push(t);},os=()=>{};function us(t){let{excludeFiles:e,filters:s,onlyCounts:r}=t;return e?os:s&&s.length?r?ss:rs:r?ns:is}var as=t=>t,cs=()=>[""].slice(0,0);function ls(t){return t.group?cs:as}var ps=(t,e,s)=>{t.push({directory:e,files:s,dir:e});},fs=()=>{};function hs(t){return t.group?ps:fs}var ds=function(t,e,s){let{queue:r,fs:n,options:{suppressErrors:i}}=e;r.enqueue(),n.realpath(t,(o,l)=>{if(o)return r.dequeue(i?null:o,e);n.stat(l,(b,S)=>{if(b)return r.dequeue(i?null:b,e);if(S.isDirectory()&&qt(t,l,e))return r.dequeue(null,e);s(S,l),r.dequeue(null,e);});});},gs=function(t,e,s){let{queue:r,fs:n,options:{suppressErrors:i}}=e;r.enqueue();try{let o=n.realpathSync(t),l=n.statSync(o);if(l.isDirectory()&&qt(t,o,e))return;s(l,o);}catch(o){if(!i)throw o}};function ms(t,e){return !t.resolveSymlinks||t.excludeSymlinks?null:e?gs:ds}function qt(t,e,s){if(s.options.useRealPaths)return bs(e,s);let r=path.dirname(t),n=1;for(;r!==s.root&&n<2;){let i=s.symlinks.get(r);!!i&&(i===e||i.startsWith(e)||e.startsWith(i))?n++:r=path.dirname(r);}return s.symlinks.set(t,e),n>1}function bs(t,e){return e.visited.includes(t+e.options.pathSeparator)}var ys=t=>t.counts,Rs=t=>t.groups,xs=t=>t.paths,As=t=>t.paths.slice(0,t.options.maxFiles),Ss=(t,e,s)=>(ft(e,s,t.counts,t.options.suppressErrors),null),_s=(t,e,s)=>(ft(e,s,t.paths,t.options.suppressErrors),null),Es=(t,e,s)=>(ft(e,s,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),vs=(t,e,s)=>(ft(e,s,t.groups,t.options.suppressErrors),null);function ft(t,e,s,r){e(t&&!r?t:null,s);}function Cs(t,e){let{onlyCounts:s,group:r,maxFiles:n}=t;return s?e?ys:Ss:r?e?Rs:vs:n?e?As:Es:e?xs:_s}var Ft={withFileTypes:true},$s=(t,e,s,r,n)=>{if(t.queue.enqueue(),r<0)return t.queue.dequeue(null,t);let{fs:i}=t;t.visited.push(e),t.counts.directories++,i.readdir(e||".",Ft,(o,l=[])=>{n(l,s,r),t.queue.dequeue(t.options.suppressErrors?null:o,t);});},Ls=(t,e,s,r,n)=>{let{fs:i}=t;if(r<0)return;t.visited.push(e),t.counts.directories++;let o=[];try{o=i.readdirSync(e||".",Ft);}catch(l){if(!t.options.suppressErrors)throw l}n(o,s,r);};function Is(t){return t?Ls:$s}var ws=class{count=0;constructor(t){this.onQueueEmpty=t;}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0));}},Os=class{_files=0;_directories=0;set files(t){this._files=t;}get files(){return this._files}set directories(t){this._directories=t;}get directories(){return this._directories}get dirs(){return this._directories}},Ts=class{aborted=false;abort(){this.aborted=true;}},Gt=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,s){this.isSynchronous=!s,this.callbackInvoker=Cs(e,this.isSynchronous),this.root=mt(t,e),this.state={root:Ke(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new Os,options:e,queue:new ws((r,n)=>this.callbackInvoker(n,r,s)),symlinks:new Map,visited:[""].slice(0,0),controller:new Ts,fs:e.fs||Fe__namespace},this.joinPath=ze(this.root,e),this.pushDirectory=es(this.root,e),this.pushFile=us(e),this.getArray=ls(e),this.groupFiles=hs(e),this.resolveSymlink=ms(e,this.isSynchronous),this.walkDirectory=Is(this.isSynchronous);}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(t,e,s)=>{let{paths:r,options:{filters:n,resolveSymlinks:i,excludeSymlinks:o,exclude:l,maxFiles:b,signal:S,useRealPaths:x,pathSeparator:y},controller:_}=this.state;if(_.aborted||S&&S.aborted||b&&r.length>b)return;let E=this.getArray(this.state.paths);for(let R=0;R<t.length;++R){let g=t[R];if(g.isFile()||g.isSymbolicLink()&&!i&&!o){let p=this.joinPath(g.name,e);this.pushFile(p,E,this.state.counts,n);}else if(g.isDirectory()){let p=je(g.name,e,this.state.options.pathSeparator);if(l&&l(g.name,p))continue;this.pushDirectory(p,r,n),this.walkDirectory(this.state,p,p,s-1,this.walk);}else if(this.resolveSymlink&&g.isSymbolicLink()){let p=Mt(g.name,e);this.resolveSymlink(p,this.state,(m,h)=>{if(m.isDirectory()){if(h=mt(h,this.state.options),l&&l(g.name,x?h:p+y))return;this.walkDirectory(this.state,h,x?h:p+y,s-1,this.walk);}else {h=x?h:p;let q=path.basename(h),F=mt(path.dirname(h),this.state.options);h=this.joinPath(q,F),this.pushFile(h,E,this.state.counts,n);}});}}this.groupFiles(this.state.groups,e,E);}};function Ps(t,e){return new Promise((s,r)=>{Wt(t,e,(n,i)=>{if(n)return r(n);s(i);});})}function Wt(t,e,s){new Gt(t,e,s).start();}function Hs(t,e){return new Gt(t,e).start()}var Nt=class{constructor(t,e){this.root=t,this.options=e;}withPromise(){return Ps(this.root,this.options)}withCallback(t){Wt(this.root,this.options,t);}sync(){return Hs(this.root,this.options)}},Ut=null;try{kt.resolve("picomatch"),Ut=kt("picomatch");}catch{}var Kt=class{globCache={};options={maxDepth:1/0,suppressErrors:true,pathSeparator:path.sep,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction;}group(){return this.options.group=true,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=true,this}withRelativePaths(){return this.options.relativePaths=true,this}withDirs(){return this.options.includeDirs=true,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=true,this.options.includeBasePath=true,this}withErrors(){return this.options.suppressErrors=false,this}withSymlinks({resolvePaths:t=true}={}){return this.options.resolveSymlinks=true,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=true,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=true,this.options.includeDirs=true,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=true,this}crawl(t){return new Nt(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new Nt(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:true})}globWithOptions(t,...e){let s=this.globFunction||Ut;if(!s)throw new Error("Please specify a glob function to use glob matching.");var r=this.globCache[t.join("\0")];return r||(r=s(t,...e),this.globCache[t.join("\0")]=r),this.options.filters.push(n=>r(n)),this}};var et=Ot(me(),1),Er=Array.isArray,xe=/\\/g,vr=/^[A-Za-z]:$/,Ae=process.platform==="win32",Cr=/^(\/?\.\.)+$/;function $r(t,e={}){let s=t.length,r=Array(s),n=Array(s),i,o;for(i=0;i<s;i++){let l=Se(t[i]);r[i]=l;let b=l.length,S=Array(b);for(o=0;o<b;o++)S[o]=(0, et.default)(l[o],e);n[i]=S;}return l=>{let b=l.split("/");if(b[0]===".."&&Cr.test(l))return true;for(i=0;i<s;i++){let S=r[i],x=n[i],y=b.length,_=Math.min(y,S.length);for(o=0;o<_;){let E=S[o];if(E.includes("/"))return true;if(!x[o](b[o]))break;if(!e.noglobstar&&E==="**")return true;o++;}if(o===y)return true}return false}}var Lr=/^[A-Z]:\/$/i,Ir=Ae?t=>Lr.test(t):t=>t==="/";function be(t,e,s){if(t===e||e.startsWith(`${t}/`)){if(s){let n=t.length+ +!Ir(t);return (i,o)=>i.slice(n,o?-1:void 0)||"."}let r=e.slice(t.length+1);return r?(n,i)=>{if(n===".")return r;let o=`${r}/${n}`;return i?o.slice(0,-1):o}:(n,i)=>i&&n!=="."?n.slice(0,-1):n}return s?r=>path.posix.relative(t,r)||".":r=>path.posix.relative(t,`${e}/${r}`)||"."}function wr(t,e){if(e.startsWith(`${t}/`)){let s=e.slice(t.length+1);return r=>`${s}/${r}`}return s=>{let r=path.posix.relative(t,`${e}/${s}`);return s[s.length-1]==="/"&&r!==""?`${r}/`:r||"."}}function ye(t){return t.replace(vr,e=>`${e}/`)}var Or={parts:true};function Se(t){var e;let s=et.default.scan(t,Or);return !((e=s.parts)===null||e===void 0)&&e.length?s.parts:[t]}var Tr=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Pr=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,Hr=t=>t.replace(Tr,"\\$&"),kr=t=>t.replace(Pr,"\\$&"),Nr=Ae?kr:Hr;function Dr(t,e){let s=et.default.scan(t);return s.isGlob||s.negated}function ut(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t);}function _e(t){return typeof t=="string"?[t]:t??[]}var Br=/^(\/?\.\.)+/,Mr=/\\(?=[()[\]{}!*+?@|])/g;function Lt(t,e,s,r){var n;let i=e.cwd,o=t;t[t.length-1]==="/"&&(o=t.slice(0,-1)),o[o.length-1]!=="*"&&e.expandDirectories&&(o+="/**");let l=Nr(i);o=path.isAbsolute(o.replace(Mr,""))?path.posix.relative(l,o):path.posix.normalize(o);let b=(n=Br.exec(o))===null||n===void 0?void 0:n[0],S=Se(o);if(b){let y=(b.length+1)/3,_=0,E=l.split("/");for(;_<y&&S[_+y]===E[E.length+_-y];)o=o.slice(0,(y-_-1)*3)+o.slice((y-_)*3+S[_+y].length+1)||".",_++;let R=path.posix.join(i,b.slice(_*3));R[0]!=="."&&s.root.length>R.length&&(s.root=ye(R),s.depthOffset=-y+_);}if(!r&&s.depthOffset>=0){var x;(x=s.commonPath)!==null&&x!==void 0||(s.commonPath=S);let y=[],_=Math.min(s.commonPath.length,S.length);for(let E=0;E<_;E++){let R=S[E];if(R==="**"&&!S[E+1]){y.pop();break}if(E===S.length-1||R!==s.commonPath[E]||Dr(R))break;y.push(R);}s.depthOffset=y.length,s.commonPath=y,s.root=ye(y.length>0?path.posix.join(i,...y):i);}return o}function qr(t,e,s){let r=[],n=[];for(let i of t.ignore)i&&(i[0]!=="!"||i[1]==="(")&&n.push(Lt(i,t,s,true));for(let i of e)i&&(i[0]!=="!"||i[1]==="("?r.push(Lt(i,t,s,false)):(i[1]!=="!"||i[2]==="(")&&n.push(Lt(i.slice(1),t,s,true)));return {match:r,ignore:n}}function Fr(t,e){let s=t.cwd,r={root:s,depthOffset:0},n=qr(t,e,r);t.debug&&ut("internal processing patterns:",n);let{absolute:i,caseSensitiveMatch:o,debug:l,dot:b,followSymbolicLinks:S,onlyDirectories:x}=t,y=r.root.replace(xe,""),_={dot:b,nobrace:t.braceExpansion===false,nocase:!o,noextglob:t.extglob===false,noglobstar:t.globstar===false,posix:true},E=(0, et.default)(n.match,_),R=(0, et.default)(n.ignore,_),g=$r(n.match,_),p=be(s,y,i),m=i?p:be(s,y,true),h=(w,I)=>{let L=m(I,true);return L!=="."&&!g(L)||R(L)},q;t.deep!==void 0&&(q=Math.round(t.deep-r.depthOffset));let F=new Kt({filters:[l?(w,I)=>{let L=p(w,I),A=E(L)&&!R(L);return A&&ut(`matched ${L}`),A}:(w,I)=>{let L=p(w,I);return E(L)&&!R(L)}],exclude:l?(w,I)=>{let L=h(w,I);return ut(`${L?"skipped":"crawling"} ${I}`),L}:h,fs:t.fs,pathSeparator:"/",relativePaths:!i,resolvePaths:i,includeBasePath:i,resolveSymlinks:S,excludeSymlinks:!S,excludeFiles:x,includeDirs:x||!t.onlyFiles,maxDepth:q,signal:t.signal}).crawl(y);return t.debug&&ut("internal properties:",{...r,root:y}),[F,s!==y&&!i&&wr(s,y)]}function Gr(t,e){if(e)for(let s=t.length-1;s>=0;s--)t[s]=e(t[s]);return t}var Re={caseSensitiveMatch:true,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:true,followSymbolicLinks:true,onlyFiles:true};function Wr(t){let e=Object.assign({},t);for(let s in Re)e[s]===void 0&&Object.assign(e,{[s]:Re[s]});return e.cwd=(e.cwd instanceof URL?url.fileURLToPath(e.cwd):path.resolve(e.cwd||process.cwd())).replace(xe,"/"),e.ignore=_e(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||Fe.readdir,readdirSync:e.fs.readdirSync||Fe.readdirSync,realpath:e.fs.realpath||Fe.realpath,realpathSync:e.fs.realpathSync||Fe.realpathSync,stat:e.fs.stat||Fe.stat,statSync:e.fs.statSync||Fe.statSync}),e.debug&&ut("globbing with options:",e),e}function Ur(t,e={}){var s;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let r=Er(t)||typeof t=="string",n=_e((s=r?t:t.patterns)!==null&&s!==void 0?s:"**/*"),i=Wr(r?e:t);return n.length>0?Fr(i,n):[]}async function Ee(t,e){let[s,r]=Ur(t,e);return s?Gr(await s.withPromise(),r):[]}var dt=It.default.cyan("(nqtr)");function st(t){return t?Array.isArray(t)?t:[t]:[]}function Yr(t){return t?.find(e=>e.name==="vite-plugin-pixi-vn")}function _n(t){let e,s,r,n=new Promise(g=>{r=g;}),i=[...st(t?.activities),...st(t?.commitments),...st(t?.locations),...st(t?.maps),...st(t?.quests),...st(t?.rooms)],o=new Set,l={activityIds:[],commitmentIds:[],locationIds:[],mapIds:[],questIds:[],roomIds:[]};function b(){if(!t?.typeFilePath||!e)return null;let g=t.typeFilePath;return path.isAbsolute(g)?g:path.resolve(e.root,g)}function S(g,p){Fe.mkdirSync(path.dirname(g),{recursive:true});let m=["// @ts-nocheck","/* eslint-disable */","// noinspection JSUnusedGlobalSymbols","// This file is auto-generated by @drincs/nqtr vite plugin. Do not edit manually.","",`export const nqtrActivityIds = ${JSON.stringify(p.activityIds)} as const;`,`export const nqtrCommitmentIds = ${JSON.stringify(p.commitmentIds)} as const;`,`export const nqtrLocationIds = ${JSON.stringify(p.locationIds)} as const;`,`export const nqtrMapIds = ${JSON.stringify(p.mapIds)} as const;`,`export const nqtrQuestIds = ${JSON.stringify(p.questIds)} as const;`,`export const nqtrRoomIds = ${JSON.stringify(p.roomIds)} as const;`,""],h=[["nqtrActivityIdsEnum",p.activityIds],["nqtrCommitmentIdsEnum",p.commitmentIds],["nqtrLocationIdsEnum",p.locationIds],["nqtrMapIdsEnum",p.mapIds],["nqtrQuestIdsEnum",p.questIds],["nqtrRoomIdsEnum",p.roomIds]];for(let[F,w]of h){if(w.length===0){m.push(`export const ${F} = {} as const;`);continue}let I=w.map(L=>`${JSON.stringify(L)}: ${JSON.stringify(L)}`).join(", ");m.push(`export const ${F} = { ${I} } as const;`);}m.push(""),m.push('declare module "@drincs/nqtr/registries" {');let q=[["NqtrActivityIds",p.activityIds],["NqtrCommitmentIds",p.commitmentIds],["NqtrLocationIds",p.locationIds],["NqtrMapIds",p.mapIds],["NqtrQuestIds",p.questIds],["NqtrRoomIds",p.roomIds]];for(let[F,w]of q)if(w.length!==0){m.push(` interface ${F} {`);for(let I of w)m.push(` ${JSON.stringify(I)}: never;`);m.push(" }");}m.push("}"),m.push(""),Fe.writeFileSync(g,m.join(`
2
+ `),"utf-8");}function x(){let g=b();if(g)try{S(g,l);}catch(p){e?.logger.error(`${dt} Failed to write type file "${g}".`,{error:p instanceof Error?p:new Error(String(p)),timestamp:true});}}async function y(g){let p={};try{p=await g("@drincs/nqtr/registries");}catch{}l={activityIds:p.RegisteredActivities?.values().map(h=>h.id)??[],commitmentIds:p.RegisteredCommitments?.values().map(h=>h.id)??[],locationIds:p.RegisteredLocations?.values().map(h=>h.id)??[],mapIds:p.RegisteredMaps?.values().map(h=>h.id)??[],questIds:p.RegisteredQuests?.values().map(h=>h.id)??[],roomIds:p.RegisteredRooms?.values().map(h=>h.id)??[]};let m=l.activityIds.length+l.commitmentIds.length+l.locationIds.length+l.mapIds.length+l.questIds.length+l.roomIds.length;e?.logger.info(`${dt} ${It.default.dim(`${m} NQTR id(s) \u2014 activities: ${l.activityIds.length}, commitments: ${l.commitmentIds.length}, locations: ${l.locationIds.length}, maps: ${l.mapIds.length}, quests: ${l.questIds.length}, rooms: ${l.roomIds.length}`)}`,{timestamp:true});}async function _(g){try{let p=await g("@drincs/nqtr/registries");p.RegisteredActivities?.clear?.(),p.RegisteredCommitments?.clear?.(),p.RegisteredLocations?.clear?.(),p.RegisteredMaps?.clear?.(),p.RegisteredQuests?.clear?.(),p.RegisteredRooms?.clear?.();}catch{}}async function E(g,p){let m=await Ee(i,{cwd:p,absolute:true,onlyFiles:true});for(let h of m){o.add(h);try{await g(h);}catch{}}}async function R(g){for(let p of o)for(let m of g.moduleGraph.getModulesByFile(p)??[])g.moduleGraph.invalidateModule(m);await _(p=>g.ssrLoadModule(p)),await E(p=>g.ssrLoadModule(p),e.root),await y(p=>g.ssrLoadModule(p)),x();}return {name:"vite-plugin-nqtr",enforce:"pre",api:{contentLoaded:n},config(g,p){if(p.command==="serve"&&i.length>0)return {ssr:{noExternal:["@drincs/nqtr","@drincs/pixi-vn"]}}},configResolved(g){e=g,s=Yr(g.plugins),i.length===0&&!s?.api?.contentLoaded&&r();},async buildStart(){if(e?.command!=="build")return;let g=s?.api?.contentLoaded;if(g&&await g,i.length>0){let{createServer:p}=await import('vite'),m=await p({root:e.root,configFile:false,resolve:e.resolve,server:{middlewareMode:true},appType:"custom",logLevel:"silent",optimizeDeps:{noDiscovery:true},ssr:{noExternal:["@drincs/nqtr","@drincs/pixi-vn"]}});try{await E(h=>m.ssrLoadModule(h),e.root),await y(h=>m.ssrLoadModule(h)),x(),r();}catch{r();}finally{await m.close();}}else if(g){try{let p=await import('@drincs/nqtr/registries');l={activityIds:p.RegisteredActivities?.values().map(m=>m.id)??[],commitmentIds:p.RegisteredCommitments?.values().map(m=>m.id)??[],locationIds:p.RegisteredLocations?.values().map(m=>m.id)??[],mapIds:p.RegisteredMaps?.values().map(m=>m.id)??[],questIds:p.RegisteredQuests?.values().map(m=>m.id)??[],roomIds:p.RegisteredRooms?.values().map(m=>m.id)??[]},x();}catch{}r();}else r();},configureServer(g){(async()=>{let m=s?.api?.contentLoaded;m&&await m,i.length>0&&await E(h=>g.ssrLoadModule(h),e.root),await y(h=>g.ssrLoadModule(h)),x(),r(),s?.api?.onReload?.(()=>{y(h=>g.ssrLoadModule(h)).then(()=>x()).catch(h=>{e?.logger.error(`${dt} Failed to regenerate types after pixi-vn reload.`,{error:h instanceof Error?h:new Error(String(h)),timestamp:true});});});})().catch(()=>r());},hotUpdate({file:g,server:p}){let m=b();if(m&&g===m)return [];if(i.length>0&&o.has(g))return R(p).catch(h=>{e?.logger.error(`${dt} Failed to reload NQTR content.`,{error:h instanceof Error?h:new Error(String(h)),timestamp:true});}),[]}}}exports.vitePluginNqtr=_n;
package/dist/vite.d.mts CHANGED
@@ -157,4 +157,5 @@ interface VitePluginNqtrOptions {
157
157
  */
158
158
  declare function vitePluginNqtr(options?: VitePluginNqtrOptions): Plugin;
159
159
 
160
- export { type VitePluginNqtrOptions, vitePluginNqtr };
160
+ export { vitePluginNqtr };
161
+ export type { VitePluginNqtrOptions };
package/dist/vite.d.ts CHANGED
@@ -157,4 +157,5 @@ interface VitePluginNqtrOptions {
157
157
  */
158
158
  declare function vitePluginNqtr(options?: VitePluginNqtrOptions): Plugin;
159
159
 
160
- export { type VitePluginNqtrOptions, vitePluginNqtr };
160
+ export { vitePluginNqtr };
161
+ export type { VitePluginNqtrOptions };