nexmap4 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,101 @@
1
+ this.nexMap4=function(e,t){var n=Object.create,o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,__commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),__copyProps=(e,t,n,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(var c,d=i(t),u=0,p=d.length;u<p;u++)c=d[u],l.call(e,c)||c===n||o(e,c,{get:(e=>t[e]).bind(null,c),enumerable:!(s=a(t,c))||s.enumerable});return e},__toESM=(e,t,a)=>(a=null!=e?n(s(e)):{},__copyProps(!t&&e&&e.__esModule?a:o(a,"default",{value:e,enumerable:!0}),e));let c=__toESM(e,1);e=__toESM(e);let d=__toESM(t,1);function deepFreeze$8(e){if(!e||"object"!=typeof e)return e;Object.freeze(e);for(const t of Object.values(e))deepFreeze$8(t);return e}t=__toESM(t);var u,p=Object.freeze({FARSEE:"farsee",FARSEE_AREA:"farsee.area",FULLSENSE:"fullsense",LANDMARK_ADD:"landmark.add",LANDMARK_LIST:"landmark.list",LANDMARK_REMOVE:"landmark.remove",MAP_CENTER:"map.center",MAP_FIT:"map.fit",MAP_REFRESH:"map.refresh",MAP_ROOM_DIAGNOSTIC:"map.roomDiagnostic",MAP_ROOM_INFO:"map.roomInfo",MAP_SELECT_ROOM:"map.selectRoom",MAP_SET_BACKGROUND:"map.setBackground",MAP_SHOW_AREA:"map.showArea",MAP_SHOW_ROOM:"map.showRoom",MAP_ZOOM:"map.zoom",SEARCH_AREA:"search.area",SEARCH_AREAS:"search.areas",SEARCH_DENIZENS:"search.denizens",SEARCH_GAME_AREA:"search.gameArea",SEARCH_ROOMS:"search.rooms",SYSTEM_CLOSE_RESULTS:"system.closeResults",SYSTEM_CLOSE_SETTINGS:"system.closeSettings",SYSTEM_CLOSE_SHELL:"system.closeShell",SYSTEM_HELP:"system.help",SYSTEM_NOTICE:"system.notice",SYSTEM_OPEN_SETTINGS:"system.openSettings",SYSTEM_OPEN_SHELL:"system.openShell",SYSTEM_SHOW_RESULTS:"system.showResults",TRACKING_CLEAR:"tracking.clear",TRACKING_LIST:"tracking.list",TRACKING_SUBJECT:"tracking.subject",TRAVEL_DISABLE:"travel.disable",TRAVEL_ENABLE:"travel.enable",TRAVEL_GOTO:"travel.goto",TRAVEL_STOP:"travel.stop",TRAVEL_TO_AREA:"travel.toArea",TRAVEL_TO_LANDMARK:"travel.toLandmark",TRAVEL_TO_ROOM:"travel.toRoom",WORMHOLES_ADD:"wormholes.add",WORMHOLES_LIST:"wormholes.list",WORMHOLES_PROBE:"wormholes.probe",WORMHOLES_REFRESH:"wormholes.refresh",WORMHOLES_REMOVE:"wormholes.remove"}),m=deepFreeze$8([{description:"Compute a route to a concrete room id and optionally start walker execution.",group:"travel",id:p.TRAVEL_TO_ROOM,title:"Travel To Room"},{description:"Resolve a saved landmark and travel to its room.",group:"travel",id:p.TRAVEL_TO_LANDMARK,title:"Travel To Landmark"},{description:"Travel to the nearest reachable room in the given area.",group:"travel",id:p.TRAVEL_TO_AREA,title:"Travel To Area"},{description:"Resolve a goto query (room id, landmark, or area name) and begin travel.",group:"travel",id:p.TRAVEL_GOTO,title:"Go To"},{description:"Stop the active walker plan.",group:"travel",id:p.TRAVEL_STOP,title:"Stop Travel"},{description:"Show a room's area and z-level through the active map renderer.",group:"map",id:p.MAP_SHOW_ROOM,title:"Show Room"},{description:"Show and select a room through the active map renderer.",group:"map",id:p.MAP_SELECT_ROOM,title:"Select Room"},{description:"Show an area/z slice through the active map renderer.",group:"map",id:p.MAP_SHOW_AREA,title:"Show Area"},{description:"Set or clear the map background image URL and optional opacity.",group:"map",id:p.MAP_SET_BACKGROUND,title:"Set Background"},{description:"Set the map zoom level.",group:"map",id:p.MAP_ZOOM,title:"Zoom Map"},{description:"Fit the map viewport to the visible area.",group:"map",id:p.MAP_FIT,title:"Fit Map"},{description:"Center the map viewport on the current room.",group:"map",id:p.MAP_CENTER,title:"Center Map"},{description:"Refresh the map renderer, re-rendering the current slice.",group:"map",id:p.MAP_REFRESH,title:"Refresh Map"},{description:"Print a full diagnostic snapshot of GMCP Location, GMCP Room.Info, and crowdmap data for the current room.",group:"map",id:p.MAP_ROOM_DIAGNOSTIC,title:"Room Diagnostic"},{description:"Print the current or requested room details from GMCP and the map graph.",group:"map",id:p.MAP_ROOM_INFO,title:"Room Info"},{description:"Enable one or more travel classes by removing them from disabledTravelClasses.",group:"travel",id:p.TRAVEL_ENABLE,title:"Enable Travel Class"},{description:"Disable one or more travel classes by adding them to disabledTravelClasses.",group:"travel",id:p.TRAVEL_DISABLE,title:"Disable Travel Class"},{description:"Save the current or provided room as a nexMap4-native landmark.",group:"landmarks",id:p.LANDMARK_ADD,title:"Add Landmark"},{description:"Return saved nexMap4-native landmarks.",group:"landmarks",id:p.LANDMARK_LIST,title:"List Landmarks"},{description:"Remove a saved nexMap4-native landmark by id or name.",group:"landmarks",id:p.LANDMARK_REMOVE,title:"Remove Landmark"},{description:"Search room names through the graph-backed search index.",group:"search",id:p.SEARCH_ROOMS,title:"Search Rooms"},{description:"Find one exact area by name through the graph-backed search index.",group:"search",id:p.SEARCH_AREA,title:"Find Area"},{description:"Search area names through the graph-backed search index.",group:"search",id:p.SEARCH_AREAS,title:"Search Areas"},{description:"Resolve Game Area labels to crowdmap area ids through the search index.",group:"search",id:p.SEARCH_GAME_AREA,title:"Find Game Area"},{description:"Search denizens through the remote denizen client when configured.",group:"search",id:p.SEARCH_DENIZENS,title:"Search Denizens"},{description:"Return the loaded remote wormholes used by pathing.",group:"wormholes",id:p.WORMHOLES_LIST,title:"List Wormholes"},{description:"Reload wormholes from the remote service and refresh graph pathing edges.",group:"wormholes",id:p.WORMHOLES_REFRESH,title:"Refresh Wormholes"},{description:"Create or replace a remote wormhole and refresh graph pathing edges.",group:"wormholes",id:p.WORMHOLES_ADD,title:"Add Wormhole"},{description:"Remove a remote wormhole by source room and refresh graph pathing edges.",group:"wormholes",id:p.WORMHOLES_REMOVE,title:"Remove Wormhole"},{description:"Send a wormhole probe command and arm the wormhole trigger parser.",group:"wormholes",id:p.WORMHOLES_PROBE,title:"Probe Wormholes"},{description:"Track a target, doppleganger, or pet at a known map room.",group:"tracking",id:p.TRACKING_SUBJECT,title:"Track Subject"},{description:"Clear one tracked subject or all tracking overlays.",group:"tracking",id:p.TRACKING_CLEAR,title:"Clear Tracking"},{description:"List the currently tracked subjects.",group:"tracking",id:p.TRACKING_LIST,title:"List Tracking"},{description:"Highlight a farsee target in a resolved room. Pass gameArea for level-2 (exact) farsee; omit it for level-1 same-area farsee — the player's current game area is used.",group:"intel",id:p.FARSEE,title:"Farsee"},{description:"Highlight an area-scoped farsee target when the exact room is unknown.",group:"intel",id:p.FARSEE_AREA,title:"Farsee Area"},{description:"Highlight multiple fullsense entries on the visible map.",group:"intel",id:p.FULLSENSE,title:"Fullsense"},{description:"Print a formatted list of all available nm commands.",group:"system",id:p.SYSTEM_HELP,title:"Help"},{description:"Send a nexMap4 startup or command notice through the host adapter.",group:"system",id:p.SYSTEM_NOTICE,title:"Notice"},{description:"Open the nexMap4 settings dialog.",group:"system",id:p.SYSTEM_OPEN_SETTINGS,title:"Open Settings"},{description:"Close the nexMap4 settings dialog.",group:"system",id:p.SYSTEM_CLOSE_SETTINGS,title:"Close Settings"},{description:"Open the results dialog with search, landmark, or NPC data.",group:"system",id:p.SYSTEM_SHOW_RESULTS,title:"Show Results"},{description:"Close the results dialog.",group:"system",id:p.SYSTEM_CLOSE_RESULTS,title:"Close Results"},{description:"Open the nexMap4 shell (landmarks, NPC explorer, help).",group:"system",id:p.SYSTEM_OPEN_SHELL,title:"Open Shell"},{description:"Close the nexMap4 shell.",group:"system",id:p.SYSTEM_CLOSE_SHELL,title:"Close Shell"}]),h=deepFreeze$8([{id:"travel",title:"Travel",commandIds:[p.TRAVEL_GOTO,p.TRAVEL_TO_ROOM,p.TRAVEL_TO_AREA,p.TRAVEL_TO_LANDMARK,p.TRAVEL_STOP,p.TRAVEL_ENABLE,p.TRAVEL_DISABLE]},{id:"map",title:"Map",commandIds:[p.MAP_SHOW_ROOM,p.MAP_SELECT_ROOM,p.MAP_SHOW_AREA,p.MAP_ZOOM,p.MAP_FIT,p.MAP_CENTER,p.MAP_REFRESH,p.MAP_ROOM_INFO,p.MAP_SET_BACKGROUND]},{id:"landmarks",title:"Landmarks",commandIds:[p.LANDMARK_ADD,p.LANDMARK_LIST,p.LANDMARK_REMOVE]},{id:"search",title:"Search",commandIds:[p.SEARCH_ROOMS,p.SEARCH_AREA,p.SEARCH_AREAS,p.SEARCH_GAME_AREA,p.SEARCH_DENIZENS]},{id:"wormholes",title:"Wormholes",commandIds:[p.WORMHOLES_LIST,p.WORMHOLES_REFRESH,p.WORMHOLES_ADD,p.WORMHOLES_REMOVE,p.WORMHOLES_PROBE]},{id:"tracking",title:"Tracking",commandIds:[p.TRACKING_SUBJECT,p.TRACKING_CLEAR,p.TRACKING_LIST]},{id:"intel",title:"Intelligence",commandIds:[p.FARSEE,p.FARSEE_AREA,p.FULLSENSE]},{id:"system",title:"System",commandIds:[p.SYSTEM_HELP,p.SYSTEM_NOTICE,p.SYSTEM_OPEN_SETTINGS,p.SYSTEM_OPEN_SHELL,p.SYSTEM_SHOW_RESULTS]}]),g="nexMap4Settings";function $constructor(e,t,n){function init(n,o){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:o,constr:_,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,o);const a=_.prototype,i=Object.keys(a);for(let e=0;e<i.length;e++){const t=i[e];t in n||(n[t]=a[t].bind(n))}}const o=n?.Parent??Object;class a extends o{}function _(e){var t;const o=n?.Parent?new a:this;init(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const n of o._zod.deferred)n();return o}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(_,"init",{value:init}),Object.defineProperty(_,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(_,"name",{value:e}),_}var y=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},b=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(u=globalThis).__zod_globalConfig??(u.__zod_globalConfig={});var v=globalThis.__zod_globalConfig;function config(e){return e&&Object.assign(v,e),v}function getEnumValues(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function jsonStringifyReplacer(e,t){return"bigint"==typeof t?t.toString():t}function cached(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function nullish(e){return null==e}function cleanRegex(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function floatSafeRemainder(e,t){const n=e/t,o=Math.round(n),a=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-o)<a?0:n-o}var w=Symbol("evaluating");function defineLazy(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==w)return void 0===o&&(o=w,o=n()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function assignProp(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function mergeDefs(...e){const t={};for(const n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function esc(e){return JSON.stringify(e)}function slugify(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var S="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function isObject$3(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var x=cached(()=>{if(v.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function isPlainObject$2(e){if(!1===isObject$3(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==isObject$3(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function shallowClone(e){return isPlainObject$2(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var I=new Set(["string","number","symbol"]);function escapeRegex(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function clone$1(e,t,n){const o=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(o._zod.parent=e),o}function normalizeParams(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function optionalKeys(e){return Object.keys(e).filter(t=>"optional"===e[t]._zod.optin&&"optional"===e[t]._zod.optout)}var C={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function pick(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return clone$1(e,mergeDefs(e._zod.def,{get shape(){const e={};for(const o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(e[o]=n.shape[o])}return assignProp(this,"shape",e),e},checks:[]}))}function omit(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return clone$1(e,mergeDefs(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete o[e]}return assignProp(this,"shape",o),o},checks:[]}))}function extend(e,t){if(!isPlainObject$2(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return clone$1(e,mergeDefs(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return assignProp(this,"shape",n),n}}))}function safeExtend(e,t){if(!isPlainObject$2(t))throw new Error("Invalid input to safeExtend: expected a plain object");return clone$1(e,mergeDefs(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return assignProp(this,"shape",n),n}}))}function merge(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");return clone$1(e,mergeDefs(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return assignProp(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function partial(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");return clone$1(t,mergeDefs(t._zod.def,{get shape(){const o=t._zod.def.shape,a={...o};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(a[t]=e?new e({type:"optional",innerType:o[t]}):o[t])}else for(const t in o)a[t]=e?new e({type:"optional",innerType:o[t]}):o[t];return assignProp(this,"shape",a),a},checks:[]}))}function required(e,t,n){return clone$1(t,mergeDefs(t._zod.def,{get shape(){const o=t._zod.def.shape,a={...o};if(n)for(const t in n){if(!(t in a))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(a[t]=new e({type:"nonoptional",innerType:o[t]}))}else for(const t in o)a[t]=new e({type:"nonoptional",innerType:o[t]});return assignProp(this,"shape",a),a}}))}function aborted(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function explicitlyAborted(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!1===e.issues[n]?.continue)return!0;return!1}function prefixIssues(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function unwrapMessage(e){return"string"==typeof e?e:e?.message}function finalizeIssue(e,t,n){const o=e.message?e.message:unwrapMessage(e.inst?._zod.def?.error?.(e))??unwrapMessage(t?.error?.(e))??unwrapMessage(n.customError?.(e))??unwrapMessage(n.localeError?.(e))??"Invalid input",{inst:a,continue:i,input:s,...l}=e;return l.path??(l.path=[]),l.message=o,t?.reportInput&&(l.input=s),l}function getLengthableOrigin(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function issue(...e){const[t,n,o]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:o}:{...t}}var initializer$1=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,jsonStringifyReplacer,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},E=$constructor("$ZodError",initializer$1),R=$constructor("$ZodError",initializer$1,{Parent:Error});function flattenError(e,t=e=>e.message){const n={},o=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):o.push(t(a));return{formErrors:o,fieldErrors:n}}function formatError(e,t=e=>e.message){const n={_errors:[]},processError=(e,o=[])=>{for(const a of e.issues)if("invalid_union"===a.code&&a.errors.length)a.errors.map(e=>processError({issues:e},[...o,...a.path]));else if("invalid_key"===a.code)processError({issues:a.issues},[...o,...a.path]);else if("invalid_element"===a.code)processError({issues:a.issues},[...o,...a.path]);else{const e=[...o,...a.path];if(0===e.length)n._errors.push(t(a));else{let o=n,i=0;for(;i<e.length;){const n=e[i];i!==e.length-1?o[n]=o[n]||{_errors:[]}:(o[n]=o[n]||{_errors:[]},o[n]._errors.push(t(a))),o=o[n],i++}}}};return processError(e),n}var _parse=e=>(t,n,o,a)=>{const i=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new y;if(s.issues.length){const t=new(a?.Err??e)(s.issues.map(e=>finalizeIssue(e,i,config())));throw S(t,a?.callee),t}return s.value},_parseAsync=e=>async(t,n,o,a)=>{const i=o?{...o,async:!0}:{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(a?.Err??e)(s.issues.map(e=>finalizeIssue(e,i,config())));throw S(t,a?.callee),t}return s.value},_safeParse=e=>(t,n,o)=>{const a=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise)throw new y;return i.issues.length?{success:!1,error:new(e??E)(i.issues.map(e=>finalizeIssue(e,a,config())))}:{success:!0,data:i.value}},k=_safeParse(R),_safeParseAsync=e=>async(t,n,o)=>{const a=o?{...o,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},a);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>finalizeIssue(e,a,config())))}:{success:!0,data:i.value}},T=_safeParseAsync(R),_encode=e=>(t,n,o)=>{const a=o?{...o,direction:"backward"}:{direction:"backward"};return _parse(e)(t,n,a)},_decode=e=>(t,n,o)=>_parse(e)(t,n,o),_encodeAsync=e=>async(t,n,o)=>{const a=o?{...o,direction:"backward"}:{direction:"backward"};return _parseAsync(e)(t,n,a)},_decodeAsync=e=>async(t,n,o)=>_parseAsync(e)(t,n,o),_safeEncode=e=>(t,n,o)=>{const a=o?{...o,direction:"backward"}:{direction:"backward"};return _safeParse(e)(t,n,a)},_safeDecode=e=>(t,n,o)=>_safeParse(e)(t,n,o),_safeEncodeAsync=e=>async(t,n,o)=>{const a=o?{...o,direction:"backward"}:{direction:"backward"};return _safeParseAsync(e)(t,n,a)},_safeDecodeAsync=e=>async(t,n,o)=>_safeParseAsync(e)(t,n,o),M=/^[cC][0-9a-z]{6,}$/,$=/^[0-9a-z]+$/,N=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,P=/^[0-9a-vA-V]{20}$/,O=/^[A-Za-z0-9]{27}$/,j=/^[a-zA-Z0-9_-]{21}$/,F=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,L=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,uuid=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,D=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,B="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function emoji(){return new RegExp(B,"u")}var G=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,W=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,V=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,H=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,U=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,q=/^[A-Za-z0-9_-]*$/,K=/^https?$/,Z=/^\+[1-9]\d{6,14}$/,Y="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",X=new RegExp(`^${Y}$`);function timeSource(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function time$1(e){return new RegExp(`^${timeSource(e)}$`)}function datetime$2(e){const t=timeSource({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${Y}T(?:${o})$`)}var string$1=e=>new RegExp(`^${e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*"}$`),J=/^-?\d+$/,Q=/^-?\d+(?:\.\d+)?$/,ee=/^(?:true|false)$/i,te=/^null$/i,re=/^[^A-Z]*$/,ne=/^[^a-z]*$/,oe=$constructor("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ae={number:"number",bigint:"bigint",object:"date"},ie=$constructor("$ZodCheckLessThan",(e,t)=>{oe.init(e,t);const n=ae[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,o=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:n,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),se=$constructor("$ZodCheckGreaterThan",(e,t)=>{oe.init(e,t);const n=ae[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,o=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),le=$constructor("$ZodCheckMultipleOf",(e,t)=>{oe.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value!==BigInt(0):0!==floatSafeRemainder(n.value,t.value))&&n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ce=$constructor("$ZodCheckNumberFormat",(e,t)=>{oe.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[a,i]=C[t.format];e._zod.onattach.push(e=>{const o=e._zod.bag;o.format=t.format,o.minimum=a,o.maximum=i,n&&(o.pattern=J)}),e._zod.check=s=>{const l=s.value;if(n){if(!Number.isInteger(l))return void s.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});if(!Number.isSafeInteger(l))return void(l>0?s.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):s.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}))}l<a&&s.issues.push({origin:"number",input:l,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),l>i&&s.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),de=$constructor("$ZodCheckMaxLength",(e,t)=>{var n;oe.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!nullish(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const a=getLengthableOrigin(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ue=$constructor("$ZodCheckMinLength",(e,t)=>{var n;oe.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!nullish(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const a=getLengthableOrigin(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),pe=$constructor("$ZodCheckLengthEquals",(e,t)=>{var n;oe.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!nullish(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const o=n.value,a=o.length;if(a===t.length)return;const i=getLengthableOrigin(o),s=a>t.length;n.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),me=$constructor("$ZodCheckStringFormat",(e,t)=>{var n,o;oe.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),he=$constructor("$ZodCheckRegex",(e,t)=>{me.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ge=$constructor("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=re),me.init(e,t)}),fe=$constructor("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ne),me.init(e,t)}),ye=$constructor("$ZodCheckIncludes",(e,t)=>{oe.init(e,t);const n=escapeRegex(t.includes),o=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),be=$constructor("$ZodCheckStartsWith",(e,t)=>{oe.init(e,t);const n=new RegExp(`^${escapeRegex(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ve=$constructor("$ZodCheckEndsWith",(e,t)=>{oe.init(e,t);const n=new RegExp(`.*${escapeRegex(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),we=$constructor("$ZodCheckOverwrite",(e,t)=>{oe.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Se=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),o=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const a of o)this.content.push(a)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}},xe={major:4,minor:4,patch:3},Ie=$constructor("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=xe;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const a of o)for(const t of a._zod.onattach)t(e);if(0===o.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const runChecks=(e,t,n)=>{let o,a=aborted(e);for(const i of t){if(i._zod.def.when){if(explicitlyAborted(e))continue;if(!i._zod.def.when(e))continue}else if(a)continue;const t=e.issues.length,s=i._zod.check(e);if(s instanceof Promise&&!1===n?.async)throw new y;if(o||s instanceof Promise)o=(o??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(a||(a=aborted(e,t)))});else{if(e.issues.length===t)continue;a||(a=aborted(e,t))}}return o?o.then(()=>e):e},handleCanaryResult=(t,n,a)=>{if(aborted(t))return t.aborted=!0,t;const i=runChecks(n,o,a);if(i instanceof Promise){if(!1===a.async)throw new y;return i.then(t=>e._zod.parse(t,a))}return e._zod.parse(i,a)};e._zod.run=(t,n)=>{if(n.skipChecks)return e._zod.parse(t,n);if("backward"===n.direction){const o=e._zod.parse({value:t.value,issues:[]},{...n,skipChecks:!0});return o instanceof Promise?o.then(e=>handleCanaryResult(e,t,n)):handleCanaryResult(o,t,n)}const a=e._zod.parse(t,n);if(a instanceof Promise){if(!1===n.async)throw new y;return a.then(e=>runChecks(e,o,n))}return runChecks(a,o,n)}}defineLazy(e,"~standard",()=>({validate:t=>{try{const n=k(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return T(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Ce=$constructor("$ZodString",(e,t)=>{Ie.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??string$1(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ee=$constructor("$ZodStringFormat",(e,t)=>{me.init(e,t),Ce.init(e,t)}),Re=$constructor("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=L),Ee.init(e,t)}),ke=$constructor("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=uuid(e))}else t.pattern??(t.pattern=uuid());Ee.init(e,t)}),Ae=$constructor("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=D),Ee.init(e,t)}),Te=$constructor("$ZodURL",(e,t)=>{Ee.init(e,t),e._zod.check=n=>{try{const o=n.value.trim();if(!t.normalize&&t.protocol?.source===K.source&&!/^https?:\/\//i.test(o))return void n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});const a=new URL(o);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=a.href:n.value=o)}catch(o){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Me=$constructor("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=emoji()),Ee.init(e,t)}),ze=$constructor("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=j),Ee.init(e,t)}),$e=$constructor("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=M),Ee.init(e,t)}),Ne=$constructor("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=$),Ee.init(e,t)}),Pe=$constructor("$ZodULID",(e,t)=>{t.pattern??(t.pattern=N),Ee.init(e,t)}),Oe=$constructor("$ZodXID",(e,t)=>{t.pattern??(t.pattern=P),Ee.init(e,t)}),_e=$constructor("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=O),Ee.init(e,t)}),je=$constructor("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=datetime$2(t)),Ee.init(e,t)}),Fe=$constructor("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=X),Ee.init(e,t)}),Le=$constructor("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=time$1(t)),Ee.init(e,t)}),De=$constructor("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=F),Ee.init(e,t)}),Be=$constructor("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=G),Ee.init(e,t),e._zod.bag.format="ipv4"}),Ge=$constructor("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=W),Ee.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),We=$constructor("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=V),Ee.init(e,t)}),Ve=$constructor("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=H),Ee.init(e,t),e._zod.check=n=>{const o=n.value.split("/");try{if(2!==o.length)throw new Error;const[e,t]=o;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function isValidBase64(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var He=$constructor("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=U),Ee.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{isValidBase64(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function isValidBase64URL(e){if(!q.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return isValidBase64(t.padEnd(4*Math.ceil(t.length/4),"="))}var Ue=$constructor("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=q),Ee.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{isValidBase64URL(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),qe=$constructor("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Z),Ee.init(e,t)});function isValidJWT(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[o]=n;if(!o)return!1;const a=JSON.parse(atob(o));return!("typ"in a&&"JWT"!==a?.typ||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}}var Ke=$constructor("$ZodJWT",(e,t)=>{Ee.init(e,t),e._zod.check=n=>{isValidJWT(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ze=$constructor("$ZodNumber",(e,t)=>{Ie.init(e,t),e._zod.pattern=e._zod.bag.pattern??Q,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}const a=n.value;if("number"==typeof a&&!Number.isNaN(a)&&Number.isFinite(a))return n;const i="number"==typeof a?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...i?{received:i}:{}}),n}}),Ye=$constructor("$ZodNumberFormat",(e,t)=>{ce.init(e,t),Ze.init(e,t)}),Xe=$constructor("$ZodBoolean",(e,t)=>{Ie.init(e,t),e._zod.pattern=ee,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}const a=n.value;return"boolean"==typeof a||n.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),n}}),Je=$constructor("$ZodNull",(e,t)=>{Ie.init(e,t),e._zod.pattern=te,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{const o=t.value;return null===o||t.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),t}}),Qe=$constructor("$ZodUnknown",(e,t)=>{Ie.init(e,t),e._zod.parse=e=>e}),et=$constructor("$ZodNever",(e,t)=>{Ie.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),tt=$constructor("$ZodDate",(e,t)=>{Ie.init(e,t),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(s){}const a=n.value,i=a instanceof Date;return i&&!Number.isNaN(a.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:a,...i?{received:"Invalid Date"}:{},inst:e}),n}});function handleArrayResult(e,t,n){e.issues.length&&t.issues.push(...prefixIssues(n,e.issues)),t.value[n]=e.value}var rt=$constructor("$ZodArray",(e,t)=>{Ie.init(e,t),e._zod.parse=(n,o)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),n;n.value=Array(a.length);const i=[];for(let e=0;e<a.length;e++){const s=a[e],l=t.element._zod.run({value:s,issues:[]},o);l instanceof Promise?i.push(l.then(t=>handleArrayResult(t,n,e))):handleArrayResult(l,n,e)}return i.length?Promise.all(i).then(()=>n):n}});function handlePropertyResult(e,t,n,o,a,i){const s=n in o;if(e.issues.length){if(a&&i&&!s)return;t.issues.push(...prefixIssues(n,e.issues))}s||a?void 0===e.value?s&&(t.value[n]=void 0):t.value[n]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]})}function normalizeDef(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const n=optionalKeys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function handleCatchall(e,t,n,o,a,i){const s=[],l=a.keySet,c=a.catchall._zod,d=c.def.type,u="optional"===c.optin,p="optional"===c.optout;for(const m in t){if("__proto__"===m)continue;if(l.has(m))continue;if("never"===d){s.push(m);continue}const a=c.run({value:t[m],issues:[]},o);a instanceof Promise?e.push(a.then(e=>handlePropertyResult(e,n,m,t,u,p))):handlePropertyResult(a,n,m,t,u,p)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}var nt=$constructor("$ZodObject",(e,t)=>{if(Ie.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const n=cached(()=>normalizeDef(t));defineLazy(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const o=e[t]._zod;if(o.values){n[t]??(n[t]=new Set);for(const e of o.values)n[t].add(e)}}return n});const o=isObject$3,a=t.catchall;let i;e._zod.parse=(t,s)=>{i??(i=n.value);const l=t.value;if(!o(l))return t.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),t;t.value={};const c=[],d=i.shape;for(const e of i.keys){const n=d[e],o="optional"===n._zod.optin,a="optional"===n._zod.optout,i=n._zod.run({value:l[e],issues:[]},s);i instanceof Promise?c.push(i.then(n=>handlePropertyResult(n,t,e,l,o,a))):handlePropertyResult(i,t,e,l,o,a)}return a?handleCatchall(c,l,t,s,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),ot=$constructor("$ZodObjectJIT",(e,t)=>{nt.init(e,t);const n=e._zod.parse,o=cached(()=>normalizeDef(t)),generateFastpass=e=>{const t=new Se(["shape","payload","ctx"]),n=o.value,parseStr=e=>{const t=esc(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const a=Object.create(null);let i=0;for(const o of n.keys)a[o]="key_"+i++;t.write("const newResult = {};");for(const o of n.keys){const n=a[o],i=esc(o),s=e[o],l="optional"===s?._zod?.optin,c="optional"===s?._zod?.optout;t.write(`const ${n} = ${parseStr(o)};`),l&&c?t.write(`\n if (${n}.issues.length) {\n if (${i} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n \n `):l?t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${i} in input) {\n newResult[${i}] = undefined;\n }\n } else {\n newResult[${i}] = ${n}.value;\n }\n \n `):t.write(`\n const ${n}_present = ${i} in input;\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${i}, ...iss.path] : [${i}]\n })));\n }\n if (!${n}_present && !${n}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${i}]\n });\n }\n\n if (${n}_present) {\n if (${n}.value === undefined) {\n newResult[${i}] = undefined;\n } else {\n newResult[${i}] = ${n}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,n)=>s(e,t,n)};let a;const i=isObject$3,s=!v.jitless,l=s&&x.value,c=t.catchall;let d;e._zod.parse=(u,p)=>{d??(d=o.value);const m=u.value;return i(m)?s&&l&&!1===p?.async&&!0!==p.jitless?(a||(a=generateFastpass(t.shape)),u=a(u,p),c?handleCatchall([],m,u,p,d,e):u):n(u,p):(u.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),u)}});function handleUnionResults(e,t,n,o){for(const i of e)if(0===i.issues.length)return t.value=i.value,t;const a=e.filter(e=>!aborted(e));return 1===a.length?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>finalizeIssue(e,o,config())))}),t)}var at=$constructor("$ZodUnion",(e,t)=>{Ie.init(e,t),defineLazy(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),defineLazy(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),defineLazy(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),defineLazy(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>cleanRegex(e.source)).join("|")})$`)}});const n=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(o,a)=>{if(n)return n(o,a);let i=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},a);if(t instanceof Promise)s.push(t),i=!0;else{if(0===t.issues.length)return t;s.push(t)}}return i?Promise.all(s).then(t=>handleUnionResults(t,o,e,a)):handleUnionResults(s,o,e,a)}}),it=$constructor("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,at.init(e,t);const n=e._zod.parse;defineLazy(e._zod,"propValues",()=>{const e={};for(const n of t.options){const o=n._zod.propValues;if(!o||0===Object.keys(o).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(o)){e[t]||(e[t]=new Set);for(const o of n)e[t].add(o)}}return e});const o=cached(()=>{const e=t.options,n=new Map;for(const o of e){const e=o._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,o)}}return n});e._zod.parse=(a,i)=>{const s=a.value;if(!isObject$3(s))return a.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),a;const l=o.value.get(s?.[t.discriminator]);return l?l._zod.run(a,i):t.unionFallback||"backward"===i.direction?n(a,i):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:s,path:[t.discriminator],inst:e}),a)}}),st=$constructor("$ZodIntersection",(e,t)=>{Ie.init(e,t),e._zod.parse=(e,n)=>{const o=e.value,a=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return a instanceof Promise||i instanceof Promise?Promise.all([a,i]).then(([t,n])=>handleIntersectionResults(e,t,n)):handleIntersectionResults(e,a,i)}});function mergeValues(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(isPlainObject$2(e)&&isPlainObject$2(t)){const n=Object.keys(t),o=Object.keys(e).filter(e=>-1!==n.indexOf(e)),a={...e,...t};for(const i of o){const n=mergeValues(e[i],t[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};a[i]=n.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;o<e.length;o++){const a=mergeValues(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function handleIntersectionResults(e,t,n){const o=new Map;let a;for(const l of t.issues)if("unrecognized_keys"===l.code){a??(a=l);for(const e of l.keys)o.has(e)||o.set(e,{}),o.get(e).l=!0}else e.issues.push(l);for(const l of n.issues)if("unrecognized_keys"===l.code)for(const e of l.keys)o.has(e)||o.set(e,{}),o.get(e).r=!0;else e.issues.push(l);const i=[...o].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(i.length&&a&&e.issues.push({...a,keys:i}),aborted(e))return e;const s=mergeValues(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var lt=$constructor("$ZodTuple",(e,t)=>{Ie.init(e,t);const n=t.items;e._zod.parse=(o,a)=>{const i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];const s=[],l=getTupleOptStart(n,"optin"),c=getTupleOptStart(n,"optout");if(!t.rest){if(i.length<l)return o.issues.push({code:"too_small",minimum:l,inclusive:!0,input:i,inst:e,origin:"array"}),o;i.length>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:i,inst:e,origin:"array"})}const d=new Array(n.length);for(let e=0;e<n.length;e++){const t=n[e]._zod.run({value:i[e],issues:[]},a);t instanceof Promise?s.push(t.then(t=>{d[e]=t})):d[e]=t}if(t.rest){let e=n.length-1;const l=i.slice(n.length);for(const n of l){e++;const i=t.rest._zod.run({value:n,issues:[]},a);i instanceof Promise?s.push(i.then(t=>handleTupleResult(t,o,e))):handleTupleResult(i,o,e)}}return s.length?Promise.all(s).then(()=>handleTupleResults(d,o,n,i,c)):handleTupleResults(d,o,n,i,c)}});function getTupleOptStart(e,t){for(let n=e.length-1;n>=0;n--)if("optional"!==e[n]._zod[t])return n+1;return 0}function handleTupleResult(e,t,n){e.issues.length&&t.issues.push(...prefixIssues(n,e.issues)),t.value[n]=e.value}function handleTupleResults(e,t,n,o,a){for(let i=0;i<n.length;i++){const n=e[i],s=i<o.length;if(n.issues.length){if(!s&&i>=a){t.value.length=i;break}t.issues.push(...prefixIssues(i,n.issues))}t.value[i]=n.value}for(let i=t.value.length-1;i>=o.length&&"optional"===n[i]._zod.optout&&void 0===t.value[i];i--)t.value.length=i;return t}var ct=$constructor("$ZodRecord",(e,t)=>{Ie.init(e,t),e._zod.parse=(n,o)=>{const a=n.value;if(!isPlainObject$2(a))return n.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),n;const i=[],s=t.keyType._zod.values;if(s){n.value={};const l=new Set;for(const d of s)if("string"==typeof d||"number"==typeof d||"symbol"==typeof d){l.add("number"==typeof d?d.toString():d);const s=t.keyType._zod.run({value:d,issues:[]},o);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>finalizeIssue(e,o,config())),input:d,path:[d],inst:e});continue}const c=s.value,u=t.valueType._zod.run({value:a[d],issues:[]},o);u instanceof Promise?i.push(u.then(e=>{e.issues.length&&n.issues.push(...prefixIssues(d,e.issues)),n.value[c]=e.value})):(u.issues.length&&n.issues.push(...prefixIssues(d,u.issues)),n.value[c]=u.value)}let c;for(const e in a)l.has(e)||(c=c??[],c.push(e));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:c})}else{n.value={};for(const s of Reflect.ownKeys(a)){if("__proto__"===s)continue;if(!Object.prototype.propertyIsEnumerable.call(a,s))continue;let l=t.keyType._zod.run({value:s,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof s&&Q.test(s)&&l.issues.length){const e=t.keyType._zod.run({value:Number(s),issues:[]},o);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(l=e)}if(l.issues.length){"loose"===t.mode?n.value[s]=a[s]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(e=>finalizeIssue(e,o,config())),input:s,path:[s],inst:e});continue}const c=t.valueType._zod.run({value:a[s],issues:[]},o);c instanceof Promise?i.push(c.then(e=>{e.issues.length&&n.issues.push(...prefixIssues(s,e.issues)),n.value[l.value]=e.value})):(c.issues.length&&n.issues.push(...prefixIssues(s,c.issues)),n.value[l.value]=c.value)}}return i.length?Promise.all(i).then(()=>n):n}}),dt=$constructor("$ZodEnum",(e,t)=>{Ie.init(e,t);const n=getEnumValues(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter(e=>I.has(typeof e)).map(e=>"string"==typeof e?escapeRegex(e):e.toString()).join("|")})$`),e._zod.parse=(t,a)=>{const i=t.value;return o.has(i)||t.issues.push({code:"invalid_value",values:n,input:i,inst:e}),t}}),ut=$constructor("$ZodLiteral",(e,t)=>{if(Ie.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?escapeRegex(e):e?escapeRegex(e.toString()):String(e)).join("|")})$`),e._zod.parse=(o,a)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),pt=$constructor("$ZodTransform",(e,t)=>{Ie.init(e,t),e._zod.optin="optional",e._zod.parse=(n,o)=>{if("backward"===o.direction)throw new b(e.constructor.name);const a=t.transform(n.value,n);if(o.async)return(a instanceof Promise?a:Promise.resolve(a)).then(e=>(n.value=e,n.fallback=!0,n));if(a instanceof Promise)throw new y;return n.value=a,n.fallback=!0,n}});function handleOptionalResult(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var mt=$constructor("$ZodOptional",(e,t)=>{Ie.init(e,t),e._zod.optin="optional",e._zod.optout="optional",defineLazy(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),defineLazy(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${cleanRegex(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const o=e.value,a=t.innerType._zod.run(e,n);return a instanceof Promise?a.then(e=>handleOptionalResult(e,o)):handleOptionalResult(a,o)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),ht=$constructor("$ZodExactOptional",(e,t)=>{mt.init(e,t),defineLazy(e._zod,"values",()=>t.innerType._zod.values),defineLazy(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),gt=$constructor("$ZodNullable",(e,t)=>{Ie.init(e,t),defineLazy(e._zod,"optin",()=>t.innerType._zod.optin),defineLazy(e._zod,"optout",()=>t.innerType._zod.optout),defineLazy(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${cleanRegex(e.source)}|null)$`):void 0}),defineLazy(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),ft=$constructor("$ZodDefault",(e,t)=>{Ie.init(e,t),e._zod.optin="optional",defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(e=>handleDefaultResult(e,t)):handleDefaultResult(o,t)}});function handleDefaultResult(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var yt=$constructor("$ZodPrefault",(e,t)=>{Ie.init(e,t),e._zod.optin="optional",defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),bt=$constructor("$ZodNonOptional",(e,t)=>{Ie.init(e,t),defineLazy(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,o)=>{const a=t.innerType._zod.run(n,o);return a instanceof Promise?a.then(t=>handleNonOptionalResult(t,e)):handleNonOptionalResult(a,e)}});function handleNonOptionalResult(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var vt=$constructor("$ZodCatch",(e,t)=>{Ie.init(e,t),e._zod.optin="optional",defineLazy(e._zod,"optout",()=>t.innerType._zod.optout),defineLazy(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(o=>(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map(e=>finalizeIssue(e,n,config()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=o.value,o.issues.length&&(e.value=t.catchValue({...e,error:{issues:o.issues.map(e=>finalizeIssue(e,n,config()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),wt=$constructor("$ZodPipe",(e,t)=>{Ie.init(e,t),defineLazy(e._zod,"values",()=>t.in._zod.values),defineLazy(e._zod,"optin",()=>t.in._zod.optin),defineLazy(e._zod,"optout",()=>t.out._zod.optout),defineLazy(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const o=t.out._zod.run(e,n);return o instanceof Promise?o.then(e=>handlePipeResult(e,t.in,n)):handlePipeResult(o,t.in,n)}const o=t.in._zod.run(e,n);return o instanceof Promise?o.then(e=>handlePipeResult(e,t.out,n)):handlePipeResult(o,t.out,n)}});function handlePipeResult(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var St=$constructor("$ZodReadonly",(e,t)=>{Ie.init(e,t),defineLazy(e._zod,"propValues",()=>t.innerType._zod.propValues),defineLazy(e._zod,"values",()=>t.innerType._zod.values),defineLazy(e._zod,"optin",()=>t.innerType?._zod?.optin),defineLazy(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const o=t.innerType._zod.run(e,n);return o instanceof Promise?o.then(handleReadonlyResult):handleReadonlyResult(o)}});function handleReadonlyResult(e){return e.value=Object.freeze(e.value),e}var xt,It=$constructor("$ZodLazy",(e,t)=>{Ie.init(e,t),defineLazy(e._zod,"innerType",()=>{const e=t;return e._cachedInner||(e._cachedInner=t.getter()),e._cachedInner}),defineLazy(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),defineLazy(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),defineLazy(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),defineLazy(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Ct=$constructor("$ZodCustom",(e,t)=>{oe.init(e,t),Ie.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const o=n.value,a=t.fn(o);if(a instanceof Promise)return a.then(t=>handleRefineResult(t,n,o,e));handleRefineResult(a,n,o,e)}});function handleRefineResult(e,t,n,o){if(!e){const e={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(e.params=o._zod.def.params),t.issues.push(issue(e))}}var Et=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function registry(){return new Et}(xt=globalThis).__zod_globalRegistry??(xt.__zod_globalRegistry=registry());var Rt=globalThis.__zod_globalRegistry;function _string(e,t){return new e({type:"string",...normalizeParams(t)})}function _email(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...normalizeParams(t)})}function _guid(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...normalizeParams(t)})}function _uuid(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...normalizeParams(t)})}function _uuidv4(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...normalizeParams(t)})}function _uuidv6(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...normalizeParams(t)})}function _uuidv7(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...normalizeParams(t)})}function _url(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...normalizeParams(t)})}function _emoji(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...normalizeParams(t)})}function _nanoid(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...normalizeParams(t)})}function _cuid(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...normalizeParams(t)})}function _cuid2(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...normalizeParams(t)})}function _ulid(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...normalizeParams(t)})}function _xid(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...normalizeParams(t)})}function _ksuid(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...normalizeParams(t)})}function _ipv4(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...normalizeParams(t)})}function _ipv6(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...normalizeParams(t)})}function _cidrv4(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...normalizeParams(t)})}function _cidrv6(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...normalizeParams(t)})}function _base64(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...normalizeParams(t)})}function _base64url(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...normalizeParams(t)})}function _e164(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...normalizeParams(t)})}function _jwt(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...normalizeParams(t)})}function _isoDateTime(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...normalizeParams(t)})}function _isoDate(e,t){return new e({type:"string",format:"date",check:"string_format",...normalizeParams(t)})}function _isoTime(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...normalizeParams(t)})}function _isoDuration(e,t){return new e({type:"string",format:"duration",check:"string_format",...normalizeParams(t)})}function _number(e,t){return new e({type:"number",checks:[],...normalizeParams(t)})}function _int(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...normalizeParams(t)})}function _boolean(e,t){return new e({type:"boolean",...normalizeParams(t)})}function _null$1(e,t){return new e({type:"null",...normalizeParams(t)})}function _unknown(e){return new e({type:"unknown"})}function _never(e,t){return new e({type:"never",...normalizeParams(t)})}function _date(e,t){return new e({type:"date",...normalizeParams(t)})}function _lt(e,t){return new ie({check:"less_than",...normalizeParams(t),value:e,inclusive:!1})}function _lte(e,t){return new ie({check:"less_than",...normalizeParams(t),value:e,inclusive:!0})}function _gt(e,t){return new se({check:"greater_than",...normalizeParams(t),value:e,inclusive:!1})}function _gte(e,t){return new se({check:"greater_than",...normalizeParams(t),value:e,inclusive:!0})}function _multipleOf(e,t){return new le({check:"multiple_of",...normalizeParams(t),value:e})}function _maxLength(e,t){return new de({check:"max_length",...normalizeParams(t),maximum:e})}function _minLength(e,t){return new ue({check:"min_length",...normalizeParams(t),minimum:e})}function _length(e,t){return new pe({check:"length_equals",...normalizeParams(t),length:e})}function _regex(e,t){return new he({check:"string_format",format:"regex",...normalizeParams(t),pattern:e})}function _lowercase(e){return new ge({check:"string_format",format:"lowercase",...normalizeParams(e)})}function _uppercase(e){return new fe({check:"string_format",format:"uppercase",...normalizeParams(e)})}function _includes(e,t){return new ye({check:"string_format",format:"includes",...normalizeParams(t),includes:e})}function _startsWith(e,t){return new be({check:"string_format",format:"starts_with",...normalizeParams(t),prefix:e})}function _endsWith(e,t){return new ve({check:"string_format",format:"ends_with",...normalizeParams(t),suffix:e})}function _overwrite(e){return new we({check:"overwrite",tx:e})}function _normalize(e){return _overwrite(t=>t.normalize(e))}function _trim(){return _overwrite(e=>e.trim())}function _toLowerCase(){return _overwrite(e=>e.toLowerCase())}function _toUpperCase(){return _overwrite(e=>e.toUpperCase())}function _slugify(){return _overwrite(e=>slugify(e))}function _array(e,t,n){return new e({type:"array",element:t,...normalizeParams(n)})}function _refine(e,t,n){return new e({type:"custom",check:"custom",fn:t,...normalizeParams(n)})}function _superRefine(e,t){const n=_check(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(issue(e,t.value,n._zod.def));else{const o=e;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),t.issues.push(issue(o))}},e(t.value,t)),t);return n}function _check(e,t){const n=new oe({check:"custom",...normalizeParams(t)});return n._zod.check=e,n}function initializeContext(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Rt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function process(e,t,n={path:[],schemaPath:[]}){var o;const a=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const l=e._zod.toJSONSchema?.();if(l)s.schema=l;else{const o={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,o);else{const n=s.schema,i=t.processors[a.type];if(!i)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);i(e,t,n,o)}const i=e._zod.parent;i&&(s.ref||(s.ref=i),process(i,t,o),t.seen.get(i).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(s.schema,c),"input"===t.io&&isTransforming(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&"_prefault"in s.schema&&((o=s.schema).default??(o.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function extractDefs(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const a of e.seen.entries()){const t=e.metadataRegistry.get(a[0])?.id;if(t){const e=o.get(t);if(e&&e!==a[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(t,a[0])}}const makeURI=t=>{const o="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,a=e.external.uri??(e=>e);if(n)return{ref:a(n)};const i=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=i,{defId:i,ref:`${a("__shared")}#/${o}/${i}`}}if(t[1]===n)return{ref:"#"};const a=`#/${o}/`,i=t[1].schema.id??"__schema"+e.counter++;return{defId:i,ref:a+i}},extractToDef=e=>{if(e[1].schema.$ref)return;const t=e[1],{ref:n,defId:o}=makeURI(e);t.def={...t.schema},o&&(t.defId=o);const a=t.schema;for(const i in a)delete a[i];a.$ref=n};if("throw"===e.cycles)for(const a of e.seen.entries()){const e=a[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const n=a[1];if(t!==a[0]){if(e.external){const n=e.external.registry.get(a[0])?.id;if(t!==a[0]&&n){extractToDef(a);continue}}(e.metadataRegistry.get(a[0])?.id||n.cycle||n.count>1&&"ref"===e.reused)&&extractToDef(a)}else extractToDef(a)}}function finalize(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const flattenRef=t=>{const n=e.seen.get(t);if(null===n.ref)return;const o=n.def??n.schema,a={...o},i=n.ref;if(n.ref=null,i){flattenRef(i);const n=e.seen.get(i),s=n.schema;if(!s.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(o,s):(o.allOf=o.allOf??[],o.allOf.push(s)),Object.assign(o,a),t._zod.parent===i)for(const e in o)"$ref"!==e&&"allOf"!==e&&(e in a||delete o[e]);if(s.$ref&&n.def)for(const e in o)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(o[e])===JSON.stringify(n.def[e])&&delete o[e]}const s=t._zod.parent;if(s&&s!==i){flattenRef(s);const t=e.seen.get(s);if(t?.schema.$ref&&(o.$ref=t.schema.$ref,t.def))for(const e in o)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(o[e])===JSON.stringify(t.def[e])&&delete o[e]}e.override({zodSchema:t,jsonSchema:o,path:n.path??[]})};for(const l of[...e.seen.entries()].reverse())flattenRef(l[0]);const o={};if("draft-2020-12"===e.target?o.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?o.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(n)}Object.assign(o,n.def??n.schema);const a=e.metadataRegistry.get(t)?.id;void 0!==a&&o.id===a&&delete o.id;const i=e.external?.defs??{};for(const l of e.seen.entries()){const e=l[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,i[e.defId]=e.def)}e.external||Object.keys(i).length>0&&("draft-2020-12"===e.target?o.$defs=i:o.definitions=i);try{const n=JSON.parse(JSON.stringify(o));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:createStandardJSONSchemaMethod(t,"input",e.processors),output:createStandardJSONSchemaMethod(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(s){throw new Error("Error converting schema to JSON.")}}function isTransforming(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;if("transform"===o.type)return!0;if("array"===o.type)return isTransforming(o.element,n);if("set"===o.type)return isTransforming(o.valueType,n);if("lazy"===o.type)return isTransforming(o.getter(),n);if("promise"===o.type||"optional"===o.type||"nonoptional"===o.type||"nullable"===o.type||"readonly"===o.type||"default"===o.type||"prefault"===o.type)return isTransforming(o.innerType,n);if("intersection"===o.type)return isTransforming(o.left,n)||isTransforming(o.right,n);if("record"===o.type||"map"===o.type)return isTransforming(o.keyType,n)||isTransforming(o.valueType,n);if("pipe"===o.type)return!!e._zod.traits.has("$ZodCodec")||isTransforming(o.in,n)||isTransforming(o.out,n);if("object"===o.type){for(const e in o.shape)if(isTransforming(o.shape[e],n))return!0;return!1}if("union"===o.type){for(const e of o.options)if(isTransforming(e,n))return!0;return!1}if("tuple"===o.type){for(const e of o.items)if(isTransforming(e,n))return!0;return!(!o.rest||!isTransforming(o.rest,n))}return!1}var createToJSONSchemaMethod=(e,t={})=>n=>{const o=initializeContext({...n,processors:t});return process(e,o),extractDefs(o,e),finalize(o,e)},createStandardJSONSchemaMethod=(e,t,n={})=>o=>{const{libraryOptions:a,target:i}=o??{},s=initializeContext({...a??{},target:i,io:t,processors:n});return process(e,s),extractDefs(s,e),finalize(s,e)},kt={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},stringProcessor=(e,t,n,o)=>{const a=n;a.type="string";const{minimum:i,maximum:s,format:l,patterns:c,contentEncoding:d}=e._zod.bag;if("number"==typeof i&&(a.minLength=i),"number"==typeof s&&(a.maxLength=s),l&&(a.format=kt[l]??l,""===a.format&&delete a.format,"time"===l&&delete a.format),d&&(a.contentEncoding=d),c&&c.size>0){const e=[...c];1===e.length?a.pattern=e[0].source:e.length>1&&(a.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}},numberProcessor=(e,t,n,o)=>{const a=n,{minimum:i,maximum:s,format:l,multipleOf:c,exclusiveMaximum:d,exclusiveMinimum:u}=e._zod.bag;"string"==typeof l&&l.includes("int")?a.type="integer":a.type="number";const p="number"==typeof u&&u>=(i??Number.NEGATIVE_INFINITY),m="number"==typeof d&&d<=(s??Number.POSITIVE_INFINITY),h="draft-04"===t.target||"openapi-3.0"===t.target;p?h?(a.minimum=u,a.exclusiveMinimum=!0):a.exclusiveMinimum=u:"number"==typeof i&&(a.minimum=i),m?h?(a.maximum=d,a.exclusiveMaximum=!0):a.exclusiveMaximum=d:"number"==typeof s&&(a.maximum=s),"number"==typeof c&&(a.multipleOf=c)},booleanProcessor=(e,t,n,o)=>{n.type="boolean"},nullProcessor=(e,t,n,o)=>{"openapi-3.0"===t.target?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},neverProcessor=(e,t,n,o)=>{n.not={}},unknownProcessor=(e,t,n,o)=>{},dateProcessor=(e,t,n,o)=>{if("throw"===t.unrepresentable)throw new Error("Date cannot be represented in JSON Schema")},enumProcessor=(e,t,n,o)=>{const a=getEnumValues(e._zod.def.entries);a.every(e=>"number"==typeof e)&&(n.type="number"),a.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=a},literalProcessor=(e,t,n,o)=>{const a=e._zod.def,i=[];for(const s of a.values)if(void 0===s){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof s){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(0===i.length);else if(1===i.length){const e=i[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else i.every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),i.every(e=>"boolean"==typeof e)&&(n.type="boolean"),i.every(e=>null===e)&&(n.type="null"),n.enum=i},customProcessor=(e,t,n,o)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")},transformProcessor=(e,t,n,o)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")},arrayProcessor=(e,t,n,o)=>{const a=n,i=e._zod.def,{minimum:s,maximum:l}=e._zod.bag;"number"==typeof s&&(a.minItems=s),"number"==typeof l&&(a.maxItems=l),a.type="array",a.items=process(i.element,t,{...o,path:[...o.path,"items"]})},objectProcessor=(e,t,n,o)=>{const a=n,i=e._zod.def;a.type="object",a.properties={};const s=i.shape;for(const d in s)a.properties[d]=process(s[d],t,{...o,path:[...o.path,"properties",d]});const l=new Set(Object.keys(s)),c=new Set([...l].filter(e=>{const n=i.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));c.size>0&&(a.required=Array.from(c)),"never"===i.catchall?._zod.def.type?a.additionalProperties=!1:i.catchall?i.catchall&&(a.additionalProperties=process(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):"output"===t.io&&(a.additionalProperties=!1)},unionProcessor=(e,t,n,o)=>{const a=e._zod.def,i=!1===a.inclusive,s=a.options.map((e,n)=>process(e,t,{...o,path:[...o.path,i?"oneOf":"anyOf",n]}));i?n.oneOf=s:n.anyOf=s},intersectionProcessor=(e,t,n,o)=>{const a=e._zod.def,i=process(a.left,t,{...o,path:[...o.path,"allOf",0]}),s=process(a.right,t,{...o,path:[...o.path,"allOf",1]}),isSimpleIntersection=e=>"allOf"in e&&1===Object.keys(e).length;n.allOf=[...isSimpleIntersection(i)?i.allOf:[i],...isSimpleIntersection(s)?s.allOf:[s]]},tupleProcessor=(e,t,n,o)=>{const a=n,i=e._zod.def;a.type="array";const s="draft-2020-12"===t.target?"prefixItems":"items",l="draft-2020-12"===t.target||"openapi-3.0"===t.target?"items":"additionalItems",c=i.items.map((e,n)=>process(e,t,{...o,path:[...o.path,s,n]})),d=i.rest?process(i.rest,t,{...o,path:[...o.path,l,..."openapi-3.0"===t.target?[i.items.length]:[]]}):null;"draft-2020-12"===t.target?(a.prefixItems=c,d&&(a.items=d)):"openapi-3.0"===t.target?(a.items={anyOf:c},d&&a.items.anyOf.push(d),a.minItems=c.length,d||(a.maxItems=c.length)):(a.items=c,d&&(a.additionalItems=d));const{minimum:u,maximum:p}=e._zod.bag;"number"==typeof u&&(a.minItems=u),"number"==typeof p&&(a.maxItems=p)},recordProcessor=(e,t,n,o)=>{const a=n,i=e._zod.def;a.type="object";const s=i.keyType,l=s._zod.bag?.patterns;if("loose"===i.mode&&l&&l.size>0){const e=process(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});a.patternProperties={};for(const t of l)a.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(a.propertyNames=process(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),a.additionalProperties=process(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});const c=s._zod.values;if(c){const e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(a.required=e)}},nullableProcessor=(e,t,n,o)=>{const a=e._zod.def,i=process(a.innerType,t,o),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=a.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},nonoptionalProcessor=(e,t,n,o)=>{const a=e._zod.def;process(a.innerType,t,o),t.seen.get(e).ref=a.innerType},defaultProcessor=(e,t,n,o)=>{const a=e._zod.def;process(a.innerType,t,o),t.seen.get(e).ref=a.innerType,n.default=JSON.parse(JSON.stringify(a.defaultValue))},prefaultProcessor=(e,t,n,o)=>{const a=e._zod.def;process(a.innerType,t,o),t.seen.get(e).ref=a.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},catchProcessor=(e,t,n,o)=>{const a=e._zod.def;let i;process(a.innerType,t,o),t.seen.get(e).ref=a.innerType;try{i=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},pipeProcessor=(e,t,n,o)=>{const a=e._zod.def,i=a.in._zod.traits.has("$ZodTransform"),s="input"===t.io?i?a.out:a.in:a.out;process(s,t,o),t.seen.get(e).ref=s},readonlyProcessor=(e,t,n,o)=>{const a=e._zod.def;process(a.innerType,t,o),t.seen.get(e).ref=a.innerType,n.readOnly=!0},optionalProcessor=(e,t,n,o)=>{const a=e._zod.def;process(a.innerType,t,o),t.seen.get(e).ref=a.innerType},lazyProcessor=(e,t,n,o)=>{const a=e._zod.innerType;process(a,t,o),t.seen.get(e).ref=a},At=$constructor("ZodISODateTime",(e,t)=>{je.init(e,t),Yt.init(e,t)});function datetime$1(e){return _isoDateTime(At,e)}var Tt=$constructor("ZodISODate",(e,t)=>{Fe.init(e,t),Yt.init(e,t)});function date$1(e){return _isoDate(Tt,e)}var Mt=$constructor("ZodISOTime",(e,t)=>{Le.init(e,t),Yt.init(e,t)});function time(e){return _isoTime(Mt,e)}var zt=$constructor("ZodISODuration",(e,t)=>{De.init(e,t),Yt.init(e,t)});function duration$1(e){return _isoDuration(zt,e)}var initializer=(e,t)=>{E.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>formatError(e,t)},flatten:{value:t=>flattenError(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,jsonStringifyReplacer,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,jsonStringifyReplacer,2)}},isEmpty:{get:()=>0===e.issues.length}})},$t=$constructor("ZodError",initializer),Nt=$constructor("ZodError",initializer,{Parent:Error}),Pt=_parse(Nt),Ot=_parseAsync(Nt),_t=_safeParse(Nt),jt=_safeParseAsync(Nt),Ft=_encode(Nt),Lt=_decode(Nt),Dt=_encodeAsync(Nt),Bt=_decodeAsync(Nt),Gt=_safeEncode(Nt),Wt=_safeDecode(Nt),Vt=_safeEncodeAsync(Nt),Ht=_safeDecodeAsync(Nt),Ut=new WeakMap;function _installLazyMethods(e,t,n){const o=Object.getPrototypeOf(e);let a=Ut.get(o);if(a||(a=new Set,Ut.set(o,a)),!a.has(t)){a.add(t);for(const e in n){const t=n[e];Object.defineProperty(o,e,{configurable:!0,enumerable:!1,get(){const n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var qt=$constructor("ZodType",(e,t)=>(Ie.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:createStandardJSONSchemaMethod(e,"input"),output:createStandardJSONSchemaMethod(e,"output")}}),e.toJSONSchema=createToJSONSchemaMethod(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Pt(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>_t(e,t,n),e.parseAsync=async(t,n)=>Ot(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>jt(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ft(e,t,n),e.decode=(t,n)=>Lt(e,t,n),e.encodeAsync=async(t,n)=>Dt(e,t,n),e.decodeAsync=async(t,n)=>Bt(e,t,n),e.safeEncode=(t,n)=>Gt(e,t,n),e.safeDecode=(t,n)=>Wt(e,t,n),e.safeEncodeAsync=async(t,n)=>Vt(e,t,n),e.safeDecodeAsync=async(t,n)=>Ht(e,t,n),_installLazyMethods(e,"ZodType",{check(...e){const t=this.def;return this.clone(mergeDefs(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return clone$1(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(refine(e,t))},superRefine(e,t){return this.check(superRefine(e,t))},overwrite(e){return this.check(_overwrite(e))},optional(){return optional(this)},exactOptional(){return exactOptional(this)},nullable(){return nullable(this)},nullish(){return optional(nullable(this))},nonoptional(e){return nonoptional(this,e)},array(){return array(this)},or(e){return union([this,e])},and(e){return intersection(this,e)},transform(e){return pipe(this,transform(e))},default(e){return _default(this,e)},prefault(e){return prefault(this,e)},catch(e){return _catch(this,e)},pipe(e){return pipe(this,e)},readonly(){return readonly(this)},describe(e){const t=this.clone();return Rt.add(t,{description:e}),t},meta(...e){if(0===e.length)return Rt.get(this);const t=this.clone();return Rt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>Rt.get(e)?.description,configurable:!0}),e)),Kt=$constructor("_ZodString",(e,t)=>{Ce.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>stringProcessor(e,t,n,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,_installLazyMethods(e,"_ZodString",{regex(...e){return this.check(_regex(...e))},includes(...e){return this.check(_includes(...e))},startsWith(...e){return this.check(_startsWith(...e))},endsWith(...e){return this.check(_endsWith(...e))},min(...e){return this.check(_minLength(...e))},max(...e){return this.check(_maxLength(...e))},length(...e){return this.check(_length(...e))},nonempty(...e){return this.check(_minLength(1,...e))},lowercase(e){return this.check(_lowercase(e))},uppercase(e){return this.check(_uppercase(e))},trim(){return this.check(_trim())},normalize(...e){return this.check(_normalize(...e))},toLowerCase(){return this.check(_toLowerCase())},toUpperCase(){return this.check(_toUpperCase())},slugify(){return this.check(_slugify())}})}),Zt=$constructor("ZodString",(e,t)=>{Ce.init(e,t),Kt.init(e,t),e.email=t=>e.check(_email(Xt,t)),e.url=t=>e.check(_url(er,t)),e.jwt=t=>e.check(_jwt(gr,t)),e.emoji=t=>e.check(_emoji(tr,t)),e.guid=t=>e.check(_guid(Jt,t)),e.uuid=t=>e.check(_uuid(Qt,t)),e.uuidv4=t=>e.check(_uuidv4(Qt,t)),e.uuidv6=t=>e.check(_uuidv6(Qt,t)),e.uuidv7=t=>e.check(_uuidv7(Qt,t)),e.nanoid=t=>e.check(_nanoid(rr,t)),e.guid=t=>e.check(_guid(Jt,t)),e.cuid=t=>e.check(_cuid(nr,t)),e.cuid2=t=>e.check(_cuid2(or,t)),e.ulid=t=>e.check(_ulid(ar,t)),e.base64=t=>e.check(_base64(pr,t)),e.base64url=t=>e.check(_base64url(mr,t)),e.xid=t=>e.check(_xid(ir,t)),e.ksuid=t=>e.check(_ksuid(sr,t)),e.ipv4=t=>e.check(_ipv4(lr,t)),e.ipv6=t=>e.check(_ipv6(cr,t)),e.cidrv4=t=>e.check(_cidrv4(dr,t)),e.cidrv6=t=>e.check(_cidrv6(ur,t)),e.e164=t=>e.check(_e164(hr,t)),e.datetime=t=>e.check(datetime$1(t)),e.date=t=>e.check(date$1(t)),e.time=t=>e.check(time(t)),e.duration=t=>e.check(duration$1(t))});function string(e){return _string(Zt,e)}var Yt=$constructor("ZodStringFormat",(e,t)=>{Ee.init(e,t),Kt.init(e,t)}),Xt=$constructor("ZodEmail",(e,t)=>{Ae.init(e,t),Yt.init(e,t)}),Jt=$constructor("ZodGUID",(e,t)=>{Re.init(e,t),Yt.init(e,t)}),Qt=$constructor("ZodUUID",(e,t)=>{ke.init(e,t),Yt.init(e,t)}),er=$constructor("ZodURL",(e,t)=>{Te.init(e,t),Yt.init(e,t)}),tr=$constructor("ZodEmoji",(e,t)=>{Me.init(e,t),Yt.init(e,t)}),rr=$constructor("ZodNanoID",(e,t)=>{ze.init(e,t),Yt.init(e,t)}),nr=$constructor("ZodCUID",(e,t)=>{$e.init(e,t),Yt.init(e,t)}),or=$constructor("ZodCUID2",(e,t)=>{Ne.init(e,t),Yt.init(e,t)}),ar=$constructor("ZodULID",(e,t)=>{Pe.init(e,t),Yt.init(e,t)}),ir=$constructor("ZodXID",(e,t)=>{Oe.init(e,t),Yt.init(e,t)}),sr=$constructor("ZodKSUID",(e,t)=>{_e.init(e,t),Yt.init(e,t)}),lr=$constructor("ZodIPv4",(e,t)=>{Be.init(e,t),Yt.init(e,t)}),cr=$constructor("ZodIPv6",(e,t)=>{Ge.init(e,t),Yt.init(e,t)}),dr=$constructor("ZodCIDRv4",(e,t)=>{We.init(e,t),Yt.init(e,t)}),ur=$constructor("ZodCIDRv6",(e,t)=>{Ve.init(e,t),Yt.init(e,t)}),pr=$constructor("ZodBase64",(e,t)=>{He.init(e,t),Yt.init(e,t)}),mr=$constructor("ZodBase64URL",(e,t)=>{Ue.init(e,t),Yt.init(e,t)}),hr=$constructor("ZodE164",(e,t)=>{qe.init(e,t),Yt.init(e,t)}),gr=$constructor("ZodJWT",(e,t)=>{Ke.init(e,t),Yt.init(e,t)}),fr=$constructor("ZodNumber",(e,t)=>{Ze.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>numberProcessor(e,t,n,o),_installLazyMethods(e,"ZodNumber",{gt(e,t){return this.check(_gt(e,t))},gte(e,t){return this.check(_gte(e,t))},min(e,t){return this.check(_gte(e,t))},lt(e,t){return this.check(_lt(e,t))},lte(e,t){return this.check(_lte(e,t))},max(e,t){return this.check(_lte(e,t))},int(e){return this.check(int(e))},safe(e){return this.check(int(e))},positive(e){return this.check(_gt(0,e))},nonnegative(e){return this.check(_gte(0,e))},negative(e){return this.check(_lt(0,e))},nonpositive(e){return this.check(_lte(0,e))},multipleOf(e,t){return this.check(_multipleOf(e,t))},step(e,t){return this.check(_multipleOf(e,t))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function number(e){return _number(fr,e)}var yr=$constructor("ZodNumberFormat",(e,t)=>{Ye.init(e,t),fr.init(e,t)});function int(e){return _int(yr,e)}var br=$constructor("ZodBoolean",(e,t)=>{Xe.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>booleanProcessor(e,t,n,o)});function boolean(e){return _boolean(br,e)}var vr=$constructor("ZodNull",(e,t)=>{Je.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>nullProcessor(e,t,n,o)});function _null(e){return _null$1(vr,e)}var wr=$constructor("ZodUnknown",(e,t)=>{Qe.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>unknownProcessor(e,t,n,o)});function unknown(){return _unknown(wr)}var Sr=$constructor("ZodNever",(e,t)=>{et.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>neverProcessor(e,t,n,o)});function never(e){return _never(Sr,e)}var xr=$constructor("ZodDate",(e,t)=>{tt.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>dateProcessor(e,t,n,o),e.min=(t,n)=>e.check(_gte(t,n)),e.max=(t,n)=>e.check(_lte(t,n));const n=e._zod.bag;e.minDate=n.minimum?new Date(n.minimum):null,e.maxDate=n.maximum?new Date(n.maximum):null});function date(e){return _date(xr,e)}var Ir=$constructor("ZodArray",(e,t)=>{rt.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>arrayProcessor(e,t,n,o),e.element=t.element,_installLazyMethods(e,"ZodArray",{min(e,t){return this.check(_minLength(e,t))},nonempty(e){return this.check(_minLength(1,e))},max(e,t){return this.check(_maxLength(e,t))},length(e,t){return this.check(_length(e,t))},unwrap(){return this.element}})});function array(e,t){return _array(Ir,e,t)}var Cr=$constructor("ZodObject",(e,t)=>{ot.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>objectProcessor(e,t,n,o),defineLazy(e,"shape",()=>t.shape),_installLazyMethods(e,"ZodObject",{keyof(){return _enum(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:unknown()})},loose(){return this.clone({...this._zod.def,catchall:unknown()})},strict(){return this.clone({...this._zod.def,catchall:never()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return extend(this,e)},safeExtend(e){return safeExtend(this,e)},merge(e){return merge(this,e)},pick(e){return pick(this,e)},omit(e){return omit(this,e)},partial(...e){return partial(Nr,this,e[0])},required(...e){return required(Fr,this,e[0])}})});function object(e,t){return new Cr({type:"object",shape:e??{},...normalizeParams(t)})}var Er=$constructor("ZodUnion",(e,t)=>{at.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>unionProcessor(e,t,n,o),e.options=t.options});function union(e,t){return new Er({type:"union",options:e,...normalizeParams(t)})}var Rr=$constructor("ZodDiscriminatedUnion",(e,t)=>{Er.init(e,t),it.init(e,t)});function discriminatedUnion(e,t,n){return new Rr({type:"union",options:t,discriminator:e,...normalizeParams(n)})}var kr=$constructor("ZodIntersection",(e,t)=>{st.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>intersectionProcessor(e,t,n,o)});function intersection(e,t){return new kr({type:"intersection",left:e,right:t})}var Ar=$constructor("ZodTuple",(e,t)=>{lt.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>tupleProcessor(e,t,n,o),e.rest=t=>e.clone({...e._zod.def,rest:t})});function tuple(e,t,n){const o=t instanceof Ie;return new Ar({type:"tuple",items:e,rest:o?t:null,...normalizeParams(o?n:t)})}var Tr=$constructor("ZodRecord",(e,t)=>{ct.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>recordProcessor(e,t,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function record(e,t,n){return t&&t._zod?new Tr({type:"record",keyType:e,valueType:t,...normalizeParams(n)}):new Tr({type:"record",keyType:string(),valueType:e,...normalizeParams(t)})}var Mr=$constructor("ZodEnum",(e,t)=>{dt.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>enumProcessor(e,t,n,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,o)=>{const a={};for(const i of e){if(!n.has(i))throw new Error(`Key ${i} not found in enum`);a[i]=t.entries[i]}return new Mr({...t,checks:[],...normalizeParams(o),entries:a})},e.exclude=(e,o)=>{const a={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete a[t]}return new Mr({...t,checks:[],...normalizeParams(o),entries:a})}});function _enum(e,t){return new Mr({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...normalizeParams(t)})}var zr=$constructor("ZodLiteral",(e,t)=>{ut.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>literalProcessor(e,t,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function literal(e,t){return new zr({type:"literal",values:Array.isArray(e)?e:[e],...normalizeParams(t)})}var $r=$constructor("ZodTransform",(e,t)=>{pt.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>transformProcessor(e,t,n,o),e._zod.parse=(n,o)=>{if("backward"===o.direction)throw new b(e.constructor.name);n.addIssue=o=>{if("string"==typeof o)n.issues.push(issue(o,n.value,t));else{const t=o;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(issue(t))}};const a=t.transform(n.value,n);return a instanceof Promise?a.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=a,n.fallback=!0,n)}});function transform(e){return new $r({type:"transform",transform:e})}var Nr=$constructor("ZodOptional",(e,t)=>{mt.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>optionalProcessor(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function optional(e){return new Nr({type:"optional",innerType:e})}var Pr=$constructor("ZodExactOptional",(e,t)=>{ht.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>optionalProcessor(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function exactOptional(e){return new Pr({type:"optional",innerType:e})}var Or=$constructor("ZodNullable",(e,t)=>{gt.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>nullableProcessor(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function nullable(e){return new Or({type:"nullable",innerType:e})}var _r=$constructor("ZodDefault",(e,t)=>{ft.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>defaultProcessor(e,t,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _default(e,t){return new _r({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():shallowClone(t)}})}var jr=$constructor("ZodPrefault",(e,t)=>{yt.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>prefaultProcessor(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function prefault(e,t){return new jr({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():shallowClone(t)}})}var Fr=$constructor("ZodNonOptional",(e,t)=>{bt.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>nonoptionalProcessor(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function nonoptional(e,t){return new Fr({type:"nonoptional",innerType:e,...normalizeParams(t)})}var Lr=$constructor("ZodCatch",(e,t)=>{vt.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>catchProcessor(e,t,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _catch(e,t){return new Lr({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t})}var Dr=$constructor("ZodPipe",(e,t)=>{wt.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>pipeProcessor(e,t,n,o),e.in=t.in,e.out=t.out});function pipe(e,t){return new Dr({type:"pipe",in:e,out:t})}var Br=$constructor("ZodReadonly",(e,t)=>{St.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>readonlyProcessor(e,t,n,o),e.unwrap=()=>e._zod.def.innerType});function readonly(e){return new Br({type:"readonly",innerType:e})}var Gr=$constructor("ZodLazy",(e,t)=>{It.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>lazyProcessor(e,t,n,o),e.unwrap=()=>e._zod.def.getter()});function lazy(e){return new Gr({type:"lazy",getter:e})}var Wr=$constructor("ZodCustom",(e,t)=>{Ct.init(e,t),qt.init(e,t),e._zod.processJSONSchema=(t,n,o)=>customProcessor(e,t,n,o)});function refine(e,t={}){return _refine(Wr,e,t)}function superRefine(e,t){return _superRefine(e,t)}var Vr,Hr={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};Vr||(Vr={});var Ur=Object.freeze(["hybridTrack","clientStep"]),qr="hybridTrack",Kr=Object.freeze(["eagleWings","atavianWings","islandWings","wormhole","sewergrate","airHarness","universe","knocker","gare","urn","pebble","nurRift"]),Zr=Object.freeze({atavianWings:"say duanatharan",eagleWings:"say duanathar",islandWings:"say duanatharic"}),Yr=(Object.freeze({atavianWings:Object.freeze([]),eagleWings:Object.freeze([]),gare:Object.freeze([]),universe:Object.freeze([])}),Object.freeze({outdoor:Object.freeze({enabled:!1,color:"#44aaff"}),wormhole:Object.freeze({enabled:!1,color:"#aa44ff"})})),Xr="https://unpkg.com/nexmap/wallpaper-830417_750_540.jpg",Jr=Object.freeze({background:Object.freeze({opacity:.3,url:Xr}),currentRoomBorder:"#ff1493",currentRoomShape:"rectangle",labelFontSize:13,labelMode:"name",pathingNotices:!0,roomBorderIndicators:Yr,zoom:1});function createDefaultSettings(){return deepFreeze$7({autoUpdate:!1,celerity:2,commandSeparator:"|",disabledTravelClasses:[...Kr],display:{...Jr},excludedRoomIds:[],landmarks:[],pathingMode:qr,schemaVersion:1,travelClassAreaExclusions:{atavianWings:[],eagleWings:[],gare:[],universe:[]},travelCommands:{...Zr},vibratingStick:!1})}function deepFreeze$7(e){if(!e||"object"!=typeof e)return e;Object.freeze(e);for(const t of Object.values(e))deepFreeze$7(t);return e}createDefaultSettings();var Qr=Object.freeze(["standard","scripted","eagleWings","atavianWings","islandWings","wormhole","sewergrate","airHarness","universe","knocker","gare","urn","pebble","nurRift","flame"]),en=union([string(),number(),boolean(),_null()]),tn=lazy(()=>union([en,array(tn),record(string(),tn)])),rn=record(string(),tn),nn=number().int(),an=number().int(),sn=string().min(1),ln=(union([nn,sn]),union([string().min(1),number().int()])),cn=tuple([number(),number(),number()]),dn=_enum(Qr),un=_enum(Ur),pn=object({areaName:string(),continent:string(),id:string().min(1),name:string().min(1),roomId:nn}).strict(),mn=object({atavianWings:string().min(1),eagleWings:string().min(1),islandWings:string().min(1)}).strict(),hn=object({atavianWings:array(an),eagleWings:array(an),gare:array(an),universe:array(an)}).strict(),gn=object({opacity:number().min(0).max(1).default(.3),url:string().nullable().default(Xr)}).strict().default({opacity:.3,url:Xr}),yn=object({color:string().min(1),enabled:boolean().default(!1)}).strict(),bn=object({outdoor:yn.default({enabled:!1,color:"#44aaff"}),wormhole:yn.default({enabled:!1,color:"#aa44ff"})}).strict().default({outdoor:{enabled:!1,color:"#44aaff"},wormhole:{enabled:!1,color:"#aa44ff"}}),vn=object({background:gn,currentRoomBorder:string().min(1),currentRoomShape:string().min(1),labelFontSize:number().positive().default(13),labelMode:string().min(1),pathingNotices:boolean().default(!0),roomBorderIndicators:bn,zoom:number().positive()}).strict(),wn=object({autoUpdate:boolean(),celerity:number().positive(),commandSeparator:string().min(1),disabledTravelClasses:array(dn),display:vn,excludedRoomIds:array(nn),landmarks:array(pn),pathingMode:un,schemaVersion:literal(1),travelClassAreaExclusions:hn,travelCommands:mn,vibratingStick:boolean().default(!1)}).strict(),Sn=object({area:string(),continent:string(),id:union([number().int(),string()]),name:string(),roomID:string(),target:string()}).passthrough(),xn=object({airHarness:boolean(),antiGareAreas:array(unknown()),antiUniverseAreas:array(unknown()),antiWingAreas:array(unknown()),celerity:number(),commandSeparator:string(),currentRoomBorder:string(),currentRoomShape:string(),disabledTravelOptions:array(string()),displayWormholes:boolean(),duanatharanCommand:string(),duanatharCommand:string(),enchantedPebble:boolean(),excludeRooms:array(unknown()),intialConfiguration:number(),labelDisplay:string(),landmarks:array(Sn),loadOnLogin:boolean(),useDuanathar:boolean(),useDuanatharan:boolean(),useKnocker:boolean(),useSewergrates:boolean(),useUniverse:boolean(),useWormholes:boolean(),vibratingStick:boolean()}).passthrough();function parseStoredSettings(e){if(null==e||""===e)return createDefaultSettings();if("string"==typeof e){let n;try{n=JSON.parse(e)}catch(t){throw new Error(`Invalid nexMap4 settings JSON: ${t.message}`,{cause:t})}return normalizeSettingsDocument(n)}return normalizeSettingsDocument(e)}function normalizeSettingsDocument(e){const t=parseNativeSettings(stripLegacyFields(e));return deepFreeze$6({autoUpdate:t.autoUpdate,celerity:t.celerity,commandSeparator:t.commandSeparator,disabledTravelClasses:uniqueValues(t.disabledTravelClasses),display:{background:{opacity:t.display.background?.opacity??.3,url:t.display.background?.url??null},currentRoomBorder:t.display.currentRoomBorder,currentRoomShape:t.display.currentRoomShape,labelFontSize:t.display.labelFontSize??13,labelMode:t.display.labelMode,pathingNotices:t.display.pathingNotices??!0,roomBorderIndicators:{outdoor:{enabled:t.display.roomBorderIndicators?.outdoor?.enabled??!1,color:t.display.roomBorderIndicators?.outdoor?.color??"#44aaff"},wormhole:{enabled:t.display.roomBorderIndicators?.wormhole?.enabled??!1,color:t.display.roomBorderIndicators?.wormhole?.color??"#aa44ff"}},zoom:t.display.zoom},excludedRoomIds:uniqueValues(t.excludedRoomIds),landmarks:t.landmarks.map(e=>({areaName:e.areaName,continent:e.continent,id:e.id,name:e.name,roomId:e.roomId})),pathingMode:t.pathingMode,schemaVersion:t.schemaVersion,travelClassAreaExclusions:{atavianWings:uniqueValues(t.travelClassAreaExclusions.atavianWings),eagleWings:uniqueValues(t.travelClassAreaExclusions.eagleWings),gare:uniqueValues(t.travelClassAreaExclusions.gare),universe:uniqueValues(t.travelClassAreaExclusions.universe)},travelCommands:{atavianWings:t.travelCommands.atavianWings,eagleWings:t.travelCommands.eagleWings,islandWings:t.travelCommands.islandWings},vibratingStick:t.vibratingStick??!1})}function serializeSettingsDocument(e){return JSON.stringify(normalizeSettingsDocument(e))}function stripLegacyFields(e){if(!e||"object"!=typeof e)return e;const{telemetryOptIn:t,...n}=e;if(!n.display||"object"!=typeof n.display)return n;const{showEdgeClasses:o,showWormholeEdges:a,...i}=n.display;return{...n,display:i}}function parseNativeSettings(e){try{return wn.parse(e)}catch(t){if(t instanceof $t)throw new Error("Invalid nexMap4 settings document.",{cause:t});throw t}}function uniqueValues(e){return[...new Set(e)]}function deepFreeze$6(e){if(!e||"object"!=typeof e)return e;Object.freeze(e);for(const t of Object.values(e))deepFreeze$6(t);return e}object({samples:array(object({description:string(),id:string().min(1),value:xn}).passthrough()),sourceSurface:string()}).passthrough(),object({samples:array(Sn),schemaObserved:record(string(),string()),sourceSurface:string()}).passthrough();var In=class{constructor({key:e=g,storage:t}={}){if(!t)throw new Error("SettingsRepository requires a storage adapter.");this.key=e,this.storage=t}load(){return parseStoredSettings(readRaw(this.storage,this.key))}read(){const e=readRaw(this.storage,this.key);return{exists:null!=e&&""!==e,key:this.key,settings:parseStoredSettings(e)}}save(e){const t=serializeSettingsDocument(e);return writeRaw(this.storage,this.key,t),parseStoredSettings(t)}clear(){clearRaw(this.storage,this.key)}};function createMemorySettingsStorage(e={}){const t=new Map(Object.entries(e));return{getItem:e=>t.has(e)?t.get(e):null,removeItem(e){t.delete(e)},setItem(e,n){t.set(e,String(n))},snapshot:()=>Object.fromEntries(t)}}function readRaw(e,t){return"function"==typeof e.getItem?e.getItem(t):"function"==typeof e.read?e.read(t):Object.prototype.hasOwnProperty.call(e,t)?e[t]:null}function writeRaw(e,t,n){"function"!=typeof e.setItem?"function"!=typeof e.write?e[t]=n:e.write(t,n):e.setItem(t,n)}function clearRaw(e,t){"function"!=typeof e.removeItem?"function"!=typeof e.delete?delete e[t]:e.delete(t):e.removeItem(t)}var createStoreImpl=e=>{let t;const n=new Set,setState=(e,o)=>{const a="function"==typeof e?e(t):e;if(!Object.is(a,t)){const e=t;t=(null!=o?o:"object"!=typeof a||null===a)?a:Object.assign({},t,a),n.forEach(n=>n(t,e))}},getState=()=>t,o={setState,getState,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e))},a=t=e(setState,getState,o);return o},createStore=e=>e?createStoreImpl(e):createStoreImpl;function createSettingsAtom(e=createDefaultSettings()){const t=createStore(()=>normalizeSettingsDocument(e));return t.get=t.getState,t.set=function(e){t.setState(e,!0)},t}var Cn=createSettingsAtom();function getSettings(e=Cn){return e.getState()}function replaceSettings(e,t=Cn){const n=normalizeSettingsDocument(e);return t.setState(n,!0),n}function updateSettings(e,t=Cn){const n=t.getState();return replaceSettings("function"==typeof e?e(n):{...n,...e},t)}function resetSettings(e=Cn){return replaceSettings(createDefaultSettings(),e)}function loadSettings(e,t=Cn){return replaceSettings(e.load(),t)}function saveSettings(e,t=Cn){const n=e.save(t.getState());return t.setState(n,!0),n}function createSettingsApi({key:e=g,repository:t=null,storage:n=null,store:o=null}={}){let a=o??createSettingsAtom(),i=t??new In({key:e,storage:n??createMemorySettingsStorage()});function configure(e={}){return e.store&&(a=e.store),e.repository?i=e.repository:e.storage&&(i=new In({key:e.key??i.key,storage:e.storage})),snapshot()}function get(){return getSettings(a)}function snapshot(){return{key:i.key,settings:get()}}function read(){return"function"==typeof i.read?i.read():{exists:!0,key:i.key,settings:i.load()}}function load(){return loadSettings(i,a)}function save(e=get()){return replaceSettings(e,a),saveSettings(i,a)}function replace(e,{persist:t=!0}={}){const n=replaceSettings(e,a);return t?save():n}function update(e,{persist:t=!0}={}){const n=updateSettings(e,a);return t?save():n}function reset({persist:e=!0}={}){const t=resetSettings(a);return e?save():t}function clear({reset:e=!0}={}){return i.clear(),e?resetSettings(a):get()}function subscribe(e){if("function"!=typeof e)throw new Error("nexMap.settings.subscribe requires a listener function.");return a.subscribe(e)}function updateDisplay(e,t){return update(t=>({...t,display:{...t.display,...e}}),t)}function updateLandmarks(e,t){return update(t=>({...t,landmarks:"function"==typeof e?e(t.landmarks):[...e??[]]}),t)}function updateTravelOptions(e,t){return update(t=>({...t,...pickDefined(e,["celerity","commandSeparator","disabledTravelClasses","excludedRoomIds","pathingMode","vibratingStick"]),travelClassAreaExclusions:e.travelClassAreaExclusions?{...t.travelClassAreaExclusions,...e.travelClassAreaExclusions}:t.travelClassAreaExclusions,travelCommands:e.travelCommands?{...t.travelCommands,...e.travelCommands}:t.travelCommands}),t)}return{clear,configure,get,get key(){return i.key},load,read,replace,reset,save,set:replace,snapshot,subscribe,get repository(){return i},get store(){return a},update,updateDisplay,updateLandmarks,updateTravelOptions}}function pickDefined(e,t){return t.reduce((t,n)=>(e&&void 0!==e[n]&&(t[n]=e[n]),t),{})}function settingsToRuntimeContext(e){return{celerity:e.celerity,disabledTravelClasses:new Set(e.disabledTravelClasses),excludedRoomIds:new Set(e.excludedRoomIds),hasVibratingStick:!0===e.vibratingStick,travelClassAreaExclusions:Object.fromEntries(Object.entries(e.travelClassAreaExclusions).map(([e,t])=>[e,new Set(t)]))}}function createClientVariableSettingsStorage(e){if(!e||"function"!=typeof e.getVariable||"function"!=typeof e.setVariable)throw new Error("createClientVariableSettingsStorage requires a Nexus client facade.");return{getItem:t=>e.getVariable(t)??null,removeItem:t=>e.setVariable(t,""),setItem:(t,n)=>e.setVariable(t,n)}}var En=deepFreeze$8({Outer:[297,209,207,162,351,191,194,314,193,192,294,206,181,396,317,225],Western_Isles:[209,162,207],Eastern_Isles:[191,180,181,192],Northern_Isles:[194,206,294,351],Island:[91,92,98,161,164,165,195,224,240,464],Arcadia:[150,153,154],North:[73,74,99,101,108,147,197,199,200,202,204,212,213,214,242,243,244,246,261,262,301,306,307,308,352,353,383,385,109],Off:[6,35,105,150,153,154,162,163,166,168,169,170,171,176,180,181,183,190,191,192,193,194,206,207,109,132,225,245,248,249,252,253,266,271,288,294,297,298,314,317,321,324,351,355,358,359,366,371,382,396,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,45,184,54],Main:[2,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,36,37,38,40,41,42,43,44,46,48,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,65,66,68,69,70,71,72,75,76,77,78,79,80,81,82,83,84,85,87,89,90,95,96,97,102,103,104,105,106,107,110,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,133,134,135,136,137,138,139,142,144,145,148,149,151,152,155,156,157,158,159,160,167,173,174,175,178,179,182,185,186,187,196,198,201,203,205,208,211,235,238,259,263,264,265,267,268,269,270,272,273,274,275,278,279,280,281,284,290,291,292,293,295,296,298,299,300,302,303,309,310,311,312,315,316,318,319,320,323,326,346,348,349,357,361,362,364,365,367,368,372,374,375,376,377,378,379,380,381,384,386,387,388,389,390,391,392,393,394,395,397,398,400,401,402,449,461,463],Yggdrasil:[45,111,255,257,289,363,434,435,436],Meropis:[39,67,141,210,215,217,218,256,282,285,286,305,322,325,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,347,399,445,492,494],Arena:[228,229,230,231,232,233,369]});function areaInContinentAreaGroup(e,t){return getContinentAreaGroupIds(t).includes(Number(e))}function getContinentAreaGroupIds(e){return En[e]??[]}var Rn=Object.freeze([/a swarm of bees/,/a mighty earth golem/,/a suicide mouse/,/an imperious sooty falcon/,/a duskflight falcon/,/a razor-beaked falcon/,/a Mhojave falcon/,/a majestic golden eagle/,/a daemonic hyena/,/a Troll Brute squad/,/a frenzied bloodworm/,/a fiendish nightmare/,/a small grey-brown rattlesnake/,/a saw-scaled viper/,/an emerald tree snake/,/a death adder/,/a many-banded krait/,/a grey wolf/,/a grumpy badger/,/a small brown lemming/,/an ebony raven/,/a cunning red fox/,/an aklan servitor/,/a kindler servitor/,/a crystalline golem/,/a dervish/,/a water weird/,/a fiery efreeti/,/a capricious djinn/,/a sandling/,/a hulking stoneback/,/a zephyr's breath/,/an obscured mistfiend/,/a blazing ashbeast/,/a sharp-toothed gremlin/,/a chaos orb/,/a bloodleech/,/a minion of chaos/,/a worm/,/a green slime/,/a soulmaster/,/a humbug/,/a chimera/,/a bubonis/,/a chaos storm/,/a chaos hound/,/a withered crone/,/a pathfinder/,/a doppleganger/,/an ethereal firelord/,/a simpering sycophant/,/an eldritch abomination/,/Khaseem/,/Dunn/,/Mizik/,/Senzu/,/Archaeon/,/Grandue/,/Imyrr/,/a guardian angel/,/a diminutive homunculus/,/a Baalzadeen/,/shipmate/,/a squad of/,/swashbuckler/,/a red admiral butterfly/,/a white pearl butterfly/,/an indigo nightfire butterfly/,/a glitterlight butterfly/,/a baby rat/,/a young rat/,/a rat/,/an old rat/,/a black rat/]);function isIgnoredDenizenName(e,t=Rn){const n=String(e??"");return t.some(e=>e.test(n))}var kn=deepFreeze$8({defaultCommands:{high:"say duanatharan",low:"say duanathar"},destinations:{main:{continent:"Main",highCloudRoomId:4882,highCommandSetting:"duanatharanCommand",lowCloudRoomId:3885,lowCommandSetting:"duanatharCommand"},meropis:{continent:"Meropis",highCloudRoomId:51603,highCommandSetting:"duanatharanCommand",lowCloudRoomId:51188,lowCommandSetting:"duanatharCommand"}},eligibleAreaGroups:[],sourceRoomSelection:"Derived from the live graph each load: Main/Meropis rooms where outdoors == 'y' or indoors != 'y'.",sourceSurface:"nexmap3/src/base/graphRevisions.js"}),An=deepFreeze$8({command:"shake harness",destinationRoomId:54632,eligibleAreaGroups:["Western_Isles","Eastern_Isles","Northern_Isles"],sourceRoomSelection:"Derived from the live graph each load inside the eligible area groups using the air harness room predicate.",sourceSurface:"nexmap3/src/base/graphRevisions.js"}),Tn=deepFreeze$8({class:"pebbleExit",disabledWeight:"Infinity",edges:[{sourceRoomId:21722,targetRoomId:1226},{sourceRoomId:1226,targetRoomId:21722}],eligibleAreaGroups:[],enabledWeight:1,sourceSurface:"nexmap3/src/base/settings.js + aliases.js"}),Mn=deepFreeze$8({command:"enter grate",eligibleAreaGroups:[],sourceRoomSelection:"Derived from live graph edges whose command is enter grate.",sourceSurface:"nexmap3/src/base/graph.js"}),zn=deepFreeze$8({main:{1745:"mannaseh",1772:"azdun",2855:"shastaan",8730:"manusha",9124:"manara",10091:"genji",10573:"blackrock",17678:"caerwitrin",20386:"newthera",25093:"bitterfork",25581:"newhope",30383:"brasslantern",35703:"thraasi",39103:"mhojave"},meropis:{1226:"rageteeth",12207:"yggdrasil",29755:"seleucar",35450:"judgement"},eligibleAreaGroups:[],sourceRoomSelection:"A temporary current-room edge is added when useUniverse is enabled and GMCP.Status.class is Jester or Occultist.",sourceSurface:"nexmap3/src/base/helpertables.js + walker.js",weightFn:e=>3*Number(e?.celerity??1)}),$n=deepFreeze$8({mainDoorRoomId:57174,meropisDoorRoomId:57177,main:[{areaName:"Morindar",dir:"north",target:18679},{areaName:"Vents of Hthrak",dir:"northeast",target:21906},{areaName:"Northreach",dir:"east",target:7553},{areaName:"Eastern Shore",dir:"southeast",target:42660},{areaName:"Isle of New Hope",dir:"south",target:14402},{areaName:"Moghedu",dir:"southwest",target:179},{areaName:"Azdun Catacombs",dir:"west",target:36546},{areaName:"Dungeon of the Beastlords",dir:"northwest",target:3970},{areaName:"Saiha'balan Grotto",dir:"out",target:37851}],meropis:[{areaName:"Northern Vasnari Mountains",dir:"north",target:26954},{areaName:"Squall Cleft",dir:"northeast",target:19949},{areaName:"Daoric Plains",dir:"east",target:34144},{areaName:"Mirror Caves",dir:"south",target:28435},{areaName:"Shipwreck Isle",dir:"west",target:44865}],eligibleAreaGroups:[],sourceRoomSelection:"A temporary edge is added from the current room to 57174 on Main/Arcadia or 57177 on Meropis when useKnocker is enabled.",sourceSurface:"nexmap3/src/base/helpertables.js + walker.js",weightFn:e=>5.5*Number(e?.celerity??1)}),Nn=deepFreeze$8({areaExitTargetsByName:{Aalen:95,"Aran'riod":197,Arcadia:154,Ashtan:263,Azdun:104,"Central Wilderness":22,Cyrene:97,Delos:22,"Dun Valley":155,"Eastern Ithmia":76,"Eastern Wilderness":166,"Inbhir Ness":147,Kamleikan:108,Mhaldor:50,"Mannaseh Swamp":72,"Mhojave Desert":175,Northreach:123,Ployargos:91,Sunderlands:401,Tomacula:41,Ulangi:92,"Western Ithmia":77},command:"pierce the veil",destinationRoomId:12695,eligibleAreaGroups:[],sourceRoomSelection:"A temporary current-room edge is added for Dragon class only.",sourceSurface:"nexmap3/src/base/helpertables.js + walker.js",weightFn:e=>4*Number(e?.celerity??1)}),Pn=deepFreeze$8({commandTemplate:"order urn/{characterName} go home",eligibleAreaGroups:[],mountDestinations:{"a ghost mule":72,"a phantom ankheg":3232,"a phantom donkey":41913,"a phantom grizzly bear":27090,"a phantom harp seal":21672,"a phantom jaguar":24559,"a phantom sea turtle":2862,"a giant spectral owl":13027,"a hulking phantom spider":9031,"a mighty ghost basilisk":1964,"a mute mammoth apparition":10923,"a silvery spectral gorilla":5100},sourceRoomSelection:"Requires nexSys, mounted defense, and a mount name present in urnMounts.",sourceSurface:"nexmap3/src/base/helpertables.js + walker.js",weightFn:e=>3*Number(e?.celerity??1)}),On=deepFreeze$8({defaultCommand:"say duanatharic",destinationRoomId:47571,sourceRoomSelection:"Derived from the live graph each load: outdoor-eligible rooms across all continents.",sourceSurface:"nexmap4 native"}),_n=deepFreeze$8({eligibleAreaGroups:[],dynamicEdges:[{areaId:431,class:"nurRift",command:"push 225037",id:"45182-nurRift",sourceRoomId:45182,targetRoomId:"riftLocation",weight:1,z:2},{areaId:"currentArea",class:"nurRift",command:"push 272931",id:"nurRift-45182",sourceRoomId:"riftLocation",targetRoomId:45182,weight:1,z:2}],sourceSurface:"nexmap3/src/base/navigation.js + aliases.js",startupDefaultRiftLocation:55588,startupDropsRawEdges:["55588-45182","45182-55588"]}),jn=deepFreeze$8({sourceSurface:"docs/plans/FINAL_FLAME_PLAN.md",routes:[{id:"radak",approachRoomId:45519,flameRoomId:52454,destinationRoomId:51940,destinationLabel:"Radak",transientRoomIds:[38968],egressWeight:31},{id:"ioje",approachRoomId:52029,flameRoomId:52454,destinationRoomId:53394,destinationLabel:"Ioje",transientRoomIds:[38968],egressWeight:31},{id:"kunapi",approachRoomId:52123,flameRoomId:51784,destinationRoomId:53544,destinationLabel:"Kunapi",transientRoomIds:[38968],egressWeight:31},{id:"myrinia",approachRoomId:52554,flameRoomId:51784,destinationRoomId:53502,destinationLabel:"Myrinia",transientRoomIds:[38968],egressWeight:31},{id:"lhitsu",approachRoomId:52391,flameRoomId:51784,destinationRoomId:53005,destinationLabel:"Lhitsu",transientRoomIds:[38968],egressWeight:31},{id:"loramere",approachRoomId:52516,flameRoomId:52144,destinationRoomId:53696,destinationLabel:"Loramere",transientRoomIds:[38968],egressWeight:31},{id:"prialysh",approachRoomId:50884,flameRoomId:52144,destinationRoomId:41708,destinationLabel:"Pri'alysh",transientRoomIds:[38968],egressWeight:31},{id:"kuthalebak",approachRoomId:51850,flameRoomId:45902,destinationRoomId:51466,destinationLabel:"Kuthalebak",transientRoomIds:[38968],egressWeight:31},{id:"qerstead",approachRoomId:52298,flameRoomId:45902,destinationRoomId:51336,destinationLabel:"Qerstead",transientRoomIds:[38968],egressWeight:31}]}),Fn=Object.freeze(["standard","scripted","special","internal"]),Ln=Object.freeze(["crowdmap","nexmap","remote","observed"]),Dn=Object.freeze(["source","session","local","remote"]),Bn=Object.freeze(["ordinary","relay","travelAction","travelEgress","travelIngress"]),Gn=discriminatedUnion("kind",[object({factor:number().nonnegative(),kind:literal("celerityMultiplier")})]),Wn=object({customLine:object({color24RGB:tuple([number().int().min(0).max(255),number().int().min(0).max(255),number().int().min(0).max(255)]).optional(),coordinates:array(tuple([number(),number()])).min(1),endsInArrow:boolean().optional(),style:string().min(1).optional()}).optional(),door:string().optional(),exitId:nn,locked:boolean().optional(),name:string().min(1),scriptId:string().min(1).optional(),weight:number().optional(),weightExpression:string().min(1).optional(),weightSpec:Gn.optional()}),Vn=object({coordinates:cn,environment:number(),exits:array(Wn),id:nn,name:string().optional(),stubExits:unknown().optional(),symbol:unknown().optional(),userData:rn.optional(),weight:number().optional()}).passthrough(),Hn=Vn.extend({environment:number().optional()}),Un=object({id:an,labels:unknown().optional(),name:string(),roomCount:number().int().nonnegative(),rooms:array(Vn),userData:rn.optional()}).passthrough(),qn=Un.extend({continent:string(),rooms:array(Hn)}),Kn=object({areaCount:number().int().nonnegative(),areas:array(Un),formatVersion:number(),roomCount:number().int().nonnegative(),userData:rn}).passthrough(),Zn=Kn.superRefine(validateCrowdmapCounts),Yn=Kn.extend({areas:array(qn)}).superRefine(validateCrowdmapCounts),Xn=object({continent:string(),crowdmapAreaId:an,crowdmapAreaName:string(),gameAreaNamesFromRoomUserData:array(string()),gmcpAreaIdStatus:string(),gmcpAreaIds:array(ln),roomCount:number().int().nonnegative(),sourceSurface:string()}).passthrough(),Jn=(array(Xn),record(string(),array(an))),Qn=array(string().min(1)).min(1),eo=object({areaId:an.optional(),areaName:string().min(1).optional(),commands:Qn.optional(),edgeId:string().min(1),redundantIfMissing:boolean().optional(),sourceSurface:string().min(1),weight:union([number(),literal(Number.POSITIVE_INFINITY),literal("Infinity")]).optional(),weightSpec:Gn.optional()}).passthrough().superRefine((e,t)=>{void 0===e.areaId!=(void 0===e.areaName)&&t.addIssue({code:Hr.custom,message:"graph behavior revision must define both areaId and areaName"}),void 0===e.commands&&void 0===e.weight&&void 0===e.weightSpec&&t.addIssue({code:Hr.custom,message:"graph behavior revision must define commands, weight, or weightSpec"}),void 0!==e.weight&&void 0!==e.weightSpec&&t.addIssue({code:Hr.custom,message:"graph behavior revision cannot define both weight and weightSpec"})}),to=union([object({area:qn,areaId:an,areaName:string().min(1),operation:literal("addArea"),reason:string().min(1).optional(),sourceSurface:string().min(1)}).passthrough(),object({affectedAreaCount:number().int().nonnegative(),id:string().min(1),operation:literal("annotateAreas"),behaviorCovered:string().min(1),sourceSurface:string().min(1)}).passthrough(),object({areaId:an,areaName:string().min(1),operation:literal("addRoom"),reason:string().min(1),room:Hn,sourceSurface:string().min(1)}).passthrough(),object({areaId:an,areaName:string().min(1),operation:literal("updateRoomUserData"),patch:object({userData:rn}),reason:string().min(1),roomId:nn,sourceSurface:string().min(1)}).passthrough(),object({areaId:an,areaName:string().min(1),exit:Wn,operation:literal("addExit"),reason:string().min(1),roomId:nn,sourceSurface:string().min(1)}).passthrough(),object({areaId:an,areaName:string().min(1),exitId:nn,name:string().min(1),operation:_enum(["removeExit","removeExitAlreadyAbsent"]),reason:string().min(1),roomId:nn,sourceSurface:string().min(1)}).passthrough(),object({areaId:an,areaName:string().min(1),exitId:nn,operation:literal("updateExit"),patch:Wn.partial().extend({scriptId:string().min(1).optional()}),reason:string().min(1),roomId:nn,sourceSurface:string().min(1)}).passthrough()]),ro=object({continentLabels:Jn,graphRevisions:array(eo),revisions:array(to)});function validateCrowdmapCounts(e,t){e.areaCount!==e.areas.length&&t.addIssue({code:Hr.custom,message:`areaCount ${e.areaCount} does not match areas length ${e.areas.length}`,path:["areaCount"]});const n=e.areas.reduce((e,t)=>e+t.rooms.length,0);e.roomCount!==n&&t.addIssue({code:Hr.custom,message:`roomCount ${e.roomCount} does not match room total ${n}`,path:["roomCount"]})}var no=_enum(["gmcp","eventStream","nexAction","client"]),oo=object({exampleSource:string().optional(),fieldsObserved:array(string()),sourceSurfaces:array(string())}).passthrough(),ao=(object({optionalGlobals:array(string()),requiredGlobals:array(string()),status:string(),topics:record(string().min(1),oo),validationGaps:array(string()).optional()}).passthrough().superRefine((e,t)=>{for(const n of["GMCP","eventStream","nexAction"])e.requiredGlobals.includes(n)||t.addIssue({code:Hr.custom,message:`requiredGlobals must include ${n}`,path:["requiredGlobals"]})}),union([string(),number(),boolean(),_null()])),io=object({area:string(),areaid:ln.nullable().optional(),id:ln,roomname:string()}).passthrough(),so=object({area:string(),coords:string(),details:string().optional(),environment:string(),exits:record(string(),ln),name:string(),num:ln,ohmap:string().optional()}).passthrough(),lo=object({class:string(),name:string()}).passthrough(),co=object({bal:ao.optional(),ep:ao.optional(),eq:ao.optional(),hp:ao.optional(),mp:ao.optional(),string:string().optional(),wp:ao.optional()}).passthrough(),uo=object({attrib:string().optional(),id:ln.optional(),name:string().optional()}).passthrough(),po=object({items:array(uo),location:string()}).passthrough(),mo=object({item:uo,location:string()}).passthrough(),ho=union([array(uo),uo]),go=object({hpperc:ln.optional(),id:ln.optional(),name:string().optional(),text:string().optional()}).passthrough(),fo=object({name:string().optional(),target:ln.optional()}).passthrough(),yo=object({source:string().optional(),vitals:record(string(),ao).optional()}).passthrough(),bo=record(string(),never()),vo=Object.freeze({"Char.Items.Add":mo,"Char.Items.List":po,"Char.Items.Remove":mo,"Char.Items.Update":mo,"Char.Status":lo,"Char.Vitals":co,"GMCP.Items.room":ho,"GMCP.Location":io,"IRE.Target.Info":go,"IRE.Target.Set":fo,PromptEvent:yo,"Room.Info":so,"Target.Info":go,"Target.Set":fo,eqBalRecoveredEvent:bo}),wo=object({payload:unknown().optional(),sequence:number().int().nonnegative(),source:no,timestampMs:number().nonnegative(),topic:string().min(1)}).passthrough().superRefine((e,t)=>{const n=getGmcpTopicPayloadSchema(e.topic);if(!n)return;const o=n.safeParse(e.payload??{});if(!o.success)for(const a of o.error.issues)t.addIssue({...a,path:["payload",...a.path]})});function getGmcpTopicPayloadSchema(e){return vo[e]}object({description:string().optional(),events:array(wo),expected:record(string(),unknown()).optional(),id:string().min(1),schemaVersion:literal(1)}).passthrough();var So=_enum(["GET","POST","PUT","DELETE"]),xo=_enum(["nexMap","users","wormholes","denizens"]),Io=object({apiKey:string().min(1),endpoints:object({denizens:string().url(),nexMap:string().url(),users:string().url(),wormholes:string().url()})}).strict(),Co=record(string(),union([string(),number(),boolean(),_null()])),Eo=Co.and(object({collection:xo})),Ro=object({body:unknown().optional(),method:So,params:Eo}).strict(),ko=object({body:unknown().nullable(),id:string().min(1),method:So,params:Co}).passthrough(),Ao=(object({requests:array(ko),sourceSurface:string()}).passthrough(),object({bodyShape:unknown().nullable(),id:string().min(1),status:number().int().min(100).max(599)}).passthrough()),To=(object({representativeResponses:array(Ao),validationGap:string().optional()}).passthrough(),union([nn,string().regex(/^\d+$/u).transform(Number)])),Mo=object({id:To,name:string()}).passthrough(),zo=union([object({source:Mo,target:Mo}).passthrough(),object({source:To,sourceName:string().optional(),target:To,targetName:string().optional()}).passthrough().transform(({source:e,sourceName:t,target:n,targetName:o,...a})=>({...a,source:{id:e,name:t??String(e)},target:{id:n,name:o??String(n)}}))]),$o=array(zo),No=object({id:ln,room:array(nn)}).passthrough(),Po=array(No),Oo=object({area:object({id:ln.nullish(),name:string()}).passthrough().optional(),id:ln,name:string(),room:array(nn)}).passthrough(),_o=array(Oo),jo=object({acknowledged:boolean().optional(),message:string().optional()}).catchall(tn),Fo=object({date:union([string().min(1),date()]),name:string().min(1),packages:array(string())}).passthrough(),Lo=object({data:Fo,filter:object({name:string().min(1)}),upsert:literal(!0)}).strict();function createStaticTravelProvider({contributeActiveEdgeSets:e=()=>[],contributeEdgeFamilies:t=()=>[],contributeEdges:n=()=>[],contributeSyntheticNodes:o=()=>[],enabledFor:a,id:i,install:s=null,onEnter:l=e=>({commands:[e.command]}),travelClass:c,weightFor:d=(e,t)=>e.weightFn?e.weightFn(t):e.weight}){return assertKnownTravelClass(c),Object.freeze({contributeActiveEdgeSets:e,contributeEdgeFamilies:t,contributeEdges:n,contributeSyntheticNodes:o,enabledFor:a??(e=>!e?.disabledTravelClasses||!e.disabledTravelClasses.has(c)),id:i,..."function"==typeof s?{install:s}:{},onEnter:l,travelClass:c,weightFor:d})}function createTravelEdgeFromExisting(e,{command:t,metadata:n,sourceId:o,targetId:a,travelClass:i,weight:s}){assertKnownTravelClass(i);const l=e.outgoingEdges(o).filter(e=>e.targetId===a);if(0===l.length)throw new Error(`Travel edge '${i}:${o}-${a}' could not find an existing crowdmap edge.`);if(l.length>1)throw new Error(`Travel edge '${i}:${o}-${a}' matched multiple crowdmap edges.`);const c=l[0],d={...c,classes:mergeSpecialTravelClasses(c.classes,i),command:t??c.command,kind:"special",origin:"nexmap",persistence:"source",role:"travelAction",travelClass:i,weight:s??c.weight};return n&&(d.metadata={...c.metadata??{},...cloneJson$2(n)}),d}function createTravelEdgeFromExistingIfPresent(e,t){return assertKnownTravelClass(t.travelClass),e.getNode(t.sourceId)&&e.getNode(t.targetId)?0===e.outgoingEdges(t.sourceId).filter(e=>e.targetId===t.targetId).length?null:createTravelEdgeFromExisting(e,t):null}function mergeSpecialTravelClasses(e,t){return[...new Set(e.filter(e=>"walk"!==e).concat(t))]}function assertKnownTravelClass(e){if(!Qr.includes(e))throw new Error(`Unknown travel class '${e}'.`)}function cloneJson$2(e){return JSON.parse(JSON.stringify(e))}function createAirHarnessProvider(e=An){return createStaticTravelProvider({contributeEdgeFamilies(t){if(!t.getNode(e.destinationRoomId))return[];const n=new Set(e.eligibleAreaIds??[]),o=t.nodes().filter(t=>isAirHarnessEligibleRoom(t,n,e)).map(e=>e.id);return 0===o.length?[]:[{id:"airHarness",metadata:{sourceSurface:e.sourceSurface},origin:"nexmap",persistence:"source",role:"travelAction",templates:[{command:e.command,id:"eligibleIslandRooms",metadata:{sourceRoomSelection:e.sourceRoomSelection,sourceSurface:e.sourceSurface},role:"travelAction",sourceIds:o,targetId:e.destinationRoomId,weight:1}],travelClass:"airHarness"}]},id:"airHarness",travelClass:"airHarness"})}function isAirHarnessEligibleRoom(e,t,n){return!(!1===e?.render||e?.nodeKind&&"room"!==e.nodeKind||!Number.isSafeInteger(e?.areaId)||!Number.isFinite(e?.coordinates?.z)||!isAirHarnessArea(e.areaId,t,n)||"y"!==e.userData?.outdoors&&"y"===e.userData?.indoors)}function isAirHarnessArea(e,t,n){return n.eligibleAreaGroups?.length?n.eligibleAreaGroups.some(t=>areaInContinentAreaGroup(e,t)):t.has(e)}var Do=Object.freeze({main:"Main",meropis:"Meropis"}),Bo="say duanathar",Go="say duanatharan";function createCloudProviders(e=kn){return[createEagleWingsProvider(e),createAtavianWingsProvider(e)]}function createEagleWingsProvider(e=kn){return createCloudProvider({commandSettingKey:"lowCommandSetting",defaultCommand:e.defaultCommands?.low??Bo,destinationKey:"lowCloudRoomId",id:"eagleWings",table:e,travelClass:"eagleWings"})}function createAtavianWingsProvider(e=kn){return createCloudProvider({commandSettingKey:"highCommandSetting",defaultCommand:e.defaultCommands?.high??Go,destinationKey:"highCloudRoomId",id:"atavianWings",table:e,travelClass:"atavianWings"})}function createCloudProvider({commandSettingKey:e,defaultCommand:t,destinationKey:n,id:o,table:a,travelClass:i}){return createStaticTravelProvider({contributeEdgeFamilies(s){const l=Object.entries(a.destinations).flatMap(([i,l])=>{const c=Do[i]??l.continent,d=l[n];if(!c)throw new Error(`Cloud provider '${o}' has no continent for '${i}'.`);if(!s.getNode(d))return[];const u=s.nodes().filter(e=>e.continent===c&&isCloudEligibleRoom(e)).map(e=>e.id);return 0===u.length?[]:[{command:t,commandSetting:l[e],id:i,metadata:{continent:c,continentKey:i,sourceSurface:a.sourceSurface},role:"travelAction",sourceIds:u,targetId:d,weight:0}]});return 0===l.length?[]:[{id:i,metadata:{sourceSurface:a.sourceSurface},origin:"nexmap",persistence:"source",role:"travelAction",templates:l,travelClass:i}]},id:o,travelClass:i})}function isCloudEligibleRoom(e){return!!isRealRoomNode$1(e)&&("y"===e.userData?.outdoors||"y"!==e.userData?.indoors)}function isRealRoomNode$1(e){return!1!==e?.render&&(!e?.nodeKind||"room"===e.nodeKind)&&Number.isSafeInteger(e?.areaId)&&Number.isFinite(e?.coordinates?.z)}function continentKeyForNode(e,{includeArcadia:t=!1}={}){const n=e?.continent;return"Meropis"===n?"meropis":"Main"===n||t&&"Arcadia"===n?"main":null}function isGareSource(e){return!!e&&(!!continentKeyForNode(e,{includeArcadia:!0})||"Off"!==e.continent&&"Yggdrasil"!==e.continent&&!areaInContinentAreaGroup(e.areaId,"Off"))}function isRealRoomNode(e){return!1!==e?.render&&(!e?.nodeKind||"room"===e.nodeKind)&&Number.isSafeInteger(e?.areaId)&&Number.isFinite(e?.coordinates?.z)}function isTravelEnabled(e,t){const n=e?.disabledTravelClasses;return!(n&&("function"==typeof n.has?n.has(t):Array.isArray(n)&&n.includes(t)))}function isUrnTravelAvailable(e,t=Pn){if(!isTravelEnabled(e,"urn"))return!1;if(!0!==hostFact(e,"isMounted","mounted"))return!1;const n=hostFact(e,"characterName");if("string"!=typeof n||0===n.trim().length)return!1;const o=hostFact(e,"urnMountName","mountName");return"string"==typeof o&&null!=t.mountDestinations[o]}function characterClassIs(e,t){return normalizeClassName(e?.characterClass??e?.hostFacts?.characterClass)===normalizeClassName(t)}function characterClassIn(e,t){return t.some(t=>characterClassIs(e,t))}function characterClassEndsWith(e,t){return normalizeClassName(e?.characterClass??e?.hostFacts?.characterClass).endsWith(normalizeClassName(t))}function hostFact(e,...t){for(const n of t){if(e&&n in e&&void 0!==e[n])return e[n];if(e?.hostFacts&&n in e.hostFacts&&void 0!==e.hostFacts[n])return e.hostFacts[n]}}function normalizeClassName(e){return String(e??"").trim().toLowerCase()}var Wo="flame",Vo="yggdrasil-flame",Ho="[nexmap/travel/flame]";function createFlameProvider(e=jn){const enabledFor=e=>isTravelEnabled(e,Wo),t=new Set,warnMissingRoute=(e,n)=>{const o=`${e.id}:${n.join(",")}`;t.has(o)||(t.add(o),console.warn(`${Ho} Skipping route '${e.id}' because configured room(s) are missing: ${n.join(", ")}.`))};return createStaticTravelProvider({contributeSyntheticNodes:(t,n)=>enabledFor(n)?validRoutes(e.routes,t,warnMissingRoute).map(t=>createFlameNode(t,e)):[],contributeEdges:(t,n)=>enabledFor(n)?validRoutes(e.routes,t,warnMissingRoute).flatMap(e=>createFlameEdges(t,e)):[],enabledFor,id:Wo,travelClass:Wo,weightFor:(e,t)=>"travelEgress"===e.role&&"celerityMultiplier"===e.weightSpec?.kind?e.weightSpec.factor*Number(t?.celerity??1):e.weight})}function presentRoutes(e,t,n){return t&&"function"==typeof t.getNode?e.filter(e=>{const o=missingRouteRooms(e,t);return!(o.length>0&&(n(e,o),1))}):e}function validRoutes(e,t,n){const o=presentRoutes(e,t,n);if(!t||"function"!=typeof t.edgesBetween)return o;for(const a of o)ingressCommandsFor(a,requireApproachEdge(t,a));return o}function createFlameNode(e,t){return{id:flameNodeId(e),metadata:{approachRoomId:e.approachRoomId,destinationRoomId:e.destinationRoomId,flameRoomId:e.flameRoomId,mechanic:Vo,routeId:e.id,sourceSurface:t.sourceSurface},name:`Yggdrasil flame state: ${e.destinationLabel}`,nodeKind:"travelState",origin:"nexmap",persistence:"source",render:!1,searchable:!1,travelClass:Wo}}function createFlameEdges(e,t){const n=e.getNode(t.approachRoomId),o=e.getNode(t.destinationRoomId),a=requireApproachEdge(e,t),i=ingressCommandsFor(t,a);return[{areaId:n.areaId,baseId:`travel:flame:ingress:${t.id}`,classes:[Wo],command:`#flame:${t.id}:ingress`,id:`travel:flame:ingress:${t.id}`,kind:"internal",metadata:{ingressCommands:i,realApproachEdgeId:a.id,realFlameRoomId:t.flameRoomId,routeId:t.id},origin:"nexmap",persistence:"source",role:"travelIngress",sourceId:t.approachRoomId,targetId:flameNodeId(t),travelClass:Wo,weight:1,z:n.coordinates.z},{areaId:o.areaId,baseId:`travel:flame:egress:${t.id}`,classes:[Wo],command:`#flame:${t.id}`,id:`travel:flame:egress:${t.id}`,kind:"scripted",metadata:{destinationRoomId:t.destinationRoomId,flameRoomId:t.flameRoomId,physicalRoomIds:[t.approachRoomId,t.flameRoomId,...t.transientRoomIds,t.destinationRoomId],routeId:t.id,transientRoomIds:[...t.transientRoomIds]},origin:"nexmap",persistence:"source",role:"travelEgress",scriptId:`flame:${t.id}`,sourceId:flameNodeId(t),targetId:t.destinationRoomId,travelClass:Wo,weight:t.egressWeight,weightExpression:`${t.egressWeight} * celerity`,weightFn:e=>t.egressWeight*Number(e?.celerity??1),weightSpec:{kind:"celerityMultiplier",factor:t.egressWeight},z:o.coordinates.z}]}function requireApproachEdge(e,t){const n=e.edgesBetween(t.approachRoomId,t.flameRoomId);if(0===n.length)throw new Error(`${Ho} Route '${t.id}' is missing real approach edge ${t.approachRoomId} -> ${t.flameRoomId}.`);if(n.length>1)throw new Error(`${Ho} Route '${t.id}' matched multiple real approach edges ${t.approachRoomId} -> ${t.flameRoomId}.`);return n[0]}function ingressCommandsFor(e,t){const n=Array.isArray(t.commands)?t.commands:[t.command],o=n.filter(e=>"string"==typeof e&&e);if(0===o.length||o.length!==n.length)throw new Error(`${Ho} Route '${e.id}' real approach edge '${t.id}' has empty commands.`);return o}function missingRouteRooms(e,t){const n=[];return t.getNode(e.approachRoomId)||n.push(`approachRoomId ${e.approachRoomId}`),t.getNode(e.flameRoomId)||n.push(`flameRoomId ${e.flameRoomId}`),t.getNode(e.destinationRoomId)||n.push(`destinationRoomId ${e.destinationRoomId}`),n}function flameNodeId(e){return`travel-flame:${e.id}`}function createIslandWingsProvider(e=On){const t=e.defaultCommand,n=e.destinationRoomId;return createStaticTravelProvider({contributeEdgeFamilies(o){if(!o.getNode(n))return[];const a=o.nodes().filter(e=>isOutdoorRoom(e)).map(e=>e.id);return 0===a.length?[]:[{id:"islandWings",metadata:{sourceSurface:e.sourceSurface},origin:"nexmap",persistence:"source",role:"travelAction",templates:[{command:t,id:"allOutdoor",metadata:{sourceSurface:e.sourceSurface},role:"travelAction",sourceIds:a,targetId:n,weight:0}],travelClass:"islandWings"}]},id:"islandWings",travelClass:"islandWings"})}function isOutdoorRoom(e){return!(!1===e?.render||e?.nodeKind&&"room"!==e.nodeKind||!Number.isSafeInteger(e?.areaId)||!Number.isFinite(e?.coordinates?.z)||"y"!==e.userData?.outdoors&&"y"===e.userData?.indoors)}function createGareProvider(e=Nn){return createStaticTravelProvider({contributeEdgeFamilies:t=>gareIngressFamily(t,e),enabledFor:e=>isTravelEnabled(e,"gare")&&characterClassEndsWith(e,"Dragon"),id:"gare",travelClass:"gare",weightFor:(e,t)=>e.weightFn?e.weightFn(t):e.weight})}function gareIngressFamily(e,t){const n=t.destinationRoomId;if(!e.getNode(n))return[];const o=e.nodes().filter(e=>e.id!==n&&isRealRoomNode(e)&&isGareSource(e)).map(e=>e.id);return 0===o.length?[]:[{id:"gare",origin:"nexmap",persistence:"source",role:"travelAction",templates:[{command:t.command,id:"veil",metadata:{areaExitTargetsByName:t.areaExitTargetsByName,sourceRoomSelection:t.sourceRoomSelection,sourceSurface:t.sourceSurface},role:"travelAction",sourceIds:o,targetId:n,weightFn:t.weightFn}],travelClass:"gare"}]}var Uo=Object.freeze([{continentKey:"main",command:"#knocker:main",doorKey:"mainDoorRoomId"},{continentKey:"meropis",command:"#knocker:meropis",doorKey:"meropisDoorRoomId"}]);function createKnockerProvider(e=$n){return createStaticTravelProvider({contributeEdgeFamilies:t=>knockerIngressFamily(t,e),enabledFor:e=>isTravelEnabled(e,"knocker"),id:"knocker",travelClass:"knocker"})}function knockerIngressFamily(e,t){const n=Uo.flatMap(({continentKey:n,command:o,doorKey:a})=>{const i=t[a];if(!e.getNode(i))return[];const s=e.nodes().filter(e=>e.id!==i&&isRealRoomNode(e)&&continentKeyForNode(e,{includeArcadia:!0})===n).map(e=>e.id);return 0===s.length?[]:[{command:o,id:n,kind:"scripted",metadata:{continentKey:n,doorRoomId:i,exitTargets:t[n],sourceRoomSelection:t.sourceRoomSelection,sourceSurface:t.sourceSurface},role:"travelIngress",sourceIds:s,targetId:i,weightFn:t.weightFn}]});return 0===n.length?[]:[{id:"knocker",origin:"nexmap",persistence:"source",role:"travelIngress",templates:n,travelClass:"knocker"}]}function createNurRiftProvider(e=_n){return createStaticTravelProvider({install:t=>replaceNurRiftEdges(t,e.startupDefaultRiftLocation,{table:e}),contributeEdges:()=>[],enabledFor:()=>!0,id:"nurRift",travelClass:"nurRift"})}function replaceNurRiftEdges(e,t,{table:n=_n,updatedAt:o=null}={}){assertMapGraph$1(e);const a=normalizeRoomId$7(t,"riftLocationRoomId"),[i,s]=n.dynamicEdges;return e.replaceEdges([i.id,s.id,...n.startupDropsRawEdges??[]],[buildRiftEdge(e,i,a,{table:n,updatedAt:o}),buildRiftEdge(e,s,a,{table:n,updatedAt:o})]),e}function getNurRiftLocationRoomId(e,{table:t=_n}={}){return e&&"function"==typeof e.getEdge?e.getEdge(t.dynamicEdges[0].id)?.targetId??null:null}function buildRiftEdge(e,t,n,{table:o,updatedAt:a}){const i="riftLocation"===t.sourceRoomId?n:t.sourceRoomId,s="riftLocation"===t.targetRoomId?n:t.targetRoomId,l=requireNode$1(e,i,t.id,"source"),c=requireNode$1(e,s,t.id,"target"),d={riftLocationRoomId:n,sourceSurface:o.sourceSurface,startupDropsRawEdges:[...o.startupDropsRawEdges??[]],targetRoomName:c.name};return null!=a&&(d.updatedAt=a),{areaId:"currentArea"===t.areaId?l.areaId:t.areaId,baseId:t.id,classes:[t.class??"nurRift"],command:t.command,id:t.id,kind:"special",metadata:d,origin:null==a?"nexmap":"observed",persistence:"session",role:"travelAction",sourceId:i,targetId:s,travelClass:"nurRift",weight:t.weight,z:l.coordinates.z}}function requireNode$1(e,t,n,o){const a=e.getNode(t);if(!a)throw new Error(`Nur rift edge '${n}' references missing ${o} room '${t}'.`);return a}function normalizeRoomId$7(e,t){if("number"==typeof e&&Number.isInteger(e))return e;const n=String(e??"").trim();if(/^-?\d+$/.test(n))return Number(n);throw new Error(`${t} must be a room id.`)}function assertMapGraph$1(e){if(!e||"function"!=typeof e.replaceEdges)throw new Error("Nur rift graph updates require a configured MapGraph.")}function createPebbleProvider(e=Tn){return createStaticTravelProvider({contributeEdges:t=>e.edges.flatMap(n=>{const o=createTravelEdgeFromExistingIfPresent(t,{metadata:{disabledWeight:e.disabledWeight,sourceSurface:e.sourceSurface,sourceTravelClass:e.class},sourceId:n.sourceRoomId,targetId:n.targetRoomId,travelClass:"pebble",weight:e.enabledWeight});return o?[o]:[]}),id:"pebble",travelClass:"pebble"})}function createSewerGratesProvider(e=Mn){return createStaticTravelProvider({contributeEdges:t=>t.edges().flatMap(n=>{if(!isSewerGrateEdge(n,e))return[];const o=createTravelEdgeFromExistingIfPresent(t,{command:n.command??e.command,metadata:{sourceRoomSelection:e.sourceRoomSelection,sourceSurface:e.sourceSurface},sourceId:n.sourceId,targetId:n.targetId,travelClass:"sewergrate",weight:1});return o?[o]:[]}),id:"sewerGrates",travelClass:"sewergrate"})}function isSewerGrateEdge(e,t){return e.classes?.includes("sewergrate")||String(e.command??"").toLowerCase()===String(t.command).toLowerCase()}var qo=Object.freeze(["Jester","Occultist"]),Ko=Object.freeze({main:"travel-hub:universe:main",meropis:"travel-hub:universe:meropis"});function createUniverseProvider(e=zn){const enabledFor=e=>isTravelEnabled(e,"universe")&&characterClassIn(e,qo);return createStaticTravelProvider({contributeEdgeFamilies(t){const n=Object.entries(Ko).flatMap(([n,o])=>{if(!t.getNode(o)||!e[n])return[];const a=t.nodes().filter(e=>isRealRoomNode(e)&&continentKeyForNode(e)===n).map(e=>e.id);return 0===a.length?[]:[{command:`#universe:${n}`,edgeIdPrefix:"travel:universe:ingress",id:n,kind:"internal",metadata:{continentKey:n,sourceRoomSelection:e.sourceRoomSelection,sourceSurface:e.sourceSurface},role:"travelIngress",sourceIds:a,targetId:o,weight:0}]});return 0===n.length?[]:[{id:"universe-ingress",origin:"nexmap",persistence:"source",role:"travelIngress",templates:n,travelClass:"universe"}]},contributeSyntheticNodes:()=>Object.entries(Ko).map(([t,n])=>({id:n,metadata:{continentKey:t,sourceSurface:e.sourceSurface},name:`Universe travel hub (${t})`,nodeKind:"travelHub",origin:"nexmap",persistence:"source",render:!1,searchable:!1,travelClass:"universe"})),contributeEdges:t=>Object.entries(Ko).flatMap(([n,o])=>Object.entries(e[n]??{}).flatMap(([a,i])=>{const s=t.getNode(Number(a));return s?[{areaId:s.areaId,baseId:`travel:universe:${n}:${a}`,classes:["universe"],command:`#universe:${n}:${i}`,id:`travel:universe:${n}:${a}`,kind:"scripted",metadata:{continentKey:n,destinationKey:i,sourceRoomSelection:e.sourceRoomSelection,sourceSurface:e.sourceSurface},origin:"nexmap",persistence:"source",role:"travelEgress",sourceId:o,targetId:Number(a),travelClass:"universe",weight:e.weightFn({celerity:1}),weightExpression:"3 * celerity",weightFn:e.weightFn,z:s.coordinates.z}]:[]})),enabledFor,id:"universe",travelClass:"universe"})}var Zo="travel-hub:urn";function createUrnProvider(e=Pn){return createStaticTravelProvider({contributeSyntheticNodes:()=>[{id:Zo,metadata:{sourceSurface:e.sourceSurface},name:"Urn travel hub",nodeKind:"travelHub",origin:"nexmap",persistence:"source",render:!1,searchable:!1,travelClass:"urn"}],contributeEdgeFamilies:t=>urnIngressFamily(t,e),contributeEdges:()=>[],enabledFor:t=>isUrnTravelAvailable(t,e),id:"urn",travelClass:"urn",weightFor:(e,t)=>e.weightFn?e.weightFn(t):e.weight})}function urnIngressFamily(e,t){if(!e.getNode("travel-hub:urn"))return[];const n=e.nodes().filter(e=>isRealRoomNode(e)&&null!==continentKeyForNode(e,{includeArcadia:!0})).map(e=>e.id);return 0===n.length?[]:[{id:"urn-ingress",origin:"nexmap",persistence:"source",role:"travelIngress",templates:[{command:"#urn:ingress",edgeIdPrefix:"travel:urn:ingress",id:"urn",kind:"internal",metadata:{sourceRoomSelection:t.sourceRoomSelection,sourceSurface:t.sourceSurface},role:"travelIngress",sourceIds:n,targetId:Zo,weight:0}],travelClass:"urn"}]}var Yo=new class{#e;#t;constructor(e=[]){assertUniqueProviderIds(e),this.#e=Object.freeze([...e]),this.#t=createProviderTravelClassIndex(this.#e)}providers(){return this.#e}providerIds(){return this.#e.map(e=>e.id)}contributeEdges(e){return this.#e.flatMap(t=>t.contributeEdges(e))}contributeEdgeFamilies(e){return this.#e.flatMap(t=>t.contributeEdgeFamilies(e))}weightFor(e,t){if(e.travelClass)return this.#t.get(e.travelClass)?.weightFor(e,t)}applyToGraph(e){for(const t of this.#e){if("function"==typeof t.install){const n=t.install(e);if(void 0!==n&&n!==e)throw new Error(`Travel provider '${t.id}' returned a replacement graph.`);continue}e.upsertSyntheticNodes(t.contributeSyntheticNodes(e)),e.upsertEdgeFamilies(t.contributeEdgeFamilies(e)),upsertProviderEdges(e,t.contributeEdges(e));for(const n of t.contributeActiveEdgeSets(e))e.replaceActiveEdgeSet(n.id,n.edges)}return e}}([...createCloudProviders(),createIslandWingsProvider(),createAirHarnessProvider(),createPebbleProvider(),createSewerGratesProvider(),createUniverseProvider(),createFlameProvider(),createKnockerProvider(),createGareProvider(),createUrnProvider(),createNurRiftProvider()]);function applyTravelProviders(e,{registry:t=Yo}={}){return t.applyToGraph(e)}function upsertProviderEdges(e,t){if(!Array.isArray(t))throw new Error("Travel providers must contribute edge arrays.");if(0===t.length)return e;const n=new Set,o=[];for(const a of t){if(n.has(a.id))throw new Error(`Travel provider contributed duplicate edge id '${a.id}'.`);n.add(a.id);const t=normalizeTravelEdge(e,a),i=e.getEdge(t.id);i&&assertReplacementMatchesExisting(i,t),o.push(t)}return e.upsertEdges(o),e}function normalizeTravelEdge(e,t){const n=e.getNode(t.sourceId),o=e.getNode(t.targetId);if(!n)throw new Error(`Travel edge '${t.id}' references missing source '${t.sourceId}'.`);if(!o)throw new Error(`Travel edge '${t.id}' references missing target '${t.targetId}'.`);return{...t,areaId:t.areaId??n.areaId??o.areaId,z:t.z??n.coordinates?.z??o.coordinates?.z}}function assertReplacementMatchesExisting(e,t){if(e.sourceId!==t.sourceId||e.targetId!==t.targetId||e.areaId!==t.areaId||e.z!==t.z)throw new Error(`Travel edge '${t.id}' cannot replace a different graph edge.`)}function assertUniqueProviderIds(e){const t=new Set;for(const n of e){if(t.has(n.id))throw new Error(`Duplicate travel provider id '${n.id}'.`);t.add(n.id)}}function createProviderTravelClassIndex(e){const t=new Map;for(const n of e){if(t.has(n.travelClass))throw new Error(`Duplicate travel provider class '${n.travelClass}'.`);t.set(n.travelClass,n)}return t}var Xo="session:travel:urn";function createTravelTopologyController({urnTable:e=Pn}={}){function updateSessionActiveEdges({graph:t,runtimeContext:n}){return assertGraph$1(t),replaceActiveEdges(t,Xo,buildUrnEdges(t,n??{},{table:e})),t}return Object.freeze({updateSessionActiveEdges})}function buildUrnEdges(e,t,{table:n}){if(!isUrnTravelAvailable(t,n))return[];const o=e.getNode(Zo),a=getMountDestination(n,t);return o&&e.getNode(a)?[createActiveTravelEdge(e,{command:n.commandTemplate.replace("{characterName}",hostFact(t,"characterName")),id:`travel:urn:egress:${a}`,metadata:{mountName:getMountName(t),sourceRoomSelection:n.sourceRoomSelection,sourceSurface:n.sourceSurface},role:"travelEgress",sourceId:Zo,targetId:a,travelClass:"urn",weight:n.weightFn(t),weightFn:n.weightFn})]:[]}function createActiveTravelEdge(e,{command:t,id:n,kind:o="special",metadata:a,origin:i="nexmap",persistence:s="session",role:l="travelAction",sourceId:c,targetId:d,travelClass:u,weight:p,weightFn:m}){const h=e.getNode(c),g=e.getNode(d);if(!h||!g)throw new Error(`Session travel edge '${n}' references a missing graph node.`);return{areaId:h.areaId??g.areaId,baseId:n,classes:[u],command:t,id:n,kind:o,metadata:a,origin:i,persistence:s,role:l,sourceId:c,targetId:d,travelClass:u,weight:p,..."function"==typeof m?{weightFn:m}:{},z:h.coordinates?.z??g.coordinates?.z}}function replaceActiveEdges(e,t,n){0!==n.length?e.replaceActiveEdgeSet(t,n):e.removeActiveEdgeSet(t)}function getMountDestination(e,t){const n=getMountName(t);return n?e.mountDestinations[n]??null:null}function getMountName(e){return hostFact(e,"urnMountName","mountName")}function assertGraph$1(e){if(!e||"function"!=typeof e.getNode||"function"!=typeof e.replaceActiveEdgeSet||"function"!=typeof e.removeActiveEdgeSet)throw new Error("Session travel topology requires a mutable MapGraph.")}var Jo=[];function reportCommandError(e){Jo.push(e);try{globalThis.console?.error?.("[nexMap4] Command failed:",e)}catch(t){Jo.push(t)}}var Qo=Object.freeze(["GMCP","eventStream","nexAction"]),ea=Object.freeze(["nexSys","nexGui"]),ta=Object.freeze(["gmcp.read","eventStream.registerEvent","eventStream.removeListener","eventStream.raiseEvent","nexAction.triggers.add","nexAction.triggers.remove","nexAction.triggers.disable","client.sendCommands","client.sendQueue","client.notice","client.printHtml","client.currentLine","client.variables","client.layout"]),ra=Object.freeze(["nexSys.api","nexGui.colors"]),na=Object.freeze({GMCP_LOCATION:"nexmap4.gmcp.location",GMCP_ROOM_INFO:"nexmap4.gmcp.room.info",GMCP_CHAR_STATUS:"nexmap4.gmcp.char.status",GMCP_CHAR_VITALS:"nexmap4.gmcp.char.vitals",GMCP_CHAR_ITEMS_LIST:"nexmap4.gmcp.char.items.list",GMCP_CHAR_ITEMS_ADD:"nexmap4.gmcp.char.items.add",GMCP_CHAR_ITEMS_REMOVE:"nexmap4.gmcp.char.items.remove",GMCP_CHAR_ITEMS_UPDATE:"nexmap4.gmcp.char.items.update",GMCP_TARGET_INFO:"nexmap4.gmcp.target.info",GMCP_TARGET_SET:"nexmap4.gmcp.target.set",HOST_PROMPT:"nexmap4.host.prompt",HOST_EQ_BAL_RECOVERED:"nexmap4.host.eqBalRecovered"}),oa=Object.freeze(Object.values(na)),aa=Object.freeze(["Room.Info","Char.Status","Char.Vitals"]),ia=Object.freeze(["Char.Items.Add","Char.Items.Remove","Char.Items.Update","Target.Info","Target.Set","IRE.Target.Info","IRE.Target.Set"]),sa=Object.freeze(["Room.Info","Char.Status","Char.Vitals"]),la=Object.freeze({optionalCapabilities:ra,optionalGlobals:ea,requiredCapabilities:ta,requiredGlobals:Qo,topics:na}),ca=class extends Error{constructor(e,{missing:t=[],optionalMissing:n=[]}={}){super(e),this.name="HostCapabilityError",this.missing=t,this.optionalMissing=n}};function describeAdapterContract(){return la}var da="#B1624E",ua="#FFF2D7",pa=`<span class="mono"><span style="color:${da};">[-</span><span style="color:#5CC8D7;">nexMap</span><span style="color:${da};">-] </span>`;function escapeHtml$1(e){return String(e??"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function buildNoticeHtml(e,t){if(t?.html)return pa+String(e)+"</span>";const n="string"==typeof t?t.trim():t?.color??ua,o=escapeHtml$1(e);return pa+(n?`<span style="color:${escapeHtml$1(n)};">${o}</span>`:o)+"</span>"}function createClientFacade({host:e,recorder:t,settingsStore:n=null}={}){if(!e||"object"!=typeof e)throw new Error("createClientFacade requires a host object.");const o=t??createNullRecorder$2();function defaultSeparator(){if(!n)return"; ";const e=n.getState?.()?.commandSeparator;return"string"==typeof e&&e.length>0?e:"; "}function sendCommands(t,{separator:n}={}){const a=(Array.isArray(t)?t:[t]).map(e=>String(e)),i=a.join(n??defaultSeparator());return o.recordSend(a),e.nexusclient?.send_commands?.(i),a}function sendQueue(t,{separator:n,queue:a="freestand"}={}){const i=(Array.isArray(t)?t:[t]).map(e=>String(e)),s=i.join(n??defaultSeparator());return o.recordSend(i),e.nexusclient?.send_commands?.(`queue add ${a} ${s}`),i}function notice(t,n){const a=String(t??""),i=(n&&"object"==typeof n?n.level:null)??"info",s="string"==typeof n?n:n?.color??null;if(o.recordNotice({color:s,level:i,message:a}),"function"==typeof e.nexusclient?.add_html_line)e.nexusclient.add_html_line(buildNoticeHtml(a,n));else{const t="string"==typeof n?n:n?.color??void 0;e.nexusclient?.writeLine?.(a,t)}}function printHtml(t){return o.recordHtml(t),e.nexusclient?.add_html_line?.(t),t}function gagLine(){const t=e.nexusclient?.current_line;return t&&(t.gag=!0),o.recordGag(),Boolean(t)}function rewriteCurrentLine(t){const n=e.nexusclient?.current_line?.parsed_line;return n&&(n.formatted=()=>t),o.recordRewrite(t),Boolean(n)}function getVariable(t){const n=e.nexusclient?.variables?.()?.vars;return n?n[t]:void 0}function setVariable(t,n){const a=e.nexusclient?.variables?.()?.vars;return!!a&&(a[t]=n,o.recordVariableSet({name:t,value:n}),!0)}function selectTab(t){const n=e.nexusclient?.ui?.()?.layout?.(),a=n?.flexModel??n?.flexlayout??null;return o.recordTabSelect(t),!!a&&("function"==typeof a.doAction&&"function"==typeof a.constructor?.SelectTab?(a.doAction(a.constructor.SelectTab(t)),!0):"function"==typeof n.selectTab&&(n.selectTab(t),!0))}return{gagLine,getVariable,notice,printHtml,rewriteCurrentLine,selectTab,sendCommands,sendQueue,setVariable}}function createNullRecorder$2(){return{recordGag(){},recordHtml(){},recordNotice(){},recordRewrite(){},recordSend(){},recordTabSelect(){},recordVariableSet(){}}}var ma=/^nexmap4(\.[a-z0-9_-]+)+$/u,ha=Object.freeze({AREA_CHANGED:"nexmap4.area.changed",BOOTSTRAP_PHASE:"nexmap4.bootstrap.phase",PATHING_BLOCKED:"nexmap4.pathing.blocked",PATHING_COMPLETE:"nexmap4.pathing.complete",PATHING_START:"nexmap4.pathing.start",ROOM_CHANGED:"nexmap4.room.changed",SCRIPT_FIRED:"nexmap4.script.fired",SCRIPT_START:"nexmap4.script.start",SCRIPT_TIMEOUT:"nexmap4.script.timeout"});function roomChangedEventName(e){const t=String(e??"").trim();if(!/^-?\d+$/u.test(t))throw new Error(`room.changed scoped event requires a numeric room id; received '${e}'.`);return`${ha.ROOM_CHANGED}.${t}`}function isNexMap4EventName(e){return ma.test(String(e??""))}function createEventStreamFacade({host:e,recorder:t}={}){if(!e||"object"!=typeof e)throw new Error("createEventStreamFacade requires a host object.");const n=t??createNullRecorder$1();function raise(t,o={}){const a=normalizeEventName(t);assertNexMap4EventName(a);const i=Object.freeze({payload:clonePayload(o),topic:a});return n.recordRaise(i),e.eventStream?.raiseEvent?.(a,o),i}return Object.freeze({raise,raiseRoomChanged(e,t={}){const n={...t,roomId:e};return raise(ha.ROOM_CHANGED,n),raise(roomChangedEventName(e),n)}})}function normalizeEventName(e){return String(e??"").trim()}function assertNexMap4EventName(e){if(!isNexMap4EventName(e))throw new Error(`Invalid nexMap4 eventStream topic '${e}'. Expected lowercase dotted nexmap4.* form.`)}function clonePayload(e){if(null==e)return e;try{return JSON.parse(JSON.stringify(e))}catch{return e}}function createNullRecorder$1(){return{recordRaise(){}}}Object.freeze(Object.values(ha));var ga=Object.freeze([na.GMCP_LOCATION,na.GMCP_ROOM_INFO]);function extractCurrentRoomId(e){if(!e)return null;const t=e.id??e.num??e.roomId??e.roomID??null;return null==t?null:normalizeRoomId$6(t)}function extractCurrentRoomIdFromEvent(e){return extractCurrentRoomId(e?.payload)}function getLatestCurrentRoomEvent(e){const t=ga.map(t=>e?.getLastEvent?.(t)).filter(Boolean);return 0===t.length?null:t.reduce((e,t)=>compareEvents$1(t,e)>0?t:e)}function normalizeRoomId$6(e){if("number"==typeof e)return e;const t=String(e).trim();return 0===t.length?null:/^-?\d+$/.test(t)?Number(t):t}function compareEvents$1(e,t){const n=Number(e?.sequence??0),o=Number(t?.sequence??0);return n!==o?n-o:Number(e?.timestampMs??0)-Number(t?.timestampMs??0)}function createGmcpFacade(){const e=new Set,t=new Map,n=new Map;function publish(o){if(!o||"string"!=typeof o.topic)throw new Error("Gmcp facade publish requires a topic.");n.set(o.topic,o);const a=t.get(o.topic);if(a)for(const e of a)e(o);for(const t of e)t(o)}function subscribe(e,n){if("function"==typeof e&&void 0===n)return subscribeAll(e);if("function"!=typeof n)throw new Error("subscribe(topic, listener) requires a listener function.");const o=Array.isArray(e)?e:[e];for(const t of o)if(!oa.includes(t))throw new Error(`subscribe received unknown nexMap4 topic '${String(t)}'.`);for(const a of o){let e=t.get(a);e||(e=new Set,t.set(a,e)),e.add(n)}return()=>{for(const e of o)t.get(e)?.delete(n)}}function subscribeAll(t){if("function"!=typeof t)throw new Error("subscribeAll requires a listener function.");return e.add(t),()=>{e.delete(t)}}function getLastEvent(e){return n.get(e)??null}function getState(){return Object.fromEntries(n)}return{getLastEvent,getState,publish,subscribe,subscribeAll}}function createLocationState({gmcp:e}){if(!e?.subscribe)throw new Error("createLocationState requires a gmcp facade with subscribe().");let t=null,n=null;const o=e.subscribe(ga,e=>{const o=extractCurrentRoomIdFromEvent(e);null!==o&&o!==t&&(n=t,t=o)});return{getRoomId:()=>t,getLastRoomId:()=>n,getSnapshot:()=>Object.freeze({lastRoomId:n,roomId:t}),reset(){t=null,n=null},destroy(){o?.()}}}var fa={"gmcp.read":e=>isObject$2(e.GMCP),"eventStream.registerEvent":e=>"function"==typeof e.eventStream?.registerEvent,"eventStream.removeListener":e=>"function"==typeof e.eventStream?.removeListener,"eventStream.raiseEvent":e=>"function"==typeof e.eventStream?.raiseEvent,"nexAction.triggers.add":e=>"function"==typeof e.nexAction?.triggers?.add,"nexAction.triggers.remove":e=>"function"==typeof e.nexAction?.triggers?.remove,"nexAction.triggers.disable":e=>"function"==typeof e.nexAction?.triggers?.disable,"client.sendCommands":e=>"function"==typeof e.nexusclient?.send_commands,"client.sendQueue":e=>"function"==typeof e.nexusclient?.send_commands,"client.notice":e=>"function"==typeof e.nexusclient?.display_notice,"client.printHtml":e=>"function"==typeof e.nexusclient?.add_html_line,"client.currentLine":e=>isObject$2(e.nexusclient),"client.variables":e=>"function"==typeof e.nexusclient?.variables,"client.layout":e=>"function"==typeof e.nexusclient?.ui,"nexSys.api":e=>isObject$2(e.nexSys?.api),"nexGui.colors":e=>isObject$2(e.nexGui?.colors)};function probeHostCapabilities(e=globalThis){const t=[],n=[],o=[],a=[];for(const i of ta)probeCapability(i,e)?t.push(i):n.push(i);for(const i of ra)probeCapability(i,e)?o.push(i):a.push(i);return{capabilities:{missingOptional:a,missingRequired:n,presentOptional:o,presentRequired:t},globals:probeGlobals(e),ok:0===n.length}}function assertHostCapabilities(e=globalThis){const t=probeHostCapabilities(e);if(!t.ok)throw new ca(`Required Nexus host capabilities missing: ${t.capabilities.missingRequired.join(", ")}`,{missing:t.capabilities.missingRequired,optionalMissing:t.capabilities.missingOptional});return t}function probeGlobals(e){return{optional:Object.fromEntries(ea.map(t=>[t,void 0!==e[t]&&null!==e[t]])),required:Object.fromEntries(Qo.map(t=>[t,void 0!==e[t]&&null!==e[t]]))}}function probeCapability(e,t){const n=fa[e];if(!n)return!1;try{return Boolean(n(t))}catch{return!1}}function isObject$2(e){return null!==e&&"object"==typeof e}var ya=Object.freeze({"Room.Info":na.GMCP_ROOM_INFO,"Char.Status":na.GMCP_CHAR_STATUS,"Char.Vitals":na.GMCP_CHAR_VITALS,"Char.Items.List":na.GMCP_CHAR_ITEMS_LIST,"Char.Items.Add":na.GMCP_CHAR_ITEMS_ADD,"Char.Items.Remove":na.GMCP_CHAR_ITEMS_REMOVE,"Char.Items.Update":na.GMCP_CHAR_ITEMS_UPDATE,"Target.Info":na.GMCP_TARGET_INFO,"Target.Set":na.GMCP_TARGET_SET,"IRE.Target.Info":na.GMCP_TARGET_INFO,"IRE.Target.Set":na.GMCP_TARGET_SET,PromptEvent:na.HOST_PROMPT,eqBalRecoveredEvent:na.HOST_EQ_BAL_RECOVERED}),ba=new Set(aa),va=new Set(ia);function createIngressNormalizer({emit:e}){if("function"!=typeof e)throw new Error("createIngressNormalizer requires an emit function.");const t=new Map,n=new Map;let o=0,a=0;function receive(e){if(!isObject$1(e))throw new Error("ingress normalizer received a non-object event.");const i=e.topic;if("string"!=typeof i||0===i.length)throw new Error("ingress normalizer received an event without a topic.");if(o=Math.max(o,Number(e.sequence??0)),a=Math.max(a,Number(e.timestampMs??0)),"Char.Items.List"!==i){if(!ba.has(i))return"PromptEvent"===i?(flushSnapshots(),void emitTranslated(e)):void("eqBalRecoveredEvent"!==i?va.has(i)&&emitTranslated(e):emitTranslated(e));t.set(i,e)}else n.set(e.payload?.location??"",e)}function flushSnapshots(){for(const e of sa){const n=t.get(e);n&&(emitTranslated(n),t.delete(e))}if(n.size>0){for(const e of n.values())emitTranslated(e);n.clear()}}function emitTranslated(t){const n=ya[t.topic];n&&e(Object.freeze({payload:t.payload??null,rawTopic:t.topic,sequence:Number(t.sequence??o),source:t.source??"gmcp",timestampMs:Number(t.timestampMs??a),topic:n}))}return{flushSnapshots,hasPending:()=>t.size>0||n.size>0,pendingSnapshotTopics:()=>[...Array.from(t.keys()),...n.size>0?["Char.Items.List"]:[]],receive}}function isObject$1(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var wa="nexmap4",Sa=new Set(["gag"]),xa=Object.freeze(["session","pathing-session","script-segment","manual"]);function namespaceTag(e){const t=String(e??"").trim();return t?Sa.has(t)||"nexmap4"===t||t.startsWith("nexmap4.")?t:`${wa}.${t}`:wa}function createTriggersFacade({host:e,recorder:t}={}){if(!e||"object"!=typeof e)throw new Error("createTriggersFacade requires a host object.");const n=t??createNullRecorder(),o=new Map,a=new Map,i=new Map;let s=1;function addTrigger(e){return registerTriggerSpec(e)}function registerTriggerSpec(t){if(!t||"object"!=typeof t)throw new Error("registerTriggerSpec requires a spec object.");const l=namespaceId(t.id??"trigger."+s++),c=t.tag?namespaceTag(t.tag):null,d=normalizeTags(t.tags,c),u=normalizeLifetime(t.lifetime),p={enabled:!1!==t.enabled,id:l,lifetime:u,remove:()=>removeTrigger(l),tag:c,tags:d},m={...t,id:l,tag:c??t.tag??null,tags:d,onRemove(...e){unregisterHandle(l),t.onRemove?.(...e)}};void 0===m.regex&&void 0!==m.pattern&&(m.regex=m.pattern,delete m.pattern),n.recordAdd(m),e.nexAction?.triggers?.add?.(m),o.set(l,p);for(const e of d){let t=a.get(e);t||(t=new Set,a.set(e,t)),t.add(p)}let h=i.get(u);return h||(h=new Set,i.set(u,h)),h.add(p),p}function removeTrigger(t){const a="string"==typeof t?t:t?.id;return!!a&&!!o.get(a)&&(n.recordRemove(a),e.nexAction?.triggers?.remove?.(a),unregisterHandle(a),!0)}function disableTrigger(t){const a="string"==typeof t?t:t?.id;if(!a)return!1;const i=o.get(a);return i&&(i.enabled=!1),n.recordDisable(a),e.nexAction?.triggers?.disable?.(a),!0}function enableTrigger(t){const a="string"==typeof t?t:t?.id;if(!a)return!1;const i=o.get(a);return i&&(i.enabled=!0),n.recordEnable(a),e.nexAction?.triggers?.enable?.(a),!0}function disableByTag(t){const o=namespaceTag(t),i=a.get(o);if(!i||0===i.size)return 0;let s=0;for(const e of i)e.enabled&&(e.enabled=!1,s+=1),n.recordDisable(e.id);return e.nexAction?.triggers?.disable?.([o]),s}function enableByTag(t){const o=namespaceTag(t),i=a.get(o);if(!i||0===i.size)return 0;let s=0;for(const e of i)e.enabled||(e.enabled=!0,s+=1),n.recordEnable(e.id);return e.nexAction?.triggers?.enable?.([o]),s}function removeAllByTag(e){const t=namespaceTag(e),n=a.get(t);if(!n)return 0;let o=0;for(const a of[...n])removeTrigger(a.id)&&(o+=1);return a.delete(t),o}function removeAllByLifetime(e){const t=normalizeLifetime(e),n=i.get(t);if(!n)return 0;let o=0;for(const a of[...n])removeTrigger(a.id)&&(o+=1);return i.delete(t),o}function listTriggers(){return Array.from(o.values()).map(e=>({enabled:e.enabled,id:e.id,lifetime:e.lifetime,tag:e.tag}))}return{addTrigger,disableByTag,disableTrigger,enableByTag,enableTrigger,listTriggers,registerTriggerSpec,removeAllByTag,removeAllByLifetime,removeTrigger};function unregisterHandle(e){const t=o.get(e);if(!t)return!1;o.delete(e);for(const n of t.tags)a.get(n)?.delete(t);return i.get(t.lifetime)?.delete(t),!0}}function namespaceId(e){const t=String(e??"").trim();if(!t)throw new Error("trigger id must be a non-empty string.");return"nexmap4"===t||t.startsWith("nexmap4.")?t:`${wa}.${t}`}function normalizeTags(e,t){const n=new Set;t&&n.add(t);for(const o of Array.isArray(e)?e:[])n.add(namespaceTag(o));return[...n]}function normalizeLifetime(e="session"){const t=String(e??"session").trim();if("persistent"===t)return"session";if(!xa.includes(t))throw new Error(`Unsupported nexMap4 trigger lifetime '${e}'. Expected one of ${xa.join(", ")}.`);return t}function createNullRecorder(){return{recordAdd(){},recordDisable(){},recordEnable(){},recordRemove(){}}}var Ia=Object.freeze([{source:"gmcp",topic:"Room.Info"},{source:"gmcp",topic:"Char.Status"},{source:"gmcp",topic:"Char.Vitals"},{source:"gmcp",topic:"Char.Items.List"},{source:"gmcp",topic:"Char.Items.Add"},{source:"gmcp",topic:"Char.Items.Remove"},{source:"gmcp",topic:"Char.Items.Update"},{source:"gmcp",topic:"Target.Info"},{source:"gmcp",topic:"Target.Set"},{source:"gmcp",topic:"IRE.Target.Info"},{source:"gmcp",topic:"IRE.Target.Set"},{source:"eventStream",topic:"PromptEvent"},{source:"eventStream",topic:"eqBalRecoveredEvent"}]);function createNexusAdapter({host:e=globalThis,settingsStore:t=null}={}){const n=assertHostCapabilities(e),o=createGmcpFacade(),a=createLocationState({gmcp:o}),i=createClientFacade({host:e,settingsStore:t}),s=createEventStreamFacade({host:e}),l=createTriggersFacade({host:e}),c=createIngressNormalizer({emit:o.publish});let d=0;const u=[];function subscribeToHost(){if(!(u.length>0))for(const{source:t,topic:n}of Ia){const listener=o=>{d+=1,c.receive({payload:resolveHostEventPayload(e,n,o),sequence:d,source:t,timestampMs:nowMs(),topic:n}),"Room.Info"===n&&c.flushSnapshots()};e.eventStream.registerEvent(n,listener),u.push({listener,topic:n})}}function unsubscribeFromHost(){for(;u.length>0;){const{listener:t,topic:n}=u.pop();e.eventStream.removeListener?.(n,t)}}function flushPendingSnapshots(){c.flushSnapshots()}return{capabilities:n,client:i,contract:describeAdapterContract(),destroy(){unsubscribeFromHost(),a.destroy(),l.removeAllByLifetime("session"),l.removeAllByLifetime("pathing-session"),l.removeAllByLifetime("script-segment"),l.removeAllByLifetime("manual")},flushPendingSnapshots,eventStream:s,gmcp:o,host:e,location:a,start(){subscribeToHost();for(const t of["Room.Info","Char.Status","Char.Items.List"]){const n=readHostSnapshotPayload(e,t);n&&(d+=1,c.receive({payload:n,sequence:d,source:"gmcp",timestampMs:nowMs(),topic:t}),c.flushSnapshots())}},triggers:l}}function resolveHostEventPayload(e,t,n){const o=readHostSnapshotPayload(e,t);return isObject(n)&&isObject(o)?{...o,...n}:n??o??null}function readHostSnapshotPayload(e,t){const n=e?.GMCP;switch(t){case"Room.Info":return roomInfoSnapshot(n?.Room?.Info,n?.Location);case"Char.Status":return n?.Char?.Status??n?.Status??null;case"Char.Vitals":return n?.Char?.Vitals??n?.Vitals??null;case"Char.Items.List":return n?.Char?.Items?.List??n?.Items?.List??roomItemsSnapshot(n?.Items?.room);case"Char.Items.Add":return n?.Char?.Items?.Add??n?.Items?.Add??null;case"Char.Items.Remove":return n?.Char?.Items?.Remove??n?.Items?.Remove??null;case"Char.Items.Update":return n?.Char?.Items?.Update??n?.Items?.Update??null;case"Target.Info":case"IRE.Target.Info":return n?.Target?.Info??n?.IRE?.Target?.Info??null;case"Target.Set":case"IRE.Target.Set":return n?.Target?.Set??n?.IRE?.Target?.Set??null;default:return null}}function roomItemsSnapshot(e){return Array.isArray(e)?{items:e,location:"room"}:isObject(e)?{items:[e],location:"room"}:null}function roomInfoSnapshot(e,t){if(!isObject(e)){const e=isObject(t)?t.id??null:null;return null!==e?{id:e,num:e}:null}if(isObject(t)&&null!=t.areaid){const n=t.id??t.num??null,o=e.num??e.id??null;if(null!==n&&n===o)return{areaid:t.areaid,...e}}return e}function isObject(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function nowMs(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}var Ca="nexMap4",Ea="https://unpkg.com/nexmap4/dist/nexMap4.nxs",Ra="khaseem",ka=Object.freeze(["nexMap4.userSettings"]),Aa=1e4,Ta=Object.freeze({color:"red",level:"error"}),toLowerName=e=>String(e??"").trim().toLowerCase(),safeCall=e=>{try{return e()}catch{return null}},clonePackageItem=e=>{if(!e||"object"!=typeof e)return null;if("function"==typeof structuredClone)try{return structuredClone(e)}catch{}try{return JSON.parse(JSON.stringify(e))}catch{return e}},getReflexes=e=>safeCall(()=>e?.reflexes?.())??null,getPackageRegistry=e=>{const t=safeCall(()=>e?.packages?.());if("function"==typeof t?.get)return t;const n=safeCall(()=>getReflexes(e)?.packages?.());return"function"==typeof n?.get?n:null},getInstalledPackage=(e,t)=>safeCall(()=>getPackageRegistry(e)?.get(t))??null,findGroupByName=(e,t)=>{if(!Array.isArray(e))return null;const n=toLowerName(t);return e.find(e=>toLowerName(e?.name)===n)??null},capturePreservedGroups=(e,t)=>t.map(t=>{const n=findGroupByName(e?.items,t);return n?{name:t,data:clonePackageItem(n)}:null}).filter(Boolean),applyPreservedGroup=(e,t,n)=>{const o=findGroupByName(e?.items,t.name);o&&t.data&&("function"!=typeof o.apply?"object"==typeof o&&Object.assign(o,clonePackageItem(t.data)):o.apply(t.data,n))},enableShippedGroups=(e,t)=>{if(!Array.isArray(e?.items))return;const n=new Set(t.map(toLowerName));e.items.filter(e=>"group"===e?.type&&!n.has(toLowerName(e.name))).forEach(e=>{e.enabled=!0})},reportUpdateError=({adapter:e,consoleObj:t,message:n,nexusClient:o})=>{t.error(n),"function"!=typeof e?.client?.notice?o?.display_notice?.(String(n),Ta.color):e.client.notice(n,Ta)},createAbortSignal=({AbortControllerCtor:e,setTimeoutFn:t,timeoutMs:n})=>{if(!e||n<=0)return{signal:void 0,timeout:null};const o=new e,a=t(()=>o.abort(),n);return{signal:o.signal,timeout:a}},updateNxs=async({adapter:e=null,clearTimeoutFn:t=clearTimeout,consoleObj:n=console,fetchFn:o=globalThis.fetch,nexusClient:a=globalThis.nexusclient,packageName:i=Ca,preservedGroupNames:s=ka,setTimeoutFn:l=setTimeout,skipCharacterName:c=Ra,timeoutMs:d=Aa,url:u=Ea}={})=>{if(c&&toLowerName(a?.charname)===toLowerName(c))return null;let p=null;try{if("function"!=typeof o)throw new Error("fetch is not available.");const e=getInstalledPackage(a,i);if(!e||"function"!=typeof e.apply)throw new Error(`${i} package is not installed in Nexus.`);const t=capturePreservedGroups(e,s),{signal:n,timeout:c}=createAbortSignal({AbortControllerCtor:globalThis.AbortController,setTimeoutFn:l,timeoutMs:d});p=c;const m=await o(u,{cache:"no-store",...n?{signal:n}:{}});if(!m?.ok)throw new Error(`${i} update failed: ${m?.status??"unknown"} ${m?.statusText??""}`.trim());const h=await m.json(),g=getReflexes(a);e.apply(h,g);const y=getInstalledPackage(a,i)??e;return t.forEach(e=>applyPreservedGroup(y,e,g)),enableShippedGroups(y,s),h}catch(m){return reportUpdateError({adapter:e,consoleObj:n,message:"AbortError"===m?.name?`${i} update timed out. Check your connection.`:`${i} update error: ${m?.message??String(m)}`,nexusClient:a}),null}finally{null!==p&&t(p)}},Ma=Object.freeze({d:"d",down:"d",e:"e",east:"e",in:"in",n:"n",ne:"ne",north:"n",northeast:"ne",nw:"nw",northwest:"nw",out:"out",s:"s",se:"se",south:"s",southeast:"se",southeastst:"se",sw:"sw",southwest:"sw",u:"u",up:"u",w:"w",west:"w"}),za=(Object.freeze({d:"down",e:"east",in:"in",n:"north",ne:"northeast",nw:"northwest",out:"out",s:"south",se:"southeast",sw:"southwest",up:"up",w:"west"}),Object.freeze(new Set(["n","north","ne","northeast","e","east","se","southeast","s","south","sw","southwest","w","west","nw","northwest","out","in","up","u","down","d"])));function toShortDirection(e){return e?Ma[String(e).trim().toLowerCase()]??e:""}function isStandardExitCommand(e){const t=String(e??"").trim().toLowerCase();return za.has(t)}var $a=new Set(Qr),Na=["Jester","Occultist"];function readSettings(e){return e.settingsStore.get()}function createRuntimeContext(e,t,n,o={}){const a=e.graph?.getNode?.(n)??null,i=readHostFacts(e,a),s=settingsToRuntimeContext(t),l=!0===s.hasVibratingStick||!0===i.hasVibratingStick,c={...s,characterClass:i.characterClass,characterName:i.characterName,currentContinent:a?.continent??i.currentContinent,currentCrowdmapAreaId:a?.areaId??i.currentCrowdmapAreaId,currentGmcpAreaId:i.currentGmcpAreaId,currentRoomId:n,hasVibratingStick:l,hostFacts:i,mountState:i.mountState,travelRegistry:e.travelRegistry,...o??{}};return{...c,disabledTravelClasses:classGatedDisabledTravelClasses(c)}}function classGatedDisabledTravelClasses(e){const t=new Set(e.disabledTravelClasses);return characterClassEndsWith(e,"Dragon")||t.add("gare"),characterClassIn(e,Na)||t.add("universe"),isUrnTravelAvailable(e)||t.add("urn"),t}function updateSessionTravelTopology(e,t){if(e.runtimeGraphController)return void e.runtimeGraphController.updateSessionTravelTopology(t);const n=e.travelTopologyController;n&&"function"==typeof n.updateSessionActiveEdges&&n.updateSessionActiveEdges({graph:e.graph,runtimeContext:t})}function assertGraphNode(e,t,n){const o=e.getNode(t);if(!o)throw new Error(`Unknown ${n} '${t}'.`);return o}function currentHostRoomId(e){return extractCurrentRoomIdFromEvent(getLatestCurrentRoomEvent(e.adapter?.gmcp))??readHostRoomId$1(e.adapter?.host)}function readHostRoomId$1(e){const t=e?.GMCP?.Location??e?.GMCP?.Room?.Info??null,n=t?.id??t?.num??t?.roomId??t?.roomID??null;if(null==n)return null;if("number"==typeof n)return Number.isFinite(n)?n:null;const o=String(n).trim();return 0===o.length?null:/^-?\d+$/.test(o)?Number(o):o}function readHostFacts(e,t=null){const n=e.adapter?.gmcp,o=n?.getLastEvent?.(na.GMCP_CHAR_STATUS)?.payload??{},a=getLatestCurrentRoomEvent(n)?.payload??{},i=e.adapter?.host??{},s=readMountFact(i,o),l=readVibratingStickFact(i,o),c=nonEmptyString$3(o.name??o.fullname);return{characterClass:nonEmptyString$3(o.class??o.className),characterName:c,currentContinent:t?.continent??nonEmptyString$3(a.continent),currentCrowdmapAreaId:t?.areaId??normalizeOptionalInteger$1(a.areaId),currentGmcpAreaId:a.areaid??null,hasVibratingStick:l,isMounted:s.isMounted,mountName:s.mountName,mountState:s.isMounted?"mounted":"unmounted",mounted:s.isMounted,urnMountName:s.mountName}}function readVibratingStickFact(e,t){return!0===t.hasVibratingStick||!0===t.vibratingStick||!0===t.wormholeAccess||!0===t.artifacts?.vibratingStick||!0===t.artefacts?.vibratingStick||!!(collectionMentionsVibratingStick(t.artifacts)||collectionMentionsVibratingStick(t.artefacts)||collectionMentionsVibratingStick(t.inventory))}function collectionMentionsVibratingStick(e){return"string"==typeof e?/vibrating stick/i.test(e):(Array.isArray(e)?e:Object.values(e??{})).some(e=>"string"==typeof e?/vibrating stick/i.test(e):!(!e||"object"!=typeof e)&&/vibrating stick/i.test(String(e.name??e.item??e.id??"")))}function readMountFact(e,t){const n=e?.nexSys?.defs?.mounted?.mount?.name??e?.nexSys?.api?.state?.defs?.mounted?.mount?.name??null,o=nonEmptyString$3(t.mountName??t.mount?.name??t.mounted?.name??t.mount??null)??nonEmptyString$3(n),a="function"==typeof e?.nexSys?.haveDef?!0===e.nexSys.haveDef("mounted"):null,i=!0===t.isMounted||!0===t.mounted||"mounted"===String(t.mountState??"").toLowerCase();return{isMounted:!0===a||i||Boolean(o),mountName:o}}function findLandmark(e,t){const n=nonEmptyString$3(t.id),o=nonEmptyString$3(t.name),a=o?fold(o):null;return e.landmarks.find(e=>n&&e.id===n||a&&fold(e.name)===a)??null}function createLandmarkId(e){return`landmark:${fold(e).replaceAll(/[^a-z0-9]+/g,"-").replaceAll(/^-|-$/g,"")||"room"}`}function defaultAreaZ(e,t){return e.areaZLevels(t)[0]??0}function limitResults(e,t){if(null==t)return[...e];const n=normalizeInteger(t,"limit");if(n<0)throw new Error("limit must be zero or greater.");return[...e].slice(0,n)}function normalizeTrackingType(e){const t=String(e??"target").trim();if(!["target","doppleganger","pet"].includes(t))throw new Error(`Unknown tracking subject type '${t}'.`);return t}function defaultTrackingName(e){switch(e){case"doppleganger":return"Doppleganger";case"pet":return"Pet";default:return"Target"}}function resolveRoomByName$1(e,t,n={}){const o=e.searchIndexes;if(!o||"function"!=typeof o.findRoomsExact)return null;const a=buildLookupScope(n),i=currentHostRoomId(e),s=null===i?null:e.graph.getNode(i),l=n.areaId??s?.areaId??null,c=n.z??s?.coordinates?.z??null,d=pickPreferredHit(o.findRoomsExact(t,a),l,c);if(d)return e.graph.getNode(d.id);const u=pickPreferredHit(o.findRooms(t,a),l,c);return u?e.graph.getNode(u.id):null}function buildLookupScope(e){return!0===e.gameAreaMissing?{gameAreaMissing:!0}:e.gameArea?{gameArea:e.gameArea}:void 0!==e.localAreaId&&null!==e.localAreaId?{areaId:e.localAreaId}:void 0}function pickPreferredHit(e,t,n){return 0===e.length?null:e.find(e=>null!==t&&e.areaId===t&&(null===n||e.z===n))??e.find(e=>null!==t&&e.areaId===t)??e[0]}function setRoomOverlay(e,t,n,o){e.renderer?.setOverlay(t,{classNames:o.classNames,color:o.color,label:o.label,priority:o.priority,roomIds:[n.id]}),e.renderer?.setVisibleSlice({areaId:n.areaId,z:n.coordinates?.z??0}),e.renderer?.center(n.id)}function announcePathToRoom(e,t){const n=currentHostRoomId(e);if(null===n)return null;const o=createRuntimeContext(e,readSettings(e),n);updateSessionTravelTopology(e,o);const a=e.graph.shortestPath(n,t,o);return a?(e.adapter?.client.notice(`Route to ${t}: ${a.commands.map(toShortDirection).join(", ")}`),a):(e.adapter?.client.notice(`No route to room ${t}.`,{color:"orange",level:"warning"}),null)}function playerColor(e,t,n){const o=e.adapter?.host?.nexGui?.colors?.playerColor?.(t);return"string"==typeof o&&o.length>0?o:n}function roomInfoHtml({area:e,current:t,exits:n,room:o}){const a=n.length?n.map(e=>`${escapeHtml(e.command)} -> ${escapeHtml(e.targetId)}`).join("<br>"):"None";return`<div class="nexmap4-room-info"><strong>${escapeHtml(o.name)}</strong> (${escapeHtml(o.id)})<br>Area: ${escapeHtml(e?.name??"")} (${escapeHtml(o.areaId)})<br>Z: ${escapeHtml(o.coordinates?.z??0)}${t?"<br>Current room":""}<br>Exits:<br>${a}</div>`}function roomDiagnosticHtml({area:e,location:t,node:n,roomId:o,roomInfo:a}){const row=(e,t)=>{const n=null==t?"(none)":String(t);return` ${e.padEnd(14)}: ${escapeHtml(n)}`},sep=e=>`<span style="color:#888">── ${escapeHtml(e)} ${"─".repeat(Math.max(0,48-e.length))}</span>`,i=Array.isArray(a?.details)?a.details.join(", "):a?.details,s=n?escapeHtml(JSON.stringify(n)):`(room ${null!==o?escapeHtml(String(o)):"unknown"} not found in graph)`;return`<div style="font-family:monospace;white-space:pre-wrap">${[sep("GMCP.Location"),row("Name",t?.roomname??t?.name),row("ID",t?.id),row("Game Area",t?.area),row("Game Area ID",t?.areaid),sep("GMCP.Room.Info"),row("Environment",a?.environment),row("Coords",a?.coords),row("Details",i),sep("CrowdMap"),row("Area ID",n?.areaId),row("Area Name",e?.name),sep("CrowdMap Room Node"),` ${s}`].join("\n")}</div>`}function normalizeFullsenseEntries(e){return(Array.isArray(e.entries)?e.entries:[]).map(e=>"string"==typeof e?parseFullsenseTextEntry(e):e&&"object"==typeof e?{areaId:normalizeOptionalInteger$1(e.areaId),color:nonEmptyString$3(e.color),areaName:nonEmptyString$3(e.areaName),targetName:nonEmptyString$3(e.targetName)??"",roomName:nonEmptyString$3(e.roomName),z:normalizeOptionalInteger$1(e.z)}:null).filter(e=>e?.roomName)}function parseFullsenseTextEntry(e){const t=String(e??"").trim(),n=t.match(/^(.+?)(?:\s*@\s*|\s*=\s*|\s+in\s+)(.+)$/i);return n?{targetName:n[1].trim(),roomName:n[2].trim()}:{targetName:t,roomName:null}}function normalizeNodeId(e,t){if("number"==typeof e&&Number.isInteger(e))return e;if("string"==typeof e){const t=e.trim();if(/^-?\d+$/.test(t))return Number(t);if(t.length>0)return t}throw new Error(`${t} must be a room id or synthetic node id.`)}function normalizeInteger(e,t){if("number"==typeof e&&Number.isInteger(e))return e;if("string"==typeof e&&/^-?\d+$/.test(e.trim()))return Number(e.trim());throw new Error(`${t} must be an integer.`)}function normalizeOptionalInteger$1(e){if(null==e||""===e)return null;if("number"==typeof e&&Number.isInteger(e))return e;const t=String(e).trim();return/^-?\d+$/.test(t)?Number(t):null}function requireName(e,t){const n=nonEmptyString$3(e);if(!n)throw new Error(`${t} must be a non-empty string.`);return n}function nonEmptyString$3(e){if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}function fold(e){return String(e).trim().toLowerCase()}function escapeHtml(e){return String(e??"").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function normalizeTravelClassInput(e){return(Array.isArray(e)?e:[e]).map(e=>{const t=String(e??"").trim();if(!$a.has(t))throw new Error(`Unknown travel class '${t}'.`);return t})}function normalizePositiveFloat(e,t){const n="number"==typeof e?e:Number(e);if(!Number.isFinite(n)||n<=0)throw new Error(`${t} must be a positive number.`);return n}function addLandmark(e,t){const n=t.graph,o=t.settingsStore,a=requireName(e.name,"name"),i=assertGraphNode(n,normalizeNodeId(e.roomId??currentHostRoomId(t),"roomId"),"roomId"),s=n.getArea(i.areaId),l=Object.freeze({areaName:s?.name??"",continent:s?.continent??i.continent??"",id:e.id?requireName(e.id,"id"):createLandmarkId(a),name:a,roomId:i.id}),c=updateSettings(e=>{const t=fold(a),n=e.landmarks.filter(e=>e.id!==l.id&&fold(e.name)!==t);return{...e,landmarks:[...n,l]}},o);return t.adapter?.client?.notice?.(`Marked '${l.name}' at room ${l.roomId}.`,{level:"info"}),{landmark:l,landmarks:c.landmarks}}function listLandmarks(e,t){return t.uiStore?.setState({shellOpen:!0}),{landmarks:[...readSettings(t).landmarks]}}function removeLandmark(e,t){const n=t.settingsStore,o=readSettings(t),a=nonEmptyString$3(e.id),i=nonEmptyString$3(e.name);if(!a&&!i)throw new Error("landmark.remove requires an id or name.");const s=i?fold(i):null,l=o.landmarks.filter(e=>a&&e.id===a||s&&fold(e.name)===s);return 0===l.length?{landmarks:o.landmarks,removed:[]}:{landmarks:updateSettings(e=>({...e,landmarks:e.landmarks.filter(e=>!l.includes(e))}),n).landmarks,removed:l}}function systemHelp(e,t){return openShell({tab:"help"},t)}function systemNotice(e,t){const n=t.adapter,o=requireName(e.message,"message");return n.client.notice(o,{color:e.color??null,level:e.level??"info"})}function openSettings(e,t){return t.uiStore?.setState({settingsOpen:!0}),{opened:!0}}function closeSettings(e,t){return t.uiStore?.setState({settingsOpen:!1}),{closed:!0}}function showResults(e,t){return t.uiStore?.setState({resultsColumns:Array.isArray(e.columns)?e.columns:[],resultsDefaultAction:"function"==typeof e.defaultAction?e.defaultAction:null,resultsInitialState:e.initialState&&"object"==typeof e.initialState?e.initialState:{},resultsOpen:!0,resultsRows:Array.isArray(e.rows)?e.rows:[],resultsTitle:nonEmptyString$3(e.title)??"Results"}),{opened:!0}}function closeResults(e,t){return t.uiStore?.setState({resultsOpen:!1}),{closed:!0}}function openShell(e,t){const n=e?.tab,o={shellOpen:!0};return n&&(o.shellTab=n),t.uiStore?.setState(o),{opened:!0,tab:n}}function closeShell(e,t){return t.uiStore?.setState({shellOpen:!1}),{closed:!0}}var Pa=Object.freeze(["target","doppleganger","pet"]);function createInitialTrackingState(){return{lastTarget:null,subjects:new Map,viewSnapshot:null}}function createTrackingStore(e=createInitialTrackingState()){const t=createStore(()=>({lastTarget:cloneRecord(e.lastTarget),subjects:new Map(e.subjects),viewSnapshot:cloneRecord(e.viewSnapshot)}));return t.patch=function(e){return t.setState(e),t.getState()},t.reset=function(){return t.setState(createInitialTrackingState(),!0),t.getState()},t.get=t.getState,t.set=function(e){t.setState(e,!0)},t.trackSubject=function(e,n,o,a={}){const i=normalizeSubjectType$1(e),s=normalizeSubject(i,n,o,a),l=new Map(t.getState().subjects);return l.set(i,s),t.setState({subjects:l}),s},t.untrackSubject=function(e){const n=normalizeSubjectType$1(e),o=new Map(t.getState().subjects);return o.delete(n)&&t.setState({subjects:o}),o},t.clearTracking=function(){t.setState({subjects:new Map})},t.setViewSnapshot=function(e){return t.setState({viewSnapshot:cloneRecord(e)}),t.getState().viewSnapshot},t.clearViewSnapshot=function(){t.setState({viewSnapshot:null})},t.setLastTarget=function(e){const n=cloneRecord(e);return t.setState({lastTarget:n}),n},t}function normalizeSubjectType$1(e){const t=String(e??"target").trim();if(!Pa.includes(t))throw new Error(`Unknown tracking subject type '${t}'.`);return t}function normalizeSubject(e,t,n,o){if(t&&"object"==typeof t&&!Array.isArray(t)){const o=normalizeRoomId$5(t.roomId??t.id);return{areaId:normalizeOptionalInteger(t.areaId),id:t.subjectId??t.targetId??null,name:normalizeName(t.name??n??e),roomId:o,timestamp:Number(t.timestamp??Date.now()),viewSnapshot:cloneRecord(t.viewSnapshot)}}return{areaId:normalizeOptionalInteger(o.areaId),id:o.subjectId??o.targetId??null,name:normalizeName(n??e),roomId:normalizeRoomId$5(t),timestamp:Number(o.timestamp??Date.now()),viewSnapshot:cloneRecord(o.viewSnapshot)}}function normalizeRoomId$5(e){if("number"==typeof e&&Number.isInteger(e))return e;const t=String(e??"").trim();if(/^-?\d+$/.test(t))return Number(t);if(t.length>0)return t;throw new Error("tracking subject roomId must be a room id.")}function normalizeOptionalInteger(e){if(null==e||""===e)return null;if("number"==typeof e&&Number.isInteger(e))return e;const t=String(e).trim();return/^-?\d+$/.test(t)?Number(t):null}function normalizeName(e){const t=String(e??"").trim();return t.length>0?t:"subject"}function cloneRecord(e){return e&&"object"==typeof e?JSON.parse(JSON.stringify(e)):null}var Oa=Object.freeze({doppleganger:Object.freeze({className:"nexmap4-overlay-tracking-doppleganger",color:"#9b59b6",label:"Doppleganger"}),pet:Object.freeze({className:"nexmap4-overlay-tracking-pet",color:"#2ecc71",label:"Pet"}),target:Object.freeze({className:"nexmap4-overlay-tracking-target",color:"#e74c3c",label:"Target"})}),_a=new Set(Pa);function createTrackingController({adapter:e=null,graph:t=null,renderer:n=null,store:o}={}){return new ja({adapter:e,graph:t,renderer:n,store:o})}var ja=class{#r;#n;#o;#a;#i=null;#s=null;#l=null;#c=new Map;constructor({adapter:e=null,graph:t=null,renderer:n=null,store:o}={}){if(!o||"function"!=typeof o.subscribe)throw new Error("TrackingController requires a tracking store.");this.#r=e,this.#n=t,this.#o=n,this.#a=o}start(){return this.#i||(this.#c=new Map(this.#a.getState().subjects),this.#d(this.#a.getState().subjects),this.#i=this.#a.subscribe(e=>{this.#u(e.subjects)}),this.#p()),this}stop(){return this.#i?.(),this.#s?.(),this.#l?.(),this.#i=null,this.#s=null,this.#l=null,this}dispose(){this.stop()}trackSubject(e,t={}){const n=normalizeSubjectType(e??t.type),o=normalizeRoomId$4(t.roomId??t.id,"roomId"),a=this.#n?.getNode?.(o)??null;if(this.#n&&!a)throw new Error(`Unknown tracking room '${o}'.`);const i=this.#m();0===this.#a.getState().subjects.size&&i&&this.#a.setViewSnapshot(i);const s=this.#a.trackSubject(n,{areaId:a?.areaId??t.areaId??null,id:t.subjectId??t.targetId??null,name:t.name??defaultSubjectLabel(n),roomId:o,timestamp:t.timestamp??Date.now(),viewSnapshot:i});return!1!==t.centerView&&this.#h(s),subjectSnapshot(n,s)}clearSubject(e){const t=normalizeSubjectType(e),n=this.#a.getState().subjects.get(t)??null;return this.#a.untrackSubject(t),n?subjectSnapshot(t,n):null}clearAll({restoreView:e=!0}={}){const t=this.listSubjects(),n=this.#a.getState().viewSnapshot;return this.#a.clearTracking(),e&&n&&this.#g(n),this.#a.clearViewSnapshot(),t}listSubjects(){return subjectsToArray(this.#a.getState().subjects)}setRenderer(e){this.#o=e,this.#d(this.#a.getState().subjects)}setGraph(e){this.#n=e}#p(){const e=this.#r?.gmcp;e&&"function"==typeof e.subscribe&&(this.#s=e.subscribe(na.GMCP_TARGET_INFO,e=>{this.#f(e)}),this.#l=e.subscribe(na.GMCP_TARGET_SET,e=>{this.#f(e)}))}#f(e){const t=normalizeTargetPayload(e?.payload);if(!t)return;this.#a.setLastTarget(t);const n=this.#a.getState().subjects.get("target");(n||null!==t.roomId)&&this.trackSubject("target",{centerView:!1,name:t.name??n?.name??"Target",roomId:t.roomId??n?.roomId,subjectId:t.id??n?.id??null})}#u(e){if(this.#o){for(const[t]of this.#c)e.has(t)||this.#o.clearOverlay?.(overlayKey(t));for(const[t,n]of e){const e=this.#c.get(t);e&&e.roomId===n.roomId&&e.name===n.name&&e.timestamp===n.timestamp||this.#o.setOverlay?.(overlayKey(t),overlayForSubject(t,n))}this.#c=new Map(e)}else this.#c=new Map(e)}#d(e){if(this.#o){for(const e of _a)this.#o.clearOverlay?.(overlayKey(e));for(const[t,n]of e)this.#o.setOverlay?.(overlayKey(t),overlayForSubject(t,n))}}#h(e){if(!this.#o)return;const t=this.#n?.getNode?.(e.roomId)??null;t&&this.#o.setVisibleSlice?.({areaId:t.areaId,z:t.coordinates?.z??0}),this.#o.center?.(e.roomId)}#m(){const e=this.#o?.getViewport?.();return e?{areaId:e.areaId,center:e.center?{...e.center}:null,viewBox:e.viewBox?{...e.viewBox}:null,z:e.z,zoom:e.zoom}:null}#g(e){this.#o&&e&&(null!==e.areaId&&null!==e.z&&this.#o.setVisibleSlice?.({areaId:e.areaId,z:e.z}),Number.isFinite(e.zoom)&&e.zoom>0&&this.#o.setZoom?.(e.zoom),e.center&&this.#o.center?.(e.center))}};function overlayForSubject(e,t){const n=Oa[e]??Oa.target;return{classNames:[n.className],color:n.color,label:t.name??n.label,priority:40,roomIds:[t.roomId]}}function overlayKey(e){return`tracking-${normalizeSubjectType(e)}`}function subjectSnapshot(e,t){return{areaId:t.areaId??null,id:t.id??null,name:t.name,roomId:t.roomId,timestamp:t.timestamp,type:e,viewSnapshot:t.viewSnapshot??null}}function subjectsToArray(e){return[...e.entries()].map(([e,t])=>subjectSnapshot(e,t))}function normalizeSubjectType(e){const t=String(e??"target").trim();if(!_a.has(t))throw new Error(`Unknown tracking subject type '${t}'.`);return t}function normalizeRoomId$4(e,t){if("number"==typeof e&&Number.isInteger(e))return e;const n=String(e??"").trim();if(/^-?\d+$/.test(n))return Number(n);if(n.length>0)return n;throw new Error(`${t} must be a room id.`)}function defaultSubjectLabel(e){return Oa[e]?.label??"Subject"}function normalizeTargetPayload(e){if(!e||"object"!=typeof e)return null;const t=e.id??e.ID??e.target??e.Target??null,n=nonEmptyString$2(e.name??e.Name??e.text??e.Text),o=normalizeOptionalRoomId(e.roomId??e.roomID??e.room??e.location??e.roomnum);return null!==t||n||null!==o?{id:t,name:n,roomId:o}:null}function normalizeOptionalRoomId(e){if(null==e||""===e||"room"===e)return null;if("number"==typeof e&&Number.isInteger(e))return e;const t=String(e).trim();return/^-?\d+$/.test(t)?Number(t):null}function nonEmptyString$2(e){if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}function trackSubject(e,t){const n=normalizeTrackingType(e.type??e.subject??"target"),o=normalizeNodeId(e.roomId??e.id,"roomId"),a=assertGraphNode(t.graph,o,"roomId"),i=nonEmptyString$3(e.name)??defaultTrackingName(n),s=e.subjectId??e.targetId??null,l=t.trackingController;if(l&&"function"==typeof l.trackSubject){const a=l.trackSubject(n,{centerView:e.centerView,name:i,roomId:o,subjectId:s});return t.adapter?.client?.notice?.(`Tracking ${n} '${i}' at room ${o}.`,{color:"blue",level:"info"}),a}const c=t.trackingStore?.trackSubject?.(n,{areaId:a.areaId,id:s,name:i,roomId:o,timestamp:Date.now(),viewSnapshot:t.renderer?.getViewport?.()??null});return t.renderer&&(t.renderer.setOverlay?.(overlayKey(n),overlayForSubject(n,c)),!1!==e.centerView&&(t.renderer.setVisibleSlice?.({areaId:a.areaId,z:a.coordinates?.z??0}),t.renderer.center?.(o))),subjectSnapshot(n,c)}function clearTracking(e,t){const n=nonEmptyString$3(e.type??e.subject),o=t.trackingController;if(o&&"function"==typeof o.clearAll)return n?{cleared:o.clearSubject(n)}:{cleared:o.clearAll()};if(n){const e=normalizeTrackingType(n),o=t.trackingStore?.getState?.().subjects.get(e)??null;return t.trackingStore?.untrackSubject?.(e),t.renderer?.clearOverlay?.(overlayKey(e)),{cleared:o?subjectSnapshot(e,o):null}}const a=subjectsToArray(t.trackingStore?.getState?.().subjects??new Map);t.trackingStore?.clearTracking?.();for(const i of["target","doppleganger","pet"])t.renderer?.clearOverlay?.(overlayKey(i));return{cleared:a}}function listTracking(e,t){return{subjects:t.trackingController?.listSubjects?.()??subjectsToArray(t.trackingStore?.getState?.().subjects??new Map)}}var Fa="path stop";function isPathStopCommand(e){return/^path\s+stop\b/i.test(String(e??"").trim())}function isPathTrackCommand(e){return/^path\s+track\b/i.test(String(e??"").trim())}var La=Object.freeze(["hybridTrack","clientStep"]);function planPath(e,t={}){if(null===e)return null;assertPath(e);const n=normalizeExecutionMode(t.executionMode),o=normalizeMaxPathTrackHops(t.maxPathTrackHops),a=t.pathTrackCommandPrefix??"path track",i=createExecutableSteps(e.steps),s=applySegmentExecutionPolicy("clientStep"===n?planClientStep(i):planHybridTrack(i,{maxPathTrackHops:o,pathTrackCommandPrefix:a}),n),l=s.flatMap(e=>e.commands),c=segmentsToRoomPath(s,e.roomIds);return deepFreeze$5({commands:l,executionMode:n,rawCommands:[...e.commands],rawEdgeIds:[...e.edgeIds],rawRoomPath:[...e.roomIds],roomPath:c,segments:s,sourceId:e.sourceId,targetId:e.targetId,totalWeight:e.totalWeight})}function planClientStep(e){return e.map(e=>createSingleStepSegment(e))}function planHybridTrack(e,{maxPathTrackHops:t,pathTrackCommandPrefix:n}){const o=[];let a=[];for(const i of e)isStandardWalkStep(i)?(a.push(i),a.length===t&&(o.push(createPathTrackSegment(a,n)),a=[])):(a.length>0&&(o.push(createPathTrackSegment(a,n)),a=[]),o.push(createSingleStepSegment(i)));return a.length>0&&o.push(createPathTrackSegment(a,n)),o}function applySegmentExecutionPolicy(e,t){return"hybridTrack"!==t?e:e.map(e=>"direct-command"!==e.kind||e.commands.some(isPathStopCommand)?e:{...e,commands:[Fa,...e.commands]})}function createPathTrackSegment(e,t){return{commands:[`${t} ${stepEndpoint(e[e.length-1])}`],edgeIds:e.flatMap(edgeIdsForStep),hopCount:e.length,kind:"path-track",roomIds:stepsToRoomIds(e),stepCommands:e.map(e=>e.command),travelClasses:["standard"]}}function createSingleStepSegment(e){const t=plannedCommandsForStep(e),n=scriptIdForStep(e),o={commands:t,edgeIds:edgeIdsForStep(e),hopCount:1,kind:n?"script":"direct-command",roomIds:roomIdsForStep(e),stepCommands:[e.command],travelClasses:travelClassesForStep(e)};return n&&(o.scriptId=n),void 0!==e.metadata&&(o.metadata=e.metadata),o}function plannedCommandsForStep(e){if(isNonEmptyStringArray$1(e.commands))return[...e.commands];const t=e.metadata??{},n=t.plannedCommands??t.commandsSent;return isNonEmptyStringArray$1(n)?[...n]:[e.command]}function scriptIdForStep(e){return"string"==typeof e.scriptId&&e.scriptId.length>0?e.scriptId:"string"==typeof e.metadata?.scriptId&&e.metadata.scriptId.length>0?e.metadata.scriptId:"scripted"===e.kind?e.command.startsWith("#")?e.command.slice(1):e.edgeId:e.command.startsWith("#")?e.command.slice(1):isNonEmptyStringArray$1(e.metadata?.plannedCommands)||isNonEmptyStringArray$1(e.metadata?.commandsSent)?e.edgeId:null}function stepsToRoomIds(e){const t=[e[0].from];for(const n of e)t.push(stepEndpoint(n));return t}function isStandardWalkStep(e){const t=travelClassesForStep(e);return 1===t.length&&"standard"===t[0]&&(void 0===e.kind||"standard"===e.kind)&&!scriptIdForStep(e)&&plannedCommandsForStep(e).every(isStandardExitCommand)}function travelClassesForStep(e){return Array.isArray(e.travelClasses)&&e.travelClasses.length>0?[...e.travelClasses]:["standard"]}function createExecutableSteps(e){const t=[];for(let n=0;n<e.length;n+=1){const o=e[n],a=e[n+1];isCollapsibleTravelIngress(o,a)?(t.push(collapseTravelIngress(o,a)),n+=1):t.push(o)}return t}function isCollapsibleTravelIngress(e,t){if(!e||!t)return!1;if("travelIngress"!==edgeRole$1(e)||"travelEgress"!==edgeRole$1(t))return!1;if(!sameNodeId(e.to,t.from))return!1;if(!isHiddenSyntheticTravelNodeId(e.to))return!1;const n=travelClassesForStep(e),o=travelClassesForStep(t);return 1===n.length&&1===o.length&&n[0]===o[0]}function collapseTravelIngress(e,t){const n={...t.metadata??{},collapsedIngressEdgeId:e.edgeId};return void 0!==e.metadata&&(n.collapsedIngressMetadata=e.metadata),{...t,edgeIds:[...edgeIdsForStep(e),...edgeIdsForStep(t)],from:e.from,metadata:n,roomIds:[e.from,t.to],weight:Number(e.weight??0)+Number(t.weight??0)}}function edgeRole$1(e){return e?.role??e?.metadata?.role??null}function edgeIdsForStep(e){return Array.isArray(e.edgeIds)&&e.edgeIds.length>0?[...e.edgeIds]:[e.edgeId]}function roomIdsForStep(e){return Array.isArray(e.roomIds)&&e.roomIds.length>=2?[...e.roomIds]:[e.from,e.to]}function stepEndpoint(e){const t=roomIdsForStep(e);return t[t.length-1]}function sameNodeId(e,t){return String(e)===String(t)}function isHiddenSyntheticTravelNodeId(e){return"string"==typeof e&&e.startsWith("travel-")}function segmentsToRoomPath(e,t){if(0===e.length)return[...t];const n=[];for(const o of e){const e=Array.isArray(o.roomIds)?o.roomIds:[];0!==e.length&&(0!==n.length?n.push(...e.slice(1)):n.push(...e))}return n.length>0?n:[...t]}function normalizeExecutionMode(e="hybridTrack"){if(!La.includes(e))throw new Error(`Unsupported path execution mode '${e}'. Expected one of ${La.join(", ")}.`);return e}function normalizeMaxPathTrackHops(e=90){if(!Number.isInteger(e)||e<1)throw new Error("maxPathTrackHops must be a positive integer.");return e}function assertPath(e){if(!e||!Array.isArray(e.roomIds)||!Array.isArray(e.steps))throw new Error("planPath requires a raw Path with roomIds and steps.");if(e.roomIds.length!==e.steps.length+1)throw new Error("Path roomIds must contain exactly one more entry than steps.");for(const[t,n]of e.steps.entries())if(e.roomIds[t]!==n.from||e.roomIds[t+1]!==n.to)throw new Error(`Path step ${t} does not match the raw room path.`)}function isNonEmptyStringArray$1(e){return Array.isArray(e)&&e.length>0&&e.every(e=>"string"==typeof e)}function deepFreeze$5(e){if(!e||"object"!=typeof e)return e;Object.freeze(e);for(const t of Object.values(e))deepFreeze$5(t);return e}function travelToRoom(e,t){const n=t.graph,o=normalizeNodeId(e.roomId??e.targetRoomId,"roomId"),a=normalizeNodeId(e.sourceRoomId??e.fromRoomId??currentHostRoomId(t),"sourceRoomId");assertGraphNode(n,a,"sourceRoomId"),assertGraphNode(n,o,"roomId");const i=readSettings(t),s=createRuntimeContext(t,i,a,e.runtimeContext);updateSessionTravelTopology(t,s);const l=n.shortestPath(a,o,s);if(!l)return e.silent||t.adapter?.client?.notice?.(`No nexMap4 route from ${a} to ${o}.`,{level:"warning",color:"orange"}),{path:null,plan:null,reason:"path-not-found",sourceRoomId:a,started:!1,targetRoomId:o};const c=planPath(l,{executionMode:e.executionMode??i.pathingMode,maxPathTrackHops:e.maxPathTrackHops,pathTrackCommandPrefix:e.pathTrackCommandPrefix}),d=!1!==e.start;return d&&(t.stepper.start(c),t.renderer?.setSelection({edgeId:null,roomId:o})),{path:l,plan:c,sourceRoomId:a,started:d,targetRoomId:o}}function travelToLandmark(e,t){const n=findLandmark(readSettings(t),e);if(!n)throw new Error(`Unknown nexMap4 landmark '${e.name??e.id??""}'.`);return travelToRoom({...e,roomId:n.roomId},t)}function travelToArea(e,t){const n=t.graph,o=normalizeInteger(e.areaId,"areaId"),a=n.getArea(o);if(!a)throw new Error(`Unknown areaId '${o}'.`);const i=n.areaRoomIds(o);if(0===i.length)throw new Error(`Area '${a.name}' has no rooms.`);const s=normalizeNodeId(e.sourceRoomId??e.fromRoomId??currentHostRoomId(t),"sourceRoomId");assertGraphNode(n,s,"sourceRoomId");const l=readSettings(t),c=createRuntimeContext(t,l,s,e.runtimeContext);updateSessionTravelTopology(t,c);const d=n.findPathToAny(s,i,c);if(!d)return t.adapter?.client?.notice?.(`No nexMap4 route to '${a.name}'.`,{color:"orange",level:"warning"}),{areaId:o,path:null,plan:null,reason:"path-not-found",sourceRoomId:s,started:!1};const u=planPath(d,{executionMode:e.executionMode??l.pathingMode,maxPathTrackHops:e.maxPathTrackHops,pathTrackCommandPrefix:e.pathTrackCommandPrefix}),p=!1!==e.start;return p&&t.stepper.start(u),{areaId:o,path:d,plan:u,sourceRoomId:s,started:p,targetRoomId:d.targetId}}function travelGoto(e,t){const n=requireName(e.target,"target");if(/^-?\d+$/.test(n.trim()))return travelToRoom({...e,roomId:Number(n.trim())},t);const o=fold(n),a=readSettings(t).landmarks.find(e=>fold(e.name)===o);if(a)return travelToRoom({...e,roomId:a.roomId},t);const i=t.searchIndexes?.findArea(n)??null;if(i)return travelToArea({...e,areaId:i.id},t);const s=t.searchIndexes?.findAreas(n)??[];if(1===s.length)return travelToArea({...e,areaId:s[0].id},t);if(s.length>1){const o=s.map(e=>({continent:e.continent,id:e.id,name:e.name,roomCount:e.roomCount}));return showResults({columns:[{key:"id",label:"ID",width:60},{key:"name",label:"Area",flex:!0},{key:"roomCount",label:"Rooms",width:80},{key:"continent",label:"Continent",width:110}],defaultAction:n=>(t.uiStore?.setState({resultsOpen:!1}),travelToArea({...e,areaId:n.id},t)),initialState:{sorting:[{desc:!1,id:"name"}]},rows:o,title:`Query results for: ${n}`},t),{areaHits:o,shown:"results-dialog",target:n}}return t.adapter?.client?.notice?.(`No landmark or area matching '${n}'.`,{color:"orange",level:"warning"}),{matched:!1,target:n}}function stopTravel(e,t){const n=t.stepper,o=nonEmptyString$3(e.reason)??"user-command";return n.stop(o),t.renderer?.setSelection({edgeId:null,roomId:null}),{reason:o,state:"function"==typeof n.getState?n.getState():null}}function enableTravelClass(e,t){return setTravelClassDisabledState(e,t,!1)}function disableTravelClass(e,t){return setTravelClassDisabledState(e,t,!0)}function setTravelClassDisabledState(e,t,n){const o=t.settingsStore,a=normalizeTravelClassInput(e.travelClass);return{disabledTravelClasses:updateSettings(e=>{const t=new Set(e.disabledTravelClasses);for(const o of a)n?t.add(o):t.delete(o);return{...e,disabledTravelClasses:[...t]}},o).disabledTravelClasses,[n?"disabled":"enabled"]:a}}function farsee(e,t){const n=requireName(e.targetName,"targetName"),o=nonEmptyString$3(e.roomName),a=nonEmptyString$3(e.areaName);if(!o)throw new Error("farsee requires a roomName.");const i={};let s=null;if(a)i.gameArea=a,s=a;else{const e=currentHostRoomId(t),n=null!==e?t.graph.getNode(e):null;n?.gameArea?(i.gameArea=n.gameArea,s=n.gameArea):null!=n?.areaId&&(i.localAreaId=n.areaId,s=`area ${n.areaId}`)}let l=resolveRoomByName$1(t,o,i),c=l?"scope":null;if(!l&&a&&(l=resolveRoomByName$1(t,o,{gameAreaMissing:!0}),l&&(c="unresolvedFallback")),!l){const e=a?`in '${s}' (and no unlabeled match found)`:s?"in the current "+(i.gameArea?"game area":"crowdmap area"):null;return t.adapter?.client?.notice?.(e?`Unable to locate '${o}' ${e}.`:`Unable to locate room '${o}'.`,{color:"orange",level:"warning"}),{areaName:s,matched:!1,roomName:o,targetName:n}}return setRoomOverlay(t,"farsee",l,{classNames:["nexmap4-overlay-farsee"],color:playerColor(t,n,"#f1c40f"),label:n,priority:30}),t.adapter?.client?.rewriteCurrentLine?.(farseeHtml({room:l,targetName:n,color:playerColor(t,n,"")})),!0===e.track&&trackSubject({centerView:e.centerView,name:n,roomId:l.id,type:"target"},t),!0===e.announcePath&&announcePathToRoom(t,l.id),{matched:!0,matchedVia:c,room:l,targetName:n}}function farseeArea(e,t){const n=requireName(e.targetName,"targetName"),o=requireName(e.areaName,"areaName"),a=t.searchIndexes?.resolveSightedArea?.(o)??null;if(!a)return t.adapter?.client?.notice?.(`Unable to locate area '${o}'.`,{color:"orange",level:"warning"}),{areaName:o,matched:!1,targetName:n};const i=farseeAreaCandidates(a,t);if(0===i.length)return t.adapter?.client?.notice?.(`Unable to locate area '${o}'.`,{color:"orange",level:"warning"}),{areaName:o,matched:!1,targetName:n};const s=playerColor(t,n,""),l="crowdmapArea"===a.kind?a.area.name:a.gameArea.name;if(1===i.length){const[e]=i;return t.adapter?.client?.rewriteCurrentLine?.(farseeAreaSingleHtml({area:e,color:s,displayName:l,targetName:n})),{area:e,matched:!0,targetName:n}}return openFarseeAreaResults({candidates:i,context:t,displayName:l,targetName:n}),t.adapter?.client?.rewriteCurrentLine?.(farseeAreaMultiHtml({areaName:o,color:s,displayName:l,targetName:n})),{areaName:a.gameArea,candidates:i,matched:!0,targetName:n}}function farseeAreaCandidates(e,t){const n=t.graph;if("crowdmapArea"===e.kind)return[e.area];const o=new Set,a=[];for(const i of e.gameArea.areaIds){if(o.has(i))continue;o.add(i);const e=n?.getArea?.(i);e&&a.push({continent:e.continent??"",id:e.id,name:e.name,roomCount:e.roomCount??n?.areaRoomIds?.(e.id)?.length??0})}return a}function openFarseeAreaResults({candidates:e,context:t,displayName:n,targetName:o}){showResults({columns:[{key:"id",label:"ID",width:60},{key:"name",label:"Area",flex:!0},{key:"roomCount",label:"Rooms",width:80},{key:"continent",label:"Continent",width:110}],defaultAction:e=>(t.uiStore?.setState({resultsOpen:!1}),travelToArea({areaId:e.id},t)),initialState:{sorting:[{desc:!1,id:"name"}]},rows:e,title:`${o} sighted in: ${n}`},t)}function fullsense(e,t){const n=normalizeFullsenseEntries(e);if(0===n.length)throw new Error("fullsense requires at least one entry with a roomName.");const o=[],a=[];for(const i of n){const e=resolveRoomByName$1(t,i.roomName,{areaId:i.areaId,gameArea:i.areaName,z:i.z});e?o.push({color:i.color??playerColor(t,i.targetName,"#1abc9c"),label:i.targetName||"Fullsense",roomId:e.id,roomName:e.name}):a.push(i.roomName)}if(o.length>0){t.renderer?.setOverlay?.("fullsense",{classNames:["nexmap4-overlay-fullsense"],color:"#1abc9c",entries:o.map(e=>({classNames:["nexmap4-overlay-fullsense"],color:e.color,label:e.label,roomId:e.roomId})),label:"Fullsense",priority:20,roomIds:o.map(e=>e.roomId)});const e=t.graph.getNode(o[0].roomId);e&&(t.renderer?.setVisibleSlice?.({areaId:e.areaId,z:e.coordinates?.z??0}),t.renderer?.center?.(o[0].roomId))}else t.renderer?.clearOverlay?.("fullsense");return a.length>0&&t.adapter?.client?.notice?.(`Fullsense: unable to locate ${[...new Set(a)].join(", ")}.`,{color:"orange",level:"warning"}),{matched:o.length,missing:[...new Set(a)],resolved:o}}function farseeHtml({color:e,room:t,targetName:n}){return`<span>You see that <span${e?` style="color:${escapeHtml(e)}"`:""}>${escapeHtml(n)}</span> is at <span style="color:white;text-decoration:underline;cursor:pointer;" onclick="nexMap.execute('travel.toRoom',{roomId:${Number(t.id)}})">"${escapeHtml(t.name)}" (${escapeHtml(t.id)})</span>.</span>`}function farseeAreaPrefix({color:e,targetName:t}){return`<span>Though too far away to accurately perceive details, you see that <span${e?` style="color:${escapeHtml(e)}"`:""}>${escapeHtml(t)}</span> is in `}function farseeAreaSingleHtml({area:e,color:t,displayName:n,targetName:o}){const a=farseeAreaPrefix({color:t,targetName:o}),i=n??e.name;return`${a}<span style="color:white;text-decoration:underline;cursor:pointer;" onclick="nexMap.execute('travel.toArea',{areaId:${Number(e.id)}})">"${escapeHtml(i)}"</span>.</span>`}function farseeAreaMultiHtml({areaName:e,color:t,displayName:n,targetName:o}){return`${farseeAreaPrefix({color:t,targetName:o})}<span style="color:white;text-decoration:underline;cursor:pointer;" title="Multiple crowdmap areas share this name — click to choose" onclick="${escapeHtml(`nexMap.execute('farsee.area',{areaName:${JSON.stringify(e)},targetName:${JSON.stringify(o)}})`)}">"${escapeHtml(n)}"</span>.</span>`}function showRoom(e,t){return renderRoom(e,t,{current:!0===e.current,selected:!0===e.selected})}function selectRoom(e,t){return renderRoom(e,t,{current:!0===e.current,selected:!0})}function showArea(e,t){const n=t.renderer,o=t.graph,a=normalizeInteger(e.areaId,"areaId"),i=o.getArea(a);if(!i)throw new Error(`Unknown areaId '${a}'.`);const s=void 0===e.z?defaultAreaZ(o,a):normalizeInteger(e.z,"z");return n.setVisibleSlice({areaId:a,z:s}),!1!==e.fit&&n.fit(),{area:i,areaId:a,viewport:"function"==typeof n.getViewport?n.getViewport():null,z:s}}function mapFit(e,t){const n=t.renderer;if(!n)throw new Error("map.fit requires an active renderer.");return n.fit(),{viewport:n.getViewport?.()??null}}function mapCenter(e,t){const n=t.renderer;if(!n)throw new Error("map.center requires an active renderer.");const o=e.roomId??currentHostRoomId(t)??null;return n.center(o),{roomId:o,viewport:n.getViewport?.()??null}}function mapZoom(e,t){const n=t.renderer;if(!n)throw new Error("map.zoom requires an active renderer.");const o=normalizePositiveFloat(e.zoom,"zoom");return n.setZoom(o),{viewport:n.getViewport?.()??null,zoom:o}}function mapSetBackground(e,t){const n="url"in e?nonEmptyString$3(e.url)??null:readSettings(t).display.background.url,o=readSettings(t).display.background.opacity,a=void 0!==e.opacity?Math.max(0,Math.min(1,Number.isFinite(Number(e.opacity))?Number(e.opacity):o)):o;return{background:updateSettings(e=>({...e,display:{...e.display,background:{opacity:a,url:n}}}),t.settingsStore).display.background}}function mapRefresh(e,t){const n=t.renderer;if(!n)throw new Error("map.refresh requires an active renderer.");const o=n.getViewport?.();return o&&n.setVisibleSlice({areaId:o.areaId,z:o.z}),{viewport:n.getViewport?.()??null}}function roomInfo(e,t){const n=t.graph,o=normalizeNodeId(e.roomId??currentHostRoomId(t),"roomId"),a=assertGraphNode(n,o,"roomId"),i=n.getArea(a.areaId),s=getLatestCurrentRoomEvent(t.adapter?.gmcp),l={area:i,current:String(extractCurrentRoomIdFromEvent(s))===String(o),exits:n.outgoingEdges(o).map(e=>({command:e.command,targetId:e.targetId,travelClass:e.travelClass??"standard"})),room:a};return t.adapter?.client?.printHtml?.(roomInfoHtml(l)),l}function roomDiagnostic(e,t){const n=t.adapter?.host,o=t.graph,a=n?.GMCP?.Location??null,i=n?.GMCP?.Room?.Info??null,s=currentHostRoomId(t),l=null!==s&&o?o.getNode(s)??null:null,c=l?o.getArea(l.areaId)??null:null,d={area:c,location:a,node:l,roomId:s,roomInfo:i};return t.adapter?.client?.printHtml?.(roomDiagnosticHtml(d)),{area:c,location:a?{...a}:null,node:l,roomId:s,roomInfo:i?{...i}:null}}function renderRoom(e,t,{current:n,selected:o}){const a=t.renderer,i=t.graph,s=normalizeNodeId(e.roomId,"roomId"),l=assertGraphNode(i,s,"roomId"),c=void 0===e.z?l.coordinates.z:normalizeInteger(e.z,"z");return a.setVisibleSlice({areaId:l.areaId,z:c}),n&&a.setCurrentRoom(s),o&&a.setSelection({edgeId:null,roomId:s}),!1!==e.center&&a.center(s),{node:l,roomId:s,viewport:"function"==typeof a.getViewport?a.getViewport():null}}function searchRooms(e,t){const n=e.text??e.query??"",o=limitResults(t.searchIndexes.findRooms(n),e.limit);return!0===e.showResults&&showRoomSearchResults(n,o,t),{hits:o}}function showRoomSearchResults(e,t,n){showResults({columns:[{key:"id",label:"Room",width:84},{key:"name",label:"Room Name",flex:!0},{key:"areaName",label:"Area",width:240},{key:"continent",label:"Continent",width:120}],defaultAction:e=>(n.uiStore?.setState({resultsOpen:!1}),travelToRoom({roomId:e.id},n)),initialState:{sorting:[{desc:!1,id:"areaName"}]},rows:t,title:`Query results for: ${String(e??"").trim()}`},n)}function searchArea(e,t){return{hit:t.searchIndexes.findArea(e.text??e.query??"")}}function searchAreas(e,t){return{hits:limitResults(t.searchIndexes.findAreas(e.text??e.query??""),e.limit)}}function searchGameArea(e,t){return{areaIds:limitResults(t.searchIndexes.findByGameArea(e.text??e.query??""),e.limit)}}async function searchDenizens(e,t){const n=t.denizensClient,o=requireName(e.text??e.query,"query");if(!n||"function"!=typeof n.search)throw new Error("Denizen search requires a configured remote denizen client.");const a=await n.search(o);return!0===e.showResults&&showResults({columns:[{key:"id",label:"ID",width:80},{key:"name",label:"Name",flex:!0},{key:"areaName",label:"Area",width:180},{key:"rooms",label:"Rooms",width:72},{key:"continent",label:"Continent",width:110}],defaultAction(e){const n=e.room??[];if(n.length)return t.uiStore?.setState({resultsOpen:!1}),travelToRoom({roomId:n[0]},t)},initialState:{sorting:[{desc:!1,id:"name"}]},rows:a.map(e=>({id:e.id,name:e.name,areaName:e.area?.name??"",continent:e.area?.continent??e.continent??"",rooms:1===e.room?.length?String(e.room[0]):`${e.room?.length??0}×`,room:e.room})),title:`Denizens matching: ${o}`},t),{hits:a,query:o}}function listWormholes(e,t){const n=requireWormholeManager(t);return{pendingRemovalSourceIds:n.snapshot().pendingRemovalSourceIds,wormholes:n.list({includePending:!0===e.includePending})}}async function refreshWormholes(e,t){const n=await requireWormholeManager(t).load();return commitWormholeGraph(t,n),{graphSummary:graphSummary(n.graph),pendingRemovalSourceIds:n.snapshot.pendingRemovalSourceIds,wormholes:n.snapshot.wormholesForPathing}}async function addWormhole(e,t){const n=requireWormholeManager(t),o=e.sourceRoomId??e.source,a=e.targetRoomId??e.target;if(null==o)throw new Error("wormholes.add requires sourceRoomId.");if(null==a)throw new Error("wormholes.add requires targetRoomId.");const i=await n.add({source:o,target:a,user:e.user??resolveWormholeUser(t)});return commitWormholeGraph(t,i),{graphSummary:graphSummary(i.graph),pendingRemovalSourceIds:i.snapshot.pendingRemovalSourceIds,response:i.response,wormhole:i.wormhole,wormholes:i.snapshot.wormholesForPathing}}async function removeWormhole(e,t){const n=await requireWormholeManager(t).remove({sourceRoomId:e.sourceRoomId??e.sourceId??e.roomId??e.source??currentHostRoomId(t),user:e.user??resolveWormholeUser(t)});return commitWormholeGraph(t,n),{graphSummary:graphSummary(n.graph),outcome:n.outcome,pendingRemovalSourceIds:n.snapshot.pendingRemovalSourceIds,response:n.response,sourceRoomId:n.sourceRoomId,wormholes:n.snapshot.wormholesForPathing}}function probeWormholes(e,t){const n=nonEmptyString$3(e.command)??"worm probe",o=e.sourceRoomId??e.sourceId??null,a=nonEmptyString$3(e.sourceName??e.source),i=nonEmptyString$3(e.targetName??e.target),s="function"==typeof t.triggerPack?.armWormholeProbe;return s&&t.triggerPack.armWormholeProbe({sourceId:o,sourceName:a,targetName:i}),!1!==e.send&&t.adapter?.client.sendCommands([n]),{armed:s,command:n,sent:!1!==e.send}}function requireWormholeManager(e){const t=e.wormholeManager;if(!t||"function"!=typeof t.list||"function"!=typeof t.snapshot||"function"!=typeof t.configure)throw new Error("Wormhole operations require a configured wormhole manager.");return e.graph&&"function"==typeof t.getGraph&&t.getGraph()!==e.graph&&t.configure({graph:e.graph}),e.wormholesClient&&t.configure({client:e.wormholesClient}),t}function commitWormholeGraph(e,t,n="wormhole-replace"){if(t?.graph)return e.runtimeGraphController?e.runtimeGraphController.getGraph()===t.graph?(e.graph=e.runtimeGraphController.getGraph(),void(e.searchIndexes=e.runtimeGraphController.getSearchIndexes())):(e.runtimeGraphController.replaceGraph(t.graph,{reason:n}),e.graph=e.runtimeGraphController.getGraph(),void(e.searchIndexes=e.runtimeGraphController.getSearchIndexes())):void("function"==typeof e.commitGraph&&e.commitGraph(t.graph,{reason:n}))}function graphSummary(e){return e?{areaCount:e.areaCount,edgeCount:e.edgeCount,nodeCount:e.nodeCount}:null}function resolveWormholeUser(e){const t=readHostFacts(e),n=e.adapter?.host??{},o=t.characterName??nonEmptyString$3(n?.GMCP?.Char?.Status?.name)??nonEmptyString$3(n?.nexusclient?.charname);if(!o)throw new Error("Wormhole operations require a character name.");return o}function createCommandHandlers(){return new Map([[p.FARSEE,farsee],[p.FARSEE_AREA,farseeArea],[p.FULLSENSE,fullsense],[p.LANDMARK_ADD,addLandmark],[p.LANDMARK_LIST,listLandmarks],[p.LANDMARK_REMOVE,removeLandmark],[p.MAP_CENTER,mapCenter],[p.MAP_FIT,mapFit],[p.MAP_REFRESH,mapRefresh],[p.MAP_ROOM_DIAGNOSTIC,roomDiagnostic],[p.MAP_ROOM_INFO,roomInfo],[p.MAP_SELECT_ROOM,selectRoom],[p.MAP_SET_BACKGROUND,mapSetBackground],[p.MAP_SHOW_AREA,showArea],[p.MAP_SHOW_ROOM,showRoom],[p.MAP_ZOOM,mapZoom],[p.SEARCH_AREA,searchArea],[p.SEARCH_AREAS,searchAreas],[p.SEARCH_DENIZENS,searchDenizens],[p.SEARCH_GAME_AREA,searchGameArea],[p.SEARCH_ROOMS,searchRooms],[p.SYSTEM_CLOSE_RESULTS,closeResults],[p.SYSTEM_CLOSE_SETTINGS,closeSettings],[p.SYSTEM_CLOSE_SHELL,closeShell],[p.SYSTEM_HELP,systemHelp],[p.SYSTEM_NOTICE,systemNotice],[p.SYSTEM_OPEN_SETTINGS,openSettings],[p.SYSTEM_OPEN_SHELL,openShell],[p.SYSTEM_SHOW_RESULTS,showResults],[p.TRACKING_CLEAR,clearTracking],[p.TRACKING_LIST,listTracking],[p.TRACKING_SUBJECT,trackSubject],[p.TRAVEL_DISABLE,disableTravelClass],[p.TRAVEL_ENABLE,enableTravelClass],[p.TRAVEL_GOTO,travelGoto],[p.TRAVEL_STOP,stopTravel],[p.TRAVEL_TO_AREA,travelToArea],[p.TRAVEL_TO_LANDMARK,travelToLandmark],[p.TRAVEL_TO_ROOM,travelToRoom],[p.WORMHOLES_ADD,addWormhole],[p.WORMHOLES_LIST,listWormholes],[p.WORMHOLES_PROBE,probeWormholes],[p.WORMHOLES_REFRESH,refreshWormholes],[p.WORMHOLES_REMOVE,removeWormhole]])}function createNexMapHostEntrypoints({router:e}={}){if(!e||"function"!=typeof e.dispatch)throw new Error("createNexMapHostEntrypoints requires a command router.");return Object.freeze({commandSurfaceVersion:1,connectRendererActions:(t={})=>connectRendererCommandActions({...t,router:e}),execute:(t,n={},o={})=>e.dispatch(t,n,o),getCommand:t=>e.getCommand(t),getCommandMenu:()=>e.getMenu(),listCommands:()=>e.listCommands()})}function connectRendererCommandActions({commandId:e=p.TRAVEL_TO_ROOM,createInput:t=defaultRoomClickInput,onError:n=null,onResult:o=null,renderer:a,router:i}={}){if(!a||"function"!=typeof a.onRoomClick)throw new Error("connectRendererCommandActions requires a renderer with onRoomClick().");if(!i||"function"!=typeof i.dispatch)throw new Error("connectRendererCommandActions requires a command router.");return a.onRoomClick(a=>{const s=n??(e=>defaultCommandErrorHandler(e,i));try{const n=i.dispatch(e,t(a),{nativeEvent:a.nativeEvent,source:"renderer.roomClick"});if(isThenable$3(n))return void n.then(e=>o?.(e),s);o?.(n)}catch(l){s(l)}})}function defaultRoomClickInput(e){return{roomId:e.roomId}}function defaultCommandErrorHandler(e,t){const n=e instanceof Error?e.message:String(e),o=t?.getDependencies?.().adapter;reportCommandError(e),o?.client?.notice?o.client.notice(n,{color:"red",level:"error"}):setTimeout(()=>{throw e},0)}function isThenable$3(e){return Boolean(e)&&"function"==typeof e.then}var Da=Object.freeze([]);function buildSearchIndexes(e){if(!e||!Array.isArray(e.nodes)||!Array.isArray(e.areas))throw new TypeError("buildSearchIndexes requires a graph snapshot with nodes and areas.");const t=new Map(e.areas.map(e=>[e.id,e])),n=[],o=new Map,a=[],i=new Map,s=new Map;for(const l of e.nodes){if(!1===l.searchable||l.nodeKind&&"room"!==l.nodeKind)continue;if(!l.name)continue;const e=foldName(l.name);if(!e)continue;const t=readGameArea(l),a=readZ(l),i={areaId:l.areaId,folded:e,gameArea:t??"",id:l.id,name:l.name,z:a};n.push(i);const c=o.get(e);if(c?c.push(i):o.set(e,[i]),t){const e=foldName(t);if(e){const n=s.get(e)??createGameAreaBucket(t);n.roomCount+=1,n.areaIdSet.has(l.areaId)||(n.areaIdSet.add(l.areaId),n.areaIds.push(l.areaId)),s.set(e,n)}}}for(const l of e.areas){if(!l.name)continue;const e=foldName(l.name);e&&(a.push({areaId:l.id,folded:e}),i.has(e)||i.set(e,l.id))}n.sort((e,t)=>e.id-t.id),a.sort((e,t)=>e.areaId-t.areaId);for(const l of s.values())l.areaIds.sort((e,t)=>e-t),Object.freeze(l.areaIds),Object.freeze(l.areaIdSet),Object.freeze(l);return new Ba({areaEntries:a,areasById:t,exactAreaIndex:i,gameAreaIndex:s,roomEntries:n,roomsByExactName:o})}var Ba=class{#y;#b;#v;#w;#S;#x;constructor({areaEntries:e,areasById:t,exactAreaIndex:n,gameAreaIndex:o,roomEntries:a,roomsByExactName:i}){this.#v=e,this.#x=t,this.#w=n,this.#S=o,this.#y=a,this.#b=i}get roomCount(){return this.#y.length}get areaCount(){return this.#v.length}get gameAreaCount(){return this.#S.size}findRooms(e,t){const n=foldName(e);if(!n)return[];if(!0===t?.gameAreaMissing){const e=[];for(const t of this.#y)!t.gameArea&&t.folded.includes(n)&&e.push(this.#I(t));return e}const o=this.#C(t);if(o===Da)return[];const a=[];for(const i of this.#y)(null===o||o.has(i.areaId))&&i.folded.includes(n)&&a.push(this.#I(i));return a}findRoomsExact(e,t){const n=foldName(e);if(!n)return[];const o=this.#b.get(n);if(!o||0===o.length)return[];if(!0===t?.gameAreaMissing)return o.filter(e=>!e.gameArea).map(e=>this.#I(e));const a=this.#C(t);if(a===Da)return[];if(null===a)return o.map(e=>this.#I(e));const i=[];for(const s of o)a.has(s.areaId)&&i.push(this.#I(s));return i}findArea(e){const t=foldName(e);if(!t)return null;const n=this.#w.get(t);return void 0===n?null:this.#E(n)}findAreas(e){const t=foldName(e);if(!t)return[];const n=[];for(const o of this.#v)if(o.folded.includes(t)){const e=this.#E(o.areaId);e&&n.push(e)}return n}findByGameArea(e){const t=foldName(e);if(!t)return[];const n=this.#S.get(t);return n?[...n.areaIds]:[]}gameAreaCoverage(){let e=0;const t=new Set,n=new Set;for(const i of this.#y)n.add(i.areaId),i.gameArea&&(e+=1,t.add(i.areaId));const o=this.#y.length-e,a=[];for(const i of n)t.has(i)||a.push(i);return a.sort((e,t)=>e-t),{labeled:e,resolvedAreaCount:t.size,totalRooms:this.#y.length,unresolved:o,unresolvedAreaIds:a}}findGameArea(e){const t=foldName(e);if(!t)return null;const n=this.#S.get(t);return n?{areaIds:[...n.areaIds],name:n.gameArea,roomCount:n.roomCount}:null}resolveSightedArea(e){const t=this.findArea(e);if(t)return{area:t,kind:"crowdmapArea"};const n=this.findAreas(e);if(1===n.length)return{area:n[0],kind:"crowdmapArea"};const o=this.findGameArea(e);return o?{gameArea:o,kind:"gameArea"}:null}#C(e){if(!e)return null;if("string"==typeof e.gameArea&&e.gameArea.length>0){const t=this.#S.get(foldName(e.gameArea));return t?t.areaIdSet:Da}return void 0!==e.areaId&&null!==e.areaId?new Set([e.areaId]):null}#I(e){const t=this.#x.get(e.areaId);return{areaId:e.areaId,areaName:t?t.name:"",continent:t?t.continent:"",gameArea:e.gameArea,id:e.id,name:e.name,z:e.z}}#E(e){const t=this.#x.get(e);return t?{continent:t.continent,id:t.id,name:t.name,roomCount:t.roomCount}:null}};function createGameAreaBucket(e){return{areaIds:[],areaIdSet:new Set,gameArea:e,roomCount:0}}function readGameArea(e){if("string"==typeof e.gameArea&&e.gameArea.length>0)return e.gameArea;const t=e.userData??e.metadata;if(t&&"object"==typeof t){const e=t["Game Area"];if("string"==typeof e&&e.length>0)return e}return null}function readZ(e){const t=e.coordinates;return Array.isArray(t)?Number.isFinite(t[2])?t[2]:0:t&&"object"==typeof t&&Number.isFinite(t.z)?t.z:0}function foldName(e){return"string"!=typeof e?"":e.trim().toLowerCase()}function createHandlerContext(e,t,n){const o={...e,commandId:t,options:n,commitGraph(t,n={}){const a=e.runtimeGraphController;if(a)return a.getGraph()!==t?a.replaceGraph(t,n):a.notify(n),e.graph=a.getGraph(),o.graph=a.getGraph(),e.searchIndexes=a.getSearchIndexes(),o.searchIndexes=a.getSearchIndexes(),a.getGraph();if(e.graph=t,o.graph=t,t&&"function"==typeof t.toSnapshot){const n=buildSearchIndexes(t.toSnapshot());e.searchIndexes=n,o.searchIndexes=n}return e.trackingController?.setGraph(t),o.trackingController?.setGraph(t),e.renderer?.setGraph?.(t),o.renderer?.setGraph?.(t),t}};return o}function createCommandRouter(e={}){const t=e.runtimeGraphController??null,n=t?.travelTopologyController??e.travelTopologyController??createTravelTopologyController(),o={adapter:e.adapter??null,denizenCollector:e.denizenCollector??null,denizensClient:e.denizensClient??null,graph:e.graph??t?.getGraph()??null,renderer:e.renderer??null,runtimeGraphController:t,searchIndexes:e.searchIndexes??t?.getSearchIndexes()??null,settingsStore:e.settingsStore??Cn,stepper:e.stepper??null,trackingController:e.trackingController??e.trackingManager??null,trackingStore:e.trackingStore??null,travelTopologyController:n,travelRegistry:e.travelRegistry??Yo,triggerPack:e.triggerPack??null,uiStore:e.uiStore??null,wormholeManager:e.wormholeManager??null,wormholesClient:e.wormholesClient??null},a=new Map(m.map(e=>[e.id,e])),i=createCommandHandlers();function dispatch(e,t={},n={}){const s=String(e??""),l=a.get(s);if(!l)throw new Error(`Unknown nexMap4 command '${s}'.`);const c=i.get(s)(t??{},createHandlerContext(o,s,n));return isThenable$2(c)?Promise.resolve(c).then(e=>createCommandResult(s,l,e,n)):createCommandResult(s,l,c,n)}function getCommand(e){return a.get(String(e))??null}function listCommands(){return m.map(e=>({...e}))}function getMenu(){return h.map(e=>({...e,commandIds:[...e.commandIds]}))}function setDependencies(e){return Object.assign(o,e),getDependencies()}function getDependencies(){return{...o}}return{dispatch,execute:dispatch,getCommand,getDependencies,getMenu,listCommands,setDependencies}}function createCommandResult(e,t,n,o={}){return deepFreeze$8({commandId:e,group:t.group,ok:!0,source:o.source??"direct",value:n})}function isThenable$2(e){return Boolean(e)&&"function"==typeof e.then}var Ga=Object.freeze({airharness:["airHarness"],atavianwings:["atavianWings"],clouds:["eagleWings","atavianWings"],eaglewings:["eagleWings"],gare:["gare"],grates:["sewergrate"],highclouds:["atavianWings"],islandwings:["islandWings"],knocker:["knocker"],lowclouds:["eagleWings"],nurrift:["nurRift"],pebble:["pebble"],sewergrate:["sewergrate"],sewergrates:["sewergrate"],universe:["universe"],urn:["urn"],wings:["eagleWings","atavianWings","islandWings"],wormhole:["wormhole"],wormholes:["wormhole"]});function parseUserCommand(e){const t=stripCommandPrefix("string"==typeof e?e.trim():"");if(!t)return{error:"No command provided. Type 'nm help' for available commands."};const n=t.indexOf(" "),o=(-1===n?t:t.slice(0,n)).toLowerCase(),a=-1===n?"":t.slice(n+1).trim();switch(o){case"goto":return parseGoto(a);case"stop":return{commandId:p.TRAVEL_STOP,input:{}};case"find":return needsArg("find",a,e=>({commandId:p.SEARCH_ROOMS,input:{showResults:!0,text:e}}));case"area":return needsArg("area",a,e=>({commandId:p.SEARCH_AREAS,input:{text:e}}));case"gamearea":return needsArg("gamearea",a,e=>({commandId:p.SEARCH_GAME_AREA,input:{text:e}}));case"npc":return needsArg("npc",a,e=>({commandId:p.SEARCH_DENIZENS,input:{showResults:!0,text:e}}));case"mark":return needsArg("mark",a,e=>({commandId:p.LANDMARK_ADD,input:{name:e}}));case"unmark":return needsArg("unmark",a,e=>({commandId:p.LANDMARK_REMOVE,input:{name:e}}));case"marks":return{commandId:p.LANDMARK_LIST,input:{}};case"track":return parseTrack(a,"target");case"track-pet":return parseTrack(a,"pet");case"untrack":return{commandId:p.TRACKING_CLEAR,input:a?{subject:a}:{}};case"fullsense":{if(!a)return{error:"fullsense requires at least one name."};const e=a.split(",").map(e=>e.trim()).filter(Boolean);return 0===e.length?{error:"fullsense requires at least one non-empty name."}:{commandId:p.FULLSENSE,input:{names:e}}}case"info":return{commandId:p.MAP_ROOM_DIAGNOSTIC,input:{}};case"roominfo":return{commandId:p.MAP_ROOM_INFO,input:{}};case"zoom":return parseZoom(a);case"fit":return{commandId:p.MAP_FIT,input:{}};case"center":return{commandId:p.MAP_CENTER,input:{}};case"refresh":return{commandId:p.MAP_REFRESH,input:{}};case"setbg":case"background":return parseSetBackground(a);case"wormholes":case"wormhole":return parseWormholes(a);case"clouds":return parseTravelToggle("clouds",a);case"highclouds":case"atavianwings":return parseTravelToggle("highclouds",a);case"lowclouds":case"eaglewings":return parseTravelToggle("lowclouds",a);case"sewergrates":case"sewergrate":case"grates":return parseTravelToggle("sewergrates",a);case"universe":return parseTravelToggle("universe",a);case"knocker":return parseTravelToggle("knocker",a);case"airharness":return parseTravelToggle("airharness",a);case"wings":return parseTravelToggle("wings",a);case"config":case"settings":return{commandId:p.SYSTEM_OPEN_SETTINGS,input:{}};case"shell":return{commandId:p.SYSTEM_OPEN_SHELL,input:{}};case"help":return{commandId:p.SYSTEM_HELP,input:{}};default:return{error:`Unknown command '${o}'. Type 'nm help' for available commands.`}}}function stripCommandPrefix(e){return e.replace(/^nm(?:\s+|$)/i,"").trim()}function parseGoto(e){return e?/^-?\d+$/.test(e)?{commandId:p.TRAVEL_TO_ROOM,input:{roomId:Number(e)}}:{commandId:p.TRAVEL_GOTO,input:{target:e}}:{error:"goto requires a room id, landmark, or area name. Example: nm goto 315"}}function parseZoom(e){if(!e)return{error:"zoom requires a zoom level. Example: nm zoom 1.5"};const t=Number(e);return!Number.isFinite(t)||t<=0?{error:`zoom level must be a positive number, got '${e}'.`}:{commandId:p.MAP_ZOOM,input:{zoom:t}}}function parseTrack(e,t){const n=e.trim().split(/\s+/);if(n.length<2||!n[0]){const e="pet"===t?"track-pet":"track";return{error:`${e} requires a room id and a name. Example: nm ${e} 12345 Veldrin`}}const[o,...a]=n;return{commandId:p.TRACKING_SUBJECT,input:{id:o,name:a.join(" "),type:t}}}function parseTravelToggle(e,t){const n=Ga[e.toLowerCase()];if(!n)return{error:`Unknown travel toggle '${e}'.`};const o=t.toLowerCase();return"on"===o||"enable"===o||"enabled"===o?{commandId:p.TRAVEL_ENABLE,input:{travelClass:n}}:"off"===o||"disable"===o||"disabled"===o?{commandId:p.TRAVEL_DISABLE,input:{travelClass:n}}:{error:`Expected 'on' or 'off' after '${e}'. Example: nm ${e} on`}}function parseWormholes(e){const t=String(e??"").trim(),n=t.indexOf(" "),o=(-1===n?t:t.slice(0,n)).toLowerCase(),a=-1===n?"":t.slice(n+1).trim();if(["on","enable","enabled","off","disable","disabled"].includes(o))return parseTravelToggle("wormholes",t);switch(o){case"":case"list":case"ls":return{commandId:p.WORMHOLES_LIST,input:{}};case"refresh":case"reload":return{commandId:p.WORMHOLES_REFRESH,input:{}};case"probe":return{commandId:p.WORMHOLES_PROBE,input:a?{command:a}:{}};case"add":case"set":case"upsert":return parseWormholeAdd(a);case"remove":case"rm":case"delete":return{commandId:p.WORMHOLES_REMOVE,input:a?{sourceRoomId:a}:{}};default:return{error:"Expected 'on', 'off', 'list', 'refresh', 'add <source> <target>', or 'remove [source]' after 'wormholes'."}}}function parseWormholeAdd(e){const t=e.split(/\s+/).filter(e=>"to"!==e.toLowerCase());return t.length<2?{error:"wormholes add requires a source and target room id. Example: nm wormholes add 4270 328"}:{commandId:p.WORMHOLES_ADD,input:{sourceRoomId:t[0],targetRoomId:t[1]}}}function parseSetBackground(e){const t=e.toLowerCase();return e&&"off"!==t&&"clear"!==t&&"none"!==t?{commandId:p.MAP_SET_BACKGROUND,input:{url:e}}:{commandId:p.MAP_SET_BACKGROUND,input:{url:null}}}function needsArg(e,t,n){return t?n(t):{error:`${e} requires additional input. Example: nm ${e} <text>`}}var Wa=Object.freeze(["eagleWings","atavianWings","islandWings","wormhole","sewergrate","airHarness","universe","knocker","gare","urn","pebble"]),Va=Object.freeze({airharness:"airHarness",atavianwings:"atavianWings",clouds:["eagleWings","atavianWings"],eaglewings:"eagleWings",gare:"gare",highclouds:"atavianWings",islandwings:"islandWings",knocker:"knocker",lowclouds:"eagleWings",pebble:"pebble",sewergrate:"sewergrate",sewergrates:"sewergrate",universe:"universe",urn:"urn",wings:["eagleWings","atavianWings","islandWings"],wormhole:"wormhole",wormholes:"wormhole"});function createPublicApi({router:e,settings:t=null}={}){if(!e||"function"!=typeof e.dispatch)throw new Error("createPublicApi requires a command router.");const execute=(t,n={},o={})=>e.dispatch(t,n,o),n=createTravelOptionsApi({settings:t});function parseAndExecute(e,t={}){const{commandText:n,executeOptions:o}=normalizeParseAndExecuteArgs(e,t),a=parseUserCommand(n);if("error"in a)return execute(p.SYSTEM_NOTICE,{message:a.error,color:"red",level:"error"},{source:"user-command"});try{return execute(a.commandId,a.input??{},{...o,source:"user-command"})}catch(i){if(i instanceof Error&&i.message.startsWith("Unknown nexMap4 command"))return execute(p.SYSTEM_NOTICE,{message:`'${a.commandId}' is not yet available. Update nexMap4 to access this feature.`,color:"orange",level:"warning"},{source:"user-command"});throw i}}return{commands:{execute,get:t=>e.getCommand(t),list:()=>e.listCommands(),menu:()=>e.getMenu(),parseAndExecute,version:1},landmarks:{add:(e,t={})=>execute(p.LANDMARK_ADD,{name:e,...t},{}),list:(e={})=>execute(p.LANDMARK_LIST,{},e),remove:(e,t={})=>execute(p.LANDMARK_REMOVE,{id:e,name:e},t)},map:{center:(e,t={})=>execute(p.MAP_CENTER,null==e?{}:{roomId:e},t),fit:(e={})=>execute(p.MAP_FIT,{},e),refresh:(e={})=>execute(p.MAP_REFRESH,{},e),roomInfo:(e,t={})=>execute(p.MAP_ROOM_INFO,null==e?{}:{roomId:e},t),selectRoom:(e,t={})=>execute(p.MAP_SELECT_ROOM,{roomId:e,...t},{}),showArea:(e,t={})=>execute(p.MAP_SHOW_AREA,{areaId:e,...t},{}),showRoom:(e,t={})=>execute(p.MAP_SHOW_ROOM,{roomId:e,...t},{}),zoom:(e,t={})=>execute(p.MAP_ZOOM,{zoom:e},t)},search:{area:(e,t={})=>execute(p.SEARCH_AREA,{text:e},t),areas:(e,t={})=>execute(p.SEARCH_AREAS,{text:e,...t},{}),denizens:(e,t={})=>execute(p.SEARCH_DENIZENS,{text:e,...t},{}),gameArea:(e,t={})=>execute(p.SEARCH_GAME_AREA,{text:e},t),rooms:(e,t={})=>execute(p.SEARCH_ROOMS,{text:e,...t},{})},wormholes:{add:(e={},t={})=>execute(p.WORMHOLES_ADD,e,t),list:(e={})=>execute(p.WORMHOLES_LIST,{},e),probe:(e={})=>execute(p.WORMHOLES_PROBE,e,{}),refresh:(e={})=>execute(p.WORMHOLES_REFRESH,{},e),remove:(e,t={})=>execute(p.WORMHOLES_REMOVE,null==e?{}:{sourceRoomId:e},t)},system:{closeResults:(e={})=>execute(p.SYSTEM_CLOSE_RESULTS,{},e),closeSettings:(e={})=>execute(p.SYSTEM_CLOSE_SETTINGS,{},e),closeShell:(e={})=>execute(p.SYSTEM_CLOSE_SHELL,{},e),notice:(e,t={})=>execute(p.SYSTEM_NOTICE,{message:e,...t},{}),openSettings:(e={})=>execute(p.SYSTEM_OPEN_SETTINGS,{},e),openShell:(e,t={})=>execute(p.SYSTEM_OPEN_SHELL,e?{tab:e}:{},t),showResults:(e={},t={})=>execute(p.SYSTEM_SHOW_RESULTS,e,t)},intel:{farsee:(e={},t={})=>execute(p.FARSEE,e,t),farseeArea:(e={},t={})=>execute(p.FARSEE_AREA,e,t),fullsense:(e,t={})=>execute(p.FULLSENSE,{entries:e},t)},tracking:{clear:(e,t={})=>execute(p.TRACKING_CLEAR,e?{type:e}:{},t),list:(e={})=>execute(p.TRACKING_LIST,{},e),subject:(e,t={})=>execute(p.TRACKING_SUBJECT,{roomId:e,...t},{})},travel:{disable:n.disable,enable:n.enable,isEnabled:n.isEnabled,travelEnabled:n.isEnabled,goto:(e,t={})=>execute(p.TRAVEL_GOTO,{target:String(e??""),...t},{}),planRoute(e,t={}){const n=execute(p.TRAVEL_TO_ROOM,{roomId:e,...t,start:!1,silent:!0},{});return assertSynchronousResult(n,"nexMap.api.travel.planRoute"),n?.value?.plan?Object.freeze({commands:Object.freeze([...n.value.plan.rawCommands]),rooms:Object.freeze([...n.value.plan.roomPath??n.value.plan.rawRoomPath]),segments:Object.freeze([...n.value.plan.segments]),totalWeight:n.value.plan.totalWeight,sourceRoomId:n.value.sourceRoomId,targetRoomId:n.value.targetRoomId}):null},stop:(e,t={})=>execute(p.TRAVEL_STOP,e?{reason:e}:{},t),toggle:n.toggle,toArea:(e,t={})=>execute(p.TRAVEL_TO_AREA,{areaId:e,...t},{}),toLandmark:(e,t={})=>execute(p.TRAVEL_TO_LANDMARK,{id:e,name:e,...t},{}),toRoom:(e,t={})=>execute(p.TRAVEL_TO_ROOM,{roomId:e,...t},{})}}}function normalizeParseAndExecuteArgs(e,t){return t&&"object"==typeof t&&!Array.isArray(t)?{commandText:String(e??""),executeOptions:t}:{commandText:[e,"boolean"==typeof t?"":Array.isArray(t)?t.join(" "):String(t??"").trim()].map(e=>String(e??"").trim()).filter(Boolean).join(" "),executeOptions:{}}}function assertSynchronousResult(e,t){if(isThenable$1(e))throw new Error(`${t} must return synchronously.`)}function isThenable$1(e){return Boolean(e)&&"function"==typeof e.then}function createTravelOptionsApi({settings:e}){function requireSettings(){if(!e||"function"!=typeof e.get||"function"!=typeof e.updateTravelOptions)throw new Error("nexMap.api travel option toggles require nexMap.settings.");return e}function currentDisabledSet(){return new Set(requireSettings().get().disabledTravelClasses)}function saveDisabled(e,t){return requireSettings().updateTravelOptions({disabledTravelClasses:[...e]},t)}function enable(e,t){const n=currentDisabledSet();for(const o of normalizeFastTravelClasses(e))n.delete(o);return saveDisabled(n,t)}function disable(e,t){const n=currentDisabledSet();for(const o of normalizeFastTravelClasses(e))n.add(o);return saveDisabled(n,t)}function isEnabled(e){const t=currentDisabledSet();return normalizeFastTravelClasses(e).every(e=>!t.has(e))}function toggle(e,t=void 0,n=void 0){const o=normalizeFastTravelClasses(e),a="boolean"==typeof t?t:null,i=null===a?t:n;return!0===a?enableMany(o,i):!1===a||isEnabledMany(o)?disableMany(o,i):enableMany(o,i)}function enableMany(e,t){const n=currentDisabledSet();for(const o of e)n.delete(o);return saveDisabled(n,t)}function disableMany(e,t){const n=currentDisabledSet();for(const o of e)n.add(o);return saveDisabled(n,t)}function isEnabledMany(e){const t=currentDisabledSet();return e.every(e=>!t.has(e))}return{disable,enable,isEnabled,toggle}}function normalizeFastTravelClasses(e){const t=String(e??"").trim(),n=Va[t.toLowerCase()];if(Array.isArray(n))return n;if(n)return[n];if(!Wa.includes(t))throw new Error(`Unknown fast travel option '${e}'.`);return[t]}function resolveWormholeFound(e,{sourceGameArea:t=null,sourceId:n,sourceName:o,targetName:a}){const i=null==n?resolveRoomByName(e,o,{gameArea:t}):resolveRoomById(e,n);if("confirmed"!==i.status)return{...i,side:"source"};const s=resolveRoomByName(e,a);return"confirmed"!==s.status?{...s,side:"target"}:{source:i.room,status:"confirmed",target:s.room,wormhole:{source:i.room,target:s.room}}}function resolveRoomById(e,t){const n=normalizeRoomId$3(t),o=e.getNode(n);return o?{room:{areaId:o.areaId,id:o.id,name:o.name},status:"confirmed"}:{matches:[],query:String(t??""),status:"unknown"}}function resolveRoomByName(e,t,{gameArea:n=null}={}){const o=normalizeRoomName(t);if(!o)return{matches:[],query:o,reason:"emptyName",status:"unknown"};if(isHouseName(o))return{matches:[],query:o,reason:"houseNameExcluded",status:"unknown"};const a=filterByGameArea(e.nodes().filter(e=>normalizeRoomName(e.name)===o).map(e=>({areaId:e.areaId,gameArea:e.gameArea,id:e.id,name:e.name})),n);return 1===a.length?{room:stripResolutionMetadata(a[0]),status:"confirmed"}:a.length>1?{matches:a,query:o,status:"ambiguous"}:{matches:[],query:o,status:"unknown"}}function normalizeRoomName(e){return String(e??"").trim().replace(/\s+/gu," ").toLocaleLowerCase("en-US")}function isHouseName(e){return/^house\b/u.test(e)||/\(house\)/u.test(e)}function normalizeRoomId$3(e){if("number"==typeof e&&Number.isInteger(e))return e;const t=String(e??"").trim();return/^-?\d+$/u.test(t)?Number(t):e}function filterByGameArea(e,t){const n=normalizeRoomName(t);return n?e.filter(e=>{const t=normalizeRoomName(e.gameArea);return!t||t===n}).map(stripResolutionMetadata):e.map(stripResolutionMetadata)}function stripResolutionMetadata(e){return{areaId:e.areaId,id:e.id,name:e.name}}function createInitialWalkerState(){return{currentRoomId:null,destinationId:null,lastDispatchedSegmentEndpoint:null,lastError:null,plan:null,segmentCount:0,segmentIndex:0,settledAt:0,sourceId:null,startedAt:0,status:"idle"}}function createWalkerStore(e=createInitialWalkerState()){const t=createStore(()=>({...e}));return t.patch=function(e){return t.setState(e),t.getState()},t.reset=function(){return t.setState(createInitialWalkerState(),!0),t.getState()},t.get=t.getState,t.set=function(e){t.setState(e,!0)},t}Object.freeze(["idle","dispatching","awaiting-room","completed","stopped","error"]);var Ha=createWalkerStore();function patchWalkerState(e,t=Ha){return t.setState(e),t.getState()}var Ua="runtime.triggerPack",qa="runtime.triggerPack.pathing",Ka="runtime.triggerPack.ambient",Za=Object.freeze(["gag","locked-door","obstacle-blocker","universe-map-missing","wormhole-arrival","wormhole-missing"]),Ya=Object.freeze(["wormhole-probe","wormhole-unavailable"]),Xa=new Set(Za),Ja=new Set(Ya),Qa=new Set(["gag","locked-door","wormhole-arrival"]),ei=Object.freeze(["dispatching","awaiting-room"]),ti=Object.freeze(["You're not currently traversing to any location.","You're already there!","You cease your movement.","You have no path.","You have arrived at your destination.","You are already traversing to a location. If you wish to cancel your movement, please CLICK HERE.","Now now, don't be so hasty!","You stumble slightly as you abruptly decide to stop walking towards your goal.",/^Carefully getting your bearings, you set off \w+ toward your goal\.$/]),ri=Object.freeze(["You are not carrying a key for this door.",/^There is a door in the way, to the (\w+)\.$/]),ni=Object.freeze([/^.+ stops you from moving that way\.$/,/^\w+ stops you from leaving\.$/,"A wall bars your path.","A rajamala slaver stops you from moving that way."]),oi=Object.freeze(["There is no map here to touch."]),ai=Object.freeze([/^You sense a wormhole leading to (?<target>.+)\.$/iu,/^You sense a connection between (?<source>.+?) and (?=[A-Z])(?<target>.+)\.$/iu,/^Wormhole detected:\s*(?<source>.+?)\s*(?:->|to)\s*(?<target>.+?)\.?$/iu,/^Your probe discovers a wormhole from (?<source>.+?) to (?<target>.+?)\.?$/iu]),ii=Object.freeze(["There is no wormhole here."]),si=Object.freeze(["The wormhole spits you out at the other end."]),li=Object.freeze(['I cannot fathom the meaning of "worm".']);function createTriggerPack({adapter:e,graph:t=null,onGag:n=null,onGraphChange:o=null,onObstacleRetry:a=null,onPathBlocked:i=null,onReplan:s=null,onUniverseMapMissing:l=null,onWormholeFound:c=null,onWormholeMissing:d=null,onWormholeReroute:u=null,onWormholeResolution:p=null,onWormholeUnavailable:m=null,patterns:h={},resolveWormholeFound:g=resolveWormholeFound,settingsStore:y=null,stepper:b=null,stopStepperOnBlocked:v=!0,store:w=Ha}={}){assertAdapter$2(e),assertStore(w);const S=normalizePatternList(h.gags??ti),x=normalizePatternList(h.lockedDoors??ri),I=normalizePatternList(h.obstacleBlockers??ni),C=normalizePatternList(h.universeMapMissing??oi),E=normalizePatternList(h.wormholeProbe??ai),R=normalizePatternList(h.wormholeMissing??ii),k=normalizePatternList(h.wormholeArrival??si),T=normalizePatternList(h.wormholeUnavailable??li),M=[],$=[];let N=!1,P=!1,O=null;function start(){if(P)throw new Error("trigger pack has been disposed.");return N||(e.triggers.enableByTag(qa),N=!0),j}function stop(){return N?(e.triggers.disableByTag(qa),N=!1,clearSessionState(),j):j}function dispose(){if(!P){for(;$.length>0;)$.pop()?.();for(;M.length>0;)e.triggers.removeTrigger(M.pop());N=!1,clearSessionState(),P=!0}}function armWormholeProbe(e={}){return O={sourceId:e.sourceId??null,sourceName:e.sourceName??null,targetName:e.targetName??null},O}function clearSessionState(){if(t&&"function"==typeof t.clearBlockedEdges){const e=t.revision??null;t.clearBlockedEdges(),null!==e&&t.revision!==e&&o?.(t,{reason:"edge-block-clear"})}O=null}function getSessionState(){return{blockedEdges:t?.blockedEdges?.()??[],pendingWormholeProbe:O?{...O}:null}}function registerPatternGroup(t,n){const o=Xa.has(t),a=Ja.has(t);if(!o&&!a)throw new Error(`triggerPack: unknown kind '${t}'.`);const i=o?qa:Ka,s=!o;for(const[l,c]of n.entries()){const n=[Ua];Qa.has(t)&&n.push("gag"),M.push(e.triggers.addTrigger({action:(...e)=>handleTriggerAction(t,e),enabled:s,id:`nexmap4.triggerPack.${t}.${l+1}`,lifetime:"pathing-session",pattern:c,tag:i,tags:n}))}}function handleTriggerAction(e,t){const n=extractMatchFromTriggerArgs$1(t);return handleKind(e,extractLineFromTriggerArgs$1(t,n),n)}function handleKind(e,t,n){return"gag"===e?handleGag(t,n):"locked-door"===e?handleLockedDoor(t,n):"obstacle-blocker"===e?handleObstacleBlocker(t,n):"universe-map-missing"===e?handleUniverseMapMissing(t,n):"wormhole-probe"===e?handleWormholeProbe(t,n):"wormhole-missing"===e?handleWormholeMissing(t,n):"wormhole-arrival"===e?handleWormholeArrival(t,n):"wormhole-unavailable"===e?handleWormholeUnavailable(t,n):ignored$1("unknown-kind",t)}function handleGag(t,o){if(!isWalkerActive$1(w.get()))return ignored$1("walker-inactive",t);e.client.gagLine();const a=Object.freeze({line:t,match:o,type:"gag"});return n?.(a),a}function handleLockedDoor(n,a){const l=w.get();if(!isWalkerActive$1(l))return ignored$1("walker-inactive",n);e.client.gagLine();const c=activeSegment$1(l),d=inferBlockedEdgeId(c,l.currentRoomId);if(!d)return ignored$1("blocked-edge-unresolved",n);if(!t||"function"!=typeof t.blockEdge)return ignored$1("graph-unavailable",n);if(!t.hasEdge(d))return ignored$1("blocked-edge-missing",n);t.blockEdge(d,{line:n,reason:"locked-door",segment:c}),o?.(t,{edgeId:d,reason:"edge-block"}),v&&"function"==typeof b?.stop&&b.stop("locked-door");const u=Object.freeze({edgeId:d,line:n,match:a,segment:c,type:"locked-door"});return i?.(u),s?.({...u,reason:"locked-door"}),u}function handleObstacleBlocker(t,n){const o=w.get();if(!isWalkerActive$1(o))return ignored$1("walker-inactive",t);const i=activeSegment$1(o),s=currentRoomId()??o.currentRoomId??null,l=nextRoomIdFromSegment(i,s);if(null===l)return ignored$1("obstacle-next-room-unresolved",t);const c=directionToRoom(l,latestRoomExits())??directionFromSegment(i,s);if(!c)return ignored$1("obstacle-direction-unresolved",t);const d=[`mountjump ${c}`,`leap ${c}`],u=y?.getState?.()?.commandSeparator??y?.get?.()?.commandSeparator??"|";e.client.sendCommands(d,{separator:u});const p=Object.freeze({commands:d,direction:c,line:t,match:n,nextRoomId:l,segment:i,type:"obstacle-retry"});return a?.(p),p}function handleUniverseMapMissing(t,n){const o=w.get();if(!isWalkerActive$1(o))return ignored$1("walker-inactive",t);const a=activeSegment$1(o);if(!isUniverseSegment(a))return ignored$1("not-universe-segment",t);e.client.sendCommands(["x"]);const i=Object.freeze({line:t,match:n,segment:a,type:"universe-map-missing"});return l?.(i),i}function handleWormholeProbe(e,n){const o=extractWormholeNames(n),a=resolveCurrentRoom(),i=o.sourceName?null:O?.sourceId??a?.id??null,s=o.sourceName??O?.sourceName??a?.name??null,l=o.targetName??O?.targetName??null;if(!s&&null===i||!l)return ignored$1("wormhole-names-unresolved",e);if(!t)return ignored$1("missing-graph",e);const d=g(t,{sourceGameArea:a?.gameArea??null,sourceId:i,sourceName:s,targetName:l}),u=Object.freeze({line:e,match:n,resolution:d,sourceName:s,targetName:l,type:"wormhole-probe"});return O=null,p?.(u),"confirmed"===d.status&&c?.(d.wormhole,u),u}function handleWormholeMissing(e,t){const n=w.get(),o=currentRoomId()??n.currentRoomId??null,a=activeSegment$1(n),i=n.destinationId??n.plan?.targetId??null;v&&"function"==typeof b?.stop&&b.stop("wormhole-missing");const l=Object.freeze({destinationId:i,line:e,match:t,segment:a,sourceRoomId:o,type:"wormhole-missing"});return d?.(l),s?.({...l,reason:"wormhole-missing"}),l}function handleWormholeArrival(t,n){const o=w.get();if(!isWalkerActive$1(o))return ignored$1("walker-inactive",t);const a=activeSegment$1(o);if(!isWormholeSegment(a))return ignored$1("not-wormhole-segment",t);const i=firstRoomId$1(a),l=lastRoomId$1(a),c=currentRoomId()??o.currentRoomId??null;if(null===i||null===l||null===c||roomIdsEqual$3(c,i))return ignored$1("wormhole-arrival-unresolved",t);e.client.gagLine();const d=o.destinationId??o.plan?.targetId??null;if(roomIdsEqual$3(c,l))return Object.freeze({actualTargetRoomId:c,destinationId:d,expectedTargetRoomId:l,line:t,match:n,segment:a,sourceRoomId:i,type:"wormhole-arrival"});const p=Object.freeze({actualTargetRoomId:c,destinationId:d,expectedTargetRoomId:l,line:t,match:n,segment:a,sourceRoomId:i,type:"wormhole-reroute"});return v&&"function"==typeof b?.stop&&b.stop("wormhole-reroute"),u?.(p),s?.({...p,reason:"wormhole-reroute"}),p}function handleWormholeUnavailable(e,t){const n=Object.freeze({line:e,match:t,type:"wormhole-unavailable"});return m?.(n),n}function subscribeToStepper(){b&&"function"==typeof b.on&&$.push(b.on("start",()=>{clearSessionState(),start()}),b.on("complete",()=>{stop()}),b.on("stopped",()=>{stop()}),b.on("error",()=>{O=null,stop()}))}function resolveCurrentRoom(){const e=currentRoomId();if(null===e||!t)return null;const n=t.getNode(e);return n?{gameArea:n.gameArea??null,id:n.id,name:n.name}:null}function currentRoomId(){return extractCurrentRoomIdFromEvent(getLatestCurrentRoomEvent(e.gmcp))}function latestRoomExits(){return getLatestCurrentRoomEvent(e.gmcp)?.payload?.exits??null}registerPatternGroup("gag",S),registerPatternGroup("locked-door",x),registerPatternGroup("obstacle-blocker",I),registerPatternGroup("universe-map-missing",C),registerPatternGroup("wormhole-probe",E),registerPatternGroup("wormhole-missing",R),registerPatternGroup("wormhole-arrival",k),registerPatternGroup("wormhole-unavailable",T),subscribeToStepper();const j={armWormholeProbe,clearSessionState,dispose,getSessionState,start,stop};return j}function activeSegment$1(e){const t=e?.segmentIndex??0;return e?.plan?.segments?.[t]??null}function inferBlockedEdgeId(e,t){if(!e||!Array.isArray(e.edgeIds)||0===e.edgeIds.length)return null;if(null!=t&&Array.isArray(e.roomIds)){const n=e.roomIds.findIndex(e=>roomIdsEqual$3(e,t));if(n>=0&&n<e.edgeIds.length)return e.edgeIds[n]}return e.edgeIds[0]??null}function nextRoomIdFromSegment(e,t){if(!Array.isArray(e?.roomIds)||e.roomIds.length<2)return null;if(null!=t){const n=e.roomIds.findIndex(e=>roomIdsEqual$3(e,t));if(n>=0&&n<e.roomIds.length-1)return e.roomIds[n+1]}return e.roomIds[1]??null}function directionToRoom(e,t){if(!t)return null;if(Array.isArray(t)){for(const n of t){const t=n?.exitId??n?.targetId??n?.target??n?.id??null;if(null!==t&&roomIdsEqual$3(t,e))return n?.name??n?.direction??n?.dir??n?.command??null}return null}if("object"==typeof t)for(const[n,o]of Object.entries(t))if(roomIdsEqual$3(exitTargetId(o),e))return n;return null}function exitTargetId(e){return e&&"object"==typeof e?e.exitId??e.targetId??e.target??e.id??null:e}function directionFromSegment(e,t){if(!Array.isArray(e?.stepCommands)||0===e.stepCommands.length)return null;if(null!=t&&Array.isArray(e.roomIds)){const n=e.roomIds.findIndex(e=>roomIdsEqual$3(e,t));if(n>=0&&n<e.stepCommands.length)return e.stepCommands[n]??null}return e.stepCommands[0]??null}function isWormholeSegment(e){return Array.isArray(e?.travelClasses)&&e.travelClasses.includes("wormhole")}function isUniverseSegment(e){return Array.isArray(e?.travelClasses)&&e.travelClasses.includes("universe")}function firstRoomId$1(e){return Array.isArray(e?.roomIds)&&0!==e.roomIds.length?e.roomIds[0]:null}function lastRoomId$1(e){return Array.isArray(e?.roomIds)&&0!==e.roomIds.length?e.roomIds[e.roomIds.length-1]:null}function isWalkerActive$1(e){return ei.includes(e?.status)}function extractWormholeNames(e){const t=e?.groups??{},n=Object.prototype.hasOwnProperty.call(t,"source"),o=Object.prototype.hasOwnProperty.call(t,"target");return{sourceName:normalizeOptionalName(n?t.source:o?null:e?.[1]),targetName:normalizeOptionalName(o?t.target:e?.[2])}}function normalizeOptionalName(e){const t=String(e??"").trim();return t.length>0?t:null}function normalizePatternList(e){if(!Array.isArray(e))throw new Error("trigger pattern groups must be arrays.");for(const t of e)if(!(t instanceof RegExp)&&"string"!=typeof t)throw new Error("trigger patterns must be RegExp objects or strings.");return Object.freeze([...e])}function extractLineFromTriggerArgs$1(e,t=null){if(null!=t?.input)return String(t.input);for(const n of e){if("string"==typeof n)return n;if(n&&"object"==typeof n){const e=n.line??n.rawLine??n.text??n.message??null;if(null!=e)return String(e)}}return""}function extractMatchFromTriggerArgs$1(e){for(const t of e){if(Array.isArray(t))return t;if(t&&"object"==typeof t){const e=t.match??t.matches??null;if(Array.isArray(e))return e}}return null}function ignored$1(e,t){return Object.freeze({line:t,reason:e,type:"ignored"})}function roomIdsEqual$3(e,t){return String(e)===String(t)}function assertAdapter$2(e){if(!e||"object"!=typeof e)throw new Error("createTriggerPack requires an adapter instance.");if(!e.client||"function"!=typeof e.client.gagLine)throw new Error("createTriggerPack adapter must expose a client facade with gagLine().");if(!e.client||"function"!=typeof e.client.sendCommands)throw new Error("createTriggerPack adapter must expose a client facade with sendCommands().");if(!e.triggers||"function"!=typeof e.triggers.addTrigger)throw new Error("createTriggerPack adapter must expose a trigger facade with addTrigger().")}function assertStore(e){if(!e||"function"!=typeof e.get)throw new Error("createTriggerPack requires a walker store atom.")}function createPublicStateApi({router:e}){function deps(){return e.getDependencies()}return function(){const{adapter:e,graph:t,stepper:n,trackingStore:o}=deps(),a=n?.getState()??null,i=ei.includes(a?.status);return Object.freeze({location:resolveLocation(e?.location??null,t??null),destination:a?.destinationId??null,path:i&&a.plan?Object.freeze({commands:Object.freeze([...a.plan.rawCommands]),rooms:Object.freeze([...a.plan.roomPath??a.plan.rawRoomPath]),segments:Object.freeze([...a.plan.segments])}):null,pathing:i,tracking:Object.freeze(subjectsToArray(o?.getState?.().subjects??new Map))})}}function resolveLocation(e,t){const n=e?.getRoomId()??null,o=e?.getLastRoomId()??null,a=null!==n?t?.getNode?.(n)??null:null,i=a?t?.getArea?.(a.areaId)??null:null;return Object.freeze({roomId:n,lastRoomId:o,charted:null!==a,room:a?Object.freeze({id:a.id,name:a.name,areaId:a.areaId,environment:a.environment??null,indoors:a.indoors??null,x:a.coordinates.x,y:a.coordinates.y,z:a.coordinates.z}):null,area:i?Object.freeze({id:i.id,name:i.name,continent:i.continent}):null})}function createInitialUiState(){return{pathingNotices:[],resultsColumns:[],resultsDefaultAction:null,resultsInitialState:{},resultsOpen:!1,resultsRows:[],resultsTitle:"Results",settingsOpen:!1,shellOpen:!1,shellTab:"landmarks"}}function createUiStore(){const e=createStore(()=>createInitialUiState());return e.get=e.getState,e.patch=function(t){return e.setState(t),e.getState()},e.appendNotice=function({severity:t="info",message:n}){const o={id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,message:String(n),severity:t,ts:Date.now()};return e.setState(e=>({pathingNotices:[...e.pathingNotices,o]})),o},e.dismissNotice=function(t){e.setState(e=>({pathingNotices:e.pathingNotices.filter(e=>e.id!==t)}))},e}function createNexMap({adapter:e=null,settings:t=null,settingsRepository:n=null,settingsStorage:o=null,settingsStore:a=null,trackingStore:i=null,uiStore:s=null,...l}={}){let c="bootstrap-pending";const d=t??createSettingsApi({repository:n,storage:o,store:a}),u=s??createUiStore(),p=i??createTrackingStore(),m=createCommandRouter({adapter:e,settingsStore:d.store,trackingStore:p,uiStore:u,...l}),h=createNexMapHostEntrypoints({router:m}),g=createPublicApi({router:m,settings:d}),y=createPublicStateApi({router:m}),b={adapter:e,api:g,commands:m,commandSurfaceVersion:h.commandSurfaceVersion,trackingStore:p,uiStore:u,configure(e={}){const{settingsRepository:t,settingsStorage:n,settingsStore:o,...a}=e;return Object.prototype.hasOwnProperty.call(e,"adapter")&&(b.adapter=e.adapter),hasSettingsConfiguration(e)&&d.configure({repository:t,storage:n,store:o}),m.setDependencies({...a,settingsStore:d.store})},connectRendererActions:h.connectRendererActions,destroy(){c="destroyed"},execute:g.commands.execute,getCommand:g.commands.get,getCommandMenu:g.commands.menu,getDependencies:()=>m.getDependencies(),getStatus:()=>c,listCommands:g.commands.list,settings:d,setStatus:e=>(c=String(e),c)};return Object.defineProperty(b,"state",{enumerable:!0,get:y}),b}function hasSettingsConfiguration(e){return Object.prototype.hasOwnProperty.call(e,"settingsRepository")||Object.prototype.hasOwnProperty.call(e,"settingsStorage")||Object.prototype.hasOwnProperty.call(e,"settingsStore")}var ci=Object.freeze({ROOM_CHANGED:"room.changed",BALANCE_RECOVERED:"balance.recovered",AREA_CHANGED:"area.changed",WALKER_START:"walker.start",WALKER_DISPATCH:"walker.dispatch",WALKER_ARRIVAL:"walker.arrival",WALKER_COMPLETE:"walker.complete",WALKER_STOPPED:"walker.stopped",WALKER_ERROR:"walker.error",SEND_COMMANDS:"intent.sendCommands",SEND_QUEUE:"intent.sendQueue",PATHING_START:"pathing.start",PATHING_COMPLETE:"pathing.complete",PATHING_BLOCKED:"pathing.blocked",BOOTSTRAP_PHASE:"bootstrap.phase"});function createEventBus(){const e=new Map,t=new Set;let n=!1;function on(t,n){if(assertNotDisposed(),"function"!=typeof n)throw new Error(`eventBus.on('${String(t)}') requires a listener function.`);const o=Array.isArray(t)?t:[t];for(const a of o){let t=e.get(a);t||(t=new Set,e.set(a,t)),t.add(n)}return()=>{for(const t of o)e.get(t)?.delete(n)}}function off(t,n){const o=Array.isArray(t)?t:[t];for(const a of o)e.get(a)?.delete(n)}function emit(o,a){if(n)return;const i=e.get(o);if(i)for(const e of i)e(a,o);for(const e of t)e(a,o)}function onAny(e){if(assertNotDisposed(),"function"!=typeof e)throw new Error("eventBus.onAny() requires a listener function.");return t.add(e),()=>t.delete(e)}function dispose(){n=!0;for(const t of e.values())t.clear();e.clear(),t.clear()}function topics(){return[...e.keys()].filter(t=>(e.get(t)?.size??0)>0)}function listenerCount(t){return e.get(t)?.size??0}function assertNotDisposed(){if(n)throw new Error("EventBus has been disposed.")}return Object.freeze({dispose,emit,listenerCount,off,on,onAny,topics,get isDisposed(){return n}})}function createStartupEventBus({app:e,resources:t}){return t.eventBus=createEventBus(),t.sendCommandsUnsub=t.eventBus.on(ci.SEND_COMMANDS,({commands:e,separator:n})=>{t.adapter.client.sendCommands(e,void 0!==n?{separator:n}:void 0)}),t.sendQueueUnsub=t.eventBus.on(ci.SEND_QUEUE,({commands:e,separator:n,queue:o})=>{const a={};void 0!==n&&(a.separator=n),void 0!==o&&(a.queue=o),t.adapter.client.sendQueue(e,Object.keys(a).length>0?a:void 0)}),e.uiStore&&(t.eventBus.on(ci.PATHING_START,t=>{const n=t?.destinationId??t?.targetRoomId??"";e.uiStore.appendNotice({message:n?`Pathing to room ${n}…`:"Pathing…",severity:"info"})}),t.eventBus.on(ci.PATHING_COMPLETE,()=>{e.uiStore.appendNotice({message:"Arrived at destination.",severity:"success"})}),t.eventBus.on(ci.PATHING_BLOCKED,t=>{e.uiStore.appendNotice({message:t?.reason??"Path blocked.",severity:"warning"})})),t.eventBus.on(ci.WALKER_COMPLETE,e=>{const n=e?.elapsedMs,o="number"==typeof n?` ${(n/1e3).toFixed(1)}s`:"";t.adapter.client.notice(`Pathing complete.${o}`)}),t.eventBus}Object.freeze(Object.values(ci));var di=Object.freeze(["abash","event","harrrvesting","harvesting","mappy","nex"]);function readUserTelemetry({adapter:e,host:t}){const n=readCharStatus({adapter:e,host:t}),o=nonEmptyString$1(n.name??n.fullname??t?.nexusclient?.charname);if(!o)throw new Error("nexMap remote user telemetry requires Char.Status.name.");return{date:new Date,name:o,packages:readPackageNames(t)}}function readCharacterName({adapter:e,host:t}){const n=readCharStatus({adapter:e,host:t});return nonEmptyString$1(n.name??n.fullname??t?.nexusclient?.charname)}function readCharStatus({adapter:e,host:t}){return e?.gmcp?.getLastEvent?.(na.GMCP_CHAR_STATUS)?.payload??t?.GMCP?.Char?.Status??t?.GMCP?.Status??t?.nexusclient?.datahandler?.()?.GMCP?.Status??{}}function readPackageNames(e){const t=(e?.nexusclient?.packages?.())?.list?.();return Array.isArray(t)?t.map(e=>"string"==typeof e?e:e?.name).filter(e=>"string"==typeof e&&e.length>0).filter(e=>{const t=e.toLowerCase();return di.some(e=>t.includes(e))}):[]}function nonEmptyString$1(e){if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}function formatMuiErrorMessage(e,...t){const n=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(e=>n.searchParams.append("args[]",e)),`Minified MUI error #${e}; visit ${n} for the full message.`}function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_extends.apply(null,arguments)}var ui=!1;function sheetForTag(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function createStyleElement(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var pi=function(){function StyleSheet(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy?!ui:e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var e=StyleSheet.prototype;return e.hydrate=function(e){e.forEach(this._insertTag)},e.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(createStyleElement(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=sheetForTag(t);try{n.insertRule(e,n.cssRules.length)}catch(o){}}else t.appendChild(document.createTextNode(e));this.ctr++},e.flush=function(){this.tags.forEach(function(e){var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)}),this.tags=[],this.ctr=0},StyleSheet}(),mi="-ms-",hi="-moz-",gi="-webkit-",fi="comm",yi="rule",bi="decl",vi="@import",wi="@keyframes",Si="@layer",xi=Math.abs,Ii=String.fromCharCode,Ci=Object.assign;function hash$2(e,t){return 45^charat(e,0)?(((t<<2^charat(e,0))<<2^charat(e,1))<<2^charat(e,2))<<2^charat(e,3):0}function trim(e){return e.trim()}function match(e,t){return(e=t.exec(e))?e[0]:e}function replace(e,t,n){return e.replace(t,n)}function indexof(e,t){return e.indexOf(t)}function charat(e,t){return 0|e.charCodeAt(t)}function substr(e,t,n){return e.slice(t,n)}function strlen(e){return e.length}function sizeof(e){return e.length}function append(e,t){return t.push(e),e}function combine(e,t){return e.map(t).join("")}var Ei=1,Ri=1,ki=0,Ai=0,Ti=0,Mi="";function node(e,t,n,o,a,i,s){return{value:e,root:t,parent:n,type:o,props:a,children:i,line:Ei,column:Ri,length:s,return:""}}function copy(e,t){return Ci(node("",null,null,"",null,null,0),e,{length:-e.length},t)}function char(){return Ti}function prev(){return Ti=Ai>0?charat(Mi,--Ai):0,Ri--,10===Ti&&(Ri=1,Ei--),Ti}function next(){return Ti=Ai<ki?charat(Mi,Ai++):0,Ri++,10===Ti&&(Ri=1,Ei++),Ti}function peek(){return charat(Mi,Ai)}function caret(){return Ai}function slice(e,t){return substr(Mi,e,t)}function token(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function alloc(e){return Ei=Ri=1,ki=strlen(Mi=e),Ai=0,[]}function dealloc(e){return Mi="",e}function delimit(e){return trim(slice(Ai-1,delimiter(91===e?e+2:40===e?e+1:e)))}function whitespace(e){for(;(Ti=peek())&&Ti<33;)next();return token(e)>2||token(Ti)>3?"":" "}function escaping(e,t){for(;--t&&next()&&!(Ti<48||Ti>102||Ti>57&&Ti<65||Ti>70&&Ti<97););return slice(e,caret()+(t<6&&32==peek()&&32==next()))}function delimiter(e){for(;next();)switch(Ti){case e:return Ai;case 34:case 39:34!==e&&39!==e&&delimiter(Ti);break;case 40:41===e&&delimiter(e);break;case 92:next()}return Ai}function commenter(e,t){for(;next()&&e+Ti!==57&&(e+Ti!==84||47!==peek()););return"/*"+slice(t,Ai-1)+"*"+Ii(47===e?e:next())}function identifier(e){for(;!token(peek());)next();return slice(e,Ai)}function compile(e){return dealloc(parse("",null,null,null,[""],e=alloc(e),0,[0],e))}function parse(e,t,n,o,a,i,s,l,c){for(var d=0,u=0,p=s,m=0,h=0,g=0,y=1,b=1,v=1,w=0,S="",x=a,I=i,C=o,E=S;b;)switch(g=w,w=next()){case 40:if(108!=g&&58==charat(E,p-1)){-1!=indexof(E+=replace(delimit(w),"&","&\f"),"&\f")&&(v=-1);break}case 34:case 39:case 91:E+=delimit(w);break;case 9:case 10:case 13:case 32:E+=whitespace(g);break;case 92:E+=escaping(caret()-1,7);continue;case 47:switch(peek()){case 42:case 47:append(comment(commenter(next(),caret()),t,n),c);break;default:E+="/"}break;case 123*y:l[d++]=strlen(E)*v;case 125*y:case 59:case 0:switch(w){case 0:case 125:b=0;case 59+u:-1==v&&(E=replace(E,/\f/g,"")),h>0&&strlen(E)-p&&append(h>32?declaration(E+";",o,n,p-1):declaration(replace(E," ","")+";",o,n,p-2),c);break;case 59:E+=";";default:if(append(C=ruleset(E,t,n,d,u,a,l,S,x=[],I=[],p),i),123===w)if(0===u)parse(E,t,C,C,x,i,p,l,I);else switch(99===m&&110===charat(E,3)?100:m){case 100:case 108:case 109:case 115:parse(e,C,C,o&&append(ruleset(e,C,C,0,0,a,l,S,a,x=[],p),I),a,I,p,l,o?x:I);break;default:parse(E,C,C,C,[""],I,0,l,I)}}d=u=h=0,y=v=1,S=E="",p=s;break;case 58:p=1+strlen(E),h=g;default:if(y<1)if(123==w)--y;else if(125==w&&0==y++&&125==prev())continue;switch(E+=Ii(w),w*y){case 38:v=u>0?1:(E+="\f",-1);break;case 44:l[d++]=(strlen(E)-1)*v,v=1;break;case 64:45===peek()&&(E+=delimit(next())),m=peek(),u=p=strlen(S=E+=identifier(caret())),w++;break;case 45:45===g&&2==strlen(E)&&(y=0)}}return i}function ruleset(e,t,n,o,a,i,s,l,c,d,u){for(var p=a-1,m=0===a?i:[""],h=sizeof(m),g=0,y=0,b=0;g<o;++g)for(var v=0,w=substr(e,p+1,p=xi(y=s[g])),S=e;v<h;++v)(S=trim(y>0?m[v]+" "+w:replace(w,/&\f/g,m[v])))&&(c[b++]=S);return node(e,t,n,0===a?yi:l,c,d,u)}function comment(e,t,n){return node(e,t,n,fi,Ii(char()),substr(e,2,-2),0)}function declaration(e,t,n,o){return node(e,t,n,bi,substr(e,0,o),substr(e,o+1,-1),o)}function serialize(e,t){for(var n="",o=sizeof(e),a=0;a<o;a++)n+=t(e[a],a,e,t)||"";return n}function stringify(e,t,n,o){switch(e.type){case Si:if(e.children.length)break;case vi:case bi:return e.return=e.return||e.value;case fi:return"";case wi:return e.return=e.value+"{"+serialize(e.children,o)+"}";case yi:e.value=e.props.join(",")}return strlen(n=serialize(e.children,o))?e.return=e.value+"{"+n+"}":""}function middleware(e){var t=sizeof(e);return function(n,o,a,i){for(var s="",l=0;l<t;l++)s+=e[l](n,o,a,i)||"";return s}}function rulesheet(e){return function(t){t.root||(t=t.return)&&e(t)}}function memoize(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var identifierWithPointTracking=function(e,t,n){for(var o=0,a=0;o=a,a=peek(),38===o&&12===a&&(t[n]=1),!token(a);)next();return slice(e,Ai)},toRules=function(e,t){var n=-1,o=44;do{switch(token(o)){case 0:38===o&&12===peek()&&(t[n]=1),e[n]+=identifierWithPointTracking(Ai-1,t,n);break;case 2:e[n]+=delimit(o);break;case 4:if(44===o){e[++n]=58===peek()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=Ii(o)}}while(o=next());return e},getRules=function(e,t){return dealloc(toRules(alloc(e),t))},zi=new WeakMap,compat=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,o=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||zi.get(n))&&!o){zi.set(e,!0);for(var a=[],i=getRules(t,a),s=n.props,l=0,c=0;l<i.length;l++)for(var d=0;d<s.length;d++,c++)e.props[c]=a[l]?i[l].replace(/&\f/g,s[d]):s[d]+" "+i[l]}}},removeLabel=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function prefix(e,t){switch(hash$2(e,t)){case 5103:return gi+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return gi+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return gi+e+hi+e+mi+e+e;case 6828:case 4268:return gi+e+mi+e+e;case 6165:return gi+e+mi+"flex-"+e+e;case 5187:return gi+e+replace(e,/(\w+).+(:[^]+)/,gi+"box-$1$2"+mi+"flex-$1$2")+e;case 5443:return gi+e+mi+"flex-item-"+replace(e,/flex-|-self/,"")+e;case 4675:return gi+e+mi+"flex-line-pack"+replace(e,/align-content|flex-|-self/,"")+e;case 5548:return gi+e+mi+replace(e,"shrink","negative")+e;case 5292:return gi+e+mi+replace(e,"basis","preferred-size")+e;case 6060:return gi+"box-"+replace(e,"-grow","")+gi+e+mi+replace(e,"grow","positive")+e;case 4554:return gi+replace(e,/([^-])(transform)/g,"$1"+gi+"$2")+e;case 6187:return replace(replace(replace(e,/(zoom-|grab)/,gi+"$1"),/(image-set)/,gi+"$1"),e,"")+e;case 5495:case 3959:return replace(e,/(image-set\([^]*)/,gi+"$1$`$1");case 4968:return replace(replace(e,/(.+:)(flex-)?(.*)/,gi+"box-pack:$3"+mi+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+gi+e+e;case 4095:case 3583:case 4068:case 2532:return replace(e,/(.+)-inline(.+)/,gi+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(strlen(e)-1-t>6)switch(charat(e,t+1)){case 109:if(45!==charat(e,t+4))break;case 102:return replace(e,/(.+:)(.+)-([^]+)/,"$1"+gi+"$2-$3$1"+hi+(108==charat(e,t+3)?"$3":"$2-$3"))+e;case 115:return~indexof(e,"stretch")?prefix(replace(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==charat(e,t+1))break;case 6444:switch(charat(e,strlen(e)-3-(~indexof(e,"!important")&&10))){case 107:return replace(e,":",":"+gi)+e;case 101:return replace(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+gi+(45===charat(e,14)?"inline-":"")+"box$3$1"+gi+"$2$3$1"+mi+"$2box$3")+e}break;case 5936:switch(charat(e,t+11)){case 114:return gi+e+mi+replace(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return gi+e+mi+replace(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return gi+e+mi+replace(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return gi+e+mi+e+e}return e}var $i=[function(e,t,n,o){if(e.length>-1&&!e.return)switch(e.type){case bi:e.return=prefix(e.value,e.length);break;case wi:return serialize([copy(e,{value:replace(e.value,"@","@"+gi)})],o);case yi:if(e.length)return combine(e.props,function(t){switch(match(t,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return serialize([copy(e,{props:[replace(t,/:(read-\w+)/,":"+hi+"$1")]})],o);case"::placeholder":return serialize([copy(e,{props:[replace(t,/:(plac\w+)/,":"+gi+"input-$1")]}),copy(e,{props:[replace(t,/:(plac\w+)/,":"+hi+"$1")]}),copy(e,{props:[replace(t,/:(plac\w+)/,mi+"input-$1")]})],o)}return""})}}],createCache=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))})}var o,a,i=e.stylisPlugins||$i,s={},l=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)s[t[n]]=!0;l.push(e)});var c,d=[compat,removeLabel],u=[stringify,rulesheet(function(e){c.insert(e)})],p=middleware(d.concat(i,u)),stylis=function(e){return serialize(compile(e),p)};a=function(e,t,n,o){c=n,stylis(e?e+"{"+t.styles+"}":t.styles),o&&(m.inserted[t.name]=!0)};var m={key:t,sheet:new pi({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:a};return m.sheet.hydrate(l),m},Ni=__commonJSMin(e=>{var t="function"==typeof Symbol&&Symbol.for,n=t?Symbol.for("react.element"):60103,o=t?Symbol.for("react.portal"):60106,a=t?Symbol.for("react.fragment"):60107,i=t?Symbol.for("react.strict_mode"):60108,s=t?Symbol.for("react.profiler"):60114,l=t?Symbol.for("react.provider"):60109,c=t?Symbol.for("react.context"):60110,d=t?Symbol.for("react.async_mode"):60111,u=t?Symbol.for("react.concurrent_mode"):60111,p=t?Symbol.for("react.forward_ref"):60112,m=t?Symbol.for("react.suspense"):60113,h=t?Symbol.for("react.suspense_list"):60120,g=t?Symbol.for("react.memo"):60115,y=t?Symbol.for("react.lazy"):60116,b=t?Symbol.for("react.block"):60121,v=t?Symbol.for("react.fundamental"):60117,w=t?Symbol.for("react.responder"):60118,S=t?Symbol.for("react.scope"):60119;function z(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case d:case u:case a:case s:case i:case m:return e;default:switch(e=e&&e.$$typeof){case c:case p:case y:case g:case l:return e;default:return t}}case o:return t}}}function A(e){return z(e)===u}e.AsyncMode=d,e.ConcurrentMode=u,e.ContextConsumer=c,e.ContextProvider=l,e.Element=n,e.ForwardRef=p,e.Fragment=a,e.Lazy=y,e.Memo=g,e.Portal=o,e.Profiler=s,e.StrictMode=i,e.Suspense=m,e.isAsyncMode=function(e){return A(e)||z(e)===d},e.isConcurrentMode=A,e.isContextConsumer=function(e){return z(e)===c},e.isContextProvider=function(e){return z(e)===l},e.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},e.isForwardRef=function(e){return z(e)===p},e.isFragment=function(e){return z(e)===a},e.isLazy=function(e){return z(e)===y},e.isMemo=function(e){return z(e)===g},e.isPortal=function(e){return z(e)===o},e.isProfiler=function(e){return z(e)===s},e.isStrictMode=function(e){return z(e)===i},e.isSuspense=function(e){return z(e)===m},e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===u||e===s||e===i||e===m||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===g||e.$$typeof===l||e.$$typeof===c||e.$$typeof===p||e.$$typeof===v||e.$$typeof===w||e.$$typeof===S||e.$$typeof===b)},e.typeOf=z}),Pi=__commonJSMin((e,t)=>{t.exports=Ni()}),Oi=__commonJSMin((e,t)=>{var n=Pi(),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function getStatics(e){return n.isMemo(e)?s:l[e.$$typeof]||o}l[n.ForwardRef]=i,l[n.Memo]=s;var c=Object.defineProperty,d=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,m=Object.getPrototypeOf,h=Object.prototype;function hoistNonReactStatics(e,t,n){if("string"!=typeof t){if(h){var o=m(t);o&&o!==h&&hoistNonReactStatics(e,o,n)}var i=d(t);u&&(i=i.concat(u(t)));for(var s=getStatics(e),l=getStatics(t),g=0;g<i.length;++g){var y=i[g];if(!(a[y]||n&&n[y]||l&&l[y]||s&&s[y])){var b=p(t,y);try{c(e,y,b)}catch(v){}}}}return e}t.exports=hoistNonReactStatics}),_i=!0;function getRegisteredStyles(e,t,n){var o="";return n.split(" ").forEach(function(n){void 0!==e[n]?t.push(e[n]+";"):n&&(o+=n+" ")}),o}var registerStyles=function(e,t,n){var o=e.key+"-"+t.name;!1!==n&&!1!==_i||void 0!==e.registered[o]||(e.registered[o]=t.styles)},insertStyles=function(e,t,n){registerStyles(e,t,n);var o=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var a=t;do{e.insert(t===a?"."+o:"",a,e.sheet,!0),a=a.next}while(void 0!==a)}};function murmur2(e){for(var t,n=0,o=0,a=e.length;a>=4;++o,a-=4)t=1540483477*(65535&(t=255&e.charCodeAt(o)|(255&e.charCodeAt(++o))<<8|(255&e.charCodeAt(++o))<<16|(255&e.charCodeAt(++o))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(a){case 3:n^=(255&e.charCodeAt(o+2))<<16;case 2:n^=(255&e.charCodeAt(o+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(o)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}var ji={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Fi=!1,Li=/[A-Z]|^ms/g,Di=/_EMO_([^_]+?)_([^]*?)_EMO_/g,isCustomProperty=function(e){return 45===e.charCodeAt(1)},isProcessableValue=function(e){return null!=e&&"boolean"!=typeof e},Bi=memoize(function(e){return isCustomProperty(e)?e:e.replace(Li,"-$&").toLowerCase()}),processStyleValue=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(Di,function(e,t,n){return Wi={name:t,styles:n,next:Wi},t})}return 1===ji[e]||isCustomProperty(e)||"number"!=typeof t||0===t?t:t+"px"},Gi="Component selectors can only be used in conjunction with @emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware compiler transform.";function handleInterpolation(e,t,n){if(null==n)return"";var o=n;if(void 0!==o.__emotion_styles)return o;switch(typeof n){case"boolean":return"";case"object":var a=n;if(1===a.anim)return Wi={name:a.name,styles:a.styles,next:Wi},a.name;var i=n;if(void 0!==i.styles){var s=i.next;if(void 0!==s)for(;void 0!==s;)Wi={name:s.name,styles:s.styles,next:Wi},s=s.next;return i.styles+";"}return createStringFromObject(e,t,n);case"function":if(void 0!==e){var l=Wi,c=n(e);return Wi=l,handleInterpolation(e,t,c)}}var d=n;if(null==t)return d;var u=t[d];return void 0!==u?u:d}function createStringFromObject(e,t,n){var o="";if(Array.isArray(n))for(var a=0;a<n.length;a++)o+=handleInterpolation(e,t,n[a])+";";else for(var i in n){var s=n[i];if("object"!=typeof s){var l=s;null!=t&&void 0!==t[l]?o+=i+"{"+t[l]+"}":isProcessableValue(l)&&(o+=Bi(i)+":"+processStyleValue(i,l)+";")}else{if("NO_COMPONENT_SELECTOR"===i&&Fi)throw new Error(Gi);if(!Array.isArray(s)||"string"!=typeof s[0]||null!=t&&void 0!==t[s[0]]){var c=handleInterpolation(e,t,s);switch(i){case"animation":case"animationName":o+=Bi(i)+":"+c+";";break;default:o+=i+"{"+c+"}"}}else for(var d=0;d<s.length;d++)isProcessableValue(s[d])&&(o+=Bi(i)+":"+processStyleValue(i,s[d])+";")}}return o}var Wi,Vi=/label:\s*([^\s;{]+)\s*(;|$)/g;function serializeStyles(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var o=!0,a="";Wi=void 0;var i=e[0];null==i||void 0===i.raw?(o=!1,a+=handleInterpolation(n,t,i)):a+=i[0];for(var s=1;s<e.length;s++)a+=handleInterpolation(n,t,e[s]),o&&(a+=i[s]);Vi.lastIndex=0;for(var l,c="";null!==(l=Vi.exec(a));)c+="-"+l[1];return{name:murmur2(a)+c,styles:a,next:Wi}}var Hi,Ui,syncFallback=function(e){return e()},qi=!!e.useInsertionEffect&&e.useInsertionEffect,Ki=qi||syncFallback,Zi=qi||e.useLayoutEffect,Yi=e.createContext("undefined"!=typeof HTMLElement?createCache({key:"css"}):null),Xi=Yi.Provider,withEmotionCache=function(t){return(0,e.forwardRef)(function(n,o){return t(n,(0,e.useContext)(Yi),o)})},Ji=e.createContext({}),Qi={}.hasOwnProperty,es="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",createEmotionProps=function(e,t){var n={};for(var o in t)Qi.call(t,o)&&(n[o]=t[o]);return n[es]=e,n},Insertion$1=function(e){var t=e.cache,n=e.serialized,o=e.isStringTag;return registerStyles(t,n,o),Ki(function(){return insertStyles(t,n,o)}),null},ts=withEmotionCache(function(t,n,o){var a=t.css;"string"==typeof a&&void 0!==n.registered[a]&&(a=n.registered[a]);var i=t[es],s=[a],l="";"string"==typeof t.className?l=getRegisteredStyles(n.registered,s,t.className):null!=t.className&&(l=t.className+" ");var c=serializeStyles(s,void 0,e.useContext(Ji));l+=n.key+"-"+c.name;var d={};for(var u in t)Qi.call(t,u)&&"css"!==u&&u!==es&&(d[u]=t[u]);return d.className=l,o&&(d.ref=o),e.createElement(e.Fragment,null,e.createElement(Insertion$1,{cache:n,serialized:c,isStringTag:"string"==typeof i}),e.createElement(i,d))}),rs=(Oi(),function(t,n){var o=arguments;if(null==n||!Qi.call(n,"css"))return e.createElement.apply(void 0,o);var a=o.length,i=new Array(a);i[0]=ts,i[1]=createEmotionProps(t,n);for(var s=2;s<a;s++)i[s]=o[s];return e.createElement.apply(null,i)});Hi=rs||(rs={}),Ui||(Ui=Hi.JSX||(Hi.JSX={}));var ns=withEmotionCache(function(t,n){var o=serializeStyles([t.styles],void 0,e.useContext(Ji)),a=e.useRef();return Zi(function(){var e=n.key+"-global",t=new n.sheet.constructor({key:e,nonce:n.sheet.nonce,container:n.sheet.container,speedy:n.sheet.isSpeedy}),i=!1,s=document.querySelector('style[data-emotion="'+e+" "+o.name+'"]');return n.sheet.tags.length&&(t.before=n.sheet.tags[0]),null!==s&&(i=!0,s.setAttribute("data-emotion",e),t.hydrate([s])),a.current=[t,i],function(){t.flush()}},[n]),Zi(function(){var e=a.current,t=e[0];e[1]?e[1]=!1:(void 0!==o.next&&insertStyles(n,o.next,!0),t.tags.length&&(t.before=t.tags[t.tags.length-1].nextElementSibling,t.flush()),n.insert("",o,t,!1))},[n,o.name]),null});function css(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return serializeStyles(t)}function keyframes(){var e=css.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}var os=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,as=!1,is=memoize(function(e){return os.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),testOmitPropsOnComponent=function(e){return"theme"!==e},getDefaultShouldForwardProp=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?is:testOmitPropsOnComponent},composeShouldForwardProps=function(e,t,n){var o;if(t){var a=t.shouldForwardProp;o=e.__emotion_forwardProp&&a?function(t){return e.__emotion_forwardProp(t)&&a(t)}:a}return"function"!=typeof o&&n&&(o=e.__emotion_forwardProp),o},Insertion=function(e){var t=e.cache,n=e.serialized,o=e.isStringTag;return registerStyles(t,n,o),Ki(function(){return insertStyles(t,n,o)}),null},ss=function createStyled(t,n){var o,a,i=t.__emotion_real===t,s=i&&t.__emotion_base||t;void 0!==n&&(o=n.label,a=n.target);var l=composeShouldForwardProps(t,n,i),c=l||getDefaultShouldForwardProp(s),d=!c("as");return function(){var u=arguments,p=i&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==o&&p.push("label:"+o+";"),null==u[0]||void 0===u[0].raw)p.push.apply(p,u);else{var m=u[0];p.push(m[0]);for(var h=u.length,g=1;g<h;g++)p.push(u[g],m[g])}var y=withEmotionCache(function(t,n,o){var i=d&&t.as||s,u="",m=[],h=t;if(null==t.theme){for(var g in h={},t)h[g]=t[g];h.theme=e.useContext(Ji)}"string"==typeof t.className?u=getRegisteredStyles(n.registered,m,t.className):null!=t.className&&(u=t.className+" ");var y=serializeStyles(p.concat(m),n.registered,h);u+=n.key+"-"+y.name,void 0!==a&&(u+=" "+a);var b=d&&void 0===l?getDefaultShouldForwardProp(i):c,v={};for(var w in t)d&&"as"===w||b(w)&&(v[w]=t[w]);return v.className=u,o&&(v.ref=o),e.createElement(e.Fragment,null,e.createElement(Insertion,{cache:n,serialized:y,isStringTag:"string"==typeof i}),e.createElement(i,v))});return y.displayName=void 0!==o?o:"Styled("+("string"==typeof s?s:s.displayName||s.name||"Component")+")",y.defaultProps=t.defaultProps,y.__emotion_real=y,y.__emotion_base=s,y.__emotion_styles=p,y.__emotion_forwardProp=l,Object.defineProperty(y,"toString",{value:function(){return void 0===a&&as?"NO_COMPONENT_SELECTOR":"."+a}}),y.withComponent=function(e,t){return createStyled(e,_extends({},n,t,{shouldForwardProp:composeShouldForwardProps(y,t,!0)})).apply(void 0,p)},y}},ls=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"],cs=ss.bind(null);ls.forEach(function(e){cs[e]=cs(e)});var ds,us=__commonJSMin(e=>{var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function jsxProd(e,n,o){var a=null;if(void 0!==o&&(a=""+o),void 0!==n.key&&(a=""+n.key),"key"in n)for(var i in o={},n)"key"!==i&&(o[i]=n[i]);else o=n;return n=o.ref,{$$typeof:t,type:e,key:a,ref:void 0!==n?n:null,props:o}}e.Fragment=n,e.jsx=jsxProd,e.jsxs=jsxProd}),ps=__commonJSMin((e,t)=>{t.exports=us()})(),ms=new Map,hs={insert:void 0},createEmotionCache=(e,t)=>{const n=createCache(e);return n.sheet=new t({key:n.key,nonce:n.sheet.nonce,container:n.sheet.container,speedy:n.sheet.isSpeedy,prepend:n.sheet.prepend,insertionPoint:n.sheet.insertionPoint}),n};if("object"==typeof document&&!(ds=document.querySelector('[name="emotion-insertion-point"]'))){(ds=document.createElement("meta")).setAttribute("name","emotion-insertion-point"),ds.setAttribute("content","");const e=document.querySelector("head");e&&e.prepend(ds)}function getCache(e,t){if(e||t){class n extends pi{insert(e,t){return hs.insert?hs.insert(e,t):(this.key&&this.key.endsWith("global")&&(this.before=ds),super.insert(e,t))}}const o=createEmotionCache({key:"css",insertionPoint:e?ds:void 0},n);if(t){const e=o.insert;o.insert=(...t)=>(t[1].styles.match(/^@layer\s+[^{]*$/)||(t[1].styles=`@layer mui {${t[1].styles}}`),e(...t))}return o}}function StyledEngineProvider(e){const{injectFirst:t,enableCssLayer:n,children:o}=e,a=c.useMemo(()=>{const e=`${t}-${n}`;if("object"==typeof document&&ms.has(e))return ms.get(e);const o=getCache(t,n);return ms.set(e,o),o},[t,n]);return a?(0,ps.jsx)(Xi,{value:a,children:o}):o}function isEmpty$3(e){return null==e||0===Object.keys(e).length}function GlobalStyles$2(e){const{styles:t,defaultTheme:n={}}=e;return(0,ps.jsx)(ns,{styles:"function"==typeof t?e=>t(isEmpty$3(e)?n:e):t})}function styled$1(e,t){return cs(e,t)}function internal_mutateStyles(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}var gs=[];function internal_serializeStyles(e){return gs[0]=e,serializeStyles(gs)}var fs=__commonJSMin(e=>{Symbol.for("react.transitional.element"),Symbol.for("react.portal");var t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),i=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),p=(Symbol.for("react.view_transition"),Symbol.for("react.client.reference"));e.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===t||e===o||e===n||e===l||e===c||"object"==typeof e&&null!==e&&(e.$$typeof===u||e.$$typeof===d||e.$$typeof===i||e.$$typeof===a||e.$$typeof===s||e.$$typeof===p||void 0!==e.getModuleId)}}),ys=__commonJSMin((e,t)=>{t.exports=fs()})();function isPlainObject$1(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function deepClone(e){if(c.isValidElement(e)||(0,ys.isValidElementType)(e)||!isPlainObject$1(e))return e;const t={};return Object.keys(e).forEach(n=>{t[n]=deepClone(e[n])}),t}function deepmerge(e,t,n={clone:!0}){const o=n.clone?{...e}:e;return isPlainObject$1(e)&&isPlainObject$1(t)&&Object.keys(t).forEach(a=>{c.isValidElement(t[a])||(0,ys.isValidElementType)(t[a])?o[a]=t[a]:isPlainObject$1(t[a])&&Object.prototype.hasOwnProperty.call(e,a)&&isPlainObject$1(e[a])?o[a]=deepmerge(e[a],t[a],n):n.clone?o[a]=isPlainObject$1(t[a])?deepClone(t[a]):t[a]:o[a]=t[a]}),o}var sortBreakpointsValues=e=>{const t=Object.keys(e).map(t=>({key:t,val:e[t]}))||[];return t.sort((e,t)=>e.val-t.val),t.reduce((e,t)=>({...e,[t.key]:t.val}),{})};function createBreakpoints(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:n="px",step:o=5,...a}=e,i=sortBreakpointsValues(t),s=Object.keys(i);function up(e){return`@media (min-width:${"number"==typeof t[e]?t[e]:e}${n})`}function down(e){return`@media (max-width:${("number"==typeof t[e]?t[e]:e)-o/100}${n})`}function between(e,a){const i=s.indexOf(a);return`@media (min-width:${"number"==typeof t[e]?t[e]:e}${n}) and (max-width:${(-1!==i&&"number"==typeof t[s[i]]?t[s[i]]:a)-o/100}${n})`}function only(e){return s.indexOf(e)+1<s.length?between(e,s[s.indexOf(e)+1]):up(e)}function not(e){const t=s.indexOf(e);return 0===t?up(s[1]):t===s.length-1?down(s[t]):between(e,s[s.indexOf(e)+1]).replace("@media","@media not all and")}const l=[];for(let c=0;c<s.length;c+=1)l.push(up(s[c]));return{keys:s,values:i,up,down,between,only,not,unit:n,internal_mediaKeys:l,...a}}var bs=/min-width:\s*([0-9.]+)/;function sortContainerQueries(e,t){if(!e.containerQueries||!hasContainerQuery(t))return t;const n=[];for(const a in t)a.startsWith("@container")&&n.push(a);n.sort((e,t)=>+(e.match(bs)?.[1]||0)-+(t.match(bs)?.[1]||0));const o=t;for(let a=0;a<n.length;a+=1){const e=n[a],t=o[e];delete o[e],o[e]=t}return o}function hasContainerQuery(e){for(const t in e)if(t.startsWith("@container"))return!0;return!1}function isCqShorthand(e,t){return"@"===t||t.startsWith("@")&&(e.some(e=>t.startsWith(`@${e}`))||!!t.match(/^@\d/))}function getContainerQuery(e,t){const n=t.match(/^@([^/]+)?\/?(.+)?$/);if(!n)return null;const[,o,a]=n,i=Number.isNaN(+o)?o||0:+o;return e.containerQueries(a).up(i)}function cssContainerQueries(e){const toContainerQuery=(e,t)=>e.replace("@media",t?`@container ${t}`:"@container");function attachCq(t,n){t.up=(...t)=>toContainerQuery(e.breakpoints.up(...t),n),t.down=(...t)=>toContainerQuery(e.breakpoints.down(...t),n),t.between=(...t)=>toContainerQuery(e.breakpoints.between(...t),n),t.only=(...t)=>toContainerQuery(e.breakpoints.only(...t),n),t.not=(...t)=>{const o=toContainerQuery(e.breakpoints.not(...t),n);return o.includes("not all and")?o.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):o}}const t={},containerQueries=e=>(attachCq(t,e),t);return attachCq(containerQueries),{...e,containerQueries}}var vs={borderRadius:4};function isObjectEmpty$2(e){if(null==e)return!0;for(const t in e)return!1;return!0}function fastDeepAssign(e,t){const n=Array.isArray(t),o=Array.isArray(e);return isPrimitive(t)?t:isPrimitiveOrBuiltIn(e)?clone(t):n&&o?mergeArray(e,t):n!==o?clone(t):mergeObject(e,t)}function cloneArray(e){let t=0;const n=e.length,o=new Array(n);for(t=0;t<n;t+=1)o[t]=clone(e[t]);return o}function cloneObject(e){const t={};for(const n in e)t[n]=clone(e[n]);return t}function mergeArray(e,t){const n=e.length;for(let o=0;o<t.length;o+=1)e[n+o]=clone(t[o]);return e}function isMergeableObject(e){return!("object"!=typeof e||null===e||e instanceof RegExp||e instanceof Date)}function isPrimitive(e){return"object"!=typeof e||null===e}function isPrimitiveOrBuiltIn(e){return"object"!=typeof e||null===e||e instanceof RegExp||e instanceof Date}function clone(e){return isMergeableObject(e)?Array.isArray(e)?cloneArray(e):cloneObject(e):e}function mergeObject(e,t){for(const n in t)e[n]=n in e?fastDeepAssign(e[n],t[n]):clone(t[n]);return e}var ws={},Ss={xs:0,sm:600,md:900,lg:1200,xl:1536},xs=createBreakpoints({values:Ss}),Is={containerQueries:e=>({up:t=>{let n="number"==typeof t?t:Ss[t]||t;return"number"==typeof n&&(n=`${n}px`),e?`@container ${e} (min-width:${n})`:`@container (min-width:${n})`}})};function handleBreakpoints(e,t,n){const o={};return iterateBreakpoints(o,e.theme,t,(e,t,a)=>{const i=n(t,a);e?o[e]=i:fastDeepAssign(o,i)})}function iterateBreakpoints(e,t,n,o){if(t??=ws,Array.isArray(n)){const a=t.breakpoints??xs;for(let t=0;t<n.length;t+=1)buildBreakpoint(e,a.up(a.keys[t]),n[t],void 0,o);return e}if("object"==typeof n){const a=t.breakpoints??xs,i=a.values??Ss;for(const s in n)if(isCqShorthand(a.keys,s)){const a=getContainerQuery(t.containerQueries?t:Is,s);a&&buildBreakpoint(e,a,n[s],s,o)}else if(s in i)buildBreakpoint(e,a.up(s),n[s],s,o);else{const t=s;e[t]=n[t]}return e}return o(void 0,n),e}function buildBreakpoint(e,t,n,o,a){e[t]??={},a(t,n,o)}function createEmptyBreakpointObject(e=xs){const{internal_mediaKeys:t}=e,n={};for(let o=0;o<t.length;o+=1)n[t[o]]={};return n}function removeUnusedBreakpoints(e,t){const n=e.internal_mediaKeys;for(let o=0;o<n.length;o+=1){const e=n[o];isObjectEmpty$2(t[e])&&delete t[e]}return t}function hasBreakpoint(e,t){if(Array.isArray(t))return!0;if("object"==typeof t&&null!==t){for(let o=0;o<e.keys.length;o+=1)if(e.keys[o]in t)return!0;const n=Object.keys(t);for(let t=0;t<n.length;t+=1)if(isCqShorthand(e.keys,n[t]))return!0}return!1}function capitalize(e){if("string"!=typeof e)throw new Error(formatMuiErrorMessage(7));return e.charAt(0).toUpperCase()+e.slice(1)}function getStyleValue2(e,t,n,o){let a;return a="function"==typeof e?e(n):Array.isArray(e)?e[n]||n:"string"==typeof n&&getPath(e,n,!0,o)||n,t&&(a=t(a,n,e)),a}function getPath(e,t,n=!0,o=void 0){if(!e||!t)return null;const a=t.split(".");if(e.vars&&n){const t=getPathImpl(e.vars,a,o);if(null!=t)return t}return getPathImpl(e,a,o)}function getPathImpl(e,t,n=void 0){let o,a=e,i=0;for(;i<t.length;){if(null==a)return a;o=a,a=a[t[i]],i+=1}if(n&&void 0===a){const e=t[t.length-1],a=`${n}${"default"===e?"":capitalize(e)}`;return o?.[a]}return a}function style$1(e){const{prop:t,cssProperty:n=e.prop,themeKey:o,transform:a}=e,fn=e=>{if(null==e[t])return null;const i=e[t],s=getPath(e.theme,o)||{};return handleBreakpoints(e,i,e=>{const o=getStyleValue2(s,a,e,t);return!1===n?o:{[n]:o}})};return fn.propTypes={},fn.filterProps=[t],fn}var Cs={internal_cache:{}},Es={m:"margin",p:"padding"},Rs={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},ks={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},As={};for(const Pb in Es)As[Pb]=[Es[Pb]];for(const Pb in Es)for(const e in Rs){const t=Es[Pb],n=Rs[e],o=Array.isArray(n)?n.map(e=>t+e):[t+n];As[Pb+e]=o}for(const Pb in ks)As[Pb]=As[ks[Pb]];var Ts=new Set(["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"]),Ms=new Set(["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"]),zs=new Set([...Ts,...Ms]);function createUnaryUnit(e,t,n,o){const a=getPath(e,t,!0)??n;return"number"==typeof a||"string"==typeof a?e=>"string"==typeof e?e:"string"==typeof a?a.startsWith("var(")&&0===e?0:a.startsWith("var(")&&1===e?a:`calc(${e} * ${a})`:a*e:Array.isArray(a)?e=>{if("string"==typeof e)return e;const t=a[Math.abs(e)];return e>=0?t:"number"==typeof t?-t:"string"==typeof t&&t.startsWith("var(")?`calc(-1 * ${t})`:`-${t}`}:"function"==typeof a?a:()=>{}}function createUnarySpacing(e){return createUnaryUnit(e,"spacing",8,"spacing")}function getValue(e,t){return"string"==typeof t||null==t?t:e(t)}var $s=[""];function style(e,t){const n=e.theme??Cs,o=n?.internal_cache?.unarySpacing??createUnarySpacing(n),a={};for(const i in e){if(!t.has(i))continue;const n=As[i]??($s[0]=i,$s),s=e[i];iterateBreakpoints(a,e.theme,s,(e,t)=>{const i=e?a[e]:a;for(let a=0;a<n.length;a+=1)i[n[a]]=getValue(o,t)})}return a}function margin(e){return style(e,Ts)}function padding(e){return style(e,Ms)}function spacing(e){return style(e,zs)}function createSpacing(e=8,t=createUnarySpacing({spacing:e})){if(e.mui)return e;const spacing=(...e)=>(0===e.length?[1]:e).map(e=>{const n=t(e);return"number"==typeof n?`${n}px`:n}).join(" ");return spacing.mui=!0,spacing}function compose(...e){const t=e.reduce((e,t)=>(t.filterProps.forEach(n=>{e[n]=t}),e),{}),fn=e=>{const n={};for(const o in e)t[o]&&fastDeepAssign(n,t[o](e));return n};return fn.propTypes={},fn.filterProps=e.reduce((e,t)=>e.concat(t.filterProps),[]),fn}function borderTransform(e){return"number"!=typeof e?e:`${e}px solid`}function createBorderStyle(e,t){return style$1({prop:e,themeKey:"borders",transform:t})}margin.propTypes={},margin.filterProps=Ts,padding.propTypes={},padding.filterProps=Ms,spacing.propTypes={},spacing.filterProps=zs;var Ns=createBorderStyle("border",borderTransform),Ps=createBorderStyle("borderTop",borderTransform),Os=createBorderStyle("borderRight",borderTransform),_s=createBorderStyle("borderBottom",borderTransform),js=createBorderStyle("borderLeft",borderTransform),Fs=createBorderStyle("borderColor"),Ls=createBorderStyle("borderTopColor"),Ds=createBorderStyle("borderRightColor"),Bs=createBorderStyle("borderBottomColor"),Gs=createBorderStyle("borderLeftColor"),Ws=createBorderStyle("outline",borderTransform),Vs=createBorderStyle("outlineColor"),borderRadius=e=>{if(void 0!==e.borderRadius&&null!==e.borderRadius){const t=createUnaryUnit(e.theme,"shape.borderRadius",4,"borderRadius"),styleFromPropValue=e=>({borderRadius:getValue(t,e)});return handleBreakpoints(e,e.borderRadius,styleFromPropValue)}return null};borderRadius.propTypes={},borderRadius.filterProps=["borderRadius"],compose(Ns,Ps,Os,_s,js,Fs,Ls,Ds,Bs,Gs,borderRadius,Ws,Vs);var gap=e=>{if(void 0!==e.gap&&null!==e.gap){const t=createUnaryUnit(e.theme,"spacing",8,"gap"),styleFromPropValue=e=>({gap:getValue(t,e)});return handleBreakpoints(e,e.gap,styleFromPropValue)}return null};gap.propTypes={},gap.filterProps=["gap"];var columnGap=e=>{if(void 0!==e.columnGap&&null!==e.columnGap){const t=createUnaryUnit(e.theme,"spacing",8,"columnGap"),styleFromPropValue=e=>({columnGap:getValue(t,e)});return handleBreakpoints(e,e.columnGap,styleFromPropValue)}return null};columnGap.propTypes={},columnGap.filterProps=["columnGap"];var rowGap=e=>{if(void 0!==e.rowGap&&null!==e.rowGap){const t=createUnaryUnit(e.theme,"spacing",8,"rowGap"),styleFromPropValue=e=>({rowGap:getValue(t,e)});return handleBreakpoints(e,e.rowGap,styleFromPropValue)}return null};function paletteTransform(e,t){return"grey"===t?t:e}function sizingTransform(e){return e<=1&&0!==e?100*e+"%":e}rowGap.propTypes={},rowGap.filterProps=["rowGap"],compose(gap,columnGap,rowGap,style$1({prop:"gridColumn"}),style$1({prop:"gridRow"}),style$1({prop:"gridAutoFlow"}),style$1({prop:"gridAutoColumns"}),style$1({prop:"gridAutoRows"}),style$1({prop:"gridTemplateColumns"}),style$1({prop:"gridTemplateRows"}),style$1({prop:"gridTemplateAreas"}),style$1({prop:"gridArea"})),compose(style$1({prop:"color",themeKey:"palette",transform:paletteTransform}),style$1({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:paletteTransform}),style$1({prop:"backgroundColor",themeKey:"palette",transform:paletteTransform}));var Hs=style$1({prop:"width",transform:sizingTransform}),maxWidth=e=>{if(void 0!==e.maxWidth&&null!==e.maxWidth){const styleFromPropValue=t=>{const n=e.theme?.breakpoints?.values?.[t]||Ss[t];return n?"px"!==e.theme?.breakpoints?.unit?{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:sizingTransform(t)}};return handleBreakpoints(e,e.maxWidth,styleFromPropValue)}return null};maxWidth.filterProps=["maxWidth"];var Us=style$1({prop:"minWidth",transform:sizingTransform}),qs=style$1({prop:"height",transform:sizingTransform}),Ks=style$1({prop:"maxHeight",transform:sizingTransform}),Zs=style$1({prop:"minHeight",transform:sizingTransform}),Ys=(style$1({prop:"size",cssProperty:"width",transform:sizingTransform}),style$1({prop:"size",cssProperty:"height",transform:sizingTransform}),compose(Hs,maxWidth,Us,qs,Ks,Zs,style$1({prop:"boxSizing"})),{border:{themeKey:"borders",transform:borderTransform},borderTop:{themeKey:"borders",transform:borderTransform},borderRight:{themeKey:"borders",transform:borderTransform},borderBottom:{themeKey:"borders",transform:borderTransform},borderLeft:{themeKey:"borders",transform:borderTransform},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:borderTransform},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:borderRadius},color:{themeKey:"palette",transform:paletteTransform},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:paletteTransform},backgroundColor:{themeKey:"palette",transform:paletteTransform},p:{style:padding},pt:{style:padding},pr:{style:padding},pb:{style:padding},pl:{style:padding},px:{style:padding},py:{style:padding},padding:{style:padding},paddingTop:{style:padding},paddingRight:{style:padding},paddingBottom:{style:padding},paddingLeft:{style:padding},paddingX:{style:padding},paddingY:{style:padding},paddingInline:{style:padding},paddingInlineStart:{style:padding},paddingInlineEnd:{style:padding},paddingBlock:{style:padding},paddingBlockStart:{style:padding},paddingBlockEnd:{style:padding},m:{style:margin},mt:{style:margin},mr:{style:margin},mb:{style:margin},ml:{style:margin},mx:{style:margin},my:{style:margin},margin:{style:margin},marginTop:{style:margin},marginRight:{style:margin},marginBottom:{style:margin},marginLeft:{style:margin},marginX:{style:margin},marginY:{style:margin},marginInline:{style:margin},marginInlineStart:{style:margin},marginInlineEnd:{style:margin},marginBlock:{style:margin},marginBlockStart:{style:margin},marginBlockEnd:{style:margin},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:gap},rowGap:{style:rowGap},columnGap:{style:columnGap},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:sizingTransform},maxWidth:{style:maxWidth},minWidth:{transform:sizingTransform},height:{transform:sizingTransform},maxHeight:{transform:sizingTransform},minHeight:{transform:sizingTransform},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}}),Xs={};function unstable_createStyleFunctionSx(){function styleFunctionSx(e){if(!e.sx)return null;const{sx:t,theme:n=Xs,nested:o}=e,a=n.unstable_sxConfig??Ys,i={sx:null,theme:n,nested:!0};function process(t){let s=t;if("function"==typeof t)s=t(n);else if("object"!=typeof t)return t;if(!s)return null;const l=n.breakpoints??xs,c=createEmptyBreakpointObject(l);for(const o in s){const t=callIfFn(s[o],n);null!=t&&("object"==typeof t?a[o]?setThemeValue(c,o,t,n,a):hasBreakpoint(l,t)?iterateBreakpoints(c,e.theme,t,(e,t)=>{c[e][o]=t}):(i.sx=t,c[o]=styleFunctionSx(i)):setThemeValue(c,o,t,n,a))}return!o&&n.modularCssLayers?{"@layer sx":sortContainerQueries(n,removeUnusedBreakpoints(l,c))}:sortContainerQueries(n,removeUnusedBreakpoints(l,c))}return Array.isArray(t)?t.map(process):process(t)}return styleFunctionSx.filterProps=["sx"],styleFunctionSx}var Js=unstable_createStyleFunctionSx();function setThemeValue(e,t,n,o,a){const i=a[t];if(!i)return void(e[t]=n);if(null==n)return;const{themeKey:s}=i;if("typography"===s&&"inherit"===n)return void(e[t]=n);const{style:l}=i;if(l)return void fastDeepAssign(e,l({[t]:n,theme:o}));const{cssProperty:c=t,transform:d}=i,u=getPath(o,s);iterateBreakpoints(e,o,n,(n,o)=>{const a=getStyleValue2(u,d,o,t);!1===c?fastDeepAssign(n?e[n]:e,a):n?e[n][c]=a:e[c]=a})}function callIfFn(e,t){return"function"==typeof e?e(t):e}function applyStyles$1(e,t){const n=this;if(n.vars){if(!n.colorSchemes?.[e]||"function"!=typeof n.getColorSchemeSelector)return{};let o=n.getColorSchemeSelector(e);return"&"===o?t:((o.includes("data-")||o.includes("."))&&(o=`*:where(${o.replace(/\s*&$/,"")}) &`),{[o]:t})}return n.palette.mode===e?t:{}}function createTheme$1(e={},...t){const{breakpoints:n={},palette:o={},spacing:a,shape:i={},...s}=e;let l=deepmerge({breakpoints:createBreakpoints(n),direction:"ltr",components:{},palette:{mode:"light",...o},spacing:createSpacing(a),shape:{...vs,...i}},s);return l=cssContainerQueries(l),l.applyStyles=applyStyles$1,l=t.reduce((e,t)=>deepmerge(e,t),l),l.unstable_sxConfig={...Ys,...s?.unstable_sxConfig},l.unstable_sx=function(e){return Js({sx:e,theme:this})},l.internal_cache={},l}function isObjectEmpty$1(e){return 0===Object.keys(e).length}function useTheme$3(e=null){const t=c.useContext(Ji);return!t||isObjectEmpty$1(t)?e:t}var Qs=createTheme$1();function useTheme$2(e=Qs){return useTheme$3(e)}function wrapGlobalLayer(e){const t=internal_serializeStyles(e);return e!==t&&t.styles?(t.styles.match(/^@layer\s+[^{]*$/)||(t.styles=`@layer global{${t.styles}}`),t):e}function GlobalStyles$1({styles:e,themeId:t,defaultTheme:n={}}){const o=useTheme$2(n),a=t&&o[t]||o;let i="function"==typeof e?e(a):e;return a.modularCssLayers&&(i=Array.isArray(i)?i.map(e=>wrapGlobalLayer("function"==typeof e?e(a):e)):wrapGlobalLayer(i)),(0,ps.jsx)(GlobalStyles$2,{styles:i})}var defaultGenerator=e=>e,el=(()=>{let e=defaultGenerator;return{configure(t){e=t},generate:t=>e(t),reset(){e=defaultGenerator}}})();function r(e){var t,n,o="";if("string"==typeof e||"number"==typeof e)o+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=r(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function clsx(){for(var e,t,n=0,o="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=r(e))&&(o&&(o+=" "),o+=t);return o}function createBox(e={}){const{themeId:t,defaultTheme:n,defaultClassName:o="MuiBox-root",generateClassName:a}=e,i=styled$1("div",{shouldForwardProp:e=>"theme"!==e&&"sx"!==e&&"as"!==e})(Js);return c.forwardRef(function(e,s){const l=useTheme$2(n),{className:c,component:d="div",...u}=e;return(0,ps.jsx)(i,{as:d,ref:s,className:clsx(c,a?a(o):o),theme:t&&l[t]||l,...u})})}var tl={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function generateUtilityClass(e,t,n="Mui"){const o=tl[t];return o?`${n}-${o}`:`${el.generate(e)}-${t}`}function generateUtilityClasses(e,t,n="Mui"){const o={};return t.forEach(t=>{o[t]=generateUtilityClass(e,t,n)}),o}function preprocessStyles(e){const{variants:t,...n}=e,o={variants:t,style:internal_serializeStyles(n),isProcessed:!0};return o.style===n||t&&t.forEach(e=>{"function"!=typeof e.style&&(e.style=internal_serializeStyles(e.style))}),o}var rl=createTheme$1();function shouldForwardProp(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}function shallowLayer(e,t){return t&&e&&"object"==typeof e&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function defaultOverridesResolver(e){return e?(t,n)=>n[e]:null}function attachTheme(e,t,n){e.theme=isObjectEmpty$2(e.theme)?n:e.theme[t]||e.theme}function processStyle(e,t,n){const o="function"==typeof t?t(e):t;if(Array.isArray(o))return o.flatMap(t=>processStyle(e,t,n));if(Array.isArray(o?.variants)){let t;if(o.isProcessed)t=n?shallowLayer(o.style,n):o.style;else{const{variants:e,...a}=o;t=n?shallowLayer(internal_serializeStyles(a),n):a}return processStyleVariants(e,o.variants,[t],n)}return o?.isProcessed?n?shallowLayer(internal_serializeStyles(o.style),n):o.style:n?shallowLayer(internal_serializeStyles(o),n):o}function processStyleVariants(e,t,n=[],o=void 0){let a;e:for(let i=0;i<t.length;i+=1){const s=t[i];if("function"==typeof s.props){if(a??={...e,...e.ownerState,ownerState:e.ownerState},!s.props(a))continue}else for(const t in s.props)if(e[t]!==s.props[t]&&e.ownerState?.[t]!==s.props[t])continue e;"function"==typeof s.style?(a??={...e,...e.ownerState,ownerState:e.ownerState},n.push(o?shallowLayer(internal_serializeStyles(s.style(a)),o):s.style(a))):n.push(o?shallowLayer(internal_serializeStyles(s.style),o):s.style)}return n}function createStyled(e={}){const{themeId:t,defaultTheme:n=rl,rootShouldForwardProp:o=shouldForwardProp,slotShouldForwardProp:a=shouldForwardProp}=e;function styleAttachTheme(e){attachTheme(e,t,n)}const styled=(e,t={})=>{internal_mutateStyles(e,e=>e.filter(e=>e!==Js));const{name:n,slot:i,skipVariantsResolver:s,skipSx:l,overridesResolver:c=defaultOverridesResolver(lowercaseFirstLetter(i)),...d}=t,u=n&&n.startsWith("Mui")||i?"components":"custom",p=void 0!==s?s:i&&"Root"!==i&&"root"!==i||!1,m=l||!1;let h=shouldForwardProp;"Root"===i||"root"===i?h=o:i?h=a:isStringTag(e)&&(h=void 0);const g=styled$1(e,{shouldForwardProp:h,label:generateStyledLabel(n,i),...d}),transformStyle=e=>{if(e.__emotion_real===e)return e;if("function"==typeof e)return function(t){return processStyle(t,e,t.theme.modularCssLayers?u:void 0)};if(isPlainObject$1(e)){const t=preprocessStyles(e);return function(e){return t.variants?processStyle(e,t,e.theme.modularCssLayers?u:void 0):e.theme.modularCssLayers?shallowLayer(t.style,u):t.style}}return e},muiStyledResolver=(...t)=>{const o=[],a=t.map(transformStyle),i=[];if(o.push(styleAttachTheme),n&&c&&i.push(function(e){const t=e.theme.components?.[n]?.styleOverrides;if(!t)return null;const o={};for(const n in t)o[n]=processStyle(e,t[n],e.theme.modularCssLayers?"theme":void 0);return c(e,o)}),n&&!p&&i.push(function(e){const t=e.theme?.components?.[n]?.variants;return t?processStyleVariants(e,t,[],e.theme.modularCssLayers?"theme":void 0):null}),m||i.push(Js),Array.isArray(a[0])){const e=a.shift(),t=new Array(o.length).fill(""),n=new Array(i.length).fill("");let s;s=[...t,...e,...n],s.raw=[...t,...e.raw,...n],o.unshift(s)}const s=g(...o,...a,...i);return e.muiName&&(s.muiName=e.muiName),s};return g.withConfig&&(muiStyledResolver.withConfig=g.withConfig),muiStyledResolver};return styled}function generateStyledLabel(e,t){let n;return n}function isStringTag(e){return"string"==typeof e&&e.charCodeAt(0)>96}function lowercaseFirstLetter(e){return e?e.charAt(0).toLowerCase()+e.slice(1):e}function resolveProps(e,t,n=!1){const o={...t};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const i=a;if("components"===i||"slots"===i)o[i]={...e[i],...o[i]};else if("componentsProps"===i||"slotProps"===i){const a=e[i],s=t[i];if(s)if(a){o[i]={...s};for(const e in a)if(Object.prototype.hasOwnProperty.call(a,e)){const t=e;o[i][t]=resolveProps(a[t],s[t],n)}}else o[i]=s;else o[i]=a||{}}else"className"===i&&n&&void 0!==t.className?o.className=clsx(e?.className,t?.className):"style"===i&&n&&t.style?o.style={...e?.style,...t?.style}:void 0===o[i]&&(o[i]=e[i])}return o}var nl="undefined"!=typeof window?c.useLayoutEffect:c.useEffect;function clamp$1(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function clampWrapper(e,t=0,n=1){return clamp$1(e,t,n)}function hexToRgb(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(t);return n&&1===n[0].length&&(n=n.map(e=>e+e)),n?`rgb${4===n.length?"a":""}(${n.map((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3).join(", ")})`:""}function decomposeColor(e){if(e.type)return e;if("#"===e.charAt(0))return decomposeColor(hexToRgb(e));const t=e.indexOf("("),n=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(n))throw new Error(formatMuiErrorMessage(9,e));let o,a=e.substring(t+1,e.length-1);if("color"===n){if(a=a.split(" "),o=a.shift(),4===a.length&&"/"===a[3].charAt(0)&&(a[3]=a[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(o))throw new Error(formatMuiErrorMessage(10,o))}else a=a.split(",");return a=a.map(e=>parseFloat(e)),{type:n,values:a,colorSpace:o}}var colorChannel=e=>{const t=decomposeColor(e);return t.values.slice(0,3).map((e,n)=>t.type.includes("hsl")&&0!==n?`${e}%`:e).join(" ")},private_safeColorChannel=(e,t)=>{try{return colorChannel(e)}catch(n){return e}};function recomposeColor(e){const{type:t,colorSpace:n}=e;let{values:o}=e;return t.includes("rgb")?o=o.map((e,t)=>t<3?parseInt(e,10):e):t.includes("hsl")&&(o[1]=`${o[1]}%`,o[2]=`${o[2]}%`),o=t.includes("color")?`${n} ${o.join(" ")}`:`${o.join(", ")}`,`${t}(${o})`}function hslToRgb(e){e=decomposeColor(e);const{values:t}=e,n=t[0],o=t[1]/100,a=t[2]/100,i=o*Math.min(a,1-a),f=(e,t=(e+n/30)%12)=>a-i*Math.max(Math.min(t-3,9-t,1),-1);let s="rgb";const l=[Math.round(255*f(0)),Math.round(255*f(8)),Math.round(255*f(4))];return"hsla"===e.type&&(s+="a",l.push(t[3])),recomposeColor({type:s,values:l})}function getLuminance(e){let t="hsl"===(e=decomposeColor(e)).type||"hsla"===e.type?decomposeColor(hslToRgb(e)).values:e.values;return t=t.map(t=>("color"!==e.type&&(t/=255),t<=.03928?t/12.92:((t+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function getContrastRatio(e,t){const n=getLuminance(e),o=getLuminance(t);return(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function alpha(e,t){return e=decomposeColor(e),t=clampWrapper(t),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,recomposeColor(e)}function private_safeAlpha(e,t,n){try{return alpha(e,t)}catch(o){return e}}function darken(e,t){if(e=decomposeColor(e),t=clampWrapper(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let n=0;n<3;n+=1)e.values[n]*=1-t;return recomposeColor(e)}function private_safeDarken(e,t,n){try{return darken(e,t)}catch(o){return e}}function lighten(e,t){if(e=decomposeColor(e),t=clampWrapper(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let n=0;n<3;n+=1)e.values[n]+=(255-e.values[n])*t;else if(e.type.includes("color"))for(let n=0;n<3;n+=1)e.values[n]+=(1-e.values[n])*t;return recomposeColor(e)}function private_safeLighten(e,t,n){try{return lighten(e,t)}catch(o){return e}}function emphasize(e,t=.15){return getLuminance(e)>.5?darken(e,t):lighten(e,t)}function private_safeEmphasize(e,t,n){try{return emphasize(e,t)}catch(o){return e}}var ol=c.createContext(null);function useTheme$1(){return c.useContext(ol)}var al="function"==typeof Symbol&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__";function mergeOuterLocalTheme(e,t){return"function"==typeof t?t(e):{...e,...t}}function ThemeProvider$2(e){const{children:t,theme:n}=e,o=useTheme$1(),a=c.useMemo(()=>{const e=null===o?{...n}:mergeOuterLocalTheme(o,n);return null!=e&&(e[al]=null!==o),e},[n,o]);return(0,ps.jsx)(ol.Provider,{value:a,children:t})}var il=c.createContext();function RtlProvider({value:e,...t}){return(0,ps.jsx)(il.Provider,{value:e??!0,...t})}var useRtl=()=>c.useContext(il)??!1,sl=c.createContext(void 0);function DefaultPropsProvider({value:e,children:t}){return(0,ps.jsx)(sl.Provider,{value:e,children:t})}function getThemeProps(e){const{theme:t,name:n,props:o}=e;if(!t||!t.components||!t.components[n])return o;const a=t.components[n];return a.defaultProps?resolveProps(a.defaultProps,o,t.components.mergeClassNameAndStyle):a.styleOverrides||a.variants?o:resolveProps(a,o,t.components.mergeClassNameAndStyle)}function useDefaultProps$1({props:e,name:t}){return getThemeProps({props:e,name:t,theme:{components:c.useContext(sl)}})}var ll=0;function useGlobalId(e){const[t,n]=c.useState(e),o=e||t;return c.useEffect(()=>{null==t&&n(`mui-${ll+=1}`)},[t]),o}var cl={...c}.useId;function useId(e){if(void 0!==cl){const t=cl();return e??t}return useGlobalId(e)}function useLayerOrder(e){const t=useTheme$3(),n=useId()||"",{modularCssLayers:o}=e;let a="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return a=o&&null===t?"string"==typeof o?o.replace(/mui(?!\.)/g,a):`@layer ${a};`:"",nl(()=>{const e=document.querySelector("head");if(!e)return;const t=e.firstChild;if(a){if(t&&t.hasAttribute?.("data-mui-layer-order")&&t.getAttribute("data-mui-layer-order")===n)return;const o=document.createElement("style");o.setAttribute("data-mui-layer-order",n),o.textContent=a,e.prepend(o)}else e.querySelector(`style[data-mui-layer-order="${n}"]`)?.remove()},[a,n]),a?(0,ps.jsx)(GlobalStyles$1,{styles:a}):null}var dl={};function useThemeScoping(e,t,n,o=!1){return c.useMemo(()=>{const a=e&&t[e]||t;if("function"==typeof n){const i=n(a),s=e?{...t,[e]:i}:i;return o?()=>s:s}return e?{...t,[e]:n}:{...t,...n}},[e,t,n,o])}function ThemeProvider$1(e){const{children:t,theme:n,themeId:o}=e,a=useTheme$3(dl),i=useTheme$1()||dl,s=useThemeScoping(o,a,n),l=useThemeScoping(o,i,n,!0),c="rtl"===(o?s[o]:s).direction,d=useLayerOrder(s);return(0,ps.jsx)(ThemeProvider$2,{theme:l,children:(0,ps.jsx)(Ji.Provider,{value:s,children:(0,ps.jsx)(RtlProvider,{value:c,children:(0,ps.jsxs)(DefaultPropsProvider,{value:o?s[o].components:s.components,children:[d,t]})})})})}var ul={theme:void 0};function unstable_memoTheme(e){let t,n;return function(o){let a=t;return void 0!==a&&o.theme===n||(ul.theme=o.theme,a=preprocessStyles(e(ul)),t=a,n=o.theme),a}}var pl="mode",ml="color-scheme",hl="data-color-scheme";function InitColorSchemeScript(e){const{defaultMode:t="system",defaultLightColorScheme:n="light",defaultDarkColorScheme:o="dark",modeStorageKey:a=pl,colorSchemeStorageKey:i=ml,attribute:s=hl,colorSchemeNode:l="document.documentElement",nonce:c}=e||{};let d="",u=s;if("class"===s&&(u=".%s"),"data"===s&&(u="[data-%s]"),u.startsWith(".")){const e=u.substring(1);d+=`${l}.classList.remove('${e}'.replace('%s', light), '${e}'.replace('%s', dark));\n ${l}.classList.add('${e}'.replace('%s', colorScheme));`}const p=u.match(/\[([^[\]]+)\]/);if(p){const[e,t]=p[1].split("=");t||(d+=`${l}.removeAttribute('${e}'.replace('%s', light));\n ${l}.removeAttribute('${e}'.replace('%s', dark));`),d+=`\n ${l}.setAttribute('${e}'.replace('%s', colorScheme), ${t?`${t}.replace('%s', colorScheme)`:'""'});`}else".%s"!==u&&(d+=`${l}.setAttribute('${u}', colorScheme);`);return(0,ps.jsx)("script",{suppressHydrationWarning:!0,nonce:"undefined"==typeof window?c:"",dangerouslySetInnerHTML:{__html:`(function() {\ntry {\n let colorScheme = '';\n const mode = localStorage.getItem('${a}') || '${t}';\n const dark = localStorage.getItem('${i}-dark') || '${o}';\n const light = localStorage.getItem('${i}-light') || '${n}';\n if (mode === 'system') {\n // handle system mode\n const mql = window.matchMedia('(prefers-color-scheme: dark)');\n if (mql.matches) {\n colorScheme = dark\n } else {\n colorScheme = light\n }\n }\n if (mode === 'light') {\n colorScheme = light;\n }\n if (mode === 'dark') {\n colorScheme = dark;\n }\n if (colorScheme) {\n ${d}\n }\n} catch(e){}})();`}},"mui-color-scheme-init")}function noop$3(){}var localStorageManager=({key:e,storageWindow:t})=>(t||"undefined"==typeof window||(t=window),{get(n){if("undefined"==typeof window)return;if(!t)return n;let o;try{o=t.localStorage.getItem(e)}catch{}return o||n},set:n=>{if(t)try{t.localStorage.setItem(e,n)}catch{}},subscribe:n=>{if(!t)return noop$3;const listener=t=>{const o=t.newValue;t.key===e&&n(o)};return t.addEventListener("storage",listener),()=>{t.removeEventListener("storage",listener)}}});function noop$2(){}function getSystemMode(e){if("undefined"!=typeof window&&"function"==typeof window.matchMedia&&"system"===e)return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function processState(e,t){return"light"===e.mode||"system"===e.mode&&"light"===e.systemMode?t("light"):"dark"===e.mode||"system"===e.mode&&"dark"===e.systemMode?t("dark"):void 0}function getColorScheme(e){return processState(e,t=>"light"===t?e.lightColorScheme:"dark"===t?e.darkColorScheme:void 0)}function useCurrentColorScheme(e){const{defaultMode:t="light",defaultLightColorScheme:n,defaultDarkColorScheme:o,supportedColorSchemes:a=[],modeStorageKey:i=pl,colorSchemeStorageKey:s=ml,storageWindow:l=("undefined"==typeof window?void 0:window),storageManager:d=localStorageManager,noSsr:u=!1}=e,p=a.join(","),m=a.length>1,h=c.useMemo(()=>d?.({key:i,storageWindow:l}),[d,i,l]),g=c.useMemo(()=>d?.({key:`${s}-light`,storageWindow:l}),[d,s,l]),y=c.useMemo(()=>d?.({key:`${s}-dark`,storageWindow:l}),[d,s,l]),[b,v]=c.useState(()=>{const e=h?.get(t)||t,a=g?.get(n)||n,i=y?.get(o)||o;return{mode:e,systemMode:getSystemMode(e),lightColorScheme:a,darkColorScheme:i}}),[w,S]=c.useState(u||!m);c.useEffect(()=>{S(!0)},[]);const x=getColorScheme(b),I=c.useCallback(e=>{v(n=>{if(e===n.mode)return n;const o=e??t;return h?.set(o),{...n,mode:o,systemMode:getSystemMode(o)}})},[h,t]),C=c.useCallback(e=>{e?"string"==typeof e?e&&!p.includes(e)?console.error(`\`${e}\` does not exist in \`theme.colorSchemes\`.`):v(t=>{const n={...t};return processState(t,t=>{"light"===t&&(g?.set(e),n.lightColorScheme=e),"dark"===t&&(y?.set(e),n.darkColorScheme=e)}),n}):v(t=>{const a={...t},i=null===e.light?n:e.light,s=null===e.dark?o:e.dark;return i&&(p.includes(i)?(a.lightColorScheme=i,g?.set(i)):console.error(`\`${i}\` does not exist in \`theme.colorSchemes\`.`)),s&&(p.includes(s)?(a.darkColorScheme=s,y?.set(s)):console.error(`\`${s}\` does not exist in \`theme.colorSchemes\`.`)),a}):v(e=>(g?.set(n),y?.set(o),{...e,lightColorScheme:n,darkColorScheme:o}))},[p,g,y,n,o]),E=c.useCallback(e=>{"system"===b.mode&&v(t=>{const n=e?.matches?"dark":"light";return t.systemMode===n?t:{...t,systemMode:n}})},[b.mode]),R=c.useRef(E);return R.current=E,c.useEffect(()=>{if("function"!=typeof window.matchMedia||!m)return;const handler=(...e)=>R.current(...e),e=window.matchMedia("(prefers-color-scheme: dark)");return e.addListener(handler),handler(e),()=>{e.removeListener(handler)}},[m]),c.useEffect(()=>{if(m){const e=h?.subscribe(e=>{e&&!["light","dark","system"].includes(e)||I(e||t)})||noop$2,n=g?.subscribe(e=>{e&&!p.match(e)||C({light:e})})||noop$2,o=y?.subscribe(e=>{e&&!p.match(e)||C({dark:e})})||noop$2;return()=>{e(),n(),o()}}},[C,I,p,t,l,m,h,g,y]),{...b,mode:w?b.mode:void 0,systemMode:w?b.systemMode:void 0,colorScheme:w?x:void 0,setMode:I,setColorScheme:C}}var gl="*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function createCssVarsProvider(e){const{themeId:t,theme:n={},modeStorageKey:o=pl,colorSchemeStorageKey:a=ml,disableTransitionOnChange:i=!1,defaultColorScheme:s,resolveTheme:l}=e,d={allColorSchemes:[],colorScheme:void 0,darkColorScheme:void 0,lightColorScheme:void 0,mode:void 0,setColorScheme:()=>{},setMode:()=>{},systemMode:void 0},u=c.createContext(void 0),useColorScheme=()=>c.useContext(u)||d,p={},m={};function CssVarsProvider(e){const{children:d,theme:h,modeStorageKey:g=o,colorSchemeStorageKey:y=a,disableTransitionOnChange:b=i,storageManager:v,storageWindow:w=("undefined"==typeof window?void 0:window),documentNode:S=("undefined"==typeof document?void 0:document),colorSchemeNode:x=("undefined"==typeof document?void 0:document.documentElement),disableNestedContext:I=!1,disableStyleSheetGeneration:C=!1,defaultMode:E="system",forceThemeRerender:R=!1,noSsr:k}=e,T=c.useRef(!1),M=useTheme$1(),$=c.useContext(u),N=!!$&&!I,P=c.useMemo(()=>h||("function"==typeof n?n():n),[h]),O=P[t],j=O||P,{colorSchemes:F=p,components:L=m,cssVarPrefix:D}=j,B=Object.keys(F).filter(e=>!!F[e]).join(","),G=c.useMemo(()=>B.split(","),[B]),W="string"==typeof s?s:s.light,V="string"==typeof s?s:s.dark,{mode:H,setMode:U,systemMode:q,lightColorScheme:K,darkColorScheme:Z,colorScheme:Y,setColorScheme:X}=useCurrentColorScheme({supportedColorSchemes:G,defaultLightColorScheme:W,defaultDarkColorScheme:V,modeStorageKey:g,colorSchemeStorageKey:y,defaultMode:F[W]&&F[V]?E:F[j.defaultColorScheme]?.palette?.mode||j.palette?.mode,storageManager:v,storageWindow:w,noSsr:k});let J=H,Q=Y;N&&(J=$.mode,Q=$.colorScheme);let ee=Q||j.defaultColorScheme;j.vars&&!R&&(ee=j.defaultColorScheme);const te=c.useMemo(()=>{const e=j.generateThemeVars?.()||j.vars,t={...j,components:L,colorSchemes:F,cssVarPrefix:D,vars:e};if("function"==typeof t.generateSpacing&&(t.spacing=t.generateSpacing()),ee){const e=F[ee];e&&"object"==typeof e&&Object.keys(e).forEach(n=>{e[n]&&"object"==typeof e[n]?t[n]={...t[n],...e[n]}:t[n]=e[n]})}return l?l(t):t},[j,ee,L,F,D]),re=j.colorSchemeSelector;nl(()=>{if(Q&&x&&re&&"media"!==re){const e=re;let t=re;if("class"===e&&(t=".%s"),"data"===e&&(t="[data-%s]"),e?.startsWith("data-")&&!e.includes("%s")&&(t=`[${e}="%s"]`),t.startsWith("."))x.classList.remove(...G.map(e=>t.substring(1).replace("%s",e))),x.classList.add(t.substring(1).replace("%s",Q));else{const e=t.replace("%s",Q).match(/\[([^\]]+)\]/);if(e){const[t,n]=e[1].split("=");n||G.forEach(e=>{x.removeAttribute(t.replace(Q,e))}),x.setAttribute(t,n?n.replace(/"|'/g,""):"")}else x.setAttribute(t,Q)}}},[Q,re,x,G]),c.useEffect(()=>{let e;if(b&&T.current&&S){const t=S.createElement("style");t.appendChild(S.createTextNode(gl)),S.head.appendChild(t),window.getComputedStyle(S.body),e=setTimeout(()=>{S.head.removeChild(t)},1)}return()=>{clearTimeout(e)}},[Q,b,S]),c.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);const ne=c.useMemo(()=>({allColorSchemes:G,colorScheme:Q,darkColorScheme:Z,lightColorScheme:K,mode:J,setColorScheme:X,setMode:U,systemMode:q}),[G,Q,Z,K,J,X,U,q,te.colorSchemeSelector]);let oe=!0;(C||!1===j.cssVariables||N&&M?.cssVarPrefix===D)&&(oe=!1);const ae=(0,ps.jsxs)(c.Fragment,{children:[(0,ps.jsx)(ThemeProvider$1,{themeId:O?t:void 0,theme:te,children:d}),oe&&(0,ps.jsx)(GlobalStyles$2,{styles:te.generateStyleSheets?.()||[]})]});return N?ae:(0,ps.jsx)(u.Provider,{value:ne,children:ae})}const h="string"==typeof s?s:s.light,g="string"==typeof s?s:s.dark;return{CssVarsProvider,useColorScheme,getInitColorSchemeScript:e=>InitColorSchemeScript({colorSchemeStorageKey:a,defaultLightColorScheme:h,defaultDarkColorScheme:g,modeStorageKey:o,...e})}}function createGetCssVar$1(e=""){function appendVar(...t){if(!t.length)return"";const n=t[0];return"string"!=typeof n||n.match(/(#|\(|\)|(-?(\d*\.)?\d+)(px|em|%|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc))|^(-?(\d*\.)?\d+)$|(\d+ \d+ \d+)/)?`, ${n}`:`, var(--${e?`${e}-`:""}${n}${appendVar(...t.slice(1))})`}return(t,...n)=>`var(--${e?`${e}-`:""}${t}${appendVar(...n)})`}var assignNestedKeys=(e,t,n,o=[])=>{let a=e;t.forEach((e,i)=>{i===t.length-1?Array.isArray(a)?a[Number(e)]=n:a&&"object"==typeof a&&(a[e]=n):a&&"object"==typeof a&&(a[e]||(a[e]=o.includes(e)?[]:{}),a=a[e])})},walkObjectDeep=(e,t,n)=>{function recurse(e,o=[],a=[]){Object.entries(e).forEach(([e,i])=>{(!n||n&&!n([...o,e]))&&null!=i&&("object"==typeof i&&Object.keys(i).length>0?recurse(i,[...o,e],Array.isArray(i)?[...a,e]:a):t([...o,e],i,a))})}recurse(e)},getCssValue=(e,t)=>"number"==typeof t?["lineHeight","fontWeight","opacity","zIndex"].some(t=>e.includes(t))||e[e.length-1].toLowerCase().includes("opacity")?t:`${t}px`:t;function cssVarsParser(e,t){const{prefix:n,shouldSkipGeneratingVar:o}=t||{},a={},i={},s={};return walkObjectDeep(e,(e,t,l)=>{if(!("string"!=typeof t&&"number"!=typeof t||o&&o(e,t))){const o=`--${n?`${n}-`:""}${e.join("-")}`,c=getCssValue(e,t);Object.assign(a,{[o]:c}),assignNestedKeys(i,e,`var(${o})`,l),assignNestedKeys(s,e,`var(${o}, ${c})`,l)}},e=>"vars"===e[0]),{css:a,vars:i,varsWithDefaults:s}}function prepareCssVars(e,t={}){const{getSelector:n=defaultGetSelector,disableCssColorScheme:o,colorSchemeSelector:a,enableContrastVars:i}=t,{colorSchemes:s={},components:l,defaultColorScheme:c="light",...d}=e,{vars:u,css:p,varsWithDefaults:m}=cssVarsParser(d,t);let h=m;const g={},{[c]:y,...b}=s;if(Object.entries(b||{}).forEach(([e,n])=>{const{vars:o,css:a,varsWithDefaults:i}=cssVarsParser(n,t);h=deepmerge(h,i),g[e]={css:a,vars:o}}),y){const{css:e,vars:n,varsWithDefaults:o}=cssVarsParser(y,t);h=deepmerge(h,o),g[c]={css:e,vars:n}}function defaultGetSelector(t,n){let o=a;if("class"===a&&(o=".%s"),"data"===a&&(o="[data-%s]"),a?.startsWith("data-")&&!a.includes("%s")&&(o=`[${a}="%s"]`),t){if("media"===o)return e.defaultColorScheme===t?":root":{[`@media (prefers-color-scheme: ${s[t]?.palette?.mode||t})`]:{":root":n}};if(o)return e.defaultColorScheme===t?`:root, ${o.replace("%s",String(t))}`:o.replace("%s",String(t))}return":root"}const generateStyleSheets=()=>{const t=[],a=e.defaultColorScheme||"light";function insertStyleSheet(e,n){Object.keys(n).length&&t.push("string"==typeof e?{[e]:{...n}}:e)}insertStyleSheet(n(void 0,{...p}),p);const{[a]:l,...c}=g;if(l){const{css:e}=l,t=s[a]?.palette?.mode,i=!o&&t?{colorScheme:t,...e}:{...e};insertStyleSheet(n(a,{...i}),i)}return Object.entries(c).forEach(([e,{css:t}])=>{const a=s[e]?.palette?.mode,i=!o&&a?{colorScheme:a,...t}:{...t};insertStyleSheet(n(e,{...i}),i)}),i&&t.push({":root":{"--__l-threshold":"0.7","--__l":"clamp(0, (l / var(--__l-threshold) - 1) * -infinity, 1)","--__a":"clamp(0.87, (l / var(--__l-threshold) - 1) * -infinity, 1)"}}),t};return{vars:h,generateThemeVars:()=>{let e={...u};return Object.entries(g).forEach(([,{vars:t}])=>{e=deepmerge(e,t)}),e},generateStyleSheets}}function createGetColorSchemeSelector(e){return function(t){return"media"===e?`@media (prefers-color-scheme: ${t})`:e?e.startsWith("data-")&&!e.includes("%s")?`[${e}="${t}"] &`:"class"===e?`.${t} &`:"data"===e?`[data-${t}] &`:`${e.replace("%s",t)} &`:"&"}}function composeClasses(e,t,n=void 0){const o={};for(const a in e){const i=e[a];let s="",l=!0;for(let e=0;e<i.length;e+=1){const o=i[e];o&&(s+=(!0===l?"":" ")+t(o),l=!1,n&&n[o]&&(s+=" "+n[o]))}o[a]=s}return o}function isMuiElement(e,t){return c.isValidElement(e)&&-1!==t.indexOf(e.type.muiName??e.type?._payload?.value?.muiName)}var fl="$$material",yl={black:"#000",white:"#fff"},bl={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},vl={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},wl={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},Sl={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},xl={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},Il={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},Cl={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"};function getLight(){return{text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:yl.white,default:yl.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}}}var El=getLight();function getDark(){return{text:{primary:yl.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:yl.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}}}var Rl=getDark();function addLightOrDark(e,t,n,o){const a=o.light||o,i=o.dark||1.5*o;e[t]||(e.hasOwnProperty(n)?e[t]=e[n]:"light"===t?e.light=lighten(e.main,a):"dark"===t&&(e.dark=darken(e.main,i)))}function mixLightOrDark(e,t,n,o,a){const i=a.light||a,s=a.dark||1.5*a;t[n]||(t.hasOwnProperty(o)?t[n]=t[o]:"light"===n?t.light=`color-mix(in ${e}, ${t.main}, #fff ${(100*i).toFixed(0)}%)`:"dark"===n&&(t.dark=`color-mix(in ${e}, ${t.main}, #000 ${(100*s).toFixed(0)}%)`))}function getDefaultPrimary(e="light"){return"dark"===e?{main:xl[200],light:xl[50],dark:xl[400]}:{main:xl[700],light:xl[400],dark:xl[800]}}function getDefaultSecondary(e="light"){return"dark"===e?{main:vl[200],light:vl[50],dark:vl[400]}:{main:vl[500],light:vl[300],dark:vl[700]}}function getDefaultError(e="light"){return"dark"===e?{main:wl[500],light:wl[300],dark:wl[700]}:{main:wl[700],light:wl[400],dark:wl[800]}}function getDefaultInfo(e="light"){return"dark"===e?{main:Il[400],light:Il[300],dark:Il[700]}:{main:Il[700],light:Il[500],dark:Il[900]}}function getDefaultSuccess(e="light"){return"dark"===e?{main:Cl[400],light:Cl[300],dark:Cl[700]}:{main:Cl[800],light:Cl[500],dark:Cl[900]}}function getDefaultWarning(e="light"){return"dark"===e?{main:Sl[400],light:Sl[300],dark:Sl[700]}:{main:"#ed6c02",light:Sl[500],dark:Sl[900]}}function contrastColor(e){return`oklch(from ${e} var(--__l) 0 h / var(--__a))`}function createPalette(e){const{mode:t="light",contrastThreshold:n=3,tonalOffset:o=.2,colorSpace:a,...i}=e,s=e.primary||getDefaultPrimary(t),l=e.secondary||getDefaultSecondary(t),c=e.error||getDefaultError(t),d=e.info||getDefaultInfo(t),u=e.success||getDefaultSuccess(t),p=e.warning||getDefaultWarning(t);function getContrastText(e){return a?contrastColor(e):getContrastRatio(e,Rl.text.primary)>=n?Rl.text.primary:El.text.primary}const augmentColor=({color:e,name:t,mainShade:n=500,lightShade:i=300,darkShade:s=700})=>{if(!(e={...e}).main&&e[n]&&(e.main=e[n]),!e.hasOwnProperty("main"))throw new Error(formatMuiErrorMessage(11,t?` (${t})`:"",n));if("string"!=typeof e.main)throw new Error(formatMuiErrorMessage(12,t?` (${t})`:"",JSON.stringify(e.main)));return a?(mixLightOrDark(a,e,"light",i,o),mixLightOrDark(a,e,"dark",s,o)):(addLightOrDark(e,"light",i,o),addLightOrDark(e,"dark",s,o)),e.contrastText||(e.contrastText=getContrastText(e.main)),e};let m;return"light"===t?m=getLight():"dark"===t&&(m=getDark()),deepmerge({common:{...yl},mode:t,primary:augmentColor({color:s,name:"primary"}),secondary:augmentColor({color:l,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:augmentColor({color:c,name:"error"}),warning:augmentColor({color:p,name:"warning"}),info:augmentColor({color:d,name:"info"}),success:augmentColor({color:u,name:"success"}),grey:bl,contrastThreshold:n,getContrastText,augmentColor,tonalOffset:o,...m},i)}function prepareTypographyVars(e){const t={};return Object.entries(e).forEach(e=>{const[n,o]=e;"object"==typeof o&&(t[n]=`${o.fontStyle?`${o.fontStyle} `:""}${o.fontVariant?`${o.fontVariant} `:""}${o.fontWeight?`${o.fontWeight} `:""}${o.fontStretch?`${o.fontStretch} `:""}${o.fontSize||""}${o.lineHeight?`/${o.lineHeight} `:""}${o.fontFamily||""}`)}),t}function createMixins(e,t){return{toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}},...t}}function round$2(e){return Math.round(1e5*e)/1e5}var kl={textTransform:"uppercase"},Al='"Roboto", "Helvetica", "Arial", sans-serif';function createTypography(e,t){const{fontFamily:n=Al,fontSize:o=14,fontWeightLight:a=300,fontWeightRegular:i=400,fontWeightMedium:s=500,fontWeightBold:l=700,htmlFontSize:c=16,allVariants:d,pxToRem:u,...p}="function"==typeof t?t(e):t,m=o/14,h=u||(e=>e/c*m+"rem"),buildVariant=(e,t,o,a,i)=>({fontFamily:n,fontWeight:e,fontSize:h(t),lineHeight:o,...n===Al?{letterSpacing:`${round$2(a/t)}em`}:{},...i,...d});return deepmerge({htmlFontSize:c,pxToRem:h,fontFamily:n,fontSize:o,fontWeightLight:a,fontWeightRegular:i,fontWeightMedium:s,fontWeightBold:l,h1:buildVariant(a,96,1.167,-1.5),h2:buildVariant(a,60,1.2,-.5),h3:buildVariant(i,48,1.167,0),h4:buildVariant(i,34,1.235,.25),h5:buildVariant(i,24,1.334,0),h6:buildVariant(s,20,1.6,.15),subtitle1:buildVariant(i,16,1.75,.15),subtitle2:buildVariant(s,14,1.57,.1),body1:buildVariant(i,16,1.5,.15),body2:buildVariant(i,14,1.43,.15),button:buildVariant(s,14,1.75,.4,kl),caption:buildVariant(i,12,1.66,.4),overline:buildVariant(i,12,2.66,1,kl),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},p,{clone:!1})}var Tl=.2,Ml=.14,zl=.12;function createShadow(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,${Tl})`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,${Ml})`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,${zl})`].join(",")}var $l=["none",createShadow(0,2,1,-1,0,1,1,0,0,1,3,0),createShadow(0,3,1,-2,0,2,2,0,0,1,5,0),createShadow(0,3,3,-2,0,3,4,0,0,1,8,0),createShadow(0,2,4,-1,0,4,5,0,0,1,10,0),createShadow(0,3,5,-1,0,5,8,0,0,1,14,0),createShadow(0,3,5,-1,0,6,10,0,0,1,18,0),createShadow(0,4,5,-2,0,7,10,1,0,2,16,1),createShadow(0,5,5,-3,0,8,10,1,0,3,14,2),createShadow(0,5,6,-3,0,9,12,1,0,3,16,2),createShadow(0,6,6,-3,0,10,14,1,0,4,18,3),createShadow(0,6,7,-4,0,11,15,1,0,4,20,3),createShadow(0,7,8,-4,0,12,17,2,0,5,22,4),createShadow(0,7,8,-4,0,13,19,2,0,5,24,4),createShadow(0,7,9,-4,0,14,21,2,0,5,26,4),createShadow(0,8,9,-5,0,15,22,2,0,6,28,5),createShadow(0,8,10,-5,0,16,24,2,0,6,30,5),createShadow(0,8,11,-5,0,17,26,2,0,6,32,5),createShadow(0,9,11,-5,0,18,28,2,0,7,34,6),createShadow(0,9,12,-6,0,19,29,2,0,7,36,6),createShadow(0,10,13,-6,0,20,31,3,0,8,38,7),createShadow(0,10,13,-6,0,21,33,3,0,8,40,7),createShadow(0,10,14,-6,0,22,35,3,0,8,42,7),createShadow(0,11,14,-7,0,23,36,3,0,9,44,8),createShadow(0,11,15,-7,0,24,38,3,0,9,46,8)],Nl={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},Pl={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function formatMs(e){return`${Math.round(e)}ms`}function getAutoHeightDuration(e){if(!e)return 0;const t=e/36;return Math.min(Math.round(10*(4+15*t**.25+t/5)),3e3)}function createTransitions(e){const t={...Nl,...e.easing},n={...Pl,...e.duration},create=(e=["all"],o={})=>{const{duration:a=n.standard,easing:i=t.easeInOut,delay:s=0,...l}=o;return(Array.isArray(e)?e:[e]).map(e=>`${e} ${"string"==typeof a?a:formatMs(a)} ${i} ${"string"==typeof s?s:formatMs(s)}`).join(",")};return{getAutoHeightDuration,create,...e,easing:t,duration:n}}var Ol={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500};function isSerializable(e){return isPlainObject$1(e)||void 0===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||Array.isArray(e)}function stringifyTheme(e={}){const t={...e};function serializeTheme(e){const t=Object.entries(e);for(let n=0;n<t.length;n++){const[o,a]=t[n];!isSerializable(a)||o.startsWith("unstable_")||o.startsWith("internal_")?delete e[o]:isPlainObject$1(a)&&(e[o]={...a},serializeTheme(e[o]))}}return serializeTheme(t),`import { unstable_createBreakpoints as createBreakpoints, createTransitions } from '@mui/material/styles';\n\nconst theme = ${JSON.stringify(t,null,2)};\n\ntheme.breakpoints = createBreakpoints(theme.breakpoints || {});\ntheme.transitions = createTransitions(theme.transitions || {});\n\nexport default theme;`}function coefficientToPercentage(e){return"number"==typeof e?`${(100*e).toFixed(0)}%`:`calc((${e}) * 100%)`}var parseAddition=e=>{if(!Number.isNaN(+e))return+e;const t=e.match(/\d*\.?\d+/g);if(!t)return 0;let n=0;for(let o=0;o<t.length;o+=1)n+=+t[o];return n};function attachColorManipulators(e){Object.assign(e,{alpha(t,n){const o=this||e;return o.colorSpace?`oklch(from ${t} l c h / ${"string"==typeof n?`calc(${n})`:n})`:o.vars?`rgba(${t.replace(/var\(--([^,\s)]+)(?:,[^)]+)?\)+/g,"var(--$1Channel)")} / ${"string"==typeof n?`calc(${n})`:n})`:alpha(t,parseAddition(n))},lighten(t,n){const o=this||e;return o.colorSpace?`color-mix(in ${o.colorSpace}, ${t}, #fff ${coefficientToPercentage(n)})`:lighten(t,n)},darken(t,n){const o=this||e;return o.colorSpace?`color-mix(in ${o.colorSpace}, ${t}, #000 ${coefficientToPercentage(n)})`:darken(t,n)}})}function createThemeNoVars(e={},...t){const{breakpoints:n,mixins:o={},spacing:a,palette:i={},transitions:s={},typography:l={},shape:c,colorSpace:d,...u}=e;if(e.vars&&void 0===e.generateThemeVars)throw new Error(formatMuiErrorMessage(22));const p=createPalette({...i,colorSpace:d}),m=createTheme$1(e);let h=deepmerge(m,{mixins:createMixins(m.breakpoints,o),palette:p,shadows:$l.slice(),typography:createTypography(p,l),transitions:createTransitions(s),zIndex:{...Ol}});return h=deepmerge(h,u),h=t.reduce((e,t)=>deepmerge(e,t),h),h.unstable_sxConfig={...Ys,...u?.unstable_sxConfig},h.unstable_sx=function(e){return Js({sx:e,theme:this})},h.toRuntimeSource=stringifyTheme,attachColorManipulators(h),h}function getOverlayAlpha(e){let t;return t=e<1?5.11916*e**2:4.5*Math.log(e+1)+2,Math.round(10*t)/1e3}var _l=[...Array(25)].map((e,t)=>{if(0===t)return"none";const n=getOverlayAlpha(t);return`linear-gradient(rgba(255 255 255 / ${n}), rgba(255 255 255 / ${n}))`});function getOpacity(e){return{inputPlaceholder:"dark"===e?.5:.42,inputUnderline:"dark"===e?.7:.42,switchTrackDisabled:"dark"===e?.2:.12,switchTrack:"dark"===e?.3:.38}}function getOverlays(e){return"dark"===e?_l:[]}function createColorScheme(e){const{palette:t={mode:"light"},opacity:n,overlays:o,colorSpace:a,...i}=e,s=createPalette({...t,colorSpace:a});return{palette:s,opacity:{...getOpacity(s.mode),...n},overlays:o||getOverlays(s.mode),...i}}function shouldSkipGeneratingVar(e){return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||"palette"===e[0]&&!!e[1]?.match(/(mode|contrastThreshold|tonalOffset)/)}var excludeVariablesFromRoot=e=>[...[...Array(25)].map((t,n)=>`--${e?`${e}-`:""}overlays-${n}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],createGetSelector_default=e=>(t,n)=>{const o=e.rootSelector||":root",a=e.colorSchemeSelector;let i=a;if("class"===a&&(i=".%s"),"data"===a&&(i="[data-%s]"),a?.startsWith("data-")&&!a.includes("%s")&&(i=`[${a}="%s"]`),e.defaultColorScheme===t){if("dark"===t){const a={};return excludeVariablesFromRoot(e.cssVarPrefix).forEach(e=>{a[e]=n[e],delete n[e]}),"media"===i?{[o]:n,"@media (prefers-color-scheme: dark)":{[o]:a}}:i?{[i.replace("%s",t)]:a,[`${o}, ${i.replace("%s",t)}`]:n}:{[o]:{...n,...a}}}if(i&&"media"!==i)return`${o}, ${i.replace("%s",String(t))}`}else if(t){if("media"===i)return{[`@media (prefers-color-scheme: ${String(t)})`]:{[o]:n}};if(i)return i.replace("%s",String(t))}return o};function assignNode(e,t){t.forEach(t=>{e[t]||(e[t]={})})}function setColor(e,t,n){!e[t]&&n&&(e[t]=n)}function toRgb(e){return"string"==typeof e&&e.startsWith("hsl")?hslToRgb(e):e}function setColorChannel(e,t){`${t}Channel`in e||(e[`${t}Channel`]=private_safeColorChannel(toRgb(e[t]),`MUI: Can't create \`palette.${t}Channel\` because \`palette.${t}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().\nTo suppress this warning, you need to explicitly provide the \`palette.${t}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function getSpacingVal(e){return"number"==typeof e?`${e}px`:"string"==typeof e||"function"==typeof e||Array.isArray(e)?e:"8px"}var silent=e=>{try{return e()}catch(t){}},createGetCssVar=(e="mui")=>createGetCssVar$1(e);function attachColorScheme$1(e,t,n,o,a){if(!n)return;n=!0===n?{}:n;const i="dark"===a?"dark":"light";if(!o)return void(t[a]=createColorScheme({...n,palette:{mode:i,...n?.palette},colorSpace:e}));const{palette:s,...l}=createThemeNoVars({...o,palette:{mode:i,...n?.palette},colorSpace:e});return t[a]={...n,palette:s,opacity:{...getOpacity(i),...n?.opacity},overlays:n?.overlays||getOverlays(i)},l}function createThemeWithVars(e={},...t){const{colorSchemes:n={light:!0},defaultColorScheme:o,disableCssColorScheme:a=!1,cssVarPrefix:i="mui",nativeColor:s=!1,shouldSkipGeneratingVar:l=shouldSkipGeneratingVar,colorSchemeSelector:c=(n.light&&n.dark?"media":void 0),rootSelector:d=":root",...u}=e,p=Object.keys(n)[0],m=o||(n.light&&"light"!==p?"light":p),h=createGetCssVar(i),{[m]:g,light:y,dark:b,...v}=n,w={...v};let S,x=g;if(("dark"===m&&!("dark"in n)||"light"===m&&!("light"in n))&&(x=!0),!x)throw new Error(formatMuiErrorMessage(21,m));s&&(S="oklch");const I=attachColorScheme$1(S,w,x,u,m);y&&!w.light&&attachColorScheme$1(S,w,y,void 0,"light"),b&&!w.dark&&attachColorScheme$1(S,w,b,void 0,"dark");let C={defaultColorScheme:m,...I,cssVarPrefix:i,colorSchemeSelector:c,rootSelector:d,getCssVar:h,colorSchemes:w,font:{...prepareTypographyVars(I.typography),...I.font},spacing:getSpacingVal(u.spacing)};Object.keys(C.colorSchemes).forEach(e=>{const t=C.colorSchemes[e].palette,setCssVarColor=e=>{const n=e.split("-"),o=n[1],a=n[2];return h(e,t[o][a])};function colorMix(e,t,n){if(S){let o;return e===private_safeAlpha&&(o=`transparent ${(100*(1-n)).toFixed(0)}%`),e===private_safeDarken&&(o=`#000 ${(100*n).toFixed(0)}%`),e===private_safeLighten&&(o=`#fff ${(100*n).toFixed(0)}%`),`color-mix(in ${S}, ${t}, ${o})`}return e(t,n)}if("light"===t.mode&&(setColor(t.common,"background","#fff"),setColor(t.common,"onBackground","#000")),"dark"===t.mode&&(setColor(t.common,"background","#000"),setColor(t.common,"onBackground","#fff")),assignNode(t,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),"light"===t.mode){setColor(t.Alert,"errorColor",colorMix(private_safeDarken,s?h("palette-error-light"):t.error.light,.6)),setColor(t.Alert,"infoColor",colorMix(private_safeDarken,s?h("palette-info-light"):t.info.light,.6)),setColor(t.Alert,"successColor",colorMix(private_safeDarken,s?h("palette-success-light"):t.success.light,.6)),setColor(t.Alert,"warningColor",colorMix(private_safeDarken,s?h("palette-warning-light"):t.warning.light,.6)),setColor(t.Alert,"errorFilledBg",setCssVarColor("palette-error-main")),setColor(t.Alert,"infoFilledBg",setCssVarColor("palette-info-main")),setColor(t.Alert,"successFilledBg",setCssVarColor("palette-success-main")),setColor(t.Alert,"warningFilledBg",setCssVarColor("palette-warning-main")),setColor(t.Alert,"errorFilledColor",silent(()=>t.getContrastText(t.error.main))),setColor(t.Alert,"infoFilledColor",silent(()=>t.getContrastText(t.info.main))),setColor(t.Alert,"successFilledColor",silent(()=>t.getContrastText(t.success.main))),setColor(t.Alert,"warningFilledColor",silent(()=>t.getContrastText(t.warning.main))),setColor(t.Alert,"errorStandardBg",colorMix(private_safeLighten,s?h("palette-error-light"):t.error.light,.9)),setColor(t.Alert,"infoStandardBg",colorMix(private_safeLighten,s?h("palette-info-light"):t.info.light,.9)),setColor(t.Alert,"successStandardBg",colorMix(private_safeLighten,s?h("palette-success-light"):t.success.light,.9)),setColor(t.Alert,"warningStandardBg",colorMix(private_safeLighten,s?h("palette-warning-light"):t.warning.light,.9)),setColor(t.Alert,"errorIconColor",setCssVarColor("palette-error-main")),setColor(t.Alert,"infoIconColor",setCssVarColor("palette-info-main")),setColor(t.Alert,"successIconColor",setCssVarColor("palette-success-main")),setColor(t.Alert,"warningIconColor",setCssVarColor("palette-warning-main")),setColor(t.AppBar,"defaultBg",setCssVarColor("palette-grey-100")),setColor(t.Avatar,"defaultBg",setCssVarColor("palette-grey-400")),setColor(t.Button,"inheritContainedBg",setCssVarColor("palette-grey-300")),setColor(t.Button,"inheritContainedHoverBg",setCssVarColor("palette-grey-A100")),setColor(t.Chip,"defaultBorder",setCssVarColor("palette-grey-400")),setColor(t.Chip,"defaultAvatarColor",setCssVarColor("palette-grey-700")),setColor(t.Chip,"defaultIconColor",setCssVarColor("palette-grey-700")),setColor(t.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),setColor(t.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),setColor(t.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),setColor(t.LinearProgress,"primaryBg",colorMix(private_safeLighten,s?h("palette-primary-main"):t.primary.main,.62)),setColor(t.LinearProgress,"secondaryBg",colorMix(private_safeLighten,s?h("palette-secondary-main"):t.secondary.main,.62)),setColor(t.LinearProgress,"errorBg",colorMix(private_safeLighten,s?h("palette-error-main"):t.error.main,.62)),setColor(t.LinearProgress,"infoBg",colorMix(private_safeLighten,s?h("palette-info-main"):t.info.main,.62)),setColor(t.LinearProgress,"successBg",colorMix(private_safeLighten,s?h("palette-success-main"):t.success.main,.62)),setColor(t.LinearProgress,"warningBg",colorMix(private_safeLighten,s?h("palette-warning-light"):t.warning.main,.62)),setColor(t.Skeleton,"bg",S?colorMix(private_safeAlpha,s?h("palette-text-primary"):t.text.primary,.11):`rgba(${setCssVarColor("palette-text-primaryChannel")} / 0.11)`),setColor(t.Slider,"primaryTrack",colorMix(private_safeLighten,s?h("palette-primary-main"):t.primary.main,.62)),setColor(t.Slider,"secondaryTrack",colorMix(private_safeLighten,s?h("palette-secondary-main"):t.secondary.main,.62)),setColor(t.Slider,"errorTrack",colorMix(private_safeLighten,s?h("palette-error-main"):t.error.main,.62)),setColor(t.Slider,"infoTrack",colorMix(private_safeLighten,s?h("palette-info-main"):t.info.main,.62)),setColor(t.Slider,"successTrack",colorMix(private_safeLighten,s?h("palette-success-main"):t.success.main,.62)),setColor(t.Slider,"warningTrack",colorMix(private_safeLighten,s?h("palette-warning-main"):t.warning.main,.62));const e=S?colorMix(private_safeDarken,s?h("palette-background-default"):t.background.default,.6825):private_safeEmphasize(t.background.default,.8);setColor(t.SnackbarContent,"bg",e),setColor(t.SnackbarContent,"color",silent(()=>S?Rl.text.primary:t.getContrastText(e))),setColor(t.SpeedDialAction,"fabHoverBg",private_safeEmphasize(t.background.paper,.15)),setColor(t.StepConnector,"border",setCssVarColor("palette-grey-400")),setColor(t.StepContent,"border",setCssVarColor("palette-grey-400")),setColor(t.Switch,"defaultColor",setCssVarColor("palette-common-white")),setColor(t.Switch,"defaultDisabledColor",setCssVarColor("palette-grey-100")),setColor(t.Switch,"primaryDisabledColor",colorMix(private_safeLighten,s?h("palette-primary-main"):t.primary.main,.62)),setColor(t.Switch,"secondaryDisabledColor",colorMix(private_safeLighten,s?h("palette-secondary-main"):t.secondary.main,.62)),setColor(t.Switch,"errorDisabledColor",colorMix(private_safeLighten,s?h("palette-error-main"):t.error.main,.62)),setColor(t.Switch,"infoDisabledColor",colorMix(private_safeLighten,s?h("palette-info-main"):t.info.main,.62)),setColor(t.Switch,"successDisabledColor",colorMix(private_safeLighten,s?h("palette-success-main"):t.success.main,.62)),setColor(t.Switch,"warningDisabledColor",colorMix(private_safeLighten,s?h("palette-warning-main"):t.warning.main,.62)),setColor(t.TableCell,"border",colorMix(private_safeLighten,private_safeAlpha(s?h("palette-divider"):t.divider,1),.88)),setColor(t.Tooltip,"bg",colorMix(private_safeAlpha,s?h("palette-grey-700"):t.grey[700],.92))}if("dark"===t.mode){setColor(t.Alert,"errorColor",colorMix(private_safeLighten,s?h("palette-error-light"):t.error.light,.6)),setColor(t.Alert,"infoColor",colorMix(private_safeLighten,s?h("palette-info-light"):t.info.light,.6)),setColor(t.Alert,"successColor",colorMix(private_safeLighten,s?h("palette-success-light"):t.success.light,.6)),setColor(t.Alert,"warningColor",colorMix(private_safeLighten,s?h("palette-warning-light"):t.warning.light,.6)),setColor(t.Alert,"errorFilledBg",setCssVarColor("palette-error-dark")),setColor(t.Alert,"infoFilledBg",setCssVarColor("palette-info-dark")),setColor(t.Alert,"successFilledBg",setCssVarColor("palette-success-dark")),setColor(t.Alert,"warningFilledBg",setCssVarColor("palette-warning-dark")),setColor(t.Alert,"errorFilledColor",silent(()=>t.getContrastText(t.error.dark))),setColor(t.Alert,"infoFilledColor",silent(()=>t.getContrastText(t.info.dark))),setColor(t.Alert,"successFilledColor",silent(()=>t.getContrastText(t.success.dark))),setColor(t.Alert,"warningFilledColor",silent(()=>t.getContrastText(t.warning.dark))),setColor(t.Alert,"errorStandardBg",colorMix(private_safeDarken,s?h("palette-error-light"):t.error.light,.9)),setColor(t.Alert,"infoStandardBg",colorMix(private_safeDarken,s?h("palette-info-light"):t.info.light,.9)),setColor(t.Alert,"successStandardBg",colorMix(private_safeDarken,s?h("palette-success-light"):t.success.light,.9)),setColor(t.Alert,"warningStandardBg",colorMix(private_safeDarken,s?h("palette-warning-light"):t.warning.light,.9)),setColor(t.Alert,"errorIconColor",setCssVarColor("palette-error-main")),setColor(t.Alert,"infoIconColor",setCssVarColor("palette-info-main")),setColor(t.Alert,"successIconColor",setCssVarColor("palette-success-main")),setColor(t.Alert,"warningIconColor",setCssVarColor("palette-warning-main")),setColor(t.AppBar,"defaultBg",setCssVarColor("palette-grey-900")),setColor(t.AppBar,"darkBg",setCssVarColor("palette-background-paper")),setColor(t.AppBar,"darkColor",setCssVarColor("palette-text-primary")),setColor(t.Avatar,"defaultBg",setCssVarColor("palette-grey-600")),setColor(t.Button,"inheritContainedBg",setCssVarColor("palette-grey-800")),setColor(t.Button,"inheritContainedHoverBg",setCssVarColor("palette-grey-700")),setColor(t.Chip,"defaultBorder",setCssVarColor("palette-grey-700")),setColor(t.Chip,"defaultAvatarColor",setCssVarColor("palette-grey-300")),setColor(t.Chip,"defaultIconColor",setCssVarColor("palette-grey-300")),setColor(t.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),setColor(t.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),setColor(t.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),setColor(t.LinearProgress,"primaryBg",colorMix(private_safeDarken,s?h("palette-primary-main"):t.primary.main,.5)),setColor(t.LinearProgress,"secondaryBg",colorMix(private_safeDarken,s?h("palette-secondary-main"):t.secondary.main,.5)),setColor(t.LinearProgress,"errorBg",colorMix(private_safeDarken,s?h("palette-error-main"):t.error.main,.5)),setColor(t.LinearProgress,"infoBg",colorMix(private_safeDarken,s?h("palette-info-main"):t.info.main,.5)),setColor(t.LinearProgress,"successBg",colorMix(private_safeDarken,s?h("palette-success-main"):t.success.main,.5)),setColor(t.LinearProgress,"warningBg",colorMix(private_safeDarken,s?h("palette-warning-main"):t.warning.main,.5)),setColor(t.Skeleton,"bg",S?colorMix(private_safeAlpha,s?h("palette-text-primary"):t.text.primary,.13):`rgba(${setCssVarColor("palette-text-primaryChannel")} / 0.13)`),setColor(t.Slider,"primaryTrack",colorMix(private_safeDarken,s?h("palette-primary-main"):t.primary.main,.5)),setColor(t.Slider,"secondaryTrack",colorMix(private_safeDarken,s?h("palette-secondary-main"):t.secondary.main,.5)),setColor(t.Slider,"errorTrack",colorMix(private_safeDarken,s?h("palette-error-main"):t.error.main,.5)),setColor(t.Slider,"infoTrack",colorMix(private_safeDarken,s?h("palette-info-main"):t.info.main,.5)),setColor(t.Slider,"successTrack",colorMix(private_safeDarken,s?h("palette-success-main"):t.success.main,.5)),setColor(t.Slider,"warningTrack",colorMix(private_safeDarken,s?h("palette-warning-light"):t.warning.main,.5));const e=S?colorMix(private_safeLighten,s?h("palette-background-default"):t.background.default,.985):private_safeEmphasize(t.background.default,.98);setColor(t.SnackbarContent,"bg",e),setColor(t.SnackbarContent,"color",silent(()=>S?El.text.primary:t.getContrastText(e))),setColor(t.SpeedDialAction,"fabHoverBg",private_safeEmphasize(t.background.paper,.15)),setColor(t.StepConnector,"border",setCssVarColor("palette-grey-600")),setColor(t.StepContent,"border",setCssVarColor("palette-grey-600")),setColor(t.Switch,"defaultColor",setCssVarColor("palette-grey-300")),setColor(t.Switch,"defaultDisabledColor",setCssVarColor("palette-grey-600")),setColor(t.Switch,"primaryDisabledColor",colorMix(private_safeDarken,s?h("palette-primary-main"):t.primary.main,.55)),setColor(t.Switch,"secondaryDisabledColor",colorMix(private_safeDarken,s?h("palette-secondary-main"):t.secondary.main,.55)),setColor(t.Switch,"errorDisabledColor",colorMix(private_safeDarken,s?h("palette-error-main"):t.error.main,.55)),setColor(t.Switch,"infoDisabledColor",colorMix(private_safeDarken,s?h("palette-info-main"):t.info.main,.55)),setColor(t.Switch,"successDisabledColor",colorMix(private_safeDarken,s?h("palette-success-main"):t.success.main,.55)),setColor(t.Switch,"warningDisabledColor",colorMix(private_safeDarken,s?h("palette-warning-light"):t.warning.main,.55)),setColor(t.TableCell,"border",colorMix(private_safeDarken,private_safeAlpha(s?h("palette-divider"):t.divider,1),.68)),setColor(t.Tooltip,"bg",colorMix(private_safeAlpha,s?h("palette-grey-700"):t.grey[700],.92))}s||(setColorChannel(t.background,"default"),setColorChannel(t.background,"paper"),setColorChannel(t.common,"background"),setColorChannel(t.common,"onBackground"),setColorChannel(t,"divider")),Object.keys(t).forEach(e=>{const n=t[e];"tonalOffset"!==e&&!s&&n&&"object"==typeof n&&(n.main&&setColor(t[e],"mainChannel",private_safeColorChannel(toRgb(n.main))),n.light&&setColor(t[e],"lightChannel",private_safeColorChannel(toRgb(n.light))),n.dark&&setColor(t[e],"darkChannel",private_safeColorChannel(toRgb(n.dark))),n.contrastText&&setColor(t[e],"contrastTextChannel",private_safeColorChannel(toRgb(n.contrastText))),"text"===e&&(setColorChannel(t[e],"primary"),setColorChannel(t[e],"secondary")),"action"===e&&(n.active&&setColorChannel(t[e],"active"),n.selected&&setColorChannel(t[e],"selected")))})}),C=t.reduce((e,t)=>deepmerge(e,t),C);const E={prefix:i,disableCssColorScheme:a,shouldSkipGeneratingVar:l,getSelector:createGetSelector_default(C),enableContrastVars:s},{vars:R,generateThemeVars:k,generateStyleSheets:T}=prepareCssVars(C,E);return C.vars=R,Object.entries(C.colorSchemes[C.defaultColorScheme]).forEach(([e,t])=>{C[e]=t}),C.generateThemeVars=k,C.generateStyleSheets=T,C.generateSpacing=function(){return createSpacing(u.spacing,createUnarySpacing(this))},C.getColorSchemeSelector=createGetColorSchemeSelector(c),C.spacing=C.generateSpacing(),C.shouldSkipGeneratingVar=l,C.unstable_sxConfig={...Ys,...u?.unstable_sxConfig},C.unstable_sx=function(e){return Js({sx:e,theme:this})},C.internal_cache={},C.toRuntimeSource=stringifyTheme,C}function attachColorScheme(e,t,n){e.colorSchemes&&n&&(e.colorSchemes[t]={...!0!==n&&n,palette:createPalette({...!0===n?{}:n.palette,mode:t})})}function createTheme(e={},...t){const{palette:n,cssVariables:o=!1,colorSchemes:a=(n?void 0:{light:!0}),defaultColorScheme:i=n?.mode,...s}=e,l=i||"light",c=a?.[l],d={...a,...n?{[l]:{..."boolean"!=typeof c&&c,palette:n}}:void 0};if(!1===o){if(!("colorSchemes"in e))return createThemeNoVars(e,...t);let o=n;"palette"in e||d[l]&&(!0!==d[l]?o=d[l].palette:"dark"===l&&(o={mode:"dark"}));const a=createThemeNoVars({...e,palette:o},...t);return a.defaultColorScheme=l,a.colorSchemes=d,"light"===a.palette.mode&&(a.colorSchemes.light={...!0!==d.light&&d.light,palette:a.palette},attachColorScheme(a,"dark",d.dark)),"dark"===a.palette.mode&&(a.colorSchemes.dark={...!0!==d.dark&&d.dark,palette:a.palette},attachColorScheme(a,"light",d.light)),a}return n||"light"in d||"light"!==l||(d.light=!0),createThemeWithVars({...s,colorSchemes:d,defaultColorScheme:l,..."boolean"!=typeof o&&o},...t)}var jl=createTheme();function useTheme(){const e=useTheme$2(jl);return e.$$material||e}function slotShouldForwardProp(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}var rootShouldForwardProp=e=>slotShouldForwardProp(e)&&"classes"!==e,Fl=createStyled({themeId:fl,defaultTheme:jl,rootShouldForwardProp});function ThemeProviderNoVars({theme:e,...t}){const n="$$material"in e?e[fl]:void 0;return(0,ps.jsx)(ThemeProvider$1,{...t,themeId:n?fl:void 0,theme:n||e})}var Ll={attribute:"data-mui-color-scheme",colorSchemeStorageKey:"mui-color-scheme",defaultLightColorScheme:"light",defaultDarkColorScheme:"dark",modeStorageKey:"mui-mode"},{CssVarsProvider:Dl,useColorScheme:Bl,getInitColorSchemeScript:Gl}=createCssVarsProvider({themeId:fl,theme:()=>createTheme({cssVariables:!0}),colorSchemeStorageKey:Ll.colorSchemeStorageKey,modeStorageKey:Ll.modeStorageKey,defaultColorScheme:{light:Ll.defaultLightColorScheme,dark:Ll.defaultDarkColorScheme},resolveTheme:e=>{const t={...e,typography:createTypography(e.palette,e.typography)};return t.unstable_sx=function(e){return Js({sx:e,theme:this})},t}}),Wl=Dl;function ThemeProvider({theme:e,...t}){const n=c.useMemo(()=>{if("function"==typeof e)return e;const t="$$material"in e?e[fl]:e;return"colorSchemes"in t?null:"vars"in t?e:{...e,vars:null}},[e]);return n?(0,ps.jsx)(ThemeProviderNoVars,{theme:n,...t}):(0,ps.jsx)(Wl,{theme:e,...t})}var Vl=generateUtilityClasses("MuiBox",["root"]),Hl=createBox({themeId:fl,defaultTheme:createTheme(),defaultClassName:Vl.root,generateClassName:el.generate}),Ul=createTheme({palette:{mode:"dark",primary:{main:"#FFD700"},text:{primary:"#FFF5D6",secondary:"#C0B090",muted:"#706050",accent:"#FFD700"},background:{primary:"#0d0d0d",panel:"#141414",header:"#1a1a1a",modal:"#1e1e1e"}},typography:{fontFamily:"Roboto Mono, Consolas, monospace",fontSize:13},spacing:8,shape:{borderRadius:4},nexmap:{window:{contentPadding:1.5,defaultMaxHeight:960,defaultMaxWidth:1440,footerPaddingX:2,footerPaddingY:1.5,shellHeight:560,shellWidth:1100,settingsHeight:950,settingsWidth:750,tabStripPaddingX:2}},components:{MuiTypography:{styleOverrides:{root:{fontFamily:"Roboto Mono, Consolas, monospace"}}},MuiButton:{defaultProps:{size:"small",disableElevation:!0},styleOverrides:{root:{fontFamily:"Roboto Mono, Consolas, monospace",minWidth:0}}},MuiPaper:{defaultProps:{elevation:0}},MuiDialog:{styleOverrides:{paper:({theme:e})=>({backgroundImage:"none",border:`1px solid ${e.palette.divider}`,borderRadius:e.shape.borderRadius})}},MuiSwitch:{defaultProps:{size:"small"}},MuiSlider:{defaultProps:{size:"small"}},MuiTextField:{defaultProps:{size:"small"}},MuiSelect:{defaultProps:{size:"small"}},MuiPopover:{styleOverrides:{paper:{background:"#000",border:"1px solid #fff"}}}}}),_noopSubscribe=()=>()=>{},_defaultSettings=()=>null,_defaultUiState=()=>({pathingNotices:[],resultsColumns:[],resultsDefaultAction:null,resultsInitialState:{},resultsOpen:!1,resultsRows:[],resultsTitle:"Results",settingsOpen:!1}),ql=c.createContext(null);function useNexMap(){const e=c.useContext(ql);if(!e)throw new Error("useNexMap must be used within a <NexMapProvider>.");return e}function useNexMapSnapshot(){const{mapStore:e}=useNexMap();return c.useSyncExternalStore(e.subscribe,e.getState,e.getState)}function useNexMapSettings(){const{settingsApi:e}=useNexMap(),t=e?.store??null;return c.useSyncExternalStore(t?.subscribe??_noopSubscribe,t?.getState??_defaultSettings,t?.getState??_defaultSettings)}function useNexUiStore(){const{uiStore:e}=useNexMap();return c.useSyncExternalStore(e?.subscribe??_noopSubscribe,e?.getState??_defaultUiState,e?.getState??_defaultUiState)}function NexMapProvider({viewModel:e,mapStore:t,settingsApi:n,router:o,uiStore:a,theme:i,children:s}){const l=c.useMemo(()=>({mapStore:t??e?.mapStore??null,router:o??null,settingsApi:n??null,uiStore:a??null,viewModel:e}),[e,t,n,o,a]);return(0,ps.jsx)(StyledEngineProvider,{injectFirst:!0,children:(0,ps.jsx)(ThemeProvider,{theme:i??Ul,children:(0,ps.jsx)(ql.Provider,{value:l,children:s})})})}function GlobalStyles(e){return(0,ps.jsx)(GlobalStyles$1,{...e,defaultTheme:jl,themeId:fl})}function globalCss(e){return function(t){return(0,ps.jsx)(GlobalStyles,{styles:"function"==typeof e?n=>e({theme:n,...t}):e})}}var Kl=unstable_memoTheme;function useDefaultProps(e){return useDefaultProps$1(e)}var Zl=capitalize;function hasCorrectMainProperty(e){return"string"==typeof e.main}function checkSimplePaletteColorValues(e,t=[]){if(!hasCorrectMainProperty(e))return!1;for(const n of t)if(!e.hasOwnProperty(n)||"string"!=typeof e[n])return!1;return!0}function createSimplePaletteValueFilter(e=[]){return([,t])=>t&&checkSimplePaletteColorValues(t,e)}function getTypographyUtilityClass(e){return generateUtilityClass("MuiTypography",e)}generateUtilityClasses("MuiTypography",["root","h1","h2","h3","h4","h5","h6","subtitle1","subtitle2","body1","body2","inherit","button","caption","overline","alignLeft","alignRight","alignCenter","alignJustify","noWrap","gutterBottom"]);var useUtilityClasses$52=e=>{const{align:t,gutterBottom:n,noWrap:o,variant:a,classes:i}=e;return composeClasses({root:["root",a,"inherit"!==e.align&&`align${Zl(t)}`,n&&"gutterBottom",o&&"noWrap"]},getTypographyUtilityClass,i)},Yl=Fl("span",{name:"MuiTypography",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.variant&&t[n.variant],"inherit"!==n.align&&t[`align${Zl(n.align)}`],n.noWrap&&t.noWrap,n.gutterBottom&&t.gutterBottom]}})(Kl(({theme:e})=>({margin:0,variants:[{props:{variant:"inherit"},style:{font:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}},...Object.entries(e.typography).filter(([e,t])=>"inherit"!==e&&t&&"object"==typeof t).map(([e,t])=>({props:{variant:e},style:t})),...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),...Object.entries(e.palette?.text||{}).filter(([,e])=>"string"==typeof e).map(([t])=>({props:{color:`text${Zl(t)}`},style:{color:(e.vars||e).palette.text[t]}})),{props:({ownerState:e})=>"inherit"!==e.align,style:{textAlign:"var(--Typography-textAlign)"}},{props:({ownerState:e})=>e.noWrap,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},{props:({ownerState:e})=>e.gutterBottom,style:{marginBottom:"0.35em"}}]}))),Xl={h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",subtitle1:"h6",subtitle2:"h6",body1:"p",body2:"p",inherit:"p"},Jl=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTypography"}),{color:o,align:a="inherit",className:i,component:s,gutterBottom:l=!1,noWrap:c=!1,variant:d="body1",variantMapping:u=Xl,...p}=n,m={...n,align:a,color:o,className:i,component:s,gutterBottom:l,noWrap:c,variant:d,variantMapping:u};return(0,ps.jsx)(Yl,{as:s||u[d]||Xl[d]||"span",ref:t,className:clsx(useUtilityClasses$52(m).root,i),...p,ownerState:m,style:{..."inherit"!==a&&{"--Typography-textAlign":a},...p.style}})});function RoomHeader(){const e=useNexMapSnapshot();return(0,ps.jsx)(Hl,{component:"header",className:"nexmap4-tab-header","data-nexmap4-tab-header":"true",sx:{backgroundColor:"rgba(0, 0, 0, 0.4)",borderBottom:1,borderColor:"divider",position:"relative",px:1,py:.5,wordWrap:"break-word",zIndex:1},children:(0,ps.jsx)(Jl,{variant:"body2",component:"strong",sx:{fontWeight:600,color:"text.primary"},children:e.room?`${e.area?.name??"Unknown area"}: ${e.room.name} (${e.room.id})`:"Loading room context"})})}var Ql=Object.freeze({bottom:0,left:0,position:"absolute",right:0,top:0}),ec=c.memo(function({container:e}){const t=c.useRef(null);return c.useLayoutEffect(()=>{const n=t.current;if(n&&e)return e.parentNode!==n&&n.appendChild(e),()=>{e.parentNode===n&&n.removeChild(e)}},[e]),(0,ps.jsx)("div",{className:"nexmap4-renderer-pane","data-nexmap4-renderer-pane":"true",ref:t,style:Ql})});function createChainedFunction(...e){return e.reduce((e,t)=>null==t?e:function(...n){e.apply(this,n),t.apply(this,n)},()=>{})}function getSvgIconUtilityClass(e){return generateUtilityClass("MuiSvgIcon",e)}generateUtilityClasses("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);var useUtilityClasses$51=e=>{const{color:t,fontSize:n,classes:o}=e;return composeClasses({root:["root","inherit"!==t&&`color${Zl(t)}`,`fontSize${Zl(n)}`]},getSvgIconUtilityClass,o)},tc=Fl("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,"inherit"!==n.color&&t[`color${Zl(n.color)}`],t[`fontSize${Zl(n.fontSize)}`]]}})(Kl(({theme:e})=>({userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:e.transitions?.create?.("fill",{duration:(e.vars??e).transitions?.duration?.shorter}),variants:[{props:e=>!e.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:e.typography?.pxToRem?.(20)||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:e.typography?.pxToRem?.(24)||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:e.typography?.pxToRem?.(35)||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,e])=>e&&e.main).map(([t])=>({props:{color:t},style:{color:(e.vars??e).palette?.[t]?.main}})),{props:{color:"action"},style:{color:(e.vars??e).palette?.action?.active}},{props:{color:"disabled"},style:{color:(e.vars??e).palette?.action?.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}))),rc=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiSvgIcon"}),{children:o,className:a,color:i="inherit",component:s="svg",fontSize:l="medium",htmlColor:d,inheritViewBox:u=!1,titleAccess:p,viewBox:m="0 0 24 24",...h}=n,g=c.isValidElement(o)&&"svg"===o.type,y={...n,color:i,component:s,fontSize:l,instanceFontSize:e.fontSize,inheritViewBox:u,viewBox:m,hasSvgAsChild:g},b={};return u||(b.viewBox=m),(0,ps.jsxs)(tc,{as:s,className:clsx(useUtilityClasses$51(y).root,a),focusable:"false",color:d,"aria-hidden":!p||void 0,role:p?"img":void 0,ref:t,...b,...h,...g&&o.props,ownerState:y,children:[g?o.props.children:o,p?(0,ps.jsx)("title",{children:p}):null]})});function createSvgIcon(e,t){function Component(t,n){return(0,ps.jsx)(rc,{"data-testid":void 0,ref:n,...t,children:e})}return Component.muiName=rc.muiName,c.memo(c.forwardRef(Component))}function debounce$2(e,t=166){let n;function debounced(...o){const later=()=>{e.apply(this,o)};clearTimeout(n),n=setTimeout(later,t)}return debounced.clear=()=>{clearTimeout(n)},debounced}rc.muiName="SvgIcon";var nc=debounce$2,oc=isMuiElement;function activeElement(e){let t=e.activeElement;for(;null!=t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}var ac=activeElement;function ownerDocument(e){return e&&e.ownerDocument||document}var ic=ownerDocument;function ownerWindow(e){return ownerDocument(e).defaultView||window}var sc=ownerWindow;function setRef(e,t){"function"==typeof e?e(t):e&&(e.current=t)}var lc=nl,cc=useId;function useControlled(e){const{controlled:t,default:n,name:o,state:a="value"}=e,{current:i}=c.useRef(void 0!==t),[s,l]=c.useState(n);return[i?t:s,c.useCallback(e=>{i||l(e)},[])]}var dc=useControlled;function useEventCallback(e){const t=c.useRef(e);return nl(()=>{t.current=e}),c.useRef((...e)=>(0,t.current)(...e)).current}var uc=useEventCallback;function useForkRef(...e){const t=c.useRef(void 0),n=c.useCallback(t=>{const n=e.map(e=>{if(null==e)return null;if("function"==typeof e){const n=e,o=n(t);return"function"==typeof o?o:()=>{n(null)}}return e.current=t,()=>{e.current=null}});return()=>{n.forEach(e=>e?.())}},e);return c.useMemo(()=>e.every(e=>null==e)?null:e=>{t.current&&(t.current(),t.current=void 0),null!=e&&(t.current=n(e))},e)}var pc=useForkRef;function isEventHandler(e,t){const n=e.charCodeAt(2);return"o"===e[0]&&"n"===e[1]&&n>=65&&n<=90&&"function"==typeof t}function mergeSlotProps$1(e,t){if(!e)return t;function extractHandlers(e,t){const n={};return Object.keys(t).forEach(o=>{isEventHandler(o,t[o])&&"function"==typeof e[o]&&(n[o]=(...n)=>{e[o](...n),t[o](...n)})}),n}if("function"==typeof e||"function"==typeof t)return n=>{const o="function"==typeof t?t(n):t,a="function"==typeof e?e({...n,...o}):e,i=clsx(n?.className,o?.className,a?.className),s=extractHandlers(a,o);return{...o,...a,...s,...!!i&&{className:i},...o?.style&&a?.style&&{style:{...o.style,...a.style}},...o?.sx&&a?.sx&&{sx:[...Array.isArray(o.sx)?o.sx:[o.sx],...Array.isArray(a.sx)?a.sx:[a.sx]]}}};const n=t,o=extractHandlers(e,n),a=clsx(n?.className,e?.className);return{...t,...e,...o,...!!a&&{className:a},...n?.style&&e?.style&&{style:{...n.style,...e.style}},...n?.sx&&e?.sx&&{sx:[...Array.isArray(n.sx)?n.sx:[n.sx],...Array.isArray(e.sx)?e.sx:[e.sx]]}}}function isFocusVisible(e){try{return e.matches(":focus-visible")}catch(t){}return!1}function useFocusableWhenDisabled(e){const{focusableWhenDisabled:t,disabled:n,composite:o=!1,tabIndex:a=0,isNativeButton:i}=e,s=o&&!1!==t,l=o&&!1===t;return c.useMemo(()=>{const e={onKeyDown(e){n&&t&&"Tab"!==e.key&&e.preventDefault()}};return o||(e.tabIndex=a,!i&&n&&(e.tabIndex=t?a:-1)),(i&&(t||s)||!i&&n)&&(e["aria-disabled"]=n),!i||t&&!l||(e.disabled=n),e},[o,n,t,s,l,i,a])}var mc={};function useButtonBase(e){const{nativeButton:t,nativeButtonProp:n,internalNativeButton:o=t,allowInferredHostMismatch:a=!1,disabled:i,type:s,hasFormAction:l=!1,tabIndex:d=0,focusableWhenDisabled:u,stopEventPropagation:p=!1,onBeforeKeyDown:m,onBeforeKeyUp:h}=e,g=c.useRef(null),y=!0===u,b=useFocusableWhenDisabled({focusableWhenDisabled:y,disabled:i,isNativeButton:t,tabIndex:d}),v=c.useCallback(()=>{const e=g.current;return null==e?t:"BUTTON"===e.tagName||Boolean("A"===e.tagName&&e.href)},[t]),w=c.useMemo(()=>{const e=y?{}:{tabIndex:i?-1:d};return t?(e.type=void 0!==s||l?s:"button",y||(e.disabled=i)):(e.role="button",!y&&i&&(e["aria-disabled"]=i)),y?{...e,...b}:e},[i,y,b,l,t,d,s]);return{getButtonProps:c.useCallback((e=mc)=>{const{onClick:t,onKeyDown:n,onKeyUp:o,...a}=e,handleClick=e=>{p&&e.stopPropagation(),i?e.preventDefault():t?.(e)},handleKeyDown=e=>{y&&b.onKeyDown(e),i||(m?.(e),n?.(e),e.target!==e.currentTarget||v()||(" "!==e.key?"Enter"===e.key&&(e.preventDefault(),e.currentTarget.click()):e.preventDefault()))},handleKeyUp=e=>{i||(h?.(e),o?.(e),e.target!==e.currentTarget||v()||" "!==e.key||e.defaultPrevented||e.currentTarget.click())};return{...w,...a,onClick:handleClick,onKeyDown:handleKeyDown,onKeyUp:handleKeyUp}},[w,i,y,b,v,m,h,p]),rootRef:g}}var hc={};function useLazyRef(e,t){const n=c.useRef(hc);return n.current===hc&&(n.current=e(t)),n}var gc=class e{static create(){return new e}static use(){const t=useLazyRef(e.create).current,[n,o]=c.useState(!1);return t.shouldMount=n,t.setShouldMount=o,c.useEffect(t.mountEffect,[n]),t}constructor(){this.ref={current:null},this.mounted=null,this.didMount=!1,this.shouldMount=!1,this.setShouldMount=null}mount(){return this.mounted||(this.mounted=createControlledPromise(),this.shouldMount=!0,this.setShouldMount(this.shouldMount)),this.mounted}mountEffect=()=>{this.shouldMount&&!this.didMount&&null!==this.ref.current&&(this.didMount=!0,this.mounted.resolve())};start(...e){this.mount().then(()=>this.ref.current?.start(...e))}stop(...e){this.mount().then(()=>this.ref.current?.stop(...e))}pulsate(...e){this.mount().then(()=>this.ref.current?.pulsate(...e))}};function useLazyRipple(){return gc.use()}function createControlledPromise(){let e,t;const n=new Promise((n,o)=>{e=n,t=o});return n.resolve=e,n.reject=t,n}function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _inheritsLoose(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,_setPrototypeOf(e,t)}var fc={disabled:!1},yc=e.default.createContext(null),forceReflow=function(e){return e.scrollTop},bc="unmounted",vc="exited",wc="entering",Sc="entered",xc="exiting",Ic=function(n){function Transition(e,t){var o,a=n.call(this,e,t)||this,i=t&&!t.isMounting?e.enter:e.appear;return a.appearStatus=null,e.in?i?(o=vc,a.appearStatus=wc):o=Sc:o=e.unmountOnExit||e.mountOnEnter?bc:vc,a.state={status:o},a.nextCallback=null,a}_inheritsLoose(Transition,n),Transition.getDerivedStateFromProps=function(e,t){return e.in&&"unmounted"===t.status?{status:vc}:null};var o=Transition.prototype;return o.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},o.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?"entering"!==n&&"entered"!==n&&(t=wc):"entering"!==n&&"entered"!==n||(t=xc)}this.updateStatus(!1,t)},o.componentWillUnmount=function(){this.cancelNextCallback()},o.getTimeouts=function(){var e,t,n=this.props.timeout,o=e=t=n;return null!=n&&"number"!=typeof n&&(o=n.exit,e=n.enter,t=void 0!==n.appear?n.appear:e),{exit:o,enter:e,appear:t}},o.updateStatus=function(e,n){if(void 0===e&&(e=!1),null!==n)if(this.cancelNextCallback(),"entering"===n){if(this.props.unmountOnExit||this.props.mountOnEnter){var o=this.props.nodeRef?this.props.nodeRef.current:t.default.findDOMNode(this);o&&forceReflow(o)}this.performEnter(e)}else this.performExit();else this.props.unmountOnExit&&"exited"===this.state.status&&this.setState({status:bc})},o.performEnter=function(e){var n=this,o=this.props.enter,a=this.context?this.context.isMounting:e,i=this.props.nodeRef?[a]:[t.default.findDOMNode(this),a],s=i[0],l=i[1],c=this.getTimeouts(),d=a?c.appear:c.enter;!e&&!o||fc.disabled?this.safeSetState({status:Sc},function(){n.props.onEntered(s)}):(this.props.onEnter(s,l),this.safeSetState({status:wc},function(){n.props.onEntering(s,l),n.onTransitionEnd(d,function(){n.safeSetState({status:Sc},function(){n.props.onEntered(s,l)})})}))},o.performExit=function(){var e=this,n=this.props.exit,o=this.getTimeouts(),a=this.props.nodeRef?void 0:t.default.findDOMNode(this);n&&!fc.disabled?(this.props.onExit(a),this.safeSetState({status:xc},function(){e.props.onExiting(a),e.onTransitionEnd(o.exit,function(){e.safeSetState({status:vc},function(){e.props.onExited(a)})})})):this.safeSetState({status:vc},function(){e.props.onExited(a)})},o.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},o.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},o.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(o){n&&(n=!1,t.nextCallback=null,e(o))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},o.onTransitionEnd=function(e,n){this.setNextCallback(n);var o=this.props.nodeRef?this.props.nodeRef.current:t.default.findDOMNode(this),a=null==e&&!this.props.addEndListener;if(o&&!a){if(this.props.addEndListener){var i=this.props.nodeRef?[this.nextCallback]:[o,this.nextCallback],s=i[0],l=i[1];this.props.addEndListener(s,l)}null!=e&&setTimeout(this.nextCallback,e)}else setTimeout(this.nextCallback,0)},o.render=function(){var t=this.state.status;if("unmounted"===t)return null;var n=this.props,o=n.children;n.in,n.mountOnEnter,n.unmountOnExit,n.appear,n.enter,n.exit,n.timeout,n.addEndListener,n.onEnter,n.onEntering,n.onEntered,n.onExit,n.onExiting,n.onExited,n.nodeRef;var a=_objectWithoutPropertiesLoose(n,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return e.default.createElement(yc.Provider,{value:null},"function"==typeof o?o(t,a):e.default.cloneElement(e.default.Children.only(o),a))},Transition}(e.default.Component);function noop$1(){}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function getChildMapping(t,n){var mapper=function(t){return n&&(0,e.isValidElement)(t)?n(t):t},o=Object.create(null);return t&&e.Children.map(t,function(e){return e}).forEach(function(e){o[e.key]=mapper(e)}),o}function mergeChildMappings(e,t){function getValueForKey(n){return n in t?t[n]:e[n]}e=e||{},t=t||{};var n,o=Object.create(null),a=[];for(var i in e)i in t?a.length&&(o[i]=a,a=[]):a.push(i);var s={};for(var l in t){if(o[l])for(n=0;n<o[l].length;n++){var c=o[l][n];s[o[l][n]]=getValueForKey(c)}s[l]=getValueForKey(l)}for(n=0;n<a.length;n++)s[a[n]]=getValueForKey(a[n]);return s}function getProp(e,t,n){return null!=n[t]?n[t]:e.props[t]}function getInitialChildMapping(t,n){return getChildMapping(t.children,function(o){return(0,e.cloneElement)(o,{onExited:n.bind(null,o),in:!0,appear:getProp(o,"appear",t),enter:getProp(o,"enter",t),exit:getProp(o,"exit",t)})})}function getNextChildMapping(t,n,o){var a=getChildMapping(t.children),i=mergeChildMappings(n,a);return Object.keys(i).forEach(function(s){var l=i[s];if((0,e.isValidElement)(l)){var c=s in n,d=s in a,u=n[s],p=(0,e.isValidElement)(u)&&!u.props.in;!d||c&&!p?d||!c||p?d&&c&&(0,e.isValidElement)(u)&&(i[s]=(0,e.cloneElement)(l,{onExited:o.bind(null,l),in:u.props.in,exit:getProp(l,"exit",t),enter:getProp(l,"enter",t)})):i[s]=(0,e.cloneElement)(l,{in:!1}):i[s]=(0,e.cloneElement)(l,{onExited:o.bind(null,l),in:!0,exit:getProp(l,"exit",t),enter:getProp(l,"enter",t)})}}),i}Ic.contextType=yc,Ic.propTypes={},Ic.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:noop$1,onEntering:noop$1,onEntered:noop$1,onExit:noop$1,onExiting:noop$1,onExited:noop$1},Ic.UNMOUNTED=bc,Ic.EXITED=vc,Ic.ENTERING=wc,Ic.ENTERED=Sc,Ic.EXITING=xc;var Cc=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},Ec={component:"div",childFactory:function(e){return e}},Rc=function(t){function TransitionGroup(e,n){var o=t.call(this,e,n)||this;return o.state={contextValue:{isMounting:!0},handleExited:o.handleExited.bind(_assertThisInitialized(o)),firstRender:!0},o}_inheritsLoose(TransitionGroup,t);var n=TransitionGroup.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},TransitionGroup.getDerivedStateFromProps=function(e,t){var n=t.children,o=t.handleExited;return{children:t.firstRender?getInitialChildMapping(e,o):getNextChildMapping(e,n,o),firstRender:!1}},n.handleExited=function(e,t){var n=getChildMapping(this.props.children);e.key in n||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState(function(t){var n=_extends({},t.children);return delete n[e.key],{children:n}}))},n.render=function(){var t=this.props,n=t.component,o=t.childFactory,a=_objectWithoutPropertiesLoose(t,["component","childFactory"]),i=this.state.contextValue,s=Cc(this.state.children).map(o);return delete a.appear,delete a.enter,delete a.exit,null===n?e.default.createElement(yc.Provider,{value:i},s):e.default.createElement(yc.Provider,{value:i},e.default.createElement(n,a,s))},TransitionGroup}(e.default.Component);Rc.propTypes={},Rc.defaultProps=Ec;var kc=[];function useOnMount(e){c.useEffect(e,kc)}var Ac=class e{static create(){return new e}currentId=null;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,t()},e)}clear=()=>{null!==this.currentId&&(clearTimeout(this.currentId),this.currentId=null)};disposeEffect=()=>this.clear};function useTimeout(){const e=useLazyRef(Ac.create).current;return useOnMount(e.disposeEffect),e}function Ripple(e){const{className:t,classes:n,pulsate:o=!1,rippleX:a,rippleY:i,rippleSize:s,in:l,onExited:d,timeout:u}=e,[p,m]=c.useState(!1),h=clsx(t,n.ripple,n.rippleVisible,o&&n.ripplePulsate),g={width:s,height:s,top:-s/2+i,left:-s/2+a},y=clsx(n.child,p&&n.childLeaving,o&&n.childPulsate);return l||p||m(!0),c.useEffect(()=>{if(!l&&null!=d){const e=setTimeout(d,u);return()=>{clearTimeout(e)}}},[d,l,u]),(0,ps.jsx)("span",{className:h,style:g,children:(0,ps.jsx)("span",{className:y})})}var Tc=generateUtilityClasses("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),Mc=550,zc=keyframes`
2
+ 0% {
3
+ transform: scale(0);
4
+ opacity: 0.1;
5
+ }
6
+
7
+ 100% {
8
+ transform: scale(1);
9
+ opacity: 0.3;
10
+ }
11
+ `,$c=keyframes`
12
+ 0% {
13
+ opacity: 1;
14
+ }
15
+
16
+ 100% {
17
+ opacity: 0;
18
+ }
19
+ `,Nc=keyframes`
20
+ 0% {
21
+ transform: scale(1);
22
+ }
23
+
24
+ 50% {
25
+ transform: scale(0.92);
26
+ }
27
+
28
+ 100% {
29
+ transform: scale(1);
30
+ }
31
+ `,Pc=Fl("span",{name:"MuiTouchRipple",slot:"Root"})({overflow:"hidden",pointerEvents:"none",position:"absolute",zIndex:0,top:0,right:0,bottom:0,left:0,borderRadius:"inherit"}),Oc=Fl(Ripple,{name:"MuiTouchRipple",slot:"Ripple"})`
32
+ opacity: 0;
33
+ position: absolute;
34
+
35
+ &.${Tc.rippleVisible} {
36
+ opacity: 0.3;
37
+ transform: scale(1);
38
+ animation-name: ${zc};
39
+ animation-duration: ${Mc}ms;
40
+ animation-timing-function: ${({theme:e})=>e.transitions.easing.easeInOut};
41
+ }
42
+
43
+ &.${Tc.ripplePulsate} {
44
+ animation-duration: ${({theme:e})=>e.transitions.duration.shorter}ms;
45
+ }
46
+
47
+ & .${Tc.child} {
48
+ opacity: 1;
49
+ display: block;
50
+ width: 100%;
51
+ height: 100%;
52
+ border-radius: 50%;
53
+ background-color: currentColor;
54
+ }
55
+
56
+ & .${Tc.childLeaving} {
57
+ opacity: 0;
58
+ animation-name: ${$c};
59
+ animation-duration: ${Mc}ms;
60
+ animation-timing-function: ${({theme:e})=>e.transitions.easing.easeInOut};
61
+ }
62
+
63
+ & .${Tc.childPulsate} {
64
+ position: absolute;
65
+ /* @noflip */
66
+ left: 0px;
67
+ top: 0;
68
+ animation-name: ${Nc};
69
+ animation-duration: 2500ms;
70
+ animation-timing-function: ${({theme:e})=>e.transitions.easing.easeInOut};
71
+ animation-iteration-count: infinite;
72
+ animation-delay: 200ms;
73
+ }
74
+ `,_c=c.forwardRef(function(e,t){const{center:n=!1,classes:o={},className:a,...i}=useDefaultProps({props:e,name:"MuiTouchRipple"}),[s,l]=c.useState([]),d=c.useRef(0),u=c.useRef(null);c.useEffect(()=>{u.current&&(u.current(),u.current=null)},[s]);const p=c.useRef(!1),m=useTimeout(),h=c.useRef(null),g=c.useRef(null),y=c.useCallback(e=>{const{pulsate:t,rippleX:n,rippleY:a,rippleSize:i,cb:s}=e;l(e=>[...e,(0,ps.jsx)(Oc,{classes:{ripple:clsx(o.ripple,Tc.ripple),rippleVisible:clsx(o.rippleVisible,Tc.rippleVisible),ripplePulsate:clsx(o.ripplePulsate,Tc.ripplePulsate),child:clsx(o.child,Tc.child),childLeaving:clsx(o.childLeaving,Tc.childLeaving),childPulsate:clsx(o.childPulsate,Tc.childPulsate)},timeout:Mc,pulsate:t,rippleX:n,rippleY:a,rippleSize:i},d.current)]),d.current+=1,u.current=s},[o]),b=c.useCallback((e={},t={},o=()=>{})=>{const{pulsate:a=!1,center:i=n||t.pulsate,fakeElement:s=!1}=t;if("mousedown"===e?.type&&p.current)return void(p.current=!1);"touchstart"===e?.type&&(p.current=!0);const l=s?null:g.current,c=l?l.getBoundingClientRect():{width:0,height:0,left:0,top:0};let d,u,b;if(i||void 0===e||0===e.clientX&&0===e.clientY||!e.clientX&&!e.touches)d=Math.round(c.width/2),u=Math.round(c.height/2);else{const{clientX:t,clientY:n}=e.touches&&e.touches.length>0?e.touches[0]:e;d=Math.round(t-c.left),u=Math.round(n-c.top)}if(i)b=Math.sqrt((2*c.width**2+c.height**2)/3),b%2==0&&(b+=1);else{const e=2*Math.max(Math.abs((l?l.clientWidth:0)-d),d)+2,t=2*Math.max(Math.abs((l?l.clientHeight:0)-u),u)+2;b=Math.sqrt(e**2+t**2)}e?.touches?null===h.current&&(h.current=()=>{y({pulsate:a,rippleX:d,rippleY:u,rippleSize:b,cb:o})},m.start(80,()=>{h.current&&(h.current(),h.current=null)})):y({pulsate:a,rippleX:d,rippleY:u,rippleSize:b,cb:o})},[n,y,m]),v=c.useCallback(()=>{b({},{pulsate:!0})},[b]),w=c.useCallback((e,t)=>{if(m.clear(),"touchend"===e?.type&&h.current)return h.current(),h.current=null,void m.start(0,()=>{w(e,t)});h.current=null,l(e=>e.length>0?e.slice(1):e),u.current=t},[m]);return c.useImperativeHandle(t,()=>({pulsate:v,start:b,stop:w}),[v,b,w]),(0,ps.jsx)(Pc,{className:clsx(Tc.root,o.root,a),ref:g,...i,children:(0,ps.jsx)(Rc,{component:null,exit:!0,children:s})})});function getButtonBaseUtilityClass(e){return generateUtilityClass("MuiButtonBase",e)}var jc=generateUtilityClasses("MuiButtonBase",["root","disabled","focusVisible"]),useUtilityClasses$50=e=>{const{disabled:t,focusVisible:n,focusVisibleClassName:o,suppressFocusVisible:a,classes:i}=e,s=composeClasses({root:["root",t&&"disabled",n&&!a&&"focusVisible"]},getButtonBaseUtilityClass,i);return n&&!a&&o&&(s.root+=` ${o}`),s},Fc=Fl("button",{name:"MuiButtonBase",slot:"Root"})({display:"inline-flex",alignItems:"center",justifyContent:"center",position:"relative",boxSizing:"border-box",WebkitTapHighlightColor:"transparent",backgroundColor:"transparent",outline:0,border:0,margin:0,borderRadius:0,padding:0,cursor:"pointer",userSelect:"none",verticalAlign:"middle",MozAppearance:"none",WebkitAppearance:"none",textDecoration:"none",color:"inherit","&::-moz-focus-inner":{borderStyle:"none"},[`&.${jc.disabled}`]:{pointerEvents:"none",cursor:"default"},"@media print":{colorAdjust:"exact"}}),Lc=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiButtonBase"}),{action:o,centerRipple:a=!1,children:i,className:s,component:l="button",disabled:d=!1,disableRipple:u=!1,disableTouchRipple:p=!1,focusRipple:m=!1,focusVisibleClassName:h,focusableWhenDisabled:g,suppressFocusVisible:y=!1,internalNativeButton:b,LinkComponent:v="a",nativeButton:w,onBlur:S,onClick:x,onContextMenu:I,onDragLeave:C,onFocus:E,onFocusVisible:R,onKeyDown:k,onKeyUp:T,onMouseDown:M,onMouseLeave:$,onMouseUp:N,onTouchEnd:P,onTouchMove:O,onTouchStart:j,tabIndex:F=0,TouchRippleProps:L,touchRippleRef:D,type:B,...G}=n,W=Boolean(G.href||G.to),V=Boolean(G.formAction);let H=l;"button"===H&&W&&(H=v);const U="string"==typeof H?"button"===H:b??!1,q=w??U,K=useLazyRipple(),Z=pc(K.ref,D),[Y,X]=c.useState(!1);(d||y)&&Y&&X(!1);const J=uc(e=>{m&&!e.repeat&&Y&&" "===e.key&&K.stop(e,()=>{K.start(e)})}),Q=uc(e=>{m&&" "===e.key&&Y&&!e.defaultPrevented&&K.stop(e,()=>{K.pulsate(e)})}),{getButtonProps:ee,rootRef:te}=useButtonBase({nativeButton:q,nativeButtonProp:w,internalNativeButton:U,allowInferredHostMismatch:W||"string"==typeof H,disabled:d,type:B,hasFormAction:V,tabIndex:F,onBeforeKeyDown:J,onBeforeKeyUp:Q}),{onClick:re,onKeyDown:ne,onKeyUp:oe,...ae}=ee({onClick:x,onKeyDown:k,onKeyUp:T});c.useImperativeHandle(o,()=>({focusVisible:()=>{X(!0),te.current.focus()}}),[te]);const ie=K.shouldMount&&!u&&!d;c.useEffect(()=>{Y&&m&&!u&&K.pulsate()},[u,m,Y,K]);const se=useRippleHandler(K,"start",M,p),le=useRippleHandler(K,"stop",I,p),ce=useRippleHandler(K,"stop",C,p),de=useRippleHandler(K,"stop",N,p),ue=useRippleHandler(K,"stop",e=>{Y&&e.preventDefault(),$&&$(e)},p),pe=useRippleHandler(K,"start",j,p),me=useRippleHandler(K,"stop",P,p),he=useRippleHandler(K,"stop",O,p),ge=useRippleHandler(K,"stop",e=>{isFocusVisible(e.target)||X(!1),S&&S(e)},!1),fe=uc(e=>{te.current||(te.current=e.currentTarget),!y&&isFocusVisible(e.target)&&(X(!0),R&&R(e)),E&&E(e)}),ye={};W&&(ye.tabIndex=d?-1:F,d&&(ye["aria-disabled"]=d),ye.type=B);const be=pc(t,te),ve={...n,centerRipple:a,component:l,disabled:d,disableRipple:u,disableTouchRipple:p,focusRipple:m,suppressFocusVisible:y,tabIndex:F,focusVisible:Y},we=useUtilityClasses$50(ve);return(0,ps.jsxs)(Fc,{as:H,className:clsx(we.root,s),ownerState:ve,onBlur:ge,onClick:re,onContextMenu:le,onFocus:fe,onKeyDown:ne,onKeyUp:oe,onMouseDown:se,onMouseLeave:ue,onMouseUp:de,onDragLeave:ce,onTouchEnd:me,onTouchMove:he,onTouchStart:pe,ref:be,...W?ye:ae,...G,children:[i,ie?(0,ps.jsx)(_c,{ref:Z,center:a,...L}):null]})});function useRippleHandler(e,t,n,o=!1){return uc(a=>(n&&n(a),o||e[t](a),!0))}function getCircularProgressUtilityClass(e){return generateUtilityClass("MuiCircularProgress",e)}generateUtilityClasses("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","track","circle","circleDisableShrink"]);var Dc=44,Bc=keyframes`
75
+ 0% {
76
+ transform: rotate(0deg);
77
+ }
78
+
79
+ 100% {
80
+ transform: rotate(360deg);
81
+ }
82
+ `,Gc=keyframes`
83
+ 0% {
84
+ stroke-dasharray: 1px, 200px;
85
+ stroke-dashoffset: 0;
86
+ }
87
+
88
+ 50% {
89
+ stroke-dasharray: 100px, 200px;
90
+ stroke-dashoffset: -15px;
91
+ }
92
+
93
+ 100% {
94
+ stroke-dasharray: 1px, 200px;
95
+ stroke-dashoffset: -126px;
96
+ }
97
+ `,Wc="string"!=typeof Bc?css`
98
+ animation: ${Bc} 1.4s linear infinite;
99
+ `:null,Vc="string"!=typeof Gc?css`
100
+ animation: ${Gc} 1.4s ease-in-out infinite;
101
+ `:null,useUtilityClasses$49=e=>{const{classes:t,variant:n,color:o,disableShrink:a}=e;return composeClasses({root:["root",n,`color${Zl(o)}`],svg:["svg"],track:["track"],circle:["circle",a&&"circleDisableShrink"]},getCircularProgressUtilityClass,t)},Hc=Fl("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`color${Zl(n.color)}`]]}})(Kl(({theme:e})=>({display:"inline-block",variants:[{props:{variant:"determinate"},style:{transition:e.transitions.create("transform")}},{props:{variant:"indeterminate"},style:Wc||{animation:`${Bc} 1.4s linear infinite`}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}}))]}))),Uc=Fl("svg",{name:"MuiCircularProgress",slot:"Svg"})({display:"block"}),qc=Fl("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.circle,n.disableShrink&&t.circleDisableShrink]}})(Kl(({theme:e})=>({stroke:"currentColor",variants:[{props:{variant:"determinate"},style:{transition:e.transitions.create("stroke-dashoffset")}},{props:{variant:"indeterminate"},style:{strokeDasharray:"80px, 200px",strokeDashoffset:0}},{props:({ownerState:e})=>"indeterminate"===e.variant&&!e.disableShrink,style:Vc||{animation:`${Gc} 1.4s ease-in-out infinite`}}]}))),Kc=Fl("circle",{name:"MuiCircularProgress",slot:"Track"})(Kl(({theme:e})=>({stroke:"currentColor",opacity:(e.vars||e).palette.action.activatedOpacity}))),Zc=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiCircularProgress"}),{className:o,color:a="primary",disableShrink:i=!1,enableTrackSlot:s=!1,min:l,max:c,size:d=40,style:u,thickness:p=3.6,value:m=n.min??0,variant:h="indeterminate",...g}=n,y=l??0,b=c??100,v={...n,color:a,disableShrink:i,size:d,thickness:p,value:m,variant:h,enableTrackSlot:s},w=useUtilityClasses$49(v),S={},x={},I={};if("determinate"===h){const e=2*Math.PI*((Dc-p)/2),t=b-y;S.strokeDasharray=e.toFixed(3),S.strokeDashoffset=t>0?`${((b-m)/t*e).toFixed(3)}px`:`${e.toFixed(3)}px`,x.transform="rotate(-90deg)",I["aria-valuenow"]=m,I["aria-valuemin"]=y,I["aria-valuemax"]=b}return(0,ps.jsx)(Hc,{className:clsx(w.root,o),style:{width:d,height:d,...x,...u},ownerState:v,ref:t,role:"progressbar",...I,...g,children:(0,ps.jsxs)(Uc,{className:w.svg,ownerState:v,viewBox:`${Dc/2} ${Dc/2} ${Dc} ${Dc}`,children:[s?(0,ps.jsx)(Kc,{className:w.track,ownerState:v,cx:Dc,cy:Dc,r:(Dc-p)/2,fill:"none",strokeWidth:p,"aria-hidden":"true"}):null,(0,ps.jsx)(qc,{className:w.circle,style:S,ownerState:v,cx:Dc,cy:Dc,r:(Dc-p)/2,fill:"none",strokeWidth:p})]})})});function getButtonUtilityClass(e){return generateUtilityClass("MuiButton",e)}var Yc=generateUtilityClasses("MuiButton",["root","text","outlined","contained","disableElevation","focusVisible","disabled","colorInherit","colorPrimary","colorSecondary","colorSuccess","colorError","colorInfo","colorWarning","sizeMedium","sizeSmall","sizeLarge","fullWidth","startIcon","endIcon","icon","loading","loadingWrapper","loadingIconPlaceholder","loadingIndicator","loadingPositionCenter","loadingPositionStart","loadingPositionEnd"]),Xc=c.createContext({}),Jc=c.createContext(void 0),useUtilityClasses$48=e=>{const{color:t,disableElevation:n,fullWidth:o,size:a,variant:i,loading:s,loadingPosition:l,classes:c}=e,d=composeClasses({root:["root",s&&"loading",i,`size${Zl(a)}`,`color${Zl(t)}`,n&&"disableElevation",o&&"fullWidth",s&&`loadingPosition${Zl(l)}`],startIcon:["icon","startIcon"],endIcon:["icon","endIcon"],loadingIndicator:["loadingIndicator"],loadingWrapper:["loadingWrapper"]},getButtonUtilityClass,c);return{...c,...d}},Qc=[{props:{size:"small"},style:{"& > *:nth-of-type(1)":{fontSize:18}}},{props:{size:"medium"},style:{"& > *:nth-of-type(1)":{fontSize:20}}},{props:{size:"large"},style:{"& > *:nth-of-type(1)":{fontSize:22}}}],ed=Fl(Lc,{shouldForwardProp:e=>rootShouldForwardProp(e)||"classes"===e,name:"MuiButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${Zl(n.size)}`],"inherit"===n.color&&t.colorInherit,n.disableElevation&&t.disableElevation,n.fullWidth&&t.fullWidth,n.loading&&t.loading]}})(Kl(({theme:e})=>{const t="light"===e.palette.mode?e.palette.grey[300]:e.palette.grey[800],n="light"===e.palette.mode?e.palette.grey.A100:e.palette.grey[700];return{...e.typography.button,minWidth:64,padding:"6px 16px",border:0,borderRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create(["background-color","box-shadow","border-color","color"],{duration:e.transitions.duration.short}),"&:hover":{textDecoration:"none"},[`&.${Yc.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:({ownerState:e})=>e.startIcon||e.loading&&"start"===e.loadingPosition,style:{"&::before":{content:'"\\200b"',width:0,overflow:"hidden"}}},{props:{variant:"contained"},style:{color:"var(--variant-containedColor)",backgroundColor:"var(--variant-containedBg)",boxShadow:(e.vars||e).shadows[2],"&:hover":{boxShadow:(e.vars||e).shadows[4],"@media (hover: none)":{boxShadow:(e.vars||e).shadows[2]}},"&:active":{boxShadow:(e.vars||e).shadows[8]},[`&.${Yc.focusVisible}`]:{boxShadow:(e.vars||e).shadows[6]},[`&.${Yc.disabled}`]:{color:(e.vars||e).palette.action.disabled,boxShadow:(e.vars||e).shadows[0],backgroundColor:(e.vars||e).palette.action.disabledBackground}}},{props:{variant:"outlined"},style:{padding:"5px 15px",border:"1px solid currentColor",borderColor:"var(--variant-outlinedBorder, currentColor)",backgroundColor:"var(--variant-outlinedBg)",color:"var(--variant-outlinedColor)",[`&.${Yc.disabled}`]:{border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`}}},{props:{variant:"text"},style:{padding:"6px 8px",color:"var(--variant-textColor)",backgroundColor:"var(--variant-textBg)"}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t},style:{"--variant-textColor":(e.vars||e).palette[t].main,"--variant-outlinedColor":(e.vars||e).palette[t].main,"--variant-outlinedBorder":e.alpha((e.vars||e).palette[t].main,.5),"--variant-containedColor":(e.vars||e).palette[t].contrastText,"--variant-containedBg":(e.vars||e).palette[t].main,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":(e.vars||e).palette[t].dark,"--variant-textBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBorder":(e.vars||e).palette[t].main,"--variant-outlinedBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}}})),{props:{color:"inherit"},style:{color:"inherit",borderColor:"currentColor","--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedBg:t,"@media (hover: hover)":{"&:hover":{"--variant-containedBg":e.vars?e.vars.palette.Button.inheritContainedHoverBg:n,"--variant-textBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity),"--variant-outlinedBg":e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity)}}}},{props:{size:"small",variant:"text"},style:{padding:"4px 5px",fontSize:e.typography.pxToRem(13)}},{props:{size:"large",variant:"text"},style:{padding:"8px 11px",fontSize:e.typography.pxToRem(15)}},{props:{size:"small",variant:"outlined"},style:{padding:"3px 9px",fontSize:e.typography.pxToRem(13)}},{props:{size:"large",variant:"outlined"},style:{padding:"7px 21px",fontSize:e.typography.pxToRem(15)}},{props:{size:"small",variant:"contained"},style:{padding:"4px 10px",fontSize:e.typography.pxToRem(13)}},{props:{size:"large",variant:"contained"},style:{padding:"8px 22px",fontSize:e.typography.pxToRem(15)}},{props:{disableElevation:!0},style:{boxShadow:"none","&:hover":{boxShadow:"none"},[`&.${Yc.focusVisible}`]:{boxShadow:"none"},"&:active":{boxShadow:"none"},[`&.${Yc.disabled}`]:{boxShadow:"none"}}},{props:{fullWidth:!0},style:{width:"100%"}},{props:{loadingPosition:"center"},style:{transition:e.transitions.create(["background-color","box-shadow","border-color"],{duration:e.transitions.duration.short}),[`&.${Yc.loading}`]:{color:"transparent"}}}]}})),td=Fl("span",{name:"MuiButton",slot:"StartIcon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.startIcon,n.loading&&t.startIconLoadingStart]}})(({theme:e})=>({display:"inherit",marginRight:8,marginLeft:-4,variants:[{props:{size:"small"},style:{marginLeft:-2}},{props:{loadingPosition:"start",loading:!0},style:{transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:"start",loading:!0,fullWidth:!0},style:{marginRight:-8}},...Qc]})),rd=Fl("span",{name:"MuiButton",slot:"EndIcon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.endIcon,n.loading&&t.endIconLoadingEnd]}})(({theme:e})=>({display:"inherit",marginRight:-4,marginLeft:8,variants:[{props:{size:"small"},style:{marginRight:-2}},{props:{loadingPosition:"end",loading:!0},style:{transition:e.transitions.create(["opacity"],{duration:e.transitions.duration.short}),opacity:0}},{props:{loadingPosition:"end",loading:!0,fullWidth:!0},style:{marginLeft:-8}},...Qc]})),nd=Fl("span",{name:"MuiButton",slot:"LoadingIndicator"})(({theme:e})=>({display:"none",position:"absolute",visibility:"visible",variants:[{props:{loading:!0},style:{display:"flex"}},{props:{loadingPosition:"start"},style:{left:14}},{props:{loadingPosition:"start",size:"small"},style:{left:10}},{props:{variant:"text",loadingPosition:"start"},style:{left:6}},{props:{loadingPosition:"center"},style:{left:"50%",transform:"translate(-50%)",color:(e.vars||e).palette.action.disabled}},{props:{loadingPosition:"end"},style:{right:14}},{props:{loadingPosition:"end",size:"small"},style:{right:10}},{props:{variant:"text",loadingPosition:"end"},style:{right:6}},{props:{loadingPosition:"start",fullWidth:!0},style:{position:"relative",left:-10}},{props:{loadingPosition:"end",fullWidth:!0},style:{position:"relative",right:-10}}]})),od=Fl("span",{name:"MuiButton",slot:"LoadingIconPlaceholder"})({display:"inline-block",width:"1em",height:"1em"}),ad=c.forwardRef(function(e,t){const n=c.useContext(Xc),o=c.useContext(Jc),a=useDefaultProps({props:resolveProps(n,e),name:"MuiButton"}),{children:i,color:s="primary",component:l="button",className:d,disabled:u=!1,disableElevation:p=!1,disableFocusRipple:m=!1,endIcon:h,focusVisibleClassName:g,fullWidth:y=!1,id:b,loading:v=null,loadingIndicator:w,loadingPosition:S="center",size:x="medium",startIcon:I,type:C,variant:E="text",...R}=a,k=cc(b),T=w??(0,ps.jsx)(Zc,{"aria-labelledby":k,color:"inherit",size:16}),M={...a,color:s,component:l,disabled:u,disableElevation:p,disableFocusRipple:m,fullWidth:y,loading:v,loadingIndicator:T,loadingPosition:S,size:x,type:C,variant:E},$=useUtilityClasses$48(M),N=(I||v&&"start"===S)&&(0,ps.jsx)(td,{className:$.startIcon,ownerState:M,children:I||(0,ps.jsx)(od,{className:$.loadingIconPlaceholder,ownerState:M})}),P=(h||v&&"end"===S)&&(0,ps.jsx)(rd,{className:$.endIcon,ownerState:M,children:h||(0,ps.jsx)(od,{className:$.loadingIconPlaceholder,ownerState:M})}),O=o||"",j="boolean"==typeof v?(0,ps.jsx)("span",{className:$.loadingWrapper,style:{display:"contents"},children:v&&(0,ps.jsx)(nd,{className:$.loadingIndicator,ownerState:M,children:T})}):null,{root:F,...L}=$;return(0,ps.jsxs)(ed,{ownerState:M,className:clsx(n.className,$.root,d,O),component:l,disabled:u||v,focusRipple:!m,focusVisibleClassName:clsx($.focusVisible,g),ref:t,internalNativeButton:!0,type:C,id:v?k:b,...R,classes:L,children:[N,"end"!==S&&j,i,"end"===S&&j,P]})});function ExitFooter(){const{router:e,viewModel:t}=useNexMap(),{exits:n}=useNexMapSnapshot();return(0,ps.jsxs)(Hl,{component:"footer",className:"nexmap4-tab-footer","data-nexmap4-tab-footer":"true",sx:{alignItems:"center",backgroundColor:"rgba(0, 0, 0, 0.4)",borderTop:1,borderColor:"divider",display:"flex",flexWrap:"wrap",gap:.5,mt:"auto",position:"relative",px:1,py:.5,wordWrap:"break-word",zIndex:1},children:[(0,ps.jsx)(Jl,{className:"nexmap4-tab-footer__label",sx:{color:"text.secondary"},children:"Exits:"}),n.length>0?n.map((o,a)=>(0,ps.jsxs)(Hl,{component:"span",className:"nexmap4-exit-item",sx:{alignItems:"baseline",display:"inline-flex",minWidth:0},children:[(0,ps.jsx)(ad,{className:"nexmap4-exit-command",onClick:()=>{o.command?.startsWith("#")?e?.dispatch("travel.toRoom",{roomId:o.targetId}):t.executeExit(o.id)},title:o.targetName?`${o.targetName} (${o.targetId})`:`Room ${o.targetId}`,variant:"outlined",size:"small",sx:{borderColor:"divider",color:"text.primary",lineHeight:1.4,minWidth:0,px:.75,py:.125,"&:hover":{borderColor:"primary.main",bgcolor:"action.hover"}},children:o.label}),a<n.length-1?(0,ps.jsx)(Hl,{component:"span","aria-hidden":"true",className:"nexmap4-exit-separator",sx:{color:"text.secondary",lineHeight:1.4,textDecoration:"none"},children:","}):null]},o.id)):(0,ps.jsxs)(Jl,{variant:"caption",component:"span",className:"nexmap4-exit-empty",sx:{color:"text.secondary"},children:[" ","none"]})]})}var id=c.createContext(void 0);function useRovingTabIndexContext(){const e=c.useContext(id);if(void 0===e)throw new Error("MUI: RovingTabIndexContext is missing. Roving tab index items must be placed within a roving tab index provider.");return e}var sd=Object.is;function fastObjectShallowCompare(e,t){if(e===t)return!0;if(!(e instanceof Object&&t instanceof Object))return!1;let n=0,o=0;for(const a in e){if(n+=1,!sd(e[a],t[a]))return!1;if(!(a in t))return!1}for(const a in t)o+=1;return n===o}var ld=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End"];function useRovingTabIndexRoot(e){const{activeItemId:t,getDefaultActiveItemId:n,orientation:o,isRtl:a=!1,isItemFocusable:i=isItemFocusable,wrap:s=!0}=e,[l,d]=c.useState(t),u=c.useRef(t);let p=l;t!==u.current&&(u.current=t,void 0!==t&&t!==l&&(p=t,d(t)));const m=c.useRef(null),h=c.useRef(new Map),[g,y]=c.useState(0),b=resolveActiveItemId(p,c.useMemo(()=>getOrderedItems(h.current),[g]),i,n),v=c.useRef(b);v.current=b;const w=c.useCallback(()=>{const e=getOrderedItems(h.current);return getItemById(e,resolveActiveItemId(v.current,e,i,n))},[n,i]),S=c.useCallback(()=>h.current,[]),x=useEventCallback(e=>{fastObjectShallowCompare(h.current.get(e.id)??null,e)||(h.current.set(e.id,e),y(e=>e+1))}),I=useEventCallback(e=>{h.current.delete(e)&&y(e=>e+1)}),C=useEventCallback(e=>{d(e)}),E=c.useCallback(e=>v.current===e,[]),R=c.useCallback((e,t,n,o)=>{const a=getNextActiveItem(getNavigableItemsSnapshot(h.current),e,t,n,o??i);return a?(a.element?.focus(),d(a.id),a):null},[i]),k=c.useCallback(e=>({onFocus:e=>{const t=getNavigableItemsSnapshot(h.current),n=findItemIndexByElement(t,e.target);-1!==n&&d(t[n].id)},onKeyDown:e=>{if(e.altKey||e.shiftKey||e.ctrlKey||e.metaKey)return;if(!ld.includes(e.key))return;let t="horizontal"===o?"ArrowLeft":"ArrowUp",n="horizontal"===o?"ArrowRight":"ArrowDown";"horizontal"===o&&a&&(t="ArrowRight",n="ArrowLeft");const i=getNavigableItemsSnapshot(h.current),l=activeElement(ownerDocument(m.current)),c=l===m.current;let d=getCurrentActiveItemIndex(i,l,v.current),u="next";switch(e.key){case t:u="previous",e.preventDefault(),c&&(d=i.length);break;case n:e.preventDefault(),c&&(d=-1);break;case"Home":e.preventDefault(),d=-1;break;case"End":e.preventDefault(),u="previous",d=i.length;break;default:return}R(d,u,s)},ref:handleRefs(e,e=>{m.current=e})}),[R,a,o,s]),T=c.useCallback(e=>{const t=getNavigableItemsSnapshot(h.current),n=activeElement(ownerDocument(m.current));return R(n===m.current?-1:getCurrentActiveItemIndex(t,n,v.current),"next",!0,e)?.id??null},[R]);return c.useMemo(()=>({activeItemId:b,focusNext:T,getActiveItem:w,getContainerProps:k,getItemMap:S,isItemActive:E,registerItem:x,setActiveItemId:C,unregisterItem:I}),[b,T,w,k,S,E,x,C,I])}function useRovingTabIndexItem(e){const{activeItemId:t,registerItem:n,unregisterItem:o}=useRovingTabIndexContext(),a=c.useRef(null),i=c.useMemo(()=>({disabled:e.disabled??!1,element:null,focusableWhenDisabled:e.focusableWhenDisabled??!1,id:e.id,selected:e.selected??!1,textValue:e.textValue}),[e.disabled,e.focusableWhenDisabled,e.id,e.selected,e.textValue]),s=c.useRef(i);s.current=i;const l=c.useCallback(t=>{a.current=t,null!=t?n({...s.current,element:t}):queueMicrotask(()=>{null==a.current&&o(e.id)})},[e.id,n,o]),d=useForkRef(e.ref,l);return nl(()=>{a.current&&n({...i,element:a.current})},[i,n]),nl(()=>{const t=e.id;return()=>{o(t)}},[e.id,o]),{ref:d,tabIndex:t===e.id?0:-1}}function resolveActiveItemId(e,t,n,o){return null!=e?resolveRequestedItemId(e,t,n):resolveDefaultItemId(t,n,o)}function resolveRequestedItemId(e,t,n){const o=findItemIndexById(t,e);return-1===o?getFirstFocusableItemId(t,n):n(t[o])?t[o].id:getNextActiveItem(t,o,"next",!1,n)?.id??null}function resolveDefaultItemId(e,t,n){const o=n?.(e);if(null!=o){const n=getItemById(e,o);if(n&&t(n))return n.id}return getFirstFocusableItemId(e,t)}function getCurrentActiveItemIndex(e,t,n){if(t){const n=findItemIndexByElement(e,t);if(-1!==n)return n}return findItemIndexById(e,n)}function getNextActiveItem(e,t,n,o,a){const i=e.length-1;if(-1===i)return null;let s=!1,l=getNextIndex(t,i,n,o);const c=l;for(;-1!==l;){if(l===c){if(s)return null;s=!0}const t=e[l];if(t&&a(t))return t;l=getNextIndex(l,i,n,o)}return null}function getFirstFocusableItemId(e,t){return e.find(e=>t(e))?.id??null}function getItemById(e,t){return null==t?null:e.find(e=>e.id===t)??null}function findItemIndexById(e,t){return null==t?-1:e.findIndex(e=>e.id===t)}function findItemIndexByElement(e,t){return t?e.findIndex(e=>e.element===t||e.element?.contains(t)):-1}function getOrderedItems(e){const t=Array.from(e.values());return t.every(e=>null==e.element)?t:[...t.filter(isConnectedItem).sort((e,t)=>sortByDocumentPosition(e.element,t.element)),...t.filter(e=>!isConnectedItem(e))]}function getNavigableItemsSnapshot(e){return getOrderedItems(e).filter(isConnectedItem)}function getNextIndex(e,t,n,o=!0){return"next"===n?e===t?o?0:-1:e+1:0===e?o?t:-1:e-1}function isItemFocusable(e){return!!e.element&&(!!e.focusableWhenDisabled||!e.disabled&&!e.element.hasAttribute("disabled")&&"true"!==e.element.getAttribute("aria-disabled")&&e.element.hasAttribute("tabindex"))}function isConnectedItem(e){return null!=e.element&&e.element.isConnected}function sortByDocumentPosition(e,t){if(e===t)return 0;const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}function handleRefs(...e){return t=>{e.forEach(e=>{setRef(e??null,t)})}}function getTabUtilityClass(e){return generateUtilityClass("MuiTab",e)}var cd=generateUtilityClasses("MuiTab",["root","labelIcon","textColorInherit","textColorPrimary","textColorSecondary","selected","disabled","fullWidth","wrapped","icon"]),useUtilityClasses$47=e=>{const{classes:t,textColor:n,fullWidth:o,wrapped:a,icon:i,label:s,selected:l,disabled:c}=e;return composeClasses({root:["root",i&&s&&"labelIcon",`textColor${Zl(n)}`,o&&"fullWidth",a&&"wrapped",l&&"selected",c&&"disabled"],icon:["icon"]},getTabUtilityClass,t)},dd=Fl(Lc,{name:"MuiTab",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.label&&n.icon&&t.labelIcon,t[`textColor${Zl(n.textColor)}`],n.fullWidth&&t.fullWidth,n.wrapped&&t.wrapped,{[`& .${cd.icon}`]:t.icon}]}})(Kl(({theme:e})=>({...e.typography.button,maxWidth:360,minWidth:90,position:"relative",minHeight:48,flexShrink:0,padding:"12px 16px",overflow:"hidden",whiteSpace:"normal",textAlign:"center",lineHeight:1.25,variants:[{props:({ownerState:e})=>e.label&&("top"===e.iconPosition||"bottom"===e.iconPosition),style:{flexDirection:"column"}},{props:({ownerState:e})=>e.label&&"top"!==e.iconPosition&&"bottom"!==e.iconPosition,style:{flexDirection:"row"}},{props:({ownerState:e})=>e.icon&&e.label,style:{minHeight:72,paddingTop:9,paddingBottom:9}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&"top"===t,style:{[`& > .${cd.icon}`]:{marginBottom:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&"bottom"===t,style:{[`& > .${cd.icon}`]:{marginTop:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&"start"===t,style:{[`& > .${cd.icon}`]:{marginRight:e.spacing(1)}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&"end"===t,style:{[`& > .${cd.icon}`]:{marginLeft:e.spacing(1)}}},{props:{textColor:"inherit"},style:{color:"inherit",opacity:.6,[`&.${cd.selected}`]:{opacity:1},[`&.${cd.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity}}},{props:{textColor:"primary"},style:{color:(e.vars||e).palette.text.secondary,[`&.${cd.selected}`]:{color:(e.vars||e).palette.primary.main},[`&.${cd.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:{textColor:"secondary"},style:{color:(e.vars||e).palette.text.secondary,[`&.${cd.selected}`]:{color:(e.vars||e).palette.secondary.main},[`&.${cd.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:({ownerState:e})=>e.fullWidth,style:{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:"none"}},{props:({ownerState:e})=>e.wrapped,style:{fontSize:e.typography.pxToRem(12)}}]}))),ud=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTab"}),{className:o,disabled:a=!1,disableFocusRipple:i=!1,fullWidth:s,icon:l,iconPosition:d="top",indicator:u,label:p,onChange:m,onClick:h,onFocus:g,selected:y,selectionFollowsFocus:b,textColor:v="inherit",value:w,wrapped:S=!1,...x}=n,I=useRovingTabIndexContext(),C=useRovingTabIndexItem({id:w,ref:t,disabled:a,selected:y}),E=0===I.getItemMap().size&&y?0:C.tabIndex,R={...n,disabled:a,disableFocusRipple:i,selected:y,icon:!!l,iconPosition:d,label:!!p,fullWidth:s,textColor:v,wrapped:S},k=useUtilityClasses$47(R),T=l&&p&&c.isValidElement(l)?c.cloneElement(l,{className:clsx(k.icon,l.props.className)}):l,handleClick=e=>{!y&&m&&m(e,w),h&&h(e)},handleFocus=e=>{b&&!y&&m&&m(e,w),g&&g(e)};return(0,ps.jsxs)(dd,{internalNativeButton:!0,focusRipple:!i,className:clsx(k.root,o),ref:C.ref,role:"tab","aria-selected":y,disabled:a,onClick:handleClick,onFocus:handleFocus,tabIndex:E,ownerState:R,...x,children:["top"===d||"start"===d?(0,ps.jsxs)(c.Fragment,{children:[T,p]}):(0,ps.jsxs)(c.Fragment,{children:[p,T]}),u]})});function isHostComponent(e){return"string"==typeof e}function appendOwnerState(e,t,n){return void 0===e||isHostComponent(e)?t:{...t,ownerState:{...t.ownerState,...n}}}function extractEventHandlers(e){if(void 0===e)return{};const t={};for(const n of Object.keys(e))isEventHandler(n,e[n])&&(t[n]=e[n]);return t}function omitEventHandlers(e){if(void 0===e)return{};const t={};return Object.keys(e).filter(t=>!(t.match(/^on[A-Z]/)&&"function"==typeof e[t])).forEach(n=>{t[n]=e[n]}),t}function mergeSlotProps(e){const{getSlotProps:t,additionalProps:n,externalSlotProps:o,externalForwardedProps:a,className:i}=e;if(!t){const e=clsx(n?.className,i,a?.className,o?.className),t={...n?.style,...a?.style,...o?.style},s={...n,...a,...o};return e.length>0&&(s.className=e),Object.keys(t).length>0&&(s.style=t),{props:s,internalRef:void 0}}const s=extractEventHandlers({...a,...o}),l=omitEventHandlers(o),c=omitEventHandlers(a),d=t(s),u=clsx(d?.className,n?.className,i,a?.className,o?.className),p={...d?.style,...n?.style,...a?.style,...o?.style},m={...d,...n,...c,...l};return u.length>0&&(m.className=u),Object.keys(p).length>0&&(m.style=p),{props:m,internalRef:d.ref}}function resolveComponentProps(e,t,n){return"function"==typeof e?e(t,n):e}function useSlotProps(e){const{elementType:t,externalSlotProps:n,ownerState:o,skipResolvingSlotProps:a=!1,...i}=e,s=a?{}:resolveComponentProps(n,o),{props:l,internalRef:c}=mergeSlotProps({...i,externalSlotProps:s});return appendOwnerState(t,{...l,ref:useForkRef(c,s?.ref,e.additionalProps?.ref)},o)}function easeInOutSin(e){return(1+Math.sin(Math.PI*e-Math.PI/2))/2}function animate(e,t,n,o={},a=()=>{}){const{ease:i=easeInOutSin,duration:s=300}=o;let l=null;const c=t[e];let d=!1;const cancel=()=>{d=!0},step=o=>{if(d)return void a(new Error("Animation cancelled"));null===l&&(l=o);const u=Math.min(1,(o-l)/s);t[e]=i(u)*(n-c)+c,u>=1?requestAnimationFrame(()=>{a(null)}):requestAnimationFrame(step)};return c===n?(a(new Error("Element already at target position")),cancel):(requestAnimationFrame(step),cancel)}var pd={width:99,height:99,position:"absolute",top:-9999,overflow:"scroll",pointerEvents:"none"};function ScrollbarSize(e){const{onChange:t,...n}=e,o=c.useRef(),a=c.useRef(null),setMeasurements=()=>{o.current=a.current.offsetHeight-a.current.clientHeight};return lc(()=>{const e=nc(()=>{const e=o.current;setMeasurements(),e!==o.current&&t(o.current)}),n=sc(a.current);return n.addEventListener("resize",e),()=>{e.clear(),n.removeEventListener("resize",e)}},[t]),c.useEffect(()=>{setMeasurements(),t(o.current)},[t]),(0,ps.jsx)("div",{style:pd,...n,ref:a})}var md=createSvgIcon((0,ps.jsx)("path",{d:"M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"}),"KeyboardArrowLeft"),hd=createSvgIcon((0,ps.jsx)("path",{d:"M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"}),"KeyboardArrowRight");function getTabScrollButtonUtilityClass(e){return generateUtilityClass("MuiTabScrollButton",e)}var gd=generateUtilityClasses("MuiTabScrollButton",["root","vertical","horizontal","disabled"]),useUtilityClasses$46=e=>{const{classes:t,orientation:n,disabled:o}=e;return composeClasses({root:["root",n,o&&"disabled"]},getTabScrollButtonUtilityClass,t)},fd=Fl(Lc,{name:"MuiTabScrollButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.orientation&&t[n.orientation]]}})({width:40,flexShrink:0,opacity:.8,[`&.${gd.disabled}`]:{opacity:0},variants:[{props:{orientation:"vertical"},style:{width:"100%",height:40,"& svg":{transform:"var(--TabScrollButton-svgRotate)"}}}]}),yd=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTabScrollButton"}),{className:o,slots:a={},slotProps:i={},direction:s,orientation:l,disabled:c,...d}=n,{nativeButton:u,...p}=d,m=useRtl(),h={isRtl:m,...n},g=useUtilityClasses$46(h),y=a.StartScrollButtonIcon??md,b=a.EndScrollButtonIcon??hd,v=useSlotProps({elementType:y,externalSlotProps:i.startScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:h}),w=useSlotProps({elementType:b,externalSlotProps:i.endScrollButtonIcon,additionalProps:{fontSize:"small"},ownerState:h});return(0,ps.jsx)(fd,{component:"div",className:clsx(g.root,o),ref:t,role:null,ownerState:h,tabIndex:null,...p,style:{...p.style,..."vertical"===l&&{"--TabScrollButton-svgRotate":`rotate(${m?-90:90}deg)`}},children:"left"===s?(0,ps.jsx)(y,{...v}):(0,ps.jsx)(b,{...w})})});function getTabsUtilityClass(e){return generateUtilityClass("MuiTabs",e)}var bd=generateUtilityClasses("MuiTabs",["root","vertical","list","centered","scroller","fixed","scrollableX","scrollableY","hideScrollbar","scrollButtons","scrollButtonsHideMobile","indicator"]);function useSlot(e,t){const{className:n,elementType:o,ownerState:a,externalForwardedProps:i,internalForwardedProps:s,shouldForwardComponentProp:l=!1,...c}=t,{component:d,slots:u={[e]:void 0},slotProps:p={[e]:void 0},...m}=i,h=u[e]||o,g=resolveComponentProps(p[e],a),{props:{component:y,...b},internalRef:v}=mergeSlotProps({className:n,...c,externalForwardedProps:"root"===e?m:void 0,externalSlotProps:g}),w=useForkRef(v,g?.ref,t.ref),S="root"===e?y||d:y;return[h,appendOwnerState(h,{..."root"===e&&!d&&!u[e]&&s,..."root"!==e&&!u[e]&&s,...b,...S&&!l&&{as:S},...S&&l&&{component:S},ref:w},a)]}function contains$1(e,t){if(!e||!t)return!1;if(e.contains(t))return!0;const n=t.getRootNode?.();if(n&&n instanceof ShadowRoot){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode??n.host??null}}return!1}var vd=contains$1,useUtilityClasses$45=e=>{const{vertical:t,fixed:n,hideScrollbar:o,scrollableX:a,scrollableY:i,centered:s,scrollButtonsHideMobile:l,classes:c}=e;return composeClasses({root:["root",t&&"vertical"],scroller:["scroller",n&&"fixed",o&&"hideScrollbar",a&&"scrollableX",i&&"scrollableY"],list:["list",t&&"vertical",s&&"centered"],indicator:["indicator"],scrollButtons:["scrollButtons",l&&"scrollButtonsHideMobile"],scrollableX:[a&&"scrollableX"],hideScrollbar:[o&&"hideScrollbar"]},getTabsUtilityClass,c)},wd=Fl("div",{name:"MuiTabs",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${bd.scrollButtons}`]:t.scrollButtons},{[`& .${bd.scrollButtons}`]:n.scrollButtonsHideMobile&&t.scrollButtonsHideMobile},t.root,n.vertical&&t.vertical]}})(Kl(({theme:e})=>({overflow:"hidden",minHeight:48,WebkitOverflowScrolling:"touch",display:"flex",variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:"column"}},{props:({ownerState:e})=>e.scrollButtonsHideMobile,style:{[`& .${bd.scrollButtons}`]:{[e.breakpoints.down("sm")]:{display:"none"}}}}]}))),Sd=Fl("div",{name:"MuiTabs",slot:"Scroller",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.scroller,n.fixed&&t.fixed,n.hideScrollbar&&t.hideScrollbar,n.scrollableX&&t.scrollableX,n.scrollableY&&t.scrollableY]}})({position:"relative",display:"inline-block",flex:"1 1 auto",whiteSpace:"nowrap",variants:[{props:({ownerState:e})=>e.fixed,style:{overflowX:"hidden",width:"100%"}},{props:({ownerState:e})=>e.hideScrollbar,style:{scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}},{props:({ownerState:e})=>e.scrollableX,style:{overflowX:"auto",overflowY:"hidden"}},{props:({ownerState:e})=>e.scrollableY,style:{overflowY:"auto",overflowX:"hidden"}}]}),xd=Fl("div",{name:"MuiTabs",slot:"List",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.list,n.centered&&t.centered]}})({display:"flex",variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:"column"}},{props:({ownerState:e})=>e.centered,style:{justifyContent:"center"}}]}),Id=Fl("span",{name:"MuiTabs",slot:"Indicator"})(Kl(({theme:e})=>({position:"absolute",height:2,bottom:0,width:"100%",transition:e.transitions.create(),variants:[{props:{indicatorColor:"primary"},style:{backgroundColor:(e.vars||e).palette.primary.main}},{props:{indicatorColor:"secondary"},style:{backgroundColor:(e.vars||e).palette.secondary.main}},{props:({ownerState:e})=>e.vertical,style:{height:"100%",width:2,right:0}}]}))),Cd=Fl(ScrollbarSize)({overflowX:"auto",overflowY:"hidden",scrollbarWidth:"none","&::-webkit-scrollbar":{display:"none"}}),Ed={},Rd=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTabs"}),o=useTheme(),a=useRtl(),{"aria-label":i,"aria-labelledby":s,action:l,centered:d=!1,children:u,className:p,component:m="div",allowScrollButtonsMobile:h=!1,indicatorColor:g="primary",onChange:y,orientation:b="horizontal",scrollButtons:v="auto",selectionFollowsFocus:w,slots:S={},slotProps:x={},textColor:I="primary",value:C,variant:E="standard",visibleScrollbar:R=!1,...k}=n,T="scrollable"===E,M="vertical"===b,$=M?"scrollTop":"scrollLeft",N=M?"top":"left",P=M?"bottom":"right",O=M?"clientHeight":"clientWidth",j=M?"height":"width",F={...n,component:m,allowScrollButtonsMobile:h,indicatorColor:g,orientation:b,vertical:M,scrollButtons:v,textColor:I,variant:E,visibleScrollbar:R,fixed:!T,hideScrollbar:T&&!R,scrollableX:T&&!M,scrollableY:T&&M,centered:d&&!T,scrollButtonsHideMobile:!h},L=useUtilityClasses$45(F),D=useSlotProps({elementType:S.startScrollButtonIcon,externalSlotProps:x.startScrollButtonIcon,ownerState:F}),B=useSlotProps({elementType:S.endScrollButtonIcon,externalSlotProps:x.endScrollButtonIcon,ownerState:F}),[G,W]=c.useState(!1),[V,H]=c.useState(Ed),[U,q]=c.useState(!1),[K,Z]=c.useState(!1),[Y,X]=c.useState(!1),J=!1===C?null:C,[Q,ee]=c.useState(!1),[te,re]=c.useState({overflow:"hidden",scrollbarWidth:0}),ne=new Map,oe=c.useRef(null),ae=c.useRef(null),ie={slots:S,slotProps:x},getTabsMeta=()=>{const e=oe.current;let t,n;if(e){const n=e.getBoundingClientRect();t={clientWidth:e.clientWidth,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,scrollWidth:e.scrollWidth,top:n.top,bottom:n.bottom,left:n.left,right:n.right}}if(e&&!1!==C){const e=ae.current.children;if(e.length>0){const t=e[ne.get(C)];n=t?t.getBoundingClientRect():null}}return{tabsMeta:t,tabMeta:n}},se=uc(()=>{const{tabsMeta:e,tabMeta:t}=getTabsMeta();let n,o=0;M?(n="top",t&&e&&(o=t.top-e.top+e.scrollTop)):(n=a?"right":"left",t&&e&&(o=(a?-1:1)*(t[n]-e[n]+e.scrollLeft)));const i={[n]:o,[j]:t?t[j]:0};if("number"!=typeof V[n]||"number"!=typeof V[j])H(i);else{const e=Math.abs(V[n]-i[n]),t=Math.abs(V[j]-i[j]);(e>=1||t>=1)&&H(i)}}),scroll=(e,{animation:t=!0}={})=>{t?animate($,oe.current,e,{duration:o.transitions.duration.standard}):oe.current[$]=e},moveTabsScroll=e=>{let t=oe.current[$];t+=M?e:e*(a?-1:1),scroll(t)},getScrollSize=()=>{const e=oe.current[O];let t=0;const n=Array.from(ae.current.children);for(let o=0;o<n.length;o+=1){const a=n[o];if(t+a[O]>e){0===o&&(t=e);break}t+=a[O]}return t},handleStartScrollClick=()=>{moveTabsScroll(-1*getScrollSize())},handleEndScrollClick=()=>{moveTabsScroll(getScrollSize())},[le,{onChange:ce,...de}]=useSlot("scrollbar",{className:clsx(L.scrollableX,L.hideScrollbar),elementType:Cd,shouldForwardComponentProp:!0,externalForwardedProps:ie,ownerState:F}),ue=c.useCallback(e=>{ce?.(e),re({overflow:null,scrollbarWidth:e})},[ce]),[pe,me]=useSlot("scrollButtons",{className:L.scrollButtons,elementType:yd,externalForwardedProps:ie,ownerState:F,additionalProps:{orientation:b,slots:{StartScrollButtonIcon:S.startScrollButtonIcon,EndScrollButtonIcon:S.endScrollButtonIcon},slotProps:{startScrollButtonIcon:D,endScrollButtonIcon:B}}}),getConditionalElements=()=>{const e={};e.scrollbarSizeListener=T?(0,ps.jsx)(le,{...de,onChange:ue}):null;const t=T&&("auto"===v&&(U||K)||!0===v);return e.scrollButtonStart=t?(0,ps.jsx)(pe,{direction:a?"right":"left",onClick:handleStartScrollClick,disabled:!U,...me}):null,e.scrollButtonEnd=t?(0,ps.jsx)(pe,{direction:a?"left":"right",onClick:handleEndScrollClick,disabled:!K,...me}):null,e},he=uc(e=>{const{tabsMeta:t,tabMeta:n}=getTabsMeta();n&&t&&(n[N]<t[N]?scroll(t[$]+(n[N]-t[N]),{animation:e}):n[P]>t[P]&&scroll(t[$]+(n[P]-t[P]),{animation:e}))}),ge=uc(()=>{T&&!1!==v&&X(!Y)});c.useEffect(()=>{const e=nc(()=>{oe.current&&se()});let t;const handleMutation=n=>{n.forEach(e=>{e.removedNodes.forEach(e=>{t?.unobserve(e)}),e.addedNodes.forEach(e=>{t?.observe(e)})}),e(),ge()},n=sc(oe.current);let o;return n.addEventListener("resize",e),"undefined"!=typeof ResizeObserver&&(t=new ResizeObserver(e),Array.from(ae.current.children).forEach(e=>{t.observe(e)})),"undefined"!=typeof MutationObserver&&(o=new MutationObserver(handleMutation),o.observe(ae.current,{childList:!0})),()=>{e.clear(),n.removeEventListener("resize",e),o?.disconnect(),t?.disconnect()}},[se,ge]),c.useEffect(()=>{const e=Array.from(ae.current.children),t=e.length;if("undefined"!=typeof IntersectionObserver&&t>0&&T&&!1!==v){const n=e[0],o=e[t-1],a={root:oe.current,threshold:.99},i=new IntersectionObserver(e=>{q(!e[0].isIntersecting)},a);i.observe(n);const s=new IntersectionObserver(e=>{Z(!e[0].isIntersecting)},a);return s.observe(o),()=>{i.disconnect(),s.disconnect()}}},[T,v,Y,u?.length]),c.useEffect(()=>{W(!0)},[]),c.useEffect(()=>{se()}),c.useEffect(()=>{he(Ed!==V)},[he,V]),c.useImperativeHandle(l,()=>({updateIndicator:se,updateScrollButtons:ge}),[se,ge]);const[fe,ye]=useSlot("indicator",{className:L.indicator,elementType:Id,externalForwardedProps:ie,ownerState:F,additionalProps:{style:V}}),be=(0,ps.jsx)(fe,{...ye}),ve=useRovingTabIndexRoot({activeItemId:Q?void 0:J,orientation:b,isRtl:a}),we=ve.getContainerProps(),Se=c.Children.toArray(u).filter(c.isValidElement).map((e,t)=>{const n=void 0===e.props.value?t:e.props.value;return ne.set(n,t),{child:e,index:t,childValue:n}}).map(({child:e,childValue:t})=>{const n=t===C;return c.cloneElement(e,{fullWidth:"fullWidth"===E,indicator:n&&!G&&be,selected:n,selectionFollowsFocus:w,onChange:y,textColor:I,value:t})}),xe=getConditionalElements(),[Ie,Ce]=useSlot("root",{ref:t,className:clsx(L.root,p),elementType:wd,externalForwardedProps:{...ie,...k,component:m},ownerState:F}),[Ee,Re]=useSlot("scroller",{ref:oe,className:L.scroller,elementType:Sd,externalForwardedProps:ie,ownerState:F,additionalProps:{style:{overflow:te.overflow,[M?"margin"+(a?"Left":"Right"):"marginBottom"]:R?void 0:-te.scrollbarWidth}}}),ke=pc(we.ref,ae),handleKeyDown=e=>{const t=ae.current;"tab"===ac(ic(t))?.getAttribute("role")&&we.onKeyDown(e)},[Ae,Te]=useSlot("list",{ref:ke,className:L.list,elementType:xd,externalForwardedProps:ie,ownerState:F,getSlotProps:e=>({...e,onBlur:t=>{vd(t.currentTarget,t.relatedTarget)||ee(!1),e.onBlur?.(t)},onKeyDown:t=>{handleKeyDown(t),e.onKeyDown?.(t)},onFocus:t=>{ee(!0),we.onFocus(t),e.onFocus?.(t)}})});return(0,ps.jsxs)(Ie,{...Ce,children:[xe.scrollButtonStart,xe.scrollbarSizeListener,(0,ps.jsxs)(Ee,{...Re,children:[(0,ps.jsx)(Ae,{"aria-label":i,"aria-labelledby":s,"aria-orientation":"vertical"===b?"vertical":null,role:"tablist",...Te,children:(0,ps.jsx)(id.Provider,{value:ve,children:Se})}),G&&be]}),xe.scrollButtonEnd]})});function getScrollbarSize(e=window){const t=e.document.documentElement.clientWidth;return e.innerWidth-t}function isOverflowing(e){const t=ownerDocument(e);return t.body===e?ownerWindow(e).innerWidth>t.documentElement.clientWidth:e.scrollHeight>e.clientHeight}function ariaHidden(e,t){t?e.setAttribute("aria-hidden","true"):e.removeAttribute("aria-hidden")}function getPaddingRight(e){return parseFloat(ownerWindow(e).getComputedStyle(e).paddingRight)||0}function isAriaHiddenForbiddenOnElement(e){const t=["TEMPLATE","SCRIPT","STYLE","LINK","MAP","META","NOSCRIPT","PICTURE","COL","COLGROUP","PARAM","SLOT","SOURCE","TRACK"].includes(e.tagName),n="INPUT"===e.tagName&&"hidden"===e.getAttribute("type");return t||n}function ariaHiddenSiblings(e,t,n,o,a){const i=[t,n,...o];[].forEach.call(e.children,e=>{const t=!i.includes(e),n=!isAriaHiddenForbiddenOnElement(e);t&&n&&ariaHidden(e,a)})}function findIndexOf(e,t){let n=-1;return e.some((e,o)=>!!t(e)&&(n=o,!0)),n}function handleContainer(e,t){const n=[],o=e.container;if(!t.disableScrollLock){if(isOverflowing(o)){const e=getScrollbarSize(ownerWindow(o));n.push({value:o.style.paddingRight,property:"padding-right",el:o}),o.style.paddingRight=`${getPaddingRight(o)+e}px`;const t=ownerDocument(o).querySelectorAll(".mui-fixed");[].forEach.call(t,t=>{n.push({value:t.style.paddingRight,property:"padding-right",el:t}),t.style.paddingRight=`${getPaddingRight(t)+e}px`})}let e;if(o.parentNode instanceof DocumentFragment)e=ownerDocument(o).body;else{const t=o.parentElement,n=ownerWindow(o);e="HTML"===t?.nodeName&&"scroll"===n.getComputedStyle(t).overflowY?t:o}n.push({value:e.style.overflow,property:"overflow",el:e},{value:e.style.overflowX,property:"overflow-x",el:e},{value:e.style.overflowY,property:"overflow-y",el:e}),e.style.overflow="hidden"}return()=>{n.forEach(({value:e,el:t,property:n})=>{e?t.style.setProperty(n,e):t.style.removeProperty(n)})}}function getHiddenSiblings(e){const t=[];return[].forEach.call(e.children,e=>{"true"===e.getAttribute("aria-hidden")&&t.push(e)}),t}var kd=class{constructor(){this.modals=[],this.containers=[]}add(e,t){let n=this.modals.indexOf(e);if(-1!==n)return n;n=this.modals.length,this.modals.push(e),e.modalRef&&ariaHidden(e.modalRef,!1);const o=getHiddenSiblings(t);ariaHiddenSiblings(t,e.mount,e.modalRef,o,!0);const a=findIndexOf(this.containers,e=>e.container===t);return-1!==a?(this.containers[a].modals.push(e),n):(this.containers.push({modals:[e],container:t,restore:null,hiddenSiblings:o}),n)}mount(e,t){const n=findIndexOf(this.containers,t=>t.modals.includes(e)),o=this.containers[n];o.restore||(o.restore=handleContainer(o,t))}remove(e,t=!0){const n=this.modals.indexOf(e);if(-1===n)return n;const o=findIndexOf(this.containers,t=>t.modals.includes(e)),a=this.containers[o];if(a.modals.splice(a.modals.indexOf(e),1),this.modals.splice(n,1),0===a.modals.length)a.restore&&a.restore(),e.modalRef&&ariaHidden(e.modalRef,t),ariaHiddenSiblings(a.container,e.mount,e.modalRef,a.hiddenSiblings,!1),this.containers.splice(o,1);else{const e=a.modals[a.modals.length-1];e.modalRef&&ariaHidden(e.modalRef,!1)}return n}isTopModal(e){return this.modals.length>0&&this.modals[this.modals.length-1]===e}};function getReactElementRef(e){return parseInt(c.version,10)>=19?e?.props?.ref||null:e?.ref||null}var Ad="data-mui-focusable";function getFocusTarget(e){return e?e.hasAttribute("data-mui-focusable")?e:e.querySelector(`[${Ad}]`):null}var Td=["input","select","textarea","a[href]","button","[tabindex]","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])'].join(",");function getTabIndex(e){const t=parseInt(e.getAttribute("tabindex")||"",10);return Number.isNaN(t)?"true"===e.contentEditable||("AUDIO"===e.nodeName||"VIDEO"===e.nodeName||"DETAILS"===e.nodeName)&&null===e.getAttribute("tabindex")?0:e.tabIndex:t}function isNonTabbableRadio(e){if("INPUT"!==e.tagName||"radio"!==e.type)return!1;if(!e.name)return!1;const getRadio=t=>e.ownerDocument.querySelector(`input[type="radio"]${t}`);let t=getRadio(`[name="${e.name}"]:checked`);return t||(t=getRadio(`[name="${e.name}"]`)),t!==e}function isNodeMatchingSelectorFocusable(e){return!(e.disabled||"INPUT"===e.tagName&&"hidden"===e.type||isNonTabbableRadio(e))}function defaultGetTabbable(e){const t=[],n=[];return Array.from(e.querySelectorAll(Td)).forEach((e,o)=>{const a=getTabIndex(e);-1!==a&&isNodeMatchingSelectorFocusable(e)&&(0===a?t.push(e):n.push({documentOrder:o,tabIndex:a,node:e}))}),n.sort((e,t)=>e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex).map(e=>e.node).concat(t)}function defaultIsEnabled(){return!0}function FocusTrap(e){const{children:t,disableAutoFocus:n=!1,disableEnforceFocus:o=!1,disableRestoreFocus:a=!1,getTabbable:i=defaultGetTabbable,isEnabled:s=defaultIsEnabled,open:l}=e,d=c.useRef(!1),u=c.useRef(null),p=c.useRef(null),m=c.useRef(null),h=c.useRef(null),g=c.useRef(!1),y=c.useRef(null),b=useForkRef(getReactElementRef(t),y),v=c.useRef(null);c.useEffect(()=>{l&&y.current&&(g.current=!n)},[n,l]),c.useEffect(()=>{if(d.current=!1,!l||!y.current)return;const e=ac(ownerDocument(y.current)),t=getFocusTarget(y.current)??y.current;return vd(y.current,e)||(t.hasAttribute("tabIndex")||t.setAttribute("tabIndex","-1"),g.current&&t.focus()),()=>{!a&&m.current&&(d.current=!0,m.current.focus(),m.current=null)}},[l]),c.useEffect(()=>{if(!l||!y.current)return;const e=ownerDocument(y.current),loopFocus=t=>{v.current=t,!o&&s()&&"Tab"===t.key&&ac(e)===y.current&&t.shiftKey&&(d.current=!0,p.current&&p.current.focus())},contain=()=>{const t=y.current;if(null===t)return;const n=ac(e);if(!e.hasFocus()||!s()||d.current)return void(d.current=!1);if(vd(t,n))return;if(o&&n!==u.current&&n!==p.current)return;if(n!==h.current)h.current=null;else if(null!==h.current)return;if(!g.current)return;let a=[];if(n!==u.current&&n!==p.current||(a=i(y.current)),a.length>0){const e=Boolean(v.current?.shiftKey&&"Tab"===v.current?.key),t=a[0],n=a[a.length-1];"string"!=typeof t&&"string"!=typeof n&&(e?n.focus():t.focus())}else t.focus()};e.addEventListener("focusin",contain),e.addEventListener("keydown",loopFocus,!0);const t=setInterval(()=>{const t=ac(e);t&&"BODY"===t.tagName&&contain()},50);return()=>{clearInterval(t),e.removeEventListener("focusin",contain),e.removeEventListener("keydown",loopFocus,!0)}},[n,o,a,s,l,i]);const onFocus=e=>{null===m.current&&(m.current=e.relatedTarget),g.current=!0,h.current=e.target;const n=t.props.onFocus;n&&n(e)},handleFocusSentinel=e=>{null===m.current&&(m.current=e.relatedTarget),g.current=!0};return(0,ps.jsxs)(c.Fragment,{children:[(0,ps.jsx)("div",{tabIndex:l?0:-1,onFocus:handleFocusSentinel,ref:u,"data-testid":"sentinelStart"}),c.cloneElement(t,{ref:b,onFocus}),(0,ps.jsx)("div",{tabIndex:l?0:-1,onFocus:handleFocusSentinel,ref:p,"data-testid":"sentinelEnd"})]})}function getContainer$1(e){return"function"==typeof e?e():e}var Md=c.forwardRef(function(e,t){const{children:n,container:o,disablePortal:a=!1}=e,[i,s]=c.useState(null),l=useForkRef(c.isValidElement(n)?getReactElementRef(n):null,t);if(nl(()=>{a||s(getContainer$1(o)||document.body)},[o,a]),nl(()=>{if(i&&!a)return setRef(t,i),()=>{setRef(t,null)}},[t,i,a]),a){if(c.isValidElement(n)){const e={ref:l};return c.cloneElement(n,e)}return n}return i?d.createPortal(n,i):i}),reflow=e=>e.scrollTop;function normalizedTransitionCallback(e,t){return n=>{if(t){const o=e.current;void 0===n?t(o):t(o,n)}}}function getTransitionChildStyle(e,t,n,o,a,i){const s="exited"!==e||t?n[e]||n.exited:o;return a||i?{...s,...a,...i}:s}function getTransitionProps(e,t){const{timeout:n,easing:o,style:a={}}=e;return{duration:a.transitionDuration??("number"==typeof n?n:n[t.mode]||0),easing:a.transitionTimingFunction??("object"==typeof o?o[t.mode]:o),delay:a.transitionDelay}}var zd={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0}},$d={opacity:0,visibility:"hidden"},Nd=c.forwardRef(function(e,t){const n=useTheme(),o={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:a,appear:i=!0,children:s,easing:l,in:d,onEnter:u,onEntered:p,onEntering:m,onExit:h,onExited:g,onExiting:y,style:b,timeout:v=o,...w}=e,S=c.useRef(null),x=pc(S,getReactElementRef(s),t),I=normalizedTransitionCallback(S,m),C=normalizedTransitionCallback(S,(e,t)=>{reflow(e);const o=getTransitionProps({style:b,timeout:v,easing:l},{mode:"enter"});e.style.transition=n.transitions.create("opacity",o),u&&u(e,t)}),E=normalizedTransitionCallback(S,p),R=normalizedTransitionCallback(S,y),k=normalizedTransitionCallback(S,e=>{const t=getTransitionProps({style:b,timeout:v,easing:l},{mode:"exit"});e.style.transition=n.transitions.create("opacity",t),h&&h(e)}),T=normalizedTransitionCallback(S,e=>{e.style.transition="",g&&g(e)}),handleAddEndListener=e=>{a&&a(S.current,e)};return(0,ps.jsx)(Ic,{appear:i,in:d,nodeRef:S,onEnter:C,onEntered:E,onEntering:I,onExit:k,onExited:T,onExiting:R,addEndListener:handleAddEndListener,timeout:v,...w,children:(e,{ownerState:t,...n})=>{const o=getTransitionChildStyle(e,d,zd,$d,b,s.props.style);return c.cloneElement(s,{style:o,ref:x,...n})}})});function getBackdropUtilityClass(e){return generateUtilityClass("MuiBackdrop",e)}generateUtilityClasses("MuiBackdrop",["root","invisible"]);var useUtilityClasses$44=e=>{const{classes:t,invisible:n}=e;return composeClasses({root:["root",n&&"invisible"]},getBackdropUtilityClass,t)},Pd=Fl("div",{name:"MuiBackdrop",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.invisible&&t.invisible]}})({position:"fixed",display:"flex",alignItems:"center",justifyContent:"center",right:0,bottom:0,top:0,left:0,backgroundColor:"rgba(0, 0, 0, 0.5)",WebkitTapHighlightColor:"transparent",variants:[{props:{invisible:!0},style:{backgroundColor:"transparent"}}]}),Od=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiBackdrop"}),{children:o,className:a,component:i="div",invisible:s=!1,open:l,slotProps:c={},slots:d={},transitionDuration:u,...p}=n,m={...n,component:i,invisible:s},h=useUtilityClasses$44(m),g={component:i,slots:d,slotProps:c},[y,b]=useSlot("root",{elementType:Pd,externalForwardedProps:g,className:clsx(h.root,a),ownerState:m}),[v,w]=useSlot("transition",{elementType:Nd,externalForwardedProps:g,ownerState:m});return(0,ps.jsx)(v,{in:l,timeout:u,...p,...w,children:(0,ps.jsx)(y,{...b,ref:t,children:o})})});function getContainer(e){return"function"==typeof e?e():e}function getHasTransition(e){return!!e&&e.props.hasOwnProperty("in")}var noop=()=>{},_d=new kd;function useModal(e){const{container:t,disableScrollLock:n=!1,closeAfterTransition:o=!1,onTransitionEnter:a,onTransitionExited:i,children:s,onClose:l,open:d,rootRef:u}=e,p=c.useRef({}),m=c.useRef(null),h=c.useRef(null),g=useForkRef(h,u),[y,b]=c.useState(!d),v=getHasTransition(s);let w=!0;"false"!==e["aria-hidden"]&&!1!==e["aria-hidden"]||(w=!1);const getDoc=()=>ownerDocument(m.current),getModal=()=>(p.current.modalRef=h.current,p.current.mount=m.current,p.current),handleMounted=()=>{_d.mount(getModal(),{disableScrollLock:n}),h.current&&(h.current.scrollTop=0)},S=useEventCallback(()=>{const e=getContainer(t)||getDoc().body;_d.add(getModal(),e),h.current&&handleMounted()}),isTopModal=()=>_d.isTopModal(getModal()),x=useEventCallback(e=>{m.current=e,e&&(d&&isTopModal()?handleMounted():h.current&&ariaHidden(h.current,w))}),I=c.useCallback(()=>{_d.remove(getModal(),w)},[w]);c.useEffect(()=>()=>{I()},[I]),c.useEffect(()=>{d?S():v&&o||I()},[d,I,v,o,S]);const createHandleKeyDown=e=>t=>{e.onKeyDown?.(t),"Escape"===t.key&&229!==t.which&&isTopModal()&&(t.stopPropagation(),l&&l(t,"escapeKeyDown"))},createHandleBackdropClick=e=>t=>{e.onClick?.(t),t.target===t.currentTarget&&l&&l(t,"backdropClick")};return{getRootProps:(t={})=>{const n=extractEventHandlers(e);delete n.onTransitionEnter,delete n.onTransitionExited;const o={...n,...t};return{role:"presentation",...o,onKeyDown:createHandleKeyDown(o),ref:g}},getBackdropProps:(e={})=>{const t=e;return{"aria-hidden":!0,...t,onClick:createHandleBackdropClick(t),open:d}},getTransitionProps:()=>{const handleExited=()=>{b(!0),i&&i(),o&&I()};return{onEnter:createChainedFunction(()=>{b(!1),a&&a()},s?.props.onEnter??noop),onExited:createChainedFunction(handleExited,s?.props.onExited??noop)}},rootRef:g,portalRef:x,isTopModal,exited:y,hasTransition:v}}function getModalUtilityClass(e){return generateUtilityClass("MuiModal",e)}generateUtilityClasses("MuiModal",["root","hidden","backdrop"]);var useUtilityClasses$43=e=>{const{open:t,exited:n,classes:o}=e;return composeClasses({root:["root",!t&&n&&"hidden"],backdrop:["backdrop"]},getModalUtilityClass,o)},jd=Fl("div",{name:"MuiModal",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.open&&n.exited&&t.hidden]}})(Kl(({theme:e})=>({position:"fixed",zIndex:(e.vars||e).zIndex.modal,right:0,bottom:0,top:0,left:0,variants:[{props:({ownerState:e})=>!e.open&&e.exited,style:{visibility:"hidden"}}]}))),Fd=Fl(Od,{name:"MuiModal",slot:"Backdrop"})({zIndex:-1}),Ld=c.forwardRef(function(e,t){const n=useDefaultProps({name:"MuiModal",props:e}),{classes:o,className:a,closeAfterTransition:i=!1,children:s,container:l,component:d,disableAutoFocus:u=!1,disableEnforceFocus:p=!1,disablePortal:m=!1,disableRestoreFocus:h=!1,disableScrollLock:g=!1,hideBackdrop:y=!1,keepMounted:b=!1,onClose:v,onTransitionEnter:w,onTransitionExited:S,open:x,slotProps:I={},slots:C={},theme:E,...R}=n,k={...n,closeAfterTransition:i,disableAutoFocus:u,disableEnforceFocus:p,disablePortal:m,disableRestoreFocus:h,disableScrollLock:g,hideBackdrop:y,keepMounted:b},{getRootProps:T,getBackdropProps:M,getTransitionProps:$,portalRef:N,isTopModal:P,exited:O,hasTransition:j}=useModal({...k,rootRef:t}),F={...k,exited:O},L=useUtilityClasses$43(F),D={};if(void 0===s.props.tabIndex&&(D.tabIndex="-1"),j){const{onEnter:e,onExited:t}=$();D.onEnter=e,D.onExited=t}const B={slots:C,slotProps:I},[G,W]=useSlot("root",{ref:t,elementType:jd,externalForwardedProps:{...B,...R,component:d},getSlotProps:T,ownerState:F,className:clsx(a,L?.root,!F.open&&F.exited&&L?.hidden)}),[V,H]=useSlot("backdrop",{elementType:Fd,externalForwardedProps:B,shouldForwardComponentProp:!0,getSlotProps:e=>M({...e,onClick:t=>{e?.onClick&&e.onClick(t)}}),className:L?.backdrop,ownerState:F});return b||x||j&&!O?(0,ps.jsx)(Md,{ref:N,container:l,disablePortal:m,children:(0,ps.jsxs)(G,{...W,children:[y?null:(0,ps.jsx)(V,{...H}),(0,ps.jsx)(FocusTrap,{disableEnforceFocus:p,disableAutoFocus:u,disableRestoreFocus:h,isEnabled:P,open:x,children:c.cloneElement(s,D)})]})}):null});function getPaperUtilityClass(e){return generateUtilityClass("MuiPaper",e)}generateUtilityClasses("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);var useUtilityClasses$42=e=>{const{square:t,elevation:n,variant:o,classes:a}=e;return composeClasses({root:["root",o,!t&&"rounded","elevation"===o&&`elevation${n}`]},getPaperUtilityClass,a)},Dd=Fl("div",{name:"MuiPaper",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],!n.square&&t.rounded,"elevation"===n.variant&&t[`elevation${n.elevation}`]]}})(Kl(({theme:e})=>({backgroundColor:(e.vars||e).palette.background.paper,color:(e.vars||e).palette.text.primary,transition:e.transitions.create("box-shadow"),variants:[{props:({ownerState:e})=>!e.square,style:{borderRadius:e.shape.borderRadius}},{props:{variant:"outlined"},style:{border:`1px solid ${(e.vars||e).palette.divider}`}},{props:{variant:"elevation"},style:{boxShadow:"var(--Paper-shadow)",backgroundImage:"var(--Paper-overlay)"}}]}))),Bd=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiPaper"}),o=useTheme(),{className:a,component:i="div",elevation:s=1,square:l=!1,variant:c="elevation",...d}=n,u={...n,component:i,elevation:s,square:l,variant:c};return(0,ps.jsx)(Dd,{as:i,ownerState:u,className:clsx(useUtilityClasses$42(u).root,a),ref:t,...d,style:{..."elevation"===c&&{"--Paper-shadow":(o.vars||o).shadows[s],...o.vars&&{"--Paper-overlay":o.vars.overlays?.[s]},...!o.vars&&"dark"===o.palette.mode&&{"--Paper-overlay":`linear-gradient(${alpha("#fff",getOverlayAlpha(s))}, ${alpha("#fff",getOverlayAlpha(s))})`}},...d.style}})});function getDialogUtilityClass(e){return generateUtilityClass("MuiDialog",e)}generateUtilityClasses("MuiDialog",["root","backdrop","scrollPaper","scrollBody","container","paper","paperWidthFalse","paperWidthXs","paperWidthSm","paperWidthMd","paperWidthLg","paperWidthXl","paperFullWidth","paperFullScreen"]);var Gd=c.createContext({}),Wd=Fl(Od,{name:"MuiDialog",slot:"Backdrop"})({zIndex:-1}),useUtilityClasses$41=e=>{const{classes:t,scroll:n,maxWidth:o,fullWidth:a,fullScreen:i}=e;return composeClasses({root:["root"],backdrop:["backdrop"],container:["container",`scroll${Zl(n)}`],paper:["paper",`paperWidth${Zl(String(o))}`,a&&"paperFullWidth",i&&"paperFullScreen"]},getDialogUtilityClass,t)},Vd=Fl(Ld,{name:"MuiDialog",slot:"Root"})({"@media print":{position:"absolute !important"}}),Hd=Fl("div",{name:"MuiDialog",slot:"Container",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.container,t[`scroll${Zl(n.scroll)}`]]}})({height:"100%","@media print":{height:"auto"},outline:0,variants:[{props:{scroll:"paper"},style:{display:"flex",justifyContent:"center",alignItems:"center"}},{props:{scroll:"body"},style:{overflowY:"auto",overflowX:"hidden",textAlign:"center","&::after":{content:'""',display:"inline-block",verticalAlign:"middle",height:"100%",width:"0"}}}]}),Ud=Fl(Bd,{name:"MuiDialog",slot:"Paper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.paper,t[`paperWidth${Zl(String(n.maxWidth))}`],n.fullWidth&&t.paperFullWidth,n.fullScreen&&t.paperFullScreen]}})(Kl(({theme:e})=>({margin:32,position:"relative",overflowY:"auto","@media print":{overflowY:"visible",boxShadow:"none"},variants:[{props:{scroll:"paper"},style:{display:"flex",flexDirection:"column",maxHeight:"calc(100% - 64px)"}},{props:{scroll:"body"},style:{display:"inline-block",verticalAlign:"middle",textAlign:"initial"}},{props:({ownerState:e})=>!e.maxWidth,style:{maxWidth:"calc(100% - 64px)"}},{props:{maxWidth:"xs"},style:{maxWidth:"px"===e.breakpoints.unit?Math.max(e.breakpoints.values.xs,444):`max(${e.breakpoints.values.xs}${e.breakpoints.unit}, 444px)`}},{props:{maxWidth:"xs",scroll:"body"},style:{[e.breakpoints.down(Math.max(e.breakpoints.values.xs,444)+64)]:{maxWidth:"calc(100% - 64px)"}}},...Object.keys(e.breakpoints.values).filter(e=>"xs"!==e).map(t=>({props:{maxWidth:t},style:{maxWidth:`${e.breakpoints.values[t]}${e.breakpoints.unit}`}})),...Object.keys(e.breakpoints.values).filter(e=>"xs"!==e).map(t=>({props:{maxWidth:t,scroll:"body"},style:{[e.breakpoints.down(e.breakpoints.values[t]+64)]:{maxWidth:"calc(100% - 64px)"}}})),{props:({ownerState:e})=>e.fullWidth,style:{width:"calc(100% - 64px)"}},{props:({ownerState:e})=>e.fullScreen,style:{margin:0,width:"100%",maxWidth:"100%",height:"100%",maxHeight:"none",borderRadius:0}},{props:({ownerState:e})=>e.fullScreen&&"body"===e.scroll,style:{margin:0,maxWidth:"100%"}}]}))),qd=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiDialog"}),o=useTheme(),a={enter:o.transitions.duration.enteringScreen,exit:o.transitions.duration.leavingScreen},{"aria-describedby":i,"aria-labelledby":s,"aria-modal":l=!0,children:d,className:u,fullScreen:p=!1,fullWidth:m=!1,maxWidth:h="sm",onClick:g,onClose:y,open:b,PaperComponent:v=Bd,role:w="dialog",scroll:S="paper",slots:x={},slotProps:I={},transitionDuration:C=a,...E}=n,R={...n,fullScreen:p,fullWidth:m,maxWidth:h,scroll:S},k=useUtilityClasses$41(R),T=c.useRef(),handleMouseDown=e=>{T.current=e.target===e.currentTarget},handleBackdropClick=e=>{g&&g(e),T.current&&(T.current=null,y&&y(e,"backdropClick"))},M=useId(s),$=c.useMemo(()=>({titleId:M}),[M]),N={slots:x,slotProps:I},[P,O]=useSlot("root",{elementType:Vd,shouldForwardComponentProp:!0,externalForwardedProps:N,ownerState:R,className:clsx(k.root,u),ref:t}),[j,F]=useSlot("backdrop",{elementType:Wd,shouldForwardComponentProp:!0,externalForwardedProps:N,ownerState:R,className:k.backdrop}),[L,D]=useSlot("paper",{elementType:Ud,shouldForwardComponentProp:!0,externalForwardedProps:N,ownerState:R,className:k.paper,additionalProps:{elevation:24,role:w,"aria-describedby":i,"aria-labelledby":M,"aria-modal":l,tabIndex:-1,[Ad]:""}}),[B,G]=useSlot("container",{elementType:Hd,externalForwardedProps:N,ownerState:R,className:k.container}),[W,V]=useSlot("transition",{elementType:Nd,externalForwardedProps:N,ownerState:R,additionalProps:{appear:!0,in:b,timeout:C,role:"presentation"}});return(0,ps.jsx)(P,{closeAfterTransition:!0,slots:{backdrop:j},slotProps:{backdrop:{transitionDuration:C,...F}},onClose:y,open:b,onClick:handleBackdropClick,...O,...E,children:(0,ps.jsx)(W,{...V,children:(0,ps.jsx)(B,{onMouseDown:handleMouseDown,...G,children:(0,ps.jsx)(L,{as:v,...D,children:(0,ps.jsx)(Gd.Provider,{value:$,children:d})})})})})});function getDialogTitleUtilityClass(e){return generateUtilityClass("MuiDialogTitle",e)}generateUtilityClasses("MuiDialogTitle",["root"]);var useUtilityClasses$40=e=>{const{classes:t}=e;return composeClasses({root:["root"]},getDialogTitleUtilityClass,t)},Kd=Fl(Jl,{name:"MuiDialogTitle",slot:"Root"})({padding:"16px 24px",flex:"0 0 auto"}),Zd=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiDialogTitle"}),{className:o,id:a,...i}=n,s=n,l=useUtilityClasses$40(s),{titleId:d=a}=c.useContext(Gd);return(0,ps.jsx)(Kd,{component:"h2",className:clsx(l.root,o),ownerState:s,ref:t,variant:"h6",id:a??d,...i})});function getIconButtonUtilityClass(e){return generateUtilityClass("MuiIconButton",e)}var Yd=generateUtilityClasses("MuiIconButton",["root","disabled","colorInherit","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","edgeStart","edgeEnd","sizeSmall","sizeMedium","sizeLarge","loading","loadingIndicator","loadingWrapper"]),useUtilityClasses$39=e=>{const{classes:t,disabled:n,color:o,edge:a,size:i,loading:s}=e;return composeClasses({root:["root",s&&"loading",n&&"disabled","default"!==o&&`color${Zl(o)}`,a&&`edge${Zl(a)}`,`size${Zl(i)}`],loadingIndicator:["loadingIndicator"],loadingWrapper:["loadingWrapper"]},getIconButtonUtilityClass,t)},Xd=Fl(Lc,{name:"MuiIconButton",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.loading&&t.loading,"default"!==n.color&&t[`color${Zl(n.color)}`],n.edge&&t[`edge${Zl(n.edge)}`],t[`size${Zl(n.size)}`]]}})(Kl(({theme:e})=>({textAlign:"center",flex:"0 0 auto",fontSize:e.typography.pxToRem(24),padding:8,borderRadius:"50%",color:(e.vars||e).palette.action.active,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shortest}),variants:[{props:e=>!e.disableRipple,style:{"--IconButton-hoverBg":e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"&:hover":{backgroundColor:"var(--IconButton-hoverBg)","@media (hover: none)":{backgroundColor:"transparent"}}}},{props:{edge:"start"},style:{marginLeft:-12}},{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:{edge:"end"},style:{marginRight:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}}]})),Kl(({theme:e})=>({variants:[{props:{color:"inherit"},style:{color:"inherit"}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main,"--IconButton-hoverBg":e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}})),{props:{size:"small"},style:{padding:5,fontSize:e.typography.pxToRem(18)}},{props:{size:"large"},style:{padding:12,fontSize:e.typography.pxToRem(28)}}],[`&.${Yd.disabled}`]:{backgroundColor:"transparent",color:(e.vars||e).palette.action.disabled},[`&.${Yd.loading}`]:{color:"transparent"}}))),Jd=Fl("span",{name:"MuiIconButton",slot:"LoadingIndicator"})(({theme:e})=>({display:"none",position:"absolute",visibility:"visible",top:"50%",left:"50%",transform:"translate(-50%, -50%)",color:(e.vars||e).palette.action.disabled,variants:[{props:{loading:!0},style:{display:"flex"}}]})),Qd=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiIconButton"}),{edge:o=!1,children:a,className:i,color:s="default",disabled:l=!1,disableFocusRipple:c=!1,size:d="medium",id:u,loading:p=null,loadingIndicator:m,...h}=n,g=cc(u),y=m??(0,ps.jsx)(Zc,{"aria-labelledby":g,color:"inherit",size:16}),b={...n,edge:o,color:s,disabled:l,disableFocusRipple:c,loading:p,loadingIndicator:y,size:d},v=useUtilityClasses$39(b);return(0,ps.jsxs)(Xd,{id:p?g:u,className:clsx(v.root,i),centerRipple:!0,internalNativeButton:!0,focusRipple:!c,disabled:l||p,ref:t,...h,ownerState:b,children:["boolean"==typeof p&&(0,ps.jsx)("span",{className:v.loadingWrapper,style:{display:"contents"},children:(0,ps.jsx)(Jd,{className:v.loadingIndicator,ownerState:b,children:p&&y})}),a]})});function getScale(e){return`scale(${e}, ${e**2})`}var eu={entering:{opacity:1,transform:getScale(1)},entered:{opacity:1,transform:"none"},exiting:{opacity:0,transform:getScale(.75)},exited:{opacity:0,transform:getScale(.75)}},tu={opacity:0,transform:getScale(.75),visibility:"hidden"},ru=c.forwardRef(function(e,t){const{addEndListener:n,appear:o=!0,children:a,easing:i,in:s,onEnter:l,onEntered:d,onEntering:u,onExit:p,onExited:m,onExiting:h,style:g,timeout:y="auto",...b}=e,v=useTimeout(),w=c.useRef(),S=useTheme(),x=c.useRef(null),I=pc(x,getReactElementRef(a),t),C=normalizedTransitionCallback(x,u),E=normalizedTransitionCallback(x,(e,t)=>{reflow(e);const{duration:n,delay:o,easing:a}=getTransitionProps({style:g,timeout:y,easing:i},{mode:"enter"});let s;"auto"===y?(s=S.transitions.getAutoHeightDuration(e.clientHeight),w.current=s):s=n,e.style.transition=[S.transitions.create("opacity",{duration:s,delay:o}),S.transitions.create("transform",{duration:.666*s,delay:o,easing:a})].join(","),l&&l(e,t)}),R=normalizedTransitionCallback(x,d),k=normalizedTransitionCallback(x,h),T=normalizedTransitionCallback(x,e=>{const{duration:t,delay:n,easing:o}=getTransitionProps({style:g,timeout:y,easing:i},{mode:"exit"});let a;"auto"===y?(a=S.transitions.getAutoHeightDuration(e.clientHeight),w.current=a):a=t,e.style.transition=[S.transitions.create("opacity",{duration:a,delay:n}),S.transitions.create("transform",{duration:.666*a,delay:n||.333*a,easing:o})].join(","),e.style.opacity=0,e.style.transform=getScale(.75),p&&p(e)}),M=normalizedTransitionCallback(x,e=>{e.style.transition="",m&&m(e)}),handleAddEndListener=e=>{"auto"===y&&v.start(w.current||0,e),n&&n(x.current,e)};return(0,ps.jsx)(Ic,{appear:o,in:s,nodeRef:x,onEnter:E,onEntered:R,onEntering:C,onExit:T,onExited:M,onExiting:k,addEndListener:handleAddEndListener,timeout:"auto"===y?null:y,...b,children:(e,{ownerState:t,...n})=>{const o=getTransitionChildStyle(e,s,eu,tu,g,a.props.style);return c.cloneElement(a,{style:o,ref:I,...n})}})});ru&&(ru.muiSupportAuto=!0);var nu="bottom",ou="right",au="left",iu="auto",su=["top",nu,ou,au],lu="start",cu="clippingParents",du="viewport",uu="popper",pu="reference",mu=su.reduce(function(e,t){return e.concat([t+"-"+lu,t+"-end"])},[]),hu=[].concat(su,[iu]).reduce(function(e,t){return e.concat([t,t+"-"+lu,t+"-end"])},[]),gu=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function getNodeName(e){return e?(e.nodeName||"").toLowerCase():null}function getWindow(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function isElement(e){return e instanceof getWindow(e).Element||e instanceof Element}function isHTMLElement$1(e){return e instanceof getWindow(e).HTMLElement||e instanceof HTMLElement}function isShadowRoot(e){return"undefined"!=typeof ShadowRoot&&(e instanceof getWindow(e).ShadowRoot||e instanceof ShadowRoot)}function applyStyles(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},o=t.attributes[e]||{},a=t.elements[e];isHTMLElement$1(a)&&getNodeName(a)&&(Object.assign(a.style,n),Object.keys(o).forEach(function(e){var t=o[e];!1===t?a.removeAttribute(e):a.setAttribute(e,!0===t?"":t)}))})}function effect$2(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var o=t.elements[e],a=t.attributes[e]||{},i=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]="",e},{});isHTMLElement$1(o)&&getNodeName(o)&&(Object.assign(o.style,i),Object.keys(a).forEach(function(e){o.removeAttribute(e)}))})}}var fu={name:"applyStyles",enabled:!0,phase:"write",fn:applyStyles,effect:effect$2,requires:["computeStyles"]};function getBasePlacement(e){return e.split("-")[0]}var yu=Math.max,bu=Math.min,vu=Math.round;function getUAString(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function isLayoutViewport(){return!/^((?!chrome|android).)*safari/i.test(getUAString())}function getBoundingClientRect(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var o=e.getBoundingClientRect(),a=1,i=1;t&&isHTMLElement$1(e)&&(a=e.offsetWidth>0&&vu(o.width)/e.offsetWidth||1,i=e.offsetHeight>0&&vu(o.height)/e.offsetHeight||1);var s=(isElement(e)?getWindow(e):window).visualViewport,l=!isLayoutViewport()&&n,c=(o.left+(l&&s?s.offsetLeft:0))/a,d=(o.top+(l&&s?s.offsetTop:0))/i,u=o.width/a,p=o.height/i;return{width:u,height:p,top:d,right:c+u,bottom:d+p,left:c,x:c,y:d}}function getLayoutRect(e){var t=getBoundingClientRect(e),n=e.offsetWidth,o=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-o)<=1&&(o=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:o}}function contains(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&isShadowRoot(n)){var o=t;do{if(o&&e.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function getComputedStyle(e){return getWindow(e).getComputedStyle(e)}function isTableElement(e){return["table","td","th"].indexOf(getNodeName(e))>=0}function getDocumentElement(e){return((isElement(e)?e.ownerDocument:e.document)||window.document).documentElement}function getParentNode(e){return"html"===getNodeName(e)?e:e.assignedSlot||e.parentNode||(isShadowRoot(e)?e.host:null)||getDocumentElement(e)}function getTrueOffsetParent(e){return isHTMLElement$1(e)&&"fixed"!==getComputedStyle(e).position?e.offsetParent:null}function getContainingBlock(e){var t=/firefox/i.test(getUAString());if(/Trident/i.test(getUAString())&&isHTMLElement$1(e)&&"fixed"===getComputedStyle(e).position)return null;var n=getParentNode(e);for(isShadowRoot(n)&&(n=n.host);isHTMLElement$1(n)&&["html","body"].indexOf(getNodeName(n))<0;){var o=getComputedStyle(n);if("none"!==o.transform||"none"!==o.perspective||"paint"===o.contain||-1!==["transform","perspective"].indexOf(o.willChange)||t&&"filter"===o.willChange||t&&o.filter&&"none"!==o.filter)return n;n=n.parentNode}return null}function getOffsetParent(e){for(var t=getWindow(e),n=getTrueOffsetParent(e);n&&isTableElement(n)&&"static"===getComputedStyle(n).position;)n=getTrueOffsetParent(n);return n&&("html"===getNodeName(n)||"body"===getNodeName(n)&&"static"===getComputedStyle(n).position)?t:n||getContainingBlock(e)||t}function getMainAxisFromPlacement(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function within(e,t,n){return yu(e,bu(t,n))}function withinMaxClamp(e,t,n){var o=within(e,t,n);return o>n?n:o}function getFreshSideObject(){return{top:0,right:0,bottom:0,left:0}}function mergePaddingObject(e){return Object.assign({},getFreshSideObject(),e)}function expandToHashMap(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}var toPaddingObject=function(e,t){return mergePaddingObject("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:expandToHashMap(e,su))};function arrow(e){var t,n=e.state,o=e.name,a=e.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,l=getBasePlacement(n.placement),c=getMainAxisFromPlacement(l),d=["left","right"].indexOf(l)>=0?"height":"width";if(i&&s){var u=toPaddingObject(a.padding,n),p=getLayoutRect(i),m="y"===c?"top":au,h="y"===c?nu:ou,g=n.rects.reference[d]+n.rects.reference[c]-s[c]-n.rects.popper[d],y=s[c]-n.rects.reference[c],b=getOffsetParent(i),v=b?"y"===c?b.clientHeight||0:b.clientWidth||0:0,w=g/2-y/2,S=u[m],x=v-p[d]-u[h],I=v/2-p[d]/2+w,C=within(S,I,x),E=c;n.modifiersData[o]=((t={})[E]=C,t.centerOffset=C-I,t)}}function effect$1(e){var t=e.state,n=e.options.element,o=void 0===n?"[data-popper-arrow]":n;null!=o&&("string"!=typeof o||(o=t.elements.popper.querySelector(o)))&&contains(t.elements.popper,o)&&(t.elements.arrow=o)}function getVariation(e){return e.split("-")[1]}var wu={top:"auto",right:"auto",bottom:"auto",left:"auto"};function roundOffsetsByDPR(e,t){var n=e.x,o=e.y,a=t.devicePixelRatio||1;return{x:vu(n*a)/a||0,y:vu(o*a)/a||0}}function mapToStyles(e){var t,n=e.popper,o=e.popperRect,a=e.placement,i=e.variation,s=e.offsets,l=e.position,c=e.gpuAcceleration,d=e.adaptive,u=e.roundOffsets,p=e.isFixed,m=s.x,h=void 0===m?0:m,g=s.y,y=void 0===g?0:g,b="function"==typeof u?u({x:h,y}):{x:h,y};h=b.x,y=b.y;var v=s.hasOwnProperty("x"),w=s.hasOwnProperty("y"),S=au,x="top",I=window;if(d){var C=getOffsetParent(n),E="clientHeight",R="clientWidth";C===getWindow(n)&&"static"!==getComputedStyle(C=getDocumentElement(n)).position&&"absolute"===l&&(E="scrollHeight",R="scrollWidth"),("top"===a||("left"===a||"right"===a)&&"end"===i)&&(x=nu,y-=(p&&C===I&&I.visualViewport?I.visualViewport.height:C[E])-o.height,y*=c?1:-1),"left"!==a&&("top"!==a&&"bottom"!==a||"end"!==i)||(S=ou,h-=(p&&C===I&&I.visualViewport?I.visualViewport.width:C[R])-o.width,h*=c?1:-1)}var k,T=Object.assign({position:l},d&&wu),M=!0===u?roundOffsetsByDPR({x:h,y},getWindow(n)):{x:h,y};return h=M.x,y=M.y,c?Object.assign({},T,((k={})[x]=w?"0":"",k[S]=v?"0":"",k.transform=(I.devicePixelRatio||1)<=1?"translate("+h+"px, "+y+"px)":"translate3d("+h+"px, "+y+"px, 0)",k)):Object.assign({},T,((t={})[x]=w?y+"px":"",t[S]=v?h+"px":"",t.transform="",t))}function computeStyles(e){var t=e.state,n=e.options,o=n.gpuAcceleration,a=void 0===o||o,i=n.adaptive,s=void 0===i||i,l=n.roundOffsets,c=void 0===l||l,d={placement:getBasePlacement(t.placement),variation:getVariation(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:a,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,mapToStyles(Object.assign({},d,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:c})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,mapToStyles(Object.assign({},d,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var Su={passive:!0};function effect(e){var t=e.state,n=e.instance,o=e.options,a=o.scroll,i=void 0===a||a,s=o.resize,l=void 0===s||s,c=getWindow(t.elements.popper),d=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&d.forEach(function(e){e.addEventListener("scroll",n.update,Su)}),l&&c.addEventListener("resize",n.update,Su),function(){i&&d.forEach(function(e){e.removeEventListener("scroll",n.update,Su)}),l&&c.removeEventListener("resize",n.update,Su)}}var xu={left:"right",right:"left",bottom:"top",top:"bottom"};function getOppositePlacement(e){return e.replace(/left|right|bottom|top/g,function(e){return xu[e]})}var Iu={start:"end",end:"start"};function getOppositeVariationPlacement(e){return e.replace(/start|end/g,function(e){return Iu[e]})}function getWindowScroll(e){var t=getWindow(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function getWindowScrollBarX(e){return getBoundingClientRect(getDocumentElement(e)).left+getWindowScroll(e).scrollLeft}function getViewportRect(e,t){var n=getWindow(e),o=getDocumentElement(e),a=n.visualViewport,i=o.clientWidth,s=o.clientHeight,l=0,c=0;if(a){i=a.width,s=a.height;var d=isLayoutViewport();(d||!d&&"fixed"===t)&&(l=a.offsetLeft,c=a.offsetTop)}return{width:i,height:s,x:l+getWindowScrollBarX(e),y:c}}function getDocumentRect(e){var t,n=getDocumentElement(e),o=getWindowScroll(e),a=null==(t=e.ownerDocument)?void 0:t.body,i=yu(n.scrollWidth,n.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),s=yu(n.scrollHeight,n.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0),l=-o.scrollLeft+getWindowScrollBarX(e),c=-o.scrollTop;return"rtl"===getComputedStyle(a||n).direction&&(l+=yu(n.clientWidth,a?a.clientWidth:0)-i),{width:i,height:s,x:l,y:c}}function isScrollParent(e){var t=getComputedStyle(e),n=t.overflow,o=t.overflowX,a=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+a+o)}function getScrollParent(e){return["html","body","#document"].indexOf(getNodeName(e))>=0?e.ownerDocument.body:isHTMLElement$1(e)&&isScrollParent(e)?e:getScrollParent(getParentNode(e))}function listScrollParents(e,t){var n;void 0===t&&(t=[]);var o=getScrollParent(e),a=o===(null==(n=e.ownerDocument)?void 0:n.body),i=getWindow(o),s=a?[i].concat(i.visualViewport||[],isScrollParent(o)?o:[]):o,l=t.concat(s);return a?l:l.concat(listScrollParents(getParentNode(s)))}function rectToClientRect(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function getInnerBoundingClientRect(e,t){var n=getBoundingClientRect(e,!1,"fixed"===t);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function getClientRectFromMixedType(e,t,n){return"viewport"===t?rectToClientRect(getViewportRect(e,n)):isElement(t)?getInnerBoundingClientRect(t,n):rectToClientRect(getDocumentRect(getDocumentElement(e)))}function getClippingParents(e){var t=listScrollParents(getParentNode(e)),n=["absolute","fixed"].indexOf(getComputedStyle(e).position)>=0&&isHTMLElement$1(e)?getOffsetParent(e):e;return isElement(n)?t.filter(function(e){return isElement(e)&&contains(e,n)&&"body"!==getNodeName(e)}):[]}function getClippingRect(e,t,n,o){var a="clippingParents"===t?getClippingParents(e):[].concat(t),i=[].concat(a,[n]),s=i[0],l=i.reduce(function(t,n){var a=getClientRectFromMixedType(e,n,o);return t.top=yu(a.top,t.top),t.right=bu(a.right,t.right),t.bottom=bu(a.bottom,t.bottom),t.left=yu(a.left,t.left),t},getClientRectFromMixedType(e,s,o));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function computeOffsets(e){var t,n=e.reference,o=e.element,a=e.placement,i=a?getBasePlacement(a):null,s=a?getVariation(a):null,l=n.x+n.width/2-o.width/2,c=n.y+n.height/2-o.height/2;switch(i){case"top":t={x:l,y:n.y-o.height};break;case nu:t={x:l,y:n.y+n.height};break;case ou:t={x:n.x+n.width,y:c};break;case au:t={x:n.x-o.width,y:c};break;default:t={x:n.x,y:n.y}}var d=i?getMainAxisFromPlacement(i):null;if(null!=d){var u="y"===d?"height":"width";switch(s){case lu:t[d]=t[d]-(n[u]/2-o[u]/2);break;case"end":t[d]=t[d]+(n[u]/2-o[u]/2)}}return t}function detectOverflow(e,t){void 0===t&&(t={});var n=t,o=n.placement,a=void 0===o?e.placement:o,i=n.strategy,s=void 0===i?e.strategy:i,l=n.boundary,c=void 0===l?cu:l,d=n.rootBoundary,u=void 0===d?du:d,p=n.elementContext,m=void 0===p?uu:p,h=n.altBoundary,g=void 0!==h&&h,y=n.padding,b=void 0===y?0:y,v=mergePaddingObject("number"!=typeof b?b:expandToHashMap(b,su)),w="popper"===m?pu:uu,S=e.rects.popper,x=e.elements[g?w:m],I=getClippingRect(isElement(x)?x:x.contextElement||getDocumentElement(e.elements.popper),c,u,s),C=getBoundingClientRect(e.elements.reference),E=computeOffsets({reference:C,element:S,strategy:"absolute",placement:a}),R=rectToClientRect(Object.assign({},S,E)),k="popper"===m?R:C,T={top:I.top-k.top+v.top,bottom:k.bottom-I.bottom+v.bottom,left:I.left-k.left+v.left,right:k.right-I.right+v.right},M=e.modifiersData.offset;if("popper"===m&&M){var $=M[a];Object.keys(T).forEach(function(e){var t=["right","bottom"].indexOf(e)>=0?1:-1,n=["top","bottom"].indexOf(e)>=0?"y":"x";T[e]+=$[n]*t})}return T}function computeAutoPlacement(e,t){void 0===t&&(t={});var n=t,o=n.placement,a=n.boundary,i=n.rootBoundary,s=n.padding,l=n.flipVariations,c=n.allowedAutoPlacements,d=void 0===c?hu:c,u=getVariation(o),p=u?l?mu:mu.filter(function(e){return getVariation(e)===u}):su,m=p.filter(function(e){return d.indexOf(e)>=0});0===m.length&&(m=p);var h=m.reduce(function(t,n){return t[n]=detectOverflow(e,{placement:n,boundary:a,rootBoundary:i,padding:s})[getBasePlacement(n)],t},{});return Object.keys(h).sort(function(e,t){return h[e]-h[t]})}function getExpandedFallbackPlacements(e){if("auto"===getBasePlacement(e))return[];var t=getOppositePlacement(e);return[getOppositeVariationPlacement(e),t,getOppositeVariationPlacement(t)]}function flip(e){var t=e.state,n=e.options,o=e.name;if(!t.modifiersData[o]._skip){for(var a=n.mainAxis,i=void 0===a||a,s=n.altAxis,l=void 0===s||s,c=n.fallbackPlacements,d=n.padding,u=n.boundary,p=n.rootBoundary,m=n.altBoundary,h=n.flipVariations,g=void 0===h||h,y=n.allowedAutoPlacements,b=t.options.placement,v=getBasePlacement(b)===b,w=c||(v||!g?[getOppositePlacement(b)]:getExpandedFallbackPlacements(b)),S=[b].concat(w).reduce(function(e,n){return e.concat("auto"===getBasePlacement(n)?computeAutoPlacement(t,{placement:n,boundary:u,rootBoundary:p,padding:d,flipVariations:g,allowedAutoPlacements:y}):n)},[]),x=t.rects.reference,I=t.rects.popper,C=new Map,E=!0,R=S[0],k=0;k<S.length;k++){var T=S[k],M=getBasePlacement(T),$=getVariation(T)===lu,N=["top",nu].indexOf(M)>=0,P=N?"width":"height",O=detectOverflow(t,{placement:T,boundary:u,rootBoundary:p,altBoundary:m,padding:d}),j=N?$?ou:au:$?nu:"top";x[P]>I[P]&&(j=getOppositePlacement(j));var F=getOppositePlacement(j),L=[];if(i&&L.push(O[M]<=0),l&&L.push(O[j]<=0,O[F]<=0),L.every(function(e){return e})){R=T,E=!1;break}C.set(T,L)}if(E)for(var _loop=function(e){var t=S.find(function(t){var n=C.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return R=t,"break"},D=g?3:1;D>0&&"break"!==_loop(D);D--);t.placement!==R&&(t.modifiersData[o]._skip=!0,t.placement=R,t.reset=!0)}}function getSideOffsets(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function isAnySideFullyClipped(e){return["top",ou,nu,au].some(function(t){return e[t]>=0})}function hide(e){var t=e.state,n=e.name,o=t.rects.reference,a=t.rects.popper,i=t.modifiersData.preventOverflow,s=detectOverflow(t,{elementContext:"reference"}),l=detectOverflow(t,{altBoundary:!0}),c=getSideOffsets(s,o),d=getSideOffsets(l,a,i),u=isAnySideFullyClipped(c),p=isAnySideFullyClipped(d);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:u,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":p})}function distanceAndSkiddingToXY(e,t,n){var o=getBasePlacement(e),a=["left","top"].indexOf(o)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,s=i[0],l=i[1];return s=s||0,l=(l||0)*a,["left","right"].indexOf(o)>=0?{x:l,y:s}:{x:s,y:l}}function offset(e){var t=e.state,n=e.options,o=e.name,a=n.offset,i=void 0===a?[0,0]:a,s=hu.reduce(function(e,n){return e[n]=distanceAndSkiddingToXY(n,t.rects,i),e},{}),l=s[t.placement],c=l.x,d=l.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=d),t.modifiersData[o]=s}function popperOffsets(e){var t=e.state,n=e.name;t.modifiersData[n]=computeOffsets({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}function getAltAxis(e){return"x"===e?"y":"x"}function preventOverflow(e){var t=e.state,n=e.options,o=e.name,a=n.mainAxis,i=void 0===a||a,s=n.altAxis,l=void 0!==s&&s,c=n.boundary,d=n.rootBoundary,u=n.altBoundary,p=n.padding,m=n.tether,h=void 0===m||m,g=n.tetherOffset,y=void 0===g?0:g,b=detectOverflow(t,{boundary:c,rootBoundary:d,padding:p,altBoundary:u}),v=getBasePlacement(t.placement),w=getVariation(t.placement),S=!w,x=getMainAxisFromPlacement(v),I=getAltAxis(x),C=t.modifiersData.popperOffsets,E=t.rects.reference,R=t.rects.popper,k="function"==typeof y?y(Object.assign({},t.rects,{placement:t.placement})):y,T="number"==typeof k?{mainAxis:k,altAxis:k}:Object.assign({mainAxis:0,altAxis:0},k),M=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,$={x:0,y:0};if(C){if(i){var N,P="y"===x?"top":au,O="y"===x?nu:ou,j="y"===x?"height":"width",F=C[x],L=F+b[P],D=F-b[O],B=h?-R[j]/2:0,G="start"===w?E[j]:R[j],W="start"===w?-R[j]:-E[j],V=t.elements.arrow,H=h&&V?getLayoutRect(V):{width:0,height:0},U=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:getFreshSideObject(),q=U[P],K=U[O],Z=within(0,E[j],H[j]),Y=S?E[j]/2-B-Z-q-T.mainAxis:G-Z-q-T.mainAxis,X=S?-E[j]/2+B+Z+K+T.mainAxis:W+Z+K+T.mainAxis,J=t.elements.arrow&&getOffsetParent(t.elements.arrow),Q=J?"y"===x?J.clientTop||0:J.clientLeft||0:0,ee=null!=(N=null==M?void 0:M[x])?N:0,te=F+X-ee,re=within(h?bu(L,F+Y-ee-Q):L,F,h?yu(D,te):D);C[x]=re,$[x]=re-F}if(l){var ne,oe="x"===x?"top":au,ae="x"===x?nu:ou,ie=C[I],se="y"===I?"height":"width",le=ie+b[oe],ce=ie-b[ae],de=-1!==["top",au].indexOf(v),ue=null!=(ne=null==M?void 0:M[I])?ne:0,pe=de?le:ie-E[se]-R[se]-ue+T.altAxis,me=de?ie+E[se]+R[se]-ue-T.altAxis:ce,he=h&&de?withinMaxClamp(pe,ie,me):within(h?pe:le,ie,h?me:ce);C[I]=he,$[I]=he-ie}t.modifiersData[o]=$}}function getHTMLElementScroll(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function getNodeScroll(e){return e!==getWindow(e)&&isHTMLElement$1(e)?getHTMLElementScroll(e):getWindowScroll(e)}function isElementScaled(e){var t=e.getBoundingClientRect(),n=vu(t.width)/e.offsetWidth||1,o=vu(t.height)/e.offsetHeight||1;return 1!==n||1!==o}function getCompositeRect(e,t,n){void 0===n&&(n=!1);var o=isHTMLElement$1(t),a=isHTMLElement$1(t)&&isElementScaled(t),i=getDocumentElement(t),s=getBoundingClientRect(e,a,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(o||!o&&!n)&&(("body"!==getNodeName(t)||isScrollParent(i))&&(l=getNodeScroll(t)),isHTMLElement$1(t)?((c=getBoundingClientRect(t,!0)).x+=t.clientLeft,c.y+=t.clientTop):i&&(c.x=getWindowScrollBarX(i))),{x:s.left+l.scrollLeft-c.x,y:s.top+l.scrollTop-c.y,width:s.width,height:s.height}}function order(e){var t=new Map,n=new Set,o=[];function sort(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var o=t.get(e);o&&sort(o)}}),o.push(e)}return e.forEach(function(e){t.set(e.name,e)}),e.forEach(function(e){n.has(e.name)||sort(e)}),o}function orderModifiers(e){var t=order(e);return gu.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}function debounce$1(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function mergeByName(e){var t=e.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{});return Object.keys(t).map(function(e){return t[e]})}var Cu={placement:"bottom",modifiers:[],strategy:"absolute"};function areValidElements(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(e){return!(e&&"function"==typeof e.getBoundingClientRect)})}function popperGenerator(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,o=void 0===n?[]:n,a=t.defaultOptions,i=void 0===a?Cu:a;return function(e,t,n){void 0===n&&(n=i);var a={placement:"bottom",orderedModifiers:[],options:Object.assign({},Cu,i),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},s=[],l=!1,c={state:a,setOptions:function(n){var s="function"==typeof n?n(a.options):n;cleanupModifierEffects(),a.options=Object.assign({},i,a.options,s),a.scrollParents={reference:isElement(e)?listScrollParents(e):e.contextElement?listScrollParents(e.contextElement):[],popper:listScrollParents(t)};var l=orderModifiers(mergeByName([].concat(o,a.options.modifiers)));return a.orderedModifiers=l.filter(function(e){return e.enabled}),runModifierEffects(),c.update()},forceUpdate:function(){if(!l){var e=a.elements,t=e.reference,n=e.popper;if(areValidElements(t,n)){a.rects={reference:getCompositeRect(t,getOffsetParent(n),"fixed"===a.options.strategy),popper:getLayoutRect(n)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach(function(e){return a.modifiersData[e.name]=Object.assign({},e.data)});for(var o=0;o<a.orderedModifiers.length;o++)if(!0!==a.reset){var i=a.orderedModifiers[o],s=i.fn,d=i.options,u=void 0===d?{}:d,p=i.name;"function"==typeof s&&(a=s({state:a,options:u,name:p,instance:c})||a)}else a.reset=!1,o=-1}}},update:debounce$1(function(){return new Promise(function(e){c.forceUpdate(),e(a)})}),destroy:function(){cleanupModifierEffects(),l=!0}};if(!areValidElements(e,t))return c;function runModifierEffects(){a.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,o=void 0===n?{}:n,i=e.effect;if("function"==typeof i){var l=i({state:a,name:t,instance:c,options:o});s.push(l||function(){})}})}function cleanupModifierEffects(){s.forEach(function(e){return e()}),s=[]}return c.setOptions(n).then(function(e){!l&&n.onFirstUpdate&&n.onFirstUpdate(e)}),c}}var Eu=popperGenerator({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect,data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:popperOffsets,data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:computeStyles,data:{}},fu,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:offset},{name:"flip",enabled:!0,phase:"main",fn:flip,requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:preventOverflow,requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:arrow,effect:effect$1,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:hide}]});function getPopperUtilityClass(e){return generateUtilityClass("MuiPopper",e)}function flipPlacement(e,t){if("ltr"===t)return e;switch(e){case"bottom-end":return"bottom-start";case"bottom-start":return"bottom-end";case"top-end":return"top-start";case"top-start":return"top-end";default:return e}}function resolveAnchorEl$1(e){return"function"==typeof e?e():e}function isHTMLElement(e){return void 0!==e.nodeType}generateUtilityClasses("MuiPopper",["root"]);var useUtilityClasses$38=e=>{const{classes:t}=e;return composeClasses({root:["root"]},getPopperUtilityClass,t)},Ru={},ku=c.forwardRef(function(e,t){const{anchorEl:n,children:o,direction:a,disablePortal:i,modifiers:s,open:l,placement:d,popperOptions:u,popperRef:p,slotProps:m={},slots:h={},TransitionProps:g,ownerState:y,...b}=e,v=c.useRef(null),w=useForkRef(v,t),S=c.useRef(null),x=useForkRef(S,p),I=c.useRef(x);nl(()=>{I.current=x},[x]),c.useImperativeHandle(p,()=>S.current,[]);const C=flipPlacement(d,a),[E,R]=c.useState(C),[k,T]=c.useState(resolveAnchorEl$1(n));c.useEffect(()=>{S.current&&S.current.forceUpdate()}),c.useEffect(()=>{n&&T(resolveAnchorEl$1(n))},[n]),nl(()=>{if(!k||!l)return;const handlePopperUpdate=e=>{R(e.placement)};let e=[{name:"preventOverflow",options:{altBoundary:i}},{name:"flip",options:{altBoundary:i}},{name:"onUpdate",enabled:!0,phase:"afterWrite",fn:({state:e})=>{handlePopperUpdate(e)}}];null!=s&&(e=e.concat(s)),u&&null!=u.modifiers&&(e=e.concat(u.modifiers));const t=Eu(k,v.current,{placement:C,...u,modifiers:e});I.current(t);const n=v.current;return()=>{if(n){const{style:e}=n,o=e.position,a=e.top,i=e.left,s=e.transform;t.destroy(),e.position=o,e.top=a,e.left=i,e.transform=s}else t.destroy();I.current(null)}},[k,i,s,l,u,C]);const M={placement:E};null!==g&&(M.TransitionProps=g);const $=useUtilityClasses$38(e),N=h.root??"div";return(0,ps.jsx)(N,{...useSlotProps({elementType:N,externalSlotProps:m.root,externalForwardedProps:b,additionalProps:{role:"tooltip",ref:w},ownerState:e,className:$.root}),children:"function"==typeof o?o(M):o})}),Au=c.forwardRef(function(e,t){const{anchorEl:n,children:o,container:a,direction:i="ltr",disablePortal:s=!1,keepMounted:l=!1,modifiers:d,open:u,placement:p="bottom",popperOptions:m=Ru,popperRef:h,style:g,transition:y=!1,slotProps:b={},slots:v={},...w}=e,[S,x]=c.useState(!0),handleEnter=()=>{x(!1)},handleExited=()=>{x(!0)};if(!l&&!u&&(!y||S))return null;let I;if(a)I=a;else if(n){const e=resolveAnchorEl$1(n);I=e&&isHTMLElement(e)?ownerDocument(e).body:ownerDocument(null).body}const C=u||!l||y&&!S?void 0:"none",E=y?{in:u,onEnter:handleEnter,onExited:handleExited}:void 0;return(0,ps.jsx)(Md,{disablePortal:s,container:I,children:(0,ps.jsx)(ku,{anchorEl:n,direction:i,disablePortal:s,modifiers:d,ref:t,open:y?!S:u,placement:p,popperOptions:m,popperRef:h,slotProps:b,slots:v,...w,style:{position:"fixed",top:0,left:0,display:C,...g},TransitionProps:E,children:o})})}),Tu=Fl(Au,{name:"MuiPopper",slot:"Root"})({}),Mu=c.forwardRef(function(e,t){const n=useRtl(),{anchorEl:o,component:a,container:i,disablePortal:s,keepMounted:l,modifiers:c,open:d,placement:u,popperOptions:p,popperRef:m,transition:h,slots:g,slotProps:y,...b}=useDefaultProps({props:e,name:"MuiPopper"}),v={anchorEl:o,container:i,disablePortal:s,keepMounted:l,modifiers:c,open:d,placement:u,popperOptions:p,popperRef:m,transition:h,...b};return(0,ps.jsx)(Tu,{as:a,direction:n?"rtl":"ltr",slots:g,slotProps:y,...v,ref:t})});function getTooltipUtilityClass(e){return generateUtilityClass("MuiTooltip",e)}var zu=generateUtilityClasses("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"]);function round(e){return Math.round(1e5*e)/1e5}var useUtilityClasses$37=e=>{const{classes:t,disableInteractive:n,arrow:o,touch:a,placement:i}=e;return composeClasses({popper:["popper",!n&&"popperInteractive",o&&"popperArrow"],tooltip:["tooltip",o&&"tooltipArrow",a&&"touch",`tooltipPlacement${Zl(i.split("-")[0])}`],arrow:["arrow"]},getTooltipUtilityClass,t)},$u=Fl(Mu,{name:"MuiTooltip",slot:"Popper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.popper,!n.disableInteractive&&t.popperInteractive,n.arrow&&t.popperArrow,!n.open&&t.popperClose]}})(Kl(({theme:e})=>({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:"none",variants:[{props:({ownerState:e,open:t})=>t&&!e.disableInteractive,style:{pointerEvents:"auto"}},{props:({ownerState:e})=>e.arrow,style:{[`&[data-popper-placement*="bottom"] .${zu.arrow}`]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},[`&[data-popper-placement*="top"] .${zu.arrow}`]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},[`&[data-popper-placement*="right"] .${zu.arrow}`]:{height:"1em",width:"0.71em",insetInlineStart:0,marginInlineStart:"-0.71em","&::before":{transformOrigin:"100% 100%"}},[`&[data-popper-placement*="left"] .${zu.arrow}`]:{height:"1em",width:"0.71em",insetInlineEnd:0,marginInlineEnd:"-0.71em","&::before":{transformOrigin:"0 0"}}}}]}))),Nu=Fl("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.tooltip,n.touch&&t.touch,n.arrow&&t.tooltipArrow,t[`tooltipPlacement${Zl(n.placement.split("-")[0])}`]]}})(Kl(({theme:e})=>({backgroundColor:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:e.typography.fontWeightMedium,[`.${zu.popper}[data-popper-placement*="left"] &`]:{transformOrigin:"right center",marginInlineEnd:"14px"},[`.${zu.popper}[data-popper-placement*="right"] &`]:{transformOrigin:"left center",marginInlineStart:"14px"},[`.${zu.popper}[data-popper-placement*="top"] &`]:{transformOrigin:"center bottom",marginBottom:"14px"},[`.${zu.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:"center top",marginTop:"14px"},variants:[{props:({ownerState:e})=>e.arrow,style:{position:"relative",marginBlock:0}},{props:({ownerState:e})=>e.touch,style:{padding:"8px 16px",fontSize:e.typography.pxToRem(14),lineHeight:`${round(16/14)}em`,fontWeight:e.typography.fontWeightRegular}},{props:({ownerState:e})=>e.touch,style:{[`.${zu.popper}[data-popper-placement*="left"] &`]:{marginInlineEnd:"24px"},[`.${zu.popper}[data-popper-placement*="right"] &`]:{marginInlineStart:"24px"},[`.${zu.popper}[data-popper-placement*="top"] &`]:{marginBottom:"24px"},[`.${zu.popper}[data-popper-placement*="bottom"] &`]:{marginTop:"24px"}}}]}))),Pu=Fl("span",{name:"MuiTooltip",slot:"Arrow"})(Kl(({theme:e})=>({overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}}))),Ou=!1,_u=new Ac,ju={x:0,y:0};function composeEventHandler(e,t){return(n,...o)=>{t&&t(n,...o),e(n,...o)}}var Fu=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTooltip"}),{arrow:o=!1,children:a,classes:i,describeChild:s=!1,disableFocusListener:l=!1,disableHoverListener:d=!1,disableInteractive:u=!1,disableTouchListener:p=!1,enterDelay:m=100,enterNextDelay:h=0,enterTouchDelay:g=700,followCursor:y=!1,id:b,leaveDelay:v=0,leaveTouchDelay:w=1500,onClose:S,onOpen:x,open:I,placement:C="bottom",slotProps:E={},slots:R={},title:k,...T}=n,M=c.isValidElement(a)?a:(0,ps.jsx)("span",{children:a}),$=useTheme(),[N,P]=c.useState(),[O,j]=c.useState(null),F=c.useRef(!1),L=u||y,D=useTimeout(),B=useTimeout(),G=useTimeout(),W=useTimeout(),[V,H]=dc({controlled:I,default:!1,name:"Tooltip",state:"open"});let U=V;const q=cc(b),K=c.useRef(),Z=uc(()=>{void 0!==K.current&&(document.body.style.WebkitUserSelect=K.current,K.current=void 0),W.clear()});c.useEffect(()=>Z,[Z]);const handleOpen=e=>{_u.clear(),Ou=!0,H(!0),x&&!U&&x(e)},Y=uc(e=>{_u.start(800+v,()=>{Ou=!1}),H(!1),S&&U&&S(e),D.start($.transitions.duration.shortest,()=>{F.current=!1})}),handleMouseOver=e=>{F.current&&"touchstart"!==e.type||(N&&N.removeAttribute("title"),B.clear(),G.clear(),m||Ou&&h?B.start(Ou?h:m,()=>{handleOpen(e)}):handleOpen(e))},handleMouseLeave=e=>{B.clear(),G.start(v,()=>{Y(e)})},[,X]=c.useState(!1),handleBlur=e=>{const t=e?.target??N;if(!t||t.disabled||!isFocusVisible(t)){X(!1);const n=e??new Event("blur");!e&&t&&(Object.defineProperty(n,"target",{value:t}),Object.defineProperty(n,"currentTarget",{value:t})),handleMouseLeave(n)}},handleFocus=e=>{if(N||P(e.currentTarget),isFocusVisible(e.target)){const handleNativeBlur=e=>{e.target.disabled&&handleBlur(e),e.target.removeEventListener("blur",handleNativeBlur)};e.target.addEventListener("blur",handleNativeBlur),X(!0),handleMouseOver(e)}},detectTouchStart=e=>{F.current=!0;const t=M.props;t.onTouchStart&&t.onTouchStart(e)},handleTouchStart=e=>{detectTouchStart(e),G.clear(),D.clear(),Z(),K.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",W.start(g,()=>{document.body.style.WebkitUserSelect=K.current,handleMouseOver(e)})},handleTouchEnd=e=>{M.props.onTouchEnd&&M.props.onTouchEnd(e),Z(),G.start(w,()=>{Y(e)})};c.useEffect(()=>{if(U)return document.addEventListener("keydown",handleKeyDown),()=>{document.removeEventListener("keydown",handleKeyDown)};function handleKeyDown(e){"Escape"===e.key&&Y(e)}},[Y,U]);const J=pc(getReactElementRef(M),P,t);k||0===k||(U=!1);const Q=c.useRef(),handleMouseMove=e=>{const t=M.props;t.onMouseMove&&t.onMouseMove(e),ju={x:e.clientX,y:e.clientY},Q.current&&Q.current.update()},ee={},te="string"==typeof k;s?(ee.title=U||!te||d?null:k,ee["aria-describedby"]=U?q:null):(ee["aria-label"]=te?k:null,ee["aria-labelledby"]=U&&!te?q:null);const re={...ee,...T,...M.props,className:clsx(T.className,M.props.className),onTouchStart:detectTouchStart,ref:J,...y?{onMouseMove:handleMouseMove}:{}},ne={};p||(re.onTouchStart=handleTouchStart,re.onTouchEnd=handleTouchEnd),d||(re.onMouseOver=composeEventHandler(handleMouseOver,re.onMouseOver),re.onMouseLeave=composeEventHandler(handleMouseLeave,re.onMouseLeave),L||(ne.onMouseOver=handleMouseOver,ne.onMouseLeave=handleMouseLeave)),l||(re.onFocus=composeEventHandler(handleFocus,re.onFocus),re.onBlur=composeEventHandler(handleBlur,re.onBlur),L||(ne.onFocus=handleFocus,ne.onBlur=handleBlur));const oe={...n,arrow:o,disableInteractive:L,placement:C,touch:F.current},ae="function"==typeof E.popper?E.popper(oe):E.popper,ie=c.useMemo(()=>{let e=[{name:"arrow",enabled:Boolean(O),options:{element:O,padding:4}}];return ae?.popperOptions?.modifiers&&(e=e.concat(ae.popperOptions.modifiers)),{...ae?.popperOptions,modifiers:e}},[O,ae?.popperOptions]),se=useUtilityClasses$37(oe),le={slots:R,slotProps:{arrow:E.arrow,popper:ae,tooltip:E.tooltip,transition:E.transition}},[ce,de]=useSlot("popper",{elementType:$u,externalForwardedProps:le,ownerState:oe,className:se.popper}),[ue,pe]=useSlot("transition",{elementType:ru,externalForwardedProps:le,ownerState:oe}),[me,he]=useSlot("tooltip",{elementType:Nu,className:se.tooltip,externalForwardedProps:le,ownerState:oe}),[ge,fe]=useSlot("arrow",{elementType:Pu,className:se.arrow,externalForwardedProps:le,ownerState:oe,ref:j});return(0,ps.jsxs)(c.Fragment,{children:[c.cloneElement(M,re),(0,ps.jsx)(ce,{as:Mu,placement:C,anchorEl:y?{getBoundingClientRect:()=>({top:ju.y,left:ju.x,right:ju.x,bottom:ju.y,width:0,height:0})}:N,popperRef:Q,open:!!N&&U,id:q,transition:!0,...ne,...de,popperOptions:ie,children:({TransitionProps:e})=>(0,ps.jsx)(ue,{timeout:$.transitions.duration.shorter,...e,...pe,children:(0,ps.jsxs)(me,{...he,children:[k,o?(0,ps.jsx)(ge,{...fe}):null]})})})]})}),Lu="✕";function NexWindowDialog({children:e,closeOnGlobalEscape:t,contentSx:n,dialogProps:o={},draggable:a=!0,footer:i=null,headerContent:s=null,headerSx:l,initialPosition:d={x:40,y:60},maxHeight:u,maxWidth:p,minWidth:m=320,modal:h=!1,onClose:g,open:y,paperSx:b,showCloseButton:v=!0,title:w,titleActions:S=null,width:x=480}){const[I,C]=c.useState(()=>{if("center"===d){if("undefined"!=typeof window){const e=x??480,t=u??420;return{x:Math.max(0,Math.round((window.innerWidth-e)/2)),y:Math.max(0,Math.round((window.innerHeight-t)/2))}}return{x:40,y:60}}return{x:d?.x??40,y:d?.y??60}}),E=c.useRef(null),R=c.useId(),{disableAutoFocus:k,disableEnforceFocus:T,disablePortal:M,disableRestoreFocus:$,disableScrollLock:N,fullWidth:P=!1,hideBackdrop:O,maxWidth:j=!1,sx:F,...L}=o,D=a&&!h,B=t??!h;function handleClose(e,t){g?.(e,t)}function handleDragStart(e){function onMove(e){E.current&&C({x:e.clientX-E.current.startX,y:e.clientY-E.current.startY})}function onUp(){E.current=null,window.removeEventListener("mousemove",onMove),window.removeEventListener("mouseup",onUp)}D&&0===e.button&&(E.current={startX:e.clientX-I.x,startY:e.clientY-I.y},window.addEventListener("mousemove",onMove),window.addEventListener("mouseup",onUp),e.preventDefault())}c.useEffect(()=>{y&&C(()=>{if("center"===d){if("undefined"!=typeof window){const e=x??480,t=u??420;return{x:Math.max(0,Math.round((window.innerWidth-e)/2)),y:Math.max(0,Math.round((window.innerHeight-t)/2))}}return{x:40,y:60}}return{x:d?.x??40,y:d?.y??60}})},[y,d,x,u]),c.useEffect(()=>{if(y&&B)return window.addEventListener("keydown",handleKeyDown),()=>{window.removeEventListener("keydown",handleKeyDown)};function handleKeyDown(e){"Escape"===e.key&&g?.(e,"escapeKeyDown")}},[B,y,g]);const resolvedPaperSx=e=>({display:"flex",flexDirection:"column",m:0,maxHeight:u??e.nexmap?.window?.defaultMaxHeight??960,maxWidth:p??e.nexmap?.window?.defaultMaxWidth??1440,overflow:"hidden",...null==m?{}:{minWidth:m},...null==x?{}:{width:x},...h?{}:{left:I.x,pointerEvents:"auto",position:"fixed",top:I.y}});return y?(0,ps.jsxs)(qd,{open:y,onClose:handleClose,"aria-labelledby":R,disableAutoFocus:k??!h,disableEnforceFocus:T??!h,disablePortal:M??!1,disableRestoreFocus:$??!h,disableScrollLock:N??!h,fullWidth:P,hideBackdrop:O??!h,maxWidth:j,sx:h?F:[{pointerEvents:"none","& .MuiDialog-container":{alignItems:"flex-start",justifyContent:"flex-start"}},F],slotProps:{paper:{sx:[resolvedPaperSx,b]}},...L,children:[(0,ps.jsxs)(Hl,{sx:{borderBottom:"1px solid",borderColor:"divider"},children:[(0,ps.jsxs)(Zd,{id:R,onMouseDown:D?handleDragStart:void 0,sx:[{alignItems:"center",bgcolor:e=>e.palette.background?.header??e.palette.action.hover,cursor:D?"move":"default",display:"flex",gap:1,justifyContent:"space-between",userSelect:D?"none":"auto"},l],children:[(0,ps.jsx)(Hl,{component:"span",sx:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w}),(S||v)&&(0,ps.jsxs)(Hl,{sx:{alignItems:"center",display:"flex",gap:.5},children:[S,v?(0,ps.jsx)(Fu,{title:"Close",children:(0,ps.jsx)(Qd,{size:"small",onClick:e=>handleClose(e,"closeClick"),sx:{color:"text.secondary"},children:Lu})}):null]})]}),s]}),(0,ps.jsx)(Hl,{sx:[{flex:1,minHeight:0},n],children:e}),i]}):null}function getDividerUtilityClass(e){return generateUtilityClass("MuiDivider",e)}var Du=generateUtilityClasses("MuiDivider",["root","absolute","fullWidth","inset","middle","flexItem","vertical","withChildren","textAlignRight","textAlignLeft","wrapper","wrapperVertical"]),useUtilityClasses$36=e=>{const{absolute:t,children:n,classes:o,flexItem:a,orientation:i,textAlign:s,variant:l}=e;return composeClasses({root:["root",t&&"absolute",l,"vertical"===i&&"vertical",a&&"flexItem",n&&"withChildren","right"===s&&"vertical"!==i&&"textAlignRight","left"===s&&"vertical"!==i&&"textAlignLeft"],wrapper:["wrapper","vertical"===i&&"wrapperVertical"]},getDividerUtilityClass,o)},Bu=Fl("div",{name:"MuiDivider",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.absolute&&t.absolute,t[n.variant],"vertical"===n.orientation&&t.vertical,n.flexItem&&t.flexItem,n.children&&t.withChildren,"right"===n.textAlign&&"vertical"!==n.orientation&&t.textAlignRight,"left"===n.textAlign&&"vertical"!==n.orientation&&t.textAlignLeft]}})(Kl(({theme:e})=>({margin:0,flexShrink:0,borderWidth:0,borderStyle:"solid",borderColor:(e.vars||e).palette.divider,borderBottomWidth:"thin",variants:[{props:{absolute:!0},style:{position:"absolute",bottom:0,left:0,width:"100%"}},{props:{variant:"inset"},style:{marginLeft:72}},{props:{variant:"middle",orientation:"horizontal"},style:{marginLeft:e.spacing(2),marginRight:e.spacing(2)}},{props:{variant:"middle",orientation:"vertical"},style:{marginTop:e.spacing(1),marginBottom:e.spacing(1)}},{props:{orientation:"vertical"},style:{height:"100%",borderBottomWidth:0,borderRightWidth:"thin"}},{props:{flexItem:!0},style:{alignSelf:"stretch",height:"auto"}},{props:({ownerState:e})=>!!e.children,style:{display:"flex",textAlign:"center",border:0,borderTopStyle:"solid",borderLeftStyle:"solid","&::before, &::after":{content:'""',alignSelf:"center"}}},{props:({ownerState:e})=>e.children&&"vertical"!==e.orientation,style:{"&::before, &::after":{width:"100%",borderTop:`thin solid ${(e.vars||e).palette.divider}`,borderTopStyle:"inherit"}}},{props:({ownerState:e})=>"vertical"===e.orientation&&e.children,style:{flexDirection:"column","&::before, &::after":{height:"100%",borderLeft:`thin solid ${(e.vars||e).palette.divider}`,borderLeftStyle:"inherit"}}},{props:({ownerState:e})=>"right"===e.textAlign&&"vertical"!==e.orientation,style:{"&::before":{width:"90%"},"&::after":{width:"10%"}}},{props:({ownerState:e})=>"left"===e.textAlign&&"vertical"!==e.orientation,style:{"&::before":{width:"10%"},"&::after":{width:"90%"}}}]}))),Gu=Fl("span",{name:"MuiDivider",slot:"Wrapper",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.wrapper,"vertical"===n.orientation&&t.wrapperVertical]}})(Kl(({theme:e})=>({display:"inline-block",paddingLeft:`calc(${e.spacing(1)} * 1.2)`,paddingRight:`calc(${e.spacing(1)} * 1.2)`,whiteSpace:"nowrap",variants:[{props:{orientation:"vertical"},style:{paddingTop:`calc(${e.spacing(1)} * 1.2)`,paddingBottom:`calc(${e.spacing(1)} * 1.2)`}}]}))),Wu=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiDivider"}),{absolute:o=!1,children:a,className:i,orientation:s="horizontal",component:l=(a||"vertical"===s?"div":"hr"),flexItem:c=!1,role:d=("hr"!==l?"separator":void 0),textAlign:u="center",variant:p="fullWidth",...m}=n,h={...n,absolute:o,component:l,flexItem:c,orientation:s,role:d,textAlign:u,variant:p},g=useUtilityClasses$36(h);return(0,ps.jsx)(Bu,{as:l,className:clsx(g.root,i),role:d,ref:t,ownerState:h,"aria-orientation":"separator"!==d||"hr"===l&&"vertical"!==s?void 0:s,...m,children:a?(0,ps.jsx)(Gu,{className:g.wrapper,ownerState:h,children:a}):null})});function hasValue(e){return null!=e&&!(Array.isArray(e)&&0===e.length)}function isFilled(e,t=!1){return e&&(hasValue(e.value)&&""!==e.value||t&&hasValue(e.defaultValue)&&""!==e.defaultValue)}function isAdornedStart(e){return e.startAdornment}var Vu=c.createContext(void 0);function getFormControlUtilityClasses(e){return generateUtilityClass("MuiFormControl",e)}generateUtilityClasses("MuiFormControl",["root","marginNone","marginNormal","marginDense","fullWidth","disabled"]);var useUtilityClasses$35=e=>{const{classes:t,margin:n,fullWidth:o}=e;return composeClasses({root:["root","none"!==n&&`margin${Zl(n)}`,o&&"fullWidth"]},getFormControlUtilityClasses,t)},Hu=Fl("div",{name:"MuiFormControl",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`margin${Zl(n.margin)}`],n.fullWidth&&t.fullWidth]}})({display:"inline-flex",flexDirection:"column",position:"relative",minWidth:0,padding:0,margin:0,border:0,verticalAlign:"top",variants:[{props:{margin:"normal"},style:{marginTop:16,marginBottom:8}},{props:{margin:"dense"},style:{marginTop:8,marginBottom:4}},{props:{fullWidth:!0},style:{width:"100%"}}]}),Uu=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiFormControl"}),{children:o,className:a,color:i="primary",component:s="div",disabled:l=!1,error:d=!1,focused:u,fullWidth:p=!1,hiddenLabel:m=!1,margin:h="none",required:g=!1,size:y="medium",variant:b="outlined",...v}=n,w={...n,color:i,component:s,disabled:l,error:d,fullWidth:p,hiddenLabel:m,margin:h,required:g,size:y,variant:b},S=useUtilityClasses$35(w),[x,I]=c.useState(()=>{let e=!1;return o&&c.Children.forEach(o,t=>{if(!oc(t,["Input","Select"]))return;const n=oc(t,["Select"])?t.props.input:t;n&&isAdornedStart(n.props)&&(e=!0)}),e}),[C,E]=c.useState(()=>{let e=!1;return o&&c.Children.forEach(o,t=>{oc(t,["Input","Select"])&&(isFilled(t.props,!0)||isFilled(t.props.inputProps,!0))&&(e=!0)}),e}),[R,k]=c.useState(!1);l&&R&&k(!1);const T=void 0===u||l?R:u;let M;c.useRef(!1);const $=c.useCallback(()=>{E(!0)},[]),N=c.useCallback(()=>{E(!1)},[]),P=c.useMemo(()=>({adornedStart:x,setAdornedStart:I,color:i,disabled:l,error:d,filled:C,focused:T,fullWidth:p,hiddenLabel:m,size:y,onBlur:()=>{k(!1)},onFocus:()=>{k(!0)},onEmpty:N,onFilled:$,registerEffect:M,required:g,variant:b}),[x,i,l,d,C,T,p,m,M,N,$,g,y,b]);return(0,ps.jsx)(Vu.Provider,{value:P,children:(0,ps.jsx)(Hu,{as:s,ownerState:w,className:clsx(S.root,a),ref:t,...v,children:o})})});function useFormControl(){return c.useContext(Vu)}function useFormControlState({props:e,states:t}){const n=c.useContext(Vu),o={};return t.forEach(t=>{const a=e[t];o[t]=void 0===a&&n?n[t]:a}),[o,n]}function getFormControlLabelUtilityClasses(e){return generateUtilityClass("MuiFormControlLabel",e)}var qu=generateUtilityClasses("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error","required","asterisk"]),useUtilityClasses$34=e=>{const{classes:t,disabled:n,labelPlacement:o,error:a,required:i}=e;return composeClasses({root:["root",n&&"disabled",`labelPlacement${Zl(o)}`,a&&"error",i&&"required"],label:["label",n&&"disabled"],asterisk:["asterisk",a&&"error"]},getFormControlLabelUtilityClasses,t)},Ku=Fl("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${qu.label}`]:t.label},t.root,t[`labelPlacement${Zl(n.labelPlacement)}`]]}})(Kl(({theme:e})=>({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${qu.disabled}`]:{cursor:"default"},[`& .${qu.label}`]:{[`&.${qu.disabled}`]:{color:(e.vars||e).palette.text.disabled}},variants:[{props:{labelPlacement:"start"},style:{flexDirection:"row-reverse",marginRight:-11}},{props:{labelPlacement:"top"},style:{flexDirection:"column-reverse"}},{props:{labelPlacement:"bottom"},style:{flexDirection:"column"}},{props:({labelPlacement:e})=>"start"===e||"top"===e||"bottom"===e,style:{marginLeft:16}}]}))),Zu=Fl("span",{name:"MuiFormControlLabel",slot:"Asterisk"})(Kl(({theme:e})=>({[`&.${qu.error}`]:{color:(e.vars||e).palette.error.main}}))),Yu=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiFormControlLabel"}),{checked:o,className:a,control:i,disabled:s,disableTypography:l,inputRef:d,label:u,labelPlacement:p="end",name:m,onChange:h,required:g,slots:y={},slotProps:b={},value:v,...w}=n,[S,x]=useFormControlState({props:n,states:["error"]}),I=s??i.props.disabled??x?.disabled,C=g??i.props.required,E={disabled:I,required:C};["checked","name","onChange","value","inputRef"].forEach(e=>{void 0===i.props[e]&&void 0!==n[e]&&(E[e]=n[e])});const R={...n,disabled:I,labelPlacement:p,required:C,error:S.error},k=useUtilityClasses$34(R),[T,M]=useSlot("typography",{elementType:Jl,externalForwardedProps:{slots:y,slotProps:b},ownerState:R});let $=u;return null==$||$.type===Jl||l||($=(0,ps.jsx)(T,{component:"span",...M,className:clsx(k.label,M?.className),children:$})),(0,ps.jsxs)(Ku,{className:clsx(k.root,a),ownerState:R,ref:t,...w,children:[c.cloneElement(i,E),C?(0,ps.jsxs)("div",{children:[$,(0,ps.jsxs)(Zu,{ownerState:R,"aria-hidden":!0,className:k.asterisk,children:[" ","*"]})]}):$]})});function getFormLabelUtilityClasses(e){return generateUtilityClass("MuiFormLabel",e)}var Xu=generateUtilityClasses("MuiFormLabel",["root","colorSecondary","focused","disabled","error","filled","required","asterisk"]),useUtilityClasses$33=e=>{const{classes:t,color:n,focused:o,disabled:a,error:i,filled:s,required:l}=e;return composeClasses({root:["root",`color${Zl(n)}`,a&&"disabled",i&&"error",s&&"filled",o&&"focused",l&&"required"],asterisk:["asterisk",i&&"error"]},getFormLabelUtilityClasses,t)},Ju=Fl("label",{name:"MuiFormLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,"secondary"===n.color&&t.colorSecondary,n.filled&&t.filled]}})(Kl(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.body1,lineHeight:"1.4375em",padding:0,position:"relative",variants:[...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t},style:{[`&.${Xu.focused}`]:{color:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${Xu.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${Xu.error}`]:{color:(e.vars||e).palette.error.main}}}]}))),Qu=Fl("span",{name:"MuiFormLabel",slot:"Asterisk"})(Kl(({theme:e})=>({[`&.${Xu.error}`]:{color:(e.vars||e).palette.error.main}}))),ep=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiFormLabel"}),{children:o,className:a,color:i,component:s="label",disabled:l,error:c,filled:d,focused:u,required:p,...m}=n,[h]=useFormControlState({props:n,states:["color","required","focused","disabled","error","filled"]}),g={...n,color:h.color||"primary",component:s,disabled:h.disabled,error:h.error,filled:h.filled,focused:h.focused,required:h.required},y=useUtilityClasses$33(g);return(0,ps.jsxs)(Ju,{as:s,ownerState:g,className:clsx(y.root,a),ref:t,...m,children:[o,h.required&&(0,ps.jsxs)(Qu,{ownerState:g,"aria-hidden":!0,className:y.asterisk,children:[" ","*"]})]})});function getInputLabelUtilityClasses(e){return generateUtilityClass("MuiInputLabel",e)}var tp=generateUtilityClasses("MuiInputLabel",["root","focused","disabled","error","required","asterisk","formControl","sizeSmall","shrink","animated","standard","filled","outlined"]),useUtilityClasses$32=e=>{const{classes:t,formControl:n,size:o,shrink:a,disableAnimation:i,variant:s,required:l}=e,c=composeClasses({root:["root",n&&"formControl",!i&&"animated",a&&"shrink",o&&"medium"!==o&&`size${Zl(o)}`,s],asterisk:[l&&"asterisk"]},getInputLabelUtilityClasses,t);return{...t,...c}},rp=Fl(ep,{shouldForwardProp:e=>rootShouldForwardProp(e)||"classes"===e,name:"MuiInputLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Xu.asterisk}`]:t.asterisk},t.root,n.formControl&&t.formControl,"small"===n.size&&t.sizeSmall,n.shrink&&t.shrink,!n.disableAnimation&&t.animated,n.focused&&t.focused,t[n.variant]]}})(Kl(({theme:e})=>({display:"block",transformOrigin:"top left",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%",variants:[{props:({ownerState:e})=>e.formControl,style:{position:"absolute",left:0,top:0,transform:"translate(0, 20px) scale(1)"}},{props:{size:"small"},style:{transform:"translate(0, 17px) scale(1)"}},{props:({ownerState:e})=>e.shrink,style:{transform:"translate(0, -1.5px) scale(0.75)",transformOrigin:"top left",maxWidth:"133%"}},{props:({ownerState:e})=>!e.disableAnimation,style:{transition:e.transitions.create(["color","transform","max-width"],{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut})}},{props:{variant:"filled"},style:{zIndex:1,pointerEvents:"none",transform:"translate(12px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"filled",size:"small"},style:{transform:"translate(12px, 13px) scale(1)"}},{props:({variant:e,ownerState:t})=>"filled"===e&&t.shrink,style:{userSelect:"none",pointerEvents:"auto",transform:"translate(12px, 7px) scale(0.75)",maxWidth:"calc(133% - 24px)"}},{props:({variant:e,ownerState:t,size:n})=>"filled"===e&&t.shrink&&"small"===n,style:{transform:"translate(12px, 4px) scale(0.75)"}},{props:{variant:"outlined"},style:{zIndex:1,pointerEvents:"none",transform:"translate(14px, 16px) scale(1)",maxWidth:"calc(100% - 24px)"}},{props:{variant:"outlined",size:"small"},style:{transform:"translate(14px, 9px) scale(1)"}},{props:({variant:e,ownerState:t})=>"outlined"===e&&t.shrink,style:{userSelect:"none",pointerEvents:"auto",maxWidth:"calc(133% - 32px)",transform:"translate(14px, -9px) scale(0.75)"}}]}))),np=c.forwardRef(function(e,t){const n=useDefaultProps({name:"MuiInputLabel",props:e}),{disableAnimation:o=!1,margin:a,shrink:i,variant:s,className:l,...c}=n,[d,u]=useFormControlState({props:n,states:["size","variant","required","focused"]});let p=i;void 0===p&&u&&(p=u.filled||u.focused||u.adornedStart);const m={...n,disableAnimation:o,formControl:u,shrink:p,size:d.size,variant:d.variant,required:d.required,focused:d.focused},h=useUtilityClasses$32(m);return(0,ps.jsx)(rp,{"data-shrink":p,ref:t,className:clsx(h.root,l),...c,ownerState:m,classes:h})});function getInputAdornmentUtilityClass(e){return generateUtilityClass("MuiInputAdornment",e)}var op,ap=generateUtilityClasses("MuiInputAdornment",["root","filled","standard","outlined","positionStart","positionEnd","disablePointerEvents","hiddenLabel","sizeSmall"]),overridesResolver$1=(e,t)=>{const{ownerState:n}=e;return[t.root,t[`position${Zl(n.position)}`],!0===n.disablePointerEvents&&t.disablePointerEvents,t[n.variant]]},useUtilityClasses$31=e=>{const{classes:t,disablePointerEvents:n,hiddenLabel:o,position:a,size:i,variant:s}=e;return composeClasses({root:["root",n&&"disablePointerEvents",a&&`position${Zl(a)}`,s,o&&"hiddenLabel",i&&`size${Zl(i)}`]},getInputAdornmentUtilityClass,t)},ip=Fl("div",{name:"MuiInputAdornment",slot:"Root",overridesResolver:overridesResolver$1})(Kl(({theme:e})=>({display:"flex",maxHeight:"2em",alignItems:"center",whiteSpace:"nowrap",color:(e.vars||e).palette.action.active,variants:[{props:{variant:"filled"},style:{[`&.${ap.positionStart}&:not(.${ap.hiddenLabel})`]:{marginTop:16}}},{props:{position:"start"},style:{marginRight:8}},{props:{position:"end"},style:{marginLeft:8}},{props:{disablePointerEvents:!0},style:{pointerEvents:"none"}}]}))),sp=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiInputAdornment"}),{children:o,className:a,component:i="div",disablePointerEvents:s=!1,disableTypography:l=!1,position:d,variant:u,...p}=n,m=useFormControl()||{};let h=u;u&&m.variant,m&&!h&&(h=m.variant);const g={...n,hiddenLabel:m.hiddenLabel,size:m.size,disablePointerEvents:s,position:d,variant:h},y=useUtilityClasses$31(g);return(0,ps.jsx)(Vu.Provider,{value:null,children:(0,ps.jsx)(ip,{as:i,ownerState:g,className:clsx(y.root,a),ref:t,...p,children:"string"!=typeof o||l?(0,ps.jsxs)(c.Fragment,{children:["start"===d?op||(op=(0,ps.jsx)("span",{className:"notranslate","aria-hidden":!0,children:"​"})):null,o]}):(0,ps.jsx)(Jl,{color:"textSecondary",children:o})})})}),lp=c.createContext({});function focusWithVisible(e,t){if(null!=t)try{e.focus({focusVisible:"keyboard"===t})}catch(n){e.focus()}else e.focus()}var cp=generateUtilityClasses("MuiListItemIcon",["root","alignItemsFlexStart"]),dp=generateUtilityClasses("MuiListItemText",["root","multiline","dense","inset","primary","secondary"]),pp=c.createContext(void 0);function useMenuListContext(){const e=c.useContext(pp);if(void 0===e)throw new Error("MUI: MenuListContext is missing. MenuItems must be placed within Menu or MenuList.");return e}function getOpenInteractionType(e){return e?"mousedown"===e.type||"pointerdown"===e.type||"touchstart"===e.type?"pointer":"keydown"===e.type||"click"===e.type&&0===e.detail?"keyboard":null:null}function isEmpty$2(e){return null==e||"string"==typeof e&&!e.trim()}function areEqualValues(e,t){return"object"==typeof t&&null!==t?e===t:String(e)===String(t)}var mp=c.createContext(null);function useSelectFocusSource(){return c.useContext(mp)}var hp=mp.Provider;function getMenuItemUtilityClass(e){return generateUtilityClass("MuiMenuItem",e)}var gp=generateUtilityClasses("MuiMenuItem",["root","focusVisible","dense","disabled","divider","gutters","selected"]),overridesResolver=(e,t)=>{const{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},useUtilityClasses$30=e=>{const{disabled:t,dense:n,divider:o,disableGutters:a,selected:i,classes:s}=e,l=composeClasses({root:["root",n&&"dense",t&&"disabled",!a&&"gutters",o&&"divider",i&&"selected"]},getMenuItemUtilityClass,s);return{...s,...l}},fp=Fl(Lc,{shouldForwardProp:e=>rootShouldForwardProp(e)||"classes"===e,name:"MuiMenuItem",slot:"Root",overridesResolver})(Kl(({theme:e})=>({...e.typography.body1,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",textDecoration:"none",minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:"border-box",whiteSpace:"nowrap","&:hover":{textDecoration:"none",backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${gp.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${gp.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${gp.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${gp.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${gp.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${Du.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${Du.inset}`]:{marginLeft:52},[`& .${dp.root}`]:{marginTop:0,marginBottom:0},[`& .${dp.inset}`]:{paddingLeft:36},[`& .${cp.root}`]:{minWidth:36},variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:"padding-box"}},{props:({ownerState:e})=>!e.dense,style:{[e.breakpoints.up("sm")]:{minHeight:"auto"}}},{props:({ownerState:e})=>e.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${cp.root} svg`]:{fontSize:"1.25rem"}}}]}))),yp=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiMenuItem"}),{autoFocus:o=!1,component:a="li",dense:i=!1,divider:s=!1,disableGutters:l=!1,focusVisibleClassName:d,role:u="menuitem",tabIndex:p,className:m,...h}=n,g=useSelectFocusSource(),y=c.useContext(lp),b=c.useMemo(()=>({dense:i||y.dense||!1,disableGutters:l}),[y.dense,i,l]),v=useMenuListContext(),w=cc(),S=v.suppressInitialFocusVisible,x=v.itemsFocusableWhenDisabled,I=c.useRef(null);lc(()=>{o&&I.current&&focusWithVisible(I.current,g)},[o]);const C={...n,dense:b.dense,divider:s,disableGutters:l},E=useUtilityClasses$30(n),{root:R,...k}=E,T=useRovingTabIndexItem({id:w,ref:t,disabled:n.disabled,focusableWhenDisabled:x,selected:n.selected}),M=pc(I,T.ref);let $;return void 0!==p?$=p:"selectedMenu"===v.variant?$=T.tabIndex:n.disabled&&!x||($=-1),(0,ps.jsx)(lp.Provider,{value:b,children:(0,ps.jsx)(fp,{ref:M,role:u,tabIndex:$,component:a,internalNativeButton:!1,focusableWhenDisabled:x,suppressFocusVisible:S,focusVisibleClassName:clsx(E.focusVisible,d),className:clsx(E.root,m),...h,ownerState:C,classes:k})})}),bp=getScrollbarSize;function getListUtilityClass(e){return generateUtilityClass("MuiList",e)}generateUtilityClasses("MuiList",["root","padding","dense","subheader"]);var useUtilityClasses$29=e=>{const{classes:t,disablePadding:n,dense:o,subheader:a}=e;return composeClasses({root:["root",!n&&"padding",o&&"dense",a&&"subheader"]},getListUtilityClass,t)},vp=Fl("ul",{name:"MuiList",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,!n.disablePadding&&t.padding,n.dense&&t.dense,n.subheader&&t.subheader]}})({listStyle:"none",margin:0,padding:0,position:"relative",variants:[{props:({ownerState:e})=>!e.disablePadding,style:{paddingTop:8,paddingBottom:8}},{props:({ownerState:e})=>e.subheader,style:{paddingTop:0,isolation:"isolate"}}]}),wp=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiList"}),{children:o,className:a,component:i="ul",dense:s=!1,disablePadding:l=!1,subheader:d,...u}=n,p=c.useMemo(()=>({dense:s}),[s]),m={...n,component:i,dense:s,disablePadding:l},h=useUtilityClasses$29(m);return(0,ps.jsx)(lp.Provider,{value:p,children:(0,ps.jsxs)(vp,{as:i,className:clsx(h.root,a),ref:t,ownerState:m,...u,children:[d,o]})})});function getItemText(e){const t=e?.element??e;if(!t)return"";if(void 0!==e?.textValue)return e.textValue;let n=t.innerText;return void 0===n&&(n=t.textContent),n??""}function textCriteriaMatches(e,t){if(void 0===t)return!0;let n=getItemText(e);return n=n.trim().toLowerCase(),0!==n.length&&(t.repeating?n[0]===t.keys[0]:n.startsWith(t.keys.join("")))}function isItemFocusableWithTextCriteria(e,t){return!!textCriteriaMatches(e,t)&&isItemFocusable(e)}function focusInitialItem(e,t){focusWithVisible(e,t)}var Sp=c.forwardRef(function(e,t){const{actions:n,autoFocus:o=!1,autoFocusItem:a=!1,children:i,className:s,disabledItemsFocusable:l=!1,disableListWrap:d=!1,onKeyDown:u,variant:p="selectedMenu",...m}=e,h=c.useRef(null),g=c.useRef(!1),[y,b]=c.useState(!1),v=useSelectFocusSource(),w=c.useRef({keys:[],repeating:!0,previousKeyMatched:!0,lastTime:null}),S=useRovingTabIndexRoot({activeItemId:void 0,getDefaultActiveItemId:c.useCallback(e=>"selectedMenu"===p?e.find(e=>e.selected&&isItemFocusable(e))?.id??e.find(e=>isItemFocusable(e))?.id??null:e.find(e=>isItemFocusable(e))?.id??null,[p]),orientation:"vertical",wrap:!d}),{activeItemId:x,focusNext:I,getActiveItem:C,getContainerProps:E,getItemMap:R}=S,k=uc((e=!1)=>{if(!h.current||!e&&g.current)return null;if(a){const e=C();if(e?.element){const t=Array.from(R().values()).some(e=>e.selected);return b("menu"===p&&t&&!e.selected&&null==v),focusInitialItem(e.element,v),g.current=!0,e.element}return o?(b(!1),h.current.focus(),h.current):null}return o?(b(!1),h.current.focus(),g.current=!0,h.current):(b(!1),null)});lc(()=>{if(!o&&!a)return g.current=!1,void b(!1);k()},[x,a,o,k]),c.useImperativeHandle(n,()=>({adjustStyleForScrollbar:(e,{direction:t})=>{const n=!h.current.style.width;if(e.clientHeight<h.current.clientHeight&&n){const n=`${bp(sc(e))}px`;h.current.style["rtl"===t?"paddingLeft":"paddingRight"]=n,h.current.style.width=`calc(100% + ${n})`}return h.current},focusInitialTarget:()=>{if(!h.current)return null;const e=ac(ic(h.current));return e&&vd(h.current,e)?e:k(!0)}}),[k]);const T=E(),M=pc(h,T.ref,t),$=c.useMemo(()=>({itemsFocusableWhenDisabled:l,suppressInitialFocusVisible:y,variant:p}),[l,y,p]);return(0,ps.jsx)(wp,{role:"menu",ref:M,className:s,onKeyDown:uc(e=>{if(y&&b(!1),(e.ctrlKey||e.metaKey||e.altKey)&&u)u(e);else{if(T.onKeyDown(e),1===e.key.length){const t=w.current,n=e.key.toLowerCase(),o=performance.now();t.keys.length>0&&(o-t.lastTime>500?(t.keys=[],t.repeating=!0,t.previousKeyMatched=!0):t.repeating&&n!==t.keys[0]&&(t.repeating=!1)),t.lastTime=o,t.keys.push(n);const a=ac(ic(h.current)),i=a&&!t.repeating&&textCriteriaMatches(a,t);t.previousKeyMatched&&(i||null!=I(e=>isItemFocusableWithTextCriteria(e,t)))?e.preventDefault():t.previousKeyMatched=!1}u&&u(e)}}),onFocus:T.onFocus,tabIndex:-1,...m,children:(0,ps.jsx)(pp.Provider,{value:$,children:(0,ps.jsx)(id.Provider,{value:S,children:i})})})});function getPopoverUtilityClass(e){return generateUtilityClass("MuiPopover",e)}function getOffsetTop(e,t){let n=0;return"number"==typeof t?n=t:"center"===t?n=e.height/2:"bottom"===t&&(n=e.height),n}function getOffsetLeft(e,t){let n=0;return"number"==typeof t?n=t:"center"===t?n=e.width/2:"right"===t&&(n=e.width),n}function getTransformOriginValue(e){return[e.horizontal,e.vertical].map(e=>"number"==typeof e?`${e}px`:e).join(" ")}function resolveAnchorEl(e){return"function"==typeof e?e():e}generateUtilityClasses("MuiPopover",["root","paper"]);var useUtilityClasses$28=e=>{const{classes:t}=e;return composeClasses({root:["root"],paper:["paper"]},getPopoverUtilityClass,t)},xp=Fl(Ld,{name:"MuiPopover",slot:"Root"})({}),Ip=Fl(Bd,{name:"MuiPopover",slot:"Paper"})({position:"absolute",overflowY:"auto",overflowX:"hidden",minWidth:16,minHeight:16,maxWidth:"calc(100% - 32px)",maxHeight:"calc(100% - 32px)",outline:0}),Cp=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiPopover"}),{action:o,anchorEl:a,anchorOrigin:i={vertical:"top",horizontal:"left"},anchorPosition:s,anchorReference:l="anchorEl",children:d,className:u,container:p,disableAutoFocus:m=!1,elevation:h=8,marginThreshold:g=16,open:y,slots:b={},slotProps:v={},transformOrigin:w={vertical:"top",horizontal:"left"},transitionDuration:S="auto",disableScrollLock:x=!1,...I}=n,C=c.useRef(),E={...n,anchorOrigin:i,anchorReference:l,elevation:h,marginThreshold:g,transformOrigin:w,transitionDuration:S},R=useUtilityClasses$28(E),k=c.useCallback(()=>{if("anchorPosition"===l)return s;const e=resolveAnchorEl(a),t=(e&&1===e.nodeType?e:ic(C.current).body).getBoundingClientRect();return{top:t.top+getOffsetTop(t,i.vertical),left:t.left+getOffsetLeft(t,i.horizontal)}},[a,i.horizontal,i.vertical,s,l]),T=c.useCallback(e=>({vertical:getOffsetTop(e,w.vertical),horizontal:getOffsetLeft(e,w.horizontal)}),[w.horizontal,w.vertical]),M=c.useCallback(e=>{const t={width:e.offsetWidth,height:e.offsetHeight},n=T(t);if("none"===l)return{top:null,left:null,transformOrigin:getTransformOriginValue(n)};const o=k();let i=o.top-n.vertical,s=o.left-n.horizontal;const c=i+t.height,d=s+t.width,u=sc(resolveAnchorEl(a)),p=u.innerHeight-g,m=u.innerWidth-g;if(null!=g&&i<g){const e=i-g;i-=e,n.vertical+=e}else if(null!=g&&c>p){const e=c-p;i-=e,n.vertical+=e}if(null!=g&&s<g){const e=s-g;s-=e,n.horizontal+=e}else if(d>m){const e=d-m;s-=e,n.horizontal+=e}return{top:`${Math.round(i)}px`,left:`${Math.round(s)}px`,transformOrigin:getTransformOriginValue(n)}},[a,l,k,T,g]),[$,N]=c.useState(y),P=c.useCallback(()=>{const e=C.current;if(!e)return;const t=M(e);null!=t.top&&e.style.setProperty("top",t.top),null!=t.left&&(e.style.left=t.left),e.style.transformOrigin=t.transformOrigin,N(!0)},[M]);c.useEffect(()=>(x&&window.addEventListener("scroll",P),()=>window.removeEventListener("scroll",P)),[a,x,P]);const handleEntering=()=>{P()},handleExited=()=>{N(!1)};c.useEffect(()=>{y&&P()}),c.useImperativeHandle(o,()=>y?{updatePosition:()=>{P()}}:null,[y,P]),c.useEffect(()=>{if(!y)return;const e=nc(()=>{P()}),t=sc(resolveAnchorEl(a));return t.addEventListener("resize",e),()=>{e.clear(),t.removeEventListener("resize",e)}},[a,y,P]);let O=S;const j={slots:b,slotProps:v},[F,L]=useSlot("transition",{elementType:ru,externalForwardedProps:j,ownerState:E,getSlotProps:e=>({...e,onEntering:(t,n)=>{e.onEntering?.(t,n),handleEntering()},onExited:t=>{e.onExited?.(t),handleExited()}}),additionalProps:{appear:!0,in:y}});"auto"!==S||F.muiSupportAuto||(O=void 0);const D=p||(a?ic(resolveAnchorEl(a)).body:void 0),[B,{slots:G,slotProps:W,...V}]=useSlot("root",{ref:t,elementType:xp,externalForwardedProps:{...j,...I},shouldForwardComponentProp:!0,additionalProps:{slots:{backdrop:b.backdrop},slotProps:{backdrop:mergeSlotProps$1("function"==typeof v.backdrop?v.backdrop(E):v.backdrop,{invisible:!0})},container:D,open:y},ownerState:E,className:clsx(R.root,u)}),[H,U]=useSlot("paper",{ref:C,className:R.paper,elementType:Ip,externalForwardedProps:j,shouldForwardComponentProp:!0,additionalProps:{elevation:h,style:$?void 0:{opacity:0}},ownerState:E});return(0,ps.jsx)(B,{...V,...!isHostComponent(B)&&{slots:G,slotProps:W,disableAutoFocus:m,disableScrollLock:x},children:(0,ps.jsx)(F,{...L,timeout:O,children:(0,ps.jsx)(H,{...U,children:d})})})});function getMenuUtilityClass(e){return generateUtilityClass("MuiMenu",e)}generateUtilityClasses("MuiMenu",["root","paper","list"]);var Ep={vertical:"top",horizontal:"right"},Rp={vertical:"top",horizontal:"left"},useUtilityClasses$27=e=>{const{classes:t}=e;return composeClasses({root:["root"],paper:["paper"],list:["list"]},getMenuUtilityClass,t)},kp=Fl(Cp,{shouldForwardProp:e=>rootShouldForwardProp(e)||"classes"===e,name:"MuiMenu",slot:"Root"})({}),Ap=Fl(Ip,{name:"MuiMenu",slot:"Paper"})({maxHeight:"calc(100% - 96px)",WebkitOverflowScrolling:"touch"}),Tp=Fl(Sp,{name:"MuiMenu",slot:"List"})({outline:0}),Mp=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiMenu"}),{autoFocus:o=!0,children:a,className:i,disableAutoFocusItem:s=!1,onClose:l,open:d,PopoverClasses:u,transitionDuration:p="auto",variant:m="selectedMenu",slots:h={},slotProps:g={},...y}=n,b=useRtl(),v={...n,autoFocus:o,disableAutoFocusItem:s,transitionDuration:p,variant:m},w=useUtilityClasses$27(v),S=o&&d,x=S&&!s,I=c.useRef(null),handleEntering=(e,t)=>{I.current&&(I.current.adjustStyleForScrollbar(e,{direction:b?"rtl":"ltr"}),S&&I.current.focusInitialTarget?.())},handleListKeyDown=e=>{"Tab"===e.key&&(e.preventDefault(),l&&l(e,"tabKeyDown"))},C={slots:h,slotProps:g},E=useSlotProps({elementType:h.root,externalSlotProps:g.root,ownerState:v,className:[w.root,i]}),[R,k]=useSlot("paper",{className:w.paper,elementType:Ap,externalForwardedProps:C,shouldForwardComponentProp:!0,ownerState:v}),[T,M]=useSlot("list",{className:w.list,elementType:Tp,shouldForwardComponentProp:!0,externalForwardedProps:C,getSlotProps:e=>({...e,onKeyDown:t=>{handleListKeyDown(t),e.onKeyDown?.(t)}}),ownerState:v}),$="function"==typeof g.transition?g.transition(v):g.transition;return(0,ps.jsx)(kp,{disableAutoFocus:o,onClose:l,anchorOrigin:{vertical:"bottom",horizontal:b?"right":"left"},transformOrigin:b?Ep:Rp,slots:{root:h.root,paper:R,backdrop:h.backdrop,transition:h.transition},slotProps:{root:E,paper:k,backdrop:"function"==typeof g.backdrop?g.backdrop(v):g.backdrop,transition:{...$,onEntering:(...e)=>{handleEntering(...e),$?.onEntering?.(...e)}}},open:d,ref:t,transitionDuration:p,ownerState:v,...y,classes:u,children:(0,ps.jsx)(T,{actions:I,autoFocus:S,autoFocusItem:x,variant:m,...M,children:a})})});function getNativeSelectUtilityClasses(e){return generateUtilityClass("MuiNativeSelect",e)}var zp=generateUtilityClasses("MuiNativeSelect",["root","select","multiple","filled","outlined","standard","disabled","icon","iconOpen","iconFilled","iconOutlined","iconStandard","nativeInput","error"]),useUtilityClasses$26=e=>{const{classes:t,variant:n,disabled:o,multiple:a,open:i,error:s}=e;return composeClasses({select:["select",n,o&&"disabled",a&&"multiple",s&&"error"],icon:["icon",`icon${Zl(n)}`,i&&"iconOpen",o&&"disabled"]},getNativeSelectUtilityClasses,t)},$p=Fl("select",{name:"MuiNativeSelect"})(({theme:e})=>({MozAppearance:"none",WebkitAppearance:"none",userSelect:"none",borderRadius:0,cursor:"pointer","&:focus":{borderRadius:0},[`&.${zp.disabled}`]:{cursor:"default"},"&[multiple]":{height:"auto"},"&:not([multiple]) option, &:not([multiple]) optgroup":{backgroundColor:(e.vars||e).palette.background.paper},variants:[{props:({ownerState:e})=>"filled"!==e.variant&&"outlined"!==e.variant,style:{"&&&":{paddingRight:24,minWidth:16}}},{props:{variant:"filled"},style:{"&&&":{paddingRight:32}}},{props:{variant:"outlined"},style:{borderRadius:(e.vars||e).shape.borderRadius,"&:focus":{borderRadius:(e.vars||e).shape.borderRadius},"&&&":{paddingRight:32}}}]})),Np=Fl($p,{name:"MuiNativeSelect",slot:"Select",shouldForwardProp:rootShouldForwardProp,overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.select,t[n.variant],n.error&&t.error,{[`&.${zp.multiple}`]:t.multiple}]}})({}),Pp=Fl("svg",{name:"MuiNativeSelect"})(({theme:e})=>({position:"absolute",right:0,top:"calc(50% - .5em)",pointerEvents:"none",color:(e.vars||e).palette.action.active,[`&.${zp.disabled}`]:{color:(e.vars||e).palette.action.disabled},variants:[{props:({ownerState:e})=>e.open,style:{transform:"rotate(180deg)"}},{props:{variant:"filled"},style:{right:7}},{props:{variant:"outlined"},style:{right:7}}]})),Op=Fl(Pp,{name:"MuiNativeSelect",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.icon,n.variant&&t[`icon${Zl(n.variant)}`],n.open&&t.iconOpen]}})({}),_p=c.forwardRef(function(e,t){const{className:n,disabled:o,error:a,IconComponent:i,inputRef:s,variant:l="standard",...d}=e,u={...e,disabled:o,variant:l,error:a},p=useUtilityClasses$26(u);return(0,ps.jsxs)(c.Fragment,{children:[(0,ps.jsx)(Np,{ownerState:u,className:clsx(p.select,n),disabled:o,ref:s||t,...d}),e.multiple?null:(0,ps.jsx)(Op,{as:i,ownerState:u,className:p.icon})]})});function getSelectUtilityClasses(e){return generateUtilityClass("MuiSelect",e)}var jp,Fp=generateUtilityClasses("MuiSelect",["root","select","multiple","filled","outlined","standard","disabled","focused","icon","iconOpen","nativeInput","error"]),Lp=2,Dp=400,Bp=200;function isMouseEventInsideElement(e,t){if(!t)return!1;if(e.composedPath().includes(t))return!0;if(e.target?.nodeType&&t.contains(e.target))return!0;const n=t.getBoundingClientRect();return(0!==n.width||0!==n.height)&&e.clientX>=n.left-Lp&&e.clientX<=n.right+Lp&&e.clientY>=n.top-Lp&&e.clientY<=n.bottom+Lp}var Gp=Fl($p,{name:"MuiSelect",slot:"Select",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`&.${Fp.select}`]:t.select},{[`&.${Fp.select}`]:t[n.variant]},{[`&.${Fp.error}`]:t.error},{[`&.${Fp.multiple}`]:t.multiple}]}})({[`&.${Fp.select}`]:{height:"auto",minHeight:"1.4375em",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}}),Wp=Fl(Pp,{name:"MuiSelect",slot:"Icon",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.icon,n.open&&t.iconOpen]}})({}),Vp=Fl("input",{shouldForwardProp:e=>slotShouldForwardProp(e)&&"classes"!==e,name:"MuiSelect",slot:"NativeInput"})({bottom:0,left:0,position:"absolute",opacity:0,pointerEvents:"none",width:"100%",boxSizing:"border-box"}),useUtilityClasses$25=e=>{const{classes:t,variant:n,disabled:o,multiple:a,open:i,error:s}=e;return composeClasses({select:["select",n,o&&"disabled",a&&"multiple",s&&"error"],icon:["icon",i&&"iconOpen",o&&"disabled"],nativeInput:["nativeInput"]},getSelectUtilityClasses,t)},Hp=c.forwardRef(function(e,t){const{"aria-describedby":n,"aria-label":o,autoFocus:a,autoWidth:i,children:s,className:l,defaultOpen:d,defaultValue:u,disabled:p,displayEmpty:m,error:h=!1,IconComponent:g,inputRef:y,labelId:b,MenuProps:v={},multiple:w,name:S,onBlur:x,onChange:I,onClose:C,onFocus:E,onKeyDown:R,onMouseDown:k,onOpen:T,open:M,readOnly:$,renderValue:N,required:P,SelectDisplayProps:O={},tabIndex:j,type:F,value:L,variant:D="standard",...B}=e,[G,W]=dc({controlled:L,default:u,name:"Select"}),[V,H]=dc({controlled:M,default:d,name:"Select"}),U=c.useRef(null),q=c.useRef(null),K=c.useRef(null),Z=c.useRef(!1),Y=c.useRef(!1),X=c.useRef(null),J=c.useRef(!1),Q=c.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ee=useTimeout(),te=useTimeout(),[re,ne]=c.useState(null),{current:oe}=c.useRef(null!=M),[ae,ie]=c.useState(),[se,le]=c.useState(null),ce=pc(t,y),de=c.useCallback(e=>{q.current=e,e&&ne(e)},[]),ue=re?.parentNode;c.useImperativeHandle(ce,()=>({focus:()=>{q.current.focus()},node:U.current,value:G}),[G]);const pe=null!==re&&V;lc(()=>{Z.current=pe},[pe]);const me=c.useCallback(()=>{ee.clear(),te.clear()},[ee,te]),he=c.useCallback(()=>{me(),J.current=!1,Q.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},[me]),ge=c.useCallback(()=>{X.current&&(X.current(),X.current=null)},[]);c.useEffect(()=>{pe||(he(),ge())},[pe,he,ge]),c.useEffect(()=>()=>{he(),ge()},[he,ge]),c.useEffect(()=>{if(!pe||!ue||i)return;if("undefined"==typeof ResizeObserver)return;const e=new ResizeObserver(()=>{ie(ue.clientWidth)});return e.observe(ue),()=>{e.disconnect()}},[pe,ue,i]),c.useEffect(()=>{d&&V&&re&&!oe&&(ie(i?null:ue.clientWidth),q.current.focus())},[re,i]),c.useEffect(()=>{a&&q.current.focus()},[a]),c.useEffect(()=>{if(!b)return;const e=ic(q.current).getElementById(b);if(e){const handler=()=>{getSelection().isCollapsed&&q.current.focus()};return e.addEventListener("click",handler),()=>{e.removeEventListener("click",handler)}}},[b]);const fe=uc((e,t)=>{e||(he(),ge()),e?(le(getOpenInteractionType(t)),T&&T(t)):(le(null),C&&C(t)),oe||(Z.current=e,ie(i?null:ue.clientWidth),H(e))}),scheduleMouseUpSelection=()=>{he(),Y.current?te.start(Bp,()=>{Q.current.allowUnselectedMouseUp=!0,ee.start(Bp,()=>{Q.current.allowSelectedMouseUp=!0})}):ee.start(Dp,()=>{Q.current.allowSelectedMouseUp=!0,Q.current.allowUnselectedMouseUp=!0})},handleMouseDown=e=>{if(k?.(e),0!==e.button)return;e.preventDefault(),q.current.focus();const t=ic(e.currentTarget);scheduleMouseUpSelection(),ge();const handleMouseUp=e=>{X.current=null,q.current&&(isMouseEventInsideElement(e,q.current)||isMouseEventInsideElement(e,K.current)||!Z.current&&oe||fe(!1,e))};t.addEventListener("mouseup",handleMouseUp,{capture:!0,once:!0}),X.current=()=>{t.removeEventListener("mouseup",handleMouseUp,!0)},fe(!0,e)},handleClose=e=>{fe(!1,e)},ye=c.Children.toArray(s),handleChange=e=>{const t=ye.find(t=>t.props.value===e.target.value);void 0!==t&&(W(t.props.value),I&&I(e,t))},handleItemClick=e=>t=>{let n;if(J.current=!1,t.currentTarget.hasAttribute("tabindex")){if(w){n=Array.isArray(G)?G.slice():[];const t=G.indexOf(e.props.value);-1===t?n.push(e.props.value):n.splice(t,1)}else n=e.props.value;if(e.props.onClick&&e.props.onClick(t),G!==n&&(W(n),I)){const o=t.nativeEvent||t,a=new o.constructor(o.type,o);Object.defineProperty(a,"target",{writable:!0,value:{value:n,name:S}}),I(a,e)}w||fe(!1,t)}},handleItemMouseUp=(e,t)=>n=>{if(e.props.onMouseUp?.(n),J.current)return void(J.current=!1);const o=!Q.current.allowSelectedMouseUp&&t,a=!Q.current.allowUnselectedMouseUp&&!t;o||a||n.currentTarget.click()},handleKeyDown=e=>{$||([" ","ArrowUp","ArrowDown","Enter"].includes(e.key)&&(e.preventDefault(),fe(!0,e)),R?.(e))},handleBlur=e=>{!pe&&x&&(Object.defineProperty(e,"target",{writable:!0,value:{value:G,name:S}}),x(e))};let be,ve;delete B["aria-invalid"];const we=[];let Se=!1,xe=!1;(isFilled({value:G})||m)&&(N?be=N(G):Se=!0);const Ie=ye.map(e=>{if(!c.isValidElement(e))return null;let t;if(w){if(!Array.isArray(G))throw new Error(formatMuiErrorMessage(2));t=G.some(t=>areEqualValues(t,e.props.value)),t&&Se&&we.push(e.props.children)}else t=areEqualValues(G,e.props.value),t&&Se&&(ve=e.props.children);return t&&(xe=!0),c.cloneElement(e,{"aria-selected":t?"true":"false",onMouseDown:t=>{J.current=!0,e.props.onMouseDown?.(t)},onPointerDown:t=>{J.current=!0,e.props.onPointerDown?.(t)},onClick:handleItemClick(e),onMouseUp:handleItemMouseUp(e,t),onKeyUp:t=>{" "===t.key&&t.preventDefault(),e.props.onKeyUp&&e.props.onKeyUp(t)},role:"option",selected:t,value:void 0,"data-value":e.props.value})});lc(()=>{Y.current=xe},[xe]),Se&&(be=w?0===we.length?null:we.reduce((e,t,n)=>(e.push(t),n<we.length-1&&e.push(", "),e),[]):ve);let Ce,Ee=ae;!i&&oe&&re&&(Ee=ue.clientWidth),Ce=void 0!==j?j:p?null:0;const Re=O.id||(S?`mui-component-select-${S}`:void 0),ke={...e,variant:D,value:G,open:pe,error:h},Ae=useUtilityClasses$25(ke),Te="function"==typeof v.slotProps?.paper?v.slotProps.paper(ke):v.slotProps?.paper,Me=pc(Te?.ref,K),ze="function"==typeof v.slotProps?.list?v.slotProps.list(ke):v.slotProps?.list,$e=useId(),Ne=useId();return(0,ps.jsxs)(c.Fragment,{children:[(0,ps.jsx)(Gp,{as:"div",ref:de,tabIndex:Ce,role:"combobox","aria-controls":pe?$e:void 0,"aria-disabled":p?"true":void 0,"aria-expanded":pe?"true":"false","aria-haspopup":"listbox","aria-label":o,"aria-labelledby":b,"aria-describedby":n,"aria-required":P?"true":void 0,"aria-invalid":h?"true":void 0,onKeyDown:handleKeyDown,onMouseDown:p||$?null:handleMouseDown,onBlur:handleBlur,onFocus:E,...O,ownerState:ke,className:clsx(O.className,Ae.select,l),id:Re,children:isEmpty$2(be)?jp||(jp=(0,ps.jsx)("span",{className:"notranslate","aria-hidden":!0,children:"​"})):be}),(0,ps.jsx)(Vp,{"aria-invalid":h,value:Array.isArray(G)?G.join(","):G,name:S,ref:U,"aria-hidden":!0,onChange:handleChange,tabIndex:-1,disabled:p,className:Ae.nativeInput,autoFocus:a,required:P,...B,id:B.id??Ne,ownerState:ke}),(0,ps.jsx)(Wp,{as:g,className:Ae.icon,ownerState:ke}),(0,ps.jsx)(hp,{value:se,children:(0,ps.jsx)(Mp,{id:`menu-${S||""}`,anchorEl:ue,open:pe,onClose:handleClose,anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},...v,slotProps:{...v.slotProps,list:{"aria-labelledby":b,role:"listbox","aria-multiselectable":w?"true":void 0,disableListWrap:!0,id:$e,...ze},paper:{...Te,ref:Me,style:{minWidth:Ee,...Te?.style}}},children:Ie})})]})}),Up=createSvgIcon((0,ps.jsx)("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown");function getStyleValue(e){return parseInt(e,10)||0}var qp={shadow:{visibility:"hidden",position:"absolute",overflow:"hidden",height:0,top:0,left:0,transform:"translateZ(0)"}};function isObjectEmpty(e){for(const t in e)return!1;return!0}function isEmpty$1(e){return isObjectEmpty(e)||0===e.outerHeightStyle&&!e.overflowing}var Kp=c.forwardRef(function(e,t){const{onChange:n,maxRows:o,minRows:a=1,style:i,value:s,...l}=e,{current:d}=c.useRef(null!=s),u=c.useRef(null),p=useForkRef(t,u),m=c.useRef(null),h=c.useRef(null),g=c.useCallback(()=>{const t=u.current,n=h.current;if(!t||!n)return;const i=ownerWindow(t).getComputedStyle(t);if("0px"===i.width)return{outerHeightStyle:0,overflowing:!1};n.style.width=i.width,n.value=t.value||e.placeholder||"x","\n"===n.value.slice(-1)&&(n.value+=" ");const s=i.boxSizing,l=getStyleValue(i.paddingBottom)+getStyleValue(i.paddingTop),c=getStyleValue(i.borderBottomWidth)+getStyleValue(i.borderTopWidth),d=n.scrollHeight;n.value="x";const p=n.scrollHeight;let m=d;return a&&(m=Math.max(Number(a)*p,m)),o&&(m=Math.min(Number(o)*p,m)),m=Math.max(m,p),{outerHeightStyle:m+("border-box"===s?l+c:0),overflowing:Math.abs(m-d)<=1}},[o,a,e.placeholder]),y=useEventCallback(()=>{const e=u.current,t=g();if(!e||!t||isEmpty$1(t))return!1;const n=t.outerHeightStyle;return null!=m.current&&m.current!==n}),b=c.useCallback(()=>{const e=u.current,t=g();if(!e||!t||isEmpty$1(t))return;const n=t.outerHeightStyle;m.current!==n&&(m.current=n,e.style.height=`${n}px`),e.style.overflow=t.overflowing?"hidden":""},[g]),v=c.useRef(-1);nl(()=>{const e=debounce$2(b),t=u?.current;if(!t)return;const n=ownerWindow(t);let o;return n.addEventListener("resize",e),"undefined"!=typeof ResizeObserver&&(o=new ResizeObserver(()=>{y()&&(o.unobserve(t),cancelAnimationFrame(v.current),b(),v.current=requestAnimationFrame(()=>{o.observe(t)}))}),o.observe(t)),()=>{e.clear(),cancelAnimationFrame(v.current),n.removeEventListener("resize",e),o&&o.disconnect()}},[g,b,y]),nl(()=>{b()});const handleChange=e=>{d||b();const t=e.target,o=t.value.length,a=t.value.endsWith("\n"),i=t.selectionStart===o;a&&i&&t.setSelectionRange(o,o),n&&n(e)};return(0,ps.jsxs)(c.Fragment,{children:[(0,ps.jsx)("textarea",{value:s,onChange:handleChange,ref:p,rows:a,style:i,...l}),(0,ps.jsx)("textarea",{"aria-hidden":!0,className:e.className,readOnly:!0,ref:h,tabIndex:-1,style:{...qp.shadow,...i,paddingTop:0,paddingBottom:0}})]})});function getInputBaseUtilityClass(e){return generateUtilityClass("MuiInputBase",e)}var Zp,Yp=generateUtilityClasses("MuiInputBase",["root","formControl","focused","disabled","adornedStart","adornedEnd","error","sizeSmall","multiline","colorSecondary","fullWidth","hiddenLabel","readOnly","input","inputTypeSearch"]),Xp="mui-auto-fill",Jp="mui-auto-fill-cancel",rootOverridesResolver=(e,t)=>{const{ownerState:n}=e;return[t.root,n.formControl&&t.formControl,n.startAdornment&&t.adornedStart,n.endAdornment&&t.adornedEnd,n.error&&t.error,"small"===n.size&&t.sizeSmall,n.multiline&&t.multiline,n.color&&t[`color${Zl(n.color)}`],n.fullWidth&&t.fullWidth,n.hiddenLabel&&t.hiddenLabel]},inputOverridesResolver=(e,t)=>{const{ownerState:n}=e;return[t.input,"search"===n.type&&t.inputTypeSearch]},useUtilityClasses$24=e=>{const{classes:t,color:n,disabled:o,error:a,endAdornment:i,focused:s,formControl:l,fullWidth:c,hiddenLabel:d,multiline:u,readOnly:p,size:m,startAdornment:h,type:g}=e;return composeClasses({root:["root",`color${Zl(n)}`,o&&"disabled",a&&"error",c&&"fullWidth",s&&"focused",l&&"formControl",m&&"medium"!==m&&`size${Zl(m)}`,u&&"multiline",h&&"adornedStart",i&&"adornedEnd",d&&"hiddenLabel",p&&"readOnly"],input:["input",o&&"disabled","search"===g&&"inputTypeSearch",p&&"readOnly"]},getInputBaseUtilityClass,t)},Qp=Fl("div",{name:"MuiInputBase",slot:"Root",overridesResolver:rootOverridesResolver})(Kl(({theme:e})=>({...e.typography.body1,color:(e.vars||e).palette.text.primary,lineHeight:"1.4375em",boxSizing:"border-box",position:"relative",cursor:"text",display:"inline-flex",alignItems:"center",[`&.${Yp.disabled}`]:{color:(e.vars||e).palette.text.disabled,cursor:"default"},variants:[{props:({ownerState:e})=>e.multiline,style:{padding:"4px 0 5px"}},{props:({ownerState:e,size:t})=>e.multiline&&"small"===t,style:{paddingTop:1}},{props:({ownerState:e})=>e.fullWidth,style:{width:"100%"}}]}))),em=Fl("input",{name:"MuiInputBase",slot:"Input",overridesResolver:inputOverridesResolver})(Kl(({theme:e})=>{const t="light"===e.palette.mode,n={color:"currentColor",...e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5},transition:e.transitions.create("opacity",{duration:e.transitions.duration.shorter})},o={opacity:"0 !important"},a=e.vars?{opacity:e.vars.opacity.inputPlaceholder}:{opacity:t?.42:.5};return{font:"inherit",letterSpacing:"inherit",color:"currentColor",padding:"4px 0 5px",border:0,boxSizing:"content-box",background:"none",height:"1.4375em",margin:0,WebkitTapHighlightColor:"transparent",display:"block",minWidth:0,width:"100%","&::-webkit-input-placeholder":n,"&::-moz-placeholder":n,"&::-ms-input-placeholder":n,"&:focus":{outline:0},"&:invalid":{boxShadow:"none"},"&::-webkit-search-decoration":{WebkitAppearance:"none"},[`label[data-shrink=false] + .${Yp.formControl} &`]:{"&::-webkit-input-placeholder":o,"&::-moz-placeholder":o,"&::-ms-input-placeholder":o,"&:focus::-webkit-input-placeholder":a,"&:focus::-moz-placeholder":a,"&:focus::-ms-input-placeholder":a},[`&.${Yp.disabled}`]:{opacity:1,WebkitTextFillColor:(e.vars||e).palette.text.disabled},variants:[{props:({ownerState:e})=>!e.disableInjectingGlobalStyles,style:{animationName:Jp,animationDuration:"10ms","&:-webkit-autofill":{animationDuration:"5000s",animationName:Xp}}},{props:{size:"small"},style:{paddingTop:1}},{props:({ownerState:e})=>e.multiline,style:{height:"auto",resize:"none",padding:0,paddingTop:0}},{props:{type:"search"},style:{MozAppearance:"textfield"}}]}})),tm=globalCss({[`@keyframes ${Xp}`]:{from:{animationName:Xp}},[`@keyframes ${Jp}`]:{from:{animationName:Jp}}}),rm=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiInputBase"}),{"aria-describedby":o,"aria-label":a,autoComplete:i,autoFocus:s,className:l,color:d,defaultValue:u,disabled:p,disableInjectingGlobalStyles:m,endAdornment:h,error:g,fullWidth:y=!1,id:b,inputComponent:v="input",inputProps:w={},inputRef:S,margin:x,maxRows:I,minRows:C,multiline:E=!1,name:R,onBlur:k,onChange:T,onClick:M,onFocus:$,onKeyDown:N,onKeyUp:P,placeholder:O,readOnly:j,renderSuffix:F,rows:L,size:D,slotProps:B={},slots:G={},startAdornment:W,type:V="text",value:H,...U}=n,q=null!=w.value?w.value:H,{current:K}=c.useRef(null!=q),Z=c.useRef(),Y=c.useCallback(e=>{},[]),X=pc(Z,S,w.ref,Y),[J,Q]=c.useState(!1),[ee,te]=useFormControlState({props:n,states:["color","disabled","error","hiddenLabel","size","required","filled"]});ee.focused=te?te.focused:J,c.useEffect(()=>{!te&&p&&J&&(Q(!1),k&&k())},[te,p,J,k]);const re=te&&te.onFilled,ne=te&&te.onEmpty,oe=c.useCallback(e=>{isFilled(e)?re&&re():ne&&ne()},[re,ne]);lc(()=>{K&&oe({value:q})},[q,oe,K]),lc(()=>{if(!s)return;const e=Z.current;if(!e)return;const t=ic(e),n=ac(t),o=null==n||n===t.body||n===t.documentElement;e===n?te&&te.onFocus?te.onFocus():Q(!0):o&&e.focus()},[s]);const handleFocus=e=>{$&&$(e),w.onFocus&&w.onFocus(e),te&&te.onFocus?te.onFocus(e):Q(!0)},handleBlur=e=>{k&&k(e),w.onBlur&&w.onBlur(e),te&&te.onBlur?te.onBlur(e):Q(!1)},handleChange=(e,...t)=>{if(!K){const t=e.target||Z.current;if(null==t)throw new Error(formatMuiErrorMessage(1));oe({value:t.value})}w.onChange&&w.onChange(e,...t),T&&T(e,...t)};c.useEffect(()=>{oe(Z.current)},[]);const handleClick=e=>{Z.current&&e.currentTarget===e.target&&Z.current.focus(),M&&M(e)};let ae=v,ie=w;E&&"input"===ae&&(ie=L?{type:void 0,minRows:L,maxRows:L,...ie}:{type:void 0,maxRows:I,minRows:C,...ie},ae=Kp);const handleAutoFill=e=>{oe(e.animationName===Jp?Z.current:{value:"x"})};c.useEffect(()=>{te&&te.setAdornedStart(Boolean(W))},[te,W]);const se={...n,color:ee.color||"primary",disabled:ee.disabled,endAdornment:h,error:ee.error,focused:ee.focused,formControl:te,fullWidth:y,hiddenLabel:ee.hiddenLabel,multiline:E,size:ee.size,startAdornment:W,type:V},le=useUtilityClasses$24(se),ce=G.root||Qp,de=B.root||{},ue=G.input||em;return ie={...ie,...B.input},(0,ps.jsxs)(c.Fragment,{children:[!m&&"function"==typeof tm&&(Zp||(Zp=(0,ps.jsx)(tm,{}))),(0,ps.jsxs)(ce,{...de,ref:t,onClick:handleClick,...U,...!isHostComponent(ce)&&{ownerState:{...se,...de.ownerState}},className:clsx(le.root,de.className,l,j&&"MuiInputBase-readOnly"),children:[W,(0,ps.jsx)(Vu.Provider,{value:null,children:(0,ps.jsx)(ue,{"aria-invalid":ee.error,"aria-describedby":o,"aria-label":a,autoComplete:i,autoFocus:s,defaultValue:u,disabled:ee.disabled,id:b,onAnimationStart:handleAutoFill,name:R,placeholder:O,readOnly:j,required:ee.required,rows:L,value:q,onKeyDown:N,onKeyUp:P,type:V,...ie,...!isHostComponent(ue)&&{as:ae,ownerState:{...se,...ie.ownerState}},ref:X,className:clsx(le.input,ie.className,j&&"MuiInputBase-readOnly"),onBlur:handleBlur,onChange:handleChange,onFocus:handleFocus})}),h,F?F({...ee,startAdornment:W}):null]})]})});function getInputUtilityClass(e){return generateUtilityClass("MuiInput",e)}var nm={...Yp,...generateUtilityClasses("MuiInput",["root","underline","input"])},useUtilityClasses$23=e=>{const{classes:t,disableUnderline:n}=e,o=composeClasses({root:["root",!n&&"underline"],input:["input"]},getInputUtilityClass,t);return{...t,...o}},om=Fl(Qp,{shouldForwardProp:e=>rootShouldForwardProp(e)||"classes"===e,name:"MuiInput",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[...rootOverridesResolver(e,t),!n.disableUnderline&&t.underline]}})(Kl(({theme:e})=>{let t="light"===e.palette.mode?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return e.vars&&(t=e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline)),{position:"relative",variants:[{props:({ownerState:e})=>e.formControl,style:{[`label + &, .${tp.root} + &`]:{marginTop:16}}},{props:({ownerState:e})=>!e.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${nm.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${nm.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'""',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${nm.disabled}, .${nm.error}):before`]:{borderBottom:`2px solid ${(e.vars||e).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${nm.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t].main}`}}}))]}})),am=Fl(em,{name:"MuiInput",slot:"Input",overridesResolver:inputOverridesResolver})({}),im=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiInput"}),{disableUnderline:o=!1,fullWidth:a=!1,inputComponent:i="input",multiline:s=!1,notched:l,slotProps:c,slots:d={},type:u="text",...p}=n,m=useUtilityClasses$23(n),h={root:{ownerState:{disableUnderline:o}}},g=c?deepmerge(c,h):h;return(0,ps.jsx)(rm,{slots:{root:d.root??om,input:d.input??am},slotProps:g,fullWidth:a,inputComponent:i,multiline:s,ref:t,type:u,...p,classes:m})});function getFilledInputUtilityClass(e){return generateUtilityClass("MuiFilledInput",e)}im.muiName="Input";var sm,lm={...Yp,...generateUtilityClasses("MuiFilledInput",["root","underline","input","adornedStart","adornedEnd","sizeSmall","multiline","hiddenLabel"])},useUtilityClasses$22=e=>{const{classes:t,disableUnderline:n,startAdornment:o,endAdornment:a,size:i,hiddenLabel:s,multiline:l}=e,c=composeClasses({root:["root",!n&&"underline",o&&"adornedStart",a&&"adornedEnd","small"===i&&`size${Zl(i)}`,s&&"hiddenLabel",l&&"multiline"],input:["input"]},getFilledInputUtilityClass,t);return{...t,...c}},cm=Fl(Qp,{shouldForwardProp:e=>rootShouldForwardProp(e)||"classes"===e,name:"MuiFilledInput",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[...rootOverridesResolver(e,t),!n.disableUnderline&&t.underline]}})(Kl(({theme:e})=>{const t="light"===e.palette.mode,n=t?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",o=t?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",a=t?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",i=t?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return{position:"relative",backgroundColor:e.vars?e.vars.palette.FilledInput.bg:o,borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius,transition:e.transitions.create("background-color",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),"&:hover":{backgroundColor:e.vars?e.vars.palette.FilledInput.hoverBg:a,"@media (hover: none)":{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:o}},[`&.${lm.focused}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.bg:o},[`&.${lm.disabled}`]:{backgroundColor:e.vars?e.vars.palette.FilledInput.disabledBg:i},variants:[{props:({ownerState:e})=>!e.disableUnderline,style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shorter,easing:e.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${lm.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${lm.error}`]:{"&::before, &::after":{borderBottomColor:(e.vars||e).palette.error.main}},"&::before":{borderBottom:`1px solid ${e.vars?e.alpha(e.vars.palette.common.onBackground,e.vars.opacity.inputUnderline):n}`,left:0,bottom:0,content:'""',position:"absolute",right:0,transition:e.transitions.create("border-bottom-color",{duration:e.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${lm.disabled}, .${lm.error}):before`]:{borderBottom:`1px solid ${(e.vars||e).palette.text.primary}`},[`&.${lm.disabled}:before`]:{borderBottomStyle:"dotted"}}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{disableUnderline:!1,color:t},style:{"&::after":{borderBottom:`2px solid ${(e.vars||e).palette[t]?.main}`}}})),{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:12}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:12}},{props:({ownerState:e})=>e.multiline,style:{padding:"25px 12px 8px"}},{props:({ownerState:e,size:t})=>e.multiline&&"small"===t,style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.multiline&&e.hiddenLabel&&"small"===e.size,style:{paddingTop:8,paddingBottom:9}}]}})),dm=Fl(em,{name:"MuiFilledInput",slot:"Input",overridesResolver:inputOverridesResolver})(Kl(({theme:e})=>({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,"&:-webkit-autofill":{...!e.vars&&{WebkitBoxShadow:"light"===e.palette.mode?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:"light"===e.palette.mode?null:"#fff",caretColor:"light"===e.palette.mode?null:"#fff"},borderTopLeftRadius:"inherit",borderTopRightRadius:"inherit",...e.vars&&e.applyStyles("dark",{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"})},variants:[{props:{size:"small"},style:{paddingTop:21,paddingBottom:4}},{props:({ownerState:e})=>e.hiddenLabel,style:{paddingTop:16,paddingBottom:17}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}},{props:({ownerState:e})=>e.hiddenLabel&&"small"===e.size,style:{paddingTop:8,paddingBottom:9}},{props:({ownerState:e})=>e.multiline,style:{paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}}]}))),um=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiFilledInput"}),{disableUnderline:o=!1,fullWidth:a=!1,hiddenLabel:i,inputComponent:s="input",multiline:l=!1,notched:c,slotProps:d,slots:u={},type:p="text",...m}=n,h={...n,disableUnderline:o,fullWidth:a,inputComponent:s,multiline:l,type:p},g=useUtilityClasses$22(n),y={root:{ownerState:h},input:{ownerState:h}},b=d?deepmerge(y,d):y;return(0,ps.jsx)(rm,{slots:{root:u.root??cm,input:u.input??dm},slotProps:b,fullWidth:a,inputComponent:s,multiline:l,ref:t,type:p,...m,classes:g})});um.muiName="Input";var pm=Fl("fieldset",{name:"MuiNotchedOutlined",shouldForwardProp:rootShouldForwardProp})({textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%"}),mm=Fl("legend",{name:"MuiNotchedOutlined",shouldForwardProp:rootShouldForwardProp})(Kl(({theme:e})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:({ownerState:e})=>!e.withLabel,style:{padding:0,lineHeight:"11px",transition:e.transitions.create("width",{duration:150,easing:e.transitions.easing.easeOut})}},{props:({ownerState:e})=>e.withLabel,style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:e.transitions.create("max-width",{duration:50,easing:e.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:({ownerState:e})=>e.withLabel&&e.notched,style:{maxWidth:"100%",transition:e.transitions.create("max-width",{duration:100,easing:e.transitions.easing.easeOut,delay:50})}}]})));function NotchedOutline(e){const{children:t,classes:n,className:o,label:a,notched:i,...s}=e,l=null!=a&&""!==a,c={...e,notched:i,withLabel:l};return(0,ps.jsx)(pm,{"aria-hidden":!0,className:o,ownerState:c,...s,children:(0,ps.jsx)(mm,{ownerState:c,children:l?(0,ps.jsx)("span",{children:a}):sm||(sm=(0,ps.jsx)("span",{className:"notranslate","aria-hidden":!0,children:"​"}))})})}function getOutlinedInputUtilityClass(e){return generateUtilityClass("MuiOutlinedInput",e)}var hm={...Yp,...generateUtilityClasses("MuiOutlinedInput",["root","notchedOutline","input"])},useUtilityClasses$21=e=>{const{classes:t}=e,n=composeClasses({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},getOutlinedInputUtilityClass,t);return{...t,...n}},gm=Fl(Qp,{shouldForwardProp:e=>rootShouldForwardProp(e)||"classes"===e,name:"MuiOutlinedInput",slot:"Root",overridesResolver:rootOverridesResolver})(Kl(({theme:e})=>{const t="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{position:"relative",borderRadius:(e.vars||e).shape.borderRadius,[`&:hover .${hm.notchedOutline}`]:{borderColor:(e.vars||e).palette.text.primary},"@media (hover: none)":{[`&:hover .${hm.notchedOutline}`]:{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}},[`&.${hm.focused} .${hm.notchedOutline}`]:{borderWidth:2},variants:[...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t},style:{[`&.${hm.focused} .${hm.notchedOutline}`]:{borderColor:(e.vars||e).palette[t].main}}})),{props:{},style:{[`&.${hm.error} .${hm.notchedOutline}`]:{borderColor:(e.vars||e).palette.error.main},[`&.${hm.disabled} .${hm.notchedOutline}`]:{borderColor:(e.vars||e).palette.action.disabled}}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:14}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:14}},{props:({ownerState:e})=>e.multiline,style:{padding:"16.5px 14px"}},{props:({ownerState:e,size:t})=>e.multiline&&"small"===t,style:{padding:"8.5px 14px"}}]}})),fm=Fl(NotchedOutline,{name:"MuiOutlinedInput",slot:"NotchedOutline"})(Kl(({theme:e})=>{const t="light"===e.palette.mode?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{borderColor:e.vars?e.alpha(e.vars.palette.common.onBackground,.23):t}})),ym=Fl(em,{name:"MuiOutlinedInput",slot:"Input",overridesResolver:inputOverridesResolver})(Kl(({theme:e})=>({padding:"16.5px 14px","&:-webkit-autofill":{...!e.vars&&{WebkitBoxShadow:"light"===e.palette.mode?null:"0 0 0 100px #266798 inset",WebkitTextFillColor:"light"===e.palette.mode?null:"#fff",caretColor:"light"===e.palette.mode?null:"#fff"},borderRadius:"inherit",...e.vars&&e.applyStyles("dark",{WebkitBoxShadow:"0 0 0 100px #266798 inset",WebkitTextFillColor:"#fff",caretColor:"#fff"})},variants:[{props:{size:"small"},style:{padding:"8.5px 14px"}},{props:({ownerState:e})=>e.multiline,style:{padding:0}},{props:({ownerState:e})=>e.startAdornment,style:{paddingLeft:0}},{props:({ownerState:e})=>e.endAdornment,style:{paddingRight:0}}]}))),bm=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiOutlinedInput"}),{fullWidth:o=!1,inputComponent:a="input",label:i,multiline:s=!1,notched:l,slots:d={},slotProps:u={},type:p="text",...m}=n,h=useUtilityClasses$21(n),[g,y]=useFormControlState({props:n,states:["color","disabled","error","focused","hiddenLabel","size","required"]}),b={...n,color:g.color||"primary",disabled:g.disabled,error:g.error,focused:g.focused,formControl:y,fullWidth:o,hiddenLabel:g.hiddenLabel,multiline:s,size:g.size,type:p},v=d.root??gm,w=d.input??ym,[S,x]=useSlot("notchedOutline",{elementType:fm,className:h.notchedOutline,shouldForwardComponentProp:!0,ownerState:b,externalForwardedProps:{slots:d,slotProps:u},additionalProps:{label:null!=i&&""!==i&&g.required?(0,ps.jsxs)(c.Fragment,{children:[i," ","*"]}):i}});return(0,ps.jsx)(rm,{slots:{root:v,input:w},slotProps:u,renderSuffix:e=>(0,ps.jsx)(S,{...x,notched:void 0!==l?l:Boolean(e.startAdornment||e.filled||e.focused)}),fullWidth:o,inputComponent:a,multiline:s,ref:t,type:p,...m,classes:{...h,notchedOutline:null}})});bm.muiName="Input";var useUtilityClasses$20=e=>{const{classes:t}=e,n=composeClasses({root:["root"]},getSelectUtilityClasses,t);return{...t,...n}},vm={name:"MuiSelect",slot:"Root",shouldForwardProp:e=>rootShouldForwardProp(e)&&"variant"!==e},wm=Fl(im,vm)(""),Sm=Fl(bm,vm)(""),xm=Fl(um,vm)(""),Im=c.forwardRef(function(e,t){const n=useDefaultProps({name:"MuiSelect",props:e}),{autoWidth:o=!1,children:a,classes:i={},className:s,defaultOpen:l=!1,displayEmpty:d=!1,IconComponent:u=Up,id:p,input:m,inputProps:h,label:g,labelId:y,MenuProps:b,multiple:v=!1,native:w=!1,onClose:S,onOpen:x,open:I,renderValue:C,SelectDisplayProps:E,variant:R="outlined",...k}=n,T=w?_p:Hp,[M]=useFormControlState({props:n,states:["variant","error"]}),$=M.variant||R,N={...n,variant:$,classes:i},P=useUtilityClasses$20(N),{root:O,...j}=P,F=m||{standard:(0,ps.jsx)(wm,{ownerState:N}),outlined:(0,ps.jsx)(Sm,{label:g,ownerState:N}),filled:(0,ps.jsx)(xm,{ownerState:N})}[$],L=pc(t,getReactElementRef(F));return(0,ps.jsx)(c.Fragment,{children:c.cloneElement(F,{inputComponent:T,inputProps:{children:a,error:M.error,IconComponent:u,variant:$,type:void 0,multiple:v,...w?{id:p}:{autoWidth:o,defaultOpen:l,displayEmpty:d,labelId:y,MenuProps:b,onClose:S,onOpen:x,open:I,renderValue:C,SelectDisplayProps:{id:p,...E}},...h,classes:h?deepmerge(j,h.classes):j,...m?m.props.inputProps:{}},...(v&&w||d)&&"outlined"===$?{notched:!0}:{},ref:L,className:clsx(F.props.className,s,P.root),...!m&&{variant:$},...k})})});Im.muiName="Select";var Cm={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",whiteSpace:"nowrap",width:"1px"};function areArraysEqual(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,o)=>n(e,t[o]))}var Em=2,Rm=[],km={};function getNewValue(e,t,n,o,a){return 1===n?Math.min(e+t,a):Math.max(e-t,o)}function asc(e,t){return e-t}function findClosest(e,t,n=-1){const{index:o}=e.reduce((e,n,o)=>{const a=Math.abs(t-n);return null==e||a<=e.distance?{distance:a,index:o}:e},null)??km;return null==o?o:n>=0&&e[n]===e[o]?n:o}function trackFinger(e,t){if(null!=t.current&&e.changedTouches){const n=e;for(let e=0;e<n.changedTouches.length;e+=1){const o=n.changedTouches[e];if(o.identifier===t.current)return{x:o.clientX,y:o.clientY}}return!1}return{x:e.clientX,y:e.clientY}}function valueToPercent(e,t,n){return 100*(e-t)/(n-t)}function percentToValue(e,t,n){return(n-t)*e+t}function getDecimalPrecision(e){if(Math.abs(e)<1){const t=e.toExponential().split("e-"),n=t[0].split(".")[1];return(n?n.length:0)+parseInt(t[1],10)}const t=e.toString().split(".")[1];return t?t.length:0}function roundValueToStep(e,t,n){const o=Math.round((e-n)/t)*t+n;return Number(o.toFixed(getDecimalPrecision(t)))}function setValueIndex(e,t,n){const o=e.slice();return o[n]=t,o.sort(asc)}function focusThumb(e,t,n,o){const a=ac(ownerDocument(e.current));if(!vd(e.current,a)||Number(a?.getAttribute("data-index"))!==t){const n=e.current?.querySelector(`[type="range"][data-index="${t}"]`);null!=n&&(null==o?n.focus({preventScroll:!0}):n.focus({preventScroll:!0,focusVisible:o}))}n&&n(t)}function areValuesEqual(e,t){return"number"==typeof e&&"number"==typeof t?e===t:"object"==typeof e&&"object"==typeof t&&areArraysEqual(e,t)}var Am={horizontal:{offset:e=>({left:`${e}%`}),leap:e=>({width:`${e}%`})},"horizontal-reverse":{offset:e=>({right:`${e}%`}),leap:e=>({width:`${e}%`})},vertical:{offset:e=>({bottom:`${e}%`}),leap:e=>({height:`${e}%`})}},Identity$1=e=>e;function useSlider(e){const{"aria-labelledby":t,defaultValue:n,disabled:o=!1,disableSwap:a=!1,isRtl:i=!1,marks:s=!1,max:l=100,min:d=0,name:u,onChange:p,onChangeCommitted:m,orientation:h="horizontal",rootRef:g,scale:y=Identity$1,step:b=1,shiftStep:v=10,tabIndex:w,value:S}=e,x=c.useRef(void 0),I=c.useRef(null),[C,E]=c.useState(-1),[R,k]=c.useState(-1),[T,M]=c.useState(!1),$=c.useRef(0),N=c.useRef(-1),P=c.useRef(!1),O=c.useRef(-1),j=useEventCallback(()=>{null!=I.current&&(cancelAnimationFrame(I.current),I.current=null)}),F=c.useRef(null),[L,D]=useControlled({controlled:S,default:n??d,name:"Slider"}),B=useEventCallback((e,t,n)=>{const o="nativeEvent"in e?e.nativeEvent:e,a=new o.constructor(o.type,o);Object.defineProperty(a,"target",{writable:!0,value:{value:t,name:u}}),F.current=t,p?.(a,t,n)}),G=Array.isArray(L),W=c.useMemo(()=>{if("number"==typeof L)return[clamp$1(L,d,l)];if(null==L)return[d];const e=L.slice().sort(asc);for(let t=0;t<e.length;t+=1){const n=e[t];e[t]=null==n?d:clamp$1(n,d,l)}return e},[L,d,l]),V=c.useMemo(()=>{if(!0===s&&null!=b){const e=new Array(Math.floor((l-d)/b)+1);for(let t=0;t<e.length;t+=1)e[t]={value:d+b*t};return e}return Array.isArray(s)?s:Rm},[s,b,d,l]),H=c.useMemo(()=>{const e=new Array(V.length);for(let t=0;t<V.length;t+=1)e[t]=V[t].value;return e},[V]),[U,q]=c.useState(-1),K=c.useRef(null),Z=useForkRef(g,K),createHandleHiddenInputFocus=e=>t=>{const n=Number(t.currentTarget.getAttribute("data-index"));isFocusVisible(t.target)&&q(n),k(n),e?.onFocus?.(t)},createHandleHiddenInputBlur=e=>t=>{isFocusVisible(t.target)||q(-1),k(-1),e?.onBlur?.(t)},changeValue=(e,t)=>{const n=Number(e.currentTarget.getAttribute("data-index")),o=W[n],i=H.indexOf(o);let s=t;if(V&&null==b){const e=H[H.length-1];s=s>=e?e:s<=H[0]?H[0]:s<o?H[i-1]:H[i+1]}if(s=clamp$1(s,d,l),G){a&&(s=clamp$1(s,W[n-1]||-1/0,W[n+1]||1/0));const e=s;s=setValueIndex(W,s,n);let t=n;a||(t=s.indexOf(e)),focusThumb(K,t)}D(s),q(n),p&&!areValuesEqual(s,L)&&B(e,s,n),m&&m(e,F.current??s)},createHandleHiddenInputKeyDown=e=>t=>{if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"].includes(t.key)){t.preventDefault();const e=W[Number(t.currentTarget.getAttribute("data-index"))];let n=null;if(null!=b){const o=t.shiftKey?v:b;switch(t.key){case"ArrowUp":n=getNewValue(e,o,1,d,l);break;case"ArrowRight":n=getNewValue(e,o,i?-1:1,d,l);break;case"ArrowDown":n=getNewValue(e,o,-1,d,l);break;case"ArrowLeft":n=getNewValue(e,o,i?1:-1,d,l);break;case"PageUp":n=getNewValue(e,v,1,d,l);break;case"PageDown":n=getNewValue(e,v,-1,d,l);break;case"Home":n=d;break;case"End":n=l}}else if(V){const o=H[H.length-1],a=H.indexOf(e),s=[i?"ArrowLeft":"ArrowRight","ArrowUp","PageUp","End"];[i?"ArrowRight":"ArrowLeft","ArrowDown","PageDown","Home"].includes(t.key)?n=0===a?H[0]:H[a-1]:s.includes(t.key)&&(n=a===H.length-1?o:H[a+1])}null!=n&&changeValue(t,n)}e?.onKeyDown?.(t)};nl(()=>{const e=ac(ownerDocument(K.current));o&&vd(K.current,e)&&null!=e&&"blur"in e&&e.blur()},[o]),o&&-1!==C&&E(-1),o&&-1!==U&&q(-1);const createHandleHiddenInputChange=e=>t=>{e.onChange?.(t),changeValue(t,t.currentTarget.valueAsNumber)},Y=c.useRef(void 0);let X=h;i&&"horizontal"===h&&(X+="-reverse");const getValueAtFinger=e=>{const{current:t}=K;if(!t)return null;const{width:n,height:o,bottom:i,left:s}=t.getBoundingClientRect();let c,u;c=X.startsWith("vertical")?(i-e.y)/o:(e.x-s)/n,X.includes("-reverse")&&(c=1-c),u=percentToValue(c,d,l),u=b?roundValueToStep(u,b,d):H[findClosest(H,u)],u=clamp$1(u,d,l);let p=0;if(G){const e=-1!==Y.current;p=e?Y.current:findClosest(W,u,N.current),a&&(u=clamp$1(u,W[p-1]||-1/0,W[p+1]||1/0));const t=u;u=setValueIndex(W,u,p),a&&e||(p=u.indexOf(t),Y.current=p)}return{newValue:u,activeIndex:p}},J=useEventCallback(e=>{if("pointerId"in e&&e.pointerId!==O.current)return;const t=trackFinger(e,x);if(!t)return;if($.current+=1,"pointermove"===e.type&&0===e.buttons)return void Q(e);const n=getValueAtFinger(t);n&&(focusThumb(K,n.activeIndex,E,!1),N.current=n.activeIndex,D(n.newValue),!T&&$.current>Em&&M(!0),p&&!areValuesEqual(n.newValue,L)&&B(e,n.newValue,n.activeIndex))}),Q=useEventCallback(e=>{if("pointerId"in e&&e.pointerId!==O.current)return;const t=trackFinger(e,x);if(M(!1),!t)return;const n=getValueAtFinger(t);E(-1),"touchend"===e.type&&k(-1),n&&m&&m(e,F.current??n.newValue),"pointerType"in e&&K.current?.hasPointerCapture(e.pointerId)&&K.current.releasePointerCapture(e.pointerId),x.current=void 0,O.current=-1,te()}),ee=useEventCallback(e=>{if(o)return;if(P.current){P.current=!1;const t=e.changedTouches[0];return void(null!=t&&(x.current=t.identifier))}const t=e.changedTouches[0];null!=t&&(x.current=t.identifier);const n=trackFinger(e,x);if(!1!==n){Y.current=-1;const t=getValueAtFinger(n);t&&(focusThumb(K,t.activeIndex,E,!1),N.current=t.activeIndex,D(t.newValue),p&&!areValuesEqual(t.newValue,L)&&B(e,t.newValue,t.activeIndex))}$.current=0;const a=ownerDocument(K.current);a.addEventListener("touchmove",J,{passive:!0}),a.addEventListener("touchend",Q,{passive:!0})}),te=c.useCallback(()=>{const e=ownerDocument(K.current);e.removeEventListener("pointermove",J),e.removeEventListener("pointerup",Q),e.removeEventListener("touchmove",J),e.removeEventListener("touchend",Q)},[Q,J]);c.useEffect(()=>{const e=K.current;if(e)return e.addEventListener("touchstart",ee,{passive:!0}),()=>{e.removeEventListener("touchstart",ee),j(),te()}},[te,ee,j]),c.useEffect(()=>{o&&(te(),j())},[o,te,j]);const createHandlePointerDown=e=>t=>{if(e.onPointerDown?.(t),"touch"===t.pointerType&&(P.current=!0),o||t.defaultPrevented||0!==t.button)return;const n=trackFinger(t,x);if(!1!==n){Y.current=-1;const e=getValueAtFinger(n);if(e){const n=K.current?.querySelector(`input[type="range"][data-index="${e.activeIndex}"]`),o=ownerDocument(K.current),a=null!=n&&n===ac(o);E(e.activeIndex),N.current=e.activeIndex,a?t.preventDefault():(j(),I.current=requestAnimationFrame(()=>{I.current=null,focusThumb(K,e.activeIndex,void 0,!1)})),D(e.newValue),p&&!areValuesEqual(e.newValue,L)&&B(t,e.newValue,e.activeIndex)}}$.current=0,O.current=t.pointerId;const a=ownerDocument(K.current);try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}a.addEventListener("pointermove",J,{passive:!0}),a.addEventListener("pointerup",Q)},re=valueToPercent(G?W[0]:d,d,l),ne=valueToPercent(W[W.length-1],d,l)-re,createHandleMouseOver=e=>t=>{e.onMouseOver?.(t),k(Number(t.currentTarget.getAttribute("data-index")))},createHandleMouseLeave=e=>t=>{e.onMouseLeave?.(t),k(-1)},getThumbStyle=e=>{let t;return G?C===e?t=2:N.current===e&&(t=1):C===e&&(t=1),{pointerEvents:-1!==C&&C!==e?"none":void 0,zIndex:t}};let oe;return"vertical"===h&&(oe=i?"vertical-rl":"vertical-lr"),{active:C,axis:X,axisProps:Am,dragging:T,focusedThumbIndex:U,getHiddenInputProps:(n=km)=>{const a=extractEventHandlers(n),s={onChange:createHandleHiddenInputChange(a),onFocus:createHandleHiddenInputFocus(a),onBlur:createHandleHiddenInputBlur(a),onKeyDown:createHandleHiddenInputKeyDown(a)},c={...a,...s};return{tabIndex:w,"aria-labelledby":t,"aria-orientation":h,"aria-valuemax":y(l),"aria-valuemin":y(d),name:u,type:"range",min:e.min,max:e.max,step:null===e.step&&e.marks?"any":e.step??void 0,disabled:o,...n,...c,style:{...Cm,direction:i?"rtl":"ltr",width:"100%",height:"100%",writingMode:oe}}},getRootProps:(e=km)=>{const t=extractEventHandlers(e),n={onPointerDown:createHandlePointerDown(t)},o={...t,...n};return{...e,ref:Z,...o}},getThumbProps:(e=km)=>{const t=extractEventHandlers(e),n={onMouseOver:createHandleMouseOver(t),onMouseLeave:createHandleMouseLeave(t)};return{...e,...t,...n}},marks:V,open:R,range:G,rootRef:Z,trackLeap:ne,trackOffset:re,values:W,getThumbStyle}}function getSliderUtilityClass(e){return generateUtilityClass("MuiSlider",e)}var Tm=generateUtilityClasses("MuiSlider",["root","active","colorPrimary","colorSecondary","colorError","colorInfo","colorSuccess","colorWarning","disabled","dragging","focusVisible","mark","markActive","marked","markLabel","markLabelActive","rail","sizeSmall","thumb","track","trackInverted","trackFalse","valueLabel","valueLabelOpen","valueLabelCircle","valueLabelLabel","vertical"]),useValueLabelClasses=e=>{const{open:t}=e;return{offset:clsx(t&&Tm.valueLabelOpen),circle:Tm.valueLabelCircle,label:Tm.valueLabelLabel}};function SliderValueLabel$1(e){const{children:t,className:n,value:o}=e,a=useValueLabelClasses(e);return t?c.cloneElement(t,{className:t.props.className},(0,ps.jsxs)(c.Fragment,{children:[t.props.children,(0,ps.jsx)("span",{className:clsx(a.offset,n),"aria-hidden":!0,children:(0,ps.jsx)("span",{className:a.circle,children:(0,ps.jsx)("span",{className:a.label,children:o})})})]})):null}function Identity(e){return e}var Mm=Fl("span",{name:"MuiSlider",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[`color${Zl(n.color)}`],"medium"!==n.size&&t[`size${Zl(n.size)}`],n.marked&&t.marked,"vertical"===n.orientation&&t.vertical,"inverted"===n.track&&t.trackInverted,!1===n.track&&t.trackFalse]}})(Kl(({theme:e})=>({borderRadius:12,boxSizing:"content-box",display:"inline-block",position:"relative",cursor:"pointer",touchAction:"none",WebkitTapHighlightColor:"transparent","@media print":{colorAdjust:"exact"},[`&.${Tm.disabled}`]:{pointerEvents:"none",cursor:"default",color:(e.vars||e).palette.grey[400]},[`&.${Tm.dragging}`]:{[`& .${Tm.thumb}, & .${Tm.track}`]:{transition:"none"}},variants:[...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t},style:{color:(e.vars||e).palette[t].main}})),{props:{orientation:"horizontal"},style:{height:4,width:"100%",padding:"13px 0","@media (pointer: coarse)":{padding:"20px 0"}}},{props:{orientation:"horizontal",size:"small"},style:{height:2}},{props:{orientation:"horizontal",marked:!0},style:{marginBottom:20}},{props:{orientation:"vertical"},style:{height:"100%",width:4,padding:"0 13px","@media (pointer: coarse)":{padding:"0 20px"}}},{props:{orientation:"vertical",size:"small"},style:{width:2}},{props:{orientation:"vertical",marked:!0},style:{marginRight:44}}]}))),zm=Fl("span",{name:"MuiSlider",slot:"Rail"})({display:"block",position:"absolute",borderRadius:"inherit",backgroundColor:"currentColor",opacity:.38,"@media (forced-colors: active)":{border:"1px solid transparent",boxSizing:"border-box"},variants:[{props:{orientation:"horizontal"},style:{width:"100%",height:"inherit",top:"50%",transform:"translateY(-50%)"}},{props:{orientation:"vertical"},style:{height:"100%",width:"inherit",left:"50%",transform:"translateX(-50%)"}},{props:{track:"inverted"},style:{opacity:1}}]}),$m=Fl("span",{name:"MuiSlider",slot:"Track"})(Kl(({theme:e})=>({display:"block",position:"absolute",borderRadius:"inherit",border:"1px solid currentColor",backgroundColor:"currentColor",transition:e.transitions.create(["left","width","bottom","height"],{duration:e.transitions.duration.shortest}),variants:[{props:{size:"small"},style:{"@media (forced-colors: none)":{border:"none"}}},{props:{orientation:"horizontal"},style:{height:"inherit",top:"50%",transform:"translateY(-50%)"}},{props:{orientation:"vertical"},style:{width:"inherit",left:"50%",transform:"translateX(-50%)"}},{props:{track:!1},style:{display:"none"}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t,track:"inverted"},style:{...e.vars?{backgroundColor:e.vars.palette.Slider[`${t}Track`],borderColor:e.vars.palette.Slider[`${t}Track`]}:{backgroundColor:e.lighten(e.palette[t].main,.62),borderColor:e.lighten(e.palette[t].main,.62),...e.applyStyles("dark",{backgroundColor:e.darken(e.palette[t].main,.5)}),...e.applyStyles("dark",{borderColor:e.darken(e.palette[t].main,.5)})}}}))]}))),Nm=Fl("span",{name:"MuiSlider",slot:"Thumb"})(Kl(({theme:e})=>({position:"absolute",width:20,height:20,boxSizing:"border-box",borderRadius:"50%",outline:0,backgroundColor:"currentColor",display:"flex",alignItems:"center",justifyContent:"center",transition:e.transitions.create(["box-shadow","left","bottom"],{duration:e.transitions.duration.shortest}),"@media (forced-colors: active)":{border:"1px solid ButtonBorder"},"&::before":{position:"absolute",content:'""',borderRadius:"inherit",width:"100%",height:"100%",boxShadow:(e.vars||e).shadows[2]},"&::after":{position:"absolute",content:'""',borderRadius:"50%",width:42,height:42,top:"50%",left:"50%",transform:"translate(-50%, -50%)"},[`&.${Tm.disabled}`]:{"&:hover":{boxShadow:"none"}},variants:[{props:{size:"small"},style:{width:12,height:12,"&::before":{boxShadow:"none"}}},{props:{orientation:"horizontal"},style:{top:"50%",transform:"translate(-50%, -50%)"}},{props:{orientation:"vertical"},style:{left:"50%",transform:"translate(-50%, 50%)"}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t},style:{[`&:hover, &.${Tm.focusVisible}`]:{boxShadow:`0px 0px 0px 8px ${e.alpha((e.vars||e).palette[t].main,.16)}`,"@media (hover: none)":{boxShadow:"none"}},[`&.${Tm.active}`]:{boxShadow:`0px 0px 0px 14px ${e.alpha((e.vars||e).palette[t].main,.16)}`}}}))]}))),Pm=Fl(SliderValueLabel$1,{name:"MuiSlider",slot:"ValueLabel"})(Kl(({theme:e})=>({zIndex:1,whiteSpace:"nowrap",...e.typography.body2,fontWeight:500,transition:e.transitions.create(["transform"],{duration:e.transitions.duration.shortest}),position:"absolute",backgroundColor:(e.vars||e).palette.grey[600],borderRadius:2,color:(e.vars||e).palette.common.white,display:"flex",alignItems:"center",justifyContent:"center",padding:"0.25rem 0.75rem",variants:[{props:{orientation:"horizontal"},style:{transform:"translateY(-100%) scale(0)",top:"-10px",transformOrigin:"bottom center","&::before":{position:"absolute",content:'""',width:8,height:8,transform:"translate(-50%, 50%) rotate(45deg)",backgroundColor:"inherit",bottom:0,left:"50%"},[`&.${Tm.valueLabelOpen}`]:{transform:"translateY(-100%) scale(1)"}}},{props:{orientation:"vertical"},style:{transform:"translateY(-50%) scale(0)",right:"30px",top:"50%",transformOrigin:"right center","&::before":{position:"absolute",content:'""',width:8,height:8,transform:"translate(-50%, -50%) rotate(45deg)",backgroundColor:"inherit",right:-8,top:"50%"},[`&.${Tm.valueLabelOpen}`]:{transform:"translateY(-50%) scale(1)"}}},{props:{size:"small"},style:{fontSize:e.typography.pxToRem(12),padding:"0.25rem 0.5rem"}},{props:{orientation:"vertical",size:"small"},style:{right:"20px"}}]}))),Om=Fl("span",{name:"MuiSlider",slot:"Mark",shouldForwardProp:e=>slotShouldForwardProp(e)&&"markActive"!==e,overridesResolver:(e,t)=>{const{markActive:n}=e;return[t.mark,n&&t.markActive]}})(Kl(({theme:e})=>({position:"absolute",width:2,height:2,borderRadius:1,backgroundColor:"currentColor",variants:[{props:{orientation:"horizontal"},style:{top:"50%",transform:"translate(-1px, -50%)"}},{props:{orientation:"vertical"},style:{left:"50%",transform:"translate(-50%, 1px)"}},{props:{markActive:!0},style:{backgroundColor:(e.vars||e).palette.background.paper,opacity:.8}}]}))),_m=Fl("span",{name:"MuiSlider",slot:"MarkLabel",shouldForwardProp:e=>slotShouldForwardProp(e)&&"markLabelActive"!==e})(Kl(({theme:e})=>({...e.typography.body2,color:(e.vars||e).palette.text.secondary,position:"absolute",whiteSpace:"nowrap",variants:[{props:{orientation:"horizontal"},style:{top:30,transform:"translateX(-50%)","@media (pointer: coarse)":{top:40}}},{props:{orientation:"vertical"},style:{left:36,transform:"translateY(50%)","@media (pointer: coarse)":{left:44}}},{props:{markLabelActive:!0},style:{color:(e.vars||e).palette.text.primary}}]}))),useUtilityClasses$19=e=>{const{disabled:t,dragging:n,marked:o,orientation:a,track:i,classes:s,color:l,size:c}=e;return composeClasses({root:["root",t&&"disabled",n&&"dragging",o&&"marked","vertical"===a&&"vertical","inverted"===i&&"trackInverted",!1===i&&"trackFalse",l&&`color${Zl(l)}`,c&&`size${Zl(c)}`],rail:["rail"],track:["track"],mark:["mark"],markActive:["markActive"],markLabel:["markLabel"],markLabelActive:["markLabelActive"],valueLabel:["valueLabel"],thumb:["thumb",t&&"disabled"],active:["active"],disabled:["disabled"],focusVisible:["focusVisible"]},getSliderUtilityClass,s)},Forward=({children:e})=>e,jm=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiSlider"}),o=useRtl(),{"aria-label":a,"aria-valuetext":i,"aria-labelledby":s,color:l="primary",classes:d,className:u,disableSwap:p=!1,disabled:m=!1,getAriaLabel:h,getAriaValueText:g,marks:y=!1,max:b=100,min:v=0,name:w,onChange:S,onChangeCommitted:x,orientation:I="horizontal",shiftStep:C=10,size:E="medium",step:R=1,scale:k=Identity,slotProps:T={},slots:M={},tabIndex:$,track:N="normal",value:P,valueLabelDisplay:O="off",valueLabelFormat:j=Identity,...F}=n,L={...n,isRtl:o,max:b,min:v,classes:d,disabled:m,disableSwap:p,orientation:I,marks:y,color:l,size:E,step:R,shiftStep:C,scale:k,track:N,valueLabelDisplay:O,valueLabelFormat:j},{axisProps:D,getRootProps:B,getHiddenInputProps:G,getThumbProps:W,open:V,active:H,axis:U,focusedThumbIndex:q,range:K,dragging:Z,marks:Y,values:X,trackOffset:J,trackLeap:Q,getThumbStyle:ee}=useSlider({...L,rootRef:t});L.marked=Y.length>0&&Y.some(e=>e.label),L.dragging=Z,L.focusedThumbIndex=q;const te=useUtilityClasses$19(L),re={slots:M,slotProps:T},[ne,oe]=useSlot("root",{elementType:Mm,getSlotProps:B,externalForwardedProps:{...re,...F},ownerState:L,className:[te.root,u]}),[ae,ie]=useSlot("rail",{elementType:zm,externalForwardedProps:re,ownerState:L,className:te.rail}),[se,le]=useSlot("track",{elementType:$m,externalForwardedProps:re,additionalProps:{style:{...D[U].offset(J),...D[U].leap(Q)}},ownerState:L,className:te.track}),[ce,de]=useSlot("thumb",{elementType:Nm,getSlotProps:W,externalForwardedProps:re,ownerState:L,className:te.thumb}),[ue,pe]=useSlot("valueLabel",{elementType:Pm,externalForwardedProps:re,ownerState:L,className:te.valueLabel}),[me,he]=useSlot("mark",{elementType:Om,externalForwardedProps:re,ownerState:L,className:te.mark}),[ge,fe]=useSlot("markLabel",{elementType:_m,externalForwardedProps:re,ownerState:L,className:te.markLabel}),[ye,be]=useSlot("input",{elementType:"input",getSlotProps:G,externalForwardedProps:re,ownerState:L});return(0,ps.jsxs)(ne,{...oe,children:[(0,ps.jsx)(ae,{...ie}),(0,ps.jsx)(se,{...le}),Y.filter(e=>e.value>=v&&e.value<=b).map((e,t)=>{const n=valueToPercent(e.value,v,b),o=D[U].offset(n);let a;return a=!1===N?X.includes(e.value):"normal"===N&&(K?e.value>=X[0]&&e.value<=X[X.length-1]:e.value<=X[0])||"inverted"===N&&(K?e.value<=X[0]||e.value>=X[X.length-1]:e.value>=X[0]),(0,ps.jsxs)(c.Fragment,{children:[(0,ps.jsx)(me,{"data-index":t,...he,...!isHostComponent(me)&&{markActive:a},style:{...o,...he.style},className:clsx(he.className,a&&te.markActive)}),null!=e.label?(0,ps.jsx)(ge,{"aria-hidden":!0,"data-index":t,...fe,...!isHostComponent(ge)&&{markLabelActive:a},style:{...o,...fe.style},className:clsx(te.markLabel,fe.className,a&&te.markLabelActive),children:e.label}):null]},t)}),X.map((e,t)=>{const n=valueToPercent(e,v,b),o=D[U].offset(n),l="off"===O?Forward:ue;return(0,ps.jsx)(l,{...!isHostComponent(l)&&{valueLabelFormat:j,valueLabelDisplay:O,value:"function"==typeof j?j(k(e),t):j,index:t,open:V===t||H===t||"on"===O,disabled:m},...pe,children:(0,ps.jsx)(ce,{"data-index":t,...de,className:clsx(te.thumb,de.className,H===t&&te.active,q===t&&te.focusVisible),style:{...o,...ee(t),...de.style},children:(0,ps.jsx)(ye,{"data-index":t,"aria-label":h?h(t):a,"aria-valuenow":k(e),"aria-labelledby":s,"aria-valuetext":g?g(k(e),t):i,value:X[t],...be})})},t)})]})});function getSwitchBaseUtilityClass(e){return generateUtilityClass("PrivateSwitchBase",e)}generateUtilityClasses("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);var useUtilityClasses$18=e=>{const{classes:t,checked:n,disabled:o,edge:a}=e;return composeClasses({root:["root",n&&"checked",o&&"disabled",a&&`edge${Zl(a)}`],input:["input"]},getSwitchBaseUtilityClass,t)},Fm=Fl(Lc,{name:"MuiSwitchBase"})({padding:9,borderRadius:"50%",variants:[{props:{edge:"start",size:"small"},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>"start"===e&&"small"!==t.size,style:{marginLeft:-12}},{props:{edge:"end",size:"small"},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>"end"===e&&"small"!==t.size,style:{marginRight:-12}}]}),Lm=Fl("input",{name:"MuiSwitchBase",shouldForwardProp:rootShouldForwardProp})({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),Dm=c.forwardRef(function(e,t){const{autoFocus:n,checked:o,checkedIcon:a,defaultChecked:i,disabled:s,disableFocusRipple:l=!1,edge:c=!1,icon:d,id:u,name:p,onBlur:m,onChange:h,onFocus:g,readOnly:y,required:b=!1,tabIndex:v,type:w,value:S,slots:x={},slotProps:I={},...C}=e,{nativeButton:E,...R}=C,[k,T]=dc({controlled:o,default:Boolean(i),name:"SwitchBase",state:"checked"}),M=useFormControl(),handleFocus=e=>{g&&g(e),M&&M.onFocus&&M.onFocus(e)},handleBlur=e=>{m&&m(e),M&&M.onBlur&&M.onBlur(e)},handleInputChange=e=>{if(e.nativeEvent.defaultPrevented||y)return;const t=e.target.checked;T(t),h&&h(e,t)};let $=s;M&&void 0===$&&($=M.disabled);const N="checkbox"===w||"radio"===w,P={...e,checked:k,disabled:$,disableFocusRipple:l,edge:c},O=useUtilityClasses$18(P),j={slots:x,slotProps:I},[F,L]=useSlot("root",{ref:t,elementType:Fm,className:O.root,shouldForwardComponentProp:!0,externalForwardedProps:{...j,component:"span",...R},getSlotProps:e=>({...e,onFocus:t=>{e.onFocus?.(t),handleFocus(t)},onBlur:t=>{e.onBlur?.(t),handleBlur(t)}}),ownerState:P,additionalProps:{centerRipple:!0,focusRipple:!l,role:void 0,tabIndex:null}}),[D,B]=useSlot("input",{elementType:Lm,className:O.input,externalForwardedProps:j,getSlotProps:e=>({...e,onChange:t=>{e.onChange?.(t),handleInputChange(t)}}),ownerState:P,additionalProps:{autoFocus:n,checked:o,defaultChecked:i,disabled:$,id:N?u:void 0,name:p,readOnly:y,required:b,tabIndex:v,type:w,..."checkbox"===w&&void 0===S?{}:{value:S}}});return(0,ps.jsxs)(F,{...L,children:[(0,ps.jsx)(D,{...B}),k?a:d]})});function getSwitchUtilityClass(e){return generateUtilityClass("MuiSwitch",e)}var Bm=generateUtilityClasses("MuiSwitch",["root","edgeStart","edgeEnd","switchBase","colorPrimary","colorSecondary","sizeSmall","sizeMedium","checked","disabled","input","thumb","track"]),useUtilityClasses$17=e=>{const{classes:t,edge:n,size:o,color:a,checked:i,disabled:s}=e,l=composeClasses({root:["root",n&&`edge${Zl(n)}`,`size${Zl(o)}`],switchBase:["switchBase",`color${Zl(a)}`,i&&"checked",s&&"disabled"],thumb:["thumb"],track:["track"],input:["input"]},getSwitchUtilityClass,t);return{...t,...l}},Gm=Fl("span",{name:"MuiSwitch",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.edge&&t[`edge${Zl(n.edge)}`],t[`size${Zl(n.size)}`]]}})({display:"inline-flex",width:58,height:38,overflow:"hidden",padding:12,boxSizing:"border-box",position:"relative",flexShrink:0,zIndex:0,verticalAlign:"middle","@media print":{colorAdjust:"exact"},variants:[{props:{edge:"start"},style:{marginLeft:-8}},{props:{edge:"end"},style:{marginRight:-8}},{props:{size:"small"},style:{width:40,height:24,padding:7,[`& .${Bm.thumb}`]:{width:16,height:16},[`& .${Bm.switchBase}`]:{padding:4,[`&.${Bm.checked}`]:{transform:"translateX(16px)"}}}}]}),Wm=Fl(Dm,{name:"MuiSwitch",slot:"SwitchBase",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.switchBase,{[`& .${Bm.input}`]:t.input},"default"!==n.color&&t[`color${Zl(n.color)}`]]}})(Kl(({theme:e})=>({position:"absolute",top:0,left:0,zIndex:1,color:e.vars?e.vars.palette.Switch.defaultColor:`${"light"===e.palette.mode?e.palette.common.white:e.palette.grey[300]}`,transition:e.transitions.create(["left","transform"],{duration:e.transitions.duration.shortest}),[`&.${Bm.checked}`]:{transform:"translateX(20px)"},[`&.${Bm.disabled}`]:{color:e.vars?e.vars.palette.Switch.defaultDisabledColor:`${"light"===e.palette.mode?e.palette.grey[100]:e.palette.grey[600]}`},[`&.${Bm.checked} + .${Bm.track}`]:{opacity:.5},[`&.${Bm.disabled} + .${Bm.track}`]:{opacity:e.vars?e.vars.opacity.switchTrackDisabled:""+("light"===e.palette.mode?.12:.2)},[`& .${Bm.input}`]:{left:"-100%",width:"300%"}})),Kl(({theme:e})=>({"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},variants:[...Object.entries(e.palette).filter(createSimplePaletteValueFilter(["light"])).map(([t])=>({props:{color:t},style:{[`&.${Bm.checked}`]:{color:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${Bm.disabled}`]:{color:e.vars?e.vars.palette.Switch[`${t}DisabledColor`]:`${"light"===e.palette.mode?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.55)}`}},[`&.${Bm.checked} + .${Bm.track}`]:{backgroundColor:(e.vars||e).palette[t].main}}}))]}))),Vm=Fl("span",{name:"MuiSwitch",slot:"Track"})(Kl(({theme:e})=>({height:"100%",width:"100%",borderRadius:7,zIndex:-1,transition:e.transitions.create(["opacity","background-color"],{duration:e.transitions.duration.shortest}),"@media (forced-colors: active)":{boxSizing:"border-box",border:"1px solid ButtonBorder"},backgroundColor:e.vars?e.vars.palette.common.onBackground:`${"light"===e.palette.mode?e.palette.common.black:e.palette.common.white}`,opacity:e.vars?e.vars.opacity.switchTrack:""+("light"===e.palette.mode?.38:.3)}))),Hm=Fl("span",{name:"MuiSwitch",slot:"Thumb"})(Kl(({theme:e})=>({boxShadow:(e.vars||e).shadows[1],backgroundColor:"currentColor",boxSizing:"border-box",border:"1px solid transparent",width:20,height:20,borderRadius:"50%"}))),Um=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiSwitch"}),{className:o,color:a="primary",edge:i=!1,size:s="medium",sx:l,slots:c={},slotProps:d={},...u}=n,p={...n,color:a,edge:i,size:s},m=useUtilityClasses$17(p),h=d.input,g={slots:c,slotProps:d},[y,b]=useSlot("root",{className:clsx(m.root,o),elementType:Gm,externalForwardedProps:g,ownerState:p,additionalProps:{sx:l}}),[v,w]=useSlot("thumb",{className:m.thumb,elementType:Hm,externalForwardedProps:g,ownerState:p}),S=(0,ps.jsx)(v,{...w}),[x,I]=useSlot("track",{className:m.track,elementType:Vm,externalForwardedProps:g,ownerState:p});return(0,ps.jsxs)(y,{...b,children:[(0,ps.jsx)(Wm,{type:"checkbox",icon:S,checkedIcon:S,ref:t,ownerState:p,...u,classes:{...m,root:m.switchBase},slots:{...c.switchBase&&{root:c.switchBase},...c.input&&{input:c.input}},slotProps:{...d.switchBase&&{root:"function"==typeof d.switchBase?d.switchBase(p):d.switchBase},input:mergeSlotProps$1("function"==typeof h?h(p):h,{role:"switch"})}}),(0,ps.jsx)(x,{...I})]})});function getFormHelperTextUtilityClasses(e){return generateUtilityClass("MuiFormHelperText",e)}var qm,Km=generateUtilityClasses("MuiFormHelperText",["root","error","disabled","sizeSmall","sizeMedium","contained","focused","filled","required"]),useUtilityClasses$16=e=>{const{classes:t,contained:n,size:o,disabled:a,error:i,filled:s,focused:l,required:c}=e;return composeClasses({root:["root",a&&"disabled",i&&"error",o&&`size${Zl(o)}`,n&&"contained",l&&"focused",s&&"filled",c&&"required"]},getFormHelperTextUtilityClasses,t)},Zm=Fl("p",{name:"MuiFormHelperText",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.size&&t[`size${Zl(n.size)}`],n.contained&&t.contained,n.filled&&t.filled]}})(Kl(({theme:e})=>({color:(e.vars||e).palette.text.secondary,...e.typography.caption,textAlign:"left",marginTop:3,marginRight:0,marginBottom:0,marginLeft:0,[`&.${Km.disabled}`]:{color:(e.vars||e).palette.text.disabled},[`&.${Km.error}`]:{color:(e.vars||e).palette.error.main},variants:[{props:{size:"small"},style:{marginTop:4}},{props:({ownerState:e})=>e.contained,style:{marginLeft:14,marginRight:14}}]}))),Ym=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiFormHelperText"}),{children:o,className:a,component:i="p",disabled:s,error:l,filled:c,focused:d,margin:u,required:p,variant:m,...h}=n,[g]=useFormControlState({props:n,states:["variant","size","disabled","error","filled","focused","required"]}),y={...n,component:i,contained:"filled"===g.variant||"outlined"===g.variant,variant:g.variant,size:g.size,disabled:g.disabled,error:g.error,filled:g.filled,focused:g.focused,required:g.required};return delete y.ownerState,(0,ps.jsx)(Zm,{as:i,className:clsx(useUtilityClasses$16(y).root,a),ref:t,...h,ownerState:y,children:" "===o?qm||(qm=(0,ps.jsx)("span",{className:"notranslate","aria-hidden":!0,children:"​"})):o})});function getTextFieldUtilityClass(e){return generateUtilityClass("MuiTextField",e)}generateUtilityClasses("MuiTextField",["root"]);var Xm={standard:im,filled:um,outlined:bm},useUtilityClasses$15=e=>{const{classes:t}=e;return composeClasses({root:["root"]},getTextFieldUtilityClass,t)},Jm=Fl(Uu,{name:"MuiTextField",slot:"Root"})({}),Qm=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTextField"}),{autoComplete:o,autoFocus:a=!1,children:i,className:s,color:l="primary",defaultValue:c,disabled:d=!1,error:u=!1,fullWidth:p=!1,helperText:m,id:h,inputRef:g,label:y,maxRows:b,minRows:v,multiline:w=!1,name:S,onBlur:x,onChange:I,onFocus:C,placeholder:E,required:R=!1,rows:k,select:T=!1,slots:M={},slotProps:$={},type:N,value:P,variant:O="outlined",...j}=n,F={...n,autoFocus:a,color:l,disabled:d,error:u,fullWidth:p,multiline:w,required:R,select:T,variant:O},L=useUtilityClasses$15(F),D=useId(h),B=m&&D?`${D}-helper-text`:void 0,G=y&&D?`${D}-label`:void 0,W=Xm[O],V={slots:M,slotProps:$},[H,U]=useSlot("select",{elementType:Im,externalForwardedProps:V,ownerState:F}),q=T&&U.native,K={},Z=V.slotProps.inputLabel;"outlined"===O&&(Z&&void 0!==Z.shrink&&(K.notched=Z.shrink),K.label=y),T&&(q||(K.id=void 0),K["aria-describedby"]=void 0);const[Y,X]=useSlot("root",{elementType:Jm,shouldForwardComponentProp:!0,externalForwardedProps:{...V,...j},ownerState:F,className:clsx(L.root,s),ref:t,additionalProps:{disabled:d,error:u,fullWidth:p,required:R,color:l,variant:O}}),[J,Q]=useSlot("input",{elementType:W,externalForwardedProps:V,additionalProps:K,ownerState:F}),[ee,te]=useSlot("inputLabel",{elementType:np,externalForwardedProps:V,ownerState:F}),[re,ne]=useSlot("htmlInput",{elementType:"input",externalForwardedProps:V,ownerState:F}),[oe,ae]=useSlot("formHelperText",{elementType:Ym,externalForwardedProps:V,ownerState:F}),ie=(0,ps.jsx)(J,{"aria-describedby":B,autoComplete:o,autoFocus:a,defaultValue:c,fullWidth:p,multiline:w,name:S,rows:k,maxRows:b,minRows:v,type:N,value:P,id:D,inputRef:g,onBlur:x,onChange:I,onFocus:C,placeholder:E,inputProps:ne,slots:{input:M.htmlInput?re:void 0},...Q});return(0,ps.jsxs)(Y,{...X,children:[null!=y&&""!==y&&(0,ps.jsx)(ee,{htmlFor:T&&!q?void 0:D,id:G,...T&&!q&&{component:"div"},...te,children:y}),T?(0,ps.jsx)(H,{"aria-describedby":B,id:D,labelId:G,value:P,input:ie,...U,children:i}):ie,m&&(0,ps.jsx)(oe,{id:B,...ae,children:m})]})}),eh=Object.freeze({airHarness:"Air Harness",atavianWings:"Atavian Wings",eagleWings:"Eagle Wings",gare:"Gare (Dragon)",islandWings:"Island Wings",knocker:"Knocker",nurRift:"Nur Rift",pebble:"Enchanted Pebble",sewergrate:"Sewer Grates",universe:"Universe (Jester/Occultist)",urn:"Urn / Mounted",wormhole:"Wormholes"});function SectionHeading({children:e}){return(0,ps.jsx)(Jl,{variant:"subtitle2",sx:{mb:2,fontWeight:600,letterSpacing:.5,textTransform:"uppercase",fontSize:"0.7rem",color:"text.secondary"},children:e})}var th=Object.freeze([{value:"rectangle",label:"Rectangle"},{value:"ellipse",label:"Ellipse"}]),rh=Object.freeze([{value:"name",label:"Room Name"},{value:"id",label:"Room ID"},{value:"none",label:"Hidden"}]);function ColorField({label:e,value:t,onChange:n}){return(0,ps.jsx)(Uu,{size:"small",sx:{minWidth:260},children:(0,ps.jsx)(Qm,{label:e,value:t,onChange:e=>n(e.target.value),size:"small",slotProps:{input:{startAdornment:(0,ps.jsx)(sp,{position:"start",children:(0,ps.jsx)(Hl,{sx:{position:"relative",width:20,height:20,borderRadius:.5,bgcolor:t,border:"1px solid",borderColor:"divider",flexShrink:0,overflow:"hidden"},children:(0,ps.jsx)(Hl,{component:"input",type:"color",value:t.startsWith("#")?t:"#000000",onChange:e=>n(e.target.value),sx:{position:"absolute",inset:0,width:"100%",height:"100%",opacity:0,cursor:"pointer",border:"none",padding:0}})})})}}})})}function DisplayTab({draft:e,patch:t}){const{router:n}=useNexMap();function patchDisplay(e){t(t=>({display:{...t.display,...e(t.display)}}))}return(0,ps.jsxs)(Hl,{sx:{display:"flex",gap:4,alignItems:"flex-start",p:1.5,width:700},children:[(0,ps.jsxs)(Hl,{sx:{display:"flex",gap:3,flexDirection:"column",flex:1},children:[(0,ps.jsx)(SectionHeading,{children:"Map Appearance"}),(0,ps.jsxs)(Uu,{size:"small",sx:{minWidth:160},children:[(0,ps.jsx)(np,{id:"room-shape-label",children:"Current Room Shape"}),(0,ps.jsx)(Im,{labelId:"room-shape-label",value:e.display?.currentRoomShape??"rectangle",label:"Current Room Shape",onChange:e=>patchDisplay(()=>({currentRoomShape:e.target.value})),children:th.map(e=>(0,ps.jsx)(yp,{value:e.value,children:e.label},e.value))})]}),(0,ps.jsx)(ColorField,{label:"Current Room Border Color",value:e.display?.currentRoomBorder??"#ff1493",onChange:e=>patchDisplay(()=>({currentRoomBorder:e}))}),(0,ps.jsxs)(Uu,{size:"small",fullWidth:!0,sx:{},children:[(0,ps.jsx)(np,{id:"label-mode-label",children:"Room Labels"}),(0,ps.jsx)(Im,{labelId:"label-mode-label",value:e.display?.labelMode??"name",label:"Room Labels",onChange:e=>patchDisplay(()=>({labelMode:e.target.value})),children:rh.map(e=>(0,ps.jsx)(yp,{value:e.value,children:e.label},e.value))})]}),(0,ps.jsxs)(Hl,{children:[(0,ps.jsxs)(Jl,{gutterBottom:!0,children:["Label Font Size: ",(0,ps.jsxs)("strong",{children:[e.display?.labelFontSize??13,"px"]})]}),(0,ps.jsx)(jm,{value:e.display?.labelFontSize??13,min:6,max:20,step:1,valueLabelDisplay:"auto",valueLabelFormat:e=>`${e}px`,onChange:(e,t)=>patchDisplay(()=>({labelFontSize:t}))})]}),(0,ps.jsxs)(Hl,{sx:{},children:[(0,ps.jsxs)(Jl,{gutterBottom:!0,children:["Default Zoom: ",(0,ps.jsx)("strong",{children:e.display?.zoom??1})]}),(0,ps.jsx)(jm,{value:e.display?.zoom??1,min:.1,max:5,step:.1,valueLabelDisplay:"auto",onChange:(e,t)=>{patchDisplay(()=>({zoom:t})),n?.execute?.("map.zoom",{zoom:t})}})]}),(0,ps.jsx)(Wu,{sx:{mb:1}}),(0,ps.jsx)(SectionHeading,{children:"Background"}),(0,ps.jsx)(Qm,{label:"Background Image URL",value:e.display?.background?.url??"",onChange:e=>patchDisplay(t=>({background:{...t.background,url:e.target.value||null}})),fullWidth:!0,size:"small",sx:{},helperText:"Optional background image behind the map."}),(0,ps.jsxs)(Hl,{sx:{},children:[(0,ps.jsxs)(Jl,{gutterBottom:!0,children:["Background Opacity: ",(0,ps.jsx)("strong",{children:e.display?.background?.opacity??.5})]}),(0,ps.jsx)(jm,{value:e.display?.background?.opacity??.5,min:0,max:1,step:.05,valueLabelDisplay:"auto",onChange:(e,t)=>patchDisplay(e=>({background:{...e.background,opacity:t}}))})]})]}),(0,ps.jsxs)(Hl,{sx:{flex:1},children:[(0,ps.jsx)(SectionHeading,{children:"Notices"}),(0,ps.jsx)(Yu,{control:(0,ps.jsx)(Um,{checked:e.display?.pathingNotices??!0,onChange:e=>patchDisplay(()=>({pathingNotices:e.target.checked})),size:"small"}),label:"Show pathing notices",sx:{mb:4,display:"flex"}}),(0,ps.jsx)(Wu,{sx:{my:4}}),(0,ps.jsx)(SectionHeading,{children:"Room Border Indicators"}),(0,ps.jsx)(Yu,{control:(0,ps.jsx)(Um,{checked:e.display?.roomBorderIndicators?.outdoor?.enabled??!1,onChange:e=>patchDisplay(t=>({roomBorderIndicators:{...t.roomBorderIndicators??{},outdoor:{...t.roomBorderIndicators?.outdoor??{},enabled:e.target.checked}}})),size:"small"}),label:"Outdoor rooms",sx:{mb:1.5,display:"flex"}}),(0,ps.jsx)(ColorField,{label:"Outdoor Room Border Color",value:e.display?.roomBorderIndicators?.outdoor?.color??"#44aaff",onChange:e=>patchDisplay(t=>({roomBorderIndicators:{...t.roomBorderIndicators??{},outdoor:{...t.roomBorderIndicators?.outdoor??{},color:e}}}))}),(0,ps.jsx)(Jl,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:.5,mb:3},children:"Rooms accessible by cloud travel and air harness"}),(0,ps.jsx)(Yu,{control:(0,ps.jsx)(Um,{checked:e.display?.roomBorderIndicators?.wormhole?.enabled??!1,onChange:e=>patchDisplay(t=>({roomBorderIndicators:{...t.roomBorderIndicators??{},wormhole:{...t.roomBorderIndicators?.wormhole??{},enabled:e.target.checked}}})),size:"small"}),label:"Wormhole rooms",sx:{mb:1.5,display:"flex"}}),(0,ps.jsx)(ColorField,{label:"Wormhole Room Border Color",value:e.display?.roomBorderIndicators?.wormhole?.color??"#aa44ff",onChange:e=>patchDisplay(t=>({roomBorderIndicators:{...t.roomBorderIndicators??{},wormhole:{...t.roomBorderIndicators?.wormhole??{},color:e}}}))}),(0,ps.jsx)(Jl,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:.5},children:"Rooms with a wormhole exit"})]})]})}var nh=createSvgIcon((0,ps.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}),"Cancel");function getChipUtilityClass(e){return generateUtilityClass("MuiChip",e)}var oh=generateUtilityClasses("MuiChip",["root","sizeSmall","sizeMedium","colorDefault","colorError","colorInfo","colorPrimary","colorSecondary","colorSuccess","colorWarning","disabled","clickable","deletable","outlined","filled","avatar","icon","label","deleteIcon","focusVisible"]),useUtilityClasses$14=e=>{const{classes:t,disabled:n,size:o,color:a,onDelete:i,clickable:s,variant:l}=e;return composeClasses({root:["root",l,n&&"disabled",`size${Zl(o)}`,`color${Zl(a)}`,s&&"clickable",i&&"deletable"],label:["label"],avatar:["avatar"],icon:["icon"],deleteIcon:["deleteIcon"]},getChipUtilityClass,t)},ah=Fl("div",{name:"MuiChip",slot:"Root",shouldForwardProp:e=>rootShouldForwardProp(e)&&"focusableWhenDisabled"!==e&&"skipFocusWhenDisabled"!==e,overridesResolver:(e,t)=>{const{ownerState:n}=e,{color:o,clickable:a,onDelete:i,size:s,variant:l}=n;return[{[`& .${oh.avatar}`]:t.avatar},{[`& .${oh.icon}`]:t.icon},{[`& .${oh.deleteIcon}`]:t.deleteIcon},t.root,t[`size${Zl(s)}`],t[`color${Zl(o)}`],a&&t.clickable,i&&t.deletable,t[l]]}})(Kl(({theme:e})=>{const t="light"===e.palette.mode?e.palette.grey[700]:e.palette.grey[300];return{maxWidth:"100%",fontFamily:e.typography.fontFamily,fontSize:e.typography.pxToRem(13),display:"inline-flex",alignItems:"center",justifyContent:"center",height:32,lineHeight:1.5,color:(e.vars||e).palette.text.primary,backgroundColor:(e.vars||e).palette.action.selected,borderRadius:16,whiteSpace:"nowrap",transition:e.transitions.create(["background-color","box-shadow"]),cursor:"unset",outline:0,textDecoration:"none",border:0,padding:0,verticalAlign:"middle",boxSizing:"border-box",[`&.${oh.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:"none"},[`& .${oh.avatar}`]:{marginLeft:5,marginRight:-6,width:24,height:24,color:e.vars?e.vars.palette.Chip.defaultAvatarColor:t,fontSize:e.typography.pxToRem(12)},[`& .${oh.icon}`]:{marginLeft:5,marginRight:-6},[`& .${oh.deleteIcon}`]:{WebkitTapHighlightColor:"transparent",color:e.alpha((e.vars||e).palette.text.primary,.26),fontSize:22,cursor:"pointer",margin:"0 5px 0 -6px","&:hover":{color:e.alpha((e.vars||e).palette.text.primary,.4)}},variants:[{props:{color:"primary"},style:{[`& .${oh.avatar}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.dark}}},{props:{color:"secondary"},style:{[`& .${oh.avatar}`]:{color:(e.vars||e).palette.secondary.contrastText,backgroundColor:(e.vars||e).palette.secondary.dark}}},{props:{size:"small"},style:{height:24,[`& .${oh.avatar}`]:{marginLeft:4,marginRight:-4,width:18,height:18,fontSize:e.typography.pxToRem(10)},[`& .${oh.icon}`]:{fontSize:18,marginLeft:4,marginRight:-4},[`& .${oh.deleteIcon}`]:{fontSize:16,marginRight:4,marginLeft:-4}}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter(["contrastText"])).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main,color:(e.vars||e).palette[t].contrastText,[`& .${oh.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].contrastText,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].contrastText}}}})),{props:e=>e.iconColor===e.color,style:{[`& .${oh.icon}`]:{color:e.vars?e.vars.palette.Chip.defaultIconColor:t}}},{props:e=>e.iconColor===e.color&&"default"!==e.color,style:{[`& .${oh.icon}`]:{color:"inherit"}}},{props:{onDelete:!0},style:{[`&.${oh.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter(["dark"])).map(([t])=>({props:{color:t,onDelete:!0},style:{[`&.${oh.focusVisible}`]:{background:(e.vars||e).palette[t].dark}}})),{props:{clickable:!0},style:{userSelect:"none",WebkitTapHighlightColor:"transparent",cursor:"pointer","&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`)},[`&.${oh.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},"&:active":{boxShadow:(e.vars||e).shadows[1]}}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter(["dark"])).map(([t])=>({props:{color:t,clickable:!0},style:{[`&:hover, &.${oh.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark}}})),{props:{variant:"outlined"},style:{backgroundColor:"transparent",border:e.vars?`1px solid ${e.vars.palette.Chip.defaultBorder}`:`1px solid ${"light"===e.palette.mode?e.palette.grey[400]:e.palette.grey[700]}`,[`&.${oh.clickable}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${oh.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`& .${oh.avatar}`]:{marginLeft:4},[`& .${oh.icon}`]:{marginLeft:4},[`& .${oh.deleteIcon}`]:{marginRight:5}}},{props:{size:"small",variant:"outlined"},style:{[`& .${oh.avatar}`]:{marginLeft:2},[`& .${oh.icon}`]:{marginLeft:2},[`& .${oh.deleteIcon}`]:{marginRight:3}}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{variant:"outlined",color:t},style:{color:(e.vars||e).palette[t].main,border:`1px solid ${e.alpha((e.vars||e).palette[t].main,.7)}`,[`&.${oh.clickable}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)},[`&.${oh.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.focusOpacity)},[`& .${oh.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].main,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].main}}}}))]}})),ih=Fl("span",{name:"MuiChip",slot:"Label"})({overflow:"hidden",textOverflow:"ellipsis",paddingLeft:12,paddingRight:12,whiteSpace:"nowrap",variants:[{props:{variant:"outlined"},style:{paddingLeft:11,paddingRight:11}},{props:{size:"small"},style:{paddingLeft:8,paddingRight:8}},{props:{size:"small",variant:"outlined"},style:{paddingLeft:7,paddingRight:7}}]});function isDeleteKeyboardEvent(e){return"Backspace"===e.key||"Delete"===e.key}var sh=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiChip"}),{avatar:o,className:a,clickable:i,color:s="default",component:l,deleteIcon:d,disabled:u=!1,icon:p,label:m,onClick:h,onDelete:g,onKeyDown:y,onKeyUp:b,size:v="medium",variant:w="filled",tabIndex:S,skipFocusWhenDisabled:x=!1,slots:I={},slotProps:C={},...E}=n,{nativeButton:R,...k}=E,T=pc(c.useRef(null),t),handleDeleteIconClick=e=>{e.stopPropagation(),g(e)},handleKeyDown=e=>{e.currentTarget===e.target&&isDeleteKeyboardEvent(e)&&e.preventDefault(),y&&y(e)},handleKeyUp=e=>{e.currentTarget===e.target&&g&&isDeleteKeyboardEvent(e)&&g(e),b&&b(e)},M=!(!1===i||!h)||i,$=M||g?Lc:l||"div",N={...n,component:$,disabled:u,size:v,color:s,iconColor:c.isValidElement(p)&&p.props.color||s,onDelete:!!g,clickable:M,variant:w},P=useUtilityClasses$14(N),O=$===Lc?{component:l||"div",internalNativeButton:!1,focusVisibleClassName:P.focusVisible,...g&&{disableRipple:!0},...void 0!==R&&{nativeButton:R}}:{};let j=null;g&&(j=d&&c.isValidElement(d)?c.cloneElement(d,{className:clsx(d.props.className,P.deleteIcon),onClick:handleDeleteIconClick}):(0,ps.jsx)(nh,{className:P.deleteIcon,onClick:handleDeleteIconClick}));let F=null;o&&c.isValidElement(o)&&(F=c.cloneElement(o,{className:clsx(P.avatar,o.props.className)}));let L=null;p&&c.isValidElement(p)&&(L=c.cloneElement(p,{className:clsx(P.icon,p.props.className)}));const D={slots:I,slotProps:C},[B,G]=useSlot("root",{elementType:ah,externalForwardedProps:{...D,...k},ownerState:N,shouldForwardComponentProp:!0,ref:T,className:clsx(P.root,a),additionalProps:{disabled:!(!M||!u)||void 0,tabIndex:x&&u?-1:S,...O},getSlotProps:e=>({...e,onClick:t=>{e.onClick?.(t),h?.(t)},onKeyDown:t=>{e.onKeyDown?.(t),handleKeyDown(t)},onKeyUp:t=>{e.onKeyUp?.(t),handleKeyUp(t)}})}),[W,V]=useSlot("label",{elementType:ih,externalForwardedProps:D,ownerState:N,className:P.label});return(0,ps.jsxs)(B,{as:$,...G,children:[F||L,(0,ps.jsx)(W,{...V,children:m}),j]})}),lh=Object.freeze(["atavianWings","eagleWings","gare","universe"]);function AreaChipList({label:e,values:t,onChange:n}){const[o,a]=c.useState("");function handleAdd(){const e=o.trim();if(!e)return;const i=Number(e);!Number.isInteger(i)||i<=0||(t.includes(i)||n([...t,i]),a(""))}function handleDelete(e){n(t.filter(t=>t!==e))}function handleKeyDown(e){"Enter"===e.key&&(e.preventDefault(),handleAdd())}return(0,ps.jsxs)(Hl,{sx:{maxWidth:700,width:700},children:[(0,ps.jsx)(ep,{sx:{display:"block",mb:1},children:e}),(0,ps.jsxs)(Hl,{sx:{display:"flex",flexWrap:"wrap",gap:.5,mb:1.5},children:[t.map(e=>(0,ps.jsx)(sh,{label:`Area ${e}`,onDelete:()=>handleDelete(e),size:"small",sx:{bgcolor:"action.selected"}},e)),0===t.length&&(0,ps.jsx)(Jl,{variant:"caption",color:"text.secondary",children:"No area exclusions"})]}),(0,ps.jsxs)(Hl,{sx:{display:"flex",gap:1},children:[(0,ps.jsx)(Qm,{size:"small",placeholder:"Area ID",value:o,onChange:e=>a(e.target.value),onKeyDown:handleKeyDown,inputProps:{inputMode:"numeric",pattern:"[0-9]*"},sx:{width:110}}),(0,ps.jsx)(ad,{size:"small",variant:"outlined",onClick:handleAdd,children:"Add"})]})]})}function Exclusions({draft:e,patch:t}){return(0,ps.jsxs)(ps.Fragment,{children:[(0,ps.jsx)(Jl,{variant:"body2",color:"text.secondary",sx:{mb:4},children:"Prevent specific travel methods from routing through particular areas. Enter area IDs (numeric crowdmap IDs)."}),lh.map(n=>(0,ps.jsx)(AreaChipList,{label:eh[n]??n,values:e.travelClassAreaExclusions?.[n]??[],onChange:e=>t(t=>({travelClassAreaExclusions:{...t.travelClassAreaExclusions,[n]:e}}))},n))]})}var ch=createSvgIcon((0,ps.jsx)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"}),"CheckBoxOutlineBlank"),dh=createSvgIcon((0,ps.jsx)("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"}),"CheckBox"),uh=createSvgIcon((0,ps.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}),"IndeterminateCheckBox");function getCheckboxUtilityClass(e){return generateUtilityClass("MuiCheckbox",e)}var ph=generateUtilityClasses("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),useUtilityClasses$13=e=>{const{classes:t,indeterminate:n,color:o,size:a}=e,i=composeClasses({root:["root",n&&"indeterminate",`color${Zl(o)}`,`size${Zl(a)}`]},getCheckboxUtilityClass,t);return{...t,...i}},mh=Fl(Dm,{shouldForwardProp:e=>rootShouldForwardProp(e)||"classes"===e,name:"MuiCheckbox",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.indeterminate&&t.indeterminate,t[`size${Zl(n.size)}`],"default"!==n.color&&t[`color${Zl(n.color)}`]]}})(Kl(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(createSimplePaletteValueFilter()).map(([t])=>({props:{color:t},style:{[`&.${ph.checked}, &.${ph.indeterminate}`]:{color:(e.vars||e).palette[t].main},[`&.${ph.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),hh=(0,ps.jsx)(dh,{}),gh=(0,ps.jsx)(ch,{}),fh=(0,ps.jsx)(uh,{}),yh=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiCheckbox"}),{checkedIcon:o=hh,color:a="primary",icon:i=gh,indeterminate:s=!1,indeterminateIcon:l=fh,size:d="medium",disableRipple:u=!1,className:p,slots:m={},slotProps:h={},...g}=n,y=s?l:i,b=s?l:o,v={...n,disableRipple:u,color:a,indeterminate:s,size:d},w=useUtilityClasses$13(v),S=h.input,[x,I]=useSlot("root",{ref:t,elementType:mh,className:clsx(w.root,p),shouldForwardComponentProp:!0,externalForwardedProps:{slots:m,slotProps:h,...g},ownerState:v,additionalProps:{type:"checkbox",icon:c.cloneElement(y,{fontSize:y.props.fontSize??d}),checkedIcon:c.cloneElement(b,{fontSize:b.props.fontSize??d}),disableRipple:u,slots:m,slotProps:{input:mergeSlotProps$1("function"==typeof S?S(v):S,{"data-indeterminate":s,"aria-checked":s?"mixed":void 0})}}});return(0,ps.jsx)(x,{...I,classes:w})});function getFormGroupUtilityClass(e){return generateUtilityClass("MuiFormGroup",e)}generateUtilityClasses("MuiFormGroup",["root","row","error"]);var useUtilityClasses$12=e=>{const{classes:t,row:n,error:o}=e;return composeClasses({root:["root",n&&"row",o&&"error"]},getFormGroupUtilityClass,t)},bh=Fl("div",{name:"MuiFormGroup",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.row&&t.row]}})({display:"flex",flexDirection:"column",flexWrap:"wrap",variants:[{props:{row:!0},style:{flexDirection:"row"}}]}),vh=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiFormGroup"}),{className:o,row:a=!1,...i}=n,[s]=useFormControlState({props:n,states:["error"]}),l={...n,row:a,error:s.error};return(0,ps.jsx)(bh,{className:clsx(useUtilityClasses$12(l).root,o),ownerState:l,ref:t,...i})}),wh=deepFreeze$8([{city:"Ashtan",areaIds:[4,82,83],gateRoomIds:[12882]},{city:"Cyrene",areaIds:[12,86],gateRoomIds:[14516]},{city:"Eleusis",areaIds:[16,88],gateRoomIds:[2587]},{city:"Hashan",areaIds:[26,90],gateRoomIds:[8525]},{city:"Mhaldor",areaIds:[37,91],gateRoomIds:[10209]},{city:"Targossas",areaIds:[130,131],gateRoomIds:[51340]}]);function gateRoomIdsForCities(e){const t=new Set(e);return wh.filter(e=>t.has(e.city)).flatMap(e=>e.gateRoomIds)}function selectedCitiesFromExcludedRooms(e){const t=new Set(e);return wh.filter(e=>e.gateRoomIds.every(e=>t.has(e))).map(e=>e.city)}function CustomRoomsInput({values:e,onChange:t}){const[n,o]=c.useState("");function handleAdd(){const a=n.trim();if(!a)return;const i=Number(a);!Number.isInteger(i)||i<=0||(e.includes(i)||t([...e,i]),o(""))}function handleDelete(n){t(e.filter(e=>e!==n))}function handleKeyDown(e){"Enter"===e.key&&(e.preventDefault(),handleAdd())}return(0,ps.jsxs)(Hl,{sx:{mt:3,width:700},children:[(0,ps.jsx)(ep,{sx:{display:"block",mb:1},children:"Custom Excluded Rooms"}),(0,ps.jsxs)(Hl,{sx:{display:"flex",flexWrap:"wrap",gap:.5,mb:1.5},children:[e.map(e=>(0,ps.jsx)(sh,{label:`Room ${e}`,onDelete:()=>handleDelete(e),size:"small",sx:{bgcolor:"action.selected"}},e)),0===e.length&&(0,ps.jsx)(Jl,{variant:"caption",color:"text.secondary",children:"No custom rooms excluded"})]}),(0,ps.jsxs)(Hl,{sx:{display:"flex",gap:1},children:[(0,ps.jsx)(Qm,{size:"small",placeholder:"Room ID",value:n,onChange:e=>o(e.target.value),onKeyDown:handleKeyDown,inputProps:{inputMode:"numeric",pattern:"[0-9]*"},sx:{width:110}}),(0,ps.jsx)(ad,{size:"small",variant:"outlined",onClick:handleAdd,children:"Add"})]})]})}function Lockouts({draft:e,patch:t}){const n=selectedCitiesFromExcludedRooms(e.excludedRoomIds??[]),o=new Set(wh.flatMap(e=>e.gateRoomIds)),a=(e.excludedRoomIds??[]).filter(e=>!o.has(e));function handleCityToggle(o){const a=n.includes(o),i=wh.find(e=>e.city===o);if(!i)return;let s=[...e.excludedRoomIds??[]];if(a){const e=new Set(i.gateRoomIds);s=s.filter(t=>!e.has(t))}else for(const e of i.gateRoomIds)s.includes(e)||s.push(e);t(()=>({excludedRoomIds:s}))}function handleCustomRoomsChange(e){const o=gateRoomIdsForCities(n);t(()=>({excludedRoomIds:[...o,...e]}))}return(0,ps.jsxs)(ps.Fragment,{children:[(0,ps.jsx)(Jl,{variant:"body2",color:"text.secondary",sx:{mb:4},children:"Exclude city gate rooms so paths never route through hostile cities."}),(0,ps.jsx)(vh,{sx:{mb:3},children:wh.map(e=>(0,ps.jsx)(Yu,{control:(0,ps.jsx)(yh,{size:"small",checked:n.includes(e.city),onChange:()=>handleCityToggle(e.city)}),label:e.city,sx:{mb:.5}},e.city))}),(0,ps.jsx)(Wu,{sx:{my:3}}),(0,ps.jsx)(CustomRoomsInput,{values:a,onChange:handleCustomRoomsChange})]})}var Sh=Object.freeze(["eagleWings","atavianWings","islandWings","wormhole","sewergrate","airHarness","universe","knocker","gare","urn","pebble"]),xh=Object.freeze([{value:"hybridTrack",label:"Hybrid Track (batched path track segments)"},{value:"clientStep",label:"Client Step (one command per room)"}]),Ih={flex:1,flexBasis:0,minWidth:0};function PathingTravelTab({draft:e,patch:t}){const n=new Set(e.disabledTravelClasses??[]);function isTravelEnabled(e){return!n.has(e)}function toggleTravel(e){const o=new Set(n);o.has(e)?o.delete(e):o.add(e),t(()=>({disabledTravelClasses:[...o]}))}function toggleVibratingStick(){t(e=>({vibratingStick:!0!==e.vibratingStick}))}return(0,ps.jsxs)(Hl,{sx:{display:"flex",gap:4,alignItems:"flex-start",p:1.5},children:[(0,ps.jsxs)(Hl,{sx:Ih,children:[(0,ps.jsx)(SectionHeading,{children:"Pathing"}),(0,ps.jsxs)(Uu,{fullWidth:!0,sx:{mb:4},children:[(0,ps.jsx)(np,{id:"pathing-mode-label",children:"Pathing Mode"}),(0,ps.jsx)(Im,{labelId:"pathing-mode-label",value:e.pathingMode??"hybridTrack",label:"Pathing Mode",onChange:e=>t(()=>({pathingMode:e.target.value})),children:xh.map(e=>(0,ps.jsx)(yp,{value:e.value,children:e.label},e.value))})]}),(0,ps.jsx)(Qm,{label:"Command Separator",value:e.commandSeparator??"\\",onChange:e=>t(()=>({commandSeparator:e.target.value})),fullWidth:!0,size:"small",sx:{mb:4},helperText:"Character(s) used to join multiple commands sent to the MUD."}),(0,ps.jsxs)(Hl,{sx:{mb:4},children:[(0,ps.jsxs)(Jl,{gutterBottom:!0,children:["Celerity: ",(0,ps.jsx)("strong",{children:e.celerity??3})]}),(0,ps.jsx)(jm,{value:e.celerity??3,min:1,max:5,step:1,marks:!0,valueLabelDisplay:"auto",onChange:(e,n)=>t(()=>({celerity:n}))}),(0,ps.jsx)(Jl,{variant:"caption",color:"text.secondary",children:"Multiplier applied to movement cost when celerity is active. Higher = faster effective speed."})]}),(0,ps.jsx)(Wu,{sx:{my:4}}),(0,ps.jsx)(SectionHeading,{children:"Commands"}),(0,ps.jsx)(Jl,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"The MUD commands sent when using wing-based travel. Adjust to match your character's incantations."}),(0,ps.jsx)(Qm,{label:"Eagle Wings command",value:e.travelCommands?.eagleWings??"say duanathar",onChange:e=>t(t=>({travelCommands:{...t.travelCommands,eagleWings:e.target.value}})),fullWidth:!0,size:"small",sx:{mb:4}}),(0,ps.jsx)(Qm,{label:"Atavian Wings command",value:e.travelCommands?.atavianWings??"say duanatharan",onChange:e=>t(t=>({travelCommands:{...t.travelCommands,atavianWings:e.target.value}})),fullWidth:!0,size:"small",sx:{mb:4}}),(0,ps.jsx)(Qm,{label:"Island Wings command",value:e.travelCommands?.islandWings??"say duanatharic",onChange:e=>t(t=>({travelCommands:{...t.travelCommands,islandWings:e.target.value}})),fullWidth:!0,size:"small"})]}),(0,ps.jsxs)(Hl,{sx:Ih,children:[(0,ps.jsx)(SectionHeading,{children:"Travel Options"}),(0,ps.jsx)(Jl,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"Enable the travel methods available to your character. Disabled methods are excluded from pathfinding."}),(0,ps.jsx)(vh,{children:Sh.flatMap(t=>[(0,ps.jsx)(Yu,{control:(0,ps.jsx)(Um,{checked:isTravelEnabled(t),onChange:()=>toggleTravel(t),size:"small"}),label:eh[t]??t,sx:{mb:1.5}},t),"wormhole"===t?(0,ps.jsx)(Yu,{control:(0,ps.jsx)(yh,{checked:Boolean(e.vibratingStick),onChange:toggleVibratingStick,size:"small"}),label:"Vibrating Stick",sx:{mb:1.5,pl:3}},"vibratingStick"):null])})]})]})}function TabPanel({children:e,value:t,index:n}){return(0,ps.jsx)(Hl,{role:"tabpanel",hidden:t!==n,sx:{overflowY:"auto",flex:1,minHeight:0,pt:3},children:t===n&&e})}function SettingsDialog(){const{router:e,settingsApi:t,uiStore:n}=useNexMap(),o=useNexUiStore(),a=useNexMapSettings(),i=o?.settingsOpen??!1,[s,l]=c.useState(0),[d,u]=c.useState(null);function handleClose(){n?.setState({settingsOpen:!1}),d?.display?.zoom!==a?.display?.zoom&&a?.display?.zoom&&e?.execute?.("map.zoom",{zoom:a.display.zoom})}function handleSave(){t&&d&&(t.update(e=>mergeDraftIntoSettings(e,d),{persist:!0}),n?.setState({settingsOpen:!1}))}function patch(e){u(t=>t?{...t,...e(t)}:t)}return c.useEffect(()=>{i&&a&&(u(deepCloneSettings(a)),l(0))},[i,a]),d?(0,ps.jsx)(NexWindowDialog,{contentSx:{display:"flex",flexDirection:"column",minHeight:0},dialogProps:{maxWidth:!1},footer:(0,ps.jsxs)(Hl,{sx:e=>({borderTop:"1px solid",borderColor:"divider",display:"flex",gap:1,justifyContent:"flex-end",px:e.spacing(e.nexmap?.window?.footerPaddingX??2),py:e.spacing(e.nexmap?.window?.footerPaddingY??1.5)}),children:[(0,ps.jsx)(ad,{onClick:handleClose,color:"secondary",children:"Cancel"}),(0,ps.jsx)(ad,{onClick:handleSave,variant:"contained",color:"primary",children:"Save"})]}),headerContent:(0,ps.jsxs)(Rd,{value:s,onChange:(e,t)=>l(t),variant:"scrollable",scrollButtons:"auto",children:[(0,ps.jsx)(ud,{label:"Pathing & Travel"}),(0,ps.jsx)(ud,{label:"Display"}),(0,ps.jsx)(ud,{label:"City Lockouts"}),(0,ps.jsx)(ud,{label:"Area Exclusions"})]}),modal:!0,onClose:handleClose,open:i,paperSx:e=>({height:e.nexmap?.window?.settingsHeight??760,maxHeight:e.nexmap?.window?.settingsHeight??760,width:e.nexmap?.window?.settingsWidth??900}),showCloseButton:!1,title:"nexMap4 Settings",width:null,minWidth:null,children:(0,ps.jsxs)(Hl,{sx:{display:"flex",flex:1,flexDirection:"column",minHeight:0,px:3,py:0},children:[(0,ps.jsx)(TabPanel,{value:s,index:0,children:(0,ps.jsx)(PathingTravelTab,{draft:d,patch})}),(0,ps.jsx)(TabPanel,{value:s,index:1,children:(0,ps.jsx)(DisplayTab,{draft:d,patch})}),(0,ps.jsx)(TabPanel,{value:s,index:2,children:(0,ps.jsx)(Lockouts,{draft:d,patch})}),(0,ps.jsx)(TabPanel,{value:s,index:3,children:(0,ps.jsx)(Exclusions,{draft:d,patch})})]})}):null}function deepCloneSettings(e){return{...e,disabledTravelClasses:[...e.disabledTravelClasses??[]],display:{...e.display,background:{...e.display?.background??{}},roomBorderIndicators:{outdoor:{...e.display?.roomBorderIndicators?.outdoor??{}},wormhole:{...e.display?.roomBorderIndicators?.wormhole??{}}}},excludedRoomIds:[...e.excludedRoomIds??[]],landmarks:[...e.landmarks??[]],travelClassAreaExclusions:{atavianWings:[...e.travelClassAreaExclusions?.atavianWings??[]],eagleWings:[...e.travelClassAreaExclusions?.eagleWings??[]],gare:[...e.travelClassAreaExclusions?.gare??[]],universe:[...e.travelClassAreaExclusions?.universe??[]]},travelCommands:{...e.travelCommands??{}}}}function mergeDraftIntoSettings(e,t){return{...e,celerity:t.celerity,commandSeparator:t.commandSeparator,disabledTravelClasses:t.disabledTravelClasses,display:{...e.display,...t.display,background:{...e.display?.background??{},...t.display?.background??{}},roomBorderIndicators:{outdoor:{...e.display?.roomBorderIndicators?.outdoor??{},...t.display?.roomBorderIndicators?.outdoor??{}},wormhole:{...e.display?.roomBorderIndicators?.wormhole??{},...t.display?.roomBorderIndicators?.wormhole??{}}}},excludedRoomIds:t.excludedRoomIds,pathingMode:t.pathingMode,travelClassAreaExclusions:{...e.travelClassAreaExclusions??{},...t.travelClassAreaExclusions??{}},travelCommands:{...e.travelCommands??{},...t.travelCommands??{}},vibratingStick:!0===t.vibratingStick}}var Ch=c.createContext();function getTableUtilityClass(e){return generateUtilityClass("MuiTable",e)}generateUtilityClasses("MuiTable",["root","stickyHeader"]);var useUtilityClasses$11=e=>{const{classes:t,stickyHeader:n}=e;return composeClasses({root:["root",n&&"stickyHeader"]},getTableUtilityClass,t)},Eh=Fl("table",{name:"MuiTable",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.stickyHeader&&t.stickyHeader]}})(Kl(({theme:e})=>({display:"table",width:"100%",borderCollapse:"collapse",borderSpacing:0,"& caption":{...e.typography.body2,padding:e.spacing(2),color:(e.vars||e).palette.text.secondary,textAlign:"left",captionSide:"bottom"},variants:[{props:({ownerState:e})=>e.stickyHeader,style:{borderCollapse:"separate"}}]}))),Rh="table",kh=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTable"}),{className:o,component:a=Rh,padding:i="normal",size:s="medium",stickyHeader:l=!1,...d}=n,u={...n,component:a,padding:i,size:s,stickyHeader:l},p=useUtilityClasses$11(u),m=c.useMemo(()=>({padding:i,size:s,stickyHeader:l}),[i,s,l]);return(0,ps.jsx)(Ch.Provider,{value:m,children:(0,ps.jsx)(Eh,{as:a,role:a===Rh?null:"table",ref:t,className:clsx(p.root,o),ownerState:u,...d})})}),Ah=c.createContext();function getTableBodyUtilityClass(e){return generateUtilityClass("MuiTableBody",e)}generateUtilityClasses("MuiTableBody",["root"]);var useUtilityClasses$10=e=>{const{classes:t}=e;return composeClasses({root:["root"]},getTableBodyUtilityClass,t)},Th=Fl("tbody",{name:"MuiTableBody",slot:"Root"})({display:"table-row-group"}),Mh={variant:"body"},zh="tbody",$h=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTableBody"}),{className:o,component:a=zh,...i}=n,s={...n,component:a},l=useUtilityClasses$10(s);return(0,ps.jsx)(Ah.Provider,{value:Mh,children:(0,ps.jsx)(Th,{className:clsx(l.root,o),as:a,ref:t,role:a===zh?null:"rowgroup",ownerState:s,...i})})});function getTableCellUtilityClass(e){return generateUtilityClass("MuiTableCell",e)}var Nh=generateUtilityClasses("MuiTableCell",["root","head","body","footer","sizeSmall","sizeMedium","paddingCheckbox","paddingNone","alignLeft","alignCenter","alignRight","alignJustify","stickyHeader"]),useUtilityClasses$9=e=>{const{classes:t,variant:n,align:o,padding:a,size:i,stickyHeader:s}=e;return composeClasses({root:["root",n,s&&"stickyHeader","inherit"!==o&&`align${Zl(o)}`,"normal"!==a&&`padding${Zl(a)}`,`size${Zl(i)}`]},getTableCellUtilityClass,t)},Ph=Fl("td",{name:"MuiTableCell",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant],t[`size${Zl(n.size)}`],"normal"!==n.padding&&t[`padding${Zl(n.padding)}`],"inherit"!==n.align&&t[`align${Zl(n.align)}`],n.stickyHeader&&t.stickyHeader]}})(Kl(({theme:e})=>({...e.typography.body2,display:"table-cell",verticalAlign:"inherit",borderBottom:e.vars?`1px solid ${e.vars.palette.TableCell.border}`:`1px solid\n ${"light"===e.palette.mode?e.lighten(e.alpha(e.palette.divider,1),.88):e.darken(e.alpha(e.palette.divider,1),.68)}`,textAlign:"left",padding:16,variants:[{props:{variant:"head"},style:{color:(e.vars||e).palette.text.primary,lineHeight:e.typography.pxToRem(24),fontWeight:e.typography.fontWeightMedium}},{props:{variant:"body"},style:{color:(e.vars||e).palette.text.primary}},{props:{variant:"footer"},style:{color:(e.vars||e).palette.text.secondary,lineHeight:e.typography.pxToRem(21),fontSize:e.typography.pxToRem(12)}},{props:{size:"small"},style:{padding:"6px 16px",[`&.${Nh.paddingCheckbox}`]:{width:24,padding:"0 12px 0 16px","& > *":{padding:0}}}},{props:{padding:"checkbox"},style:{width:48,padding:"0 0 0 4px"}},{props:{padding:"none"},style:{padding:0}},{props:{align:"left"},style:{textAlign:"left"}},{props:{align:"center"},style:{textAlign:"center"}},{props:{align:"right"},style:{textAlign:"right",flexDirection:"row-reverse"}},{props:{align:"justify"},style:{textAlign:"justify"}},{props:({ownerState:e})=>e.stickyHeader,style:{position:"sticky",top:0,zIndex:2,backgroundColor:(e.vars||e).palette.background.default}}]}))),Oh=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTableCell"}),{align:o="inherit",className:a,component:i,padding:s,scope:l,size:d,sortDirection:u,variant:p,...m}=n,h=c.useContext(Ch),g=c.useContext(Ah),y=g&&"head"===g.variant;let b;b=i||(y?"th":"td");let v=l;"td"===b?v=void 0:!v&&y&&(v="col");const w=p||g&&g.variant,S={...n,align:o,component:b,padding:s||(h&&h.padding?h.padding:"normal"),size:d||(h&&h.size?h.size:"medium"),sortDirection:u,stickyHeader:"head"===w&&h&&h.stickyHeader,variant:w},x=useUtilityClasses$9(S);let I=null;return u&&(I="asc"===u?"ascending":"descending"),(0,ps.jsx)(Ph,{as:b,ref:t,className:clsx(x.root,a),"aria-sort":I,scope:v,ownerState:S,...m})});function getTableContainerUtilityClass(e){return generateUtilityClass("MuiTableContainer",e)}generateUtilityClasses("MuiTableContainer",["root"]);var useUtilityClasses$8=e=>{const{classes:t}=e;return composeClasses({root:["root"]},getTableContainerUtilityClass,t)},_h=Fl("div",{name:"MuiTableContainer",slot:"Root"})({width:"100%",overflowX:"auto"}),jh=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTableContainer"}),{className:o,component:a="div",...i}=n,s={...n,component:a};return(0,ps.jsx)(_h,{ref:t,as:a,className:clsx(useUtilityClasses$8(s).root,o),ownerState:s,...i})});function getTableHeadUtilityClass(e){return generateUtilityClass("MuiTableHead",e)}generateUtilityClasses("MuiTableHead",["root"]);var useUtilityClasses$7=e=>{const{classes:t}=e;return composeClasses({root:["root"]},getTableHeadUtilityClass,t)},Fh=Fl("thead",{name:"MuiTableHead",slot:"Root"})({display:"table-header-group"}),Lh={variant:"head"},Dh="thead",Bh=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTableHead"}),{className:o,component:a=Dh,...i}=n,s={...n,component:a},l=useUtilityClasses$7(s);return(0,ps.jsx)(Ah.Provider,{value:Lh,children:(0,ps.jsx)(Fh,{as:a,className:clsx(l.root,o),ref:t,role:a===Dh?null:"rowgroup",ownerState:s,...i})})});function getTableRowUtilityClass(e){return generateUtilityClass("MuiTableRow",e)}var Gh=generateUtilityClasses("MuiTableRow",["root","selected","hover","head","footer"]),useUtilityClasses$6=e=>{const{classes:t,selected:n,hover:o,head:a,footer:i}=e;return composeClasses({root:["root",n&&"selected",o&&"hover",a&&"head",i&&"footer"]},getTableRowUtilityClass,t)},Wh=Fl("tr",{name:"MuiTableRow",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.head&&t.head,n.footer&&t.footer]}})(Kl(({theme:e})=>({color:"inherit",display:"table-row",verticalAlign:"middle",outline:0,[`&.${Gh.hover}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${Gh.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`)}}}))),Vh="tr",Hh=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTableRow"}),{className:o,component:a=Vh,hover:i=!1,selected:s=!1,...l}=n,d=c.useContext(Ah),u={...n,component:a,hover:i,selected:s,head:d&&"head"===d.variant,footer:d&&"footer"===d.variant};return(0,ps.jsx)(Wh,{as:a,ref:t,className:clsx(useUtilityClasses$6(u).root,o),role:a===Vh?null:"row",ownerState:u,...l})}),Uh=createSvgIcon((0,ps.jsx)("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}),"ArrowDownward");function getTableSortLabelUtilityClass(e){return generateUtilityClass("MuiTableSortLabel",e)}var qh=generateUtilityClasses("MuiTableSortLabel",["root","active","icon","directionDesc","directionAsc"]),useUtilityClasses$5=e=>{const{classes:t,direction:n,active:o}=e;return composeClasses({root:["root",o&&"active",`direction${Zl(n)}`],icon:["icon"]},getTableSortLabelUtilityClass,t)},Kh=Fl(Lc,{name:"MuiTableSortLabel",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,n.active&&t.active]}})(Kl(({theme:e})=>({cursor:"pointer",display:"inline-flex",justifyContent:"flex-start",flexDirection:"inherit",alignItems:"center","&:focus":{color:(e.vars||e).palette.text.secondary},"&:hover":{color:(e.vars||e).palette.text.secondary,[`& .${qh.icon}`]:{opacity:.5}},[`&.${qh.active}`]:{color:(e.vars||e).palette.text.primary,[`& .${qh.icon}`]:{opacity:1,color:(e.vars||e).palette.text.secondary}}}))),Zh=Fl("span",{name:"MuiTableSortLabel",slot:"Icon"})(Kl(({theme:e})=>({fontSize:18,marginRight:4,marginLeft:4,opacity:0,transition:e.transitions.create(["opacity","transform"],{duration:e.transitions.duration.shorter}),userSelect:"none",variants:[{props:{direction:"desc"},style:{transform:"rotate(0deg)"}},{props:{direction:"asc"},style:{transform:"rotate(180deg)"}}]}))),Yh=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiTableSortLabel"}),{active:o=!1,children:a,className:i,direction:s="asc",hideSortIcon:l=!1,IconComponent:c=Uh,slots:d={},slotProps:u={},...p}=n,m={...n,active:o,direction:s,hideSortIcon:l,IconComponent:c},h=useUtilityClasses$5(m),g={slots:d,slotProps:u},[y,b]=useSlot("root",{elementType:Kh,externalForwardedProps:g,ownerState:m,className:clsx(h.root,i),ref:t,additionalProps:{internalNativeButton:!1}}),[v,w]=useSlot("icon",{elementType:Zh,externalForwardedProps:g,ownerState:m,className:h.icon});return(0,ps.jsxs)(y,{disableRipple:!0,component:"span",...b,...p,children:[a,l&&!o?null:(0,ps.jsx)(v,{as:c,...w})]})});function createColumnHelper(){return{accessor:(e,t)=>"function"==typeof e?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function functionalUpdate(e,t){return"function"==typeof e?e(t):e}function makeStateUpdater(e,t){return n=>{t.setState(t=>({...t,[e]:functionalUpdate(n,t[e])}))}}function isFunction(e){return e instanceof Function}function isNumberArray(e){return Array.isArray(e)&&e.every(e=>"number"==typeof e)}function flattenBy(e,t){const n=[],recurse=e=>{e.forEach(e=>{n.push(e);const o=t(e);null!=o&&o.length&&recurse(o)})};return recurse(e),n}function memo$1(e,t,n){let o,a=[];return i=>{let s;n.key&&n.debug&&(s=Date.now());const l=e(i);if(l.length===a.length&&!l.some((e,t)=>a[t]!==e))return o;let c;if(a=l,n.key&&n.debug&&(c=Date.now()),o=t(...l),null==n||null==n.onChange||n.onChange(o),n.key&&n.debug&&null!=n&&n.debug()){const e=Math.round(100*(Date.now()-s))/100,t=Math.round(100*(Date.now()-c))/100,o=t/16,pad=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${pad(t,5)} /${pad(e,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*o,120))}deg 100% 31%);`,null==n?void 0:n.key)}return o}}function getMemoOptions(e,t,n,o){return{debug:()=>{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:o}}function createCell(e,t,n,o){const getRenderValue=()=>{var t;return null!=(t=a.getValue())?t:e.options.renderFallbackValue},a={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(o),renderValue:getRenderValue,getContext:memo$1(()=>[e,n,t,a],(e,t,n,o)=>({table:e,column:t,row:n,cell:o,getValue:o.getValue,renderValue:o.renderValue}),getMemoOptions(e.options,"debugCells","cell.getContext"))};return e._features.forEach(o=>{null==o.createCell||o.createCell(a,n,t,e)},{}),a}function createColumn(e,t,n,o){var a,i;const s={...e._getDefaultColumnDef(),...t},l=s.accessorKey;let c,d=null!=(a=null!=(i=s.id)?i:l?"function"==typeof String.prototype.replaceAll?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)?a:"string"==typeof s.header?s.header:void 0;if(s.accessorFn?c=s.accessorFn:l&&(c=l.includes(".")?e=>{let t=e;for(const o of l.split(".")){var n;t=null==(n=t)?void 0:n[o]}return t}:e=>e[s.accessorKey]),!d)throw new Error;let u={id:`${String(d)}`,accessorFn:c,parent:o,depth:n,columnDef:s,columns:[],getFlatColumns:memo$1(()=>[!0],()=>{var e;return[u,...null==(e=u.columns)?void 0:e.flatMap(e=>e.getFlatColumns())]},getMemoOptions(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:memo$1(()=>[e._getOrderColumnsFn()],e=>{var t;return null!=(t=u.columns)&&t.length?e(u.columns.flatMap(e=>e.getLeafColumns())):[u]},getMemoOptions(e.options,"debugColumns","column.getLeafColumns"))};for(const p of e._features)null==p.createColumn||p.createColumn(u,e);return u}var Xh="debugHeaders";function createHeader(e,t,n){var o;let a={id:null!=(o=n.id)?o:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const e=[],recurseHeader=t=>{t.subHeaders&&t.subHeaders.length&&t.subHeaders.map(recurseHeader),e.push(t)};return recurseHeader(a),e},getContext:()=>({table:e,header:a,column:t})};return e._features.forEach(t=>{null==t.createHeader||t.createHeader(a,e)}),a}var Jh={createTable:e=>{e.getHeaderGroups=memo$1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,o,a)=>{var i,s;const l=null!=(i=null==o?void 0:o.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],c=null!=(s=null==a?void 0:a.map(e=>n.find(t=>t.id===e)).filter(Boolean))?s:[],d=n.filter(e=>!(null!=o&&o.includes(e.id)||null!=a&&a.includes(e.id)));return buildHeaderGroups(t,[...l,...d,...c],e)},getMemoOptions(e.options,Xh,"getHeaderGroups")),e.getCenterHeaderGroups=memo$1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,o,a)=>(n=n.filter(e=>!(null!=o&&o.includes(e.id)||null!=a&&a.includes(e.id))),buildHeaderGroups(t,n,e,"center")),getMemoOptions(e.options,Xh,"getCenterHeaderGroups")),e.getLeftHeaderGroups=memo$1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,o)=>{var a;return buildHeaderGroups(t,null!=(a=null==o?void 0:o.map(e=>n.find(t=>t.id===e)).filter(Boolean))?a:[],e,"left")},getMemoOptions(e.options,Xh,"getLeftHeaderGroups")),e.getRightHeaderGroups=memo$1(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,o)=>{var a;return buildHeaderGroups(t,null!=(a=null==o?void 0:o.map(e=>n.find(t=>t.id===e)).filter(Boolean))?a:[],e,"right")},getMemoOptions(e.options,Xh,"getRightHeaderGroups")),e.getFooterGroups=memo$1(()=>[e.getHeaderGroups()],e=>[...e].reverse(),getMemoOptions(e.options,Xh,"getFooterGroups")),e.getLeftFooterGroups=memo$1(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),getMemoOptions(e.options,Xh,"getLeftFooterGroups")),e.getCenterFooterGroups=memo$1(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),getMemoOptions(e.options,Xh,"getCenterFooterGroups")),e.getRightFooterGroups=memo$1(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),getMemoOptions(e.options,Xh,"getRightFooterGroups")),e.getFlatHeaders=memo$1(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),getMemoOptions(e.options,Xh,"getFlatHeaders")),e.getLeftFlatHeaders=memo$1(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),getMemoOptions(e.options,Xh,"getLeftFlatHeaders")),e.getCenterFlatHeaders=memo$1(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),getMemoOptions(e.options,Xh,"getCenterFlatHeaders")),e.getRightFlatHeaders=memo$1(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),getMemoOptions(e.options,Xh,"getRightFlatHeaders")),e.getCenterLeafHeaders=memo$1(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),getMemoOptions(e.options,Xh,"getCenterLeafHeaders")),e.getLeftLeafHeaders=memo$1(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),getMemoOptions(e.options,Xh,"getLeftLeafHeaders")),e.getRightLeafHeaders=memo$1(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),getMemoOptions(e.options,Xh,"getRightLeafHeaders")),e.getLeafHeaders=memo$1(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>{var o,a,i,s,l,c;return[...null!=(o=null==(a=e[0])?void 0:a.headers)?o:[],...null!=(i=null==(s=t[0])?void 0:s.headers)?i:[],...null!=(l=null==(c=n[0])?void 0:c.headers)?l:[]].map(e=>e.getLeafHeaders()).flat()},getMemoOptions(e.options,Xh,"getLeafHeaders"))}};function buildHeaderGroups(e,t,n,o){var a,i;let s=0;const findMaxDepth=function(e,t){void 0===t&&(t=1),s=Math.max(s,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;null!=(n=e.columns)&&n.length&&findMaxDepth(e.columns,t+1)},0)};findMaxDepth(e);let l=[];const createHeaderGroup=(e,t)=>{const a={depth:t,id:[o,`${t}`].filter(Boolean).join("_"),headers:[]},i=[];e.forEach(e=>{const s=[...i].reverse()[0];let l,c=!1;if(e.column.depth===a.depth&&e.column.parent?l=e.column.parent:(l=e.column,c=!0),s&&(null==s?void 0:s.column)===l)s.subHeaders.push(e);else{const a=createHeader(n,l,{id:[o,t,l.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:c,placeholderId:c?`${i.filter(e=>e.column===l).length}`:void 0,depth:t,index:i.length});a.subHeaders.push(e),i.push(a)}a.headers.push(e),e.headerGroup=a}),l.push(a),t>0&&createHeaderGroup(i,t-1)};createHeaderGroup(t.map((e,t)=>createHeader(n,e,{depth:s,index:t})),s-1),l.reverse();const recurseHeadersForSpans=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,o=[0];return e.subHeaders&&e.subHeaders.length?(o=[],recurseHeadersForSpans(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:a}=e;t+=n,o.push(a)})):t=1,n+=Math.min(...o),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return recurseHeadersForSpans(null!=(a=null==(i=l[0])?void 0:i.headers)?a:[]),l}var createRow=(e,t,n,o,a,i,s)=>{let l={id:t,index:o,original:n,depth:a,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(l._valuesCache.hasOwnProperty(t))return l._valuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?(l._valuesCache[t]=n.accessorFn(l.original,o),l._valuesCache[t]):void 0},getUniqueValues:t=>{if(l._uniqueValuesCache.hasOwnProperty(t))return l._uniqueValuesCache[t];const n=e.getColumn(t);return null!=n&&n.accessorFn?n.columnDef.getUniqueValues?(l._uniqueValuesCache[t]=n.columnDef.getUniqueValues(l.original,o),l._uniqueValuesCache[t]):(l._uniqueValuesCache[t]=[l.getValue(t)],l._uniqueValuesCache[t]):void 0},renderValue:t=>{var n;return null!=(n=l.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=i?i:[],getLeafRows:()=>flattenBy(l.subRows,e=>e.subRows),getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let e=[],t=l;for(;;){const n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:memo$1(()=>[e.getAllLeafColumns()],t=>t.map(t=>createCell(e,l,t,t.id)),getMemoOptions(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:memo$1(()=>[l.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),getMemoOptions(e.options,"debugRows","getAllCellsByColumnId"))};for(let c=0;c<e._features.length;c++){const t=e._features[c];null==t||null==t.createRow||t.createRow(l,e)}return l},Qh={createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},includesString=(e,t,n)=>{var o,a;const i=null==n||null==(o=n.toString())?void 0:o.toLowerCase();return Boolean(null==(a=e.getValue(t))||null==(a=a.toString())||null==(a=a.toLowerCase())?void 0:a.includes(i))};includesString.autoRemove=e=>testFalsey(e);var includesStringSensitive=(e,t,n)=>{var o;return Boolean(null==(o=e.getValue(t))||null==(o=o.toString())?void 0:o.includes(n))};includesStringSensitive.autoRemove=e=>testFalsey(e);var equalsString=(e,t,n)=>{var o;return(null==(o=e.getValue(t))||null==(o=o.toString())?void 0:o.toLowerCase())===(null==n?void 0:n.toLowerCase())};equalsString.autoRemove=e=>testFalsey(e);var arrIncludes=(e,t,n)=>{var o;return null==(o=e.getValue(t))?void 0:o.includes(n)};arrIncludes.autoRemove=e=>testFalsey(e);var arrIncludesAll=(e,t,n)=>!n.some(n=>{var o;return!(null!=(o=e.getValue(t))&&o.includes(n))});arrIncludesAll.autoRemove=e=>testFalsey(e)||!(null!=e&&e.length);var arrIncludesSome=(e,t,n)=>n.some(n=>{var o;return null==(o=e.getValue(t))?void 0:o.includes(n)});arrIncludesSome.autoRemove=e=>testFalsey(e)||!(null!=e&&e.length);var equals=(e,t,n)=>e.getValue(t)===n;equals.autoRemove=e=>testFalsey(e);var weakEquals=(e,t,n)=>e.getValue(t)==n;weakEquals.autoRemove=e=>testFalsey(e);var inNumberRange=(e,t,n)=>{let[o,a]=n;const i=e.getValue(t);return i>=o&&i<=a};inNumberRange.resolveFilterValue=e=>{let[t,n]=e,o="number"!=typeof t?parseFloat(t):t,a="number"!=typeof n?parseFloat(n):n,i=null===t||Number.isNaN(o)?-1/0:o,s=null===n||Number.isNaN(a)?1/0:a;if(i>s){const e=i;i=s,s=e}return[i,s]},inNumberRange.autoRemove=e=>testFalsey(e)||testFalsey(e[0])&&testFalsey(e[1]);var eg={includesString,includesStringSensitive,equalsString,arrIncludes,arrIncludesAll,arrIncludesSome,equals,weakEquals,inNumberRange};function testFalsey(e){return null==e||""===e}var tg={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:makeStateUpdater("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],o=null==n?void 0:n.getValue(e.id);return"string"==typeof o?eg.includesString:"number"==typeof o?eg.inNumberRange:"boolean"==typeof o||null!==o&&"object"==typeof o?eg.equals:Array.isArray(o)?eg.arrIncludes:eg.weakEquals},e.getFilterFn=()=>{var n,o;return isFunction(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(n=null==(o=t.options.filterFns)?void 0:o[e.columnDef.filterFn])?n:eg[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,o,a;return(null==(n=e.columnDef.enableColumnFilter)||n)&&(null==(o=t.options.enableColumnFilters)||o)&&(null==(a=t.options.enableFilters)||a)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return null==(n=t.getState().columnFilters)||null==(n=n.find(t=>t.id===e.id))?void 0:n.value},e.getFilterIndex=()=>{var n,o;return null!=(n=null==(o=t.getState().columnFilters)?void 0:o.findIndex(t=>t.id===e.id))?n:-1},e.setFilterValue=n=>{t.setColumnFilters(t=>{const o=e.getFilterFn(),a=null==t?void 0:t.find(t=>t.id===e.id),i=functionalUpdate(n,a?a.value:void 0);var s;if(shouldAutoRemoveFilter(o,i,e))return null!=(s=null==t?void 0:t.filter(t=>t.id!==e.id))?s:[];const l={id:e.id,value:i};var c;return a?null!=(c=null==t?void 0:t.map(t=>t.id===e.id?l:t))?c:[]:null!=t&&t.length?[...t,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),updateFn=e=>{var o;return null==(o=functionalUpdate(t,e))?void 0:o.filter(e=>{const t=n.find(t=>t.id===e.id);return!t||!shouldAutoRemoveFilter(t.getFilterFn(),e.value,t)})};null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange(updateFn)},e.resetColumnFilters=t=>{var n,o;e.setColumnFilters(t?[]:null!=(n=null==(o=e.initialState)?void 0:o.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function shouldAutoRemoveFilter(e,t,n){return!(!e||!e.autoRemove)&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}var sum=(e,t,n)=>n.reduce((t,n)=>{const o=n.getValue(e);return t+("number"==typeof o?o:0)},0),mean=(e,t)=>{let n=0,o=0;if(t.forEach(t=>{let a=t.getValue(e);null!=a&&(a=+a)>=a&&(++n,o+=a)}),n)return o/n},median=(e,t)=>{if(!t.length)return;const n=t.map(t=>t.getValue(e));if(!isNumberArray(n))return;if(1===n.length)return n[0];const o=Math.floor(n.length/2),a=n.sort((e,t)=>e-t);return n.length%2!=0?a[o]:(a[o-1]+a[o])/2},rg={sum,min:(e,t,n)=>{let o;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(o>n||void 0===o&&n>=n)&&(o=n)}),o},max:(e,t,n)=>{let o;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(o<n||void 0===o&&n>=n)&&(o=n)}),o},extent:(e,t,n)=>{let o,a;return n.forEach(t=>{const n=t.getValue(e);null!=n&&(void 0===o?n>=n&&(o=a=n):(o>n&&(o=n),a<n&&(a=n)))}),[o,a]},mean,median,unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},ng={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:makeStateUpdater("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>null!=t&&t.includes(e.id)?t.filter(t=>t!==e.id):[...null!=t?t:[],e.id])},e.getCanGroup=()=>{var n,o;return(null==(n=e.columnDef.enableGrouping)||n)&&(null==(o=t.options.enableGrouping)||o)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],o=null==n?void 0:n.getValue(e.id);return"number"==typeof o?rg.sum:"[object Date]"===Object.prototype.toString.call(o)?rg.extent:void 0},e.getAggregationFn=()=>{var n,o;if(!e)throw new Error;return isFunction(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(o=t.options.aggregationFns)?void 0:o[e.columnDef.aggregationFn])?n:rg[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,o;e.setGrouping(t?[]:null!=(n=null==(o=e.initialState)?void 0:o.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const o=t.getColumn(n);return null!=o&&o.columnDef.getGroupingValue?(e._groupingValuesCache[n]=o.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,o)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!(null==(t=n.subRows)||!t.length)}}};function orderColumns(e,t,n){if(null==t||!t.length||!n)return e;const o=e.filter(e=>!t.includes(e.id));return"remove"===n?o:[...t.map(t=>e.find(e=>e.id===t)).filter(Boolean),...o]}var og={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:makeStateUpdater("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=memo$1(e=>[_getVisibleLeafColumns(t,e)],t=>t.findIndex(t=>t.id===e.id),getMemoOptions(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=n=>{var o;return(null==(o=_getVisibleLeafColumns(t,n)[0])?void 0:o.id)===e.id},e.getIsLastColumn=n=>{var o;const a=_getVisibleLeafColumns(t,n);return(null==(o=a[a.length-1])?void 0:o.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=memo$1(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>o=>{let a=[];if(null!=e&&e.length){const t=[...e],n=[...o];for(;n.length&&t.length;){const e=t.shift(),o=n.findIndex(t=>t.id===e);o>-1&&a.push(n.splice(o,1)[0])}a=[...a,...n]}else a=o;return orderColumns(a,t,n)},getMemoOptions(e.options,"debugTable","_getOrderColumnsFn"))}},getDefaultColumnPinningState=()=>({left:[],right:[]}),ag={getInitialState:e=>({columnPinning:getDefaultColumnPinningState(),...e}),getDefaultOptions:e=>({onColumnPinningChange:makeStateUpdater("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const o=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>{var t,a,i,s,l,c;return"right"===n?{left:(null!=(i=null==e?void 0:e.left)?i:[]).filter(e=>!(null!=o&&o.includes(e))),right:[...(null!=(s=null==e?void 0:e.right)?s:[]).filter(e=>!(null!=o&&o.includes(e))),...o]}:"left"===n?{left:[...(null!=(l=null==e?void 0:e.left)?l:[]).filter(e=>!(null!=o&&o.includes(e))),...o],right:(null!=(c=null==e?void 0:e.right)?c:[]).filter(e=>!(null!=o&&o.includes(e)))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter(e=>!(null!=o&&o.includes(e))),right:(null!=(a=null==e?void 0:e.right)?a:[]).filter(e=>!(null!=o&&o.includes(e)))}})},e.getCanPin=()=>e.getLeafColumns().some(e=>{var n,o,a;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(o=null!=(a=t.options.enableColumnPinning)?a:t.options.enablePinning)||o)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(e=>e.id),{left:o,right:a}=t.getState().columnPinning,i=n.some(e=>null==o?void 0:o.includes(e)),s=n.some(e=>null==a?void 0:a.includes(e));return i?"left":!!s&&"right"},e.getPinnedIndex=()=>{var n,o;const a=e.getIsPinned();return a?null!=(n=null==(o=t.getState().columnPinning)||null==(o=o[a])?void 0:o.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=memo$1(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{const o=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!o.includes(e.column.id))},getMemoOptions(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=memo$1(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"left"})),getMemoOptions(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=memo$1(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"right"})),getMemoOptions(t.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,o;return e.setColumnPinning(t?getDefaultColumnPinningState():null!=(n=null==(o=e.initialState)?void 0:o.columnPinning)?n:getDefaultColumnPinningState())},e.getIsSomeColumnsPinned=t=>{var n;const o=e.getState().columnPinning;var a,i;return t?Boolean(null==(n=o[t])?void 0:n.length):Boolean((null==(a=o.left)?void 0:a.length)||(null==(i=o.right)?void 0:i.length))},e.getLeftLeafColumns=memo$1(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),getMemoOptions(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=memo$1(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),getMemoOptions(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=memo$1(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{const o=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!o.includes(e.id))},getMemoOptions(e.options,"debugColumns","getCenterLeafColumns"))}};function safelyAccessDocument(e){return e||("undefined"!=typeof document?document:null)}var ig={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},getDefaultColumnSizingInfoState=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),sg={getDefaultColumnDef:()=>ig,getInitialState:e=>({columnSizing:{},columnSizingInfo:getDefaultColumnSizingInfoState(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:makeStateUpdater("columnSizing",e),onColumnSizingInfoChange:makeStateUpdater("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,o,a;const i=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:ig.minSize,null!=(o=null!=i?i:e.columnDef.size)?o:ig.size),null!=(a=e.columnDef.maxSize)?a:ig.maxSize)},e.getStart=memo$1(e=>[e,_getVisibleLeafColumns(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),getMemoOptions(t.options,"debugColumns","getStart")),e.getAfter=memo$1(e=>[e,_getVisibleLeafColumns(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),getMemoOptions(t.options,"debugColumns","getAfter")),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...o}=t;return o})},e.getCanResize=()=>{var n,o;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(o=t.options.enableColumnResizing)||o)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0;const recurse=e=>{var n;e.subHeaders.length?e.subHeaders.forEach(recurse):t+=null!=(n=e.column.getSize())?n:0};return recurse(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{const o=t.getColumn(e.column.id),a=null==o?void 0:o.getCanResize();return i=>{if(!o||!a)return;if(null==i.persist||i.persist(),isTouchStartEvent(i)&&i.touches&&i.touches.length>1)return;const s=e.getSize(),l=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[o.id,o.getSize()]],c=isTouchStartEvent(i)?Math.round(i.touches[0].clientX):i.clientX,d={},updateOffset=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo(e=>{var o,a;const i="rtl"===t.options.columnResizeDirection?-1:1,s=(n-(null!=(o=null==e?void 0:e.startOffset)?o:0))*i,l=Math.max(s/(null!=(a=null==e?void 0:e.startSize)?a:0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;d[t]=Math.round(100*Math.max(n+n*l,0))/100}),{...e,deltaOffset:s,deltaPercentage:l}}),"onChange"!==t.options.columnResizeMode&&"end"!==e||t.setColumnSizing(e=>({...e,...d})))},onMove=e=>updateOffset("move",e),onEnd=e=>{updateOffset("end",e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},u=safelyAccessDocument(n),p={moveHandler:e=>onMove(e.clientX),upHandler:e=>{u?.removeEventListener("mousemove",p.moveHandler),u?.removeEventListener("mouseup",p.upHandler),onEnd(e.clientX)}},m={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),onMove(e.touches[0].clientX),!1),upHandler:e=>{var t;u?.removeEventListener("touchmove",m.moveHandler),u?.removeEventListener("touchend",m.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),onEnd(null==(t=e.touches[0])?void 0:t.clientX)}},h=!!passiveEventSupported()&&{passive:!1};isTouchStartEvent(i)?(u?.addEventListener("touchmove",m.moveHandler,h),u?.addEventListener("touchend",m.upHandler,h)):(u?.addEventListener("mousemove",p.moveHandler,h),u?.addEventListener("mouseup",p.upHandler,h)),t.setColumnSizingInfo(e=>({...e,startOffset:c,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:o.id}))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?getDefaultColumnSizingInfoState():null!=(n=e.initialState.columnSizingInfo)?n:getDefaultColumnSizingInfoState())},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0}}},lg=null;function passiveEventSupported(){if("boolean"==typeof lg)return lg;let e=!1;try{const t={get passive(){return e=!0,!1}},noop=()=>{};window.addEventListener("test",noop,t),window.removeEventListener("test",noop)}catch(t){e=!1}return lg=e}function isTouchStartEvent(e){return"touchstart"===e.type}var cg={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:makeStateUpdater("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()}))},e.getIsVisible=()=>{var n,o;const a=e.columns;return null==(n=a.length?a.some(e=>e.getIsVisible()):null==(o=t.getState().columnVisibility)?void 0:o[e.id])||n},e.getCanHide=()=>{var n,o;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(o=t.options.enableHiding)||o)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=memo$1(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),getMemoOptions(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=memo$1(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],getMemoOptions(t.options,"debugRows","getVisibleCells"))},createTable:e=>{const makeVisibleColumnsMethod=(t,n)=>memo$1(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join("_")],e=>e.filter(e=>null==e.getIsVisible?void 0:e.getIsVisible()),getMemoOptions(e.options,"debugColumns",t));e.getVisibleFlatColumns=makeVisibleColumnsMethod("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=makeVisibleColumnsMethod("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=makeVisibleColumnsMethod("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=makeVisibleColumnsMethod("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=makeVisibleColumnsMethod("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(null!=e.getIsVisible&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>null==e.getIsVisible?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}};function _getVisibleLeafColumns(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}var dg={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:makeStateUpdater("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const o=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof o||"number"==typeof o}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,o,a,i;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(o=t.options.enableGlobalFilter)||o)&&(null==(a=t.options.enableFilters)||a)&&(null==(i=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||i)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>eg.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:o}=e.options;return isFunction(o)?o:"auto"===o?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[o])?t:eg[o]},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},ug=0,pg=10,getDefaultPaginationState=()=>({pageIndex:ug,pageSize:pg}),getDefaultRowPinningState=()=>({top:[],bottom:[]}),mg={getInitialState:e=>({rowPinning:getDefaultRowPinningState(),...e}),getDefaultOptions:e=>({onRowPinningChange:makeStateUpdater("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,o,a)=>{const i=o?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],s=a?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],l=new Set([...s,e.id,...i]);t.setRowPinning(e=>{var t,o,a,i,s,c;return"bottom"===n?{top:(null!=(a=null==e?void 0:e.top)?a:[]).filter(e=>!(null!=l&&l.has(e))),bottom:[...(null!=(i=null==e?void 0:e.bottom)?i:[]).filter(e=>!(null!=l&&l.has(e))),...Array.from(l)]}:"top"===n?{top:[...(null!=(s=null==e?void 0:e.top)?s:[]).filter(e=>!(null!=l&&l.has(e))),...Array.from(l)],bottom:(null!=(c=null==e?void 0:e.bottom)?c:[]).filter(e=>!(null!=l&&l.has(e)))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter(e=>!(null!=l&&l.has(e))),bottom:(null!=(o=null==e?void 0:e.bottom)?o:[]).filter(e=>!(null!=l&&l.has(e)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:o,enablePinning:a}=t.options;return"function"==typeof o?o(e):null==(n=null!=o?o:a)||n},e.getIsPinned=()=>{const n=[e.id],{top:o,bottom:a}=t.getState().rowPinning,i=n.some(e=>null==o?void 0:o.includes(e)),s=n.some(e=>null==a?void 0:a.includes(e));return i?"top":!!s&&"bottom"},e.getPinnedIndex=()=>{var n,o;const a=e.getIsPinned();if(!a)return-1;const i=null==(n="top"===a?t.getTopRows():t.getBottomRows())?void 0:n.map(e=>{let{id:t}=e;return t});return null!=(o=null==i?void 0:i.indexOf(e.id))?o:-1}},createTable:e=>{e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,o;return e.setRowPinning(t?getDefaultRowPinningState():null!=(n=null==(o=e.initialState)?void 0:o.rowPinning)?n:getDefaultRowPinningState())},e.getIsSomeRowsPinned=t=>{var n;const o=e.getState().rowPinning;var a,i;return t?Boolean(null==(n=o[t])?void 0:n.length):Boolean((null==(a=o.top)?void 0:a.length)||(null==(i=o.bottom)?void 0:i.length))},e._getPinnedRows=(t,n,o)=>{var a;return(null==(a=e.options.keepPinnedRows)||a?(null!=n?n:[]).map(t=>{const n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(null!=n?n:[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:o}))},e.getTopRows=memo$1(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),getMemoOptions(e.options,"debugRows","getTopRows")),e.getBottomRows=memo$1(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),getMemoOptions(e.options,"debugRows","getBottomRows")),e.getCenterRows=memo$1(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{const o=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter(e=>!o.has(e.id))},getMemoOptions(e.options,"debugRows","getCenterRows"))}},hg={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:makeStateUpdater("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();const o={...n},a=e.getPreGroupedRowModel().flatRows;return t?a.forEach(e=>{e.getCanSelect()&&(o[e.id]=!0)}):a.forEach(e=>{delete o[e.id]}),o})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const o=void 0!==t?t:!e.getIsAllPageRowsSelected(),a={...n};return e.getRowModel().rows.forEach(t=>{mutateRowIsSelected(a,t.id,o,!0,e)}),a}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=memo$1(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?selectRowsFn(e,n):{rows:[],flatRows:[],rowsById:{}},getMemoOptions(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=memo$1(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?selectRowsFn(e,n):{rows:[],flatRows:[],rowsById:{}},getMemoOptions(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=memo$1(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?selectRowsFn(e,n):{rows:[],flatRows:[],rowsById:{}},getMemoOptions(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let o=Boolean(t.length&&Object.keys(n).length);return o&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(o=!1),o},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState();let o=!!t.length;return o&&t.some(e=>!n[e.id])&&(o=!1),o},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,o)=>{const a=e.getIsSelected();t.setRowSelection(i=>{var s;if(n=void 0!==n?n:!a,e.getCanSelect()&&a===n)return i;const l={...i};return mutateRowIsSelected(l,e.id,n,null==(s=null==o?void 0:o.selectChildren)||s,t),l})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return isRowSelected(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return"some"===isSubRowSelected(e,n)},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return"all"===isSubRowSelected(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var o;t&&e.toggleSelected(null==(o=n.target)?void 0:o.checked)}}}},mutateRowIsSelected=(e,t,n,o,a)=>{var i;const s=a.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),s.getCanSelect()&&(e[t]=!0)):delete e[t],o&&null!=(i=s.subRows)&&i.length&&s.getCanSelectSubRows()&&s.subRows.forEach(t=>mutateRowIsSelected(e,t.id,n,o,a))};function selectRowsFn(e,t){const n=e.getState().rowSelection,o=[],a={},recurseRows=function(e,t){return e.map(e=>{var t;const i=isRowSelected(e,n);if(i&&(o.push(e),a[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:recurseRows(e.subRows)}),i)return e}).filter(Boolean)};return{rows:recurseRows(t.rows),flatRows:o,rowsById:a}}function isRowSelected(e,t){var n;return null!=(n=t[e.id])&&n}function isSubRowSelected(e,t,n){var o;if(null==(o=e.subRows)||!o.length)return!1;let a=!0,i=!1;return e.subRows.forEach(e=>{if((!i||a)&&(e.getCanSelect()&&(isRowSelected(e,t)?i=!0:a=!1),e.subRows&&e.subRows.length)){const n=isSubRowSelected(e,t);"all"===n?i=!0:"some"===n?(i=!0,a=!1):a=!1}}),a?"all":!!i&&"some"}var gg=/([0-9]+)/gm;function compareBasic(e,t){return e===t?0:e>t?1:-1}function toString(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function compareAlphanumeric(e,t){const n=e.split(gg).filter(Boolean),o=t.split(gg).filter(Boolean);for(;n.length&&o.length;){const e=n.shift(),t=o.shift(),a=parseInt(e,10),i=parseInt(t,10),s=[a,i].sort();if(isNaN(s[0])){if(e>t)return 1;if(t>e)return-1}else{if(isNaN(s[1]))return isNaN(a)?-1:1;if(a>i)return 1;if(i>a)return-1}}return n.length-o.length}var fg={alphanumeric:(e,t,n)=>compareAlphanumeric(toString(e.getValue(n)).toLowerCase(),toString(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>compareAlphanumeric(toString(e.getValue(n)),toString(t.getValue(n))),text:(e,t,n)=>compareBasic(toString(e.getValue(n)).toLowerCase(),toString(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>compareBasic(toString(e.getValue(n)),toString(t.getValue(n))),datetime:(e,t,n)=>{const o=e.getValue(n),a=t.getValue(n);return o>a?1:o<a?-1:0},basic:(e,t,n)=>compareBasic(e.getValue(n),t.getValue(n))},yg={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:makeStateUpdater("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const t of n){const n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return fg.datetime;if("string"==typeof n&&(o=!0,n.split(gg).length>1))return fg.alphanumeric}return o?fg.text:fg.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,o;if(!e)throw new Error;return isFunction(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(o=t.options.sortingFns)?void 0:o[e.columnDef.sortingFn])?n:fg[e.columnDef.sortingFn]},e.toggleSorting=(n,o)=>{const a=e.getNextSortingOrder(),i=null!=n;t.setSorting(s=>{const l=null==s?void 0:s.find(t=>t.id===e.id),c=null==s?void 0:s.findIndex(t=>t.id===e.id);let d,u=[],p=i?n:"desc"===a;var m;return d=null!=s&&s.length&&e.getCanMultiSort()&&o?l?"toggle":"add":null!=s&&s.length&&c!==s.length-1?"replace":l?"toggle":"replace","toggle"===d&&(i||a||(d="remove")),"add"===d?(u=[...s,{id:e.id,desc:p}],u.splice(0,u.length-(null!=(m=t.options.maxMultiSortColCount)?m:Number.MAX_SAFE_INTEGER))):u="toggle"===d?s.map(t=>t.id===e.id?{...t,desc:p}:t):"remove"===d?s.filter(t=>t.id!==e.id):[{id:e.id,desc:p}],u})},e.getFirstSortDir=()=>{var n,o;return(null!=(n=null!=(o=e.columnDef.sortDescFirst)?o:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var o,a;const i=e.getFirstSortDir(),s=e.getIsSorted();return s?!!(s===i||null!=(o=t.options.enableSortingRemoval)&&!o||n&&null!=(a=t.options.enableMultiRemove)&&!a)&&("desc"===s?"asc":"desc"):i},e.getCanSort=()=>{var n,o;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(o=t.options.enableSorting)||o)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,o;return null!=(n=null!=(o=e.columnDef.enableMultiSort)?o:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const o=null==(n=t.getState().sorting)?void 0:n.find(t=>t.id===e.id);return!!o&&(o.desc?"desc":"asc")},e.getSortIndex=()=>{var n,o;return null!=(n=null==(o=t.getState().sorting)?void 0:o.findIndex(t=>t.id===e.id))?n:-1},e.clearSorting=()=>{t.setSorting(t=>null!=t&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return o=>{n&&(null==o.persist||o.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(o))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,o;e.setSorting(t?[]:null!=(n=null==(o=e.initialState)?void 0:o.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},bg=[Jh,cg,og,ag,Qh,tg,{createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},dg,yg,ng,{getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:makeStateUpdater("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var o,a;if(t){if(null!=(o=null!=(a=e.options.autoResetAll)?a:e.options.autoResetExpanded)?o:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}}else e._queue(()=>{t=!0})},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,o;e.setExpanded(t?{}:null!=(n=null==(o=e.initialState)?void 0:o.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{const t=e.getState().expanded;return"boolean"==typeof t?!0===t:!!Object.keys(t).length&&!e.getRowModel().flatRows.some(e=>!e.getIsExpanded())},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{const n=e.split(".");t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(o=>{var a;const i=!0===o||!(null==o||!o[e.id]);let s={};if(!0===o?Object.keys(t.getRowModel().rowsById).forEach(e=>{s[e]=!0}):s=o,n=null!=(a=n)?a:!i,!i&&n)return{...s,[e.id]:!0};if(i&&!n){const{[e.id]:t,...n}=s;return n}return o})},e.getIsExpanded=()=>{var n;const o=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===o||(null==o?void 0:o[e.id]))},e.getCanExpand=()=>{var n,o,a;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(o=t.options.enableExpanding)||o)&&!(null==(a=e.subRows)||!a.length)},e.getIsAllParentsExpanded=()=>{let n=!0,o=e;for(;n&&o.parentId;)o=t.getRow(o.parentId,!0),n=o.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},{getInitialState:e=>({...e,pagination:{...getDefaultPaginationState(),...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:makeStateUpdater("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var o,a;if(t){if(null!=(o=null!=(a=e.options.autoResetAll)?a:e.options.autoResetPageIndex)?o:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}}else e._queue(()=>{t=!0})},e.setPagination=t=>{const safeUpdater=e=>functionalUpdate(t,e);return null==e.options.onPaginationChange?void 0:e.options.onPaginationChange(safeUpdater)},e.resetPagination=t=>{var n;e.setPagination(t?getDefaultPaginationState():null!=(n=e.initialState.pagination)?n:getDefaultPaginationState())},e.setPageIndex=t=>{e.setPagination(n=>{let o=functionalUpdate(t,n.pageIndex);const a=void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return o=Math.max(0,Math.min(o,a)),{...n,pageIndex:o}})},e.resetPageIndex=t=>{var n,o;e.setPageIndex(t?ug:null!=(n=null==(o=e.initialState)||null==(o=o.pagination)?void 0:o.pageIndex)?n:ug)},e.resetPageSize=t=>{var n,o;e.setPageSize(t?pg:null!=(n=null==(o=e.initialState)||null==(o=o.pagination)?void 0:o.pageSize)?n:pg)},e.setPageSize=t=>{e.setPagination(e=>{const n=Math.max(1,functionalUpdate(t,e.pageSize)),o=e.pageSize*e.pageIndex,a=Math.floor(o/n);return{...e,pageIndex:a,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{var o;let a=functionalUpdate(t,null!=(o=e.options.pageCount)?o:-1);return"number"==typeof a&&(a=Math.max(-1,a)),{...n,pageCount:a}}),e.getPageOptions=memo$1(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...new Array(e)].fill(null).map((e,t)=>t)),t},getMemoOptions(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return-1===n||0!==n&&t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},mg,hg,sg];function createTable(e){var t,n;const o=[...bg,...null!=(t=e._features)?t:[]];let a={_features:o};const i=a._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(a)),{}),mergeOptions=e=>a.options.mergeOptions?a.options.mergeOptions(i,e):{...i,...e};let s={...null!=(n=e.initialState)?n:{}};a._features.forEach(e=>{var t;s=null!=(t=null==e.getInitialState?void 0:e.getInitialState(s))?t:s});const l=[];let c=!1;const d={_features:o,options:{...i,...e},initialState:s,_queue:e=>{l.push(e),c||(c=!0,Promise.resolve().then(()=>{for(;l.length;)l.shift()();c=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{a.setState(a.initialState)},setOptions:e=>{a.options=mergeOptions(functionalUpdate(e,a.options))},getState:()=>a.options.state,setState:e=>{null==a.options.onStateChange||a.options.onStateChange(e)},_getRowId:(e,t,n)=>{var o;return null!=(o=null==a.options.getRowId?void 0:a.options.getRowId(e,t,n))?o:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(a._getCoreRowModel||(a._getCoreRowModel=a.options.getCoreRowModel(a)),a._getCoreRowModel()),getRowModel:()=>a.getPaginationRowModel(),getRow:(e,t)=>{let n=(t?a.getPrePaginationRowModel():a.getRowModel()).rowsById[e];if(!n&&(n=a.getCoreRowModel().rowsById[e],!n))throw new Error;return n},_getDefaultColumnDef:memo$1(()=>[a.options.defaultColumn],e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{const t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...a._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef()),{}),...e}},getMemoOptions(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>a.options.columns,getAllColumns:memo$1(()=>[a._getColumnDefs()],e=>{const recurseColumns=function(e,t,n){return void 0===n&&(n=0),e.map(e=>{const o=createColumn(a,e,n,t),i=e;return o.columns=i.columns?recurseColumns(i.columns,o,n+1):[],o})};return recurseColumns(e)},getMemoOptions(e,"debugColumns","getAllColumns")),getAllFlatColumns:memo$1(()=>[a.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),getMemoOptions(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:memo$1(()=>[a.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),getMemoOptions(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:memo$1(()=>[a.getAllColumns(),a._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),getMemoOptions(e,"debugColumns","getAllLeafColumns")),getColumn:e=>a._getAllFlatColumnsById()[e]};Object.assign(a,d);for(let u=0;u<a._features.length;u++){const e=a._features[u];null==e||null==e.createTable||e.createTable(a)}return a}function getCoreRowModel(){return e=>memo$1(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},accessRows=function(t,o,a){void 0===o&&(o=0);const i=[];for(let l=0;l<t.length;l++){const c=createRow(e,e._getRowId(t[l],l,a),t[l],l,o,void 0,null==a?void 0:a.id);var s;n.flatRows.push(c),n.rowsById[c.id]=c,i.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(t[l],l),null!=(s=c.originalSubRows)&&s.length&&(c.subRows=accessRows(c.originalSubRows,o+1,c)))}return i};return n.rows=accessRows(t),n},getMemoOptions(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function getSortedRowModel(){return e=>memo$1(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||null==t||!t.length)return n;const o=e.getState().sorting,a=[],i=o.filter(t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()}),s={};i.forEach(t=>{const n=e.getColumn(t.id);n&&(s[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});const sortData=e=>{const t=e.map(e=>({...e}));return t.sort((e,t)=>{for(let o=0;o<i.length;o+=1){var n;const a=i[o],l=s[a.id],c=l.sortUndefined,d=null!=(n=null==a?void 0:a.desc)&&n;let u=0;if(c){const n=void 0===e.getValue(a.id),o=void 0===t.getValue(a.id);if(n||o){if("first"===c)return n?-1:1;if("last"===c)return n?1:-1;u=n&&o?0:n?c:-c}}if(0===u&&(u=l.sortingFn(e,t,a.id)),0!==u)return d&&(u*=-1),l.invertSorting&&(u*=-1),u}return e.index-t.index}),t.forEach(e=>{var t;a.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=sortData(e.subRows))}),t};return{rows:sortData(n.rows),flatRows:a,rowsById:n.rowsById}},getMemoOptions(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function flexRender(e,t){return e?isReactComponent(e)?c.createElement(e,t):e:null}function isReactComponent(e){return isClassComponent(e)||"function"==typeof e||isExoticComponent(e)}function isClassComponent(e){return"function"==typeof e&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function isExoticComponent(e){return"object"==typeof e&&"symbol"==typeof e.$$typeof&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function useReactTable(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=c.useState(()=>({current:createTable(t)})),[o,a]=c.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...o,...e.state},onStateChange:t=>{a(t),null==e.onStateChange||e.onStateChange(t)}})),n.current}function createLazyMeasurementsView(e,t,n){const o=new Array(e);return new Proxy(o,{get(o,a,i){if("string"==typeof a){const i=a.charCodeAt(0);if(i>=48&&i<=57){const i=+a;if(Number.isInteger(i)&&i>=0&&i<e){let e=o[i];if(!e){const a=t[2*i];e=o[i]={index:i,key:n(i),start:a,size:t[2*i+1],end:a+t[2*i+1],lane:0}}return e}}if("length"===a)return e}return Reflect.get(o,a,i)}})}function memo(e,t,n){let o,a=n.initialDeps??[],i=!0;function memoizedFunction(){const s=e();return s.length!==a.length||s.some((e,t)=>a[t]!==e)?(a=s,o=t(...s),!(null==n?void 0:n.onChange)||i&&n.skipInitialOnChange||n.onChange(o),i=!1,o):o}return memoizedFunction.updateDeps=e=>{a=e},memoizedFunction}function notUndefined(e,t){if(void 0===e)throw new Error("Unexpected undefined"+(t?`: ${t}`:""));return e}var vg,approxEqual=(e,t)=>Math.abs(e-t)<1.01,debounce=(e,t,n)=>{let o;return function(...a){e.clearTimeout(o),o=e.setTimeout(()=>t.apply(this,a),n)}},isIOSWebKit=()=>{if(void 0!==vg)return vg;if("undefined"==typeof navigator)return vg=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return vg=!0;const e=navigator.maxTouchPoints;return vg="MacIntel"===navigator.platform&&void 0!==e&&e>0},getRect=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},defaultKeyExtractor=e=>e,defaultRangeExtractor=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(n);for(let a=0;a<n;a++)o[a]=t+a;return o},observeElementRect=(e,t)=>{const n=e.scrollElement;if(!n)return;const o=e.targetWindow;if(!o)return;const handler=e=>{const{width:n,height:o}=e;t({width:Math.round(n),height:Math.round(o)})};if(handler(getRect(n)),!o.ResizeObserver)return()=>{};const a=new o.ResizeObserver(t=>{const run=()=>{const e=t[0];if(null==e?void 0:e.borderBoxSize){const t=e.borderBoxSize[0];if(t)return void handler({width:t.inlineSize,height:t.blockSize})}handler(getRect(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(run):run()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},wg={passive:!0},Sg="undefined"==typeof window||"onscrollend"in window,observeOffset=(e,t,n)=>{const o=e.scrollElement;if(!o)return;const a=e.targetWindow;if(!a)return;const i=e.options.useScrollendEvent&&Sg;let s=0;const l=i?null:debounce(a,()=>t(s,!1),e.options.isScrollingResetDelay),createHandler=e=>()=>{s=n(o),l?.(),t(s,e)},c=createHandler(!0),d=createHandler(!1);return o.addEventListener("scroll",c,wg),i&&o.addEventListener("scrollend",d,wg),()=>{o.removeEventListener("scroll",c),i&&o.removeEventListener("scrollend",d)}},observeElementOffset=(e,t)=>observeOffset(e,t,t=>{const{horizontal:n,isRtl:o}=e.options;return n?t.scrollLeft*(o?-1:1):t.scrollTop}),measureElement=(e,t,n)=>{if(null==t?void 0:t.borderBoxSize){const e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},scrollWithAdjustments=(e,{adjustments:t=0,behavior:n},o)=>{var a,i;null==(i=null==(a=o.scrollElement)?void 0:a.scrollTo)||i.call(a,{[o.options.horizontal?"left":"top"]:e+t,behavior:n})},xg=scrollWithAdjustments,Ig=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e,t,n;return(null==(n=null==(t=null==(e=this.targetWindow)?void 0:e.performance)?void 0:t.now)?void 0:n.call(t))??Date.now()},this.observer=(()=>{let e=null;const get=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{const run=()=>{const t=e.target,n=this.indexFromElement(t);if(t.isConnected)this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this));else{this.observer.unobserve(t);for(const[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}}};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(run):run()})}):null);return{disconnect:()=>{var t;null==(t=get())||t.disconnect(),e=null},observe:e=>{var t;return null==(t=get())?void 0:t.observe(e,{box:"border-box"})},unobserve:e=>{var t;return null==(t=get())?void 0:t.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{var t,n;const o={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:defaultKeyExtractor,rangeExtractor:defaultRangeExtractor,onChange:()=>{},measureElement,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const l in e){const t=e[l];void 0!==t&&(o[l]=t)}const a=this.options;let i=null,s=null;if(void 0!==a&&a.enabled&&o.enabled&&"end"===o.anchorTo&&null!==this.scrollElement){const e=a.count,l=o.count,c=this.getMeasurements(),d=e>0?(null==(t=c[0])?void 0:t.key)??a.getItemKey(0):null,u=e>0?(null==(n=c[e-1])?void 0:n.key)??a.getItemKey(e-1):null;if(l!==e||e>0&&l>0&&(o.getItemKey(0)!==d||o.getItemKey(l-1)!==u)){const t=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??c[0]:null;t&&(i=[t.key,this.getScrollOffset()-t.start]);const n=!0===o.followOnAppend?"auto":o.followOnAppend||null;n&&l>e&&this.isAtEnd(a.scrollEndThreshold)&&(0===e||o.getItemKey(l-1)!==u)&&(s=n)}}this.options=o,(i||s)&&(this.pendingScrollAnchor=[(null==i?void 0:i[0])??null,(null==i?void 0:i[1])??0,s])},this.notify=e=>{var t,n;null==(n=(t=this.options).onChange)||n.call(t,this,e)},this.maybeNotify=memo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();if(this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{null!==this._intendedScrollOffset&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const e=this.scrollElement,onTouchStart=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},onTouchEnd=()=>{this._iosTouching=!1,isIOSWebKit()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener("touchstart",onTouchStart,wg),e.addEventListener("touchend",onTouchEnd,wg),this.unsubs.push(()=>{e.removeEventListener("touchstart",onTouchStart),e.removeEventListener("touchend",onTouchEnd),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){const[e,t,o]=n;if(null!==e){const{count:n,getItemKey:o}=this.options;let a=0;for(;a<n&&o(a)!==e;)a++;const i=a<n?this.getMeasurements()[a]:void 0;if(i){const e=i.start+t-this.getScrollOffset();approxEqual(e,0)||this.applyScrollAdjustment(e)}}o&&this.scrollToEnd({behavior:o})}},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment)return;if(this.isScrolling)return;if(this._iosTouching)return;if(this._iosJustTouchEnded)return;const e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;const n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{const n=new Map,o=new Map;for(let a=t-1;a>=0;a--){const t=e[a];if(n.has(t.lane))continue;const i=o.get(t.lane);if(null==i||t.end>i.end?o.set(t.lane,t):t.end<i.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=memo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,o,a,i,s)=>(void 0!==this.prevLanes&&this.prevLanes!==i&&(this.lanesChangedFlag=!0),this.prevLanes=i,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:o,enabled:a,lanes:i,laneAssignmentMode:s}),{key:!1}),this.getMeasurements=memo(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:o,enabled:a,lanes:i,laneAssignmentMode:s},l)=>{const c=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const m of this.laneAssignments.keys())m>=e&&this.laneAssignments.delete(m);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));const d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),1===i){const a=this.options.gap,i=2*e;let s,l=this._flatMeasurements;if(!l||l.length<i){const e=new Float64Array(i);l&&d>0&&e.set(l.subarray(0,2*d)),l=e,this._flatMeasurements=l}if(0===d)s=t+n;else{const e=d-1;s=l[2*e]+l[2*e+1]+a}for(let t=d;t<e;t++){const e=o(t),n=c.get(e),i="number"==typeof n?n:this.options.estimateSize(t);l[2*t]=s,l[2*t+1]=i,s+=i+a}const u=createLazyMeasurementsView(e,l,o);return this.measurementsCache=u,u}const u=this.measurementsCache.slice(0,d),p=new Array(i).fill(void 0);for(let m=0;m<d;m++){const e=u[m];e&&(p[e.lane]=m)}for(let m=d;m<e;m++){const e=o(m),a=this.laneAssignments.get(m);let i,l;const d="estimate"===s||c.has(e);if(void 0!==a&&this.options.lanes>1){i=a;const e=p[i],o=void 0!==e?u[e]:void 0;l=o?o.end+this.options.gap:t+n}else{const e=1===this.options.lanes?u[m-1]:this.getFurthestMeasurement(u,m);l=e?e.end+this.options.gap:t+n,i=e?e.lane:m%this.options.lanes,this.options.lanes>1&&d&&this.laneAssignments.set(m,i)}const h=c.get(e),g="number"==typeof h?h:this.options.estimateSize(m),y=l+g;u[m]={index:m,start:l,size:g,end:y,key:e,lane:i},p[i]=m}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=memo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,o)=>this.range=e.length>0&&t>0?calculateRange({measurements:e,outerSize:t,scrollOffset:n,lanes:o,flat:1===o&&null!=this._flatMeasurements?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=memo(()=>{let e=null,t=null;const n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,o,a)=>null===o||null===a?[]:e({startIndex:o,endIndex:a,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;const n=this.scrollState.index??(null==(t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:t.index);if(void 0!==n&&this.range){const t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),o=Math.max(0,n-t),a=Math.min(this.options.count-1,n+t);return e>=o&&e<=a}return!0},this.measureElement=e=>{if(!e)return void this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});const t=this.indexFromElement(e),n=this.options.getItemKey(t),o=this.elementsCache.get(n);o!==e&&(o&&this.observer.unobserve(o),this.observer.observe(e),this.elementsCache.set(n,e)),this.isScrolling&&!this.scrollState||!this.shouldMeasureDuringScroll(t)||this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n,o;if(e<0||e>=this.options.count)return;let a,i,s;const l=this._flatMeasurements;if(1===this.options.lanes&&null!==l)s=this.options.getItemKey(e),i=l[2*e],a=l[2*e+1];else{const t=this.measurementsCache[e];if(!t)return;s=t.key,i=t.start,a=t.size}const c=t-(this.itemSizeCache.get(s)??a);if(0!==c){const l="end"===this.options.anchorTo&&"smooth"!==(null==(n=this.scrollState)?void 0:n.behavior)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,d=l?this.getTotalSize():0,u="smooth"!==(null==(o=this.scrollState)?void 0:o.behavior)&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:s,start:i,size:a,end:i+a,lane:0},c,this):i<this.getScrollOffset()+this.scrollAdjustments&&"backward"!==this.scrollDirection);(null===this.pendingMin||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(s,t),this.itemSizeCacheVersion++,l?this.applyScrollAdjustment(this.getTotalSize()-d):u&&this.applyScrollAdjustment(c),this.notify(!1)}},this.getVirtualItems=memo(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{const n=[];for(let o=0,a=e.length;o<a;o++){const a=t[e[o]];n.push(a)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const t=this.getMeasurements();if(0===t.length)return;const n=this._flatMeasurements,o=1===this.options.lanes&&null!=n;return notUndefined(t[findNearestBinarySearch(0,t.length-1,o?e=>n[2*e]:e=>notUndefined(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;const o=this.getSize(),a=this.getScrollOffset();"auto"===t&&(t=e>=a+o?"end":"start"),"center"===t?e+=(n-o)/2:"end"===t&&(e-=o);const i=this.getMaxScrollOffset();return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.getSize(),o=this.getScrollOffset(),a=this.measurementsCache[e];if(!a)return;if("auto"===t)if(a.end>=o+n-this.options.scrollPaddingEnd)t="end";else{if(!(a.start<=o+this.options.scrollPaddingStart))return[o,t];t="start"}if("end"===t&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];const i="end"===t?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,t,a.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:n="auto"}={})=>{const o=this.getOffsetForAlignment(e,t),a=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:a,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t="auto",behavior:n="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));const o=this.getOffsetForIndex(e,t);if(!o)return;const[a,i]=o,s=this.now();this.scrollState={index:e,align:i,behavior:n,startedAt:s,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t="auto"}={})=>{const n=this.getScrollOffset()+e,o=this.now();this.scrollState={index:null,align:"start",behavior:t,startedAt:o,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e="auto"}={})=>{this.options.count>0?this.scrollToIndex(this.options.count-1,{align:"end",behavior:e}):this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{var e;const t=this.getMeasurements();let n;if(0===t.length)n=this.options.paddingStart;else if(1===this.options.lanes){const o=t.length-1,a=this._flatMeasurements;n=null!=a?a[2*o]+a[2*o+1]:(null==(e=t[o])?void 0:e.end)??0}else{const e=Array(this.options.lanes).fill(null);let o=t.length-1;for(;o>=0&&e.some(e=>null===e);){const n=t[o];null===e[n.lane]&&(e[n.lane]=n.end),o--}n=Math.max(...e.filter(e=>null!==e))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const e=[];if(0===this.itemSizeCache.size)return e;const t=this.getMeasurements();for(const n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){0!==e&&(isIOSWebKit()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}))}scheduleScrollReconcile(){this.targetWindow?null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})):this.scrollState=null}reconcileScroll(){if(!this.scrollState)return;if(!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3)return void(this.scrollState=null);const e=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=e?e[0]:this.scrollState.lastTargetOffset,n=1,o=t!==this.scrollState.lastTargetOffset;if(!o&&approxEqual(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=n)return this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}),void(this.scrollState=null)}else if(this.scrollState.stableFrames=0,o){const e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),o="smooth"===this.scrollState.behavior&&n>e;this.scrollState.lastTargetOffset=t,o||(this.scrollState.behavior="auto"),this._scrollToOffset(t,{adjustments:void 0,behavior:o?"smooth":"auto"})}this.scheduleScrollReconcile()}},findNearestBinarySearch=(e,t,n,o)=>{for(;e<=t;){const a=(e+t)/2|0,i=n(a);if(i<o)e=a+1;else{if(!(i>o))return a;t=a-1}}return e>0?e-1:0};function calculateRange({measurements:e,outerSize:t,scrollOffset:n,lanes:o,flat:a}){const i=e.length-1,s=a?e=>a[2*e]:t=>e[t].start,l=a?e=>a[2*e]+a[2*e+1]:t=>e[t].end;if(e.length<=o)return{startIndex:0,endIndex:i};let c=findNearestBinarySearch(0,i,s,n),d=c;if(1===o)for(;d<i&&l(d)<n+t;)d++;else if(o>1){const a=Array(o).fill(0);for(;d<i&&a.some(e=>e<n+t);){const t=e[d];a[t.lane]=t.end,d++}const s=Array(o).fill(n+t);for(;c>=0&&s.some(e=>e>=n);){const t=e[c];s[t.lane]=t.start,c--}c=Math.max(0,c-c%o),d=Math.min(i,d+(o-1-d%o))}return{startIndex:c,endIndex:d}}var Cg="undefined"!=typeof document?c.useLayoutEffect:c.useEffect;function useVirtualizerBase({useFlushSync:e=!0,...t}){const n=c.useReducer(e=>e+1,0)[1],o={...t,onChange:(o,a)=>{var i;e&&a?(0,d.flushSync)(n):n(),null==(i=t.onChange)||i.call(t,o,a)}},[a]=c.useState(()=>new Ig(o));return a.setOptions(o),Cg(()=>a._didMount(),[]),Cg(()=>a._willUpdate()),a}function useVirtualizer(e){return useVirtualizerBase({observeElementRect,observeElementOffset,scrollToFn:xg,...e})}var Eg=36,Rg=40;function NexDataGrid({columns:e,data:t,emptyText:n="No rows.",getRowId:o,initialState:a,meta:i,onRowClick:s,sx:l}){const[d,u]=c.useState(a?.sorting??[]),p=useReactTable({columns:e,data:t,getRowId:o,meta:i,state:{sorting:d},onSortingChange:u,enableMultiSort:!1,getCoreRowModel:getCoreRowModel(),getSortedRowModel:getSortedRowModel()}),m=p.getRowModel().rows,h=c.useRef(null),g=useVirtualizer({count:m.length,getScrollElement:()=>h.current,estimateSize:()=>Rg,overscan:5}),y=g.getVirtualItems(),b=g.getTotalSize(),v=y.length>0?y[0].start:0,w=y.length>0?b-y[y.length-1].end:0;return(0,ps.jsx)(Hl,{sx:{display:"flex",flex:1,minHeight:0,width:"100%",overflow:"hidden",...l},children:(0,ps.jsx)(jh,{ref:h,sx:{flex:1,height:"100%",minHeight:0,overflowX:"auto",overflowY:"auto",width:"100%"},children:(0,ps.jsxs)(kh,{stickyHeader:!0,size:"small",sx:{fontSize:12},children:[(0,ps.jsx)(Bh,{children:p.getHeaderGroups().map(e=>(0,ps.jsx)(Hh,{sx:{height:Eg},children:e.headers.map(e=>{const t=e.column.getCanSort(),n=e.column.getIsSorted(),o=e.column.columnDef.meta?.autoWidth;return(0,ps.jsx)(Oh,{sx:{height:Eg,px:1,py:0,fontSize:11,fontWeight:700,textTransform:"uppercase",...o?{}:{width:e.column.getSize(),minWidth:e.column.columnDef.minSize??e.column.getSize()}},children:t?(0,ps.jsx)(Yh,{active:!!n,direction:"desc"===n?"desc":"asc",onClick:e.column.getToggleSortingHandler(),children:flexRender(e.column.columnDef.header,e.getContext())}):flexRender(e.column.columnDef.header,e.getContext())},e.id)})},e.id))}),(0,ps.jsx)($h,{children:0===m.length?(0,ps.jsx)(Hh,{children:(0,ps.jsx)(Oh,{colSpan:e.length,sx:{color:"text.secondary",textAlign:"center",py:2,fontSize:12},children:n})}):(0,ps.jsxs)(ps.Fragment,{children:[v>0&&(0,ps.jsx)(Hh,{sx:{height:v,border:"none"},children:(0,ps.jsx)(Oh,{colSpan:e.length,sx:{p:0,border:0}})}),y.map(e=>{const t=m[e.index];return(0,ps.jsx)(Hh,{ref:g.measureElement,"data-index":e.index,hover:!0,onClick:s?()=>s(t.original):void 0,sx:{height:Rg,cursor:s?"pointer":void 0},children:t.getVisibleCells().map(e=>{const t=e.column.columnDef.meta?.autoWidth;return(0,ps.jsx)(Oh,{sx:{height:Rg,px:1,py:0,fontSize:12,...t?{}:{width:e.column.getSize(),minWidth:e.column.columnDef.minSize??e.column.getSize()},"&:focus, &:focus-within":{outline:"none"}},children:flexRender(e.column.columnDef.cell,e.getContext())},e.id)})},t.id)}),w>0&&(0,ps.jsx)(Hh,{sx:{height:w,border:"none"},children:(0,ps.jsx)(Oh,{colSpan:e.length,sx:{p:0,border:0}})})]})})]})})})}function ResultsDialog(){const{uiStore:e}=useNexMap(),t=useNexUiStore(),n=t?.resultsOpen??!1;function handleClose(){e?.setState({resultsOpen:!1})}function handleRowClick(e){const n=t?.resultsDefaultAction;"function"==typeof n&&n(e)}const o=t?.resultsTitle??"Results",a=t?.resultsColumns??[],i=t?.resultsInitialState??{},s=t?.resultsRows??[],l=c.useMemo(()=>a.length>0?a.map(e=>({id:e.key,accessorKey:e.key,header:e.label,minSize:120,...e.flex?{meta:{autoWidth:!0}}:{size:e.width??160}})):[{id:"__summary",accessorKey:"__summary",header:"Result",minSize:220,meta:{autoWidth:!0}}],[a]),d=c.useMemo(()=>a.length>0?s:s.map(e=>({...e,__summary:String(e.name??e.id??e.roomId??"")})),[a,s]);return(0,ps.jsx)(NexWindowDialog,{contentSx:e=>({display:"flex",flexDirection:"column",minHeight:0,overflow:"hidden",p:e.spacing(e.nexmap?.window?.contentPadding??1.5)}),footer:(0,ps.jsxs)(Hl,{sx:e=>({borderTop:"1px solid",borderColor:"divider",color:e.palette.text.secondary,fontSize:12,px:e.spacing(e.nexmap?.window?.footerPaddingX??2),py:e.spacing(e.nexmap?.window?.footerPaddingY??1.5),textAlign:"right"}),children:[s.length," result",1!==s.length?"s":""]}),initialPosition:"center",maxHeight:600,onClose:handleClose,open:n,paperSx:{height:"min(600px, calc(100vh - 24px))",maxHeight:"calc(100vh - 24px)",minWidth:320,zIndex:1300},width:1e3,title:o,children:(0,ps.jsx)(NexDataGrid,{columns:l,data:d,emptyText:"No results.",getRowId:(e,t)=>String(e.id??e.roomId??t),initialState:i,onRowClick:handleRowClick},`${o}:${a.map(e=>e.key).join("|")}`)})}var kg=createColumnHelper(),Ag=[kg.display({id:"actions",header:"",enableSorting:!1,size:84,cell:({row:e,table:t})=>{const{handleGoto:n,handleDelete:o}=t.options.meta;return(0,ps.jsxs)(Hl,{sx:{display:"flex",gap:.5},children:[(0,ps.jsx)(Fu,{title:"Go to landmark",children:(0,ps.jsx)(Qd,{size:"small",onClick:t=>{t.stopPropagation(),n(e.original)},sx:{fontSize:12},children:"▶"})}),(0,ps.jsx)(Fu,{title:"Delete landmark",children:(0,ps.jsx)(Qd,{size:"small",color:"error",onClick:t=>{t.stopPropagation(),o(e.original)},sx:{fontSize:12},children:"✕"})})]})}}),kg.accessor("roomId",{header:"Room",size:84,cell:({getValue:e})=>(0,ps.jsx)(Hl,{component:"span",sx:{color:"text.secondary",fontFamily:"monospace"},children:e()})}),kg.accessor("name",{header:"Name",size:150}),kg.accessor("areaName",{header:"Area",minSize:260,meta:{autoWidth:!0},cell:({getValue:e})=>(0,ps.jsx)(Hl,{component:"span",sx:{color:"text.secondary"},children:e()??""})}),kg.accessor("continent",{header:"Continent",size:120,cell:({getValue:e})=>(0,ps.jsx)(Hl,{component:"span",sx:{color:"text.secondary"},children:e()??""})})],Tg=[{id:"name",desc:!1}];function LandmarksPanel(){const{router:e}=useNexMap(),t=useNexMapSettings(),[n,o]=c.useState(""),[a,i]=c.useState(""),s=t?.landmarks??[],l=c.useCallback(async t=>{try{await(e?.dispatch(p.TRAVEL_TO_LANDMARK,{name:t.name}))}catch{}},[e]),d=c.useCallback(async t=>{try{await(e?.dispatch(p.LANDMARK_REMOVE,{id:t.id}))}catch{}},[e]),u=c.useMemo(()=>({handleGoto:l,handleDelete:d}),[l,d]);async function handleAdd(){const t=n.trim();if(t){i("");try{await(e?.dispatch(p.LANDMARK_ADD,{name:t})),o("")}catch(a){i(a?.message??"Failed to add landmark.")}}else i("Name is required.")}return(0,ps.jsxs)(Hl,{sx:{display:"flex",flexDirection:"column",height:"100%",gap:1.5},children:[(0,ps.jsxs)(Hl,{sx:{display:"flex",alignItems:"flex-start",gap:1},children:[(0,ps.jsx)(Qm,{label:"Add landmark for current room",placeholder:"Landmark name",size:"small",value:n,onChange:e=>{o(e.target.value),i("")},onKeyDown:e=>"Enter"===e.key&&handleAdd(),error:Boolean(a),helperText:a||" ",sx:{flex:1}}),(0,ps.jsx)(ad,{variant:"contained",size:"small",onClick:handleAdd,sx:{mt:.25,flexShrink:0},children:"Add"})]}),(0,ps.jsx)(NexDataGrid,{columns:Ag,data:s,emptyText:"No landmarks saved. Use the Add form above to save the current room.",getRowId:e=>e.id,initialState:{sorting:Tg},meta:u,onRowClick:l,sx:{minWidth:700}})]})}var Mg=createColumnHelper(),zg=[Mg.accessor("id",{header:"ID",size:72,cell:({getValue:e})=>(0,ps.jsx)(Hl,{component:"span",sx:{color:"text.secondary",fontFamily:"monospace"},children:e()})}),Mg.accessor("name",{header:"Name",meta:{autoWidth:!0}}),Mg.accessor(e=>e.area?.name??"",{id:"area",header:"Area",size:180,cell:({getValue:e})=>(0,ps.jsx)(Hl,{component:"span",sx:{color:"text.secondary"},children:e()})}),Mg.display({id:"rooms",header:"Rooms",enableSorting:!1,size:72,cell:({row:e})=>{const t=e.original.room??[];return(0,ps.jsx)(Hl,{component:"span",sx:{color:"text.secondary",fontFamily:"monospace",fontSize:11},children:1===t.length?t[0]:`${t.length}×`})}}),Mg.accessor(e=>e.area?.continent??e.continent??"",{id:"continent",header:"Continent",size:110,cell:({getValue:e})=>(0,ps.jsx)(Hl,{component:"span",sx:{color:"text.secondary"},children:e()})}),Mg.display({id:"go",header:"",enableSorting:!1,size:40,cell:({row:e,table:t})=>{const{handleGo:n}=t.options.meta;return(0,ps.jsx)(Fu,{title:e.original.room?.length>1?"Travel to room (cycles through all)":"Travel to room",children:(0,ps.jsx)(Qd,{size:"small",onClick:t=>{t.stopPropagation(),n(e.original)},sx:{fontSize:12},children:"▶"})})}})],$g=[{id:"name",desc:!1}];function NpcExplorerPanel(){const{router:e}=useNexMap(),[t,n]=c.useState(""),[o,a]=c.useState([]),[i,s]=c.useState(!1),[l,d]=c.useState(""),[u,m]=c.useState(!1),h=c.useRef(new Map);async function handleSearch(){const n=t.trim();if(n){s(!0),d(""),m(!0),a([]),h.current.clear();try{a((await(e?.dispatch(p.SEARCH_DENIZENS,{query:n})))?.value?.hits??[])}catch(o){d(o?.message??"Search failed."),a([])}finally{s(!1)}}}const g=c.useCallback(async t=>{const n=t.room??[];if(0===n.length)return;const o=h.current.get(t.id)??0;h.current.set(t.id,(o+1)%n.length);try{await(e?.dispatch(p.TRAVEL_TO_ROOM,{roomId:n[o]}))}catch{}},[e]),y=c.useCallback(async t=>{const n=t.room??[];if(0!==n.length)try{await(e?.dispatch(p.TRAVEL_TO_ROOM,{roomId:n[0]}))}catch{}},[e]),b=c.useMemo(()=>({handleGo:g}),[g]);return(0,ps.jsxs)(Hl,{sx:{display:"flex",flexDirection:"column",height:"100%",gap:1.5},children:[(0,ps.jsxs)(Hl,{sx:{display:"flex",gap:1,alignItems:"flex-start"},children:[(0,ps.jsx)(Qm,{label:"Search denizens",placeholder:"e.g. Orinula",size:"small",value:t,onChange:e=>n(e.target.value),onKeyDown:e=>"Enter"===e.key&&handleSearch(),sx:{flex:1}}),(0,ps.jsx)(ad,{variant:"contained",size:"small",onClick:handleSearch,disabled:i,sx:{mt:.25,flexShrink:0},children:i?(0,ps.jsx)(Zc,{size:14}):"Search"})]}),l&&(0,ps.jsx)(Jl,{variant:"caption",color:"error",children:l}),u?i||0!==o.length?(0,ps.jsx)(NexDataGrid,{columns:zg,data:o,emptyText:"No denizens found.",getRowId:e=>String(e.id),initialState:{sorting:$g},meta:b,onRowClick:y}):(0,ps.jsxs)(Jl,{variant:"body2",color:"text.secondary",children:['No denizens found for "',t,'".']}):(0,ps.jsx)(Jl,{variant:"body2",color:"text.secondary",children:"Search the denizen database by name."})]})}function getCollapseUtilityClass(e){return generateUtilityClass("MuiCollapse",e)}generateUtilityClasses("MuiCollapse",["root","horizontal","vertical","entered","hidden","wrapper","wrapperInner"]);var useUtilityClasses$4=e=>{const{orientation:t,classes:n}=e;return composeClasses({root:["root",t],entered:["entered"],hidden:["hidden"],wrapper:["wrapper",t],wrapperInner:["wrapperInner",t]},getCollapseUtilityClass,n)},Ng=Fl("div",{name:"MuiCollapse",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.orientation],"entered"===n.state&&t.entered,"exited"===n.state&&!n.in&&"0px"===n.collapsedSize&&t.hidden]}})(Kl(({theme:e})=>({height:0,overflow:"hidden",transition:e.transitions.create("height"),variants:[{props:{orientation:"horizontal"},style:{height:"auto",width:0,transition:e.transitions.create("width")}},{props:{state:"entered"},style:{height:"auto",overflow:"visible"}},{props:{state:"entered",orientation:"horizontal"},style:{width:"auto"}},{props:({ownerState:e})=>"exited"===e.state&&!e.in&&"0px"===e.collapsedSize,style:{visibility:"hidden"}}]}))),Pg=Fl("div",{name:"MuiCollapse",slot:"Wrapper"})({display:"flex",width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),Og=Fl("div",{name:"MuiCollapse",slot:"WrapperInner"})({width:"100%",variants:[{props:{orientation:"horizontal"},style:{width:"auto",height:"100%"}}]}),_g=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiCollapse"}),{addEndListener:o,children:a,className:i,collapsedSize:s="0px",component:l,easing:d,in:u,onEnter:p,onEntered:m,onEntering:h,onExit:g,onExited:y,onExiting:b,orientation:v="vertical",slots:w={},slotProps:S={},style:x,timeout:I=Pl.standard,TransitionComponent:C=Ic,...E}=n,R={...n,orientation:v,collapsedSize:s},k=useUtilityClasses$4(R),T=useTheme(),M=useTimeout(),$=c.useRef(null),N=c.useRef(),P="number"==typeof s?`${s}px`:s,O="horizontal"===v,j=O?"width":"height",F=c.useRef(null),L=pc(t,F),getWrapperSize=()=>$.current?$.current[O?"clientWidth":"clientHeight"]:0,D=normalizedTransitionCallback(F,(e,t)=>{$.current&&O&&($.current.style.position="absolute"),e.style[j]=P,p&&p(e,t)}),B=normalizedTransitionCallback(F,(e,t)=>{const n=getWrapperSize();$.current&&O&&($.current.style.position="");const{duration:o,easing:a}=getTransitionProps({style:x,timeout:I,easing:d},{mode:"enter"});if("auto"===I){const t=T.transitions.getAutoHeightDuration(n);e.style.transitionDuration=`${t}ms`,N.current=t}else e.style.transitionDuration="string"==typeof o?o:`${o}ms`;e.style[j]=`${n}px`,e.style.transitionTimingFunction=a,h&&h(e,t)}),G=normalizedTransitionCallback(F,(e,t)=>{e.style[j]="auto",m&&m(e,t)}),W=normalizedTransitionCallback(F,e=>{e.style[j]=`${getWrapperSize()}px`,g&&g(e)}),V=normalizedTransitionCallback(F,y),H=normalizedTransitionCallback(F,e=>{const t=getWrapperSize(),{duration:n,easing:o}=getTransitionProps({style:x,timeout:I,easing:d},{mode:"exit"});if("auto"===I){const n=T.transitions.getAutoHeightDuration(t);e.style.transitionDuration=`${n}ms`,N.current=n}else e.style.transitionDuration="string"==typeof n?n:`${n}ms`;e.style[j]=P,e.style.transitionTimingFunction=o,b&&b(e)}),handleAddEndListener=e=>{"auto"===I&&M.start(N.current||0,e),o&&o(F.current,e)},U={slots:w,slotProps:S,component:l},[q,K]=useSlot("root",{ref:L,className:clsx(k.root,i),elementType:Ng,externalForwardedProps:U,ownerState:R,additionalProps:{style:{[O?"minWidth":"minHeight"]:P,...x}}}),[Z,Y]=useSlot("wrapper",{ref:$,className:k.wrapper,elementType:Pg,externalForwardedProps:U,ownerState:R}),[X,J]=useSlot("wrapperInner",{className:k.wrapperInner,elementType:Og,externalForwardedProps:U,ownerState:R});return(0,ps.jsx)(C,{in:u,onEnter:D,onEntered:G,onEntering:B,onExit:W,onExited:V,onExiting:H,addEndListener:handleAddEndListener,nodeRef:F,timeout:"auto"===I?null:I,...E,children:(e,{ownerState:t,...n})=>{const o={...R,state:e};return(0,ps.jsx)(q,{...K,className:clsx(K.className,{entered:k.entered,exited:!u&&"0px"===P&&k.hidden}[e]),ownerState:o,...n,children:(0,ps.jsx)(Z,{...Y,ownerState:o,children:(0,ps.jsx)(X,{...J,ownerState:o,children:a})})})}})});_g&&(_g.muiSupportAuto=!0);var jg=c.createContext({});function getAccordionUtilityClass(e){return generateUtilityClass("MuiAccordion",e)}var Fg=generateUtilityClasses("MuiAccordion",["root","heading","rounded","expanded","disabled","gutters","region"]),useUtilityClasses$3=e=>{const{classes:t,square:n,expanded:o,disabled:a,disableGutters:i}=e;return composeClasses({root:["root",!n&&"rounded",o&&"expanded",a&&"disabled",!i&&"gutters"],heading:["heading"],region:["region"]},getAccordionUtilityClass,t)},Lg=Fl(Bd,{name:"MuiAccordion",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[{[`& .${Fg.region}`]:t.region},t.root,!n.square&&t.rounded,!n.disableGutters&&t.gutters]}})(Kl(({theme:e})=>{const t={duration:e.transitions.duration.shortest};return{position:"relative",transition:e.transitions.create(["margin"],t),overflowAnchor:"none","&::before":{position:"absolute",left:0,top:-1,right:0,height:1,content:'""',opacity:1,backgroundColor:(e.vars||e).palette.divider,transition:e.transitions.create(["opacity","background-color"],t)},"&:first-of-type":{"&::before":{display:"none"}},[`&.${Fg.expanded}`]:{"&::before":{opacity:0},"&:first-of-type":{marginTop:0},"&:last-of-type":{marginBottom:0},"& + &":{"&::before":{display:"none"}}},[`&.${Fg.disabled}`]:{backgroundColor:(e.vars||e).palette.action.disabledBackground}}}),Kl(({theme:e})=>({variants:[{props:e=>!e.square,style:{borderRadius:0,"&:first-of-type":{borderTopLeftRadius:(e.vars||e).shape.borderRadius,borderTopRightRadius:(e.vars||e).shape.borderRadius},"&:last-of-type":{borderBottomLeftRadius:(e.vars||e).shape.borderRadius,borderBottomRightRadius:(e.vars||e).shape.borderRadius,"@supports (-ms-ime-align: auto)":{borderBottomLeftRadius:0,borderBottomRightRadius:0}}}},{props:e=>!e.disableGutters,style:{[`&.${Fg.expanded}`]:{margin:"16px 0"}}}]}))),Dg=Fl("h3",{name:"MuiAccordion",slot:"Heading"})({all:"unset"}),Bg=Fl("div",{name:"MuiAccordion",slot:"Region"})({}),Gg=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiAccordion"}),{children:o,className:a,defaultExpanded:i=!1,disabled:s=!1,disableGutters:l=!1,expanded:d,onChange:u,slots:p={},slotProps:m={},...h}=n,[g,y]=dc({controlled:d,default:i,name:"Accordion",state:"expanded"}),b=c.useCallback(e=>{y(!g),u&&u(e,!g)},[g,u,y]),[v,...w]=c.Children.toArray(o),S=c.useMemo(()=>({expanded:g,disabled:s,disableGutters:l,toggle:b}),[g,s,l,b]),x={...n,disabled:s,disableGutters:l,expanded:g},I=useUtilityClasses$3(x),C={slots:p,slotProps:m},[E,R]=useSlot("root",{elementType:Lg,externalForwardedProps:{...C,...h},className:clsx(I.root,a),shouldForwardComponentProp:!0,ownerState:x,ref:t}),[k,T]=useSlot("heading",{elementType:Dg,externalForwardedProps:C,className:I.heading,ownerState:x}),[M,$]=useSlot("transition",{elementType:_g,externalForwardedProps:C,ownerState:x}),[N,P]=useSlot("region",{elementType:Bg,externalForwardedProps:C,ownerState:x,className:I.region,additionalProps:{"aria-labelledby":v.props.id,id:v.props["aria-controls"],role:"region"}});return(0,ps.jsxs)(E,{...R,children:[(0,ps.jsx)(k,{...T,children:(0,ps.jsx)(jg.Provider,{value:S,children:v})}),(0,ps.jsx)(M,{in:g,timeout:"auto",...$,children:(0,ps.jsx)(N,{...P,children:w})})]})});function getAccordionDetailsUtilityClass(e){return generateUtilityClass("MuiAccordionDetails",e)}generateUtilityClasses("MuiAccordionDetails",["root"]);var useUtilityClasses$2=e=>{const{classes:t}=e;return composeClasses({root:["root"]},getAccordionDetailsUtilityClass,t)},Wg=Fl("div",{name:"MuiAccordionDetails",slot:"Root"})(Kl(({theme:e})=>({padding:e.spacing(1,2,2)}))),Vg=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiAccordionDetails"}),{className:o,...a}=n,i=n;return(0,ps.jsx)(Wg,{className:clsx(useUtilityClasses$2(i).root,o),ref:t,ownerState:i,...a})});function getAccordionSummaryUtilityClass(e){return generateUtilityClass("MuiAccordionSummary",e)}var Hg=generateUtilityClasses("MuiAccordionSummary",["root","expanded","focusVisible","disabled","gutters","content","expandIconWrapper"]),useUtilityClasses$1=e=>{const{classes:t,expanded:n,disabled:o,disableGutters:a}=e;return composeClasses({root:["root",n&&"expanded",o&&"disabled",!a&&"gutters"],focusVisible:["focusVisible"],content:["content",n&&"expanded"],expandIconWrapper:["expandIconWrapper",n&&"expanded"]},getAccordionSummaryUtilityClass,t)},Ug=Fl(Lc,{name:"MuiAccordionSummary",slot:"Root"})(Kl(({theme:e})=>{const t={duration:e.transitions.duration.shortest};return{display:"flex",width:"100%",minHeight:48,padding:e.spacing(0,2),transition:e.transitions.create(["min-height","background-color"],t),[`&.${Hg.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Hg.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`&:hover:not(.${Hg.disabled})`]:{cursor:"pointer"},variants:[{props:e=>!e.disableGutters,style:{[`&.${Hg.expanded}`]:{minHeight:64}}}]}})),qg=Fl("span",{name:"MuiAccordionSummary",slot:"Content"})(Kl(({theme:e})=>({display:"flex",textAlign:"start",flexGrow:1,margin:"12px 0",variants:[{props:e=>!e.disableGutters,style:{transition:e.transitions.create(["margin"],{duration:e.transitions.duration.shortest}),[`&.${Hg.expanded}`]:{margin:"20px 0"}}}]}))),Kg=Fl("span",{name:"MuiAccordionSummary",slot:"ExpandIconWrapper"})(Kl(({theme:e})=>({display:"flex",color:(e.vars||e).palette.action.active,transform:"rotate(0deg)",transition:e.transitions.create("transform",{duration:e.transitions.duration.shortest}),[`&.${Hg.expanded}`]:{transform:"rotate(180deg)"}}))),Zg=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiAccordionSummary"}),{children:o,className:a,expandIcon:i,focusVisibleClassName:s,onClick:l,slots:d,slotProps:u,...p}=n,{disabled:m=!1,disableGutters:h,expanded:g,toggle:y}=c.useContext(jg),handleChange=e=>{y&&y(e),l&&l(e)},b={...n,expanded:g,disabled:m,disableGutters:h},v=useUtilityClasses$1(b),w={slots:d,slotProps:u},[S,x]=useSlot("root",{ref:t,shouldForwardComponentProp:!0,className:clsx(v.root,a),elementType:Ug,externalForwardedProps:{...w,...p},ownerState:b,additionalProps:{focusRipple:!1,disableRipple:!0,internalNativeButton:!0,disabled:m,"aria-expanded":g,focusVisibleClassName:clsx(v.focusVisible,s)},getSlotProps:e=>({...e,onClick:t=>{e.onClick?.(t),handleChange(t)}})}),[I,C]=useSlot("content",{className:v.content,elementType:qg,externalForwardedProps:w,ownerState:b}),[E,R]=useSlot("expandIconWrapper",{className:v.expandIconWrapper,elementType:Kg,externalForwardedProps:w,ownerState:b});return(0,ps.jsxs)(S,{...x,children:[(0,ps.jsx)(I,{...C,children:o}),i&&(0,ps.jsx)(E,{...R,children:i})]})}),Yg=Object.freeze(["travel","map","landmarks","search","wormholes","tracking","intel","system"]),Xg=Object.freeze({intel:"Intelligence",landmarks:"Landmarks",map:"Map",search:"Search",system:"System",tracking:"Tracking",travel:"Travel",wormholes:"Wormholes"}),Jg=Object.freeze([{id:"travel",title:"Travel",entries:[{call:"goto <room id|landmark|area>",description:"Resolve a destination and begin travel."},{call:"stop",description:"Stop the active walker plan."}]},{id:"search",title:"Search",entries:[{call:"find <text>",description:"Search room names."},{call:"area <text>",description:"Search area names."},{call:"gamearea <text>",description:"Resolve Game Area labels to crowdmap areas."},{call:"npc <text>",description:"Search denizens through the configured remote client."}]},{id:"landmarks",title:"Landmarks",entries:[{call:"mark <name>",description:"Save the current room as a landmark."},{call:"unmark <name>",description:"Remove a saved landmark by name."},{call:"marks",description:"List saved landmarks."}]},{id:"map",title:"Map",entries:[{call:"roominfo",description:"Print current room details."},{call:"zoom <level>",description:"Set the map zoom level."},{call:"fit",description:"Fit the viewport to the visible area."},{call:"center",description:"Center the viewport on the current room."},{call:"refresh",description:"Refresh the map renderer."}]},{id:"wormholes",title:"Wormholes",entries:[{call:"wormholes on|off",description:"Enable or disable wormhole travel.",meta:"Also accepts: nm wormhole on|off"},{call:"wormholes [list]",description:"List loaded remote wormholes.",meta:"Also accepts: nm wormhole [list]"},{call:"wormholes refresh",description:"Reload wormholes and refresh graph pathing edges."},{call:"wormholes probe [command]",description:"Send a probe command and arm the parser."},{call:"wormholes add <source> <target>",description:"Create or replace a remote wormhole."},{call:"wormholes remove [source]",description:"Remove a remote wormhole by source room."}]},{id:"travel-options",title:"Travel Options",entries:[{call:"clouds on|off",description:"Toggle both eagleWings and atavianWings travel."},{call:"highclouds on|off",description:"Toggle atavianWings travel.",meta:"Also accepts: nm atavianwings on|off"},{call:"lowclouds on|off",description:"Toggle eagleWings travel.",meta:"Also accepts: nm eaglewings on|off"},{call:"sewergrates on|off",description:"Toggle sewergrate travel.",meta:"Also accepts: nm sewergrate on|off, nm grates on|off"},{call:"universe on|off",description:"Toggle universe travel."},{call:"knocker on|off",description:"Toggle knocker travel."},{call:"airharness on|off",description:"Toggle airHarness travel."},{call:"wings on|off",description:"Toggle all wing travel classes."}]},{id:"tracking",title:"Tracking",entries:[{call:"track <room id> <name>",description:"Track a target at a known room."},{call:"track-pet <room id> <name>",description:"Track a pet at a known room."},{call:"untrack [subject]",description:"Clear one tracked subject or all tracking overlays."}]},{id:"intel",title:"Intelligence",entries:[{call:"fullsense <name>[, <name>...]",description:"Highlight one or more fullsense entries."}]},{id:"system",title:"System",entries:[{call:"config",description:"Open the settings dialog."},{call:"settings",description:"Open the settings dialog."},{call:"shell",description:"Open the nexMap4 shell."},{call:"help",description:"Show command help."}]}]),Qg=Object.freeze({id:"api-helpers",title:"API Helpers",entries:[{code:"nexMap.api.commands.execute(commandId, input, options)",description:"Dispatch one command by explicit nexMap4 command id."},{code:"nexMap.api.commands.get(commandId)",description:"Return metadata for one command."},{code:"nexMap.api.commands.list()",description:"Return command metadata for menus or help."},{code:"nexMap.api.commands.menu()",description:"Return the grouped command menu."},{code:"nexMap.api.commands.parseAndExecute(rawInput, options)",description:"Parse an nm command body and execute the routed command."},{code:"nexMap.api.travel.planRoute(roomId, options)",description:"Compute a route without starting walker execution."},{code:"nexMap.api.travel.toggle(travelClass, enabledOrOptions, options)",description:"Toggle a persisted fast-travel option."},{code:"nexMap.api.travel.isEnabled(travelClass)",description:"Return whether a fast-travel option is currently enabled."},{code:"nexMap.api.travel.travelEnabled(travelClass)",description:"Alias for nexMap.api.travel.isEnabled(travelClass)."}]}),ef=Object.freeze({farsee:"nexMap.api.intel.farsee(input, options)","farsee.area":"nexMap.api.intel.farseeArea(input, options)",fullsense:"nexMap.api.intel.fullsense(entries, options)","landmark.add":"nexMap.api.landmarks.add(name, options)","landmark.list":"nexMap.api.landmarks.list(options)","landmark.remove":"nexMap.api.landmarks.remove(nameOrId, options)","map.center":"nexMap.api.map.center(roomId, options)","map.fit":"nexMap.api.map.fit(options)","map.refresh":"nexMap.api.map.refresh(options)","map.roomInfo":"nexMap.api.map.roomInfo(roomId, options)","map.selectRoom":"nexMap.api.map.selectRoom(roomId, options)","map.showArea":"nexMap.api.map.showArea(areaId, options)","map.showRoom":"nexMap.api.map.showRoom(roomId, options)","map.zoom":"nexMap.api.map.zoom(level, options)","search.area":"nexMap.api.search.area(text, options)","search.areas":"nexMap.api.search.areas(text, options)","search.denizens":"nexMap.api.search.denizens(text, options)","search.gameArea":"nexMap.api.search.gameArea(text, options)","search.rooms":"nexMap.api.search.rooms(text, options)","system.notice":"nexMap.api.system.notice(message, options)","system.openSettings":"nexMap.api.system.openSettings(options)","system.openShell":"nexMap.api.system.openShell(tab, options)","system.showResults":"nexMap.api.system.showResults(input, options)","tracking.clear":"nexMap.api.tracking.clear(type, options)","tracking.list":"nexMap.api.tracking.list(options)","tracking.subject":"nexMap.api.tracking.subject(roomId, options)","travel.disable":"nexMap.api.travel.disable(travelClass, options)","travel.enable":"nexMap.api.travel.enable(travelClass, options)","travel.goto":"nexMap.api.travel.goto(target, options)","travel.stop":"nexMap.api.travel.stop(reason, options)","travel.toArea":"nexMap.api.travel.toArea(areaId, options)","travel.toLandmark":"nexMap.api.travel.toLandmark(nameOrId, options)","travel.toRoom":"nexMap.api.travel.toRoom(roomId, options)","wormholes.add":"nexMap.api.wormholes.add(input, options)","wormholes.list":"nexMap.api.wormholes.list(options)","wormholes.probe":"nexMap.api.wormholes.probe(options)","wormholes.refresh":"nexMap.api.wormholes.refresh(options)","wormholes.remove":"nexMap.api.wormholes.remove(sourceRoomId, options)"});function HelpPanel(){const{router:e}=useNexMap(),t=c.useMemo(()=>e?e.listCommands?.()??[]:[],[e]),n=c.useMemo(()=>e?e.getMenu?.()??[]:[],[e]),o=c.useMemo(()=>new Map(t.map(e=>[e.id,e])),[t]),a=c.useMemo(()=>{if(n.length>0)return n;const e=new Map;for(const n of t){const t=n.group??"other";e.has(t)||e.set(t,[]),e.get(t).push(n.id)}return[...e.entries()].map(([e,t])=>({id:e,title:Xg[e]??e,commandIds:t}))},[n,t]),i=c.useMemo(()=>[...a].sort((e,t)=>{const n=Yg.indexOf(e.id),o=Yg.indexOf(t.id);return-1===n&&-1===o?0:-1===n?1:-1===o?-1:n-o}),[a]);return(0,ps.jsxs)(Hl,{sx:{flex:1,minHeight:0,overflowY:"auto"},children:[(0,ps.jsx)(HelpAccordion,{title:"Nexus Aliases",children:Jg.map((e,t)=>(0,ps.jsx)(ReferenceGroup,{title:e.title,divider:t>0,children:e.entries.map(e=>(0,ps.jsx)(ReferenceRow,{code:`nm ${e.call}`,description:e.description,meta:e.meta},e.call))},e.id))}),(0,ps.jsxs)(HelpAccordion,{title:"nexMap API",children:[0===t.length?(0,ps.jsx)(Jl,{variant:"body2",color:"text.secondary",children:"Command list unavailable."}):i.map((e,t)=>(0,ps.jsx)(ReferenceGroup,{title:e.title,divider:t>0,children:e.commandIds.map(e=>{const t=o.get(e);return t?(0,ps.jsx)(ReferenceRow,{code:apiCallForCommand(e),description:t.description,meta:`Command: ${e}`},e):null})},e.id)),t.length>0&&(0,ps.jsx)(ReferenceGroup,{title:Qg.title,divider:!0,children:Qg.entries.map(e=>(0,ps.jsx)(ReferenceRow,{code:e.code,description:e.description},e.code))})]})]})}function HelpAccordion({children:e,title:t}){return(0,ps.jsxs)(Gg,{disableGutters:!0,sx:{border:1,borderColor:"divider",borderRadius:1,boxShadow:"none",mb:1.25,overflow:"hidden","&:before":{display:"none"}},children:[(0,ps.jsx)(Zg,{expandIcon:(0,ps.jsx)(ExpandIcon,{}),sx:{bgcolor:"action.hover",minHeight:42,px:1.5,"& .MuiAccordionSummary-content":{my:1}},children:(0,ps.jsx)(Jl,{variant:"subtitle2",sx:{fontWeight:700},children:t})}),(0,ps.jsx)(Vg,{sx:{px:1.5,py:1.25},children:e})]})}function ExpandIcon(){return(0,ps.jsx)(Hl,{component:"span",sx:{borderBottom:2,borderColor:"text.secondary",borderRight:2,display:"inline-block",height:8,transform:"rotate(45deg)",width:8}})}function ReferenceGroup({children:e,divider:t=!1,title:n}){return(0,ps.jsxs)(Hl,{sx:{mb:1.5},children:[t&&(0,ps.jsx)(Wu,{sx:{mb:1.5}}),(0,ps.jsx)(Jl,{variant:"overline",sx:{color:"primary.main",display:"block",fontSize:10,fontWeight:700,letterSpacing:"0.12em",mb:.5},children:n}),e]})}function ReferenceRow({code:e,description:t,meta:n}){return(0,ps.jsxs)(Hl,{sx:{mb:.85},children:[(0,ps.jsx)(Jl,{variant:"body2",component:"span",sx:{color:"text.primary",display:"block",fontFamily:"monospace",fontSize:12,fontWeight:600,overflowWrap:"anywhere"},children:e}),t&&(0,ps.jsx)(Jl,{variant:"caption",sx:{color:"text.secondary",display:"block",ml:1.5},children:t}),n&&(0,ps.jsx)(Jl,{variant:"caption",sx:{color:"text.disabled",display:"block",fontFamily:"monospace",ml:1.5},children:n})]})}function apiCallForCommand(e){return ef[e]??`nexMap.api.commands.execute("${e}", input, options)`}var tf=Object.freeze(["landmarks","npcs","help"]);function ShellDialog(){const{uiStore:e}=useNexMap(),t=useNexUiStore(),n=t?.shellOpen??!1,o=t?.shellTab??"landmarks",[a,i]=c.useState(tabIndex(o));function handleClose(){e?.setState({shellOpen:!1})}function handleTabChange(t,n){i(n),e?.setState({shellTab:tf[n]??"landmarks"})}return c.useEffect(()=>{i(tabIndex(o))},[o]),(0,ps.jsx)(NexWindowDialog,{contentSx:{display:"flex",flexDirection:"column",overflow:"hidden"},headerContent:(0,ps.jsxs)(Rd,{value:a,onChange:handleTabChange,variant:"fullWidth",children:[(0,ps.jsx)(ud,{label:"Landmarks"}),(0,ps.jsx)(ud,{label:"NPCs"}),(0,ps.jsx)(ud,{label:"Help"})]}),initialPosition:"center",minWidth:320,onClose:handleClose,open:n,paperSx:e=>({height:e.nexmap?.window?.shellHeight??600,zIndex:1200}),width:1e3,title:"nexMap4",children:(0,ps.jsxs)(Hl,{sx:{display:"flex",flexDirection:"column",flex:1,minHeight:0,overflow:"hidden",p:e=>e.spacing(e.nexmap?.window?.contentPadding??1.5)},children:[0===a&&(0,ps.jsx)(LandmarksPanel,{}),1===a&&(0,ps.jsx)(NpcExplorerPanel,{}),2===a&&(0,ps.jsx)(HelpPanel,{})]})})}function tabIndex(e){const t=tf.indexOf(e);return t>=0?t:0}function getAlertUtilityClass(e){return generateUtilityClass("MuiAlert",e)}var rf=generateUtilityClasses("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","outlined","standard"]),nf=createSvgIcon((0,ps.jsx)("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),of=createSvgIcon((0,ps.jsx)("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),af=createSvgIcon((0,ps.jsx)("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),sf=createSvgIcon((0,ps.jsx)("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),lf=createSvgIcon((0,ps.jsx)("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),useUtilityClasses=e=>{const{variant:t,color:n,severity:o,classes:a}=e;return composeClasses({root:["root",`color${Zl(n||o)}`,`${t}`],icon:["icon"],message:["message"],action:["action"]},getAlertUtilityClass,a)},cf=Fl(Bd,{name:"MuiAlert",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.root,t[n.variant]]}})(Kl(({theme:e})=>{const t="light"===e.palette.mode?e.darken:e.lighten,n="light"===e.palette.mode?e.lighten:e.darken;return{...e.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(e.palette).filter(createSimplePaletteValueFilter(["light"])).map(([o])=>({props:{colorSeverity:o,variant:"standard"},style:{color:e.vars?e.vars.palette.Alert[`${o}Color`]:t(e.palette[o].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${o}StandardBg`]:n(e.palette[o].light,.9),[`& .${rf.icon}`]:e.vars?{color:e.vars.palette.Alert[`${o}IconColor`]}:{color:e.palette[o].main}}})),...Object.entries(e.palette).filter(createSimplePaletteValueFilter(["light"])).map(([n])=>({props:{colorSeverity:n,variant:"outlined"},style:{color:e.vars?e.vars.palette.Alert[`${n}Color`]:t(e.palette[n].light,.6),border:`1px solid ${(e.vars||e).palette[n].light}`,[`& .${rf.icon}`]:e.vars?{color:e.vars.palette.Alert[`${n}IconColor`]}:{color:e.palette[n].main}}})),...Object.entries(e.palette).filter(createSimplePaletteValueFilter(["dark"])).map(([t])=>({props:{colorSeverity:t,variant:"filled"},style:{fontWeight:e.typography.fontWeightMedium,...e.vars?{color:e.vars.palette.Alert[`${t}FilledColor`],backgroundColor:e.vars.palette.Alert[`${t}FilledBg`]}:{backgroundColor:"dark"===e.palette.mode?e.palette[t].dark:e.palette[t].main,color:e.palette.getContrastText(e.palette[t].main)}}}))]}})),df=Fl("div",{name:"MuiAlert",slot:"Icon"})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),uf=Fl("div",{name:"MuiAlert",slot:"Message"})({padding:"8px 0",minWidth:0,overflow:"auto"}),pf=Fl("div",{name:"MuiAlert",slot:"Action"})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),mf={success:(0,ps.jsx)(nf,{fontSize:"inherit"}),warning:(0,ps.jsx)(of,{fontSize:"inherit"}),error:(0,ps.jsx)(af,{fontSize:"inherit"}),info:(0,ps.jsx)(sf,{fontSize:"inherit"})},hf=c.forwardRef(function(e,t){const n=useDefaultProps({props:e,name:"MuiAlert"}),{action:o,children:a,className:i,closeText:s="Close",color:l,icon:c,iconMapping:d=mf,onClose:u,role:p="alert",severity:m="success",slotProps:h={},slots:g={},variant:y="standard",...b}=n,v={...n,color:l,severity:m,variant:y,colorSeverity:l||m},w=useUtilityClasses(v),S={slots:g,slotProps:h},[x,I]=useSlot("root",{ref:t,shouldForwardComponentProp:!0,className:clsx(w.root,i),elementType:cf,externalForwardedProps:{...S,...b},ownerState:v,additionalProps:{role:p,elevation:0}}),[C,E]=useSlot("icon",{className:w.icon,elementType:df,externalForwardedProps:S,ownerState:v}),[R,k]=useSlot("message",{className:w.message,elementType:uf,externalForwardedProps:S,ownerState:v}),[T,M]=useSlot("action",{className:w.action,elementType:pf,externalForwardedProps:S,ownerState:v}),[$,N]=useSlot("closeButton",{elementType:Qd,externalForwardedProps:S,ownerState:v}),[P,O]=useSlot("closeIcon",{elementType:lf,externalForwardedProps:S,ownerState:v});return(0,ps.jsxs)(x,{...I,children:[!1!==c?(0,ps.jsx)(C,{...E,children:c||d[m]||mf[m]}):null,(0,ps.jsx)(R,{...k,children:a}),null!=o?(0,ps.jsx)(T,{...M,children:o}):null,null==o&&u?(0,ps.jsx)(T,{...M,children:(0,ps.jsx)($,{size:"small","aria-label":s,title:s,color:"inherit",onClick:u,...N,children:(0,ps.jsx)(P,{fontSize:"small",...O})})}):null]})}),gf=4e3;function PathingNotices(){const{uiStore:e}=useNexMap(),t=useNexUiStore(),n=!1!==useNexMapSettings()?.display?.pathingNotices,o=t?.pathingNotices??[];function dismiss(t){"function"==typeof e?.dismissNotice&&e.dismissNotice(t)}return n&&0!==o.length?(0,ps.jsx)(Hl,{sx:{bottom:40,display:"flex",flexDirection:"column",gap:.75,left:"50%",maxWidth:400,pointerEvents:"none",position:"absolute",transform:"translateX(-50%)",width:"calc(100% - 48px)",zIndex:1400},children:o.map(e=>(0,ps.jsx)(DismissibleNotice,{notice:e,onDismiss:dismiss},e.id))}):null}function DismissibleNotice({notice:e,onDismiss:t}){return c.useEffect(()=>{const n=setTimeout(()=>{t(e.id)},gf);return()=>clearTimeout(n)},[e.id,t]),(0,ps.jsx)(_g,{in:!0,appear:!0,timeout:200,children:(0,ps.jsx)(hf,{severity:e.severity??"info",variant:"filled",sx:{borderRadius:1,boxShadow:4,fontSize:13,pointerEvents:"auto",py:.5},children:e.message})})}function NexMapRoot({container:e,viewModel:t,mapStore:n,settingsApi:o,router:a,uiStore:i,theme:s}){return(0,ps.jsx)(NexMapProvider,{viewModel:t,mapStore:n,settingsApi:o,router:a,uiStore:i,theme:s,children:(0,ps.jsxs)(Hl,{className:"nexmap4-tab-shell","data-nexmap4-tab-shell":"true",sx:{bgcolor:"background.default",display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",position:"relative",width:"100%"},children:[(0,ps.jsx)(RoomHeader,{}),(0,ps.jsx)(ec,{container:e}),(0,ps.jsx)(ExitFooter,{}),(0,ps.jsx)(SettingsDialog,{}),(0,ps.jsx)(ResultsDialog,{}),(0,ps.jsx)(ShellDialog,{}),(0,ps.jsx)(PathingNotices,{})]})})}function patchGetTabObject(e,t){void 0===e.get_tab_object_original&&(e.get_tab_object_original=e.get_tab_object),t&&"object"==typeof t&&void 0===t.get_tab_object_original&&(t.get_tab_object_original=e.get_tab_object_original??t.get_tab_object);const n=t?.get_tab_object_original??e.get_tab_object_original??t?.get_tab_object;e.get_tab_object=function(t,o){const a=this?.nexoverrides??e.nexoverrides;return a?.[t]?a[t](o):"function"==typeof n?n.call(this,t,o):null},t&&"object"==typeof t&&t!==e&&(t.get_tab_object=e.get_tab_object)}function upsertLayoutTab({container:e,layout:t,tabSpec:n}){if(!t)return attachFallbackContainer(e),{existing:!1,injected:!1,method:"fallback-body"};const o=findExistingTab(t,n.id);if(o)return{existing:!0,injected:!0,method:"existing",tab:o};const a=callFlexLayoutAddNode(t,n);return a.injected?a:(attachFallbackContainer(e),{existing:!1,injected:!1,method:"fallback-body"})}function callFlexLayoutAddNode(e,t){const n=resolveFlexModel(e);if(!n||"function"!=typeof n.doAction)return{injected:!1};const o=("function"==typeof n.getNodeById?n.getNodeById("map"):null)?.getParent?.()?.getId?.()??getNodeId(findFirstTabset(n))??"root";return n.doAction({data:{json:t,location:"center",toNode:o},type:"FlexLayout_AddNode"}),{existing:!1,injected:!0,method:"FlexLayout_AddNode",tab:findExistingTab(e,t.id)??t}}function findExistingTab(e,t){if(!e||!t)return null;const n=resolveFlexModel(e);if("function"==typeof n?.getNodeById){const e=n.getNodeById(t);if(e)return e}return Array.isArray(e.tabs)?e.tabs.find(e=>e.id===t)??null:null}function findFirstTabset(e){if("function"!=typeof e?.visitNodes)return null;let t=null;return e.visitNodes(e=>{t||"tabset"!==e?.getType?.()||(t=e)}),t}function attachFallbackContainer(e){const t=e?.ownerDocument?.body;t&&e.parentNode!==t&&t.appendChild(e)}function selectLayoutTab({client:e,layout:t,tabId:n}){const o=resolveFlexModel(t);return"function"==typeof o?.doAction?(o.doAction({data:{tabNode:n},type:"FlexLayout_SelectTab"}),!0):e&&"function"==typeof e.selectTab?e.selectTab(n):"function"==typeof t?.selectTab?(t.selectTab(n),!0):"function"==typeof o?.selectTab&&(o.selectTab(n),!0)}function resolveFlexModel(e){return e?.flexModel??e?.flexlayout??e?.flexLayout?.model??null}function resolveLayout(e){try{return e?.nexusclient?.ui?.()?.layout?.()??null}catch{return null}}function resolveStoredLayout(e,t){try{return e?.nexusclient?._ui?._layout??t}catch{return t}}function getNodeId(e){return e?"function"==typeof e.getId?e.getId():e.id??null:null}function requestLayoutMount({client:e,container:t,host:n,select:o,tabComponent:a,tabId:i,tabSpec:s,tabFactory:l}){const c=resolveLayout(n),d=resolveStoredLayout(n,c);let u=!1;if(c&&"object"==typeof c){const e=c.nexoverrides??d?.nexoverrides??{};c.nexoverrides=e,d&&"object"==typeof d&&(d.nexoverrides=e),patchGetTabObject(c,d),e[a]?.__nexMapContainer===t||e[a]?.__nexMap4Container===t||(e[a]=l),u=!0}const p=upsertLayoutTab({container:t,layout:c,tabSpec:s});return{overrideRegistered:u,selected:!!o&&selectLayoutTab({client:e,layout:c,tabId:i}),...p}}function createInitialMapState(){return{area:null,currentArea:null,currentRoomId:null,exits:Object.freeze([]),graphReady:!1,rendererReady:!1,room:null}}function createMapStore(e=createInitialMapState()){const t=createStore(()=>({...e}));return t.patch=function(e){return t.setState(e),t.getState()},t.reset=function(){return t.setState(createInitialMapState(),!0),t.getState()},t.get=t.getState,t.set=function(e){t.setState(e,!0)},t}function createNexMapTabViewModel({mapStore:e=null}={}){const t=e??createMapStore();let n=null,o=null,a=null,i=null;function subscribe(e){if("function"!=typeof e)throw new Error("nexMap tab view subscribe requires a listener function.");return t.subscribe(e)}function getSnapshot(){return deriveSnapshot(t.getState(),o)}function setGraph(e){o=e??null;const n=t.getState().currentRoomId,a=resolveGraphRoomId(o,n),i=null===a?null:o?.getNode?.(a),s=i?o.getArea(i.areaId):null,l=i?createRoomExitViews(i,o):Object.freeze([]);t.setState({area:s?Object.freeze({continent:s.continent,id:s.id,name:s.name}):null,currentRoomId:i?.id??a,exits:Object.freeze(l),graphReady:Boolean(o),room:i?Object.freeze({areaId:i.areaId,id:i.id,name:i.name,z:i.coordinates.z}):null})}function setRenderer(e){a=e??null,t.setState({rendererReady:Boolean(a)})}function bindAdapter(e){i?.(),n=e??null,i=n?.gmcp?.subscribe?n.gmcp.subscribe(ga,e=>{const t=extractCurrentRoomIdFromEvent(e);null!==t&&setCurrentRoom(t)}):null}function setCurrentRoom(e,{center:n=!0}={}){const i=resolveGraphRoomId(o,e),s=null===i?null:o?.getNode?.(i);s&&a?(a.setVisibleSlice({areaId:s.areaId,z:s.coordinates.z}),a.setCurrentRoom(s.id),n&&a.center(s.id)):a&&a.fit();const l=s?o.getArea(s.areaId):null,c=s?createRoomExitViews(s,o):Object.freeze([]);t.setState({area:l?Object.freeze({continent:l.continent,id:l.id,name:l.name}):null,currentRoomId:s?.id??i,exits:Object.freeze(c),graphReady:Boolean(o),rendererReady:Boolean(a),room:s?Object.freeze({areaId:s.areaId,id:s.id,name:s.name,z:s.coordinates.z}):null})}function executeExit(e){const o=t.getState().exits.find(t=>t.id===e);return!!o?.command&&(n?.client?.sendCommands?.(o.command),!0)}function destroy(){i?.(),i=null,n=null,o=null,a=null,t.setState({area:null,currentArea:null,currentRoomId:null,exits:Object.freeze([]),graphReady:!1,rendererReady:!1,room:null},!0)}return Object.freeze({bindAdapter,destroy,executeExit,getSnapshot,mapStore:t,setCurrentRoom,setGraph,setRenderer,subscribe})}function deriveSnapshot(e,t){const n=resolveGraphRoomId(t,e.currentRoomId),o=null===n?null:t?.getNode?.(n),a=o?t.getArea(o.areaId):null;return Object.freeze({area:a?Object.freeze({continent:a.continent,id:a.id,name:a.name}):e.area,exits:e.exits,ready:Boolean(o),room:o?Object.freeze({areaId:o.areaId,id:o.id,name:o.name,z:o.coordinates.z}):e.room,roomId:o?.id??n})}function createRoomExitViews(e,t){const n=new Map;for(const o of t.outgoingEdges(e.id)){const e=String(o.targetId),t=n.get(e)??[];t.push(o),n.set(e,t)}return e.exits.map((o,a)=>createExitView({edge:n.get(String(o.exitId))?.shift()??null,exit:o,graph:t,index:a,roomId:e.id}))}function createExitView({edge:e,exit:t,graph:n,index:o,roomId:a}){const i=t.exitId,s=String(t.name??""),l=n.getNode(i);return Object.freeze({command:s,id:e?.id??`${String(a)}-${String(i)}:${String(o)}`,label:createExitLabel(s,i),targetId:i,targetName:l?.name??""})}function createExitLabel(e,t){const n=String(e??"").trim();return n?toShortDirection(n):String(t)}function resolveGraphRoomId(e,t){if(null==t||""===t)return null;if(e?.hasNode?.(t))return t;const n=Number(t);return Number.isFinite(n)&&e?.hasNode?.(n)?n:t}var ff="nexMap",yf="nexMap",bf="nexMap";function installNexMapTab({document:e=resolveDocument$2(),host:t=globalThis,router:n=null,select:o=!0,settingsApi:a=null,tabComponent:i=yf,tabId:s=ff,title:l=bf,uiStore:d=null,viewModel:u=createNexMapTabViewModel()}={}){if(!e||"function"!=typeof e.createElement)throw new Error("installNexMapTab requires a document.");const p=createTabContainer(e,s),tabFactory=()=>c.createElement(NexMapRoot,{container:p,router:n,settingsApi:a,uiStore:d,viewModel:u});tabFactory.__nexMapContainer=p,tabFactory.__nexMap4Container=p,tabFactory.__nexMapViewModel=u,tabFactory.__nexMap4ViewModel=u;const m=createTabNode({tabComponent:i,tabId:s,title:l}),h=requestLayoutMount({client:t.nexusclient,container:p,host:t,select:o,tabComponent:i,tabId:s,tabSpec:m,tabFactory}),g=[];return h.overrideRegistered||g.push("tab-override-unregistered"),h.injected||g.push("tab-injection-unconfirmed"),o&&!h.selected&&g.push("tab-select-unconfirmed"),Object.freeze({container:p,tabId:s,viewModel:u,warnings:g,...h})}function createTabContainer(e,t){const n=e.createElement("div");return n.className="nexmap4-root",n.dataset.nexmap4Root="true",n.id=t,n.style.display="flex",n.style.flex="1 1 auto",n.style.height="100%",n.style.minHeight="0",n.style.minWidth="0",n.style.position="relative",n.style.width="100%",n}function createTabNode({tabComponent:e,tabId:t,title:n}){return{component:e,helpText:n,icon:"feather-pointed",id:t,name:n,type:"tab"}}function resolveDocument$2(){return"undefined"!=typeof document?document:null}var vf=Object.freeze(["mount","destroy","setGraph","setVisibleSlice","setCurrentRoom","setSelection","setOverlay","clearOverlay","setBackground","setShowEdgeClasses","setRoomBorderIndicators","onRoomClick","fit","center","setZoom","getViewport"]);function assertMapRenderer(e){const t=vf.filter(t=>"function"!=typeof e?.[t]);if(t.length>0)throw new Error(`MapRenderer is missing required method(s): ${t.join(", ")}.`);return e}var wf="nexmap4-styles",Sf=new Map;function registerNexMapStyles(e,t,{document:n=null}={}){if(!e||"string"!=typeof t)return;Sf.set(e,t.trim());const o=getStyleElement(n);o&&(o.textContent=composeStylesheet())}function getStyleElement(e){const t=resolveDocument$1(e);if(!t||"function"!=typeof t.getElementById||!t.head)return null;const n=t.getElementById(wf);if(n)return n;const o=t.createElement("style");return o.id=wf,t.head.appendChild(o),o.textContent=composeStylesheet(),o}function composeStylesheet(){return Array.from(Sf.values()).filter(Boolean).join("\n\n")}function resolveDocument$1(e){return e||("undefined"!=typeof document?document:null)}var xf="svg-renderer",If='\n.nexmap4-tab-shell {\n background: #101820;\n color: #dce7f2;\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n min-width: 0;\n font-family: "Roboto Mono", Consolas, monospace;\n font-size: 13px;\n overflow: hidden;\n position: relative;\n width: 100%;\n}\n\n.nexmap4-tab-header,\n.nexmap4-tab-footer {\n align-items: center;\n background: rgba(0, 0, 0, 0.5);\n box-sizing: border-box;\n display: flex;\n flex: 0 0 auto;\n gap: 8px;\n line-height: 1.2;\n min-height: 30px;\n padding: 5px 8px;\n position: relative;\n z-index: 2;\n}\n\n.nexmap4-tab-header {\n justify-content: space-between;\n}\n\n.nexmap4-tab-header strong {\n font-size: 13px;\n font-weight: 700;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.nexmap4-tab-header span {\n color: #aebdca;\n flex: 0 0 auto;\n font-size: 13px;\n}\n\n.nexmap4-renderer-pane,\n.nexmap4-root {\n flex: 1 1 auto;\n min-height: 0;\n min-width: 0;\n}\n\n.nexmap4-tab-footer {\n flex-wrap: wrap;\n font-size: 13px;\n}\n\n.nexmap4-tab-footer__label {\n color: #aebdca;\n font-weight: 700;\n}\n\n.nexmap4-exit-command {\n background: transparent;\n border: 0;\n color: #dce7f2;\n cursor: pointer;\n font: inherit;\n padding: 0;\n text-decoration: underline;\n}\n\n.nexmap4-exit-command:hover,\n.nexmap4-exit-command:focus-visible {\n color: #ffffff;\n}\n\n.nexmap4-exit-separator,\n.nexmap4-exit-empty {\n color: #aebdca;\n}\n\n.nexmap4-svg-renderer {\n --nexmap4-background: #000000;\n --nexmap4-edge: #7f8b99;\n --nexmap4-edge-muted: #596575;\n --nexmap4-edge-door: #d08b42;\n --nexmap4-edge-scripted: #c07ad9;\n --nexmap4-edge-blocked: #a14444;\n --nexmap4-edge-oneway: #4da6ff;\n --nexmap4-room-stroke: #000000;\n --nexmap4-room-label: #dce7f2;\n --nexmap4-room-label-shadow: #081018;\n --nexmap4-current-room-border: #ff1493;\n --nexmap4-selection: #ffe66d;\n --nexmap4-overlay: #4dd6c6;\n --nexmap4-pseudo-special-leaves-area: #00ff9c;\n background: var(--nexmap4-background);\n block-size: 100%;\n color: var(--nexmap4-room-label);\n contain: strict;\n inline-size: 100%;\n overflow: hidden;\n position: relative;\n}\n\n.nexmap4-svg-viewport {\n transform-box: view-box;\n transform-origin: 0 0;\n will-change: transform;\n}\n\n.nexmap4-svg-background {\n background-position: center;\n background-repeat: no-repeat;\n background-size: cover;\n inset: 0;\n pointer-events: none;\n position: absolute;\n}\n\n.nexmap4-svg {\n block-size: 100%;\n cursor: grab;\n display: block;\n inline-size: 100%;\n position: relative;\n touch-action: none;\n}\n\n.nexmap4-svg-renderer.is-panning .nexmap4-svg,\n.nexmap4-svg-renderer.is-panning .nexmap4-svg * {\n cursor: grabbing !important;\n}\n\n.nexmap4-svg-layer {\n pointer-events: none;\n}\n\n.nexmap4-svg-edges,\n.nexmap4-svg-door-edges,\n.nexmap4-svg-pseudo-exits {\n color: var(--nexmap4-edge);\n}\n\n.nexmap4-svg-edge {\n fill: none;\n pointer-events: stroke;\n stroke: currentColor;\n stroke-linecap: round;\n stroke-linejoin: round;\n stroke-width: 1;\n}\n\n.nexmap4-svg-door-bar {\n fill: none;\n pointer-events: none;\n stroke: currentColor;\n stroke-linecap: butt;\n stroke-width: 2;\n}\n\n.nexmap4-svg-pseudo-exit.nexmap4-edge--door {\n color: var(--nexmap4-edge-door);\n stroke-dasharray: 5 4;\n}\n\n.nexmap4-svg-edge.nexmap4-edge--scripted,\n.nexmap4-svg-pseudo-exit.nexmap4-edge--scripted {\n color: var(--nexmap4-edge-scripted);\n stroke-dasharray: 7 4;\n}\n\n.nexmap4-svg-edge.nexmap4-edge--oneway,\n.nexmap4-svg-pseudo-exit.nexmap4-edge--oneway {\n color: var(--nexmap4-edge-oneway);\n stroke: var(--nexmap4-edge-oneway);\n stroke-dasharray: 4 4;\n}\n\n.nexmap4-svg-edge.nexmap4-edge--blocked {\n color: var(--nexmap4-edge-blocked);\n opacity: 0.42;\n}\n\n.nexmap4-svg-edge.is-selected {\n color: var(--nexmap4-selection);\n stroke-width: 2;\n}\n\n.nexmap4-svg-door-bar.is-selected {\n color: var(--nexmap4-selection);\n stroke-width: 3;\n}\n\n.nexmap4-svg-edge.is-overlayed {\n color: var(--nexmap4-overlay);\n stroke-width: 2;\n}\n\n.nexmap4-svg-door-bar.is-overlayed {\n color: var(--nexmap4-overlay);\n stroke-width: 3;\n}\n\n.nexmap4-svg-pseudo-exit {\n color: var(--nexmap4-edge-muted);\n}\n\n.nexmap4-svg-pseudo-exit.nexmap4-pseudo--cardinal {\n color: var(--nexmap4-edge);\n stroke-dasharray: none;\n}\n\n.nexmap4-svg-pseudo-exit.nexmap4-pseudo--special {\n color: #000000;\n}\n\n.nexmap4-svg-pseudo-line {\n fill: none;\n stroke: currentColor;\n stroke-linecap: round;\n stroke-width: 1;\n}\n\n.nexmap4-svg-pseudo-exit.nexmap4-pseudo--special .nexmap4-svg-pseudo-line,\n.nexmap4-svg-pseudo-exit.nexmap4-pseudo--special .nexmap4-svg-pseudo-arrow,\n.nexmap4-svg-pseudo-exit.nexmap4-pseudo--cardinal .nexmap4-svg-pseudo-glyph {\n display: none;\n}\n\n.nexmap4-svg-pseudo-glyph {\n fill: #ffffff;\n pointer-events: none;\n stroke: #000000;\n stroke-dasharray: none;\n stroke-linejoin: round;\n stroke-width: 0.5;\n}\n\n.nexmap4-svg-pseudo-exit.nexmap4-pseudo--leaves-area .nexmap4-svg-pseudo-glyph {\n fill: var(--nexmap4-edge-muted);\n}\n\n.nexmap4-svg-pseudo-exit.nexmap4-pseudo--special.nexmap4-pseudo--leaves-area .nexmap4-svg-pseudo-glyph {\n fill: var(--nexmap4-pseudo-special-leaves-area);\n}\n\n.nexmap4-svg-pseudo-arrow {\n fill: none;\n pointer-events: none;\n stroke: currentColor;\n stroke-linecap: round;\n stroke-linejoin: round;\n stroke-width: 1.2;\n}\n\n.nexmap4-svg-overlay-halo {\n fill: none;\n pointer-events: none;\n stroke: var(--nexmap4-overlay);\n stroke-width: 3;\n}\n\n.nexmap4-svg-room {\n cursor: pointer;\n pointer-events: auto;\n}\n\n.nexmap4-svg-room-shape {\n fill: var(--nexmap4-room-fill, #888888);\n stroke: var(--nexmap4-room-stroke);\n stroke-width: 0.5;\n}\n\n.nexmap4-svg-state-rooms,\n.nexmap4-svg-state-room {\n pointer-events: none;\n}\n\n.nexmap4-svg-state-room-shape {\n fill: none;\n stroke-linejoin: round;\n vector-effect: non-scaling-stroke;\n}\n\n.nexmap4-state-room--current .nexmap4-svg-state-room-shape {\n filter: drop-shadow(0 0 3px var(--nexmap4-current-room-border));\n stroke: var(--nexmap4-current-room-border);\n stroke-width: 4;\n}\n\n.nexmap4-state-room--selected .nexmap4-svg-state-room-shape {\n filter: drop-shadow(0 0 3px var(--nexmap4-selection));\n stroke: var(--nexmap4-selection);\n stroke-width: 4;\n}\n\n.nexmap4-svg-room.is-overlayed .nexmap4-svg-room-shape {\n filter: drop-shadow(0 0 4px var(--nexmap4-overlay));\n}\n\n.nexmap4-svg-symbol {\n pointer-events: none;\n}\n\n.nexmap4-svg-label {\n fill: var(--nexmap4-room-label);\n font-family: ui-sans-serif, system-ui, sans-serif;\n font-size: calc(var(--nexmap4-label-font-size, 8px) / max(var(--nexmap4-zoom, 1), 0.25));\n opacity: 0;\n paint-order: stroke;\n pointer-events: none;\n stroke: var(--nexmap4-room-label-shadow);\n stroke-width: calc(var(--nexmap4-label-font-size, 8px) * 0.375 / max(var(--nexmap4-zoom, 1), 0.25));\n text-anchor: middle;\n transition: opacity 0.12s ease;\n user-select: none;\n}\n\n/* Flash label into view on room hover, then fade out after 3s */\n.nexmap4-svg-label.nexmap4-label--hover {\n animation: nexmap4-label-flash 3s ease forwards;\n}\n\n@keyframes nexmap4-label-flash {\n 0% { opacity: 1; }\n 70% { opacity: 0.8; }\n 100% { opacity: 0; }\n}\n\n/* ── Named overlay classes ──────────────────────────────────────────── */\n\n.nexmap4-overlay-tracking-target {\n stroke: #e74c3c;\n animation: nexmap4-pulse-tracking 1.8s ease-in-out infinite;\n}\n\n.nexmap4-overlay-tracking-pet {\n stroke: #2ecc71;\n animation: nexmap4-pulse-tracking-pet 2s ease-in-out infinite;\n}\n\n.nexmap4-overlay-tracking-doppleganger {\n stroke: #9b59b6;\n animation: nexmap4-pulse-tracking-doppleganger 1.6s ease-in-out infinite;\n}\n\n.nexmap4-overlay-farsee {\n stroke: #f1c40f;\n animation: nexmap4-pulse-farsee 2.2s ease-in-out infinite;\n}\n\n.nexmap4-overlay-fullsense {\n stroke: #1abc9c;\n animation: nexmap4-pulse-fullsense 2.4s ease-in-out infinite;\n}\n\n/* ── Pulse keyframe animations ──────────────────────────────────────── */\n\n@keyframes nexmap4-pulse-tracking {\n 0%, 100% { stroke-opacity: 1; stroke-width: 3; }\n 50% { stroke-opacity: 0.4; stroke-width: 5; }\n}\n\n@keyframes nexmap4-pulse-tracking-pet {\n 0%, 100% { stroke-opacity: 1; stroke-width: 3; }\n 50% { stroke-opacity: 0.35; stroke-width: 4.5; }\n}\n\n@keyframes nexmap4-pulse-tracking-doppleganger {\n 0%, 100% { stroke-opacity: 1; stroke-width: 3; }\n 50% { stroke-opacity: 0.3; stroke-width: 5.5; }\n}\n\n@keyframes nexmap4-pulse-farsee {\n 0%, 100% { stroke-opacity: 0.9; stroke-width: 3; }\n 50% { stroke-opacity: 0.3; stroke-width: 4; }\n}\n\n@keyframes nexmap4-pulse-fullsense {\n 0%, 100% { stroke-opacity: 0.85; stroke-width: 2.5; }\n 50% { stroke-opacity: 0.25; stroke-width: 4; }\n}\n\n/* ── Per-class edge visibility toggles ──────────────────────────────── */\n\n.nexmap4-svg-edge.nexmap4-edge--hidden,\n.nexmap4-svg-door-bar.nexmap4-edge--hidden,\n.nexmap4-svg-pseudo-exit.nexmap4-edge--hidden {\n display: none;\n}\n\n/* ── Room border indicators ─────────────────────────────────────────── */\n\n.nexmap4-svg-room-border-topleft,\n.nexmap4-svg-room-border-bottomright {\n fill: none;\n pointer-events: none;\n stroke: none;\n stroke-linecap: butt;\n stroke-width: 2;\n}\n\n.nexmap4-svg-renderer[data-outdoor-border="true"] .nexmap4-svg-room.is-outdoors .nexmap4-svg-room-border-topleft {\n stroke: var(--nexmap4-outdoor-room-border, #44aaff);\n}\n\n.nexmap4-svg-renderer[data-wormhole-border="true"] .nexmap4-svg-room.has-wormhole .nexmap4-svg-room-border-bottomright {\n stroke: var(--nexmap4-wormhole-room-border, #aa44ff);\n}\n';function injectSvgRendererStyles({document:e=null}={}){registerNexMapStyles(xf,If,{document:e})}var Cf=Object.freeze([]),Ef=new Set(["e","east","n","ne","north","northeast","northwest","nw","s","se","south","southeast","southwest","sw","w","west"]),Rf=new Set(["d","down","in","out","u","up"]);function projectVisualSlice({snapshot:e,nodesById:t,visibleSlice:n,showEdgeClasses:o}){const a=new Map(e.edges.map(e=>[e.id,e])),i=areaZRecordIds(e.indices.areaZRoomIds,n),s=areaZRecordIds(e.indices.areaZEdgeIds,n),l=i.map(e=>lookupRecord(t,e)).filter(Boolean),c=new Set(l.map(e=>e.id)),d=[],u=[];for(const g of s){const e=a.get(g);if(!e||!c.has(e.sourceId))continue;const i=lookupRecord(t,e.targetId),s=c.has(e.targetId)&&Number(i?.coordinates?.z)===Number(n.z);isSpecialPseudoExit(e)?d.push(createDirectedVisualEdge(e,"pseudo")):s&&shouldIncludeVisibleEdge(e,o)?u.push(e):isDisplayablePseudoExit(e)&&d.push(createDirectedVisualEdge(e,"pseudo"))}const p=createOrdinaryVisualEdges(u),m=new Map,h=new Map;for(const g of[...p,...d]){h.set(g.id,g.directedEdgeIds);for(const e of g.directedEdgeIds)m.set(e,g.id)}return Object.freeze({directedEdgeIdsByVisualEdgeId:h,ordinaryVisualEdges:Object.freeze(p),pseudoVisualEdges:Object.freeze(d),roomRecords:Object.freeze(l),visualEdgeIdByDirectedEdgeId:m})}function isDoorVisualEdge(e){return Array.isArray(e?.doorEdgeIds)&&e.doorEdgeIds.length>0}function areaZRecordIds(e,t){return e?.[String(t.areaId)]?.[String(t.z)]??Cf}function lookupRecord(e,t){return e?"function"==typeof e.get?e.get(t)??null:e[t]??e[String(t)]??null:null}function createOrdinaryVisualEdges(e){const t=new Map,n=[];for(const a of e){if(!isCollapsibleOrdinaryEdge(a)||!0===a.classes?.includes?.("oneway")){n.push(createDirectedVisualEdge(a,"ordinary"));continue}const e=undirectedRoomPairKey(a.sourceId,a.targetId),o=t.get(e)??[];o.push(a),t.set(e,o)}const o=[];for(const a of t.values())hasVisibleReciprocalEdges(a)?o.push(createBidirectionalVisualEdge(a)):n.push(...a.map(e=>createDirectedVisualEdge(e,"ordinary")));return[...o,...n]}function createDirectedVisualEdge(e,t){return createVisualEdge({bidirectional:!1,edges:[e],id:`visual:${t}:${e.id}`,kind:t,sourceId:e.sourceId,targetId:e.targetId})}function createBidirectionalVisualEdge(e){const[t,n]=canonicalRoomPair(e[0].sourceId,e[0].targetId);return createVisualEdge({bidirectional:!0,edges:e,id:`visual:ordinary:${t}-${n}`,kind:"ordinary",sourceId:t,targetId:n})}function createVisualEdge({bidirectional:e,edges:t,id:n,kind:o,sourceId:a,targetId:i}){const s=selectRepresentativeEdge(t,a,i),l=selectVisualGeometry(t,{bidirectional:e,sourceId:a,targetId:i}),c=orderDirectedEdgeIds(t,s.id),d=orderDirectedEdgeIds(t.filter(isDoorEdge),null),u=Object.fromEntries(t.map(e=>[e.id,String(e.command??"")]));return Object.freeze({bidirectional:e,classes:Object.freeze(aggregateVisualClasses(t,{bidirectional:e,geometry:l})),commandsByEdgeId:Object.freeze(u),directedEdgeIds:Object.freeze(c),doorEdgeIds:Object.freeze(d),geometry:l,id:n,kind:o,oneWay:!e&&1===t.length&&!0===t[0].classes?.includes?.("oneway"),representativeEdgeId:s.id,sourceId:a,targetId:i})}function orderDirectedEdgeIds(e,t){const n=e.map(e=>e.id).sort(compareIds);return null==t?n:[t,...n.filter(e=>e!==t)]}function selectRepresentativeEdge(e,t,n){const o=e.filter(e=>e.sourceId===t&&e.targetId===n).sort((e,t)=>compareIds(e.id,t.id));return o.length>0?o[0]:[...e].sort((e,t)=>compareIds(e.id,t.id))[0]}function aggregateVisualClasses(e,{bidirectional:t,geometry:n}){const o=new Set;for(const a of e)for(const e of a.classes??Cf)"oneway"===e&&t||o.add(e);return t&&(o.delete("oneway"),o.add("bidirectional")),e.length>2&&o.add("multi-directed"),e.some(isDoorEdge)&&o.add("door"),"customLine"===n.kind&&(o.add("custom-line"),n.style&&o.add(`custom-line-${n.style}`),n.conflict&&o.add("custom-line-conflict")),addMixedClass(o,e,"door",isDoorEdge),addMixedClass(o,e,"locked",e=>!0===e.locked),addMixedClass(o,e,"blocked",e=>!0===e.classes?.includes?.("blocked")),addMixedClass(o,e,"scripted",e=>!0===e.classes?.includes?.("scripted")),addMixedClass(o,e,"dynamicWeight",e=>void 0!==e.weightExpression),new Set(e.map(e=>String(e.command??""))).size>1&&o.add("mixed-command"),new Set(e.map(e=>String(e.weight??""))).size>1&&o.add("mixed-weight"),[...o].sort(compareIds)}function selectVisualGeometry(e,{bidirectional:t,sourceId:n,targetId:o}){const a=e.flatMap(e=>{const t=isSpecialPseudoExit(e)?null:normalizeCustomLine(e.customLine);return t?[Object.freeze({edgeId:e.id,customLine:t,coordinates:Object.freeze(orientedCustomLineCoordinates(e,t.coordinates,n,o))})]:[]});if(0===a.length)return Object.freeze({kind:"roomLine"});const i=a.find(t=>e.some(e=>e.id===t.edgeId&&e.sourceId===n&&e.targetId===o))??a[0],s=t&&a.some(e=>!coordinatesEqual(e.coordinates,i.coordinates));return Object.freeze({color24RGB:i.customLine.color24RGB,conflict:s,coordinates:i.coordinates,endsInArrow:i.customLine.endsInArrow,kind:"customLine",sourceEdgeId:i.edgeId,style:i.customLine.style})}function normalizeCustomLine(e){return e&&Array.isArray(e.coordinates)&&0!==e.coordinates.length?Object.freeze({color24RGB:Array.isArray(e.color24RGB)?Object.freeze([...e.color24RGB]):void 0,coordinates:Object.freeze(e.coordinates.map(e=>Object.freeze([...e]))),endsInArrow:!0===e.endsInArrow,style:"string"==typeof e.style?e.style:void 0}):null}function orientedCustomLineCoordinates(e,t,n,o){return(e.sourceId===n&&e.targetId===o?t:[...t].reverse()).map(e=>Object.freeze([e[0],e[1]]))}function coordinatesEqual(e,t){return e.length===t.length&&e.every((e,n)=>Math.abs(e[0]-t[n][0])<1e-6&&Math.abs(e[1]-t[n][1])<1e-6)}function addMixedClass(e,t,n,o){const a=t.filter(o).length;a>0&&a<t.length&&e.add(`mixed-${n}`)}function hasVisibleReciprocalEdges(e){const[t,n]=canonicalRoomPair(e[0].sourceId,e[0].targetId);let o=!1,a=!1;for(const i of e)i.sourceId===t&&i.targetId===n?o=!0:i.sourceId===n&&i.targetId===t&&(a=!0);return o&&a}function isCollapsibleOrdinaryEdge(e){return"ordinary"===edgeRole(e)&&!e.travelClass&&"internal"!==e.kind}function edgeRole(e){return e?.role??e?.metadata?.role??(e?.travelClass?"travelAction":"ordinary")}function isDoorEdge(e){return void 0!==e?.door||!0===e?.classes?.includes?.("door")}function shouldIncludeVisibleEdge(e,t){if(isCardinalExit(e))return!0;if(!t||!Array.isArray(e?.classes))return!0;let n=!1;for(const o of e.classes)if(o in t&&(n=!0,!0===t[o]))return!0;return!n}function isDisplayablePseudoExit(e){return isSpecialPseudoExit(e)||isCardinalExit(e)}function isSpecialPseudoExit(e){const t=visualExitDirection$1(e);return!!t&&Rf.has(t)}function isCardinalExit(e){const t=visualExitDirection$1(e);return!!t&&Ef.has(t)}function visualExitDirection$1(e){return normalizePseudoExitCommand$1(e?.sourceExitDirection??e?.command)}function normalizePseudoExitCommand$1(e){const t=String(e??"").toLowerCase().trim();return t.length>0?t:null}function undirectedRoomPairKey(e,t){const[n,o]=canonicalRoomPair(e,t);return`${String(n)}\0${String(o)}`}function canonicalRoomPair(e,t){return compareIds(e,t)<=0?[e,t]:[t,e]}function compareIds(e,t){const n=Number(e),o=Number(t);return Number.isSafeInteger(n)&&Number.isSafeInteger(o)?n-o:String(e).localeCompare(String(t))}var kf="http://www.w3.org/2000/svg",Af=20,Tf=5,Mf=10,zf=48,$f=8,Nf=1,Pf=1.2,Of=120,_f=25,jf=5,Ff=.05,Lf=3,Df=.3,Bf=1.25,Gf=Object.freeze({e:Object.freeze({dx:16,dy:0,kind:"east",type:"cardinal"}),east:Object.freeze({dx:16,dy:0,kind:"east",type:"cardinal"}),n:Object.freeze({dx:0,dy:-16,kind:"north",type:"cardinal"}),ne:Object.freeze({dx:12,dy:-12,kind:"northeast",type:"cardinal"}),northeast:Object.freeze({dx:12,dy:-12,kind:"northeast",type:"cardinal"}),north:Object.freeze({dx:0,dy:-16,kind:"north",type:"cardinal"}),nw:Object.freeze({dx:-12,dy:-12,kind:"northwest",type:"cardinal"}),northwest:Object.freeze({dx:-12,dy:-12,kind:"northwest",type:"cardinal"}),s:Object.freeze({dx:0,dy:16,kind:"south",type:"cardinal"}),se:Object.freeze({dx:12,dy:12,kind:"southeast",type:"cardinal"}),southeast:Object.freeze({dx:12,dy:12,kind:"southeast",type:"cardinal"}),south:Object.freeze({dx:0,dy:16,kind:"south",type:"cardinal"}),sw:Object.freeze({dx:-12,dy:12,kind:"southwest",type:"cardinal"}),southwest:Object.freeze({dx:-12,dy:12,kind:"southwest",type:"cardinal"}),w:Object.freeze({dx:-16,dy:0,kind:"west",type:"cardinal"}),west:Object.freeze({dx:-16,dy:0,kind:"west",type:"cardinal"})}),Wf=Object.freeze({d:Object.freeze({kind:"down",type:"special"}),down:Object.freeze({kind:"down",type:"special"}),in:Object.freeze({kind:"in",type:"special"}),out:Object.freeze({kind:"out",type:"special"}),u:Object.freeze({kind:"up",type:"special"}),up:Object.freeze({kind:"up",type:"special"})}),Vf=new Map([[2,"#80735F"],[3,"#765116"],[4,"#36662E"],[5,"#FFFFCC"],[6,"#F9FD00"],[7,"#1DC713"],[8,"#BDA0CB"],[9,"#2D7720"],[10,"#00DDFF"],[11,"#837766"],[12,"#7C7C7C"],[13,"#41AB2F"],[14,"#584A34"],[15,"#76843C"],[16,"#C5FCFF"],[17,"#89E14B"],[18,"#AB9E6D"],[19,"#56A574"],[20,"#0000FF"],[21,"#94E45D"],[22,"#5FF0F0"],[23,"#918010"],[24,"#003366"],[25,"#F98167"],[27,"#FFFFFF"],[28,"#00E342"],[29,"#990000"],[30,"#4D42D4"],[31,"#DD4400"],[32,"#DDBA82"],[33,"#837766"],[34,"#0000FF"],[35,"#FFFFFF"],[36,"#918010"],[39,"#918010"],[40,"#C0C0C0"],[41,"#C0C0C0"],[42,"#CF1020"],[43,"#00701F"],[48,"#F98167"],[257,"#800000"],[258,"#008000"],[259,"#808000"],[260,"#000080"],[261,"#800080"],[262,"#008080"],[263,"#C0C0C0"],[264,"#464646"],[265,"#FF0000"],[266,"#00FF00"],[267,"#FFFF00"],[268,"#0000FF"],[269,"#FF00FF"],[270,"#00FFFF"],[271,"#FFFFFF"],[272,"#808080"]]),Hf=1,Uf=class{#R;#k=new Map;#A=null;#T=new Map;#M;#z=null;#$;#N=new Map;#P=13;#O="name";#_=null;#j=!1;#F;#L;#D;#B;#G;#W;#V;#H=new Map;#U=new Map;#q=new Map;#K=new Set;#Z=new Map;#Y=Object.freeze({edgeId:null,roomId:null});#X=new Map;#J;#Q=!1;#ee=new Set;#te=Object.freeze({outdoor:Object.freeze({enabled:!1,color:"#44aaff"}),wormhole:Object.freeze({enabled:!1,color:"#aa44ff"})});#re=null;#ne=new Map;#oe=new Map;#ae=null;#ie=null;#se=null;#le=new Set;#ce=null;#de=null;#ue=new Map;#pe=null;#me=null;constructor({document:e=null,graph:t=null,options:n={},snapshot:o=null}={}){this.#J=resolveSnapshot({graph:t,snapshot:o}),this.#R=e,this.#B=createRecordMap$1(this.#J.nodes,"id"),this.#M=createRecordMap$1(this.#J.edges,"id");for(const a of this.#J.edges)Array.isArray(a.classes)&&a.classes.includes("wormhole")&&(this.#ee.add(a.sourceId),this.#ee.add(a.targetId));this.#V=Object.freeze({edgeEndpointClearance:Nf,gridSize:Af,minViewportSize:Of,roomRadius:Tf,showRoomLabels:!1,symbolSize:Mf,viewportGridSpan:_f,viewportPadding:zf,...n,background:normalizeBackground(n.background),showEdgeClasses:normalizeShowEdgeClasses(n.showEdgeClasses)}),this.#$=Hf,Hf+=1,this.#G=e=>this.#he(e),this.#F=e=>this.#ge(e),this.#L=e=>this.#fe(e),this.#D=e=>this.#ye(e),this.#W=e=>this.#be(e)}mount(e){if(!e||"function"!=typeof e.appendChild)throw new Error("SvgMapRenderer.mount requires a DOM container.");this.#j&&this.destroy();const t=this.#R??e.ownerDocument??globalThis.document;if(!t)throw new Error("SvgMapRenderer.mount could not resolve a document.");this.#R=t,injectSvgRendererStyles({document:t}),this.#z=t.createElement("div"),this.#z.className="nexmap4-svg-renderer",this.#z.dataset.renderer="svg",this.#ve(),this.#we();const n=this.#V.background?.url??null;n&&(this.#ae=t.createElement("div"),this.#ae.className="nexmap4-svg-background",this.#ae.style.backgroundImage=`url(${n})`,this.#ae.style.opacity=String(this.#V.background?.opacity??.3),this.#z.appendChild(this.#ae));const o=t.defaultView;o&&(this.#ie=()=>this.#Se(),o.addEventListener("resize",this.#ie)),"undefined"!=typeof MutationObserver&&e&&(this.#se=new MutationObserver(()=>this.#Se()),this.#se.observe(e,{attributes:!0,attributeFilter:["style","class"]})),this.#Se(),this.#re=createSvgElement(t,"svg"),this.#re.setAttribute("class","nexmap4-svg"),this.#re.setAttribute("role","img"),this.#re.setAttribute("aria-label","nexMap4 area map"),this.#re.addEventListener("click",this.#G),this.#re.addEventListener("mousedown",this.#F),this.#re.addEventListener("wheel",this.#W,{passive:!1}),this.#re.appendChild(this.#xe());const a=createSvgElement(t,"g");return a.setAttribute("class","nexmap4-svg-viewport"),this.#_={doorEdges:createLayer(t,"door-edges"),edges:createLayer(t,"edges"),labels:createLayer(t,"labels"),overlays:createLayer(t,"overlays"),pseudoExits:createLayer(t,"pseudo-exits"),rooms:createLayer(t,"rooms"),stateRooms:createLayer(t,"state-rooms"),symbols:createLayer(t,"symbols"),viewport:a},a.append(this.#_.rooms,this.#_.edges,this.#_.doorEdges,this.#_.overlays,this.#_.symbols,this.#_.pseudoExits,this.#_.labels,this.#_.stateRooms),this.#re.appendChild(a),this.#z.append(this.#re),e.appendChild(this.#z),this.#j=!0,this.#ce&&(this.#Ie(),this.fit()),this}destroy(){return this.#re&&(this.#re.removeEventListener("click",this.#G),this.#re.removeEventListener("mousedown",this.#F),this.#re.removeEventListener("wheel",this.#W)),this.#Ce(),this.#Ee(!1),this.#A=null,this.#Q=!1,this.#ie&&(this.#R?.defaultView?.removeEventListener("resize",this.#ie),this.#ie=null),this.#se?.disconnect(),this.#se=null,this.#z?.remove(),this.#ae=null,this.#k.clear(),this.#T.clear(),this.#N.clear(),this.#H.clear(),this.#q.clear(),this.#Z.clear(),this.#X.clear(),this.#ne.clear(),this.#le.clear(),this.#de=null,this.#ue.clear(),this.#z=null,this.#_=null,this.#re=null,this.#j=!1,this}setGraph(e=null){const{graph:t,snapshot:n}=resolveSetGraphInput(e),o=resolveSnapshot({graph:t,snapshot:n});this.#J=o,this.#B=createRecordMap$1(o.nodes,"id"),this.#M=createRecordMap$1(o.edges,"id"),this.#ee=new Set;for(const a of o.edges)Array.isArray(a.classes)&&a.classes.includes("wormhole")&&(this.#ee.add(a.sourceId),this.#ee.add(a.targetId));return null===this.#Y.roomId||this.#B.has(this.#Y.roomId)||(this.#Y=Object.freeze({edgeId:this.#Y.edgeId,roomId:null})),null===this.#Y.edgeId||this.#M.has(this.#Y.edgeId)||(this.#Y=Object.freeze({edgeId:null,roomId:this.#Y.roomId})),this.#ce&&null===this.#Re(this.#ce.areaId)&&(this.#ce=null,this.#de=null,this.#ue.clear(),this.#le.clear()),this.#j&&this.#ce&&this.#Ie(),this}setVisibleSlice(e,t=void 0){const n=normalizeVisibleSlice(e,t),o=this.#Re(n.areaId);if(!o)throw new Error(`Cannot render unknown area '${n.areaId}'.`);this.#ce=Object.freeze({areaId:o.id,z:n.z});const a=this.#pe?.zoom??1;return this.#pe=null,this.#j&&(this.#Ie(),this.#ke({zoom:a})),this}setCurrentRoom(e){const t=this.#me,n=null==e?null:this.#Ae(e);return t===n||this.#Te(t,n)||(this.#me=n,null!==n&&this.#Te(n,this.#Y.roomId)&&(this.#Y=Object.freeze({edgeId:null,roomId:null})),this.#Me(t),this.#Me(n),this.#ze()),this}setSelection(e){const t=this.#Y,n=normalizeSelection(e,this.#B,this.#M);return this.#$e(t,n)||(this.#Y=n,this.#Ne(t,n),this.#ze()),this}setBackground(e){const t=normalizeBackground(e);if(this.#V=Object.freeze({...this.#V,background:t}),!this.#j||!this.#z)return this;const n=this.#R;return t.url?(this.#ae||(this.#ae=n.createElement("div"),this.#ae.className="nexmap4-svg-background",this.#z.insertBefore(this.#ae,this.#z.firstChild)),this.#ae.style.backgroundImage=`url(${t.url})`,this.#ae.style.opacity=String(t.opacity),this.#Se(),this):(this.#ae?.remove(),this.#ae=null,this)}#Se(){if(!this.#ae||!this.#z)return;const e=this.#R?.defaultView;if(!e)return;const t=this.#z.getBoundingClientRect();this.#ae.style.transform=t.left>e.innerWidth/2?"scaleX(-1)":""}setShowEdgeClasses(e){const t=this.#V.showEdgeClasses,n=normalizeShowEdgeClasses(e);if(this.#V=Object.freeze({...this.#V,showEdgeClasses:n}),!this.#j||!this.#ce||!this.#_)return this;const o=[];for(const a of Object.keys(n))n[a]!==t[a]&&o.push(a);return 0===o.length||this.#Ie(),this}setRoomBorderIndicators(e){return this.#te=normalizeRoomBorderIndicators(e),this.#z&&this.#ve(),this}#ve(){const{outdoor:e,wormhole:t}=this.#te;this.#z.dataset.outdoorBorder=e.enabled?"true":"false",this.#z.dataset.wormholeBorder=t.enabled?"true":"false",this.#z.style.setProperty("--nexmap4-outdoor-room-border",e.color),this.#z.style.setProperty("--nexmap4-wormhole-room-border",t.color)}setLabelFontSize(e){const t=Number.isFinite(e)&&e>0?e:13;return t===this.#P||(this.#P=t,this.#z&&this.#we()),this}#we(){this.#z.style.setProperty("--nexmap4-label-font-size",`${this.#P}px`)}setLabelMode(e){const t="id"===e?"id":"none"===e?"none":"name";return t===this.#O||(this.#O=t,this.#j&&this.#ce&&this.#Ie()),this}setOverlay(e,t={}){if(null==e||""===e)throw new Error("SvgMapRenderer.setOverlay requires a non-empty overlay key.");return this.#U.set(String(e),normalizeOverlay(t,this.#B,this.#M)),this.#Pe(),this.#Oe(),this}clearOverlay(e=void 0){return null==e?this.#U.clear():this.#U.delete(String(e)),this.#Pe(),this.#Oe(),this}onRoomClick(e){if("function"!=typeof e)throw new Error("SvgMapRenderer.onRoomClick requires a function.");return this.#K.add(e),()=>{this.#K.delete(e)}}fit(){return this.#ke({}),this}#ke({zoom:e=null}={}){if(!this.#ce)return this.#pe=createViewport({areaId:null,viewBox:emptyViewBox(),z:null,zoom:1}),this.#_e(),this;const t=this.#je(),n=this.#Fe(),o=t?{x:(t.minX+t.maxX)/2,y:(t.minY+t.maxY)/2}:{x:0,y:0};let a=e??1;if(null===e&&t){const e=Number(this.#V.viewportPadding)||zf,o=t.maxX-t.minX+2*e,i=t.maxY-t.minY+2*e;a=clamp(Math.min(n.width/o,n.height/i),Ff,jf)}const i=this.#Le({center:o,zoom:a});return this.#pe=createViewport({areaId:this.#ce.areaId,viewBox:i,z:this.#ce.z,zoom:a}),this.#_e(),this}center(e=null){this.#pe||this.fit();const t=this.#De(e)??this.#pe.center,n={height:this.#pe.viewBox.height,minX:t.x-this.#pe.viewBox.width/2,minY:t.y-this.#pe.viewBox.height/2,width:this.#pe.viewBox.width};return this.#pe=createViewport({areaId:this.#ce?.areaId??null,viewBox:n,z:this.#ce?.z??null,zoom:this.#pe.zoom}),this.#_e(),this}setZoom(e,t={}){const n=Number(e);if(!Number.isFinite(n)||n<=0)throw new Error(`SvgMapRenderer.setZoom requires a positive finite zoom, received '${e}'.`);this.#pe||this.fit();const{width:o,height:a}=this.#Le({center:this.#pe.center,zoom:n}),i=isCoordinatePoint(t.anchor)?t.anchor:null,s=normalizePointerRatio(t.pointer),l=t.center??t.roomId??(i&&!s?i:null),c=this.#De(l)??this.#pe.center,d=i&&s?{height:a,minX:i.x-o*s.x,minY:i.y-a*s.y,width:o}:{height:a,minX:c.x-o/2,minY:c.y-a/2,width:o};return this.#pe=createViewport({areaId:this.#ce?.areaId??null,viewBox:d,z:this.#ce?.z??null,zoom:n}),this.#_e(),this}getViewport(){return this.#pe||this.fit(),cloneViewport(this.#pe)}#Ie(){const e=this.#R,t=projectVisualSlice({nodesById:this.#B,showEdgeClasses:this.#V.showEdgeClasses,snapshot:this.#J,visibleSlice:this.#ce}),n=new Set(t.roomRecords.map(e=>e.id)),o=[...t.ordinaryVisualEdges,...t.pseudoVisualEdges];this.#de=t,this.#ue=new Map(o.map(e=>[e.id,e])),this.#le=n,this.#re.dataset.areaId=String(this.#ce.areaId),this.#re.dataset.z=String(this.#ce.z),syncLayer({create:()=>createSvgElement(e,"path"),getKey:e=>e.id,layer:this.#_.edges,records:t.ordinaryVisualEdges,update:(e,t)=>this.#Be(e,t),elementsByKey:this.#T}),syncLayer({create:()=>createSvgElement(e,"line"),getKey:e=>e.id,layer:this.#_.doorEdges,records:t.ordinaryVisualEdges.filter(isDoorVisualEdge),update:(e,t)=>this.#Ge(e,t),elementsByKey:this.#k}),syncLayer({create:()=>this.#We(),getKey:e=>e.id,layer:this.#_.pseudoExits,records:t.pseudoVisualEdges,update:(e,t)=>this.#Ve(e,t),elementsByKey:this.#q}),syncLayer({create:()=>this.#He(),getKey:e=>e.id,layer:this.#_.rooms,records:t.roomRecords,update:(e,t)=>this.#Ue(e,t),elementsByKey:this.#Z}),syncLayer({create:()=>createSvgElement(e,"image"),getKey:e=>e.id,layer:this.#_.symbols,records:t.roomRecords.filter(e=>Boolean(e.symbolSvg)),update:(e,t)=>this.#qe(e,t),elementsByKey:this.#ne}),syncLayer({create:()=>createSvgElement(e,"text"),getKey:e=>e.id,layer:this.#_.labels,records:"none"!==this.#O?t.roomRecords:[],update:(e,t)=>this.#Ke(e,t),elementsByKey:this.#N}),this.#Pe(),this.#Oe(),this.#Ze()}#xe(){const e=createSvgElement(this.#R,"defs"),t=createSvgElement(this.#R,"marker");t.setAttribute("id",this.#Ye()),t.setAttribute("markerHeight","6"),t.setAttribute("markerWidth","6"),t.setAttribute("orient","auto-start-reverse"),t.setAttribute("refX","4"),t.setAttribute("refY","3"),t.setAttribute("viewBox","0 0 6 6");const n=createSvgElement(this.#R,"polyline");return n.setAttribute("points","1,1 4,3 1,5"),n.setAttribute("fill","none"),n.setAttribute("stroke","var(--nexmap4-edge-oneway)"),n.setAttribute("stroke-width","1.2"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),t.appendChild(n),e.appendChild(t),e}#He(){const e=createSvgElement(this.#R,"g"),t=createSvgElement(this.#R,"rect"),n=createSvgElement(this.#R,"polyline"),o=createSvgElement(this.#R,"polyline");return t.setAttribute("class","nexmap4-svg-room-shape"),n.setAttribute("class","nexmap4-svg-room-border-topleft"),o.setAttribute("class","nexmap4-svg-room-border-bottomright"),e.addEventListener("mouseenter",()=>{if("none"===this.#O)return;const t=parseRoomIdAttribute(e),n=null!==t?this.#N.get(t):null;n&&(n.classList.remove("nexmap4-label--hover"),n.offsetWidth,n.classList.add("nexmap4-label--hover"))}),e.addEventListener("mouseleave",()=>{const t=parseRoomIdAttribute(e),n=null!==t?this.#N.get(t):null;n&&n.classList.remove("nexmap4-label--hover")}),e.append(t,n,o),e}#We(){const e=createSvgElement(this.#R,"g"),t=createSvgElement(this.#R,"line"),n=createSvgElement(this.#R,"polygon"),o=createSvgElement(this.#R,"polyline");return t.setAttribute("class","nexmap4-svg-pseudo-line"),n.setAttribute("class","nexmap4-svg-pseudo-glyph"),o.setAttribute("class","nexmap4-svg-pseudo-arrow"),e.append(t,n,o),e}#Ue(e,t){const n=this.#Xe(t),o=e.firstElementChild,a=e.children[1],i=e.children[2];e.setAttribute("data-room-id",String(t.id)),e.setAttribute("data-room-name",t.name),e.setAttribute("data-area-id",String(t.areaId)),e.setAttribute("data-z",String(t.coordinates.z)),e.setAttribute("transform",`translate(${formatNumber(n.x)} ${formatNumber(n.y)})`),e.setAttribute("style",`--nexmap4-room-fill: ${environmentColor(t.environment)};`),e.setAttribute("aria-label",`Room ${String(t.id)}`);const s=this.#V.roomRadius;o.setAttribute("x",String(-s)),o.setAttribute("y",String(-s)),o.setAttribute("width",String(2*s)),o.setAttribute("height",String(2*s)),a.setAttribute("points",`${s},${-s} ${-s},${-s} ${-s},${s}`),i.setAttribute("points",`${-s},${s} ${s},${s} ${s},${-s}`),this.#Je(e,t.id)}#Be(e,t){const n=this.#M.get(t.representativeEdgeId);e.setAttribute("data-visual-edge-id",t.id),e.setAttribute("data-edge-id",t.representativeEdgeId),e.setAttribute("data-edge-ids",t.directedEdgeIds.join(" ")),e.setAttribute("data-command",n?.command??""),e.setAttribute("data-source-room-id",String(t.sourceId)),e.setAttribute("data-target-room-id",String(t.targetId)),e.setAttribute("d",this.#Qe(t)),this.#et(e,t),t.oneWay?e.setAttribute("marker-end",`url(#${this.#Ye()})`):e.removeAttribute("marker-end"),this.#tt(e,t)}#Ge(e,t){const n=t.doorEdgeIds[0]??t.representativeEdgeId,o=this.#M.get(n),a=this.#rt(t);e.setAttribute("data-visual-edge-id",t.id),e.setAttribute("data-door-edge-id",n),e.setAttribute("data-door-edge-ids",t.doorEdgeIds.join(" ")),e.setAttribute("data-edge-id",t.representativeEdgeId),e.setAttribute("data-edge-ids",t.directedEdgeIds.join(" ")),e.setAttribute("data-command",o?.command??""),e.setAttribute("data-source-room-id",String(t.sourceId)),e.setAttribute("data-target-room-id",String(t.targetId)),this.#et(e,t),e.setAttribute("x1",formatNumber(a.x1)),e.setAttribute("y1",formatNumber(a.y1)),e.setAttribute("x2",formatNumber(a.x2)),e.setAttribute("y2",formatNumber(a.y2)),this.#nt(e,t)}#Ve(e,t){const n=this.#M.get(t.representativeEdgeId),o=this.#B.get(n.sourceId),a=this.#Xe(o),i=pseudoExitDirection(n),s=e.children[0],l=e.children[1],c=e.children[2];if(e.setAttribute("data-visual-edge-id",t.id),e.setAttribute("data-edge-id",t.representativeEdgeId),e.setAttribute("data-edge-ids",t.directedEdgeIds.join(" ")),e.setAttribute("data-command",n.command),e.setAttribute("data-source-room-id",String(t.sourceId)),e.setAttribute("data-target-room-id",String(t.targetId)),e.setAttribute("data-pseudo-exit-type",i.type),this.#et(e,t),e.setAttribute("transform",`translate(${formatNumber(a.x)} ${formatNumber(a.y)})`),"cardinal"===i.type){const e=this.#ot(i);s.setAttribute("x1",formatNumber(e.x1)),s.setAttribute("y1",formatNumber(e.y1)),s.setAttribute("x2",formatNumber(e.x2)),s.setAttribute("y2",formatNumber(e.y2)),l.removeAttribute("points"),c.setAttribute("points",cardinalArrowPoints(i,e))}else s.removeAttribute("x1"),s.removeAttribute("y1"),s.removeAttribute("x2"),s.removeAttribute("y2"),l.setAttribute("points",specialPseudoExitPoints(i.kind,this.#V.roomRadius)),c.removeAttribute("points");this.#at(e,t,i.kind)}#et(e,t){const n="customLine"===t.geometry?.kind?t.geometry:null;if(!n)return e.removeAttribute("data-custom-line-source-edge-id"),e.removeAttribute("data-custom-line-style"),e.removeAttribute("data-custom-line-ends-in-arrow"),void e.removeAttribute("data-custom-line-conflict");e.setAttribute("data-custom-line-source-edge-id",n.sourceEdgeId),e.setAttribute("data-custom-line-ends-in-arrow",String(!0===n.endsInArrow)),e.setAttribute("data-custom-line-conflict",String(!0===n.conflict)),n.style?e.setAttribute("data-custom-line-style",n.style):e.removeAttribute("data-custom-line-style")}#qe(e,t){const n=this.#Xe(t),o=this.#V.symbolSize;e.setAttribute("class","nexmap4-svg-symbol"),e.setAttribute("data-room-id",String(t.id)),e.setAttribute("x",formatNumber(n.x-o/2)),e.setAttribute("y",formatNumber(n.y-o/2)),e.setAttribute("width",String(o)),e.setAttribute("height",String(o)),e.setAttribute("href",this.#it(t))}#Ke(e,t){const n=this.#Xe(t);e.setAttribute("class","nexmap4-svg-label"),e.setAttribute("data-room-id",String(t.id)),e.setAttribute("x",formatNumber(n.x)),e.setAttribute("y",formatNumber(n.y-this.#V.roomRadius-3));const o=t.name||String(t.id);e.textContent="id"===this.#O?String(t.id):`${o} (${t.id})`}#Pe(){if(!this.#j||!this.#_)return;const e=[];for(const[t,n]of this.#st())for(const o of n.roomIds){const a=this.#B.get(o);a&&this.#le.has(o)&&e.push({key:`${t}:room:${String(o)}`,node:a,overlay:n,overlayKey:t,roomId:o})}syncLayer({create:()=>createSvgElement(this.#R,"circle"),elementsByKey:this.#H,getKey:e=>e.key,layer:this.#_.overlays,records:e,update:(e,t)=>this.#lt(e,t)})}*#st(){const e=[...this.#U.entries()];e.sort((e,t)=>(e[1].priority??0)-(t[1].priority??0));for(const t of e)yield t}#ze(){if(!this.#j||!this.#_)return;const e=[],t=this.#ct(this.#me),n=this.#ct(this.#Y.roomId);t&&e.push({kind:"current",node:t}),n&&e.push({kind:"selected",node:n}),syncLayer({create:()=>this.#dt(),elementsByKey:this.#X,getKey:e=>e.kind,layer:this.#_.stateRooms,records:e,update:(e,t)=>this.#ut(e,t)})}#ct(e){return null!=e&&this.#le.has(e)?this.#B.get(e)??null:null}#dt(){const e=createSvgElement(this.#R,"g"),t=createSvgElement(this.#R,"rect");return t.setAttribute("class","nexmap4-svg-state-room-shape"),e.setAttribute("aria-hidden","true"),e.appendChild(t),e}#ut(e,{kind:t,node:n}){const o=this.#Xe(n),a=e.firstElementChild,i=this.#V.roomRadius*Pf;e.setAttribute("class",`nexmap4-svg-state-room nexmap4-state-room--${t}`),e.setAttribute("data-room-id",String(n.id)),e.setAttribute("data-state-room",t),e.setAttribute("transform",`translate(${formatNumber(o.x)} ${formatNumber(o.y)})`),a.setAttribute("x",formatNumber(-i)),a.setAttribute("y",formatNumber(-i)),a.setAttribute("width",formatNumber(2*i)),a.setAttribute("height",formatNumber(2*i))}#lt(e,{node:t,overlay:n,overlayKey:o,roomId:a}){const i=this.#Xe(t),s=n.roomSpecs.get(a)??null,l=s?[...n.classNames,...s.classNames]:n.classNames,c=s?.color??n.color,d=s?.label??n.label,u=["nexmap4-svg-overlay-halo",`nexmap4-overlay--${toClassToken(o)}`,...l];e.setAttribute("class",u.join(" ")),e.setAttribute("data-overlay-id",o),e.setAttribute("data-room-id",String(t.id)),e.setAttribute("cx",formatNumber(i.x)),e.setAttribute("cy",formatNumber(i.y)),e.setAttribute("r",String(this.#V.roomRadius+5)),c?e.setAttribute("stroke",c):e.removeAttribute("stroke"),e.textContent=d??""}#Oe(){for(const[e,t]of this.#Z)this.#Je(t,e);for(const[e,t]of this.#T)this.#tt(t,this.#ue.get(e));for(const[e,t]of this.#k)this.#nt(t,this.#ue.get(e));for(const[e,t]of this.#q){const n=this.#ue.get(e),o=pseudoExitDirection(this.#M.get(n?.representativeEdgeId));o&&this.#at(t,n,o.kind)}this.#ze()}#Ne(e,t){this.#Me(e.roomId),this.#Me(t.roomId),this.#pt(e.edgeId),this.#pt(t.edgeId)}#Me(e){const t=this.#Z.get(e);t&&this.#Je(t,e)}#pt(e){if(null==e)return;const t=this.#de?.visualEdgeIdByDirectedEdgeId.get(e),n=t?this.#ue.get(t):null;if(!n)return;const o=this.#T.get(n.id),a=this.#k.get(n.id),i=this.#q.get(n.id);if(o&&this.#tt(o,n),a&&this.#nt(a,n),i){const e=pseudoExitDirection(this.#M.get(n.representativeEdgeId));e&&this.#at(i,n,e.kind)}}#$e(e,t){return e.edgeId===t.edgeId&&(e.roomId===t.roomId||this.#Te(e.roomId,t.roomId))}#Je(e,t){const n=this.#B.get(t),o=this.#mt("room",t);setClassName(e,["nexmap4-svg-room",`nexmap4-room--environment-${n?.environment??"unknown"}`,n?.indoors?"is-indoors":"is-outdoors",this.#ee.has(t)?"has-wormhole":null,this.#Te(t,this.#me)?"is-current":null,this.#Te(t,this.#Y.roomId)?"is-selected":null,o.length>0?"is-overlayed":null,...o])}#tt(e,t){if(!t)return;const n=this.#ht(t.directedEdgeIds);setClassName(e,["nexmap4-svg-edge",...t.classes,...t.classes.map(e=>`nexmap4-edge--${toClassToken(e)}`),this.#gt(t)?"is-selected":null,n.length>0?"is-overlayed":null,...n,this.#ft(t)?"nexmap4-edge--hidden":null])}#nt(e,t){if(!t)return;const n=this.#ht(t.directedEdgeIds);setClassName(e,["nexmap4-svg-door-bar",...t.classes,...t.classes.map(e=>`nexmap4-edge--${toClassToken(e)}`),this.#gt(t)?"is-selected":null,n.length>0?"is-overlayed":null,...n,this.#ft(t)?"nexmap4-edge--hidden":null])}#at(e,t,n){if(!t)return;const o=this.#M.get(t.representativeEdgeId),a=this.#B.get(t.targetId),i=a&&a.areaId!==this.#ce.areaId,s=this.#ht(t.directedEdgeIds);setClassName(e,["nexmap4-svg-pseudo-exit",`nexmap4-pseudo--${n}`,`nexmap4-pseudo--${pseudoExitDirection(o)?.type??"unknown"}`,i?"nexmap4-pseudo--leaves-area":null,...t.classes,...t.classes.map(e=>`nexmap4-edge--${toClassToken(e)}`),this.#gt(t)?"is-selected":null,s.length>0?"is-overlayed":null,...s,this.#ft(t)?"nexmap4-edge--hidden":null])}#gt(e){return e.directedEdgeIds.includes(this.#Y.edgeId)}#ft(e){if(!e?.classes||!Array.isArray(e.classes)||0===e.classes.length)return!1;const t=this.#V.showEdgeClasses;if(!t)return!1;for(const n of e.classes)if(n in t)return!t[n];return!1}#mt(e,t){const n=[];for(const[o,a]of this.#st())if(("room"===e?a.roomIds:a.edgeIds).has(t)){const i="room"===e?a.roomSpecs.get(t):null;n.push(`nexmap4-overlay--${toClassToken(o)}`,...a.classNames,...i?.classNames??[])}return n}#ht(e){const t=[];for(const[n,o]of this.#st())e.some(e=>o.edgeIds.has(e))&&t.push(`nexmap4-overlay--${toClassToken(n)}`,...o.classNames);return t}#Qe(e){const t=this.#yt(e);if(t)return polylinePath(t);const n=this.#B.get(e.sourceId),o=this.#Xe(n),a=.7*this.#V.gridSize;return[`M ${formatNumber(o.x)} ${formatNumber(o.y)}`,`C ${formatNumber(o.x+a)} ${formatNumber(o.y-a)}`,` ${formatNumber(o.x+a)} ${formatNumber(o.y+a)}`,` ${formatNumber(o.x)} ${formatNumber(o.y+a)}`].join("")}#yt(e){const t=this.#B.get(e.sourceId),n=this.#B.get(e.targetId),o=this.#Xe(t),a=this.#Xe(n),i="customLine"===e.geometry?.kind?e.geometry.coordinates:null;if(t.id===n.id&&!i)return null;const s=Array.isArray(i)?i.map(e=>this.#bt(e)):[],l=s[0]??a,c=s.at(-1)??o,{sourcePoint:d}=this.#vt(o,l),{targetPoint:u}=this.#vt(c,a);return[d,...s,u]}#vt(e,t){const n=t.x-e.x,o=t.y-e.y,a=Math.max(Math.abs(n),Math.abs(o));if(0===a)return{sourcePoint:e,targetPoint:t};const i=Math.min((this.#V.roomRadius+this.#V.edgeEndpointClearance)/a,.5);return{sourcePoint:{x:e.x+n*i,y:e.y+o*i},targetPoint:{x:t.x-n*i,y:t.y-o*i}}}#ot(e){const t=Math.max(Math.abs(e.dx),Math.abs(e.dy));if(0===t)return{x1:0,y1:0,x2:e.dx,y2:e.dy};const n=Math.min((this.#V.roomRadius+this.#V.edgeEndpointClearance)/t,.5);return{x1:e.dx*n,y1:e.dy*n,x2:e.dx*n+e.dx*(1-n)*Bf,y2:e.dy*n+e.dy*(1-n)*Bf}}#rt(e){const t=this.#yt(e);if(!t){const t=this.#B.get(e.sourceId),n=this.#Xe(t);return{x1:n.x,x2:n.x,y1:n.y,y2:n.y}}return this.#wt(t)}#wt(e){let t=0;for(let b=1;b<e.length;b+=1)t+=distanceBetween(e[b-1],e[b]);if(0===t){const t=e[0]??{x:0,y:0};return{x1:t.x,x2:t.x,y1:t.y,y2:t.y}}const n=t/2;let o=0,a=e[0],i=e[1],s=distanceBetween(a,i);for(let b=1;b<e.length&&(a=e[b-1],i=e[b],s=distanceBetween(a,i),!(o+s>=n||b===e.length-1));b+=1)o+=s;const l=0===s?0:(n-o)/s,c=a.x+(i.x-a.x)*l,d=a.y+(i.y-a.y)*l,u=i.x-a.x,p=i.y-a.y,m=Math.hypot(u,p)||1,h=$f/2,g=-p/m*h,y=u/m*h;return{x1:c-g,x2:c+g,y1:d-y,y2:d+y}}#he(e){if(this.#Q)return void(this.#Q=!1);const t=closestWithAttribute(e.target,"data-room-id",this.#re);if(!t)return;const n=this.#Ae(t.getAttribute("data-room-id")),o=this.#B.get(n);if(!o)return;const a=Object.freeze({areaId:o.areaId,nativeEvent:e,node:o,roomId:o.id,z:o.coordinates.z});this.setSelection({edgeId:null,roomId:o.id});for(const i of this.#K)i(a)}#ge(e){0===e.button&&this.#re&&this.#ce&&(this.#pe||this.fit(),this.#pe&&(this.#A={lastClientX:e.clientX,lastClientY:e.clientY,moved:!1,startClientX:e.clientX,startClientY:e.clientY},this.#St(),e.preventDefault()))}#fe(e){if(!this.#A||!this.#pe)return;const t=this.#re?.getBoundingClientRect?.();if(!t||t.width<=0||t.height<=0)return;const n=Math.hypot(e.clientX-this.#A.startClientX,e.clientY-this.#A.startClientY);if(!this.#A.moved&&n<Lf)return;this.#A.moved||(this.#A.moved=!0,this.#Ee(!0));const o=e.clientX-this.#A.lastClientX,a=e.clientY-this.#A.lastClientY;if(0===o&&0===a)return;const i=this.#pe.viewBox.width/t.width,s=this.#pe.viewBox.height/t.height;this.#pe=createViewport({areaId:this.#pe.areaId,viewBox:{height:this.#pe.viewBox.height,minX:this.#pe.viewBox.minX-o*i,minY:this.#pe.viewBox.minY-a*s,width:this.#pe.viewBox.width},z:this.#pe.z,zoom:this.#pe.zoom}),this.#A.lastClientX=e.clientX,this.#A.lastClientY=e.clientY,this.#_e(),e.preventDefault()}#ye(e){if(!this.#A)return;const t=this.#A.moved;this.#Ce(),this.#A=null,this.#Ee(!1),t&&(this.#Q=!0,e.preventDefault())}#be(e){if(!this.#ce)return;this.#pe||this.fit();const t=this.#xt(e);if(!t)return;const n=normalizeWheelDelta(e);if(0===n)return;const o=clamp(this.#pe.zoom*Math.exp(.0015*-n),Ff,jf);Math.abs(o-this.#pe.zoom)<.001||(e.preventDefault(),this.setZoom(o,{anchor:t.point,pointer:t.ratio}))}#je(){const e=this.#It(this.#ce.areaId,this.#ce.z).map(e=>this.#B.get(e)).filter(Boolean).map(e=>this.#Xe(e));return 0===e.length?null:e.reduce((e,t)=>({maxX:Math.max(e.maxX,t.x),maxY:Math.max(e.maxY,t.y),minX:Math.min(e.minX,t.x),minY:Math.min(e.minY,t.y)}),{maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY})}#Le({center:e,zoom:t}){const n=this.#Fe();return{height:n.height/t,minX:e.x-n.width/t/2,minY:e.y-n.height/t/2,width:n.width/t}}#Fe(){const e=Number(this.#V.gridSize),t=Number(this.#V.viewportGridSpan),n=Number(this.#V.minViewportSize),o=Math.max((Number.isFinite(e)&&e>0?e:Af)*(Number.isFinite(t)&&t>0?t:_f),Number.isFinite(n)&&n>0?n:Of),a=this.#re?.getBoundingClientRect?.();return!a||a.width<=0||a.height<=0?{height:o,width:o}:a.width>=a.height?{height:o,width:o*(a.width/a.height)}:{height:o*(a.height/a.width),width:o}}#_e(){if(!this.#re||!this.#pe||!this.#_)return;const{minX:e,minY:t,width:n,height:o}=this.#pe.viewBox,a=this.#re.getBoundingClientRect?.();if(!a||a.width<=0||a.height<=0)return this.#re.setAttribute("viewBox",`${formatNumber(e)} ${formatNumber(t)} ${formatNumber(n)} ${formatNumber(o)}`),this.#_.viewport.style.transform="",this.#z&&this.#z.style.setProperty("--nexmap4-zoom",String(this.#pe.zoom)),void this.#Ze();this.#re.removeAttribute("viewBox");const i=Math.min(a.width/n,a.height/o),s=(a.width-n*i)/2-e*i,l=(a.height-o*i)/2-t*i;this.#_.viewport.style.transform=`translate(${formatNumber(s)}px, ${formatNumber(l)}px) scale(${formatNumber(i)})`,this.#z&&this.#z.style.setProperty("--nexmap4-zoom",String(this.#pe.zoom)),this.#Ze()}#Ze(){if(!this.#_?.labels)return;const e=this.#pe?.zoom??1,t="none"!==this.#O&&e>=Df;this.#_.labels.style.display=t?"":"none"}#St(){this.#R?.addEventListener("mousemove",this.#L),this.#R?.addEventListener("mouseup",this.#D)}#Ce(){this.#R?.removeEventListener("mousemove",this.#L),this.#R?.removeEventListener("mouseup",this.#D)}#xt(e){if(!this.#re||!this.#pe)return null;const t=this.#re.getBoundingClientRect();if(!t||t.width<=0||t.height<=0)return null;const n=normalizePointerRatio({x:(e.clientX-t.left)/t.width,y:(e.clientY-t.top)/t.height});return n?{point:{x:this.#pe.viewBox.minX+this.#pe.viewBox.width*n.x,y:this.#pe.viewBox.minY+this.#pe.viewBox.height*n.y},ratio:n}:null}#Ee(e){this.#z?.classList.toggle("is-panning",e)}#De(e){if(null==e){if(null!==this.#me){const e=this.#B.get(this.#me);return e?this.#Xe(e):null}return null}if("object"==typeof e&&"x"in e&&"y"in e)return{x:Number(e.x),y:Number(e.y)};const t="object"==typeof e&&"roomId"in e?e.roomId:e,n=this.#B.get(this.#Ae(t));return n?this.#Xe(n):null}#Xe(e){return{x:e.coordinates.x*this.#V.gridSize,y:-e.coordinates.y*this.#V.gridSize}}#bt(e){return{x:Number(e[0])*this.#V.gridSize,y:-Number(e[1])*this.#V.gridSize}}#it(e){const t=this.#oe.get(e.id);if(t)return t;const n=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e.symbolSvg)}`;return this.#oe.set(e.id,n),n}#Re(e){return this.#J.areas.find(t=>t.id===e)??null}#It(e,t){return this.#J.indices.areaZRoomIds?.[String(e)]?.[String(t)]??[]}#Ae(e){return resolveKnownId(e,this.#B)}#Te(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&String(e)===String(t)}#Ye(){return`nexmap4-svg-oneway-arrow-${this.#$}`}};function resolveSnapshot({graph:e,snapshot:t}){const n=t??("function"==typeof e?.toSnapshot?e.toSnapshot():null);if(!n||!Array.isArray(n.nodes)||!Array.isArray(n.edges))throw new Error("SvgMapRenderer requires a GraphSnapshot or MapGraph.");return n}function resolveSetGraphInput(e){return null==e?{graph:null,snapshot:null}:"function"==typeof e.toSnapshot?{graph:e,snapshot:null}:Array.isArray(e.nodes)&&Array.isArray(e.edges)?{graph:null,snapshot:e}:{graph:e.graph??null,snapshot:e.snapshot??null}}function isCoordinatePoint(e){return null!==e&&"object"==typeof e&&Number.isFinite(e.x)&&Number.isFinite(e.y)}function createRecordMap$1(e,t){return new Map(e.map(e=>[e[t],e]))}function createLayer(e,t){const n=createSvgElement(e,"g");return n.setAttribute("class",`nexmap4-svg-layer nexmap4-svg-${t}`),n.dataset.layer=t,n}function createSvgElement(e,t){return e.createElementNS(kf,t)}function syncLayer({create:e,elementsByKey:t,getKey:n,layer:o,records:a,update:i}){const s=new Set(a.map(e=>n(e)));for(const[l,c]of t)s.has(l)||(c.remove(),t.delete(l));for(const l of a){const a=n(l);let s=t.get(a);s||(s=e(l),t.set(a,s)),i(s,l),o.appendChild(s)}}function normalizeVisibleSlice(e,t){return"object"==typeof e&&null!==e?{areaId:Number(e.areaId),z:Number(e.z)}:{areaId:Number(e),z:Number(t)}}function normalizeSelection(e,t,n){if(null==e)return Object.freeze({edgeId:null,roomId:null});if("object"!=typeof e)return Object.freeze({edgeId:null,roomId:resolveKnownId(e,t)});const o=null===e.edgeId||void 0===e.edgeId?null:resolveKnownId(e.edgeId,n),a=null===e.roomId||void 0===e.roomId?null:resolveKnownId(e.roomId,t);return Object.freeze({edgeId:o,roomId:a})}function normalizeOverlay(e,t,n){const o=new Set((e.roomIds??e.rooms??[]).map(e=>resolveKnownId(e,t))),a=new Set((e.edgeIds??e.edges??[]).map(e=>resolveKnownId(e,n))),i=new Map;if(Array.isArray(e.entries))for(const d of e.entries){if(!d||"object"!=typeof d)continue;const e=resolveKnownId(d.roomId??d.id,t);o.add(e),i.set(e,Object.freeze({classNames:Object.freeze(Array.isArray(d.classNames)?d.classNames.map(toClassTokenPreservingKnown).filter(Boolean):[]),color:"string"==typeof d.color&&d.color?d.color:null,label:"string"==typeof d.label?d.label:null}))}const s=Array.isArray(e.classNames)?e.classNames.map(toClassTokenPreservingKnown).filter(Boolean):[],l="string"==typeof e.className?normalizeClassNameList(e.className):[],c=[...new Set([...s,...l])];return Object.freeze({classNames:Object.freeze(c),color:"string"==typeof e.color&&e.color?e.color:null,edgeIds:a,label:"string"==typeof e.label?e.label:null,priority:"number"==typeof e.priority?e.priority:0,roomIds:o,roomSpecs:i})}function resolveKnownId(e,t){if(t.has(e))return e;const n=Number(e);return Number.isSafeInteger(n)&&t.has(n)?n:String(e)}function pseudoExitDirection(e){const t=visualExitDirection(e);return t?Gf[t]??Wf[t]??null:null}function visualExitDirection(e){return normalizePseudoExitCommand(e?.sourceExitDirection??e?.command)}function closestWithAttribute(e,t,n){let o=e;for(;o&&o!==n.parentNode;){if("function"==typeof o.getAttribute&&null!==o.getAttribute(t))return o;if(o===n)return null;o=o.parentNode}return null}function environmentColor(e){return Number.isFinite(e)?Vf.get(Number(e))??"#888888":"#888888"}function polylinePath(e){if(!Array.isArray(e)||0===e.length)return"";const[t,...n]=e;return[`M ${formatNumber(t.x)} ${formatNumber(t.y)}`,...n.map(e=>`L ${formatNumber(e.x)} ${formatNumber(e.y)}`)].join(" ")}function distanceBetween(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function setClassName(e,t){e.setAttribute("class",t.filter(Boolean).map(toClassTokenPreservingKnown).join(" "))}function normalizeClassNameList(e){return"string"!=typeof e?[]:e.split(/\s+/u).map(toClassToken).filter(Boolean)}function toClassTokenPreservingKnown(e){const t=String(e);return/^[A-Za-z_][A-Za-z0-9_-]*$/u.test(t)?t:toClassToken(t)}function toClassToken(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/gu,"-").replace(/^-+|-+$/gu,"")||"value"}function createViewport({areaId:e,viewBox:t,z:n,zoom:o}){return Object.freeze({areaId:e,center:Object.freeze({x:t.minX+t.width/2,y:t.minY+t.height/2}),viewBox:Object.freeze({...t}),z:n,zoom:o})}function cloneViewport(e){return{areaId:e.areaId,center:{...e.center},viewBox:{...e.viewBox},z:e.z,zoom:e.zoom}}function normalizePointerRatio(e){return isCoordinatePoint(e)?{x:clamp(Number(e.x),0,1),y:clamp(Number(e.y),0,1)}:null}function emptyViewBox(){return{height:Of,minX:-Of/2,minY:-Of/2,width:Of}}function formatNumber(e){return Number(e.toFixed(3)).toString()}function parseRoomIdAttribute(e){const t=e.getAttribute("data-room-id");if(null===t)return null;const n=Number(t);return Number.isInteger(n)&&!Number.isNaN(n)?n:t}function normalizeWheelDelta(e){const t=Number(e.deltaY??0);return Number.isFinite(t)?1===e.deltaMode?16*t:2===e.deltaMode?160*t:t:0}function clamp(e,t,n){return Math.min(Math.max(e,t),n)}function normalizePseudoExitCommand(e){const t=String(e??"").toLowerCase().trim();return t.length>0?t:null}var qf="https://unpkg.com/nexmap/wallpaper-830417_750_540.jpg",Kf=Object.freeze({airHarness:!1,atavianWings:!1,eagleWings:!1,gare:!1,islandWings:!1,knocker:!1,nurRift:!1,pebble:!1,sewergrate:!1,universe:!1,urn:!1,wormhole:!1}),Zf=Object.freeze({outdoor:Object.freeze({enabled:!1,color:"#44aaff"}),wormhole:Object.freeze({enabled:!1,color:"#aa44ff"})});function normalizeRoomBorderType(e,t){const n=e&&"object"==typeof e?e:{};return Object.freeze({enabled:Boolean(n.enabled),color:"string"==typeof n.color&&n.color.length>0?n.color:t.color})}function normalizeRoomBorderIndicators(e){return e&&"object"==typeof e?Object.freeze({outdoor:normalizeRoomBorderType(e.outdoor,Zf.outdoor),wormhole:normalizeRoomBorderType(e.wormhole,Zf.wormhole)}):Zf}function normalizeBackground(e){if(!e||"object"!=typeof e)return Object.freeze({opacity:.5,url:qf});const t=Number.isFinite(e.opacity)?clamp(Number(e.opacity),0,1):.5,n="string"==typeof e.url&&e.url.length>0?e.url:null;return Object.freeze({opacity:t,url:n})}function normalizeShowEdgeClasses(e){const t={...Kf};if(e&&"object"==typeof e)for(const n of Object.keys(Kf))n in e&&(t[n]=Boolean(e[n]));return Object.freeze(t)}function specialPseudoExitPoints(e,t){const n=t||Tf,o=formatNumber(.7*n),a=formatNumber(.1*n),i=formatNumber(.5*n);switch(e){case"down":return`${-i},${-o} ${i},${-o} 0,${-a}`;case"in":return`${o},${-i} ${o},${i} ${a},0`;case"out":return`${-o},${i} ${-o},${-i} ${-a},0`;case"up":return`${i},${o} ${-i},${o} 0,${a}`;default:return""}}function cardinalArrowPoints(e,t=e){const n=t.x2??t.dx,o=t.y2??t.dy,a=Math.hypot(n,o);if(0===a)return"";const i=n/a,s=o/a,l=-s,c=3.5,d=3,u=o-s*c+i*d,p=n-i*c-l*d,m=o-s*c-i*d;return`${formatNumber(n-i*c+l*d)},${formatNumber(u)} ${formatNumber(n)},${formatNumber(o)} ${formatNumber(p)},${formatNumber(m)}`}function createDefaultRenderer({document:e,graph:t,options:n}){return new Uf({document:e,graph:t,options:n})}function resolveInitialRoomId({graph:e,host:t}){const n=readHostRoomId(t),o=(null===n?null:e.getNode(n))??e.nodes()[0]??null;return o?o.id:null}function readHostRoomId(e){const t=e?.GMCP?.Location??e?.GMCP?.Room?.Info??null,n=t?.id??t?.num??null;if(null==n||""===n)return null;if("number"==typeof n)return n;const o=String(n).trim();return/^-?\d+$/.test(o)?Number(o):o}function applyPersistedRendererSettings(e,t){const n=t?.display??{};void 0!==n.background&&"function"==typeof e.setBackground&&e.setBackground(n.background),void 0!==n.roomBorderIndicators&&"function"==typeof e.setRoomBorderIndicators&&e.setRoomBorderIndicators(n.roomBorderIndicators),Number.isFinite(n.zoom)&&n.zoom>0&&"function"==typeof e.setZoom&&e.setZoom(n.zoom),void 0!==n.labelMode&&"function"==typeof e.setLabelMode&&e.setLabelMode(n.labelMode),Number.isFinite(n.labelFontSize)&&n.labelFontSize>0&&"function"==typeof e.setLabelFontSize&&e.setLabelFontSize(n.labelFontSize)}function subscribeRendererToSettings(e,t){if(!t||"function"!=typeof t.subscribe)return null;let n=t.get?.()?.display??t.getState?.()?.display??null;return t.subscribe(t=>{const o=t?.display;o&&o!==n&&(o.background!==n?.background&&"function"==typeof e.setBackground&&e.setBackground(o.background),o.roomBorderIndicators!==n?.roomBorderIndicators&&"function"==typeof e.setRoomBorderIndicators&&e.setRoomBorderIndicators(o.roomBorderIndicators),o.zoom!==n?.zoom&&Number.isFinite(o.zoom)&&o.zoom>0&&"function"==typeof e.setZoom&&e.setZoom(o.zoom),o.labelMode!==n?.labelMode&&"function"==typeof e.setLabelMode&&e.setLabelMode(o.labelMode),o.labelFontSize!==n?.labelFontSize&&"function"==typeof e.setLabelFontSize&&e.setLabelFontSize(o.labelFontSize),n=o)})}function cloneJson$1(e){return structuredClone(e)}function compileRevisionModule({continentLabels:e,graphBehaviorRevisions:t=[],mapTopologyRevisions:n=[],scriptedExitRevisions:o=[]}){const a=[],i=[];for(const s of n)a.push(compileMapTopologyRevision(s));for(const s of o)a.push(...compileScriptedExitMapRevisions(s)),i.push(compileRuntimeScript(s));return deepFreeze$8({continentLabels:e,graphRevisions:t.map(compileGraphBehaviorRevision),revisions:a,runtimeScripts:i})}function compileMapTopologyRevision(e){switch(assertRevisionType(e,"mapTopology"),e.kind){case"annotateAreas":return omitTypeFields(e,{operation:"annotateAreas"});case"addArea":return omitTypeFields(e,{operation:"addArea"});case"updateRoomUserData":return omitTypeFields(e,{operation:"updateRoomUserData"});case"addRoom":return omitTypeFields(e,{operation:"addRoom"});case"removeExit":return omitTypeFields(e,{operation:e.redundantIfMissing?"removeExitAlreadyAbsent":"removeExit"});case"addExit":return omitTypeFields(e,{operation:"addExit"});case"updateExit":return omitTypeFields(e,{operation:"updateExit"});default:throw new Error(`Unsupported map topology revision '${e.kind}'.`)}}function compileScriptedExitMapRevisions(e){assertRevisionType(e,"scriptedExit");const t={exitId:e.targetRoomId,name:e.displayedExit,scriptId:e.id};if(void 0!==e.weight&&(t.weight=e.weight),void 0!==e.weightSpec&&(t.weightSpec=e.weightSpec),"addExit"===e.install)return[{areaId:e.areaId,areaName:e.areaName,exit:t,operation:"addExit",reason:e.reason,roomId:e.sourceRoomId,sourceSurface:e.sourceSurface}];const{exitId:n,...o}=t;return[{areaId:e.areaId,areaName:e.areaName,exitId:n,operation:"updateExit",patch:o,reason:e.reason,roomId:e.sourceRoomId,sourceSurface:e.sourceSurface}]}function compileGraphBehaviorRevision(e){assertRevisionType(e,"graphBehavior");const t={edgeId:e.edgeId,sourceSurface:e.sourceSurface};return void 0!==e.areaId&&(t.areaId=e.areaId),void 0!==e.areaName&&(t.areaName=e.areaName),void 0!==e.commands&&(t.commands=[...e.commands]),void 0!==e.weight&&(t.weight=e.weight),void 0!==e.weightSpec&&(t.weightSpec=e.weightSpec),!0===e.redundantIfMissing&&(t.redundantIfMissing=!0),t}function compileRuntimeScript(e){return{category:e.category,displayedExit:e.displayedExit,execute:e.execute,id:e.id,sourceRoomId:e.sourceRoomId,targetRoomId:e.targetRoomId}}function omitTypeFields(e,t){const{kind:n,type:o,...a}=e;return{...a,...t}}function assertRevisionType(e,t){if(e?.type!==t)throw new Error(`Expected ${t} revision.`)}function celerityWeight(e){return assertFiniteNonNegativeNumber(e,"celerity weight factor"),Object.freeze({factor:e,kind:"celerityMultiplier"})}var Yf=Object.freeze({addArea:e=>createMapTopologyRevision("addArea",e),addExit:e=>createMapTopologyRevision("addExit",e),addRoom:e=>createMapTopologyRevision("addRoom",e),annotateAreas:e=>createMapTopologyRevision("annotateAreas",e),removeExit:e=>createMapTopologyRevision("removeExit",e),updateExit:e=>createMapTopologyRevision("updateExit",e),updateRoomUserData:e=>createMapTopologyRevision("updateRoomUserData",e)}),Xf=Object.freeze({edge:e=>createGraphBehaviorRevision(e)});function scriptedExit(e){if(assertObject(e,"scripted exit"),assertNonEmptyString(e.id,"scripted exit id"),assertNonEmptyString(e.displayedExit,`scripted exit '${e.id}' displayedExit`),assertNonEmptyString(e.category,`scripted exit '${e.id}' category`),assertFiniteNumber(e.sourceRoomId,`scripted exit '${e.id}' sourceRoomId`),assertFiniteNumber(e.targetRoomId,`scripted exit '${e.id}' targetRoomId`),assertFiniteNumber(e.areaId,`scripted exit '${e.id}' areaId`),assertNonEmptyString(e.areaName,`scripted exit '${e.id}' areaName`),assertNonEmptyString(e.reason,`scripted exit '${e.id}' reason`),"addExit"!==e.install&&"updateExit"!==e.install)throw new Error(`Scripted exit '${e.id}' install must be either 'addExit' or 'updateExit'.`);if("function"!=typeof e.execute)throw new TypeError(`Scripted exit '${e.id}' must define execute(ctx).`);return deepFreeze$4({...e,type:"scriptedExit"})}function createMapTopologyRevision(e,t){return assertObject(t,`${e} revision`),deepFreeze$4({...t,kind:e,type:"mapTopology"})}function createGraphBehaviorRevision(e){assertObject(e,"graph behavior revision"),assertNonEmptyString(e.edgeId,"graph behavior edgeId");const t=void 0!==e.areaId,n=void 0!==e.areaName,o=void 0!==e.commands,a=void 0!==e.weight,i=void 0!==e.weightSpec;if(t!==n)throw new Error(`Graph behavior '${e.edgeId}' must define both areaId and areaName.`);if(t&&(assertFiniteNumber(e.areaId,`graph behavior '${e.edgeId}' areaId`),assertNonEmptyString(e.areaName,`graph behavior '${e.edgeId}' areaName`)),!o&&!a&&!i)throw new Error(`Graph behavior '${e.edgeId}' must define commands or weight.`);if(o&&assertCommandArray(e.commands,`graph behavior '${e.edgeId}' commands`),a&&i)throw new Error(`Graph behavior '${e.edgeId}' cannot define both weight and weightSpec.`);return deepFreeze$4({...e,type:"graphBehavior"})}function assertCommandArray(e,t){if(!Array.isArray(e)||0===e.length)throw new TypeError(`${t} must be a non-empty command array.`);for(const n of e)assertNonEmptyString(n,t)}function assertObject(e,t){if(!e||"object"!=typeof e||Array.isArray(e))throw new TypeError(`${t} must be an object.`)}function assertNonEmptyString(e,t){if("string"!=typeof e||0===e.length)throw new TypeError(`${t} must be a non-empty string.`)}function assertFiniteNumber(e,t){if(!Number.isFinite(e))throw new TypeError(`${t} must be a finite number.`)}function assertFiniteNonNegativeNumber(e,t){if(assertFiniteNumber(e,t),e<0)throw new TypeError(`${t} must be non-negative.`)}function deepFreeze$4(e){if(!e||"object"!=typeof e)return e;Object.freeze(e);for(const t of Object.values(e))deepFreeze$4(t);return e}var Jf="nexmap3/src/base/graphRevisions.js",Qf=Object.freeze([Xf.edge({areaId:431,areaName:"The collar of Veior",commands:["land","in"],edgeId:"45380-52144",sourceSurface:Jf,weight:Number.POSITIVE_INFINITY}),Xf.edge({areaId:431,areaName:"The collar of Veior",commands:["land","n"],edgeId:"52516-52144",sourceSurface:Jf}),Xf.edge({areaId:431,areaName:"The collar of Veior",commands:["land","s"],edgeId:"50884-52144",sourceSurface:Jf}),Xf.edge({areaId:427,areaName:"fathomless expanse of the World Tree",commands:["land","in"],edgeId:"45458-51784",sourceSurface:Jf,weight:Number.POSITIVE_INFINITY}),Xf.edge({areaId:427,areaName:"fathomless expanse of the World Tree",commands:["land","s"],edgeId:"52391-51784",sourceSurface:Jf}),Xf.edge({areaId:427,areaName:"fathomless expanse of the World Tree",commands:["land","w"],edgeId:"52554-51784",sourceSurface:Jf}),Xf.edge({areaId:427,areaName:"fathomless expanse of the World Tree",commands:["land","se"],edgeId:"52123-51784",sourceSurface:Jf}),Xf.edge({areaId:429,areaName:"The collar of Frysta",commands:["land","in"],edgeId:"45033-52454",sourceSurface:Jf,weight:Number.POSITIVE_INFINITY}),Xf.edge({areaId:429,areaName:"The collar of Frysta",commands:["land","w"],edgeId:"45519-52454",sourceSurface:Jf}),Xf.edge({areaId:429,areaName:"The collar of Frysta",commands:["land","sw"],edgeId:"52029-52454",sourceSurface:Jf}),Xf.edge({areaId:432,areaName:"The collar of Bjarndyr",commands:["land","in"],edgeId:"45041-45902",sourceSurface:Jf,weight:Number.POSITIVE_INFINITY}),Xf.edge({areaId:432,areaName:"The collar of Bjarndyr",commands:["land","s"],edgeId:"52298-45902",sourceSurface:Jf}),Xf.edge({areaId:432,areaName:"The collar of Bjarndyr",commands:["land","w"],edgeId:"51850-45902",sourceSurface:Jf}),Xf.edge({areaId:209,areaName:"Ageiro, the Isle of",commands:["push bookcase here","north"],edgeId:"25110-25397",sourceSurface:Jf}),Xf.edge({areaId:162,areaName:"Tapoa Island",commands:["get rope from pile","up"],edgeId:"21800-22101",sourceSurface:Jf}),Xf.edge({areaId:207,areaName:"Tuar, the Island of",commands:["push crate here","pull trapdoor here"],edgeId:"16613-19024",sourceSurface:Jf}),Xf.edge({areaId:31,areaName:"Green Lake",commands:["push rubble here","in"],edgeId:"23500-22390",sourceSurface:Jf}),Xf.edge({areaId:152,areaName:"Nimick, the Village of",commands:["push boulder here","down"],edgeId:"23770-23775",sourceSurface:Jf}),Xf.edge({areaId:156,areaName:"Dun Valley (Village)",commands:["pull tapestry here","in"],edgeId:"4705-17269",sourceSurface:Jf}),Xf.edge({areaId:334,areaName:"Judgement Mountains",commands:["push rock84281 here","northwest"],edgeId:"36226-36235",sourceSurface:Jf}),Xf.edge({areaId:334,areaName:"Judgement Mountains",commands:["push rock300379 here","southeast"],edgeId:"36235-36226",sourceSurface:Jf}),Xf.edge({areaId:343,areaName:"Battlesite of Mourning Pass",commands:["pull rubble here","east"],edgeId:"29081-30864",sourceSurface:Jf}),Xf.edge({areaId:343,areaName:"Battlesite of Mourning Pass",commands:["push bones here","east"],edgeId:"30136-30469",sourceSurface:Jf}),Xf.edge({areaId:343,areaName:"Battlesite of Mourning Pass",commands:["pull shield81739 here","northeast"],edgeId:"30469-30437",sourceSurface:Jf}),Xf.edge({areaId:343,areaName:"Battlesite of Mourning Pass",commands:["pull roots here","south"],edgeId:"30523-30631",sourceSurface:Jf}),Xf.edge({areaId:343,areaName:"Battlesite of Mourning Pass",commands:["pull mucus here","northeast"],edgeId:"31099-23239",sourceSurface:Jf}),Xf.edge({areaId:158,areaName:"Dun Valley (Swamp)",commands:["pull vine here","east"],edgeId:"3827-24264",sourceSurface:Jf}),Xf.edge({areaId:158,areaName:"Dun Valley (Swamp)",commands:["pull vine here","west"],edgeId:"24264-3827",sourceSurface:Jf}),Xf.edge({areaId:257,areaName:"Loramere",commands:["push gates here","south"],edgeId:"51615-52621",sourceSurface:Jf}),Xf.edge({areaId:257,areaName:"Loramere",commands:["push gates here","north"],edgeId:"52621-51615",sourceSurface:Jf}),Xf.edge({areaId:430,areaName:"Kkractle's Grasp",edgeId:"52857-61764",sourceSurface:Jf,weightSpec:celerityWeight(5)}),Xf.edge({areaId:54,areaName:"Coterie of Clouds",edgeId:"65261-61764",sourceSurface:Jf,weightSpec:celerityWeight(5)}),Xf.edge({areaId:437,areaName:"Garash's Grief",edgeId:"53813-66471",sourceSurface:Jf,weightSpec:celerityWeight(5)}),Xf.edge({areaId:54,areaName:"Coterie of Clouds",edgeId:"65474-66471",sourceSurface:Jf,weightSpec:celerityWeight(5)}),Xf.edge({areaId:437,areaName:"Garash's Grief",edgeId:"53753-67558",sourceSurface:Jf,weightSpec:celerityWeight(5)}),Xf.edge({areaId:439,areaName:"Sllshya's Maw",edgeId:"53315-67558",sourceSurface:Jf,weightSpec:celerityWeight(5)}),Xf.edge({areaId:430,areaName:"Kkractle's Grasp",edgeId:"34660-67326",sourceSurface:Jf,weightSpec:celerityWeight(5)}),Xf.edge({areaId:437,areaName:"Garash's Grief",edgeId:"53843-67326",sourceSurface:Jf,weightSpec:celerityWeight(5)}),Xf.edge({areaId:439,areaName:"Sllshya's Maw",edgeId:"52665-67832",sourceSurface:Jf,weightSpec:celerityWeight(5)}),Xf.edge({areaId:54,areaName:"Coterie of Clouds",edgeId:"65583-67832",sourceSurface:Jf,weightSpec:celerityWeight(5)})]),ey="nexmap3/src/base/crowdMapRevisions.js",ty="nexmap3/src/base/crowdMapRevisions.js + helpertables.js",ry=Object.freeze([Yf.annotateAreas({affectedAreaCount:470,behaviorCovered:"Adds area continent labels used by travel eligibility and routing scope.",id:"continent-labels",sourceSurface:ty}),Yf.addArea({area:{continent:"",id:994,name:"a raging inferno",roomCount:7,rooms:[{coordinates:[0,0,0],exits:[{exitId:66795,name:"ne"}],id:66403,name:"Within a raging inferno (indoors)",userData:{"Game Area":"a raging inferno"}},{coordinates:[1,1,0],exits:[{exitId:66805,name:"nw"}],id:66795,name:"Within a raging inferno (indoors)",userData:{"Game Area":"a raging inferno"}},{coordinates:[0,2,0],exits:[{exitId:66846,name:"w"}],id:66805,name:"Within a raging inferno (indoors)",userData:{"Game Area":"a raging inferno"}},{coordinates:[-1,2,0],exits:[{exitId:66888,name:"sw"}],id:66846,name:"Within a raging inferno (indoors)",userData:{"Game Area":"a raging inferno"}},{coordinates:[-2,1,0],exits:[{exitId:66897,name:"se"}],id:66888,name:"Within a raging inferno (indoors)",userData:{"Game Area":"a raging inferno"}},{coordinates:[-1,0,0],exits:[{exitId:66403,name:"e"}],id:66897,name:"Within a raging inferno (indoors)",userData:{"Game Area":"a raging inferno"}}]},areaId:994,areaName:"a raging inferno",reason:"Adds missing raging inferno area and rooms.",sourceSurface:ey}),Yf.updateRoomUserData({areaId:207,areaName:"Tuar, the Island of",patch:{userData:{indoors:"y"}},reason:"Corrects indoor/outdoor state for cloud eligibility and display.",roomId:18415,sourceSurface:ey}),Yf.addRoom({areaId:477,areaName:"Ghezavat Commune",reason:"Room missing from crowdmap but required for corrected topology.",room:{coordinates:[4,3,-1],environment:2,exits:[{exitId:58881,name:"southwest"}],id:58306,name:"A landscape of shifting sand",userData:{"Game Area":"the Ghezavat Commune",indoors:"y"}},sourceSurface:ey}),Yf.addRoom({areaId:477,areaName:"Ghezavat Commune",reason:"Room missing from crowdmap but required for corrected topology.",room:{coordinates:[3,2,-1],environment:2,exits:[{exitId:58509,name:"west"},{exitId:58306,name:"northeast"}],id:58881,name:"A narrow, sandy tunnel",userData:{"Game Area":"the Ghezavat Commune",indoors:"y"}},sourceSurface:ey}),Yf.addRoom({areaId:129,areaName:"The Darkenwood Barrow",reason:"Adds Vulkuz snake pit room missing from crowdmap.",room:{coordinates:[3,0,0],environment:32,exits:[],id:14372,name:"Within the snake pit (indoors)",userData:{"Game Area":"The Darkenwood Barrow",details:["indoors"],indoors:!0}},sourceNameInLegacyComment:"Vulkuz Barrow",sourceSurface:ey}),Yf.removeExit({areaId:3,areaName:"New Thera, the Village of",exitId:23806,name:"northeast",reason:"Standard exit duplicates a scripted northeast exit.",roomId:28521,sourceSurface:ey}),Yf.removeExit({areaId:328,areaName:"Southern Atrousian Jungle",exitId:33119,name:"south",reason:"Standard exit duplicates a scripted south exit.",roomId:33044,sourceSurface:ey}),Yf.removeExit({areaId:310,areaName:"Theran Underground",exitId:27338,name:"down",reason:"Standard exit duplicates a scripted down exit.",roomId:23083,sourceSurface:ey}),Yf.addExit({areaId:477,areaName:"Ghezavat Commune",exit:{exitId:58881,name:"northeast"},reason:"Adds missing Ghezavat tunnel edge.",roomId:58509,sourceSurface:ey}),Yf.addExit({areaId:207,areaName:"Tuar, the Island of",exit:{exitId:19024,name:"down"},reason:"Adds missing Tuar trapdoor descent.",roomId:16613,sourceSurface:ey}),Yf.addExit({areaId:54,areaName:"Coterie of Clouds",exit:{exitId:52137,name:"climb clouds"},reason:"Adds missing Coterie cloud climb upward edge.",roomId:53395,sourceSurface:ey}),Yf.addExit({areaId:54,areaName:"Coterie of Clouds",exit:{exitId:53395,name:"climb down"},reason:"Adds missing Coterie cloud climb downward edge.",roomId:52137,sourceSurface:ey}),flameExit({areaId:429,areaName:"The collar of Frysta",reason:"Adds path-between-worlds exit from Frysta collar flame room.",roomId:52454,targetRoomId:38968,weightFactor:7}),flameExit({areaId:427,areaName:"fathomless expanse of the World Tree",reason:"Adds path-between-worlds exit from Drauger collar flame room.",roomId:51784,targetRoomId:38968,weightFactor:7}),flameExit({areaId:431,areaName:"The collar of Veior",reason:"Adds path-between-worlds exit from Veior collar flame room.",roomId:52144,targetRoomId:38968,weightFactor:7}),flameExit({areaId:432,areaName:"The collar of Bjarndyr",reason:"Adds path-between-worlds exit from Bjarndyr collar flame room.",roomId:45902,targetRoomId:38968,weightFactor:7}),flameExit({areaId:22,areaName:"Central Wilderness",reason:"Adds path-between-worlds early-exit from the mainland 2898 flame room.",roomId:2898,targetRoomId:38968,weightFactor:7}),flameExit({areaId:327,areaName:"Vasnari Mountains, the (Central)",reason:"Adds path-between-worlds early-exit from the meropis 68906 flame room.",roomId:68906,targetRoomId:38968,weightFactor:7}),flameExit({areaId:190,areaName:"Parthren Gare, the",reason:"Adds path-between-worlds early-exit from the Gare 69077 flame room.",roomId:69077,targetRoomId:38968,weightFactor:7}),flameExit({areaId:427,areaName:"fathomless expanse of the World Tree",reason:"Adds path-between-worlds early-exit from the Yggdrasil 54133 flame room.",roomId:54133,targetRoomId:38968,weightFactor:7}),flameExit({areaId:434,areaName:"Radak's Hold",reason:"Adds path-between-worlds early-exit from the Radak 51940 flame room.",roomId:51940,targetRoomId:38968,weightFactor:7}),flameExit({areaId:435,areaName:"Ioje compound",reason:"Adds path-between-worlds early-exit from the Ioje 53394 flame room.",roomId:53394,targetRoomId:38968,weightFactor:7}),flameExit({areaId:255,areaName:"Pri'alysh Moor",reason:"Adds path-between-worlds early-exit from the Pri'alysh 41708 flame room.",roomId:41708,targetRoomId:38968,weightFactor:7}),flameExit({areaId:257,areaName:"Loramere",reason:"Adds path-between-worlds early-exit from the Loramere 53696 flame room.",roomId:53696,targetRoomId:38968,weightFactor:7}),flameExit({areaId:45,areaName:"Lhitsu forest",reason:"Adds path-between-worlds early-exit from the Lhitsu 53005 flame room.",roomId:53005,targetRoomId:38968,weightFactor:7}),flameExit({areaId:289,areaName:"Valley of Kuthalebak",reason:"Adds path-between-worlds early-exit from the Kuthalebak 51466 flame room.",roomId:51466,targetRoomId:38968,weightFactor:7}),flameExit({areaId:363,areaName:"Village of Qerstead",reason:"Adds path-between-worlds early-exit from the Qerstead 51336 flame room.",roomId:51336,targetRoomId:38968,weightFactor:7}),flameExit({areaId:436,areaName:"Kunpai Island",reason:"Adds path-between-worlds early-exit from the Kunapi 53544 flame room.",roomId:53544,targetRoomId:38968,weightFactor:7}),flameExit({areaId:111,areaName:"Village of Myrinia",reason:"Adds path-between-worlds early-exit from the Myrinia 53502 flame room.",roomId:53502,targetRoomId:38968,weightFactor:7})]);function flameExit({areaId:e,areaName:t,reason:n,roomId:o,targetRoomId:a,weightFactor:i}){return Yf.addExit({areaId:e,areaName:t,exit:{exitId:a,name:"embrace flame",weightSpec:celerityWeight(i)},reason:n,roomId:o,sourceSurface:ey})}var ny="nexmap3/src/base/crowdMapRevisions.js",oy=45e3,ay=31;function flameTransit({areaId:e,areaName:t,id:n,install:o,reason:a,sourceRoomId:i,targetRoomId:s}){return scriptedExit({areaId:e,areaName:t,category:"flame",displayedExit:"embrace flame",id:n,install:o,reason:a,sourceRoomId:i,sourceSurface:ny,targetRoomId:s,weightSpec:celerityWeight(ay),async execute(e){e.sendCommands(["embrace flame"]),await e.waitForRoom(s,{timeoutMs:oy})}})}var iy=Object.freeze([scriptedExit({areaId:7,areaName:"Maim's Mansion",category:"jar",displayedExit:"#down",id:"maims-mansion-jar-down",install:"updateExit",reason:"Turns cabinet/jar interaction into a named scripted exit.",sourceRoomId:10293,sourceSurface:ny,targetRoomId:10639,async execute(e){e.sendCommands(["turn jar here"]),await e.waitForLine("The entire cabinet swings forward, revealing a stairway leading down.",{once:!0,timeoutMs:4e3}),e.sendCommands(["down"])}}),scriptedExit({areaId:186,areaName:"Shamtota Hills, the (West)",category:"rocks",displayedExit:"#in",id:"shamtota-chrysantha-knob",install:"updateExit",reason:"Turns hidden-rock interaction into a named scripted exit.",sourceRoomId:1450,sourceSurface:ny,targetRoomId:15398,async execute(e){e.sendCommands(["say Chrysantha","push knob here"]),await e.waitForLine("Wavering, the rock face turns translucent for a moment.",{once:!0,timeoutMs:4e3}),e.sendCommands(["in"])}}),scriptedExit({areaId:261,areaName:"Caverns of Riagath",category:"rocks",displayedExit:"#push rocks",id:"riagath-push-rocks-east",install:"addExit",reason:"Turns rock-clearing interaction into a named scripted exit.",sourceRoomId:28687,sourceSurface:ny,targetRoomId:23387,async execute(e){e.sendCommands(["push rocks here","e"]),await e.waitForLine("As the cloud of dust settles, an exit to the east is revealed.",{once:!0,timeoutMs:4e3}),e.sendCommands(["e"])}}),scriptedExit({areaId:78,areaName:"Vashnar Mountains, the (South)",category:"archway",displayedExit:"#archway",id:"vashnar-arcadia-archway",install:"updateExit",reason:"Archway requires item-presence check before entering.",sourceRoomId:10221,sourceSurface:ny,targetRoomId:19775,weightSpec:celerityWeight(13),async execute(e){e.itemExistsInRoom(268468)||(e.sendCommands(["say arcadia"]),await e.waitForItem(268468,{timeoutMs:15e3})),e.sendCommands(["enter archway"])}}),scriptedExit({areaId:428,areaName:"tunnels beneath Yggdrasil's lowest branches",category:"flame",displayedExit:"#out",id:"between-worlds-out",install:"addExit",reason:"Adds explicit scripted out exit from the path-between-worlds room.",sourceRoomId:38968,sourceSurface:ny,targetRoomId:1231,weight:1,execute(e){e.sendCommands(["out"])}}),flameTransit({areaId:22,areaName:"Central Wilderness",id:"flame-main-to-yggdrasil",install:"updateExit",reason:"Wraps the mainland 2898 → Yggdrasil 54133 flame to transit 38968.",sourceRoomId:2898,targetRoomId:54133}),flameTransit({areaId:327,areaName:"Vasnari Mountains, the (Central)",id:"flame-meropis-to-yggdrasil",install:"updateExit",reason:"Wraps the meropis 68906 → Yggdrasil 68501 flame to transit 38968.",sourceRoomId:68906,targetRoomId:68501}),flameTransit({areaId:190,areaName:"Parthren Gare, the",id:"flame-gare-to-yggdrasil",install:"updateExit",reason:"Wraps the Gare 69077 → Yggdrasil 68501 flame to transit 38968.",sourceRoomId:69077,targetRoomId:68501}),flameTransit({areaId:427,areaName:"fathomless expanse of the World Tree",id:"flame-yggdrasil-to-main",install:"updateExit",reason:"Wraps the Yggdrasil 54133 → mainland 2898 flame to transit 38968.",sourceRoomId:54133,targetRoomId:2898}),flameTransit({areaId:434,areaName:"Radak's Hold",id:"flame-radak-return",install:"addExit",reason:"Adds Radak 51940 → Frysta collar 52454 return flame through 38968.",sourceRoomId:51940,targetRoomId:52454}),flameTransit({areaId:435,areaName:"Ioje compound",id:"flame-ioje-return",install:"addExit",reason:"Adds Ioje 53394 → Frysta collar 52454 return flame through 38968.",sourceRoomId:53394,targetRoomId:52454}),flameTransit({areaId:255,areaName:"Pri'alysh Moor",id:"flame-prialysh-return",install:"addExit",reason:"Adds Pri'alysh 41708 → Veior collar 52144 return flame through 38968.",sourceRoomId:41708,targetRoomId:52144}),flameTransit({areaId:257,areaName:"Loramere",id:"flame-loramere-return",install:"addExit",reason:"Adds Loramere 53696 → Veior collar 52144 return flame through 38968.",sourceRoomId:53696,targetRoomId:52144}),flameTransit({areaId:45,areaName:"Lhitsu forest",id:"flame-lhitsu-return",install:"addExit",reason:"Adds Lhitsu 53005 → Drauger collar 51784 return flame through 38968.",sourceRoomId:53005,targetRoomId:51784}),flameTransit({areaId:289,areaName:"Valley of Kuthalebak",id:"flame-kuthalebak-return",install:"addExit",reason:"Adds Kuthalebak 51466 → Bjarndyr collar 45902 return flame through 38968.",sourceRoomId:51466,targetRoomId:45902}),flameTransit({areaId:363,areaName:"Village of Qerstead",id:"flame-qerstead-return",install:"addExit",reason:"Adds Qerstead 51336 → Bjarndyr collar 45902 return flame through 38968.",sourceRoomId:51336,targetRoomId:45902}),flameTransit({areaId:436,areaName:"Kunpai Island",id:"flame-kunapi-return",install:"addExit",reason:"Adds Kunapi 53544 → Drauger collar 51784 return flame through 38968.",sourceRoomId:53544,targetRoomId:51784}),flameTransit({areaId:111,areaName:"Village of Myrinia",id:"flame-myrinia-return",install:"addExit",reason:"Adds Myrinia 53502 → Drauger collar 51784 return flame through 38968.",sourceRoomId:53502,targetRoomId:51784})]),sy=deepFreeze$8(compileRevisionModule({continentLabels:En,graphBehaviorRevisions:Qf,mapTopologyRevisions:ry,scriptedExitRevisions:iy})),ly=sy.runtimeScripts,cy=deepFreeze$8(ro.parse(sy)),dy=cy.graphRevisions;function normalizeCrowdmap(e,{revisionReporter:t=py,revisionSet:n=cy}={}){return Yn.parse(applyRevisions(e,n,{revisionReporter:t}))}function applyRevisions(e,t=cy,{revisionReporter:n=py}={}){const o=Zn.parse(e),a=ro.parse(t),i=n??uy,s=cloneJson$1(o),l=new Map;for(const d of s.areas)for(const e of d.rooms)l.set(e.id,{area:d,room:e});const c={baseIndex:createBaseCrowdmapIndex(o),conflicts:{exits:[],rooms:[]},roomsById:l,touched:{exitsBySourceTarget:new Set,roomsById:new Set}};for(const d of a.revisions)applyRevision(s,d,a,c);return(c.conflicts.exits.length>0||c.conflicts.rooms.length>0)&&i.revisionConflicts?.(c.conflicts),s}function applyRevision(e,t,n,o){switch(t.operation){case"annotateAreas":return void annotateAreas(e,n.continentLabels);case"addArea":return void addArea(e,t.area);case"updateRoomUserData":return void updateRoomUserData(e,t);case"addRoom":return void addRoom(e,t,o);case"removeExit":return void removeExit(e,t,{allowMissing:!1});case"removeExitAlreadyAbsent":return void removeExit(e,t,{allowMissing:!0});case"addExit":return void addExit(e,t,o);case"updateExit":return void updateExit(e,t);default:throw new Error(`Unsupported crowdmap revision operation '${t.operation}'.`)}}function annotateAreas(e,t){for(const n of e.areas)n.continent=resolveContinent(n.id,t)}function resolveContinent(e,t){for(const[n,o]of Object.entries(t))if(o.includes(e))return n;return""}function addArea(e,t){if(e.areas.some(e=>e.id===t.id))throw new Error(`Cannot add duplicate crowdmap area '${t.id}'.`);e.areas.push(cloneJson$1(t)),e.areaCount+=1,e.roomCount+=t.rooms.length}function updateRoomUserData(e,t){const n=findRoom(e,t.areaId,t.roomId);n.userData={...n.userData??{},...t.patch.userData}}function addRoom(e,t,n){if(n.touched.roomsById.has(t.room.id))throw new Error(`Cannot add duplicate crowdmap room '${t.room.id}': another revision already created it.`);n.touched.roomsById.add(t.room.id);const o=n.baseIndex.roomsById.get(t.room.id)??null;if(o){n.conflicts.rooms.push({roomId:t.room.id,crowdmapArea:`${o.area.name} (${o.area.id})`,crowdmapRoom:o.room.name??"",revisionArea:`${t.areaName} (${t.areaId})`,revisionRoom:t.room.name??"",revisionReason:t.reason,sourceSurface:t.sourceSurface});const a=findRoomById(n,t.room.id);if(a){const o=a.area.rooms.findIndex(e=>e.id===t.room.id);a.area.rooms.splice(o,1),a.area.roomCount-=1,e.roomCount-=1,n.roomsById.delete(t.room.id)}}const a=findArea(e,t.areaId),i=cloneJson$1(t.room);a.rooms.push(i),a.roomCount+=1,e.roomCount+=1,n.roomsById.set(i.id,{area:a,room:i})}function removeExit(e,t,{allowMissing:n}){const o=findRoom(e,t.areaId,t.roomId),a=o.exits.map((e,t)=>({exit:e,index:t})).filter(({exit:e})=>e.exitId===t.exitId&&e.name===t.name).map(({index:e})=>e);if(a.length>1)throw new Error(`Cannot remove ambiguous exit '${t.name}' from room '${t.roomId}' to '${t.exitId}'.`);const i=a[0]??-1;if(-1===i){if(n)return;throw new Error(`Cannot remove missing exit '${t.name}' from room '${t.roomId}' to '${t.exitId}'.`)}o.exits.splice(i,1)}function addExit(e,t,n){if(!findRoomById(n,t.roomId))throw new Error(`Crowdmap room '${t.roomId}' does not exist in area '${t.areaId}'.`);requireTargetRoom(n,t.exit.exitId,t);const o=createSourceTargetKey(t.roomId,t.exit.exitId);if(n.touched.exitsBySourceTarget.has(o))throw new Error(`Cannot add duplicate exit from room '${t.roomId}' to '${t.exit.exitId}': another revision already created it.`);n.touched.exitsBySourceTarget.add(o);const a=n.baseIndex.exitsBySourceTarget.get(o)??[],i=findRoom(e,t.areaId,t.roomId);if(a.length>0){n.conflicts.exits.push({sourceRoomId:t.roomId,targetRoomId:t.exit.exitId,area:`${t.areaName} (${t.areaId})`,crowdmapExit:a.map(e=>e.name).join(" | "),revisionExit:t.exit.name,revisionReason:t.reason,sourceSurface:t.sourceSurface});for(let e=i.exits.length-1;e>=0;e-=1)i.exits[e].exitId===t.exit.exitId&&i.exits.splice(e,1)}i.exits.push(cloneJson$1(t.exit))}function updateExit(e,t){const n=findUniqueExitByTarget(e,t.areaId,t.roomId,t.exitId);Object.assign(n,cloneJson$1(t.patch))}function requireTargetRoom(e,t,n){if(!findRoomById(e,t))throw new Error(`Cannot add exit from room '${n.roomId}' to missing target room '${t}'.`)}function findArea(e,t){const n=e.areas.find(e=>e.id===t);if(!n)throw new Error(`Crowdmap area '${t}' does not exist.`);return n}function findRoom(e,t,n){const o=findArea(e,t).rooms.find(e=>e.id===n);if(!o)throw new Error(`Crowdmap room '${n}' does not exist in area '${t}'.`);return o}function findRoomById(e,t){return e.roomsById.get(t)??null}function findExitsByTarget(e,t){return e.exits.filter(e=>e.exitId===t)}function findUniqueExitByTarget(e,t,n,o){const a=findExitsByTarget(findRoom(e,t,n),o);if(0===a.length)throw new Error(`Crowdmap room '${n}' does not have an exit to '${o}'.`);if(a.length>1)throw new Error(`Crowdmap room '${n}' has multiple exits to '${o}'.`);return a[0]}var uy=Object.freeze({revisionConflicts:()=>{}}),py=Object.freeze({revisionConflicts({exits:e,rooms:t}){const n=e.length+t.length;0!==n&&(console.warn(`[nexMap crowdmap revisions] ${n} nexMap4 addition(s) overrode existing crowdmap entries. Audit each row — if the crowdmap is now sufficient, remove the revision.`),e.length>0&&console.table(e),t.length>0&&console.table(t))}});function createBaseCrowdmapIndex(e){const t=new Map,n=new Map;for(const o of e.areas)for(const e of o.rooms){n.set(e.id,{area:o,room:e});for(const n of e.exits){const o=createSourceTargetKey(e.id,n.exitId),a=t.get(o)??[];a.push(n),t.set(o,a)}}return{exitsBySourceTarget:t,roomsById:n}}function createSourceTargetKey(e,t){return`${e}->${t}`}async function fetchCrowdmap({requestInit:e,schema:t=Zn,url:n}={}){if(!n)throw new Error("fetchCrowdmap requires a URL.");const o=await fetch(n,e);if(!o?.ok)throw new Error(`Crowdmap fetch failed with status ${o?.status??"unknown"}.`);const a=await o.json();return t.parse(a)}var my=[...ly,...universeScripts(),knockerScript("knocker:main",57174),knockerScript("knocker:meropis",57177),...flameScripts()],hy="a shimmering map of Sapience",gy="A shimmering, translucent image rises up before you, its glittering surface displaying the verdant grasslands, soaring mountains, sprawling settlements and deep blue seas of Sapience.",fy="a massive iron doorway",yy="With a groaning sound, the great iron door swings ponderously open.";function universeScripts(e=zn){return Object.entries(e.main).map(([e,t])=>universeScript(`universe:main:${t}`,Number(e),t)).concat(Object.entries(e.meropis).map(([e,t])=>universeScript(`universe:meropis:${t}`,Number(e),t)))}function universeScript(e,t,n){return{category:"universe",displayedExit:`#${e}`,id:e,sourceRoomId:0,targetRoomId:t,async execute(e){e.itemNamedInRoom(hy)||(e.sendCommands(["queue add free fling universe at ground"]),await e.waitForLine(gy,{once:!0,timeoutMs:12e3})),e.sendCommands([`queue add free touch ${n}`])}}}function knockerScript(e,t){return{category:"knocker",displayedExit:`#${e}`,id:e,sourceRoomId:0,targetRoomId:t,async execute(e){e.itemNamedInRoom(fy)||(e.sendCommands(["queue add freestand raise knocker"]),await e.waitForLine(yy,{once:!0,timeoutMs:12e3})),e.sendCommands(["queue add freestand enter doorway"])}}}function flameScripts(e=jn){return e.routes.map(e=>flameRouteScript(e))}function flameRouteScript(e){return{category:"flame",displayedExit:`#flame:${e.id}`,id:`flame:${e.id}`,sourceRoomId:e.approachRoomId,targetRoomId:e.destinationRoomId,async execute(t){const n=flameRuntimeRoute(e,t.segmentMetadata);t.sendCommands(n.ingressCommands),await t.waitForRoom(n.flameRoomId,{timeoutMs:15e3}),t.sendCommands(["embrace flame"]),await t.waitForRoom(n.destinationRoomId,{timeoutMs:45e3})}}}function flameRuntimeRoute(e,t){const n=t?.collapsedIngressMetadata,o=n?.ingressCommands;if(void 0!==t?.routeId&&t.routeId!==e.id)throw new Error(`Flame script '${e.id}' received segment metadata for route '${t.routeId}'.`);if(void 0!==n?.routeId&&n.routeId!==e.id)throw new Error(`Flame script '${e.id}' received ingress metadata for route '${n.routeId}'.`);if(!isNonEmptyStringArray(o))throw new Error(`Flame script '${e.id}' requires collapsed ingressCommands metadata.`);return{destinationRoomId:e.destinationRoomId,flameRoomId:e.flameRoomId,ingressCommands:o}}function isNonEmptyStringArray(e){return Array.isArray(e)&&e.length>0&&e.every(e=>"string"==typeof e)}var by=class extends Error{constructor(e,{missing:t=[]}={}){super(e),this.name="RuntimeScriptResolutionError",this.missing=t}};function createRuntimeScripts(e=my){const t=new Map;for(const n of e){if(assertScriptDefinition(n),t.has(n.id))throw new Error(`Duplicate runtime script id '${n.id}'.`);t.set(n.id,Object.freeze({...n}))}function get(e){return t.get(String(e??""))??null}function requireScript(e){const t=get(e);if(!t)throw new by(`Unknown runtime script '${e}'.`,{missing:[String(e??"")]});return t}function unresolved(e){return[...new Set(e.map(e=>String(e)).filter(Boolean))].filter(e=>!t.has(e)).sort()}function assertResolved(e){const t=unresolved(e);if(t.length>0)throw new by(`Runtime script registry is missing ${t.length} script id(s): ${t.join(", ")}.`,{missing:t});return!0}return Object.freeze({assertResolved,get,has:e=>t.has(String(e??"")),ids:()=>[...t.keys()],list:()=>[...t.values()].map(e=>({...e})),require:requireScript,unresolved})}var vy=createRuntimeScripts(my);function assertScriptDefinition(e){if(!e||"object"!=typeof e)throw new TypeError("Script definition must be an object.");if("string"!=typeof e.id||0===e.id.length)throw new TypeError("Script definition must have a non-empty string 'id'.");if("function"!=typeof e.execute)throw new TypeError(`Script '${e.id}' must have an 'execute' function.`);if("number"!=typeof e.sourceRoomId)throw new TypeError(`Script '${e.id}' must have a numeric 'sourceRoomId'.`);if("number"!=typeof e.targetRoomId)throw new TypeError(`Script '${e.id}' must have a numeric 'targetRoomId'.`);if("string"!=typeof e.displayedExit||0===e.displayedExit.length)throw new TypeError(`Script '${e.id}' must have a non-empty string 'displayedExit'.`)}var wy="runtime.scripts",Sy=class extends Error{constructor(e){super(`Script timed out after ${e}ms.`),this.name="ScriptTimeoutError",this.timeoutMs=e}},xy=Object.freeze([na.GMCP_CHAR_ITEMS_ADD,na.GMCP_CHAR_ITEMS_LIST,na.GMCP_CHAR_ITEMS_REMOVE,na.GMCP_CHAR_ITEMS_UPDATE]),Iy=1;function createScriptContext({adapter:e,segmentMetadata:t={},signal:n,setTimeout:o=defaultSetTimeout$1,clearTimeout:a=defaultClearTimeout$1}){const i=createCurrentRoomTracker(e.gmcp),s=createRoomItemTracker(e.gmcp,i),l=deepFreezeClone(t),dispose=()=>{n.removeEventListener("abort",dispose),s.dispose(),i.dispose()};return n.addEventListener("abort",dispose,{once:!0}),Object.freeze({segmentMetadata:l,signal:n,dispose,sendCommands(t){n.aborted||e.client.sendCommands([...t])},waitForLine:(t,{timeoutMs:o=null,once:a=!0}={})=>new Promise((i,s)=>{if(n.aborted)return void s(newAbortError());const l=normalizeDuration(o);let c=!1,d=null;d=e.triggers.registerTriggerSpec({action(...t){if(!settle())return!1;const n=extractLine(t);return e.triggers.removeTrigger(d),i(n),!0},duration:l,id:"script.wait-line."+Iy++,lifetime:"script-segment",once:!1!==a,pattern:normalizeWaitLinePattern(t),tag:wy,onRemove(){settle()&&s(l?new Sy(o):newAbortError())}});const onAbort=()=>{settle()&&(e.triggers.removeTrigger(d),s(newAbortError()))};function settle(){return!c&&(c=!0,n.removeEventListener("abort",onAbort),!0)}n.addEventListener("abort",onAbort,{once:!0})}),waitForRoom:(e,{timeoutMs:t=3e4}={})=>new Promise((s,l)=>{if(n.aborted)return void l(newAbortError());let c=null,d=!1,unsubscribe=()=>{};function tryFire(t=i.currentRoomId()){return!!roomIdsEqual$2(t,e)&&(settle(),s(t),!0)}if(tryFire())return;unsubscribe=i.subscribe(e=>{tryFire(e)}),Number.isFinite(t)&&t>0&&(c=o(()=>{settle(),l(new Sy(t))},t));const onAbort=()=>{settle(),l(newAbortError())};function settle(){d||(d=!0,a(c),unsubscribe(),n.removeEventListener("abort",onAbort))}n.addEventListener("abort",onAbort,{once:!0})}),waitForItem:(e,{timeoutMs:t=null}={})=>new Promise((i,l)=>{if(n.aborted)return void l(newAbortError());const c=String(e);let d=null,u=!1,unsubscribe=()=>{};function tryFire(){return!!s.hasId(c)&&(settle(),i(),!0)}if(tryFire())return;unsubscribe=s.subscribe(tryFire),Number.isFinite(t)&&t>0&&(d=o(()=>{settle(),l(new Sy(t))},t));const onAbort=()=>{settle(),l(newAbortError())};function settle(){u||(u=!0,a(d),unsubscribe(),n.removeEventListener("abort",onAbort))}n.addEventListener("abort",onAbort,{once:!0})}),itemExistsInRoom:e=>s.hasId(e),itemNamedInRoom:e=>s.hasName(e)})}function newAbortError(){return new DOMException("Script execution was cancelled.","AbortError")}function normalizeWaitLinePattern(e){if(e instanceof RegExp||"string"==typeof e)return e;throw new Error("waitForLine pattern must be a RegExp or string.")}function extractLine(e){for(const t of e){if("string"==typeof t)return t.trim();if(Array.isArray(t)){const e=t.input??t[0]??null;if(null!=e)return String(e).trim()}if(t&&"object"==typeof t){const e=t.line??t.rawLine??t.text??t.message??null;if("function"==typeof e)continue;if(null!=e)return String(e).trim()}}return""}function createCurrentRoomTracker(e){const t=new Set;let n=getLatestCurrentRoomEvent(e),o=extractCurrentRoomIdFromEvent(n),a=!1;const i=e.subscribe(ga,e=>{const a=extractCurrentRoomIdFromEvent(e);if(null!==a&&(n=e,!roomIdsEqual$2(a,o))){o=a;for(const n of t)n(o,e)}});return{currentRoomId:()=>o,dispose(){a||(a=!0,t.clear(),i())},latestRoomEvent:()=>n,subscribe(e){if("function"!=typeof e)throw new Error("current room tracker subscriber must be a function.");return t.add(e),()=>t.delete(e)}}}function createRoomItemTracker(e,t){const n=new Map,o=new Set;let a=t.currentRoomId(),i=!1;seedFromLatestEvents();const s=t.subscribe(e=>{roomIdsEqual$2(e,a)||(a=e,n.clear()),notify()}),l=e.subscribe(xy,e=>{observe(e),notify()});return{dispose(){i||(i=!0,o.clear(),s(),l())},hasId:e=>n.has(itemKeyFromId(e)),hasName(e){const t=normalizeItemName(e);if(!t)return!1;for(const o of n.values())if(normalizeItemName(o?.name)===t)return!0;return!1},subscribe(e){if("function"!=typeof e)throw new Error("room item tracker subscriber must be a function.");return o.add(e),()=>o.delete(e)}};function seedFromLatestEvents(){const n=t.latestRoomEvent(),o=xy.map(t=>e.getLastEvent?.(t)).filter(Boolean).filter(e=>isCurrentRoomItemEvent(e,n)).sort(compareEvents);for(const e of o)applyItemEvent(e)}function observe(e){applyItemEvent(e)}function applyItemEvent(e){if(!isRoomLocation(e?.payload))return;if(e.topic===na.GMCP_CHAR_ITEMS_LIST){n.clear();for(const t of Array.isArray(e.payload?.items)?e.payload.items:[])setItem(t);return}const t=e.payload?.item;e.topic!==na.GMCP_CHAR_ITEMS_REMOVE?e.topic!==na.GMCP_CHAR_ITEMS_ADD&&e.topic!==na.GMCP_CHAR_ITEMS_UPDATE||setItem(t):deleteItem(t)}function setItem(e){const t=itemKey(e);t&&n.set(t,{...n.get(t)??{},...e})}function deleteItem(e){const t=itemKey(e);t&&n.delete(t)}function notify(){for(const e of o)e()}}function isCurrentRoomItemEvent(e,t){return!!isRoomLocation(e?.payload)&&(!t||compareEvents(e,t)>=0)}function isRoomLocation(e){return"room"===String(e?.location??"room").trim().toLowerCase()}function itemKey(e){if(!e||"object"!=typeof e)return null;if(null!==e.id&&void 0!==e.id&&String(e.id).length>0)return itemKeyFromId(e.id);const t=normalizeItemName(e.name);return t?`name:${t}`:null}function itemKeyFromId(e){return`id:${String(e)}`}function normalizeItemName(e){return String(e??"").trim().toLowerCase()}function normalizeDuration(e){return!!(Number.isFinite(e)&&e>0)&&e}function roomIdsEqual$2(e,t){return null==e||null==t?e===t:String(e)===String(t)}function compareEvents(e,t){const n=Number(e?.sequence??0)-Number(t?.sequence??0);return 0!==n?n:Number(e?.timestampMs??0)-Number(t?.timestampMs??0)}function defaultSetTimeout$1(e,t){return globalThis.setTimeout(e,t)}function defaultClearTimeout$1(e){return globalThis.clearTimeout(e)}function deepFreezeClone(e){return deepFreeze$3(clonePlain(e))}function clonePlain(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(e=>clonePlain(e)):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,clonePlain(t)])):e}function deepFreeze$3(e){if(!e||"object"!=typeof e)return e;Object.freeze(e);for(const t of Object.values(e))deepFreeze$3(t);return e}function createScriptExecutor({adapter:e,clearTimeout:t=defaultClearTimeout,registry:n=vy,setTimeout:o=defaultSetTimeout}={}){assertAdapter$1(e);let a=null;function startSegment({plan:i=null,segment:s,segmentIndex:l=0}={}){if(!s||"script"!==s.kind)throw new Error("ScriptExecutor.startSegment requires a script PlannedPath segment.");const c=n.require(s.scriptId);let d,u;cancel("replaced");const p=new Promise((e,t)=>{d=e,u=t}),m=new AbortController,h={abortController:m,plan:i,rejectPromise:u,resolvePromise:d,script:c,segment:s,segmentIndex:l};a=h,raise(ha.SCRIPT_START,payloadFor(h));const g=createScriptContext({adapter:e,clearTimeout:t,segmentMetadata:s.metadata,setTimeout:o,signal:m.signal});return Promise.resolve().then(()=>c.execute(g)).then(()=>{a===h&&(a=null,g.dispose?.(),raise(ha.SCRIPT_FIRED,payloadFor(h)),d(Object.freeze({detail:{},script:c,segment:s,segmentIndex:l,status:"fired"})))},e=>{if(a===h){if(a=null,g.dispose?.(),e instanceof Sy){const t={timeoutMs:e.timeoutMs};return raise(ha.SCRIPT_TIMEOUT,{...payloadFor(h),detail:t}),void u(e)}isAbortError(e)?d(Object.freeze({detail:{reason:"cancelled"},script:c,segment:s,segmentIndex:l,status:"cancelled"})):u(e)}}),p}function cancel(e="cancelled"){if(!a)return!1;const t=a;return a=null,t.abortController.abort(e),t.resolvePromise(Object.freeze({detail:{reason:e},script:t.script,segment:t.segment,segmentIndex:t.segmentIndex,status:"cancelled"})),!0}function dispose(){cancel("disposed")}function raise(t,n){e.eventStream?.raise?.(t,n)}return Object.freeze({cancel,dispose,getActiveScript:()=>a?{scriptId:a.script.id,segmentIndex:a.segmentIndex}:null,hasScript:e=>n.has(e),startSegment})}function payloadFor({plan:e,script:t,segment:n,segmentIndex:o}){return Object.freeze({category:t.category,destinationId:e?.targetId??null,scriptId:t.id,segmentIndex:o,sourceRoomId:firstNumericRoomId(n?.roomIds)??t.sourceRoomId,targetRoomId:lastNumericRoomId(n?.roomIds)??t.targetRoomId,travelClasses:[...n.travelClasses??[]]})}function firstNumericRoomId(e){if(!Array.isArray(e))return null;const t=e[0];return"number"==typeof t?t:null}function lastNumericRoomId(e){if(!Array.isArray(e))return null;const t=e[e.length-1];return"number"==typeof t?t:null}function isAbortError(e){return"AbortError"===e?.name}function assertAdapter$1(e){if(!e||"object"!=typeof e)throw new Error("createScriptExecutor requires an adapter instance.");if(!e.client||"function"!=typeof e.client.sendCommands)throw new Error("ScriptExecutor adapter must expose client.sendCommands().");if(!e.triggers||"function"!=typeof e.triggers.registerTriggerSpec)throw new Error("ScriptExecutor adapter must expose triggers.registerTriggerSpec().");if(!e.gmcp||"function"!=typeof e.gmcp.subscribe)throw new Error("ScriptExecutor adapter must expose gmcp.subscribe().")}function defaultSetTimeout(e,t){return globalThis.setTimeout(e,t)}function defaultClearTimeout(e){return globalThis.clearTimeout(e)}var Cy=Object.freeze(["start","dispatch","arrival","complete","stopped","error"]),Ey=new Set(["script","direct-command"]),Ry=new Set(["blocked","locked-door","path-blocked","script-error"]);function createStepper({adapter:e,eventBus:t=null,scriptExecutor:n=null,settingsStore:o=null,store:a=Ha,onRoomArrival:i=null,now:s=defaultNow}={}){if(!e||"object"!=typeof e)throw new Error("createStepper requires an adapter instance.");if(!e.gmcp||"function"!=typeof e.gmcp.subscribe)throw new Error("createStepper adapter must expose a gmcp facade with subscribe().");if(!(t||e.client&&"function"==typeof e.client.sendCommands))throw new Error("createStepper adapter must expose a client facade with sendCommands().");if(!t&&"function"!=typeof e.client?.sendQueue)throw new Error("createStepper adapter must expose a client facade with sendQueue().");const l=new Map;for(const y of Cy)l.set(y,new Set);let c=null,d=!1,u=null,p=null,m=null;function currentPlan(){return a.get().plan}function currentSegmentIndex(){return a.get().segmentIndex}const h=n??(e.triggers&&e.eventStream?createScriptExecutor({adapter:e}):null),g=[e.gmcp.subscribe(ga,handleLocationEvent),e.gmcp.subscribe(na.HOST_EQ_BAL_RECOVERED,handleBalanceEvent)];function on(e,t){if(assertEvent(e),"function"!=typeof t)throw new Error(`stepper.on('${e}') requires a listener function.`);return l.get(e).add(t),()=>l.get(e).delete(t)}function off(e,t){assertEvent(e),l.get(e).delete(t)}function emit(e,t){assertEvent(e);for(const n of l.get(e))n(t)}function getStateSnapshot(){return a.get()}function start(e){if(d)throw new Error("stepper.start called after dispose().");assertPlan(e);const t=a.get(),n=t.status,o=isActiveWalkerStatus(n)&&shouldCancelHostPath(t);if(isActiveWalkerStatus(n))replaceActivePlan();else if(!isStartableWalkerStatus(n))throw new Error(`stepper.start blocked: walker status is '${n}'.`);c=null,cancelActiveScript("restart"),patchWalkerState({currentRoomId:null,destinationId:e.targetId,lastDispatchedSegmentEndpoint:null,lastError:null,plan:e,segmentCount:e.segments.length,segmentIndex:0,settledAt:0,sourceId:e.sourceId,startedAt:s(),status:"dispatching"},a),emit("start",{plan:e});const i={executionMode:e.executionMode,segmentCount:e.segments.length,sourceId:e.sourceId,targetId:e.targetId,totalWeight:e.totalWeight};raiseEvent(ha.PATHING_START,i),busBroadcast(ci.WALKER_START,{plan:e,...i}),0!==e.segments.length?(!o&&shouldPreflightStopHostPath(e)&&sendCommands([Fa]),dispatchCurrentSegment()):finalizeComplete()}function stop(e="stopped"){if(d)return;const t=a.get();if("idle"===t.status||"completed"===t.status||"stopped"===t.status)return;shouldCancelHostPath(t)&&sendCommands([Fa]),c=null,cancelActiveScript(e);const n=t.plan,o=t.segmentIndex;patchWalkerState({lastError:null,settledAt:s(),status:"stopped"},a),emit("stopped",{plan:n,reason:e,segmentIndex:o}),Ry.has(String(e))&&raisePathingBlocked({reason:e}),busBroadcast(ci.WALKER_STOPPED,{plan:n,reason:e,segmentIndex:o})}function dispose(){if(!d){for(d=!0,c=null,cancelActiveScript("disposed");g.length>0;){const e=g.pop();try{e?.()}catch{}}for(const e of l.values())e.clear()}}function dispatchCurrentSegment(){const e=currentPlan();if(!e)return;const t=currentSegmentIndex(),n=e.segments[t];if(!n)return void finalizeComplete();const o=segmentEndpoint(n);patchWalkerState({lastDispatchedSegmentEndpoint:o,segmentIndex:t,status:"dispatching"},a),emit("dispatch",{plan:e,segment:n,segmentIndex:t}),isRuntimeScriptSegment(n)?dispatchScriptSegment(n,o):(dispatchSegmentCommands(n),shouldSkipRoomWait(n,o)?advanceToNextSegment():patchWalkerState({status:"awaiting-room"},a))}function handleLocationEvent(e){const t=extractCurrentRoomIdFromEvent(e);if(null===t)return;patchWalkerState({currentRoomId:t},a),raiseCurrentRoomEvents(e,t);const n=a.get();if(!n.plan)return;if("awaiting-room"!==n.status)return void("dispatching"===n.status&&maybeCompleteScriptArrival(n,t));const o=n.plan.segments[n.segmentIndex];o&&(roomIdsEqual$1(t,segmentEndpoint(o))?handleSegmentArrival(o,t):isRoomInfoEvent(e)&&dispatchCurrentSegment())}function handleSegmentArrival(e,t){const n=a.get(),o=n.plan,s=n.segmentIndex,l=s>=o.segments.length-1,d=Object.freeze({isFinal:l,segment:e,segmentCount:o.segments.length,segmentIndex:s});let u;if(emit("arrival",{plan:o,roomId:t,...d}),"function"==typeof i)try{u=i(t,d)}catch(p){return void failWith(p)}if(isThenable(u)){const e=Symbol("arrival-pending");return c=e,patchWalkerState({status:"dispatching"},a),void Promise.resolve(u).then(()=>{c===e&&(c=null,completeArrivalTransition(l))},t=>{c===e&&(c=null,failWith(t))})}completeArrivalTransition(l)}function completeArrivalTransition(e){e?finalizeComplete():advanceToNextSegment()}function advanceToNextSegment(){const e=a.get(),t=e.plan;if(!t)return;const n=e.segmentIndex+1;patchWalkerState({segmentIndex:n},a),n>=t.segments.length?finalizeComplete():dispatchCurrentSegment()}function handleBalanceEvent(){const e=a.get();e.plan&&"awaiting-room"===e.status&&dispatchCurrentSegment()}function dispatchSegmentCommands(e){const t=segmentCommands(e);shouldDispatchImmediately(t)?sendCommands(t):sendQueue(t)}function finalizeComplete(){const e=a.get(),t=e.plan,n=e.currentRoomId??t?.targetId??null,o=null!=e.startedAt?s()-e.startedAt:null;patchWalkerState({currentRoomId:n,segmentIndex:t?t.segments.length:0,settledAt:s(),status:"completed"},a),emit("complete",{finalRoomId:n,plan:t});const i={elapsedMs:o,finalRoomId:n,sourceId:t?.sourceId??null,targetId:t?.targetId??null};raiseEvent(ha.PATHING_COMPLETE,i),busBroadcast(ci.WALKER_COMPLETE,{plan:t,...i})}function failWith(e){c=null,cancelActiveScript("error");const t=e instanceof Error?e.message:String(e);reportStepperError(e);const n=a.get(),o=n.plan,i=n.segmentIndex;patchWalkerState({lastError:t,settledAt:s(),status:"error"},a),emit("error",{error:e,plan:o,segmentIndex:i}),raisePathingBlocked({error:t,reason:"error"}),busBroadcast(ci.WALKER_ERROR,{error:t,plan:o,segmentIndex:i})}function dispatchScriptSegment(e,t){if(!h)return void failWith(new Error(`Script segment '${e.scriptId??""}' requires ScriptExecutor.`));const n=Symbol("script-pending");u=n,patchWalkerState({status:"dispatching"},a);const o=a.get(),i=h.startSegment({plan:o.plan,segment:e,segmentIndex:o.segmentIndex});isThenable(i)?Promise.resolve(i).then(()=>{completeScriptDispatch(n,e,t)},e=>{u===n&&(u=null,failWith(e))}):completeScriptDispatch(n,e,t)}function completeScriptDispatch(e,t,n){u===e&&(u=null,shouldSkipRoomWait(t,n)?advanceToNextSegment():patchWalkerState({status:"awaiting-room"},a))}function cancelActiveScript(e){u=null,h?.cancel?.(e)}function maybeCompleteScriptArrival(e,t){if(null===u)return!1;const n=e.plan?.segments?.[e.segmentIndex];return!(!n||!isRuntimeScriptSegment(n)||!roomIdsEqual$1(t,segmentEndpoint(n))||(cancelActiveScript("arrived"),handleSegmentArrival(n,t),0))}function isRuntimeScriptSegment(e){return"script"===e.kind&&"string"==typeof e.scriptId&&"function"==typeof h?.hasScript&&h.hasScript(e.scriptId)}function raiseCurrentRoomEvents(t,n){if(null!==m&&roomIdsEqual$1(m,n))return;m=n;const o={rawTopic:t.rawTopic??null,roomId:n,sequence:t.sequence??null,source:t.source??null,timestampMs:t.timestampMs??null};e.eventStream?.raiseRoomChanged?.(n,o);const a=extractAreaName(t);if(a&&a!==p){p=a;const e={gameAreaName:a,gmcpAreaId:extractGmcpAreaId(t),roomId:n};raiseEvent(ha.AREA_CHANGED,e),busBroadcast(ci.AREA_CHANGED,e)}}function raisePathingBlocked(e){const t=a.get();raiseEvent(ha.PATHING_BLOCKED,{segmentIndex:t.segmentIndex,sourceId:t.plan?.sourceId??null,targetId:t.plan?.targetId??null,...e})}function raiseEvent(t,n){e.eventStream?.raise?.(t,n)}function sendCommands(n){const a=o?.getState?.()?.commandSeparator??"|";t?t.emit(ci.SEND_COMMANDS,{commands:n,separator:a}):e.client.sendCommands(n,{separator:a})}function sendQueue(n){const a=o?.getState?.()?.commandSeparator??"|";t?t.emit(ci.SEND_QUEUE,{commands:n,separator:a}):e.client.sendQueue(n,{separator:a})}function busBroadcast(e,n){t?.emit?.(e,n)}function assertEvent(e){if(!l.has(e))throw new Error(`Unknown walker event '${e}'. Expected one of ${Cy.join(", ")}.`)}function replaceActivePlan(){stop("restart")}return{dispose,getState:getStateSnapshot,off,on,start,stop,get isDisposed(){return d}}}function isActiveWalkerStatus(e){return"dispatching"===e||"awaiting-room"===e}function isStartableWalkerStatus(e){return"idle"===e||"completed"===e||"stopped"===e||"error"===e}function shouldCancelHostPath(e){const t=e?.plan?.segments?.[e.segmentIndex??0];return!!t&&("path-track"===t.kind||Array.isArray(t.commands)&&t.commands.some(isPathTrackCommand))}function shouldPreflightStopHostPath(e){if("hybridTrack"!==e?.executionMode)return!1;const t=e.segments?.[0]??null;return!!t&&!segmentCommands(t).some(isPathStopCommand)}function shouldDispatchImmediately(e){return e.some(isPathStopCommand)}function segmentCommands(e){return Array.isArray(e?.commands)?[...e.commands]:[]}function assertPlan(e){if(!e||"object"!=typeof e)throw new Error("stepper.start requires a PlannedPath.");if(!Array.isArray(e.segments))throw new Error("PlannedPath.segments must be an array.");if("hybridTrack"!==e.executionMode&&"clientStep"!==e.executionMode)throw new Error(`Unsupported plan executionMode '${e.executionMode}'.`)}function segmentEndpoint(e){const{roomIds:t}=e;return Array.isArray(t)&&0!==t.length?t[t.length-1]:null}function shouldSkipRoomWait(e,t){return!!Ey.has(e.kind)&&!isRealRoomId(t)}function isRealRoomId(e){return!("number"!=typeof e||!Number.isFinite(e))||!("string"!=typeof e||!/^-?\d+$/.test(e))}function isRoomInfoEvent(e){return e?.topic===na.GMCP_ROOM_INFO||"Room.Info"===e?.rawTopic}function roomIdsEqual$1(e,t){return null!=e&&null!=t&&String(e)===String(t)}function isThenable(e){return Boolean(e)&&"function"==typeof e.then}function extractGmcpAreaId(e){return e?.payload?.areaid??null??null}function extractAreaName(e){const t=e?.payload?.currentArea??e?.payload?.areaName??e?.payload?.area??e?.payload?.areaname??null;if(null==t)return null;const n=String(t).trim();return n.length>0?n:null}function defaultNow(){return"undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now()}function reportStepperError(e){try{globalThis.console?.error?.("[nexMap4] Walker failed:",e)}catch{}}function createDenizenCollector({adapter:e=null,client:t=null,ignorePatterns:n=Rn,initialDenizens:o=[],now:a=()=>(new Date).toString(),seedPending:i=!1}={}){return new ky({adapter:e,client:t,ignorePatterns:n,initialDenizens:o,now:a,seedPending:i})}var ky=class{#r;#Ct;#Et=new Map;#Rt=!1;#kt;#At=Promise.resolve({inserts:[],updates:[]});#Tt;#Mt=new Map;#zt=!1;#$t=null;#Nt=!0;#Pt=null;#Ot=null;constructor({adapter:e=null,client:t=null,ignorePatterns:n=Rn,initialDenizens:o=[],now:a=()=>(new Date).toString(),seedPending:i=!1}={}){this.#r=e,this.#Ct=t,this.#kt=n,this.#Tt=a,this.#Nt=!i,this.seed(o,{markReady:!i,releaseBuffered:!i})}start(){if(this.#Pt)return this;const e=this.#r?.gmcp;return e&&"function"==typeof e.subscribe?(this.#Pt=e.subscribe(na.GMCP_CHAR_ITEMS_LIST,e=>this.observeItemsList(e)),this.#Ot=e.subscribe(na.HOST_PROMPT,()=>{this.#At=this.flush()}),this):this}stop(){return this.#Pt?.(),this.#Ot?.(),this.#Pt=null,this.#Ot=null,this}dispose(){this.stop()}seed(e=[],{markReady:t=!0,releaseBuffered:n=!0}={}){for(const o of e??[]){const e=normalizeDenizenId(o?.id);if(null===e)continue;const t=(Array.isArray(o.room)?o.room:[]).map(normalizeRoomId$2).filter(notNull);this.#Et.set(e,new Set(t))}return t&&(this.#Nt=!0,this.#zt=!1,this.#$t=null),t&&n&&this.#Mt.size>0&&(this.#At=this.flush()),this.snapshot()}markSeedFailed(e="denizen seed failed"){return this.#zt=!0,this.#Nt=!1,this.#$t=String(e??"denizen seed failed"),this.#Mt.clear(),this.#At=Promise.resolve({disabled:!0,inserts:[],reason:this.#$t,updates:[]}),this.snapshot()}disableRemoteWrites(e="denizen remote writes disabled"){return this.markSeedFailed(e)}observeItemsList(e){const t=e?.payload??{},n=Array.isArray(t.items)?t.items:[];if("room"!==t.location&&null===normalizeRoomId$2(t.location))return null;const o=resolveRoomId(this.#r,t);if(null===o)return null;const a=[];for(const i of n){if(!isMobile(i))continue;if(isIgnoredDenizenName(i.name,this.#kt))continue;const e=normalizeDenizenItem(i,o,this.#r);e&&a.push(e)}return a.length>0&&this.#Mt.set(o,a),a}flush(){if(this.#Rt)return this.#At;const e=(async()=>{if(this.#zt)return this.#Mt.clear(),{disabled:!0,inserts:[],reason:this.#$t,updates:[]};if(!this.#Nt)return{deferred:!0,inserts:[],updates:[]};const e=[...this.#Mt.entries()];if(this.#Mt.clear(),0===e.length||!this.#Ct)return{inserts:[],updates:[]};const t=[],n=[];this.#Rt=!0;try{for(const[o,a]of e)for(const e of a){const a=this.#Et.get(e.id);if(!a){const n={...e,room:[o],time:this.#Tt()};this.#Et.set(e.id,new Set([o])),await this.#Ct.insert(n),t.push(n);continue}if(!a.has(o)){const t={id:e.id,room:[o],time:this.#Tt()};a.add(o),await this.#Ct.updateRoom(t),n.push(t)}}}finally{this.#Rt=!1}return{inserts:t,updates:n}})();return this.#At=e,e}waitForLastFlush(){return this.#At}snapshot(){return{denizenRoomsById:new Map([...this.#Et.entries()].map(([e,t])=>[e,new Set(t)])),pendingRoomCount:this.#Mt.size,seedFailed:this.#zt,seedFailureReason:this.#$t,seedReady:this.#Nt}}};function normalizeDenizenItem(e,t,n){const o=normalizeDenizenId(e.id),a="string"==typeof e.name?e.name.trim():"";if(null===o||!a)return null;const i={...e,area:resolveLegacyDenizenArea(t,n),id:o,name:a,room:[t]},s=resolveLegacyDenizenUser(n);return s&&(i.user=s),i}function resolveLegacyDenizenArea(e,t){const n=readMatchingGmcpLocation(t,e),o=getLatestCurrentRoomEvent(t?.gmcp)?.payload??{};return{id:firstDefined(n?.areaid,o.areaid,""),name:firstNonEmptyString(n?.areaname,n?.area,o.areaname,o.area,"")}}function readMatchingGmcpLocation(e,t){const n=e?.host?.GMCP?.Location;return n&&"object"==typeof n&&normalizeRoomId$2(n.id??n.num??n.roomId)===t?n:null}function resolveLegacyDenizenUser(e){const t=e?.host??globalThis,n=e?.gmcp?.getLastEvent?.(na.GMCP_CHAR_STATUS)?.payload??t?.GMCP?.Char?.Status??t?.GMCP?.Status??t?.nexusclient?.datahandler?.()?.GMCP?.Status??{},o=firstNonEmptyString(t?.mongo?.user?.id,t?.nexMap?.mongo?.user?.id,globalThis?.mongo?.user?.id,globalThis?.nexMap?.mongo?.user?.id),a=firstNonEmptyString(t?.GMCP?.Character?.name,n.name,n.fullname,t?.nexusclient?.charname);return o||a?{...o?{id:o}:{},...a?{name:a}:{}}:null}function resolveRoomId(e,t){const n=normalizeRoomId$2(t.roomId??t.room??t.location);return null!==n?n:extractCurrentRoomIdFromEvent(getLatestCurrentRoomEvent(e?.gmcp))}function isMobile(e){return"string"==typeof e?.attrib&&e.attrib.includes("m")}function normalizeDenizenId(e){if("number"==typeof e&&Number.isInteger(e))return e;const t=String(e??"").trim();return/^-?\d+$/.test(t)?Number(t):null}function normalizeRoomId$2(e){if(null==e||""===e||"room"===e)return null;if("number"==typeof e&&Number.isInteger(e))return e;const t=String(e).trim();return/^-?\d+$/.test(t)?Number(t):null}function firstDefined(...e){for(const t of e)if(null!=t)return t}function firstNonEmptyString(...e){for(const t of e)if("string"==typeof t&&t.trim().length>0)return t.trim();return""}function notNull(e){return null!==e}var Ay=Object.freeze({EDGE_BLOCK:"edge-block",EDGE_UNBLOCK:"edge-unblock",EDGE_BLOCK_CLEAR:"edge-block-clear",GRAPH_REPLACED:"graph-replaced",NUR_RIFT:"nur-rift",SESSION_TRAVEL:"session-travel",TRAVEL_TOPOLOGY:"travel-topology",WORMHOLE_ADD:"wormhole-add",WORMHOLE_LOAD:"wormhole-load",WORMHOLE_REMOVE:"wormhole-remove",WORMHOLE_REPLACE:"wormhole-replace"}),Ty=Ay;function createRuntimeGraphController(e={}){return new My(e)}var My=class{#n;#_t;#jt;#Ft;#Lt=new Set;#Dt=!1;constructor({graph:e,searchIndexes:t=null,travelTopologyController:n=null}={}){assertGraph(e),this.#n=e,this.#_t=t??buildSearchIndexes(e.toSnapshot()),this.#Ft=n??createTravelTopologyController(),this.#jt=e.revision}get graph(){return this.#n}get searchIndexes(){return this.#_t}get revision(){return this.#n.revision}get travelTopologyController(){return this.#Ft}getGraph(){return this.#n}getSearchIndexes(){return this.#_t}subscribe(e){if("function"!=typeof e)throw new Error("RuntimeGraphController.subscribe requires a listener function.");if(this.#Dt)throw new Error("RuntimeGraphController has been disposed.");return this.#Lt.add(e),()=>{this.#Lt.delete(e)}}notify(e={}){if(this.#Dt)return!1;const t=String(e.reason??"graph-change"),n=!0===e.force,o=this.#n.revision;if(!n&&o===this.#jt)return!1;this.#_t=buildSearchIndexes(this.#n.toSnapshot()),this.#jt=o;const a=freezeEvent({...e,graph:this.#n,reason:t,revision:o,searchIndexes:this.#_t});for(const i of[...this.#Lt])i(a);return!0}replaceGraph(e,{reason:t=Ay.GRAPH_REPLACED,...n}={}){if(assertGraph(e),this.#Dt)throw new Error("RuntimeGraphController has been disposed.");this.#n=e,this.#_t=buildSearchIndexes(e.toSnapshot()),this.#jt=e.revision;const o=freezeEvent({...n,graph:e,reason:t,replaced:!0,revision:e.revision,searchIndexes:this.#_t});for(const a of[...this.#Lt])a(o);return e}updateSessionTravelTopology(e,{notify:t=!1,reason:n=Ay.SESSION_TRAVEL}={}){if(this.#Dt)throw new Error("RuntimeGraphController has been disposed.");return this.#Ft.updateSessionActiveEdges({graph:this.#n,runtimeContext:e}),t&&this.notify({reason:n,force:!1}),this.#n}mutate(e,t={}){if("function"!=typeof e)throw new Error("RuntimeGraphController.mutate requires a mutator function.");if(this.#Dt)throw new Error("RuntimeGraphController has been disposed.");const n=e(this.#n);return this.notify(t),n}dispose(){this.#Dt=!0,this.#Lt.clear()}};function assertGraph(e){if(!e||"function"!=typeof e.toSnapshot||"number"!=typeof e.revision)throw new Error("RuntimeGraphController requires a MapGraph with a revision counter.")}function freezeEvent(e){return Object.freeze({...e})}var zy="runtime.nurRift",$y=Object.freeze(["No sooner does your hand touch against the sizzling maw of a planar tear than do you feel yourself violently yanked within, a scream of pained fury and primordial extinction tearing through your form as you are hurled bodily across the worldly gap to be expelled, violently, from the other side."]),Ny=Object.freeze(["Entering a rune-marked archway, you feel your form grow light, a sense of translucence and sudden speed filling your being as a sense of immeasurable distance accompanies your every step. The sensation soon passes, your form intensifying to flesh and blood once more as you emerge elsewhere."]),Py=new Set(["dispatching","awaiting-room"]),Oy=300;function createNurRiftManager(e={}){return new _y(e)}var _y=class{#r;#n;#Bt=[];#Gt;#Wt;#Vt=null;#Ht;#Ut=!1;#qt;#a;#Kt=[];constructor({adapter:e,graph:t=null,onGraphChange:n=null,onReroute:o=null,refreshDelayMs:a=Oy,stepper:i=null,store:s=null}={}){assertAdapter(e),this.#r=e,this.#n=t,this.#Gt="function"==typeof n?n:null,this.#Wt="function"==typeof o?o:null,this.#Ht=normalizeNonNegativeNumber(a,"refreshDelayMs"),this.#qt=i,this.#a=s}configure({adapter:e,graph:t,onGraphChange:n,onReroute:o,stepper:a,store:i}={}){return void 0!==e&&(assertAdapter(e),this.#r=e),void 0!==t&&this.setGraph(t),void 0!==n&&(this.#Gt="function"==typeof n?n:null),void 0!==o&&(this.#Wt="function"==typeof o?o:null),void 0!==a&&(this.#qt=a),void 0!==i&&(this.#a=i),this}start(){return this.#Ut||(this.#Zt("transport",$y),this.#Zt("refresh",Ny),this.#Kt.push(this.#r.gmcp.subscribe(ga,e=>{this.#Yt(e)})),this.#Ut=!0),this}stop(){if(!this.#Ut)return this;for(;this.#Bt.length>0;)this.#r.triggers.removeTrigger(this.#Bt.pop());for(;this.#Kt.length>0;)this.#Kt.pop()?.();return this.#Xt(),this.#Ut=!1,this}dispose(){this.stop()}setGraph(e){return this.#n=e??null,this}getGraph(){return this.#n}snapshot(){return Object.freeze({graphSummary:this.#n?{edgeCount:this.#n.edgeCount,nodeCount:this.#n.nodeCount}:null,riftLocationRoomId:getNurRiftLocationRoomId(this.#n)})}updateRiftLocation(e,t={}){const n=normalizeRoomId$1(e,"riftLocationRoomId");if(roomIdsEqual(n,45182))return{reason:"source-room",riftLocationRoomId:n,type:"ignored"};const o=requireGraph$1(this.#n),a=getNurRiftLocationRoomId(o);replaceNurRiftEdges(o,n);const i=Object.freeze({graph:o,previousRiftLocationRoomId:a,riftLocationRoomId:n,snapshot:this.snapshot(),type:"nur-rift-updated",...t});return this.#Gt?.(o,i),this.#Jt(i),i}#Zt(e,t){for(const[n,o]of t.entries())this.#Bt.push(this.#r.triggers.addTrigger({action:(...t)=>this.#Qt(e,t),id:`runtime.nurRift.${e}.${n+1}`,lifetime:"session",pattern:o,tag:zy}))}#Qt(e,t){const n=extractMatchFromTriggerArgs(t),o=extractLineFromTriggerArgs(t,n);return"transport"===e?this.#er(o,n):"refresh"===e?this.#tr(o,n):ignored("unknown-kind",o)}#er(e,t){const n=this.#me();return roomIdsEqual(n,45182)?Object.freeze({currentRoomId:n,line:e,match:t,reason:"source-room",type:"ignored"}):null===n?Object.freeze({currentRoomId:n,line:e,match:t,reason:"missing-current-room",type:"ignored"}):this.updateRiftLocation(n,{line:e,match:t,reason:"transport-line"})}#tr(e,t){return isWalkerActive(this.#a?.get?.())?(this.#Xt(),this.#Vt=setTimeout(()=>{this.#Vt=null,this.#r.client.sendCommands(["x"])},this.#Ht),Object.freeze({delayMs:this.#Ht,line:e,match:t,type:"nur-rift-refresh-armed"})):ignored("walker-inactive",e)}#Yt(e){("Room.Info"===e?.rawTopic||e?.topic?.endsWith?.(".room.info"))&&this.#Xt()}#Jt(e){const t=this.#a?.get?.();if(!isWalkerActive(t))return;const n=activeSegment(t);if(!isNurRiftSegment(n))return;const o=firstRoomId(n),a=lastRoomId(n);if(!roomIdsEqual(o,45182)||roomIdsEqual(a,e.riftLocationRoomId))return;const i=Object.freeze({actualTargetRoomId:e.riftLocationRoomId,destinationId:t.destinationId??t.plan?.targetId??null,expectedTargetRoomId:a,segment:n,sourceRoomId:o,type:"nur-rift-reroute"});"function"==typeof this.#qt?.stop&&this.#qt.stop("nur-rift-reroute"),this.#Wt?.(i)}#me(){return extractCurrentRoomIdFromEvent(getLatestCurrentRoomEvent(this.#r.gmcp))}#Xt(){null!==this.#Vt&&(clearTimeout(this.#Vt),this.#Vt=null)}};function activeSegment(e){const t=e?.segmentIndex??0;return e?.plan?.segments?.[t]??null}function isNurRiftSegment(e){return Array.isArray(e?.travelClasses)&&e.travelClasses.includes("nurRift")}function firstRoomId(e){return Array.isArray(e?.roomIds)?e.roomIds[0]??null:null}function lastRoomId(e){return Array.isArray(e?.roomIds)?e.roomIds[e.roomIds.length-1]??null:null}function isWalkerActive(e){return Py.has(e?.status)}function extractLineFromTriggerArgs(e,t=null){if(null!=t?.input)return String(t.input);for(const n of e){if("string"==typeof n)return n;if(n&&"object"==typeof n){const e=n.line??n.rawLine??n.text??n.message??null;if(null!=e)return String(e)}}return""}function extractMatchFromTriggerArgs(e){for(const t of e){if(Array.isArray(t))return t;if(t&&"object"==typeof t){const e=t.match??t.matches??null;if(Array.isArray(e))return e}}return null}function ignored(e,t){return Object.freeze({line:t,reason:e,type:"ignored"})}function normalizeRoomId$1(e,t){if("number"==typeof e&&Number.isInteger(e))return e;const n=String(e??"").trim();if(/^-?\d+$/.test(n))return Number(n);throw new Error(`${t} must be a room id.`)}function normalizeNonNegativeNumber(e,t){const n=Number(e);if(!Number.isFinite(n)||n<0)throw new Error(`${t} must be a non-negative number.`);return n}function roomIdsEqual(e,t){return String(e)===String(t)}function requireGraph$1(e){if(!e||"function"!=typeof e.toSnapshot)throw new Error("Nur rift graph updates require a configured MapGraph.");return e}function assertAdapter(e){if(!e||"object"!=typeof e)throw new Error("createNurRiftManager requires an adapter instance.");if(!e.client||"function"!=typeof e.client.sendCommands)throw new Error("createNurRiftManager adapter must expose client.sendCommands().");if(!e.gmcp||"function"!=typeof e.gmcp.subscribe)throw new Error("createNurRiftManager adapter must expose gmcp.subscribe().");if(!e.triggers||"function"!=typeof e.triggers.addTrigger)throw new Error("createNurRiftManager adapter must expose triggers.addTrigger().")}var jy="worm warp",Fy=3.15,Ly="wormhole";function replaceWormholeEdges(e,t){assertMapGraph(e);const n=buildWormholeEdgeRecords(e,t);return e.replaceEdgesByTravelClass(Ly,n),e}function buildWormholeEdgeRecords(e,t){assertMapGraph(e);const n=dedupeByEndpoint($o.parse(t)),o=[],a=new Set;for(const i of n){const t=i.source.id,n=i.target.id;if(t===n)continue;const s=requireNode(e,t,"source"),l=requireNode(e,n,"target");o.push(createWormholeEdge({edgeIds:a,source:s,sourceRef:i.source,target:l,targetRef:i.target})),o.push(createWormholeEdge({edgeIds:a,source:l,sourceRef:i.target,target:s,targetRef:i.source}))}return o}function createWormholeEdge({edgeIds:e,source:t,sourceRef:n,target:o,targetRef:a}){const i=allocateWormholeEdgeId(e,t.id,o.id);return{areaId:t.areaId,baseId:i,classes:["wormhole"],command:jy,id:i,kind:"special",metadata:{sourceName:n.name,targetName:a.name},origin:"remote",persistence:"remote",role:"travelAction",sourceId:t.id,targetId:o.id,travelClass:Ly,weight:Fy,weightExpression:"celerity * 3.15",weightFn:e=>Fy*Number(e?.celerity??1),z:t.coordinates.z}}function allocateWormholeEdgeId(e,t,n){const o=`wormhole:${t}-${n}`;let a=o,i=2;for(;e.has(a);)a=`${o}#${i}`,i+=1;return e.add(a),a}function dedupeByEndpoint(e){const t=[];for(const n of e){const e=new Set([n.source.id,n.target.id]);for(let n=t.length-1;n>=0;n-=1){const o=t[n];(e.has(o.source.id)||e.has(o.target.id))&&t.splice(n,1)}t.push(n)}return t}function requireNode(e,t,n){const o=e.getNode(t);if(!o)throw new Error(`Wormhole references missing ${n} room '${t}'.`);return o}function assertMapGraph(e){if(!e||"function"!=typeof e.getNode||"function"!=typeof e.replaceEdgesByTravelClass)throw new Error("Wormhole edge updates require a configured MapGraph.")}function createWormholeManager(e={}){return new Dy(e)}var Dy=class{#Ct;#n;#Gt;#rr=new Set;#nr=[];constructor({client:e=null,graph:t=null,initialWormholes:n=[],onGraphChange:o=null}={}){this.#Ct=e,this.#n=t,this.#Gt="function"==typeof o?o:null,this.seed(n)}configure({client:e,graph:t,onGraphChange:n}={}){return void 0!==e&&(this.#Ct=e),void 0!==t&&this.setGraph(t),void 0!==n&&(this.#Gt="function"==typeof n?n:null),this}setGraph(e){return this.#n=e??null,this}getGraph(){return this.#n}seed(e=[]){return this.#nr=dedupeWormholes(e),this.snapshot()}list({includePending:e=!1}={}){return(e?this.#nr:this.#or()).map(cloneWormhole)}snapshot(){return deepFreeze$2({graphSummary:this.#n?{edgeCount:this.#n.edgeCount,nodeCount:this.#n.nodeCount}:null,pendingRemovalSourceIds:[...this.#rr],wormholes:this.list({includePending:!0}),wormholesForPathing:this.list()})}async load(){const e=await requireClient(this.#Ct,"loadAll").loadAll();return this.#rr.clear(),this.#nr=dedupeWormholes(e),this.#ar("load")}async add(e={}){const t=requireClient(this.#Ct,"addWormhole"),n=createWormholeRecord(requireGraph(this.#n),e),o=requireUser(e.user),a=await t.addWormhole({source:n.source,target:n.target,user:o});return this.#nr=upsertWormhole(this.#nr,n),this.#rr.delete(n.source.id),this.#rr.delete(n.target.id),{...this.#ar("add"),response:a,wormhole:cloneWormhole(n)}}async upsert(e={}){return this.add(e)}async remove(e={}){const t=requireClient(this.#Ct,"removeBySourceRoomId"),n=normalizeRoomId(e.sourceRoomId??e.sourceId??e.roomId??e.source,"sourceRoomId"),o=resolveStoredSourceRoomId(this.#nr,n),a=requireUser(e.user),i=await t.removeBySourceRoomId(o,{user:a});return this.#nr=this.#nr.filter(e=>!recordTouchesAny(e,[n,o])),"removalRecorded"===i.outcome?this.#rr.add(o):this.#rr.delete(o),{...this.#ar("remove"),outcome:i.outcome,requestedRoomId:n,response:i,sourceRoomId:o}}#or(){return this.#nr.filter(e=>!this.#rr.has(e.source.id))}#ar(e){const t=requireGraph(this.#n);return replaceWormholeEdges(t,this.#or()),this.#Gt?.(t,{reason:e,snapshot:this.snapshot(),wormholes:this.list()}),{graph:t,snapshot:this.snapshot()}}};function createWormholeRecord(e,t){const n=normalizeRoomRef(t.source??t.sourceRoom??t.sourceRoomId??t.fromRoomId,e,"source"),o=normalizeRoomRef(t.target??t.targetRoom??t.targetRoomId??t.toRoomId??t.roomId,e,"target");if(n.id===o.id)throw new Error("wormhole source and target must be different rooms.");return zo.parse({source:n,target:o})}function normalizeRoomRef(e,t,n){if(e&&"object"==typeof e){const o=normalizeRoomId(e.id??e.roomId,`${n}.id`),a=t.getNode(o),i=nonEmptyString(e.name)??a?.name??null;if(!i)throw new Error(`wormhole ${n} room '${o}' requires a room name.`);return{...e,id:o,name:i}}const o=normalizeRoomId(e,n),a=t.getNode(o);if(!a)throw new Error(`Unknown wormhole ${n} room '${o}'.`);return{id:a.id,name:a.name}}function normalizeRoomId(e,t){if("number"==typeof e&&Number.isInteger(e))return nn.parse(e);const n=String(e??"").trim();if(/^-?\d+$/.test(n))return nn.parse(Number(n));throw new Error(`${t} must be a room id.`)}function requireClient(e,t){if(!e||"function"!=typeof e[t])throw new Error(`Wormhole CRUD requires a configured remote client with ${t}().`);return e}function requireGraph(e){if(!e||"function"!=typeof e.replaceEdgesByTravelClass)throw new Error("Wormhole graph updates require a configured MapGraph.");return e}function requireUser(e){const t=nonEmptyString(e);if(!t)throw new Error("Wormhole CRUD requires a user name.");return t}function dedupeWormholes(e=[]){const t=$o.parse(e),n=[];for(const o of t){const e=[o.source.id,o.target.id];for(let t=n.length-1;t>=0;t-=1)recordTouchesAny(n[t],e)&&n.splice(t,1);n.push(cloneWormhole(o))}return n}function upsertWormhole(e,t){return dedupeWormholes([...e,t])}function resolveStoredSourceRoomId(e,t){return e.find(e=>recordTouchesAny(e,[t]))?.source.id??t}function recordTouchesAny(e,t){const n=new Set(t);return n.has(e.source.id)||n.has(e.target.id)}function cloneWormhole(e){return{...e,source:{...e.source},target:{...e.target}}}function nonEmptyString(e){if("string"!=typeof e)return null;const t=e.trim();return t.length>0?t:null}function deepFreeze$2(e){if(!e||"object"!=typeof e)return e;Object.freeze(e);for(const t of Object.values(e))deepFreeze$2(t);return e}function mountRendererRuntime({app:e,documentRef:t,graph:n,host:o,hydrated:a,remoteClients:i,rendererFactory:s,rendererOptions:l,resources:c}){return c.renderer=assertMapRenderer(s({document:t,graph:n,options:l??void 0})),c.tab.viewModel.setGraph(n),c.tab.viewModel.setRenderer(c.renderer),c.tab.viewModel.bindAdapter(c.adapter),c.renderer.mount(c.tab.container),c.tab.viewModel.setCurrentRoom(resolveInitialRoomId({graph:n,host:o})),applyPersistedRendererSettings(c.renderer,a.settingsStore.get()),c.rendererSettingsUnsub=subscribeRendererToSettings(c.renderer,a.settingsStore),c.trackingController=createTrackingController({adapter:c.adapter,graph:n,renderer:c.renderer,store:a.trackingStore}).start(),c.roomClickUnsubscribe=e.connectRendererActions({renderer:c.renderer}),c.runtimeGraphUnsubscribe=c.runtimeGraphController.subscribe(t=>{c.renderer?.setGraph(t.graph),c.tab?.viewModel.setGraph(t.graph),c.trackingController?.setGraph(t.graph),e.configure?.({graph:t.graph,searchIndexes:t.searchIndexes})}),e.configure({adapter:c.adapter,denizenCollector:a.denizenCollector,denizensClient:i.denizensClient,graph:n,renderer:c.renderer,runtimeGraphController:c.runtimeGraphController,searchIndexes:a.searchIndexes,settingsRepository:a.settingsRepository,settingsStore:a.settingsStore,stepper:a.stepper,trackingController:c.trackingController,trackingStore:a.trackingStore,travelTopologyController:c.runtimeGraphController.travelTopologyController,triggerPack:a.triggerPack,wormholeManager:a.wormholeManager,wormholesClient:i.wormholesClient}),c.renderer}var By=deepFreeze$1({apiKey:"zr1te94RPZ4yaMJCc6j134eAxDsCpkmm48py1GaD",endpoints:{denizens:"https://2a9fwzdazf.execute-api.us-east-2.amazonaws.com/nexMap/denizens",nexMap:"https://2a9fwzdazf.execute-api.us-east-2.amazonaws.com/default/nexMap",users:"https://2a9fwzdazf.execute-api.us-east-2.amazonaws.com/default/nexMap",wormholes:"https://2a9fwzdazf.execute-api.us-east-2.amazonaws.com/nexMap/wormholes"}});function normalizeRemoteConfig(e){const t=Io.parse(e);return deepFreeze$1({apiKey:t.apiKey,endpoints:{denizens:t.endpoints.denizens,nexMap:t.endpoints.nexMap,users:t.endpoints.users,wormholes:t.endpoints.wormholes}})}function resolveRemoteConfig(e=null,t=By){return normalizeRemoteConfig(e?{apiKey:e.apiKey??t.apiKey,endpoints:{...t.endpoints,...e.endpoints??{}}}:t)}function resolveGlobalRemoteConfig(e=globalThis){return resolveRemoteConfig(e?.nexMap4RemoteConfig??null)}function deepFreeze$1(e){if(!e||"object"!=typeof e)return e;Object.freeze(e);for(const t of Object.values(e))deepFreeze$1(t);return e}var Gy=class extends Error{constructor(e,{body:t=null,cause:n,method:o,status:a=null,url:i}={}){super(e,n?{cause:n}:void 0),this.name="RemoteServiceError",this.body=t,this.method=o,this.status=a,this.url=i}},Wy=2,Vy=250;function defaultRetryOn(e){return null==e||e>=500}function normalizeRetryPolicy(e){if(!1===e)return{attempts:1,backoffMs:0,retryOn:defaultRetryOn};const t=e??{};return{attempts:Math.max(1,Math.floor(Number(t.attempts??Wy))),backoffMs:Math.max(0,Number(t.backoffMs??Vy)),retryOn:"function"==typeof t.retryOn?t.retryOn:defaultRetryOn}}function delay$1(e){return new Promise(t=>setTimeout(t,e))}var Hy=class{constructor({config:e,retry:t}={}){this.config=normalizeRemoteConfig(e),this.retryPolicy=normalizeRetryPolicy(t)}async request(e,{responseSchema:t=unknown(),retry:n}={}){const o=Ro.parse(e),a=buildRemoteUrl(this.config.endpoints[o.params.collection],o.params),i={headers:{"Content-Type":"application/json","x-api-key":this.config.apiKey},method:o.method};void 0!==o.body&&null!==o.body&&(i.body=JSON.stringify(o.body));const s=void 0!==n?normalizeRetryPolicy(n):this.retryPolicy;let l=null;for(let d=1;d<=s.attempts;d++)try{return await this.#ir(a,i,o.method,t)}catch(c){l=c;const e=c instanceof Gy?c.status:null;if(d<s.attempts&&s.retryOn(e,c)){await delay$1(s.backoffMs*Math.pow(2,d-1));continue}throw c}throw l}async#ir(e,t,n,o){let a;try{a=await fetch(e,t)}catch(l){throw new Gy(`Remote ${n} request failed before response.`,{cause:l,method:n,url:e})}const i=await readRemoteBody(a),s=a?.status??null;if(!a?.ok)throw new Gy(createHttpErrorMessage(n,s,i),{body:i,method:n,status:s,url:e});return{body:o.parse(i),status:s,url:e}}};function buildRemoteUrl(e,t){const n=new URLSearchParams;for(const[o,a]of Object.entries(t))n.append(o,String(a));return`${e}${e.includes("?")?"&":"?"}${n.toString()}`}async function readRemoteBody(e){if(!e||204===e.status)return null;if("function"==typeof e.json)try{return await e.json()}catch(t){return readRemoteText(e,t)}return readRemoteText(e)}async function readRemoteText(e,t){if("function"!=typeof e?.text){if(t)throw t;return null}const n=await e.text();if(!n)return null;try{return JSON.parse(n)}catch{return n}}function createHttpErrorMessage(e,t,n){const o=t??"unknown";return n&&"object"==typeof n&&"message"in n?`Remote ${e} request failed with status ${o}: ${n.message}`:"string"==typeof n&&n.length>0?`Remote ${e} request failed with status ${o}: ${n}`:`Remote ${e} request failed with status ${o}.`}var Uy=class{constructor({httpClient:e,...t}={}){this.httpClient=e??new Hy(t)}async loadAll(){return(await this.httpClient.request({body:null,method:"GET",params:{collection:"denizens",name:"ALL"}},{responseSchema:Po})).body}async search(e){const t=String(e).toLowerCase();return(await this.httpClient.request({body:null,method:"GET",params:{collection:"denizens",name:t}},{responseSchema:_o})).body}async insert(e){const t=Oo.parse(e);return(await this.httpClient.request({body:{data:t},method:"POST",params:{collection:"denizens"}},{responseSchema:jo})).body}async updateRoom({id:e,room:t,time:n}){const o=t.map(e=>nn.parse(e));return(await this.httpClient.request({body:{data:{id:e,room:o,time:n},filter:{id:e},upsert:!1},method:"PUT",params:{collection:"denizens"}},{responseSchema:jo})).body}},qy=class{constructor({httpClient:e,...t}={}){this.httpClient=e??new Hy(t)}async checkAuth(){return isAuthenticatedResponse((await this.httpClient.request({body:null,method:"GET",params:{collection:"nexMap",check:"auth"}})).body)}async upsertOnLoad({date:e=new Date,name:t,packages:n}){const o=Lo.parse({data:{date:e,name:t,packages:n},filter:{name:t},upsert:!0});return(await this.httpClient.request({body:o,method:"PUT",params:{collection:"users"}},{responseSchema:jo})).body}};function isAuthenticatedResponse(e){return"boolean"==typeof e?e:e&&"object"==typeof e&&"authenticated"in e?!0===e.authenticated:Boolean(e)}var Ky=class{constructor({httpClient:e,...t}={}){this.httpClient=e??new Hy(t)}async loadAll(){return(await this.httpClient.request({body:null,method:"GET",params:{collection:"wormholes",type:"all"}},{responseSchema:$o})).body}async addWormhole({source:e,target:t,user:n}){const o=zo.parse({source:e,target:t});return(await this.httpClient.request({body:{data:{removeRequests:[],source:o.source,target:o.target,user:n}},method:"POST",params:{collection:"wormholes"}},{responseSchema:jo})).body}async removeBySourceRoomId(e,{user:t}){const n=nn.parse(e),o=await this.httpClient.request({body:{data:{user:t}},method:"DELETE",params:{collection:"wormholes",type:"id",id:n}},{responseSchema:jo.nullable()});return{body:o.body,outcome:202===o.status?"removalRecorded":"deleted",status:o.status}}};function reportStartupError(e,t){try{globalThis.console?.error?.("[nexMap4] Startup failed:",t,e)}catch{}}function logDenizenStartupDebug(e,t=void 0){try{if(void 0===t)return void globalThis.console?.log?.(`[nexMap4 denizens] startup ${e}`);globalThis.console?.log?.(`[nexMap4 denizens] startup ${e}`,t)}catch{}}function isFatalStartupAbortError(e){return e instanceof Yy||e instanceof Zy&&e.cause instanceof Yy}function formatErrorMessage(e){return e instanceof Error?e.message:String(e??"unknown error")}function normalizeError(e){return e instanceof Zy?{cause:e.cause instanceof Error?e.cause.message:String(e.cause??""),message:e.message,name:e.name,phase:e.phase}:e instanceof Error?{cause:e.cause instanceof Error?e.cause.message:String(e.cause??""),message:e.message,name:e.name,phase:null}:{cause:"",message:String(e),name:"Error",phase:null}}function cloneState(e){return{attempts:{...e.attempts},capabilities:e.capabilities?{capabilities:{missingOptional:[...e.capabilities.capabilities.missingOptional],missingRequired:[...e.capabilities.capabilities.missingRequired],presentOptional:[...e.capabilities.capabilities.presentOptional],presentRequired:[...e.capabilities.capabilities.presentRequired]},globals:{optional:{...e.capabilities.globals.optional},required:{...e.capabilities.globals.required}},ok:e.capabilities.ok}:null,completed:e.completed,graphSummary:e.graphSummary?{...e.graphSummary}:null,lastError:e.lastError?{...e.lastError}:null,phase:e.phase,ready:e.ready,rendererViewport:e.rendererViewport?cloneJson$1(e.rendererViewport):null,started:e.started,tab:e.tab?{...e.tab}:null,warnings:e.warnings.map(e=>({...e}))}}function delay(e){return e<=0?Promise.resolve():new Promise(t=>{setTimeout(t,e)})}function resolveDocument(){return"undefined"!=typeof document?document:null}var Zy=class extends Error{constructor(e,{cause:t,phase:n}){super(e,t?{cause:t}:void 0),this.name="StartupPhaseError",this.phase=n}},Yy=class extends Error{constructor(e,{cause:t}={}){super(e,t?{cause:t}:void 0),this.name="RemoteAuthenticationError"}};function resolveRemoteClients({denizensClient:e=null,remoteConfig:t=null,usersClient:n=null,wormholesClient:o=null}={}){const a=t?{config:t}:null;return{denizensClient:e??(a?new Uy(a):null),usersClient:n??(a?new qy(a):null),wormholesClient:o??(a?new Ky(a):null)}}async function checkRemoteAuth(e){if(!e)return!0;if("function"!=typeof e.checkAuth)throw new Yy("nexMap remote authentication client is missing checkAuth.");let t;try{t=await e.checkAuth()}catch(n){throw new Yy("nexMap remote authentication failed.",{cause:n})}if(!t)throw new Yy("nexMap remote authentication failed.");return!0}async function loadStartupWormholes(e){if(!e)return[];if("function"!=typeof e.loadAll)throw new Error("nexMap remote wormhole loading requires loadAll.");return e.loadAll()}async function loadDenizenSeed(e){if(!e)return logDenizenStartupDebug("loadDenizenSeed skipped; no denizen client configured"),[];if("function"!=typeof e.loadAll)throw new Error("nexMap denizen collection seed loading requires loadAll.");logDenizenStartupDebug("loadDenizenSeed start");try{const t=await e.loadAll();return logDenizenStartupDebug("loadDenizenSeed complete",{recordCount:t?.length??0}),t}catch(t){throw logDenizenStartupDebug("loadDenizenSeed failed",{message:formatErrorMessage(t)}),t}}var Xy=Object.freeze({BOOTING:"BOOTING",BUILDING_GRAPH:"BUILDING_GRAPH",DEGRADED:"DEGRADED",FETCHING_CROWDMAP:"FETCHING_CROWDMAP",FETCHING_REMOTE:"FETCHING_REMOTE",HYDRATING_STATE:"HYDRATING_STATE",READY:"READY"}),Jy=(Object.freeze(Object.values(Xy)),"https://raw.githubusercontent.com/IRE-Mudlet-Mapping/AchaeaCrowdmap/gh-pages/Map/map_mini.json"),Qy=Object.freeze({cache:"no-store"});async function hydrateRuntime({app:e,denizenSeedPromise:t=null,denizensClient:n,graph:o,initialWormholes:a,readCharacterName:i,resources:s,settingsRepository:l,settingsStore:c,notify:d,warn:u,wormholesClient:m}){const h=c??e.settings?.store??createSettingsAtom(),g=l??new In({storage:createClientVariableSettingsStorage(s.adapter.client)}),y=createWalkerStore();s.stepper=createStepper({adapter:s.adapter,eventBus:s.eventBus??void 0,settingsStore:h,store:y});const b=e.trackingStore??createTrackingStore();function notifyRuntimeGraphChange(e,t={}){s.runtimeGraphController?.notify({...t,reason:t.reason??Ty.WORMHOLE_REPLACE})}function restartSpecialTravel(t,n,o){const a=t?.destinationId??null;null!=a&&null!=n&&e.execute(p.TRAVEL_TO_ROOM,{roomId:a,silent:!0,sourceRoomId:n}).catch(e=>{u(o,`nexMap special-travel replan failed: ${e instanceof Error?e.message:String(e)}`,Xy.HYDRATING_STATE)})}return s.runtimeGraphController=createRuntimeGraphController({graph:o}),s.wormholeManager=createWormholeManager({client:m,graph:o,initialWormholes:a,onGraphChange:(e,t)=>notifyRuntimeGraphChange(e,{...t,reason:"load"===t?.reason?Ty.WORMHOLE_LOAD:"add"===t?.reason?Ty.WORMHOLE_ADD:"remove"===t?.reason?Ty.WORMHOLE_REMOVE:Ty.WORMHOLE_REPLACE})}),s.nurRiftManager=createNurRiftManager({adapter:s.adapter,graph:o,onGraphChange:(e,t)=>notifyRuntimeGraphChange(e,{...t,reason:Ty.NUR_RIFT}),onReroute(e){restartSpecialTravel(e,e.actualTargetRoomId,"nur-rift-reroute-failed")},stepper:s.stepper,store:y}).start(),s.denizenCollector=createDenizenCollector({adapter:s.adapter,client:n,graph:o,initialDenizens:[],seedPending:Boolean(n)}).start(),attachDenizenSeed({collector:s.denizenCollector,denizenSeedPromise:t,notify:d,resources:s,warn:u}),s.triggerPack=createTriggerPack({adapter:s.adapter,graph:o,onGraphChange:(e,t)=>notifyRuntimeGraphChange(e,{...t,reason:"edge-block-clear"===t?.reason?Ty.EDGE_BLOCK_CLEAR:"edge-unblock"===t?.reason?Ty.EDGE_UNBLOCK:Ty.EDGE_BLOCK}),settingsStore:h,onWormholeFound(e){const t=i();t?s.wormholeManager?.add({...e,user:t}).catch(e=>{u("remote-wormhole-write-failed",`nexMap remote wormhole write failed: ${e instanceof Error?e.message:String(e)}`,Xy.HYDRATING_STATE)}):u("remote-wormhole-user-missing","nexMap remote wormhole persistence requires Char.Status.name.",Xy.HYDRATING_STATE)},onWormholeMissing(e){const t=i();t&&null!==e.sourceRoomId&&void 0!==e.sourceRoomId&&s.wormholeManager?.remove({sourceRoomId:e.sourceRoomId,user:t}).then(()=>{restartSpecialTravel(e,e.sourceRoomId,"remote-wormhole-replan-failed")}).catch(e=>{u("remote-wormhole-remove-failed",`nexMap remote wormhole removal failed: ${e instanceof Error?e.message:String(e)}`,Xy.HYDRATING_STATE)})},onWormholeReroute(e){const t=i();t&&null!==e.sourceRoomId&&void 0!==e.sourceRoomId&&null!==e.actualTargetRoomId&&void 0!==e.actualTargetRoomId&&s.wormholeManager?.add({sourceRoomId:e.sourceRoomId,targetRoomId:e.actualTargetRoomId,user:t}).then(()=>{restartSpecialTravel(e,e.actualTargetRoomId,"remote-wormhole-reroute-failed")}).catch(e=>{u("remote-wormhole-reroute-failed",`nexMap remote wormhole reroute failed: ${e instanceof Error?e.message:String(e)}`,Xy.HYDRATING_STATE)})},onWormholeUnavailable(){updateSettings(e=>({...e,disabledTravelClasses:[...new Set([...e.disabledTravelClasses,"wormhole"])]}),h)},stepper:s.stepper,store:y}),{denizensClient:n,denizenCollector:s.denizenCollector,nurRiftManager:s.nurRiftManager,runtimeGraphController:s.runtimeGraphController,searchIndexes:s.runtimeGraphController.getSearchIndexes(),settingsRepository:g,settingsStore:h,stepper:s.stepper,trackingStore:b,triggerPack:s.triggerPack,wormholeManager:s.wormholeManager}}function attachDenizenSeed({collector:e,denizenSeedPromise:t,notify:n,resources:o,warn:a}){t?t.then(t=>{o.denizenCollector===e&&(e.seed(t),n(`Denizen database loaded with ${t.length} NPC entries.`))}).catch(t=>{a("remote-denizen-seed-failed",`nexMap denizen collection seed failed; remote denizen writes are disabled for this session: ${formatErrorMessage(t)}`,Xy.HYDRATING_STATE),o.denizenCollector===e&&e.markSeedFailed(formatErrorMessage(t))}):e.seed([])}var eb=__commonJSMin((e,t)=>{var n,o="object"==typeof Reflect?Reflect:null,a=o&&"function"==typeof o.apply?o.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};function ProcessEmitWarning(e){console&&console.warn&&console.warn(e)}n=o&&"function"==typeof o.ownKeys?o.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function EventEmitter(){EventEmitter.init.call(this)}t.exports=EventEmitter,t.exports.once=once,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var s=10;function checkListener(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function _getMaxListeners(e){return void 0===e._maxListeners?EventEmitter.defaultMaxListeners:e._maxListeners}function _addListener(e,t,n,o){var a,i,s;if(checkListener(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),void 0===s)s=i[t]=n,++e._eventsCount;else if("function"==typeof s?s=i[t]=o?[n,s]:[s,n]:o?s.unshift(n):s.push(n),(a=_getMaxListeners(e))>0&&s.length>a&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,ProcessEmitWarning(l)}return e}function onceWrapper(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _onceWrap(e,t,n){var o={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},a=onceWrapper.bind(o);return a.listener=n,o.wrapFn=a,a}function _listeners(e,t,n){var o=e._events;if(void 0===o)return[];var a=o[t];return void 0===a?[]:"function"==typeof a?n?[a.listener||a]:[a]:n?unwrapListeners(a):arrayClone(a,a.length)}function listenerCount(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function arrayClone(e,t){for(var n=new Array(t),o=0;o<t;++o)n[o]=e[o];return n}function spliceOne(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function unwrapListeners(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function once(e,t){return new Promise(function(n,o){function errorListener(n){e.removeListener(t,resolver),o(n)}function resolver(){"function"==typeof e.removeListener&&e.removeListener("error",errorListener),n([].slice.call(arguments))}eventTargetAgnosticAddListener(e,t,resolver,{once:!0}),"error"!==t&&addErrorHandlerIfEventEmitter(e,errorListener,{once:!0})})}function addErrorHandlerIfEventEmitter(e,t,n){"function"==typeof e.on&&eventTargetAgnosticAddListener(e,"error",t,n)}function eventTargetAgnosticAddListener(e,t,n,o){if("function"==typeof e.on)o.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function wrapListener(a){o.once&&e.removeEventListener(t,wrapListener),n(a)})}}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),EventEmitter.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},EventEmitter.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},EventEmitter.prototype.getMaxListeners=function(){return _getMaxListeners(this)},EventEmitter.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var l=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw l.context=s,l}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)a(c,this,t);else{var d=c.length,u=arrayClone(c,d);for(n=0;n<d;++n)a(u[n],this,t)}return!0},EventEmitter.prototype.addListener=function(e,t){return _addListener(this,e,t,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function(e,t){return _addListener(this,e,t,!0)},EventEmitter.prototype.once=function(e,t){return checkListener(t),this.on(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.prependOnceListener=function(e,t){return checkListener(t),this.prependListener(e,_onceWrap(this,e,t)),this},EventEmitter.prototype.removeListener=function(e,t){var n,o,a,i,s;if(checkListener(t),void 0===(o=this._events))return this;if(void 0===(n=o[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(a=-1,i=n.length-1;i>=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,a=i;break}if(a<0)return this;0===a?n.shift():spliceOne(n,a),1===n.length&&(o[e]=n[0]),void 0!==o.removeListener&&this.emit("removeListener",e,s||t)}return this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.removeAllListeners=function(e){var t,n,o=this._events;if(void 0===o)return this;if(void 0===o.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==o[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete o[e]),this;if(0===arguments.length){var a,i=Object.keys(o);for(n=0;n<i.length;++n)"removeListener"!==(a=i[n])&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=o[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},EventEmitter.prototype.listeners=function(e){return _listeners(this,e,!0)},EventEmitter.prototype.rawListeners=function(e){return _listeners(this,e,!1)},EventEmitter.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):listenerCount.call(e,t)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}}),tb=eb();function assignPolyfill(){const e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(const o in arguments[t])e[o]=arguments[t][o];return e}var rb=assignPolyfill;function getMatchingEdge(e,t,n,o){const a=e._nodes.get(t);let i=null;return a?(i="mixed"===o?a.out&&a.out[n]||a.undirected&&a.undirected[n]:"directed"===o?a.out&&a.out[n]:a.undirected&&a.undirected[n],i):i}function isPlainObject(e){return"object"==typeof e&&null!==e}function isEmpty(e){let t;for(t in e)return!1;return!0}function privateProperty(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function readOnlyProperty(e,t,n){const o={enumerable:!0,configurable:!0};"function"==typeof n?o.get=n:(o.value=n,o.writable=!1),Object.defineProperty(e,t,o)}function validateHints(e){return!(!isPlainObject(e)||e.attributes&&!Array.isArray(e.attributes))}function incrementalIdStartingFromRandomByte(){let e=255&Math.floor(256*Math.random());return()=>e++}function chain(){const e=arguments;let t=null,n=-1;return{[Symbol.iterator](){return this},next(){let o=null;for(;;){if(null===t){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(o=t.next(),!o.done)break;t=null}return o}}}function emptyIterator(){return{[Symbol.iterator](){return this},next:()=>({done:!0})}}"function"==typeof Object.assign&&(rb=Object.assign);var nb=class extends Error{constructor(e){super(),this.name="GraphError",this.message=e}},ob=class e extends nb{constructor(t){super(t),this.name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e.prototype.constructor)}},ab=class e extends nb{constructor(t){super(t),this.name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e.prototype.constructor)}},ib=class e extends nb{constructor(t){super(t),this.name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e.prototype.constructor)}};function MixedNodeData(e,t){this.key=e,this.attributes=t,this.clear()}function DirectedNodeData(e,t){this.key=e,this.attributes=t,this.clear()}function UndirectedNodeData(e,t){this.key=e,this.attributes=t,this.clear()}function EdgeData(e,t,n,o,a){this.key=t,this.attributes=a,this.undirected=e,this.source=n,this.target=o}MixedNodeData.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},DirectedNodeData.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},UndirectedNodeData.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},EdgeData.prototype.attach=function(){let e="out",t="in";this.undirected&&(e=t="undirected");const n=this.source.key,o=this.target.key;this.source[e][o]=this,this.undirected&&n===o||(this.target[t][n]=this)},EdgeData.prototype.attachMulti=function(){let e="out",t="in";const n=this.source.key,o=this.target.key;this.undirected&&(e=t="undirected");const a=this.source[e],i=a[o];if(void 0===i)return a[o]=this,void(this.undirected&&n===o||(this.target[t][n]=this));i.previous=this,this.next=i,a[o]=this,this.target[t][n]=this},EdgeData.prototype.detach=function(){const e=this.source.key,t=this.target.key;let n="out",o="in";this.undirected&&(n=o="undirected"),delete this.source[n][t],delete this.target[o][e]},EdgeData.prototype.detachMulti=function(){const e=this.source.key,t=this.target.key;let n="out",o="in";this.undirected&&(n=o="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][t],delete this.target[o][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[o][e]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var sb=0,lb=1,cb=2,db=3;function findRelevantNodeData(e,t,n,o,a,i,s){let l,c,d,u;if(o=""+o,n===sb){if(l=e._nodes.get(o),!l)throw new ab(`Graph.${t}: could not find the "${o}" node in the graph.`);d=a,u=i}else if(n===db){if(a=""+a,c=e._edges.get(a),!c)throw new ab(`Graph.${t}: could not find the "${a}" edge in the graph.`);const n=c.source.key,p=c.target.key;if(o===n)l=c.target;else{if(o!==p)throw new ab(`Graph.${t}: the "${o}" node is not attached to the "${a}" edge (${n}, ${p}).`);l=c.source}d=i,u=s}else{if(c=e._edges.get(o),!c)throw new ab(`Graph.${t}: could not find the "${o}" edge in the graph.`);l=n===lb?c.source:c.target,d=a,u=i}return[l,d,u]}function attachNodeAttributeGetter(e,t,n){e.prototype[t]=function(e,o,a){const[i,s]=findRelevantNodeData(this,t,n,e,o,a);return i.attributes[s]}}function attachNodeAttributesGetter(e,t,n){e.prototype[t]=function(e,o){const[a]=findRelevantNodeData(this,t,n,e,o);return a.attributes}}function attachNodeAttributeChecker(e,t,n){e.prototype[t]=function(e,o,a){const[i,s]=findRelevantNodeData(this,t,n,e,o,a);return i.attributes.hasOwnProperty(s)}}function attachNodeAttributeSetter(e,t,n){e.prototype[t]=function(e,o,a,i){const[s,l,c]=findRelevantNodeData(this,t,n,e,o,a,i);return s.attributes[l]=c,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:l}),this}}function attachNodeAttributeUpdater(e,t,n){e.prototype[t]=function(e,o,a,i){const[s,l,c]=findRelevantNodeData(this,t,n,e,o,a,i);if("function"!=typeof c)throw new ob(`Graph.${t}: updater should be a function.`);const d=s.attributes;return d[l]=c(d[l]),this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:l}),this}}function attachNodeAttributeRemover(e,t,n){e.prototype[t]=function(e,o,a){const[i,s]=findRelevantNodeData(this,t,n,e,o,a);return delete i.attributes[s],this.emit("nodeAttributesUpdated",{key:i.key,type:"remove",attributes:i.attributes,name:s}),this}}function attachNodeAttributesReplacer(e,t,n){e.prototype[t]=function(e,o,a){const[i,s]=findRelevantNodeData(this,t,n,e,o,a);if(!isPlainObject(s))throw new ob(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=s,this.emit("nodeAttributesUpdated",{key:i.key,type:"replace",attributes:i.attributes}),this}}function attachNodeAttributesMerger(e,t,n){e.prototype[t]=function(e,o,a){const[i,s]=findRelevantNodeData(this,t,n,e,o,a);if(!isPlainObject(s))throw new ob(`Graph.${t}: provided attributes are not a plain object.`);return rb(i.attributes,s),this.emit("nodeAttributesUpdated",{key:i.key,type:"merge",attributes:i.attributes,data:s}),this}}function attachNodeAttributesUpdater(e,t,n){e.prototype[t]=function(e,o,a){const[i,s]=findRelevantNodeData(this,t,n,e,o,a);if("function"!=typeof s)throw new ob(`Graph.${t}: provided updater is not a function.`);return i.attributes=s(i.attributes),this.emit("nodeAttributesUpdated",{key:i.key,type:"update",attributes:i.attributes}),this}}var ub=[{name:e=>`get${e}Attribute`,attacher:attachNodeAttributeGetter},{name:e=>`get${e}Attributes`,attacher:attachNodeAttributesGetter},{name:e=>`has${e}Attribute`,attacher:attachNodeAttributeChecker},{name:e=>`set${e}Attribute`,attacher:attachNodeAttributeSetter},{name:e=>`update${e}Attribute`,attacher:attachNodeAttributeUpdater},{name:e=>`remove${e}Attribute`,attacher:attachNodeAttributeRemover},{name:e=>`replace${e}Attributes`,attacher:attachNodeAttributesReplacer},{name:e=>`merge${e}Attributes`,attacher:attachNodeAttributesMerger},{name:e=>`update${e}Attributes`,attacher:attachNodeAttributesUpdater}];function attachNodeAttributesMethods(e){ub.forEach(function({name:t,attacher:n}){n(e,t("Node"),sb),n(e,t("Source"),lb),n(e,t("Target"),cb),n(e,t("Opposite"),db)})}function attachEdgeAttributeGetter(e,t,n){e.prototype[t]=function(e,o){let a;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ib(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ib(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const i=""+e,s=""+o;if(o=arguments[2],a=getMatchingEdge(this,i,s,n),!a)throw new ab(`Graph.${t}: could not find an edge for the given path ("${i}" - "${s}").`)}else{if("mixed"!==n)throw new ib(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new ab(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[o]}}function attachEdgeAttributesGetter(e,t,n){e.prototype[t]=function(e){let o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ib(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new ib(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,i=""+arguments[1];if(o=getMatchingEdge(this,a,i,n),!o)throw new ab(`Graph.${t}: could not find an edge for the given path ("${a}" - "${i}").`)}else{if("mixed"!==n)throw new ib(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new ab(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return o.attributes}}function attachEdgeAttributeChecker(e,t,n){e.prototype[t]=function(e,o){let a;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ib(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ib(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const i=""+e,s=""+o;if(o=arguments[2],a=getMatchingEdge(this,i,s,n),!a)throw new ab(`Graph.${t}: could not find an edge for the given path ("${i}" - "${s}").`)}else{if("mixed"!==n)throw new ib(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new ab(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(o)}}function attachEdgeAttributeSetter(e,t,n){e.prototype[t]=function(e,o,a){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ib(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new ib(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,l=""+o;if(o=arguments[2],a=arguments[3],i=getMatchingEdge(this,s,l,n),!i)throw new ab(`Graph.${t}: could not find an edge for the given path ("${s}" - "${l}").`)}else{if("mixed"!==n)throw new ib(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,i=this._edges.get(e),!i)throw new ab(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes[o]=a,this.emit("edgeAttributesUpdated",{key:i.key,type:"set",attributes:i.attributes,name:o}),this}}function attachEdgeAttributeUpdater(e,t,n){e.prototype[t]=function(e,o,a){let i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ib(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new ib(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,l=""+o;if(o=arguments[2],a=arguments[3],i=getMatchingEdge(this,s,l,n),!i)throw new ab(`Graph.${t}: could not find an edge for the given path ("${s}" - "${l}").`)}else{if("mixed"!==n)throw new ib(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,i=this._edges.get(e),!i)throw new ab(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if("function"!=typeof a)throw new ob(`Graph.${t}: updater should be a function.`);return i.attributes[o]=a(i.attributes[o]),this.emit("edgeAttributesUpdated",{key:i.key,type:"set",attributes:i.attributes,name:o}),this}}function attachEdgeAttributeRemover(e,t,n){e.prototype[t]=function(e,o){let a;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ib(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ib(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const i=""+e,s=""+o;if(o=arguments[2],a=getMatchingEdge(this,i,s,n),!a)throw new ab(`Graph.${t}: could not find an edge for the given path ("${i}" - "${s}").`)}else{if("mixed"!==n)throw new ib(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new ab(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[o],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:o}),this}}function attachEdgeAttributesReplacer(e,t,n){e.prototype[t]=function(e,o){let a;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ib(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ib(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const i=""+e,s=""+o;if(o=arguments[2],a=getMatchingEdge(this,i,s,n),!a)throw new ab(`Graph.${t}: could not find an edge for the given path ("${i}" - "${s}").`)}else{if("mixed"!==n)throw new ib(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new ab(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!isPlainObject(o))throw new ob(`Graph.${t}: provided attributes are not a plain object.`);return a.attributes=o,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function attachEdgeAttributesMerger(e,t,n){e.prototype[t]=function(e,o){let a;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ib(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ib(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const i=""+e,s=""+o;if(o=arguments[2],a=getMatchingEdge(this,i,s,n),!a)throw new ab(`Graph.${t}: could not find an edge for the given path ("${i}" - "${s}").`)}else{if("mixed"!==n)throw new ib(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new ab(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!isPlainObject(o))throw new ob(`Graph.${t}: provided attributes are not a plain object.`);return rb(a.attributes,o),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:o}),this}}function attachEdgeAttributesUpdater(e,t,n){e.prototype[t]=function(e,o){let a;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new ib(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ib(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const i=""+e,s=""+o;if(o=arguments[2],a=getMatchingEdge(this,i,s,n),!a)throw new ab(`Graph.${t}: could not find an edge for the given path ("${i}" - "${s}").`)}else{if("mixed"!==n)throw new ib(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new ab(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if("function"!=typeof o)throw new ob(`Graph.${t}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}var pb=[{name:e=>`get${e}Attribute`,attacher:attachEdgeAttributeGetter},{name:e=>`get${e}Attributes`,attacher:attachEdgeAttributesGetter},{name:e=>`has${e}Attribute`,attacher:attachEdgeAttributeChecker},{name:e=>`set${e}Attribute`,attacher:attachEdgeAttributeSetter},{name:e=>`update${e}Attribute`,attacher:attachEdgeAttributeUpdater},{name:e=>`remove${e}Attribute`,attacher:attachEdgeAttributeRemover},{name:e=>`replace${e}Attributes`,attacher:attachEdgeAttributesReplacer},{name:e=>`merge${e}Attributes`,attacher:attachEdgeAttributesMerger},{name:e=>`update${e}Attributes`,attacher:attachEdgeAttributesUpdater}];function attachEdgeAttributesMethods(e){pb.forEach(function({name:t,attacher:n}){n(e,t("Edge"),"mixed"),n(e,t("DirectedEdge"),"directed"),n(e,t("UndirectedEdge"),"undirected")})}var mb=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function forEachSimple(e,t,n,o){let a=!1;for(const i in t){if(i===o)continue;const s=t[i];if(a=n(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),e&&a)return s.key}}function forEachMulti(e,t,n,o){let a,i,s,l=!1;for(const c in t)if(c!==o){a=t[c];do{if(i=a.source,s=a.target,l=n(a.key,a.attributes,i.key,s.key,i.attributes,s.attributes,a.undirected),e&&l)return a.key;a=a.next}while(void 0!==a)}}function createIterator(e,t){const n=Object.keys(e),o=n.length;let a,i=0;return{[Symbol.iterator](){return this},next(){do{if(a)a=a.next;else{if(i>=o)return{done:!0};const s=n[i++];if(s===t){a=void 0;continue}a=e[s]}}while(!a);return{done:!1,value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected}}}}}function forEachForKeySimple(e,t,n,o){const a=t[n];if(!a)return;const i=a.source,s=a.target;return o(a.key,a.attributes,i.key,s.key,i.attributes,s.attributes,a.undirected)&&e?a.key:void 0}function forEachForKeyMulti(e,t,n,o){let a=t[n];if(!a)return;let i=!1;do{if(i=o(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),e&&i)return a.key;a=a.next}while(void 0!==a)}function createIteratorForKey(e,t){let n=e[t];if(void 0!==n.next)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};const e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let o=!1;return{[Symbol.iterator](){return this},next:()=>!0===o?{done:!0}:(o=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}function createEdgeArray(e,t){if(0===e.size)return[];if("mixed"===t||t===e.type)return Array.from(e._edges.keys());const n="undirected"===t?e.undirectedSize:e.directedSize,o=new Array(n),a="undirected"===t,i=e._edges.values();let s,l,c=0;for(;s=i.next(),!0!==s.done;)l=s.value,l.undirected===a&&(o[c++]=l.key);return o}function forEachEdge(e,t,n,o){if(0===t.size)return;const a="mixed"!==n&&n!==t.type,i="undirected"===n;let s,l,c=!1;const d=t._edges.values();for(;s=d.next(),!0!==s.done;){if(l=s.value,a&&l.undirected!==i)continue;const{key:t,attributes:n,source:d,target:u}=l;if(c=o(t,n,d.key,u.key,d.attributes,u.attributes,l.undirected),e&&c)return t}}function createEdgeIterator(e,t){if(0===e.size)return emptyIterator();const n="mixed"!==t&&t!==e.type,o="undirected"===t,a=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=a.next(),e.done)return e;if(t=e.value,!n||t.undirected===o)break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}}}function forEachEdgeForNode(e,t,n,o,a,i){const s=t?forEachMulti:forEachSimple;let l;if("undirected"!==n){if("out"!==o&&(l=s(e,a.in,i),e&&l))return l;if("in"!==o&&(l=s(e,a.out,i,o?void 0:a.key),e&&l))return l}if("directed"!==n&&(l=s(e,a.undirected,i),e&&l))return l}function createEdgeArrayForNode(e,t,n,o){const a=[];return forEachEdgeForNode(!1,e,t,n,o,function(e){a.push(e)}),a}function createEdgeIteratorForNode(e,t,n){let o=emptyIterator();return"undirected"!==e&&("out"!==t&&void 0!==n.in&&(o=chain(o,createIterator(n.in))),"in"!==t&&void 0!==n.out&&(o=chain(o,createIterator(n.out,t?void 0:n.key)))),"directed"!==e&&void 0!==n.undirected&&(o=chain(o,createIterator(n.undirected))),o}function forEachEdgeForPath(e,t,n,o,a,i,s){const l=n?forEachForKeyMulti:forEachForKeySimple;let c;if("undirected"!==t){if(void 0!==a.in&&"out"!==o&&(c=l(e,a.in,i,s),e&&c))return c;if(void 0!==a.out&&"in"!==o&&(o||a.key!==i)&&(c=l(e,a.out,i,s),e&&c))return c}if("directed"!==t&&void 0!==a.undirected&&(c=l(e,a.undirected,i,s),e&&c))return c}function createEdgeArrayForPath(e,t,n,o,a){const i=[];return forEachEdgeForPath(!1,e,t,n,o,a,function(e){i.push(e)}),i}function createEdgeIteratorForPath(e,t,n,o){let a=emptyIterator();return"undirected"!==e&&(void 0!==n.in&&"out"!==t&&o in n.in&&(a=chain(a,createIteratorForKey(n.in,o))),void 0!==n.out&&"in"!==t&&o in n.out&&(t||n.key!==o)&&(a=chain(a,createIteratorForKey(n.out,o)))),"directed"!==e&&void 0!==n.undirected&&o in n.undirected&&(a=chain(a,createIteratorForKey(n.undirected,o))),a}function attachEdgeArrayCreator(e,t){const{name:n,type:o,direction:a}=t;e.prototype[n]=function(e,t){if("mixed"!==o&&"mixed"!==this.type&&o!==this.type)return[];if(!arguments.length)return createEdgeArray(this,o);if(1===arguments.length){e=""+e;const t=this._nodes.get(e);if(void 0===t)throw new ab(`Graph.${n}: could not find the "${e}" node in the graph.`);return createEdgeArrayForNode(this.multi,"mixed"===o?this.type:o,a,t)}if(2===arguments.length){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new ab(`Graph.${n}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new ab(`Graph.${n}: could not find the "${t}" target node in the graph.`);return createEdgeArrayForPath(o,this.multi,a,i,t)}throw new ob(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function attachForEachEdge(e,t){const{name:n,type:o,direction:a}=t,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(e,t,n){if("mixed"===o||"mixed"===this.type||o===this.type){if(1===arguments.length)return forEachEdge(!1,this,o,n=e);if(2===arguments.length){e=""+e,n=t;const s=this._nodes.get(e);if(void 0===s)throw new ab(`Graph.${i}: could not find the "${e}" node in the graph.`);return forEachEdgeForNode(!1,this.multi,"mixed"===o?this.type:o,a,s,n)}if(3===arguments.length){e=""+e,t=""+t;const s=this._nodes.get(e);if(!s)throw new ab(`Graph.${i}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new ab(`Graph.${i}: could not find the "${t}" target node in the graph.`);return forEachEdgeForPath(!1,o,this.multi,a,s,t,n)}throw new ob(`Graph.${i}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const s="map"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){const e=Array.prototype.slice.call(arguments),t=e.pop();let n;if(0===e.length){let a=0;"directed"!==o&&(a+=this.undirectedSize),"undirected"!==o&&(a+=this.directedSize),n=new Array(a);let i=0;e.push((e,o,a,s,l,c,d)=>{n[i++]=t(e,o,a,s,l,c,d)})}else n=[],e.push((e,o,a,i,s,l,c)=>{n.push(t(e,o,a,i,s,l,c))});return this[i].apply(this,e),n};const l="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[l]=function(){const e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,o,a,i,s,l,c)=>{t(e,o,a,i,s,l,c)&&n.push(e)}),this[i].apply(this,e),n};const c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let e,t,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new ob(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${n.length}).`);if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new ob(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);2===n.length?(e=n[0],t=n[1],n=[]):3===n.length?(e=n[1],t=n[2],n=[n[0]]):4===n.length&&(e=n[2],t=n[3],n=[n[0],n[1]]);let o=t;return n.push((t,n,a,i,s,l,c)=>{o=e(o,t,n,a,i,s,l,c)}),this[i].apply(this,n),o}}function attachFindEdge(e,t){const{name:n,type:o,direction:a}=t,i="find"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(e,t,n){if("mixed"!==o&&"mixed"!==this.type&&o!==this.type)return!1;if(1===arguments.length)return forEachEdge(!0,this,o,n=e);if(2===arguments.length){e=""+e,n=t;const s=this._nodes.get(e);if(void 0===s)throw new ab(`Graph.${i}: could not find the "${e}" node in the graph.`);return forEachEdgeForNode(!0,this.multi,"mixed"===o?this.type:o,a,s,n)}if(3===arguments.length){e=""+e,t=""+t;const s=this._nodes.get(e);if(!s)throw new ab(`Graph.${i}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new ab(`Graph.${i}: could not find the "${t}" target node in the graph.`);return forEachEdgeForPath(!0,o,this.multi,a,s,t,n)}throw new ob(`Graph.${i}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const s="some"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){const e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,o,a,i,s,l)=>t(e,n,o,a,i,s,l)),!!this[i].apply(this,e)};const l="every"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[l]=function(){const e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,o,a,i,s,l)=>!t(e,n,o,a,i,s,l)),!this[i].apply(this,e)}}function attachEdgeIteratorCreator(e,t){const{name:n,type:o,direction:a}=t,i=n.slice(0,-1)+"Entries";e.prototype[i]=function(e,t){if("mixed"!==o&&"mixed"!==this.type&&o!==this.type)return emptyIterator();if(!arguments.length)return createEdgeIterator(this,o);if(1===arguments.length){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.${i}: could not find the "${e}" node in the graph.`);return createEdgeIteratorForNode(o,a,t)}if(2===arguments.length){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new ab(`Graph.${i}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new ab(`Graph.${i}: could not find the "${t}" target node in the graph.`);return createEdgeIteratorForPath(o,a,n,t)}throw new ob(`Graph.${i}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function attachEdgeIterationMethods(e){mb.forEach(t=>{attachEdgeArrayCreator(e,t),attachForEachEdge(e,t),attachFindEdge(e,t),attachEdgeIteratorCreator(e,t)})}var hb=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function CompositeSetWrapper(){this.A=null,this.B=null}function forEachInObjectOnce(e,t,n,o,a){for(const i in o){const s=o[i],l=s.source,c=s.target,d=l===n?c:l;if(t&&t.has(d.key))continue;const u=a(d.key,d.attributes);if(e&&u)return d.key}}function forEachNeighbor(e,t,n,o,a){if("mixed"!==t){if("undirected"===t)return forEachInObjectOnce(e,null,o,o.undirected,a);if("string"==typeof n)return forEachInObjectOnce(e,null,o,o[n],a)}const i=new CompositeSetWrapper;let s;if("undirected"!==t){if("out"!==n){if(s=forEachInObjectOnce(e,null,o,o.in,a),e&&s)return s;i.wrap(o.in)}if("in"!==n){if(s=forEachInObjectOnce(e,i,o,o.out,a),e&&s)return s;i.wrap(o.out)}}if("directed"!==t&&(s=forEachInObjectOnce(e,i,o,o.undirected,a),e&&s))return s}function createNeighborArrayForNode(e,t,n){if("mixed"!==e){if("undirected"===e)return Object.keys(n.undirected);if("string"==typeof t)return Object.keys(n[t])}const o=[];return forEachNeighbor(!1,e,t,n,function(e){o.push(e)}),o}function createDedupedObjectIterator(e,t,n){const o=Object.keys(n),a=o.length;let i=0;return{[Symbol.iterator](){return this},next(){let s=null;do{if(i>=a)return e&&e.wrap(n),{done:!0};const l=n[o[i++]],c=l.source,d=l.target;s=c===t?d:c,e&&e.has(s.key)&&(s=null)}while(null===s);return{done:!1,value:{neighbor:s.key,attributes:s.attributes}}}}}function createNeighborIterator(e,t,n){if("mixed"!==e){if("undirected"===e)return createDedupedObjectIterator(null,n,n.undirected);if("string"==typeof t)return createDedupedObjectIterator(null,n,n[t])}let o=emptyIterator();const a=new CompositeSetWrapper;return"undirected"!==e&&("out"!==t&&(o=chain(o,createDedupedObjectIterator(a,n,n.in))),"in"!==t&&(o=chain(o,createDedupedObjectIterator(a,n,n.out)))),"directed"!==e&&(o=chain(o,createDedupedObjectIterator(a,n,n.undirected))),o}function attachNeighborArrayCreator(e,t){const{name:n,type:o,direction:a}=t;e.prototype[n]=function(e){if("mixed"!==o&&"mixed"!==this.type&&o!==this.type)return[];e=""+e;const t=this._nodes.get(e);if(void 0===t)throw new ab(`Graph.${n}: could not find the "${e}" node in the graph.`);return createNeighborArrayForNode("mixed"===o?this.type:o,a,t)}}function attachForEachNeighbor(e,t){const{name:n,type:o,direction:a}=t,i="forEach"+n[0].toUpperCase()+n.slice(1,-1);e.prototype[i]=function(e,t){if("mixed"!==o&&"mixed"!==this.type&&o!==this.type)return;e=""+e;const n=this._nodes.get(e);if(void 0===n)throw new ab(`Graph.${i}: could not find the "${e}" node in the graph.`);forEachNeighbor(!1,"mixed"===o?this.type:o,a,n,t)};const s="map"+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){const n=[];return this[i](e,(e,o)=>{n.push(t(e,o))}),n};const l="filter"+n[0].toUpperCase()+n.slice(1);e.prototype[l]=function(e,t){const n=[];return this[i](e,(e,o)=>{t(e,o)&&n.push(e)}),n};const c="reduce"+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new ob(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let o=n;return this[i](e,(e,n)=>{o=t(o,e,n)}),o}}function attachFindNeighbor(e,t){const{name:n,type:o,direction:a}=t,i=n[0].toUpperCase()+n.slice(1,-1),s="find"+i;e.prototype[s]=function(e,t){if("mixed"!==o&&"mixed"!==this.type&&o!==this.type)return;e=""+e;const n=this._nodes.get(e);if(void 0===n)throw new ab(`Graph.${s}: could not find the "${e}" node in the graph.`);return forEachNeighbor(!0,"mixed"===o?this.type:o,a,n,t)};const l="some"+i;e.prototype[l]=function(e,t){return!!this[s](e,t)};const c="every"+i;e.prototype[c]=function(e,t){return!this[s](e,(e,n)=>!t(e,n))}}function attachNeighborIteratorCreator(e,t){const{name:n,type:o,direction:a}=t,i=n.slice(0,-1)+"Entries";e.prototype[i]=function(e){if("mixed"!==o&&"mixed"!==this.type&&o!==this.type)return emptyIterator();e=""+e;const t=this._nodes.get(e);if(void 0===t)throw new ab(`Graph.${i}: could not find the "${e}" node in the graph.`);return createNeighborIterator("mixed"===o?this.type:o,a,t)}}function attachNeighborIterationMethods(e){hb.forEach(t=>{attachNeighborArrayCreator(e,t),attachForEachNeighbor(e,t),attachFindNeighbor(e,t),attachNeighborIteratorCreator(e,t)})}function forEachAdjacency(e,t,n,o,a){const i=o._nodes.values(),s=o.type;let l,c,d,u,p,m,h;for(;l=i.next(),!0!==l.done;){let o=!1;if(c=l.value,"undirected"!==s)for(d in u=c.out,u){p=u[d];do{if(m=p.target,o=!0,h=a(c.key,m.key,c.attributes,m.attributes,p.key,p.attributes,p.undirected),e&&h)return p;p=p.next}while(p)}if("directed"!==s)for(d in u=c.undirected,u)if(!(t&&c.key>d)){p=u[d];do{if(m=p.target,m.key!==d&&(m=p.source),o=!0,h=a(c.key,m.key,c.attributes,m.attributes,p.key,p.attributes,p.undirected),e&&h)return p;p=p.next}while(p)}if(n&&!o&&(h=a(c.key,null,c.attributes,null,null,null,null),e&&h))return null}}function serializeNode(e,t){const n={key:e};return isEmpty(t.attributes)||(n.attributes=rb({},t.attributes)),n}function serializeEdge(e,t,n){const o={key:t,source:n.source.key,target:n.target.key};return isEmpty(n.attributes)||(o.attributes=rb({},n.attributes)),"mixed"===e&&n.undirected&&(o.undirected=!0),o}function validateSerializedNode(e){if(!isPlainObject(e))throw new ob('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in e))throw new ob("Graph.import: serialized node is missing its key.");if("attributes"in e&&(!isPlainObject(e.attributes)||null===e.attributes))throw new ob("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function validateSerializedEdge(e){if(!isPlainObject(e))throw new ob('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in e))throw new ob("Graph.import: serialized edge is missing its source.");if(!("target"in e))throw new ob("Graph.import: serialized edge is missing its target.");if("attributes"in e&&(!isPlainObject(e.attributes)||null===e.attributes))throw new ob("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in e&&"boolean"!=typeof e.undirected)throw new ob("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}CompositeSetWrapper.prototype.wrap=function(e){null===this.A?this.A=e:null===this.B&&(this.B=e)},CompositeSetWrapper.prototype.has=function(e){return null!==this.A&&e in this.A||null!==this.B&&e in this.B};var gb=incrementalIdStartingFromRandomByte(),fb=new Set(["directed","undirected","mixed"]),yb=new Set(["domain","_events","_eventsCount","_maxListeners"]),bb=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:"directed"},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:"directed"},{name:e=>`${e}UndirectedEdgeWithKey`,type:"undirected"}],vb={allowSelfLoops:!0,multi:!1,type:"mixed"};function addNode(e,t,n){if(n&&!isPlainObject(n))throw new ob(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=""+t,n=n||{},e._nodes.has(t))throw new ib(`Graph.addNode: the "${t}" node already exist in the graph.`);const o=new e.NodeDataClass(t,n);return e._nodes.set(t,o),e.emit("nodeAdded",{key:t,attributes:n}),o}function unsafeAddNode(e,t,n){const o=new e.NodeDataClass(t,n);return e._nodes.set(t,o),e.emit("nodeAdded",{key:t,attributes:n}),o}function addEdge(e,t,n,o,a,i,s,l){if(!o&&"undirected"===e.type)throw new ib(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(o&&"directed"===e.type)throw new ib(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(l&&!isPlainObject(l))throw new ob(`Graph.${t}: invalid attributes. Expecting an object but got "${l}"`);if(i=""+i,s=""+s,l=l||{},!e.allowSelfLoops&&i===s)throw new ib(`Graph.${t}: source & target are the same ("${i}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const c=e._nodes.get(i),d=e._nodes.get(s);if(!c)throw new ab(`Graph.${t}: source node "${i}" not found.`);if(!d)throw new ab(`Graph.${t}: target node "${s}" not found.`);const u={key:null,undirected:o,source:i,target:s,attributes:l};if(n)a=e._edgeKeyGenerator();else if(a=""+a,e._edges.has(a))throw new ib(`Graph.${t}: the "${a}" edge already exists in the graph.`);if(!e.multi&&(o?void 0!==c.undirected[s]:void 0!==c.out[s]))throw new ib(`Graph.${t}: an edge linking "${i}" to "${s}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const p=new EdgeData(o,a,c,d,l);e._edges.set(a,p);const m=i===s;return o?(c.undirectedDegree++,d.undirectedDegree++,m&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,d.inDegree++,m&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?p.attachMulti():p.attach(),o?e._undirectedSize++:e._directedSize++,u.key=a,e.emit("edgeAdded",u),a}function mergeEdge(e,t,n,o,a,i,s,l,c){if(!o&&"undirected"===e.type)throw new ib(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(o&&"directed"===e.type)throw new ib(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(l)if(c){if("function"!=typeof l)throw new ob(`Graph.${t}: invalid updater function. Expecting a function but got "${l}"`)}else if(!isPlainObject(l))throw new ob(`Graph.${t}: invalid attributes. Expecting an object but got "${l}"`);let d;if(i=""+i,s=""+s,c&&(d=l,l=void 0),!e.allowSelfLoops&&i===s)throw new ib(`Graph.${t}: source & target are the same ("${i}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u,p,m=e._nodes.get(i),h=e._nodes.get(s);if(!n&&(u=e._edges.get(a),u)){if(!(u.source.key===i&&u.target.key===s||o&&u.source.key===s&&u.target.key===i))throw new ib(`Graph.${t}: inconsistency detected when attempting to merge the "${a}" edge with "${i}" source & "${s}" target vs. ("${u.source.key}", "${u.target.key}").`);p=u}if(p||e.multi||!m||(p=o?m.undirected[s]:m.out[s]),p){const t=[p.key,!1,!1,!1];if(c?!d:!l)return t;if(c){const t=p.attributes;p.attributes=d(t),e.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else rb(p.attributes,l),e.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:l});return t}l=l||{},c&&d&&(l=d(l));const g={key:null,undirected:o,source:i,target:s,attributes:l};if(n)a=e._edgeKeyGenerator();else if(a=""+a,e._edges.has(a))throw new ib(`Graph.${t}: the "${a}" edge already exists in the graph.`);let y=!1,b=!1;m||(m=unsafeAddNode(e,i,{}),y=!0,i===s&&(h=m,b=!0)),h||(h=unsafeAddNode(e,s,{}),b=!0),u=new EdgeData(o,a,m,h,l),e._edges.set(a,u);const v=i===s;return o?(m.undirectedDegree++,h.undirectedDegree++,v&&(m.undirectedLoops++,e._undirectedSelfLoopCount++)):(m.outDegree++,h.inDegree++,v&&(m.directedLoops++,e._directedSelfLoopCount++)),e.multi?u.attachMulti():u.attach(),o?e._undirectedSize++:e._directedSize++,g.key=a,e.emit("edgeAdded",g),[a,!0,y,b]}function dropEdgeFromData(e,t){e._edges.delete(t.key);const{source:n,target:o,attributes:a}=t,i=t.undirected,s=n===o;i?(n.undirectedDegree--,o.undirectedDegree--,s&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,o.inDegree--,s&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),i?e._undirectedSize--:e._directedSize--,e.emit("edgeDropped",{key:t.key,attributes:a,source:n.key,target:o.key,undirected:i})}var wb=class e extends tb.EventEmitter{constructor(e){if(super(),"boolean"!=typeof(e=rb({},vb,e)).multi)throw new ob(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!fb.has(e.type))throw new ob(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if("boolean"!=typeof e.allowSelfLoops)throw new ob(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);privateProperty(this,"NodeDataClass","mixed"===e.type?MixedNodeData:"directed"===e.type?DirectedNodeData:UndirectedNodeData);const t="geid_"+gb()+"_";let n=0;const edgeKeyGenerator=()=>{let e;do{e=t+n++}while(this._edges.has(e));return e};privateProperty(this,"_attributes",{}),privateProperty(this,"_nodes",new Map),privateProperty(this,"_edges",new Map),privateProperty(this,"_directedSize",0),privateProperty(this,"_undirectedSize",0),privateProperty(this,"_directedSelfLoopCount",0),privateProperty(this,"_undirectedSelfLoopCount",0),privateProperty(this,"_edgeKeyGenerator",edgeKeyGenerator),privateProperty(this,"_options",e),yb.forEach(e=>privateProperty(this,e,this[e])),readOnlyProperty(this,"order",()=>this._nodes.size),readOnlyProperty(this,"size",()=>this._edges.size),readOnlyProperty(this,"directedSize",()=>this._directedSize),readOnlyProperty(this,"undirectedSize",()=>this._undirectedSize),readOnlyProperty(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),readOnlyProperty(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),readOnlyProperty(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),readOnlyProperty(this,"multi",this._options.multi),readOnlyProperty(this,"type",this._options.type),readOnlyProperty(this,"allowSelfLoops",this._options.allowSelfLoops),readOnlyProperty(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if("undirected"===this.type)return!1;if(1===arguments.length){const t=""+e,n=this._edges.get(t);return!!n&&!n.undirected}if(2===arguments.length){e=""+e,t=""+t;const n=this._nodes.get(e);return!!n&&n.out.hasOwnProperty(t)}throw new ob(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if("directed"===this.type)return!1;if(1===arguments.length){const t=""+e,n=this._edges.get(t);return!!n&&n.undirected}if(2===arguments.length){e=""+e,t=""+t;const n=this._nodes.get(e);return!!n&&n.undirected.hasOwnProperty(t)}throw new ob(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(1===arguments.length){const t=""+e;return this._edges.has(t)}if(2===arguments.length){e=""+e,t=""+t;const n=this._nodes.get(e);return!!n&&(void 0!==n.out&&n.out.hasOwnProperty(t)||void 0!==n.undirected&&n.undirected.hasOwnProperty(t))}throw new ob(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if("undirected"===this.type)return;if(e=""+e,t=""+t,this.multi)throw new ib("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const n=this._nodes.get(e);if(!n)throw new ab(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new ab(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const o=n.out&&n.out[t]||void 0;return o?o.key:void 0}undirectedEdge(e,t){if("directed"===this.type)return;if(e=""+e,t=""+t,this.multi)throw new ib("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const n=this._nodes.get(e);if(!n)throw new ab(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new ab(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const o=n.undirected&&n.undirected[t]||void 0;return o?o.key:void 0}edge(e,t){if(this.multi)throw new ib("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new ab(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new ab(`Graph.edge: could not find the "${t}" target node in the graph.`);const o=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(o)return o.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new ab(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&(t in n.in||t in n.out)}areOutNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new ab(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&t in n.out}areInNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new ab(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&t in n.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new ab(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return"directed"!==this.type&&t in n.undirected}areNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new ab(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&(t in n.in||t in n.out)||"directed"!==this.type&&t in n.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new ab(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&t in n.in||"directed"!==this.type&&t in n.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new ab(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return"undirected"!==this.type&&t in n.out||"directed"!==this.type&&t in n.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.inDegree: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.outDegree: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return"directed"===this.type?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree),n}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.outDegree),n}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return"directed"!==this.type&&(n+=t.undirectedDegree),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return"undirected"===this.type?0:t.inDegree+t.outDegree-2*t.directedLoops}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return"directed"===this.type?0:t.undirectedDegree-2*t.undirectedLoops}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,o=0;return"directed"!==this.type&&(n+=t.undirectedDegree,o+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree,o+=t.directedLoops),n-o}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,o=0;return"directed"!==this.type&&(n+=t.undirectedDegree,o+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.outDegree,o+=t.directedLoops),n-o}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,o=0;return"directed"!==this.type&&(n+=t.undirectedDegree,o+=2*t.undirectedLoops),"undirected"!==this.type&&(n+=t.inDegree+t.outDegree,o+=2*t.directedLoops),n-o}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new ab(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new ab(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new ab(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const n=this._edges.get(t);if(!n)throw new ab(`Graph.opposite: could not find the "${t}" edge in the graph.`);const o=n.source.key,a=n.target.key;if(e===o)return a;if(e===a)return o;throw new ab(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${o}, ${a}).`)}hasExtremity(e,t){e=""+e,t=""+t;const n=this._edges.get(e);if(!n)throw new ab(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new ab(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new ab(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new ab(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return addNode(this,e,t).key}mergeNode(e,t){if(t&&!isPlainObject(t))throw new ob(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let n=this._nodes.get(e);return n?(t&&(rb(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&"function"!=typeof t)throw new ob(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let n=this._nodes.get(e);if(n){if(t){const o=n.attributes;n.attributes=t(o),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}const o=t?t({}):{};return n=new this.NodeDataClass(e,o),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:o}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new ab(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if("undirected"!==this.type){for(const e in t.out){n=t.out[e];do{dropEdgeFromData(this,n),n=n.next}while(n)}for(const e in t.in){n=t.in[e];do{dropEdgeFromData(this,n),n=n.next}while(n)}}if("directed"!==this.type)for(const o in t.undirected){n=t.undirected[o];do{dropEdgeFromData(this,n),n=n.next}while(n)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const e=""+arguments[0],n=""+arguments[1];if(t=getMatchingEdge(this,e,n,this.type),!t)throw new ab(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new ab(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return dropEdgeFromData(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new ib("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new ib("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=getMatchingEdge(this,e=""+e,t=""+t,"directed");if(!n)throw new ab(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return dropEdgeFromData(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new ib("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new ib("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=getMatchingEdge(this,e,t,"undirected");if(!n)throw new ab(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return dropEdgeFromData(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),!0!==t.done;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if("function"!=typeof t)throw new ob("Graph.updateAttribute: updater should be a function.");const n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!isPlainObject(e))throw new ob("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!isPlainObject(e))throw new ob("Graph.mergeAttributes: provided attributes are not a plain object.");return rb(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if("function"!=typeof e)throw new ob("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if("function"!=typeof e)throw new ob("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!validateHints(t))throw new ob("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._nodes.values();let o,a;for(;o=n.next(),!0!==o.done;)a=o.value,a.attributes=e(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if("function"!=typeof e)throw new ob("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!validateHints(t))throw new ob("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._edges.values();let o,a,i,s;for(;o=n.next(),!0!==o.done;)a=o.value,i=a.source,s=a.target,a.attributes=e(a.key,a.attributes,i.key,s.key,i.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if("function"!=typeof e)throw new ob("Graph.forEachAdjacencyEntry: expecting a callback.");forEachAdjacency(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if("function"!=typeof e)throw new ob("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");forEachAdjacency(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if("function"!=typeof e)throw new ob("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");forEachAdjacency(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if("function"!=typeof e)throw new ob("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");forEachAdjacency(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if("function"!=typeof e)throw new ob("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let n,o;for(;n=t.next(),!0!==n.done;)o=n.value,e(o.key,o.attributes)}findNode(e){if("function"!=typeof e)throw new ob("Graph.findNode: expecting a callback.");const t=this._nodes.values();let n,o;for(;n=t.next(),!0!==n.done;)if(o=n.value,e(o.key,o.attributes))return o.key}mapNodes(e){if("function"!=typeof e)throw new ob("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let n,o;const a=new Array(this.order);let i=0;for(;n=t.next(),!0!==n.done;)o=n.value,a[i++]=e(o.key,o.attributes);return a}someNode(e){if("function"!=typeof e)throw new ob("Graph.someNode: expecting a callback.");const t=this._nodes.values();let n,o;for(;n=t.next(),!0!==n.done;)if(o=n.value,e(o.key,o.attributes))return!0;return!1}everyNode(e){if("function"!=typeof e)throw new ob("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let n,o;for(;n=t.next(),!0!==n.done;)if(o=n.value,!e(o.key,o.attributes))return!1;return!0}filterNodes(e){if("function"!=typeof e)throw new ob("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let n,o;const a=[];for(;n=t.next(),!0!==n.done;)o=n.value,e(o.key,o.attributes)&&a.push(o.key);return a}reduceNodes(e,t){if("function"!=typeof e)throw new ob("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new ob("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let n=t;const o=this._nodes.values();let a,i;for(;a=o.next(),!0!==a.done;)i=a.value,n=e(n,i.key,i.attributes);return n}nodeEntries(){const e=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=e.next();if(t.done)return t;const n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((n,o)=>{e[t++]=serializeNode(o,n)});const n=new Array(this._edges.size);return t=0,this._edges.forEach((e,o)=>{n[t++]=serializeEdge(this.type,o,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(t,n=!1){if(t instanceof e)return t.forEachNode((e,t)=>{n?this.mergeNode(e,t):this.addNode(e,t)}),t.forEachEdge((e,t,o,a,i,s,l)=>{n?l?this.mergeUndirectedEdgeWithKey(e,o,a,t):this.mergeDirectedEdgeWithKey(e,o,a,t):l?this.addUndirectedEdgeWithKey(e,o,a,t):this.addDirectedEdgeWithKey(e,o,a,t)}),this;if(!isPlainObject(t))throw new ob("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!isPlainObject(t.attributes))throw new ob("Graph.import: invalid attributes. Expecting a plain object.");n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let o,a,i,s,l;if(t.nodes){if(i=t.nodes,!Array.isArray(i))throw new ob("Graph.import: invalid nodes. Expecting an array.");for(o=0,a=i.length;o<a;o++){s=i[o],validateSerializedNode(s);const{key:e,attributes:t}=s;n?this.mergeNode(e,t):this.addNode(e,t)}}if(t.edges){let e=!1;if("undirected"===this.type&&(e=!0),i=t.edges,!Array.isArray(i))throw new ob("Graph.import: invalid edges. Expecting an array.");for(o=0,a=i.length;o<a;o++){l=i[o],validateSerializedEdge(l);const{source:t,target:a,attributes:s,undirected:c=e}=l;let d;"key"in l?(d=n?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,d.call(this,l.key,t,a,s)):(d=n?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,d.call(this,t,a,s))}}return this}nullCopy(t){const n=new e(rb({},this._options,t));return n.replaceAttributes(rb({},this.getAttributes())),n}emptyCopy(e){const t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{const o=rb({},e.attributes);e=new t.NodeDataClass(n,o),t._nodes.set(n,e)}),t}copy(e){if("string"==typeof(e=e||{}).type&&e.type!==this.type&&"mixed"!==e.type)throw new ib(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if("boolean"==typeof e.multi&&e.multi!==this.multi&&!0!==e.multi)throw new ib("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof e.allowSelfLoops&&e.allowSelfLoops!==this.allowSelfLoops&&!0!==e.allowSelfLoops)throw new ib("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(e),n=this._edges.values();let o,a;for(;o=n.next(),!0!==o.done;)a=o.value,addEdge(t,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,rb({},a.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});const t={},n={};this._edges.forEach((e,o)=>{const a=e.undirected?"--":"->";let i,s="",l=e.source.key,c=e.target.key;e.undirected&&l>c&&(i=l,l=c,c=i);const d=`(${l})${a}(${c})`;o.startsWith("geid_")?this.multi&&(void 0===n[d]?n[d]=0:n[d]++,s+=`${n[d]}. `):s+=`[${o}]: `,s+=d,t[s]=e.attributes});const o={};for(const a in this)this.hasOwnProperty(a)&&!yb.has(a)&&"function"!=typeof this[a]&&"symbol"!=typeof a&&(o[a]=this[a]);return o.attributes=this._attributes,o.nodes=e,o.edges=t,privateProperty(o,"constructor",this.constructor),o}};"undefined"!=typeof Symbol&&(wb.prototype[Symbol.for("nodejs.util.inspect.custom")]=wb.prototype.inspect),bb.forEach(e=>{["add","merge","update"].forEach(t=>{const n=e.name(t),o="add"===t?addEdge:mergeEdge;e.generateKey?wb.prototype[n]=function(a,i,s){return o(this,n,!0,"undirected"===(e.type||this.type),null,a,i,s,"update"===t)}:wb.prototype[n]=function(a,i,s,l){return o(this,n,!1,"undirected"===(e.type||this.type),a,i,s,l,"update"===t)}})}),attachNodeAttributesMethods(wb),attachEdgeAttributesMethods(wb),attachEdgeIterationMethods(wb),attachNeighborIterationMethods(wb);var Sb=class extends wb{constructor(e){const t=rb({type:"directed"},e);if("multi"in t&&!1!==t.multi)throw new ob("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==t.type)throw new ob('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}},xb=class extends wb{constructor(e){const t=rb({type:"undirected"},e);if("multi"in t&&!1!==t.multi)throw new ob("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==t.type)throw new ob('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}},Ib=class extends wb{constructor(e){const t=rb({multi:!0},e);if("multi"in t&&!0!==t.multi)throw new ob("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}},Cb=class extends wb{constructor(e){const t=rb({type:"directed",multi:!0},e);if("multi"in t&&!0!==t.multi)throw new ob("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==t.type)throw new ob('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}},Eb=class extends wb{constructor(e){const t=rb({type:"undirected",multi:!0},e);if("multi"in t&&!0!==t.multi)throw new ob("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==t.type)throw new ob('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}};function attachStaticFromMethod(e){e.from=function(t,n){const o=new e(rb({},t.options,n));return o.import(t),o}}attachStaticFromMethod(wb),attachStaticFromMethod(Sb),attachStaticFromMethod(xb),attachStaticFromMethod(Ib),attachStaticFromMethod(Cb),attachStaticFromMethod(Eb),wb.Graph=wb,wb.DirectedGraph=Sb,wb.UndirectedGraph=xb,wb.MultiGraph=Ib,wb.MultiDirectedGraph=Cb,wb.MultiUndirectedGraph=Eb,wb.InvalidArgumentsGraphError=ob,wb.NotFoundGraphError=ab,wb.UsageGraphError=ib;var Rb=class e{#n;#J;#B;#M;#x;#sr;#lr;#It;#cr;#dr;#ur;#pr;#mr;#hr;#gr;#fr;constructor(e){this.#fr=normalizeSnapshotRevision(e.graphRevision),this.#B=createRecordMap(e.nodes,"id");const t=normalizeStoredEdgeRecords(e.edges);if(this.#J=withGraphRevision({...e,edgeCount:t.length,edges:t},this.#fr),this.#M=createRecordMap(t,"id"),this.#x=createRecordMap(e.areas,"id"),this.#sr=objectToNumberKeyMap(e.indices.areaRoomIds),this.#lr=objectToNumberKeyMap(e.indices.areaEdgeIds),this.#It=objectToNestedNumberKeyMap(e.indices.areaZRoomIds),this.#cr=objectToNestedNumberKeyMap(e.indices.areaZEdgeIds),this.#dr=objectToNumberKeyMap(e.indices.symbolSvgByRoomId),this.#n=createGraphologyGraph(this.#J),this.#ur=new Map,this.#pr=new Map,this.#mr=new Map,this.#hr=new Map,this.#gr=new Map,Array.isArray(e.edgeFamilies))for(const n of e.edgeFamilies){const e=this.#yr(n);this.#ur.set(e.id,e)}if(Array.isArray(e.activeEdgeSets)){for(const t of e.activeEdgeSets){const e=this.#br(t.id,t.edges??[]);this.#pr.set(e.id,e)}this.#vr()}this.#J=Object.freeze({...this.#J,activeEdgeSetCount:this.#pr.size,activeEdgeSets:Object.freeze(this.activeEdgeSets()),edgeFamilies:Object.freeze(this.edgeFamilies()),edgeFamilyCount:this.#ur.size})}get nodeCount(){return this.#n.order}get edgeCount(){return this.#n.size}get areaCount(){return this.#J.areaCount}get revision(){return this.#fr}toSnapshot(){return this.#J}nodes(){return this.#J.nodes}edges(){return this.#J.edges}edgeFamilies(){return[...this.#ur.values()].map(e=>e.record)}activeEdgeSets(){return[...this.#pr.values()].map(e=>e.record)}areas(){return this.#J.areas}static inspectGraphology(t){return t instanceof e?t.#n:null}hasNode(e){return this.#B.has(e)}hasEdge(e){return this.#M.has(e)}getNode(e){return this.#B.get(e)??null}getEdge(e){return this.#M.get(e)??null}getEdgeFamily(e){return this.#ur.get(e)?.record??null}getActiveEdgeSet(e){return this.#pr.get(e)?.record??null}getArea(e){return this.#x.get(e)??null}outgoingEdges(e){return this.#n.outboundEdges(e).map(e=>this.#M.get(e))}incomingEdges(e){return this.#n.inboundEdges(e).map(e=>this.#M.get(e))}edgesBetween(e,t){return this.#n.edges(e,t).map(e=>this.#M.get(e))}areaRoomIds(e){return this.#sr.get(e)??kb}areaEdgeIds(e){return this.#lr.get(e)??kb}areaZRoomIds(e,t){return this.#It.get(e)?.get(t)??kb}areaZEdgeIds(e,t){return this.#cr.get(e)?.get(t)??kb}areaZLevels(e){return[...this.#It.get(e)?.keys()??[]].sort((e,t)=>e-t)}symbolSvg(e){return this.#dr.get(e)??null}upsertNodes(e){return this.#wr({upsertNodes:e})}upsertSyntheticNodes(e){return this.#wr({syntheticOnly:!0,upsertNodes:e})}removeNodes(e){return this.#wr({removeIds:e})}upsertEdges(e){return this.#Sr({upsertEdges:e})}removeEdges(e){return this.#Sr({removeIds:e})}replaceEdgesByPredicate(e,t){if("function"!=typeof e)throw new Error("replaceEdgesByPredicate requires a predicate function.");const n=this.edges().filter(t=>e(t)).map(e=>e.id);return this.#Sr({allowReplacingOutsideRemoval:!1,removeIds:n,upsertEdges:t})}replaceEdgesByTravelClass(e,t){return this.replaceEdgesByPredicate(t=>t.travelClass===e,t)}updateEdge(e,t){const n=this.getEdge(e);if(!n)throw new Error(`Cannot update missing graph edge '${e}'.`);const o="function"==typeof t?t(n):t;if(!isObjectRecord(o))throw new Error(`Graph edge '${e}' update must return an object patch.`);if(void 0!==o.id&&o.id!==e)throw new Error(`Graph edge '${e}' update cannot change the edge id.`);const a=void 0!==o.sourceId&&o.sourceId!==n.sourceId,i={...n,...o,id:e};return a&&!hasOwn(o,"areaId")&&delete i.areaId,a&&!hasOwn(o,"z")&&delete i.z,this.#Sr({upsertEdges:[i]})}replaceEdges(e,t){return this.#Sr({removeIds:e,upsertEdges:t})}blockEdge(e,t){if(assertEdgeId(e),!isObjectRecord(t))throw new Error(`Cannot block edge '${e}' without an observation record.`);const n=this.#M.get(e);if(!n)throw new Error(`Cannot block missing graph edge '${e}'.`);const o=this.#gr.get(e),a=o?o.original:Object.freeze({classes:Object.freeze([...n.classes]),weight:n.weight}),i=n.classes.includes("blocked")?Object.freeze([...n.classes]):Object.freeze([...n.classes,"blocked"]),s=Object.freeze({...t,observedAt:Number.isFinite(t.observedAt)&&t.observedAt>=0?t.observedAt:Date.now()}),l={...n,block:s,classes:i,weight:Number.POSITIVE_INFINITY};return this.#Sr({allowBlockedEdgeMutation:!0,upsertEdges:[l]}),this.#gr.set(e,{observation:s,original:a}),this}unblockEdge(e){assertEdgeId(e);const t=this.#gr.get(e);if(!t)return this;const n=this.#M.get(e);return n&&this.#Sr({allowBlockedEdgeMutation:!0,upsertEdges:[createUnblockedEdgeRecord(n,t.original)]}),this.#gr.delete(e),this}clearBlockedEdges(){if(0===this.#gr.size)return this;const e=[];for(const[t,n]of this.#gr.entries()){const o=this.#M.get(t);o&&e.push(createUnblockedEdgeRecord(o,n.original))}return this.#gr.clear(),e.length>0&&this.#Sr({allowBlockedEdgeMutation:!0,upsertEdges:e}),this}isEdgeBlocked(e){return this.#gr.has(e)}getBlockedEdge(e){const t=this.#gr.get(e);return t?Object.freeze({edge:this.#M.get(e)??null,observation:t.observation}):null}blockedEdges(){const e=[];for(const[t,n]of this.#gr.entries())e.push(Object.freeze({edge:this.#M.get(t)??null,observation:n.observation}));return Object.freeze(e)}upsertEdgeFamilies(e){if(!Array.isArray(e))throw new Error("Graph edge-family mutations require an array of family records.");if(0===e.length)return this;const t=e.map(e=>this.#yr(e));this.#xr(t);for(const n of t)this.#ur.set(n.id,n);return this.#Ir(),this}removeEdgeFamilies(e){const t=normalizeStringIdSet(e,"Graph edge-family removals");let n=!1;for(const o of t)n=this.#ur.delete(o)||n;return n&&this.#Ir(),this}replaceActiveEdgeSet(e,t){const n=this.#br(e,t);return this.#Cr(n),this.#pr.set(n.id,n),this.#vr(),this.#Ir(),this}removeActiveEdgeSet(e){return assertStringId(e,"Graph active edge-set id"),this.#pr.delete(e)&&(this.#vr(),this.#Ir()),this}edgeFamilyEdgesForSource(e,t={}){return this.#Er(e,t)}activeEdgesForSource(e){return this.#mr.get(e)??kb}shortestPath(e,t,n={}){return this.#Rr(e,new Set([t]),n)}findPathToAny(e,t,n={}){return Array.isArray(t)&&0!==t.length?this.#Rr(e,new Set(t),n):null}#Rr(e,t,n){if(!this.hasNode(e))return null;const o=[...t].filter(e=>this.hasNode(e));if(0===o.length)return null;const a=new Set(o);if(a.has(e))return createPath({edgeIds:[],roomIds:[e],sourceId:e,steps:[],targetId:e,totalWeight:0});const i=new Tb,s=new Map,l={distance:0,edge:null,nodeId:e,previousNodeId:null,routeKey:"",stepCount:0};for(s.set(e,l),i.push(l);i.size>0;){const t=i.pop();if(s.get(t.nodeId)===t){if(a.has(t.nodeId))return createPathFromBestEntry({bestByNode:s,sourceId:e,targetEntry:t});for(const e of this.#kr(t.nodeId,n)){const o=e.targetId;if(!this.hasNode(o))continue;const a=this.#Ar(e,n);if(a===Number.POSITIVE_INFINITY)continue;assertFiniteNonNegativeWeight(e,a);const l={distance:t.distance+a,edge:e,nodeId:o,previousNodeId:t.nodeId,routeKey:appendRouteKey(t.routeKey,e.id),stepCount:t.stepCount+1},c=s.get(o);(!c||comparePathEntries(l,c)<0)&&(s.set(o,l),i.push(l))}}}return null}*#kr(e,t){for(const n of this.#n.outboundEdges(e)){const e=this.#M.get(n);e&&(yield e)}for(const n of this.#mr.get(e)??kb)yield n;yield*this.#Tr(e,t)}#Ar(e,t){if(e.block)return Number.POSITIVE_INFINITY;if(isRoomExcluded(t,e.targetId))return Number.POSITIVE_INFINITY;const n=getPrimaryTravelClass(e);if(isTravelClassDisabled(t,n))return Number.POSITIVE_INFINITY;if("wormhole"===n&&!isWormholeUsable(t))return Number.POSITIVE_INFINITY;if(isTravelClassAreaExcluded(t,n,this.getNode(e.sourceId),this.getNode(e.targetId)))return Number.POSITIVE_INFINITY;if("function"==typeof t?.travelRegistry?.weightFor){const n=t.travelRegistry.weightFor(e,t);if(void 0!==n)return normalizeWeight(n,e)}return e.weightFn?normalizeWeight(e.weightFn(t),e):normalizeWeight(e.weight,e)}#Sr({removeIds:e=kb,upsertEdges:t=kb,allowReplacingOutsideRemoval:n=!0,allowBlockedEdgeMutation:o=!1}){const a=normalizeEdgeIdSet(e),i=this.#Mr(t);assertNoExternalReplacement({allowReplacingOutsideRemoval:n,edgesById:this.#M,removeIdSet:a,upsertEdges:i}),o||this.#zr(i);const s=new Set(a);for(const l of i)this.#n.hasEdge(l.id)&&s.add(l.id);if(![...s].some(e=>this.#n.hasEdge(e))&&0===i.length)return this;for(const l of s)this.#n.hasEdge(l)&&this.#n.dropEdge(l),this.#M.delete(l);for(const l of i)this.#n.addDirectedEdgeWithKey(l.id,l.sourceId,l.targetId,l),this.#M.set(l.id,l);return this.#$r(),this}#wr({removeIds:e=kb,upsertNodes:t=kb,syntheticOnly:n=!1}){const o=normalizeNodeIdSet(e),a=this.#Nr(t,{syntheticOnly:n});if(0===o.size&&0===a.length)return this;for(const s of o)this.#Pr(s);let i=!1;for(const s of o)this.#n.hasNode(s)&&(this.#n.dropNode(s),i=!0),this.#B.delete(s);for(const s of a)this.#n.hasNode(s.id)?replaceGraphologyNodeAttributes(this.#n,s.id,s):this.#n.addNode(s.id,s),this.#B.set(s.id,s),i=!0;return i&&this.#Or(),this}#Mr(e,t=Ab){if(!Array.isArray(e))throw new Error("Graph edge mutations require an array of edge records.");const n=new Set;return e.map(e=>{if(!isObjectRecord(e))throw new Error("Graph edge mutations require edge records.");if(assertEdgeId(e.id),n.has(e.id))throw new Error(`Graph edge mutation includes duplicate edge id '${e.id}'.`);n.add(e.id);const o=requireMutationNode(this.#B,e.id,e.sourceId,"source"),a=requireMutationNode(this.#B,e.id,e.targetId,"target"),i=e.areaId??nodeAreaId(o)??nodeAreaId(a),s=e.z??nodeZ(o)??nodeZ(a);if(!this.#x.has(i))throw new Error(`Graph edge '${e.id}' references missing area '${i}'.`);if(!Number.isFinite(s))throw new Error(`Graph edge '${e.id}' references invalid z level '${s}'.`);if(!Array.isArray(e.classes))throw new Error(`Graph edge '${e.id}' must define a classes array.`);const l=normalizeEdgeKind(e.kind??t.kind??inferDefaultEdgeKind(e)),c=normalizeEdgeOrigin(e.origin??t.origin??inferDefaultEdgeOrigin(e)),d=normalizeEdgePersistence(e.persistence??t.persistence??inferDefaultEdgePersistence(e)),u=normalizeEdgeRole(e.role??e.metadata?.role??t.role??inferDefaultEdgeRole(e));return freezeGraphRecord({...e,areaId:i,classes:Object.freeze([...e.classes]),commands:Array.isArray(e.commands)?Object.freeze([...e.commands]):e.commands,kind:l,origin:c,persistence:d,role:u,z:s})})}#Nr(e,{syntheticOnly:t=!1}={}){if(!Array.isArray(e))throw new Error("Graph node mutations require an array of node records.");const n=new Set;return e.map(e=>{if(!isObjectRecord(e))throw new Error("Graph node mutations require node records.");if(assertNodeId(e.id),n.has(e.id))throw new Error(`Graph node mutation includes duplicate node id '${e.id}'.`);return n.add(e.id),t?assertSyntheticNode(e):isIndexedRoomNode(e)&&requireIndexedNodePlacement(this.#x,e),freezeGraphRecord({...e,exits:Array.isArray(e.exits)?Object.freeze([...e.exits]):e.exits})})}#yr(e){if(!isObjectRecord(e))throw new Error("Graph edge-family mutations require family records.");if(assertStringId(e.id,"Graph edge-family id"),assertStringId(e.travelClass,`Graph edge-family '${e.id}' travel class`),!Array.isArray(e.templates)||0===e.templates.length)throw new Error(`Graph edge-family '${e.id}' requires at least one template.`);const t=new Set,n=new Set,o=new Set,a=new Map,i=e.templates.map(i=>{if(!isObjectRecord(i))throw new Error(`Graph edge-family '${e.id}' requires template records.`);if(assertStringId(i.id,`Graph edge-family '${e.id}' template id`),t.has(i.id))throw new Error(`Graph edge-family '${e.id}' includes duplicate template id '${i.id}'.`);t.add(i.id),assertStringId(i.command,`Graph edge-family '${e.id}' template '${i.id}' command`);const s=requireMutationNode(this.#B,`${e.id}:${i.id}`,i.targetId,"target"),l=normalizeNodeIdArray(i.sourceIds,`Graph edge-family '${e.id}' template '${i.id}' sourceIds`);if(0===l.length)throw new Error(`Graph edge-family '${e.id}' template '${i.id}' requires at least one source.`);for(const t of l){const l=requireMutationNode(this.#B,`${e.id}:${i.id}`,t,"source"),c=createFamilyEdgeId(e,i,t);if(assertEdgeId(c),n.has(c))throw new Error(`Graph edge-family '${e.id}' generates duplicate edge id '${c}'.`);if(n.add(c),o.add(t),!resolveEdgePlacement(this.#x,c,l,s,i))throw new Error(`Graph edge-family '${e.id}' could not place edge '${c}'.`);const d=a.get(t)??[];d.push(i.id),a.set(t,d)}return freezeGraphRecord({...i,sourceIds:Object.freeze([...l])})}),s=new Map(i.map(e=>[e.id,e])),l=freezeGraphRecord({...e,edgeCount:n.size,kind:e.kind??"compiledEdgeFamily",origin:normalizeEdgeOrigin(e.origin??"nexmap"),persistence:normalizeEdgePersistence(e.persistence??"source"),role:normalizeEdgeRole(e.role??"travelAction"),sourceCount:o.size,templates:Object.freeze(i)});return{edgeIds:n,id:e.id,record:l,sourceIndex:a,templateById:s,travelClass:e.travelClass}}#br(e,t){assertStringId(e,"Graph active edge-set id");const n=this.#Mr(t,{origin:"nexmap",persistence:"session"}),o=[...new Set(n.map(e=>getPrimaryTravelClass(e)).filter(Boolean))].sort();return{edges:n,id:e,record:freezeGraphRecord({edgeCount:n.length,edges:Object.freeze(n),id:e,travelClasses:Object.freeze(o)})}}#Pr(e){if(!this.#n.hasNode(e))return;const t=this.#n.outboundEdges(e),n=this.#n.inboundEdges(e);if(t.length>0||n.length>0)throw new Error(`Cannot remove graph node '${e}' while materialized edges reference it.`);if(this.#mr.has(e))throw new Error(`Cannot remove graph node '${e}' while active edges reference it.`);for(const o of this.#hr.values())if(o.targetId===e)throw new Error(`Cannot remove graph node '${e}' while active edges reference it.`);for(const o of this.#ur.values()){if(o.sourceIndex.has(e))throw new Error(`Cannot remove graph node '${e}' while edge families reference it.`);for(const t of o.record.templates)if(t.targetId===e)throw new Error(`Cannot remove graph node '${e}' while edge families reference it.`)}}#xr(e){const t=new Set(e.map(e=>e.id)),n=new Set;for(const o of e)for(const e of o.edgeIds){if(n.has(e))throw new Error(`Graph edge-family mutation generates duplicate edge id '${e}'.`);if(n.add(e),this.#M.has(e))throw new Error(`Graph edge-family '${o.id}' generated edge id '${e}' that collides with a materialized edge.`);if(this.#hr.has(e))throw new Error(`Graph edge-family '${o.id}' generated edge id '${e}' that collides with an active edge.`);for(const n of this.#ur.values())if(!t.has(n.id)&&n.edgeIds.has(e))throw new Error(`Graph edge-family '${o.id}' generated edge id '${e}' that collides with edge-family '${n.id}'.`)}}#Cr(e){const t=this.#pr.get(e.id),n=new Set(t?.edges.map(e=>e.id)??[]);for(const o of e.edges){if(this.#M.has(o.id))throw new Error(`Graph active edge-set '${e.id}' edge '${o.id}' collides with a materialized edge.`);if(this.#hr.get(o.id)&&!n.has(o.id))throw new Error(`Graph active edge-set '${e.id}' edge '${o.id}' collides with another active edge.`);for(const t of this.#ur.values())if(t.edgeIds.has(o.id))throw new Error(`Graph active edge-set '${e.id}' edge '${o.id}' collides with edge-family '${t.id}'.`)}}#Er(e,t){return[...this.#Tr(e,t)]}*#Tr(e,t){for(const n of this.#ur.values()){if(isTravelClassDisabled(t,n.travelClass))continue;const o=n.sourceIndex.get(e);if(o)for(const t of o)yield this.#_r(n,t,e)}}#_r(e,t,n){const o=e.templateById.get(t),a=this.#B.get(n),i=this.#B.get(o.targetId),s=createFamilyEdgeId(e.record,o,n),l=resolveEdgePlacement(this.#x,s,a,i,o);return freezeGraphRecord({areaId:l.areaId,baseId:s,classes:Object.freeze([...o.classes??[e.travelClass]]),command:o.command,commandSetting:o.commandSetting,id:s,kind:normalizeEdgeKind(o.kind??e.record.edgeKind??"special"),metadata:mergeMetadata(e.record.metadata,o.metadata),origin:normalizeEdgeOrigin(o.origin??e.record.origin??"nexmap"),persistence:normalizeEdgePersistence(o.persistence??e.record.persistence??"source"),role:normalizeEdgeRole(o.role??o.metadata?.role??e.record.role??"travelAction"),sourceId:n,targetId:o.targetId,travelClass:e.travelClass,weight:o.weight??e.record.weight??1,weightExpression:o.weightExpression??e.record.weightExpression,weightFn:o.weightFn??e.record.weightFn,z:l.z})}#$r(){const e=[...this.#M.values()],{areaEdgeIds:t,areaZEdgeIds:n}=createEdgeIndexRecords(this.#J.areas,e);this.#lr=objectToNumberKeyMap(t),this.#cr=objectToNestedNumberKeyMap(n);for(const o of[...this.#gr.keys()])this.#M.has(o)||this.#gr.delete(o);this.#fr+=1,this.#J=Object.freeze({...this.#J,edgeCount:e.length,edges:Object.freeze(e),graphRevision:this.#fr,indices:Object.freeze({...this.#J.indices,areaEdgeIds:t,areaZEdgeIds:n})})}#zr(e){for(const t of e)if(this.#gr.has(t.id))throw new Error(`Cannot mutate currently-blocked edge '${t.id}'. Call unblockEdge() first.`)}#Or(){const e=[...this.#B.values()],{areas:t,areaRoomIds:n,areaZRoomIds:o,roomToAreaId:a,symbolSvgByRoomId:i}=createNodeIndexRecords(this.#J.areas,e,this.#x);this.#x=createRecordMap(t,"id"),this.#sr=objectToNumberKeyMap(n),this.#It=objectToNestedNumberKeyMap(o),this.#dr=objectToNumberKeyMap(i),this.#fr+=1,this.#J=Object.freeze({...this.#J,areas:Object.freeze(t),nodeCount:e.length,nodes:Object.freeze(e),graphRevision:this.#fr,indices:Object.freeze({...this.#J.indices,areaRoomIds:n,areaZRoomIds:o,roomToAreaId:a,symbolSvgByRoomId:i})})}#vr(){const e=new Map,t=new Map;for(const n of this.#pr.values())for(const o of n.edges){if(t.has(o.id))throw new Error(`Graph active edge sets include duplicate edge id '${o.id}'.`);t.set(o.id,o);const n=e.get(o.sourceId)??[];n.push(o),e.set(o.sourceId,n)}for(const[n,o]of e.entries())e.set(n,Object.freeze(o));this.#mr=e,this.#hr=t}#Ir(){this.#fr+=1,this.#J=Object.freeze({...this.#J,activeEdgeSetCount:this.#pr.size,activeEdgeSets:Object.freeze(this.activeEdgeSets()),edgeFamilies:Object.freeze(this.edgeFamilies()),edgeFamilyCount:this.#ur.size,graphRevision:this.#fr})}},kb=Object.freeze([]),Ab=Object.freeze({}),Tb=class{#jr=[];get size(){return this.#jr.length}push(e){this.#jr.push(e),this.#Fr(this.#jr.length-1)}pop(){const e=this.#jr[0],t=this.#jr.pop();return this.#jr.length>0&&(this.#jr[0]=t,this.#Lr(0)),e}#Fr(e){let t=e;for(;t>0;){const e=Math.floor((t-1)/2);if(comparePathEntries(this.#jr[t],this.#jr[e])>=0)break;this.#Dr(t,e),t=e}}#Lr(e){let t=e;for(;;){const e=2*t+1,n=e+1;let o=t;if(e<this.#jr.length&&comparePathEntries(this.#jr[e],this.#jr[o])<0&&(o=e),n<this.#jr.length&&comparePathEntries(this.#jr[n],this.#jr[o])<0&&(o=n),o===t)break;this.#Dr(t,o),t=o}}#Dr(e,t){const n=this.#jr[e];this.#jr[e]=this.#jr[t],this.#jr[t]=n}};function createGraphologyGraph(e){const t=new Cb({allowSelfLoops:!0});for(const n of e.nodes)t.addNode(n.id,n);for(const n of e.edges)t.addDirectedEdgeWithKey(n.id,n.sourceId,n.targetId,n);return t}function normalizeStoredEdgeRecords(e){return Object.freeze(e.map(e=>freezeGraphRecord({...e,classes:Array.isArray(e.classes)?Object.freeze([...e.classes]):kb,commands:Array.isArray(e.commands)?Object.freeze([...e.commands]):e.commands,kind:normalizeEdgeKind(e.kind??inferDefaultEdgeKind(e)),origin:normalizeEdgeOrigin(e.origin??inferDefaultEdgeOrigin(e)),persistence:normalizeEdgePersistence(e.persistence??inferDefaultEdgePersistence(e)),role:normalizeEdgeRole(e.role??e.metadata?.role??inferDefaultEdgeRole(e))})))}function normalizeSnapshotRevision(e){return Number.isSafeInteger(e)&&e>=0?e:0}function withGraphRevision(e,t){return e.graphRevision===t?e:Object.freeze({...e,graphRevision:t})}function createRecordMap(e,t){return new Map(e.map(e=>[e[t],e]))}function objectToNumberKeyMap(e){return new Map(Object.entries(e).map(([e,t])=>[Number(e),t]))}function objectToNestedNumberKeyMap(e){return new Map(Object.entries(e).map(([e,t])=>[Number(e),new Map(Object.entries(t).map(([e,t])=>[Number(e),t]))]))}function normalizeEdgeIdSet(e){if(!Array.isArray(e))throw new Error("Graph edge removals require an array of edge ids.");const t=new Set;for(const n of e)assertEdgeId(n),t.add(n);return t}function normalizeNodeIdSet(e){if(!Array.isArray(e))throw new Error("Graph node removals require an array of node ids.");const t=new Set;for(const n of e)assertNodeId(n),t.add(n);return t}function normalizeStringIdSet(e,t){if(!Array.isArray(e))throw new Error(`${t} require an array of ids.`);const n=new Set;for(const o of e)assertStringId(o,`${t} id`),n.add(o);return n}function normalizeNodeIdArray(e,t){if(!Array.isArray(e))throw new Error(`${t} must be an array.`);const n=new Set,o=[];for(const a of e){if(assertNodeId(a),n.has(a))throw new Error(`${t} includes duplicate node id '${a}'.`);n.add(a),o.push(a)}return o}function assertEdgeId(e){if("string"!=typeof e||0===e.trim().length)throw new Error("Graph edge mutations require string edge ids.")}function assertNodeId(e){if("string"!=typeof e&&"number"!=typeof e||"string"==typeof e&&0===e.trim().length||"number"==typeof e&&!Number.isSafeInteger(e))throw new Error("Graph node mutations require string or integer node ids.")}function assertStringId(e,t){if("string"!=typeof e||0===e.trim().length)throw new Error(`${t} must be a non-empty string.`)}function requireMutationNode(e,t,n,o){const a=e.get(n);if(!a)throw new Error(`Graph edge '${t}' references missing ${o} node '${n}'.`);return a}function assertSyntheticNode(e){if("string"!=typeof e.id||!e.id.startsWith("travel-"))throw new Error(`Synthetic graph node '${e.id}' must use a travel-owned string id.`);if("string"!=typeof e.nodeKind||0===e.nodeKind.trim().length)throw new Error(`Synthetic graph node '${e.id}' must define nodeKind.`);if("room"===e.nodeKind)throw new Error(`Synthetic graph node '${e.id}' cannot use nodeKind 'room'.`);if(!1!==e.render)throw new Error(`Synthetic graph node '${e.id}' must set render: false.`);if(!1!==e.searchable)throw new Error(`Synthetic graph node '${e.id}' must set searchable: false.`);if("string"!=typeof e.origin||0===e.origin.trim().length)throw new Error(`Synthetic graph node '${e.id}' must define origin metadata.`);if("string"!=typeof e.persistence||0===e.persistence.trim().length)throw new Error(`Synthetic graph node '${e.id}' must define persistence metadata.`)}function isIndexedRoomNode(e){return!1!==e.render&&(!e.nodeKind||"room"===e.nodeKind)&&null!==nodeAreaId(e)&&null!==nodeZ(e)}function requireIndexedNodePlacement(e,t){if(!e.has(t.areaId))throw new Error(`Graph node '${t.id}' references missing area '${t.areaId}'.`);if(!Number.isFinite(t.coordinates?.x)||!Number.isFinite(t.coordinates?.y))throw new Error(`Graph node '${t.id}' references invalid coordinates.`)}function nodeAreaId(e){return Number.isSafeInteger(e?.areaId)?e.areaId:null}function nodeZ(e){return Number.isFinite(e?.coordinates?.z)?e.coordinates.z:null}function resolveEdgePlacement(e,t,n,o,a){const i=a.areaId??nodeAreaId(n)??nodeAreaId(o),s=a.z??nodeZ(n)??nodeZ(o);return e.has(i)&&Number.isFinite(s)?{areaId:i,z:s}:null}function createUnblockedEdgeRecord(e,t){const n={...e};return delete n.block,n.classes=Object.freeze([...t.classes]),n.weight=t.weight,n}function assertNoExternalReplacement({allowReplacingOutsideRemoval:e,edgesById:t,removeIdSet:n,upsertEdges:o}){if(!e)for(const a of o)if(t.has(a.id)&&!n.has(a.id))throw new Error(`Replacement edge '${a.id}' would replace an existing edge outside the selected set.`)}function replaceGraphologyNodeAttributes(e,t,n){if("function"==typeof e.replaceNodeAttributes)return void e.replaceNodeAttributes(t,n);const o=e.getNodeAttributes(t);for(const a of Object.keys(o))e.removeNodeAttribute(t,a);for(const[a,i]of Object.entries(n))e.setNodeAttribute(t,a,i)}function createEdgeIndexRecords(e,t){const n=Object.fromEntries(e.map(e=>[e.id,[]])),o=Object.fromEntries(e.map(e=>[e.id,{}]));for(const a of t)n[a.areaId]??=[],n[a.areaId].push(a.id),o[a.areaId]??={},o[a.areaId][a.z]??=[],o[a.areaId][a.z].push(a.id);return{areaEdgeIds:freezeArrayRecord(n),areaZEdgeIds:freezeNestedArrayRecord(o)}}function createNodeIndexRecords(e,t,n){const o=Object.fromEntries(e.map(e=>[e.id,[]])),a=Object.fromEntries(e.map(e=>[e.id,{}])),i={},s={};for(const d of t)isIndexedRoomNode(d)&&(requireIndexedNodePlacement(n,d),o[d.areaId]??=[],o[d.areaId].push(d.id),a[d.areaId]??={},a[d.areaId][d.coordinates.z]??=[],a[d.areaId][d.coordinates.z].push(d.id),i[d.id]=d.areaId,d.symbolSvg&&(s[d.id]=d.symbolSvg));const l=freezeArrayRecord(o),c=e.map(e=>freezeGraphRecord({...e,roomCount:l[e.id]?.length??0,roomIds:l[e.id]??kb}));return{areas:Object.freeze(c),areaRoomIds:l,areaZRoomIds:freezeNestedArrayRecord(a),roomToAreaId:Object.freeze(i),symbolSvgByRoomId:Object.freeze(s)}}function createFamilyEdgeId(e,t,n){return`${t.edgeIdPrefix??e.edgeIdPrefix??`travel:${e.travelClass}`}:${String(n)}-${String(t.targetId)}`}function mergeMetadata(e,t){if(void 0!==e||void 0!==t)return{...e??{},...t??{}}}function freezeArrayRecord(e){for(const t of Object.values(e))Object.freeze(t);return Object.freeze(e)}function freezeNestedArrayRecord(e){for(const t of Object.values(e))freezeArrayRecord(t);return Object.freeze(e)}function freezeGraphRecord(e){if(!e||"object"!=typeof e)return e;Object.freeze(e);for(const t of Object.values(e))freezeGraphRecord(t);return e}function isObjectRecord(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function hasOwn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function comparePathEntries(e,t){if(e.distance!==t.distance)return e.distance-t.distance;if(e.stepCount!==t.stepCount)return e.stepCount-t.stepCount;if(e.routeKey!==t.routeKey)return e.routeKey<t.routeKey?-1:1;const n=String(e.nodeId),o=String(t.nodeId);return n!==o?n<o?-1:1:0}function appendRouteKey(e,t){return e?`${e}\0${t}`:t}function createPathFromBestEntry({bestByNode:e,sourceId:t,targetEntry:n}){const o=[],a=[];let i=n;for(;i;)o.push(i.nodeId),i.edge&&a.push(createPathStep(i,e)),i=null===i.previousNodeId?null:e.get(i.previousNodeId);return o.reverse(),a.reverse(),createPath({edgeIds:a.map(e=>e.edgeId),roomIds:o,sourceId:t,steps:a,targetId:n.nodeId,totalWeight:n.distance})}function createPathStep(e,t){const n={command:e.edge.command,edgeId:e.edge.id,from:e.edge.sourceId,to:e.edge.targetId,travelClasses:Object.freeze(getTravelClasses(e.edge)),weight:e.distance-t.get(e.previousNodeId).distance};return Array.isArray(e.edge.commands)&&e.edge.commands.length>0&&(n.commands=Object.freeze([...e.edge.commands])),e.edge.kind&&"standard"!==e.edge.kind&&(n.kind=e.edge.kind),void 0!==e.edge.origin&&(n.origin=e.edge.origin),void 0!==e.edge.persistence&&(n.persistence=e.edge.persistence),void 0!==e.edge.role&&(n.role=e.edge.role),void 0!==e.edge.scriptId&&(n.scriptId=e.edge.scriptId),void 0!==e.edge.metadata&&(n.metadata=e.edge.metadata),Object.freeze(n)}function createPath({edgeIds:e,roomIds:t,sourceId:n,steps:o,targetId:a,totalWeight:i}){return Object.freeze({commands:Object.freeze(o.flatMap(commandsForStep)),edgeIds:Object.freeze(e),roomIds:Object.freeze(t),sourceId:n,steps:Object.freeze(o),targetId:a,totalWeight:i})}function commandsForStep(e){return Array.isArray(e.commands)&&e.commands.length>0?[...e.commands]:[e.command]}function getPrimaryTravelClass(e){return e.travelClass?e.travelClass:"scripted"===e.kind||e.classes?.includes("scripted")?"scripted":"standard"}function getTravelClasses(e){return[getPrimaryTravelClass(e)]}function inferDefaultEdgeKind(e){return e.kind?e.kind:e.travelClass?e.command?.startsWith?.("#")?"scripted":"special":"standard"}function inferDefaultEdgeOrigin(e){return e.origin?e.origin:"wormhole"===e.travelClass?"remote":e.travelClass?"nexmap":"crowdmap"}function inferDefaultEdgePersistence(e){return e.persistence?e.persistence:"wormhole"===e.travelClass?"remote":"source"}function inferDefaultEdgeRole(e){return e.role?e.role:e.metadata?.role?e.metadata.role:e.travelClass?"travelAction":"ordinary"}function normalizeEdgeKind(e){return normalizeEnumValue(e,Fn,"Graph edge kind")}function normalizeEdgeOrigin(e){return normalizeEnumValue(e,Ln,"Graph edge origin")}function normalizeEdgePersistence(e){return normalizeEnumValue(e,Dn,"Graph edge persistence")}function normalizeEdgeRole(e){return normalizeEnumValue(e,Bn,"Graph edge role")}function normalizeEnumValue(e,t,n){if("string"!=typeof e||!t.includes(e))throw new Error(`${n} '${e}' must be one of ${t.join(", ")}.`);return e}function isRoomExcluded(e,t){return collectionHas(e?.excludedRoomIds,t)}function isTravelClassDisabled(e,t){return collectionHas(e?.disabledTravelClasses,t)}function isWormholeUsable(e){if(hasVibratingStick(e))return!0;const t=String(e?.characterClass??e?.hostFacts?.characterClass??"").trim().toLowerCase();return 0===t.length||"serpent"===t}function hasVibratingStick(e){return!0===e?.hasVibratingStick||!0===e?.vibratingStick||!0===e?.wormholeAccess||!0===e?.hostFacts?.hasVibratingStick||!0===e?.hostFacts?.vibratingStick||!0===e?.hostFacts?.wormholeAccess}function isTravelClassAreaExcluded(e,t,n,o){const a=e?.travelClassAreaExclusions,i=getKeyedCollection(a,t);return!!i&&(collectionHas(i,n?.areaId)||collectionHas(i,o?.areaId))}function getKeyedCollection(e,t){const n=getKeyedValue(e,t);return void 0===n?null:n}function getKeyedValue(e,t){if(e)return"function"==typeof e.get?e.get(t):Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function collectionHas(e,t){return!(null==t||!e)&&("function"==typeof e.has?e.has(t):!!Array.isArray(e)&&e.includes(t))}function normalizeWeight(e,t){return"Infinity"===e?Number.POSITIVE_INFINITY:Number(e??t.weight)}function assertFiniteNonNegativeWeight(e,t){if(!Number.isFinite(t)||t<0)throw new Error(`Path edge '${e.id}' resolved to invalid weight '${t}'.`)}var Mb=array(eo),zb=Object.freeze({d:"d",down:"d",e:"e",east:"e",in:"in",n:"n",ne:"ne",north:"n",northeast:"ne",northwest:"nw",nw:"nw",out:"out",s:"s",se:"se",south:"s",southeast:"se",southwest:"sw",sw:"sw",u:"u",up:"u",w:"w",west:"w"});function buildGraph(e,{graphRevisions:t=[]}={}){const n=Yn.parse(e),o=createBehaviorIndex(Mb.parse(t)),a=countSourceTargetPairs(n),i=createReversePairIndex(n),s=new Map;assertGraphBehaviorTargets(o,a);const l=[],c=[],d=[],u={},p={},m={},h={},g={},y={};for(const b of n.areas){const e=createAreaRecord(b);l.push(e),u[b.id]=[],p[b.id]=[],m[b.id]={},h[b.id]={};for(const t of b.rooms){const n=createNodeRecord(b,t);c.push(n),e.roomIds.push(t.id),u[b.id].push(t.id),g[t.id]=b.id,pushNested(m,b.id,n.coordinates.z,t.id),n.symbolSvg&&(y[t.id]=n.symbolSvg);for(const e of t.exits){if(isWormWarpExit(e))continue;const n=createEdgeRecord({area:b,edgeIdCounts:s,exit:e,behavior:o.get(createBaseEdgeId(t.id,e.exitId))??$b,reversePairs:i,room:t});d.push(n),p[b.id].push(n.id),pushNested(h,b.id,n.z,n.id)}}}propagateUnambiguousGameAreas(c);for(const b of l)Object.freeze(b.roomIds);return new Rb(deepFreeze({areaCount:l.length,areas:l,edgeCount:d.length,edges:d,indices:{areaEdgeIds:p,areaRoomIds:u,areaZEdgeIds:h,areaZRoomIds:m,roomToAreaId:g,symbolSvgByRoomId:y},nodeCount:c.length,nodes:c,schemaVersion:1}))}function propagateUnambiguousGameAreas(e){const t=new Map;for(const o of e){if("room"!==o.nodeKind||!o.gameArea)continue;const e=t.get(o.areaId);e?e.add(o.gameArea):t.set(o.areaId,new Set([o.gameArea]))}const n=new Map;for(const[o,a]of t)1===a.size&&n.set(o,a.values().next().value);for(const o of e){if("room"!==o.nodeKind||o.gameArea)continue;const e=n.get(o.areaId);e&&(o.gameArea=e)}}function createAreaRecord(e){return{continent:e.continent,id:e.id,name:e.name,roomCount:e.rooms.length,roomIds:[],userData:cloneJson(e.userData??{})}}function createNodeRecord(e,t){const[n,o,a]=t.coordinates,i=t.userData??{},s=void 0===t.symbol?null:cloneJson(t.symbol),l=s?createSymbolSvg(s):null,c="y"===i.indoors||!0===i.indoors,d={areaId:e.id,continent:e.continent,coordinates:{x:n,y:o,z:a},exits:cloneJson(t.exits??[]),gameArea:"string"==typeof i["Game Area"]?i["Game Area"]:"",id:t.id,indoors:c,name:t.name??"",nodeKind:"room",origin:"crowdmap",outdoors:"y"===i.outdoors||!c,persistence:"source",render:!0,searchable:!0,userData:cloneJson(i)};return void 0!==t.environment&&(d.environment=t.environment),s&&(d.symbol=s,d.symbolSvg=l),d}function createEdgeRecord({area:e,behavior:t,edgeIdCounts:n,exit:o,reversePairs:a,room:i}){const s=createBaseEdgeId(i.id,o.exitId),l=allocateEdgeId(s,n),c=resolveCommands({behavior:t,exit:o}),d=c[c.length-1],{weight:u,weightExpression:p,weightFn:m,weightSpec:h}=resolveWeight({behavior:t,edgeId:s,exit:o}),g=!a.has(createPairKey(o.exitId,i.id)),y=normalizeVisualExitDirection(o.name),b=classifyCrowdmapExitKind({commands:c,exit:o}),v=createEdgeClasses({command:d,exit:o,kind:b,oneWay:g,sourceExitDirection:y,weight:u,weightExpression:p,weightSpec:h}),w={areaId:e.id,baseId:s,classes:v,command:d,id:l,kind:b,locked:!0===o.locked,origin:"crowdmap",persistence:"source",role:"ordinary",sourceId:i.id,targetId:o.exitId,weight:u,z:i.coordinates[2]};return(t.commands||c.length>1)&&(w.commands=c),y&&(w.sourceExitDirection=y),void 0!==o.customLine&&(w.customLine=cloneJson(o.customLine)),void 0!==o.door&&(w.door=o.door),void 0!==o.scriptId&&(w.scriptId=o.scriptId),p&&(w.weightExpression=p),h&&(w.weightSpec=cloneJson(h)),m&&(w.weightFn=m),w}function createEdgeClasses({command:e,exit:t,kind:n,oneWay:o,sourceExitDirection:a,weight:i,weightExpression:s,weightSpec:l}){const c="scripted"===n?["scripted"]:["walk"],d=normalizeCommandToken(e),u=normalizeCommandToken(t.name);switch("worm warp"!==d&&"worm warp"!==u||c.push("wormhole"),a){case"d":c.push("downexit");break;case"in":c.push("inexit");break;case"out":c.push("outexit");break;case"u":c.push("upexit")}return"enter grate"!==d&&"enter grate"!==u||c.push("sewergrate"),t.door&&c.push("door"),t.locked&&c.push("locked"),o&&c.push("oneway"),i===Number.POSITIVE_INFINITY&&c.push("blocked"),(s||l)&&c.push("dynamicWeight"),c}function resolveCommands({behavior:e,exit:t}){const normalizeCommand=e=>isStandardExitCommand(e)?toShortDirection(e):e;return Array.isArray(e.commands)&&e.commands.length>0?e.commands.map(normalizeCommand):[normalizeCommand(t.name)]}function createBehaviorIndex(e){const t=new Map;for(const n of e){if(t.has(n.edgeId))throw new Error(`Duplicate graph behavior revision for edge '${n.edgeId}'.`);t.set(n.edgeId,{...n})}return t}function assertGraphBehaviorTargets(e,t){for(const[n,o]of e.entries()){const e=t.get(n)??0;if(0===e){if(!0===o.redundantIfMissing)continue;throw new Error(`Graph behavior revision '${n}' does not match any normalized exit.`)}if(e>1)throw new Error(`Graph edge override '${n}' matches multiple normalized exits.`)}}function countSourceTargetPairs(e){const t=new Map;for(const n of e.areas)for(const e of n.rooms)for(const n of e.exits){const o=createBaseEdgeId(e.id,n.exitId);t.set(o,(t.get(o)??0)+1)}return t}function createReversePairIndex(e){const t=new Set;for(const n of e.areas)for(const e of n.rooms)for(const n of e.exits)t.add(createPairKey(e.id,n.exitId));return t}function allocateEdgeId(e,t){const n=(t.get(e)??0)+1;return t.set(e,n),1===n?e:`${e}#${n}`}function createBaseEdgeId(e,t){return`${e}-${t}`}function createPairKey(e,t){return`${e}>${t}`}function resolveWeight({behavior:e,edgeId:t,exit:n}){if(e.weightSpec)return compileWeightSpec(e.weightSpec,n.weight);if("weight"in e)return{weight:normalizeStaticWeight(e.weight,t),weightExpression:null,weightFn:null,weightSpec:null};if(n.weightSpec)return compileWeightSpec(n.weightSpec,n.weight);if(n.weightExpression)throw new Error(`Crowdmap exit '${t}' carries legacy weightExpression '${n.weightExpression}' without an executable weightSpec.`);return{weight:n.weight??1,weightExpression:null,weightFn:null,weightSpec:null}}function compileWeightSpec(e,t){if("celerityMultiplier"===e.kind){const n=Number(e.factor);return{weight:t??n,weightExpression:`${n} * celerity`,weightFn:e=>n*Number(e?.celerity??1),weightSpec:e}}throw new Error(`Unsupported weight spec '${e.kind}'.`)}function normalizeStaticWeight(e,t){const n="Infinity"===e?Number.POSITIVE_INFINITY:Number(e);if(n===Number.POSITIVE_INFINITY||Number.isFinite(n))return n;throw new Error(`Graph behavior revision '${t}' has an unsupported weight '${e}'.`)}function normalizeCommandToken(e){const t=String(e??"").toLowerCase().trim();return t.length>0?t:null}function normalizeVisualExitDirection(e){const t=normalizeCommandToken(e);return t?zb[t]??null:null}function classifyCrowdmapExitKind({commands:e,exit:t}){return t.scriptId?"scripted":e.every(isStandardExitCommand)?"standard":"special"}function isWormWarpExit(e){return"worm warp"===normalizeCommandToken(e?.name)}function pushNested(e,t,n,o){e[t][n]??=[],e[t][n].push(o)}function createSymbolSvg(e){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><text x="16" y="24" text-anchor="middle" font-family="'Roboto Mono', Consolas, monospace" font-size="24" font-weight="bold">${escapeXml("string"==typeof e.text?e.text:"")}</text></svg>`}function escapeXml(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&apos;")}function cloneJson(e){return JSON.parse(JSON.stringify(e))}function deepFreeze(e){if(!e||"object"!=typeof e)return e;Object.freeze(e);for(const t of Object.values(e))deepFreeze(t);return e}var $b=Object.freeze({});function buildStartupBaseGraph(e,{graphRevisions:t=null,travelProviderApplier:n=applyTravelProviders}={}){const o=performance.now(),_stamp=e=>console.log(`[nexMap4 timing] graph +${Math.round(performance.now()-o)}ms - ${e}`);_stamp("normalizeCrowdmap + buildGraph start");const a=buildGraph(ensureNormalizedCrowdmap(e),{graphRevisions:t??(isNormalizedCrowdmap(e)?[]:dy)});_stamp(`buildGraph complete (${a.nodeCount} nodes, ${a.edgeCount} edges)`),_stamp("applyTravelProviders start");const i=n(a);return _stamp("applyTravelProviders complete"),i}function mergeStartupWormholes(e,t=[]){const n=performance.now(),_stamp=e=>console.log(`[nexMap4 timing] wormholes +${Math.round(performance.now()-n)}ms - ${e}`);_stamp(`mergeWormholes start (${t.length} wormholes)`);const o=loadWormholesIntoGraph(e,t);return _stamp("mergeWormholes complete"),o}function loadRemoteCrowdmap({requestInit:e=Qy,url:t=Jy}={}){return fetchCrowdmap({requestInit:e,url:t})}function ensureNormalizedCrowdmap(e){return isNormalizedCrowdmap(e)?e:normalizeCrowdmap(e)}function isNormalizedCrowdmap(e){return Array.isArray(e?.areas)&&e.areas.every(e=>"string"==typeof e.continent)}function loadWormholesIntoGraph(e,t){return Array.isArray(t)&&0!==t.length?(replaceWormholeEdges(e,t),e):e}function createStartupCoordinator({adapterFactory:e=createNexusAdapter,app:t=createNexMap(),crowdmapLoader:n=null,crowdmapRequestInit:o=Qy,crowdmapUrl:a=Jy,denizensClient:i=null,document:s=resolveDocument(),graphBuilder:l=null,host:c=globalThis,maxAttempts:d=2,onFatalStartupAbort:u=null,remoteConfig:p=null,rendererFactory:m=createDefaultRenderer,rendererOptions:h=null,retryDelayMs:g=250,settingsRepository:y=null,settingsStore:b=null,tabId:v=ff,travelProviderApplier:w=applyTravelProviders,usersClient:S=null,wormholesClient:x=null}={}){const I=n??(()=>loadRemoteCrowdmap({requestInit:o,url:a})),C=new Set,E={attempts:{crowdmap:0,graph:0,remote:0},capabilities:null,completed:!1,graphSummary:null,lastError:null,phase:Xy.BOOTING,ready:!1,rendererViewport:null,started:!1,tab:null,warnings:[]},R={adapter:null,denizenCollector:null,eventBus:null,renderer:null,rendererSettingsUnsub:null,runtimeGraphController:null,runtimeGraphUnsubscribe:null,nurRiftManager:null,roomClickUnsubscribe:null,sendCommandsUnsub:null,sendQueueUnsub:null,stepper:null,tab:null,trackingController:null,triggerPack:null,wormholeManager:null};let k=null,T=!1;function subscribe(e){if("function"!=typeof e)throw new Error("startup.subscribe requires a listener function.");return C.add(e),()=>C.delete(e)}function getState(){return cloneState(E)}function emit(){const e=getState();t.setStatus?.(e.phase);for(const t of C)t(e)}function transition(e,t={}){E.phase=e,Object.assign(E,t),emit(),R.adapter?.eventStream?.raise?.(ha.BOOTSTRAP_PHASE,{attempts:{...E.attempts},completed:E.completed,phase:e,ready:E.ready})}async function start(){if(T)throw new Error("nexMap startup coordinator has been destroyed.");return k||(k=runStartup(),k)}async function runStartup(){const n=performance.now(),stamp=e=>console.log(`[nexMap4 timing] +${Math.round(performance.now()-n)}ms — ${e}`);E.started=!0,transition(Xy.BOOTING),stamp("BOOTING start");try{const o=probeHostCapabilities(c);if(E.capabilities=o,recordOptionalCapabilityWarnings(o),!o.ok)throw new Error(`Required Nexus host capabilities missing: ${o.capabilities.missingRequired.join(", ")}`);const a=b??t.settings?.store??createSettingsAtom();R.adapter=e({host:c,settingsStore:a}),R.adapter.start?.();const l=prepareSettings({settingsRepository:y,settingsStore:a});t.configure({settingsRepository:l.repository,settingsStore:l.store}),createStartupEventBus({app:t,resources:R}),installHostTab(),announceStartup();const d=resolveRemoteClients({denizensClient:i,remoteConfig:p,usersClient:S,wormholesClient:x});logDenizenStartupDebug("remote client resolution complete",{hasDenizensClient:Boolean(d.denizensClient),hasRemoteConfig:Boolean(p)}),stamp("BOOTING complete - checking remote auth"),transition(Xy.FETCHING_REMOTE),await runRemoteAuth(d.usersClient),stamp("remote auth complete - starting parallel startup work"),startRemoteUserTelemetry(d.usersClient);const{baseGraph:u,denizenSeedPromise:g,wormholes:v}=await loadStartupData({remoteClients:d,stamp}),w=mergeStartupWormholes(u,v);stamp(`BUILDING_GRAPH complete (${w.nodeCount} nodes, ${w.edgeCount} edges) - hydrating runtime`),notify(`Wormhole database loaded with ${v.length} connections.`),transition(Xy.HYDRATING_STATE);const I=await hydrateRuntime({app:t,denizenSeedPromise:g,denizensClient:d.denizensClient,graph:w,initialWormholes:v,readCharacterName:()=>readCharacterName({adapter:R.adapter,host:c}),resources:R,settingsRepository:l.repository,settingsStore:l.store,notify,warn,wormholesClient:d.wormholesClient});return stamp("HYDRATING_STATE complete - mounting renderer"),mountRendererRuntime({app:t,documentRef:s,graph:w,host:c,hydrated:I,remoteClients:d,rendererFactory:m,rendererOptions:h,resources:R}),transition(Xy.READY,{completed:!0,graphSummary:{areaCount:w.areaCount,edgeCount:w.edgeCount,nodeCount:w.nodeCount},ready:!0,rendererViewport:R.renderer.getViewport()}),stamp("READY — startup complete"),notify(`nexMap loaded and ready. ${((performance.now()-n)/1e3).toFixed(2)}s`,{color:"green",level:"info"}),getState()}catch(o){return isFatalStartupAbortError(o)&&abortStartup(o),degrade(o)}}function installHostTab(){R.tab=installNexMapTab({document:s,host:c,router:t.commands,settingsApi:t.settings,tabId:v,uiStore:t.uiStore}),E.tab={injected:R.tab.injected,method:R.tab.method,selected:R.tab.selected,tabId:R.tab.tabId};for(const e of R.tab.warnings)warn(e,`nexMap tab setup warning: ${e}.`,Xy.BOOTING)}function announceStartup(){R.adapter?.client.printHtml("<span><img src='https://tenor.com/view/daddys-home2-daddys-home2gifs-jon-lithgow-reunion-waiting-gif-9683398.gif' style='width: 35%;'/></span>"),notify("nexMap starting.",{color:"green",level:"info"})}async function loadStartupData({remoteClients:e,stamp:t}){transition(Xy.FETCHING_CROWDMAP);const n=withRetries("crowdmap",Xy.FETCHING_CROWDMAP,I).then(e=>(t("FETCHING_CROWDMAP complete - building base graph"),e)),o=withRetries("remote",Xy.FETCHING_REMOTE,()=>loadStartupWormholes(e.wormholesClient)).then(e=>(t(`FETCHING_REMOTE wormholes complete (${e.length})`),e));logDenizenStartupDebug("starting denizen seed load outside READY critical path",{hasDenizensClient:Boolean(e.denizensClient)});const a=loadDenizenSeed(e.denizensClient);a.catch(()=>{});const i=n.then(e=>(transition(Xy.BUILDING_GRAPH),withRetries("graph",Xy.BUILDING_GRAPH,()=>buildStartupBaseGraphForCoordinator(e)))),[s,l]=await Promise.all([i,o]);return t(`base graph and wormholes ready (${s.nodeCount} nodes, ${l.length} wormholes) - merging wormholes`),{baseGraph:s,denizenSeedPromise:a,wormholes:l}}function prepareSettings({settingsRepository:e,settingsStore:n}){const o=n??t.settings?.store??createSettingsAtom(),a=e??new In({storage:createClientVariableSettingsStorage(R.adapter.client)});return{repository:a,settings:loadSettings(a,o),store:o}}async function runRemoteAuth(e){if(!e)return!0;E.attempts.remote=Math.max(E.attempts.remote,1),emit();try{return await checkRemoteAuth(e),!0}catch(t){throw new Zy("nexMap remote authentication failed.",{cause:t,phase:Xy.FETCHING_REMOTE})}}function startRemoteUserTelemetry(e){if(!e||"function"!=typeof e.upsertOnLoad)return Promise.resolve({skipped:!0});let t;try{t=readUserTelemetry({adapter:R.adapter,host:c})}catch(n){return warn("remote-user-telemetry-failed",`nexMap remote user telemetry skipped: ${formatErrorMessage(n)}`,Xy.FETCHING_REMOTE),Promise.resolve({error:n,skipped:!0})}return Promise.resolve().then(()=>e.upsertOnLoad(t)).catch(e=>(warn("remote-user-telemetry-failed",`nexMap remote user telemetry failed: ${formatErrorMessage(e)}`,Xy.FETCHING_REMOTE),{error:e,skipped:!0}))}function buildStartupBaseGraphForCoordinator(e){return"function"==typeof l?l(e,{travelProviderApplier:w,wormholes:[]}):buildStartupBaseGraph(e,{travelProviderApplier:w})}async function withRetries(e,t,n){let o=null;for(let i=1;i<=d;i+=1){E.attempts[e]=i,emit();try{return await n()}catch(a){o=a,i<d&&await delay(g)}}throw new Zy(`nexMap ${t.toLowerCase()} failed after ${d} attempt(s).`,{cause:o,phase:t})}function recordOptionalCapabilityWarnings(e){for(const t of e.capabilities.missingOptional)warn(`optional-capability:${t}`,`Optional Nexus capability missing: ${t}.`,Xy.BOOTING)}function warn(e,t,n){E.warnings.some(t=>t.code===e)||(E.warnings.push({code:e,message:t,phase:n}),notify(t,{color:"orange",level:"warning"}))}function degrade(e){const t=normalizeError(e);return reportStartupError(e,t),E.lastError=t,E.ready=!1,E.completed=!0,transition(Xy.DEGRADED,{completed:!0,lastError:t,ready:!1}),notify(t.message,{color:"red",level:"error"}),t.cause&&notify(t.cause,{color:"red",level:"error"}),getState()}function abortStartup(e){destroy(),"function"==typeof u&&u({app:t,error:e,state:getState()})}function notify(e,t){try{R.adapter?.client.notice(e,t),R.adapter||c?.nexusclient?.display_notice?.(String(e),t?.color??void 0)}catch{}}function destroy(){T=!0,R.rendererSettingsUnsub?.(),R.roomClickUnsubscribe?.(),R.runtimeGraphUnsubscribe?.(),R.sendCommandsUnsub?.(),R.sendQueueUnsub?.(),R.tab?.viewModel.destroy(),R.nurRiftManager?.dispose(),R.triggerPack?.dispose(),R.stepper?.dispose(),R.trackingController?.dispose(),R.denizenCollector?.dispose(),R.renderer?.destroy(),R.runtimeGraphController?.dispose(),R.eventBus?.dispose(),R.adapter?.destroy(),t.setStatus?.("destroyed")}return{destroy,getState,start,subscribe}}function bootstrapNexus({autoStart:e,globalObject:t=globalThis,host:n=t,...o}={}){const a=t.nexMap??t.nexMap4;if(a)return t.nexMap=a,a;const i=createNexMap(),s=createStartupCoordinator({app:i,host:n,...o,onFatalStartupAbort(){t.nexMap===i&&delete t.nexMap,t.nexMap4===i&&delete t.nexMap4}}),l=i.destroy.bind(i);return i.startup=s,i.start=s.start,i.getStartupState=s.getState,i.subscribeStartup=s.subscribe,i.destroy=()=>{s.destroy(),l()},t.nexMap=i,(e??shouldAutoStart(n))&&s.start(),i}function shouldAutoStart(e){return Boolean(e?.GMCP&&e?.eventStream&&e?.nexAction&&e?.nexusclient)}var Nb=bootstrapNexus({remoteConfig:resolveGlobalRemoteConfig(globalThis)});return Promise.resolve(Nb.start?.()).finally(()=>{updateNxs()}),Nb}(React,ReactDOM);