@nice-code/commander 0.113.0 → 0.114.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.
package/build/cli.cjs CHANGED
@@ -1623,7 +1623,7 @@ function jsErrorOrCastJsError(error, logMessage = true) {
1623
1623
  }
1624
1624
  //#endregion
1625
1625
  //#region ../nice-error/package.json
1626
- var version = "0.113.0";
1626
+ var version = "0.114.0";
1627
1627
  //#endregion
1628
1628
  //#region ../nice-error/src/utils/logger.ts
1629
1629
  let activeLogger = {
package/build/cli.mjs CHANGED
@@ -1624,7 +1624,7 @@ function jsErrorOrCastJsError(error, logMessage = true) {
1624
1624
  }
1625
1625
  //#endregion
1626
1626
  //#region ../nice-error/package.json
1627
- var version = "0.113.0";
1627
+ var version = "0.114.0";
1628
1628
  //#endregion
1629
1629
  //#region ../nice-error/src/utils/logger.ts
1630
1630
  let activeLogger = {
@@ -1,4 +1,4 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var S={H:null,A:null,T:null,S:null},C=Object.prototype.hasOwnProperty;function w(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ne(e,t){return w(e.type,t,e.props)}function re(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ie(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ae=/\/+/g;function T(e,t){return typeof e==`object`&&e&&e.key!=null?ie(``+e.key):t.toString(36)}function oe(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(te,te):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function se(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,se(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+T(e,0):a,ee(o)?(i=``,c!=null&&(i=c.replace(ae,`$&/`)+`/`),se(o,r,i,``,function(e){return e})):o!=null&&(re(o)&&(o=ne(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ae,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ee(e))for(var u=0;u<e.length;u++)a=e[u],s=l+T(a,u),c+=se(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+T(a,u++),c+=se(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return se(oe(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function E(e,t,n){if(e==null)return e;var r=[],i=0;return se(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function D(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ce=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},le={map:E,forEach:function(e,t,n){E(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return E(e,function(){t++}),t},toArray:function(e){return E(e,function(e){return e})||[]},only:function(e){if(!re(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=le,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return S.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!C.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return w(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)C.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return w(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=re,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:D}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=S.T,n={};S.T=n;try{var r=e(),i=S.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(te,ce)}catch(e){ce(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),S.T=t}},e.unstable_useCacheRefresh=function(){return S.H.useCacheRefresh()},e.use=function(e){return S.H.use(e)},e.useActionState=function(e,t,n){return S.H.useActionState(e,t,n)},e.useCallback=function(e,t){return S.H.useCallback(e,t)},e.useContext=function(e){return S.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return S.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return S.H.useEffect(e,t)},e.useEffectEvent=function(e){return S.H.useEffectEvent(e)},e.useId=function(){return S.H.useId()},e.useImperativeHandle=function(e,t,n){return S.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return S.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return S.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return S.H.useMemo(e,t)},e.useOptimistic=function(e,t){return S.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return S.H.useReducer(e,t,n)},e.useRef=function(e){return S.H.useRef(e)},e.useState=function(e){return S.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return S.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return S.H.useTransition()},e.version=`19.2.7`})),u=o(((e,t)=>{t.exports=l()})),d=c(u(),1),f=function(e){return e.context_unhydrated=`context_unhydrated`,e.hydrate_domain_mismatch=`hydrate_domain_mismatch`,e.from_context_empty=`from_context_empty`,e.handler_returned_promise_in_sync=`handler_returned_promise_in_sync`,e}({}),p;function m(e){p=e}function h(e,t){return p==null?Error(`[nice-error:${e}]${t==null?``:` ${JSON.stringify(t)}`}`):p(e,t)}function g(e){return e.def}function _(e,t=!0){if(e instanceof Error)return Object.assign(e,{message:e.message});let n=e?.message??(typeof e==`string`?e:`No error message found`);return t&&console.error(`An unknown and unstructured error was thrown: ${n}`,e),{...Error(n),...e}}var v=`0.113.0`,y={warn:(e,t)=>t===void 0?console.warn(e):console.warn(e,t),debug:(e,t)=>t===void 0?console.debug(e):console.debug(e,t),error:(e,t)=>t===void 0?console.error(e):console.error(e,t)};function b(){return y}var x=v,ee=Symbol.for(`@nice-code/error/versions`),te="Every @nice-code/* package must be on the same version (the lockstep rule): an error built by one copy of @nice-code/error fails `instanceof NiceError` in another. `nice-code-lockstep`, shipped in @nice-code/util, lists the versions installed.";function S(e,t=globalThis,n=e=>console.warn(e)){try{let r=Reflect.get(t,ee);if(r===void 0){Reflect.set(t,ee,[e]);return}if(!Array.isArray(r)||r.includes(e))return;let i=r.filter(e=>typeof e==`string`);r.push(e),n(`[@nice-code/error] Version ${e} was loaded beside ${i.join(`, `)}. ${te}`)}catch{}}var C=!1;function w(){if(!C){C=!0;try{b().warn(`[@nice-code/error] Version ${x} received an error built by an older copy of this package, one too old to report its version. ${te}`)}catch{}}}var ne=`NE_DUROBJ[[`,re=`]]NE_DUROBJ`,ie=`err_cast_not_nice`,ae=function(e){return e.no_pack=`no_pack`,e.msg_pack=`msg_pack`,e.cause_pack=`cause_pack`,e}({}),T=e=>(e._packedState={cause:e.cause,packedAs:ae.cause_pack},e.cause=`${ne}${JSON.stringify(e.toJsonObject())}${re}`,e),oe=e=>(e._packedState={message:e.cleanMessage,packedAs:ae.msg_pack},e.message=`${ne}${JSON.stringify(e.toJsonObject())}${re}`,e),se=(e,t=`msg_pack`)=>t===`no_pack`?e:t===`msg_pack`?oe(e):T(e),E=4;function D(e){if(e instanceof Error)return!0;if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.name==`string`&&typeof t.message==`string`}function ce(e,t=E){if(e==null)return e;if(D(e)){let n={name:e.name,message:e.message,stack:e.stack},r=e.errors;return Array.isArray(r)&&(n.errors=t>0?r.map(e=>ce(e,t-1)):[]),e.cause!=null&&t>0&&(n.cause=ce(e.cause,t-1)),n}try{return JSON.stringify(e),e}catch{return String(e)}}var le=function(e){return e.serde_unset=`serde_unset`,e.unhydrated=`unhydrated`,e.hydrated=`hydrated`,e}({}),ue=Symbol.for(`@nice-code/error`),de=class extends Error{name=`NiceError`;def;ids;httpStatusCode;timeCreated;cleanMessage;originError;_packedState;_errorDataMap;constructor(e){let t=e.message,n=`[${e.def.domain}](${e.ids.join(`,`)}) ${t}`;super(n),this.cleanMessage=t,this.def=e.def,this.ids=e.ids,this._errorDataMap=e.errorData??{},this.httpStatusCode=e.httpStatusCode??500,e.originError!=null&&(this.originError=e.originError),this.timeCreated=e.timeCreated??Date.now()}get isUnhandled(){return this.def.domain===ie}hasId(e){return e in this._errorDataMap}hasOneOfIds(e){return e.some(e=>e in this._errorDataMap)}get hasMultiple(){return Object.keys(this._errorDataMap).length>1}getIds(){return Object.keys(this._errorDataMap)}getContext(e){let t=this._errorDataMap[e]?.contextState;if(t!=null){if(t.kind===`unhydrated`)throw h(f.context_unhydrated,{id:String(e)});return t.value}}getErrorDataForId(e){return this._errorDataMap[e]}withOriginError(e){return this.originError=_(e),this._packedState?.packedAs!==ae.cause_pack&&(this.cause=this.originError),this}matches(e){let t=g(this),n=g(e);if(t.domain!==n.domain)return!1;let r=this.getIds().map(String).sort(),i=e.getIds().map(String).sort();return r.length===i.length?r.every((e,t)=>e===i[t]):!1}toJsonObject(){let e=this.originError?{name:this.originError.name,message:this.originError.cleanMessage??this.originError.message,stack:this.originError.stack,cause:ce(this.originError.cause),...Array.isArray(this.originError.errors)?{errors:this.originError.errors.map(e=>ce(e))}:{}}:void 0,t={domain:this.def.domain,allDomains:this.def.allDomains};this.def.defaultHttpStatusCode!=null&&(t.defaultHttpStatusCode=this.def.defaultHttpStatusCode),this.def.defaultMessage!=null&&(t.defaultMessage=this.def.defaultMessage);let n={};for(let e of Object.keys(this._errorDataMap)){let t=e,r=this._errorDataMap[t];if(r==null)continue;let i;i=r.contextState.kind===le.hydrated?{kind:le.unhydrated,serialized:r.contextState.serialized}:r.contextState,n[t]={contextState:i,message:r.message,httpStatusCode:r.httpStatusCode,timeAdded:r.timeAdded}}return{name:`NiceError`,def:t,ids:this.ids,errorData:n,isUnhandled:this.isUnhandled,message:this.cleanMessage,httpStatusCode:this.httpStatusCode,timeCreated:this.timeCreated,...this.stack==null?{}:{stack:this.stack},originError:e}}toJSON(){return this.toJsonObject()}toWireJsonObject(){let{stack:e,originError:t,...n}=this.toJsonObject();return n}toStructuredLog(){return{domain:this.def.domain,ids:this.getIds().map(String),message:this.cleanMessage,httpStatusCode:this.httpStatusCode,isUnhandled:this.isUnhandled,timeCreated:this.timeCreated,...this.originError==null?{}:{originError:this.originError}}}toJsonString(){return JSON.stringify(this.toJsonObject())}toHttpResponse(){return new Response(this.toJsonString(),{status:this.httpStatusCode,headers:{"Content-Type":`application/json`}})}hydrate(e){return e.hydrate(this)}handleWithSync(e,t={}){let n=Array.isArray(e)?e:[e];for(let e of n){let n=e.handleErrorWithPromiseInspection(this,t);if(n.matched)return n.isPromise&&b().warn(h(f.handler_returned_promise_in_sync,{identifier:n.target.identifier}).message),n.isPromise?void 0:n.handlerResponse}if(t.throwOnUnhandled===!0)throw this}async handleWithAsync(e,t={}){let n=Array.isArray(e)?e:[e];for(let e of n){let n=e.handleErrorWithPromiseInspection(this,t);if(n.matched)return n.isPromise?await n.handlerPromise:n.handlerResponse}if(t.throwOnUnhandled===!0)throw this}get isPacked(){return this._packedState!=null}pack(e=`msg_pack`){return this.isPacked?this:se(this,e)}unpack(){return this._packedState==null?this:(this._packedState.packedAs===ae.msg_pack&&(this.message=this._packedState.message),this._packedState.packedAs===ae.cause_pack&&(this.cause=this._packedState.cause),this._packedState=void 0,delete this._packedState,this)}};Object.defineProperty(de.prototype,ue,{value:!0}),S(x);function O(e){return typeof e==`object`&&!!e&&Reflect.get(e,ue)===!0}var k=class e extends de{def;niceErrorDefined;constructor(e){super(e),this.def=e.def,this.niceErrorDefined=e.niceErrorDefined}addContext(t){let n=Object.keys(t),r={};for(let e of n)r[e]=this.niceErrorDefined.reconcileErrorDataForId(e,t[e]);let i={...this._errorDataMap,...r},a=Array.from(new Set([...this.getIds(),...Object.keys(t)]));return new e({def:this.def,niceErrorDefined:this.niceErrorDefined,ids:a,errorData:i,message:this.cleanMessage,httpStatusCode:this.httpStatusCode,originError:this.originError})}addId(...t){let[n,r]=t,i=this.niceErrorDefined.reconcileErrorDataForId(n,r),a={};a[n]=i;let o={...this._errorDataMap,...a},s=Array.from(new Set([...this.getIds(),n]));return new e({def:this.def,niceErrorDefined:this.niceErrorDefined,ids:s,errorData:o,message:this.cleanMessage,httpStatusCode:this.httpStatusCode,originError:this.originError})}},fe=new Set;function pe(e){if(fe.size!==0)for(let t of fe)try{t(e)}catch{}}function me(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.name!==`NiceError`||typeof t.message!=`string`||typeof t.isUnhandled!=`boolean`||typeof t.httpStatusCode!=`number`)return!1;let n=t.ids;if(!Array.isArray(n)||!n.every(e=>typeof e==`string`))return!1;let r=t.def;if(typeof r!=`object`||!r)return!1;let i=r;if(typeof i.domain!=`string`||!Array.isArray(i.allDomains))return!1;let a=t.errorData;if(a!=null){if(typeof a!=`object`)return!1;for(let e of Object.values(a)){if(e==null)continue;if(typeof e!=`object`)return!1;let t=e.contextState;if(typeof t!=`object`||!t)return!1;let n=t.kind;if(n!==le.serde_unset&&n!==le.unhydrated)return!1}}return!0}function he(e){return e instanceof Error&&e.name===`NiceError`&&`toJsonObject`in e&&typeof e.toJsonObject==`function`}function ge(e){if(typeof e!=`object`||!e)return;let t=O(e);if(!(!t&&!he(e)))try{let n=e.toJsonObject();return me(n)?(t||w(),n):void 0}catch{return}}var _e=class e{domain;allDomains;defaultHttpStatusCode;defaultMessage;_schema;_definedChildNiceErrors=[];_definedParentNiceError;_setPack;_packAsFn;constructor(e){this.domain=e.domain,this.allDomains=e.allDomains,this._schema=e.schema,e.packAs!=null&&(this._packAsFn=e.packAs),e.defaultHttpStatusCode!=null&&(this.defaultHttpStatusCode=e.defaultHttpStatusCode),e.defaultMessage!=null&&(this.defaultMessage=e.defaultMessage)}createChildDomain(t){let n=new e({domain:t.domain,allDomains:[t.domain,...this.allDomains],schema:t.schema,defaultHttpStatusCode:t.defaultHttpStatusCode,defaultMessage:t.defaultMessage});return this.addChildNiceErrorDomain(n),n.addParentNiceErrorDomain(this),t.packAs==null?this._setPack?n.packAs(this._setPack):this._packAsFn&&(n._packAsFn=this._packAsFn):n._packAsFn=t.packAs,n}addParentNiceErrorDomain(e){this._definedParentNiceError?.domain!==e.domain&&(this._definedParentNiceError={domain:e.domain,definedError:e})}addChildNiceErrorDomain(e){this._definedChildNiceErrors.some(t=>t.domain===e.domain)||(this._definedChildNiceErrors.push({domain:e.domain,definedError:e}),this._definedParentNiceError&&this._definedParentNiceError.definedError.addChildNiceErrorDomain(e))}packAs(e){return this._setPack=e,this}createError(e){let t=new k(e);pe(t);let n=this._setPack??this._packAsFn?.();return n!=null&&n!==`no_pack`?t.pack(n):t}hydrate(e){let t=g(e);if(t.domain!==this.domain)throw h(f.hydrate_domain_mismatch,{expected:this.domain,received:t.domain});let n=this._ownInstanceOf(e),r={};for(let e of n.getIds()){let t=n.getErrorDataForId(e);if(t==null)continue;let i=t.contextState;if(i.kind===`unhydrated`){let t=this._schema[e]?.context?.serialization?.fromJsonSerializable;t!=null&&(i={kind:le.hydrated,value:t(i.serialized),serialized:i.serialized})}r[e]={contextState:i,message:t.message,httpStatusCode:t.httpStatusCode,timeAdded:t.timeAdded}}return new k({def:this._buildDef(),niceErrorDefined:this,ids:n.ids,errorData:r,message:n.cleanMessage??n.message,httpStatusCode:n.httpStatusCode,originError:n.originError,timeCreated:n.timeCreated})}fromId(...e){let[t,n]=e,r=this.reconcileErrorDataForId(t,n),i={};i[t]=r;let a=this.createError({def:this._buildDef(),niceErrorDefined:this,ids:[t],errorData:i,message:r.message,httpStatusCode:r.httpStatusCode});return typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(a,this.fromId),a}fromContext(e){let t=Object.keys(e);if(t.length===0)throw h(f.from_context_empty,void 0);let n={};for(let r of t)n[r]=this.reconcileErrorDataForId(r,e[r]);let r=t[0],i=this.createError({def:this._buildDef(),niceErrorDefined:this,ids:t,errorData:n,message:n[r].message,httpStatusCode:n[r].httpStatusCode});return typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(i,this.fromContext),i}isExact(e){return O(e)?g(e).domain===this.domain:!1}isThisOrChild(e){if(!O(e))return!1;let t=g(e).allDomains;return Array.isArray(t)&&t.includes(this.domain)}isParentOf(e){let t=O(e)?g(e).allDomains:e.allDomains;return Array.isArray(t)&&t.includes(this.domain)}_ownInstanceOf(e){if(e instanceof de)return e;let t=ge(e);return t==null?new de(e):new de(t)}_buildDef(){return{domain:this.domain,allDomains:this.allDomains,schema:this._schema}}_resolveMessage(e,t){let n=this._schema[e];return typeof n?.message==`function`?n.message(t):typeof n?.message==`string`?n.message:this.defaultMessage??`[${this.domain}::${e}] An error occurred.`}_resolveHttpStatusCode(e,t){let n=this._schema[e],r;return typeof n?.httpStatusCode==`function`&&(r=n.httpStatusCode(t)),typeof n?.httpStatusCode==`number`&&(r=n.httpStatusCode),typeof r==`number`?r:this.defaultHttpStatusCode??500}reconcileErrorDataForId(e,t){let n=this._resolveMessage(e,t),r=this._resolveHttpStatusCode(e,t),i=this._schema[e],a;if(t!=null&&i?.context?.serialization!=null){let e=i.context.serialization.toJsonSerializable(t);a={kind:le.hydrated,value:t,serialized:e}}else a={kind:le.serde_unset,value:t};return{contextState:a,message:n,httpStatusCode:r,timeAdded:Date.now()}}},ve=e=>new _e({domain:e.domain,allDomains:[e.domain],schema:e.schema,...e.packAs==null?{}:{packAs:e.packAs}});function A(e){return e??{}}var ye=422,be=500,xe=ve({domain:`err_nice`,schema:{}}),Se=function(e){return e.js_error=`native_error`,e.js_error_like_object=`js_error_like_object`,e.nullish_value=`nullish_value`,e.js_data_type=`js_data_type`,e.js_other=`js_other`,e}({}),Ce=xe.createChildDomain({domain:`err_cast_not_nice`,defaultHttpStatusCode:ye,schema:{native_error:A({context:{required:!0},message:({jsError:e})=>`A native JavaScript Error was encountered during casting: ${e.message}`,httpStatusCode:be}),js_error_like_object:A({context:{required:!0},message:({jsErrorObject:e})=>`An object resembling a JavaScript Error was encountered during casting: [${e.name}] ${e.message}`,httpStatusCode:be}),nullish_value:A({context:{required:!0},message:({value:e})=>`A nullish value [${e===null?`null`:`undefined`}] was encountered during casting`}),js_data_type:A({context:{required:!0},message:({jsDataType:e,jsDataValue:t})=>{let n;try{n=JSON.stringify(t)}catch{}return`A value of type [${e}] with value [${n??`UNSERIALIZABLE`}] was encountered during casting, which is not a valid error type`}}),js_other:A({context:{required:!0},message:({jsDataValue:e})=>{let t;try{t=JSON.stringify(e)}catch{}return`An unhandled type [${typeof e}] with value [${t??`UNSERIALIZABLE`}] was encountered during casting, which is not a valid error type`}})}});xe.createChildDomain({domain:`err_nice_handler`,schema:{}});var we=xe.createChildDomain({domain:`err_nice_error`,defaultHttpStatusCode:be,schema:{[f.context_unhydrated]:A({context:{required:!0},message:({id:e})=>`[NiceError.getContext] Context for id "${e}" is in the "unhydrated" state. The error was reconstructed from a serialized payload but has not been deserialized yet. Call \`niceErrorDomain.hydrate(error)\` to reconstruct the typed context.`}),[f.hydrate_domain_mismatch]:A({context:{required:!0},message:({expected:e,received:t})=>`[NiceErrorDomain.hydrate] Domain mismatch: this definition is "${e}" but the error belongs to "${t}". Call \`niceErrorDomain.isExact(error)\` before hydrating to ensure compatibility.`}),[f.from_context_empty]:A({message:`[NiceErrorDomain.fromContext] context object must contain at least one error id.`}),[f.handler_returned_promise_in_sync]:A({context:{required:!0},message:({identifier:e})=>`[NiceError.handleWithSync] Handler ${e} returned a Promise but was called via \`handleWithSync\` (synchronous). The Promise will not be awaited. Use \`handleWithAsync\` for async handlers.`})}});m((e,t)=>we.fromId(e,t));function Te(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.name==`string`&&typeof t.message==`string`}var Ee=function(e){return e.nullish=`nullish`,e.niceErrorObject=`niceErrorObject`,e.niceError=`niceError`,e.jsError=`jsError`,e.jsErrorObject=`jsErrorObject`,e.jsDataType=`jsDataType`,e.jsOther=`jsOther`,e}({});function De(e){let t;if(typeof e.message==`string`&&e.message.includes(`NE_DUROBJ[[`)&&e.message.includes(`]]NE_DUROBJ`)&&(t=e.message),typeof e.cause==`string`&&e.cause.includes(`NE_DUROBJ[[`)&&e.cause.includes(`]]NE_DUROBJ`)&&(t=e.cause),t!=null){let e=t.split(ne)[1].split(re)[0];try{let t=JSON.parse(e);if(me(t))return{type:Ee.niceErrorObject,niceErrorObject:t}}catch{}}return null}var Oe=e=>{if(e==null)return{type:Ee.nullish,value:e};if(typeof e==`number`)return{type:Ee.jsDataType,jsDataType:`number`,jsDataValue:e};if(typeof e==`boolean`)return{type:Ee.jsDataType,jsDataType:`boolean`,jsDataValue:e};let t=e;if(typeof e==`string`)if(e.includes(`{`)&&e.includes(`name`))try{t=JSON.parse(e)}catch{return{type:Ee.jsDataType,jsDataType:`string`,jsDataValue:e}}else return{type:Ee.jsDataType,jsDataType:`string`,jsDataValue:e};if(typeof t!=`object`||!t)return b().warn(`Received a potential error that is a primitive data type other than string, number, or boolean. This is unexpected and may indicate an issue with error handling in the code.`,{potentialError:e}),{jsDataValue:e,type:Ee.jsOther};if(t instanceof de)return{type:Ee.niceError,niceError:t};let n=ge(t);return n==null?me(t)?{type:Ee.niceErrorObject,niceErrorObject:t}:t instanceof Error?De(t)??{type:Ee.jsError,jsError:t}:Te(t)?De(t)??{type:Ee.jsErrorObject,jsErrorObject:t}:{type:Ee.jsDataType,jsDataType:`object`,jsDataValue:t}:{type:Ee.niceErrorObject,niceErrorObject:n}},ke=e=>{let t=Oe(e);switch(t.type){case Ee.niceError:return t.niceError;case Ee.niceErrorObject:{let e=t.niceErrorObject;return new de(e)}case Ee.jsError:return Ce.fromContext({[Se.js_error]:t}).withOriginError(t.jsError);case Ee.jsErrorObject:{let e=Ce.fromContext({[Se.js_error_like_object]:t});return e.cause=t.jsErrorObject,e}case Ee.nullish:return Ce.fromContext({[Se.nullish_value]:t});case Ee.jsDataType:return Ce.fromContext({[Se.js_data_type]:t});default:return Ce.fromContext({[Se.js_other]:t})}};async function Ae(e){try{return{ok:!0,output:await e()}}catch(e){return{ok:!1,error:ke(e)}}}var je=function(e){return e.unsafe_css_value=`unsafe_css_value`,e.alpha_derivation_unsupported=`alpha_derivation_unsupported`,e.style_reference_unreadable=`style_reference_unreadable`,e.contrast_failed=`contrast_failed`,e}({}),Me=xe.createChildDomain({domain:`err_ui`,schema:{unsafe_css_value:A({message:({property:e,value:t})=>`nice-ui refused to emit ${e}: the value contains CSS-terminating characters (${JSON.stringify(t)}). A theme compiled from an untrusted document cannot be allowed to close a declaration and open its own.`}),alpha_derivation_unsupported:A({message:({value:e})=>`nice-ui cannot derive alpha from ${JSON.stringify(e)}: a 6-digit hex colour is required. Appending alpha to an rgb()/rgba() value produces a string that is not a colour at all, and the style silently drops.`}),style_reference_unreadable:A({message:({reason:e,line:t,column:n})=>`nice-ui could not read the style reference: ${e}`+(t==null?``:` (line ${t}${n==null?``:`, column ${n}`})`)}),contrast_failed:A({message:({pairs:e,scheme:t})=>`nice-ui: ${e.length} contrast pair(s) fail in the ${t} scheme with no ledger entry: ${e.slice(0,5).join(`, `)}${e.length>5?`, …`:``}.`})}}),Ne=`textEmphasis.textSecondary.textMuted.textFaint.semanticError.semanticSuccess.semanticSystem.semanticWarning.semanticMetadata.primary.onPrimary.errorSurface.onErrorSurface.surfaceVoid.surfaceBase.surfaceSelected.surfaceDetail.surfaceDetailHeader.surfaceSection.surfaceSectionAlt.borderPanel.borderDivider.dialogBackdrop.tooltipBackground.tooltipTitleBackground.tooltipTitleBorder.tooltipBorder.jsonKey.jsonString.jsonNumber.jsonKeyword.jsonPunctuation.scrollbarThumb.scrollbarThumbHover.focusRing`.split(`.`);new Set(Ne);var Pe=`data-nice-ui-scheme`,Fe=`data-nice-ui-scheme-source`,Ie=`--nice-ui`;function Le(e){return`${Ie}-${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`}function Re(e){return`${Ie}-lane-accent-${e}`}var ze=/[;{}<>\\]|\/\*|\*\//;function Be(e,t){if(ze.test(t))throw Me.fromId(je.unsafe_css_value,{property:e,value:t});return`${e}: ${t};`}function Ve(e,t){let n=e.schemes[t],r=[];for(let e of Ne)r.push(Be(Le(e),n[e]));return n.laneAccents.forEach((e,t)=>{r.push(Be(Re(t),e))}),r.push(Be(`${Ie}-lane-accent-count`,String(n.laneAccents.length))),r.push(Be(`color-scheme`,t)),r}function He(e,t){if(!Number.isFinite(t))throw Me.fromId(je.unsafe_css_value,{property:e,value:String(t)});return`${e}: ${t}px;`}function Ue(e,t){return[e,...t].map(e=>/^[a-zA-Z][a-zA-Z0-9-]*$/.test(e)?e:`'${e.replace(/'/g,``)}'`).join(`, `)}function We(e){let t=[];for(let[n,r]of Object.entries(e.typography)){let e=`${Ie}-font-${n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;t.push(Be(`${e}-family`,Ue(r.fontFamily,r.fontFamilyFallbacks))),t.push(He(`${e}-size`,r.fontSize)),t.push(Be(`${e}-weight`,r.fontWeight)),t.push(He(`${e}-line-height`,r.lineHeight)),r.letterSpacing!=null&&t.push(He(`${e}-letter-spacing`,r.letterSpacing))}for(let[n,r]of Object.entries(e.rounded))t.push(He(`${Ie}-rounded-${n}`,r));for(let[n,r]of Object.entries(e.spacing))t.push(He(`${Ie}-space-${n}`,r));for(let[n,r]of Object.entries(e.elevation))t.push(He(`${Ie}-elevation-${n}-offset-y`,r.offsetY)),t.push(He(`${Ie}-elevation-${n}-blur`,r.blur)),t.push(He(`${Ie}-elevation-${n}-spread`,r.spread));return t}function Ge(e,t){return`${e} {\n ${t.join(`
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var ee=Array.isArray;function te(){}var S={H:null,A:null,T:null,S:null},C=Object.prototype.hasOwnProperty;function w(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ne(e,t){return w(e.type,t,e.props)}function re(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function ie(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ae=/\/+/g;function T(e,t){return typeof e==`object`&&e&&e.key!=null?ie(``+e.key):t.toString(36)}function oe(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(te,te):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function se(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,se(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+T(e,0):a,ee(o)?(i=``,c!=null&&(i=c.replace(ae,`$&/`)+`/`),se(o,r,i,``,function(e){return e})):o!=null&&(re(o)&&(o=ne(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ae,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ee(e))for(var u=0;u<e.length;u++)a=e[u],s=l+T(a,u),c+=se(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+T(a,u++),c+=se(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return se(oe(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function E(e,t,n){if(e==null)return e;var r=[],i=0;return se(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function D(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var ce=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},le={map:E,forEach:function(e,t,n){E(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return E(e,function(){t++}),t},toArray:function(e){return E(e,function(e){return e})||[]},only:function(e){if(!re(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=le,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return S.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!C.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return w(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)C.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return w(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=re,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:D}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=S.T,n={};S.T=n;try{var r=e(),i=S.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(te,ce)}catch(e){ce(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),S.T=t}},e.unstable_useCacheRefresh=function(){return S.H.useCacheRefresh()},e.use=function(e){return S.H.use(e)},e.useActionState=function(e,t,n){return S.H.useActionState(e,t,n)},e.useCallback=function(e,t){return S.H.useCallback(e,t)},e.useContext=function(e){return S.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return S.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return S.H.useEffect(e,t)},e.useEffectEvent=function(e){return S.H.useEffectEvent(e)},e.useId=function(){return S.H.useId()},e.useImperativeHandle=function(e,t,n){return S.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return S.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return S.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return S.H.useMemo(e,t)},e.useOptimistic=function(e,t){return S.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return S.H.useReducer(e,t,n)},e.useRef=function(e){return S.H.useRef(e)},e.useState=function(e){return S.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return S.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return S.H.useTransition()},e.version=`19.2.7`})),u=o(((e,t)=>{t.exports=l()})),d=c(u(),1),f=function(e){return e.context_unhydrated=`context_unhydrated`,e.hydrate_domain_mismatch=`hydrate_domain_mismatch`,e.from_context_empty=`from_context_empty`,e.handler_returned_promise_in_sync=`handler_returned_promise_in_sync`,e}({}),p;function m(e){p=e}function h(e,t){return p==null?Error(`[nice-error:${e}]${t==null?``:` ${JSON.stringify(t)}`}`):p(e,t)}function g(e){return e.def}function _(e,t=!0){if(e instanceof Error)return Object.assign(e,{message:e.message});let n=e?.message??(typeof e==`string`?e:`No error message found`);return t&&console.error(`An unknown and unstructured error was thrown: ${n}`,e),{...Error(n),...e}}var v=`0.114.0`,y={warn:(e,t)=>t===void 0?console.warn(e):console.warn(e,t),debug:(e,t)=>t===void 0?console.debug(e):console.debug(e,t),error:(e,t)=>t===void 0?console.error(e):console.error(e,t)};function b(){return y}var x=v,ee=Symbol.for(`@nice-code/error/versions`),te="Every @nice-code/* package must be on the same version (the lockstep rule): an error built by one copy of @nice-code/error fails `instanceof NiceError` in another. `nice-code-lockstep`, shipped in @nice-code/util, lists the versions installed.";function S(e,t=globalThis,n=e=>console.warn(e)){try{let r=Reflect.get(t,ee);if(r===void 0){Reflect.set(t,ee,[e]);return}if(!Array.isArray(r)||r.includes(e))return;let i=r.filter(e=>typeof e==`string`);r.push(e),n(`[@nice-code/error] Version ${e} was loaded beside ${i.join(`, `)}. ${te}`)}catch{}}var C=!1;function w(){if(!C){C=!0;try{b().warn(`[@nice-code/error] Version ${x} received an error built by an older copy of this package, one too old to report its version. ${te}`)}catch{}}}var ne=`NE_DUROBJ[[`,re=`]]NE_DUROBJ`,ie=`err_cast_not_nice`,ae=function(e){return e.no_pack=`no_pack`,e.msg_pack=`msg_pack`,e.cause_pack=`cause_pack`,e}({}),T=e=>(e._packedState={cause:e.cause,packedAs:ae.cause_pack},e.cause=`${ne}${JSON.stringify(e.toJsonObject())}${re}`,e),oe=e=>(e._packedState={message:e.cleanMessage,packedAs:ae.msg_pack},e.message=`${ne}${JSON.stringify(e.toJsonObject())}${re}`,e),se=(e,t=`msg_pack`)=>t===`no_pack`?e:t===`msg_pack`?oe(e):T(e),E=4;function D(e){if(e instanceof Error)return!0;if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.name==`string`&&typeof t.message==`string`}function ce(e,t=E){if(e==null)return e;if(D(e)){let n={name:e.name,message:e.message,stack:e.stack},r=e.errors;return Array.isArray(r)&&(n.errors=t>0?r.map(e=>ce(e,t-1)):[]),e.cause!=null&&t>0&&(n.cause=ce(e.cause,t-1)),n}try{return JSON.stringify(e),e}catch{return String(e)}}var le=function(e){return e.serde_unset=`serde_unset`,e.unhydrated=`unhydrated`,e.hydrated=`hydrated`,e}({}),ue=Symbol.for(`@nice-code/error`),de=class extends Error{name=`NiceError`;def;ids;httpStatusCode;timeCreated;cleanMessage;originError;_packedState;_errorDataMap;constructor(e){let t=e.message,n=`[${e.def.domain}](${e.ids.join(`,`)}) ${t}`;super(n),this.cleanMessage=t,this.def=e.def,this.ids=e.ids,this._errorDataMap=e.errorData??{},this.httpStatusCode=e.httpStatusCode??500,e.originError!=null&&(this.originError=e.originError),this.timeCreated=e.timeCreated??Date.now()}get isUnhandled(){return this.def.domain===ie}hasId(e){return e in this._errorDataMap}hasOneOfIds(e){return e.some(e=>e in this._errorDataMap)}get hasMultiple(){return Object.keys(this._errorDataMap).length>1}getIds(){return Object.keys(this._errorDataMap)}getContext(e){let t=this._errorDataMap[e]?.contextState;if(t!=null){if(t.kind===`unhydrated`)throw h(f.context_unhydrated,{id:String(e)});return t.value}}getErrorDataForId(e){return this._errorDataMap[e]}withOriginError(e){return this.originError=_(e),this._packedState?.packedAs!==ae.cause_pack&&(this.cause=this.originError),this}matches(e){let t=g(this),n=g(e);if(t.domain!==n.domain)return!1;let r=this.getIds().map(String).sort(),i=e.getIds().map(String).sort();return r.length===i.length?r.every((e,t)=>e===i[t]):!1}toJsonObject(){let e=this.originError?{name:this.originError.name,message:this.originError.cleanMessage??this.originError.message,stack:this.originError.stack,cause:ce(this.originError.cause),...Array.isArray(this.originError.errors)?{errors:this.originError.errors.map(e=>ce(e))}:{}}:void 0,t={domain:this.def.domain,allDomains:this.def.allDomains};this.def.defaultHttpStatusCode!=null&&(t.defaultHttpStatusCode=this.def.defaultHttpStatusCode),this.def.defaultMessage!=null&&(t.defaultMessage=this.def.defaultMessage);let n={};for(let e of Object.keys(this._errorDataMap)){let t=e,r=this._errorDataMap[t];if(r==null)continue;let i;i=r.contextState.kind===le.hydrated?{kind:le.unhydrated,serialized:r.contextState.serialized}:r.contextState,n[t]={contextState:i,message:r.message,httpStatusCode:r.httpStatusCode,timeAdded:r.timeAdded}}return{name:`NiceError`,def:t,ids:this.ids,errorData:n,isUnhandled:this.isUnhandled,message:this.cleanMessage,httpStatusCode:this.httpStatusCode,timeCreated:this.timeCreated,...this.stack==null?{}:{stack:this.stack},originError:e}}toJSON(){return this.toJsonObject()}toWireJsonObject(){let{stack:e,originError:t,...n}=this.toJsonObject();return n}toStructuredLog(){return{domain:this.def.domain,ids:this.getIds().map(String),message:this.cleanMessage,httpStatusCode:this.httpStatusCode,isUnhandled:this.isUnhandled,timeCreated:this.timeCreated,...this.originError==null?{}:{originError:this.originError}}}toJsonString(){return JSON.stringify(this.toJsonObject())}toHttpResponse(){return new Response(this.toJsonString(),{status:this.httpStatusCode,headers:{"Content-Type":`application/json`}})}hydrate(e){return e.hydrate(this)}handleWithSync(e,t={}){let n=Array.isArray(e)?e:[e];for(let e of n){let n=e.handleErrorWithPromiseInspection(this,t);if(n.matched)return n.isPromise&&b().warn(h(f.handler_returned_promise_in_sync,{identifier:n.target.identifier}).message),n.isPromise?void 0:n.handlerResponse}if(t.throwOnUnhandled===!0)throw this}async handleWithAsync(e,t={}){let n=Array.isArray(e)?e:[e];for(let e of n){let n=e.handleErrorWithPromiseInspection(this,t);if(n.matched)return n.isPromise?await n.handlerPromise:n.handlerResponse}if(t.throwOnUnhandled===!0)throw this}get isPacked(){return this._packedState!=null}pack(e=`msg_pack`){return this.isPacked?this:se(this,e)}unpack(){return this._packedState==null?this:(this._packedState.packedAs===ae.msg_pack&&(this.message=this._packedState.message),this._packedState.packedAs===ae.cause_pack&&(this.cause=this._packedState.cause),this._packedState=void 0,delete this._packedState,this)}};Object.defineProperty(de.prototype,ue,{value:!0}),S(x);function O(e){return typeof e==`object`&&!!e&&Reflect.get(e,ue)===!0}var k=class e extends de{def;niceErrorDefined;constructor(e){super(e),this.def=e.def,this.niceErrorDefined=e.niceErrorDefined}addContext(t){let n=Object.keys(t),r={};for(let e of n)r[e]=this.niceErrorDefined.reconcileErrorDataForId(e,t[e]);let i={...this._errorDataMap,...r},a=Array.from(new Set([...this.getIds(),...Object.keys(t)]));return new e({def:this.def,niceErrorDefined:this.niceErrorDefined,ids:a,errorData:i,message:this.cleanMessage,httpStatusCode:this.httpStatusCode,originError:this.originError})}addId(...t){let[n,r]=t,i=this.niceErrorDefined.reconcileErrorDataForId(n,r),a={};a[n]=i;let o={...this._errorDataMap,...a},s=Array.from(new Set([...this.getIds(),n]));return new e({def:this.def,niceErrorDefined:this.niceErrorDefined,ids:s,errorData:o,message:this.cleanMessage,httpStatusCode:this.httpStatusCode,originError:this.originError})}},fe=new Set;function pe(e){if(fe.size!==0)for(let t of fe)try{t(e)}catch{}}function me(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.name!==`NiceError`||typeof t.message!=`string`||typeof t.isUnhandled!=`boolean`||typeof t.httpStatusCode!=`number`)return!1;let n=t.ids;if(!Array.isArray(n)||!n.every(e=>typeof e==`string`))return!1;let r=t.def;if(typeof r!=`object`||!r)return!1;let i=r;if(typeof i.domain!=`string`||!Array.isArray(i.allDomains))return!1;let a=t.errorData;if(a!=null){if(typeof a!=`object`)return!1;for(let e of Object.values(a)){if(e==null)continue;if(typeof e!=`object`)return!1;let t=e.contextState;if(typeof t!=`object`||!t)return!1;let n=t.kind;if(n!==le.serde_unset&&n!==le.unhydrated)return!1}}return!0}function he(e){return e instanceof Error&&e.name===`NiceError`&&`toJsonObject`in e&&typeof e.toJsonObject==`function`}function ge(e){if(typeof e!=`object`||!e)return;let t=O(e);if(!(!t&&!he(e)))try{let n=e.toJsonObject();return me(n)?(t||w(),n):void 0}catch{return}}var _e=class e{domain;allDomains;defaultHttpStatusCode;defaultMessage;_schema;_definedChildNiceErrors=[];_definedParentNiceError;_setPack;_packAsFn;constructor(e){this.domain=e.domain,this.allDomains=e.allDomains,this._schema=e.schema,e.packAs!=null&&(this._packAsFn=e.packAs),e.defaultHttpStatusCode!=null&&(this.defaultHttpStatusCode=e.defaultHttpStatusCode),e.defaultMessage!=null&&(this.defaultMessage=e.defaultMessage)}createChildDomain(t){let n=new e({domain:t.domain,allDomains:[t.domain,...this.allDomains],schema:t.schema,defaultHttpStatusCode:t.defaultHttpStatusCode,defaultMessage:t.defaultMessage});return this.addChildNiceErrorDomain(n),n.addParentNiceErrorDomain(this),t.packAs==null?this._setPack?n.packAs(this._setPack):this._packAsFn&&(n._packAsFn=this._packAsFn):n._packAsFn=t.packAs,n}addParentNiceErrorDomain(e){this._definedParentNiceError?.domain!==e.domain&&(this._definedParentNiceError={domain:e.domain,definedError:e})}addChildNiceErrorDomain(e){this._definedChildNiceErrors.some(t=>t.domain===e.domain)||(this._definedChildNiceErrors.push({domain:e.domain,definedError:e}),this._definedParentNiceError&&this._definedParentNiceError.definedError.addChildNiceErrorDomain(e))}packAs(e){return this._setPack=e,this}createError(e){let t=new k(e);pe(t);let n=this._setPack??this._packAsFn?.();return n!=null&&n!==`no_pack`?t.pack(n):t}hydrate(e){let t=g(e);if(t.domain!==this.domain)throw h(f.hydrate_domain_mismatch,{expected:this.domain,received:t.domain});let n=this._ownInstanceOf(e),r={};for(let e of n.getIds()){let t=n.getErrorDataForId(e);if(t==null)continue;let i=t.contextState;if(i.kind===`unhydrated`){let t=this._schema[e]?.context?.serialization?.fromJsonSerializable;t!=null&&(i={kind:le.hydrated,value:t(i.serialized),serialized:i.serialized})}r[e]={contextState:i,message:t.message,httpStatusCode:t.httpStatusCode,timeAdded:t.timeAdded}}return new k({def:this._buildDef(),niceErrorDefined:this,ids:n.ids,errorData:r,message:n.cleanMessage??n.message,httpStatusCode:n.httpStatusCode,originError:n.originError,timeCreated:n.timeCreated})}fromId(...e){let[t,n]=e,r=this.reconcileErrorDataForId(t,n),i={};i[t]=r;let a=this.createError({def:this._buildDef(),niceErrorDefined:this,ids:[t],errorData:i,message:r.message,httpStatusCode:r.httpStatusCode});return typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(a,this.fromId),a}fromContext(e){let t=Object.keys(e);if(t.length===0)throw h(f.from_context_empty,void 0);let n={};for(let r of t)n[r]=this.reconcileErrorDataForId(r,e[r]);let r=t[0],i=this.createError({def:this._buildDef(),niceErrorDefined:this,ids:t,errorData:n,message:n[r].message,httpStatusCode:n[r].httpStatusCode});return typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(i,this.fromContext),i}isExact(e){return O(e)?g(e).domain===this.domain:!1}isThisOrChild(e){if(!O(e))return!1;let t=g(e).allDomains;return Array.isArray(t)&&t.includes(this.domain)}isParentOf(e){let t=O(e)?g(e).allDomains:e.allDomains;return Array.isArray(t)&&t.includes(this.domain)}_ownInstanceOf(e){if(e instanceof de)return e;let t=ge(e);return t==null?new de(e):new de(t)}_buildDef(){return{domain:this.domain,allDomains:this.allDomains,schema:this._schema}}_resolveMessage(e,t){let n=this._schema[e];return typeof n?.message==`function`?n.message(t):typeof n?.message==`string`?n.message:this.defaultMessage??`[${this.domain}::${e}] An error occurred.`}_resolveHttpStatusCode(e,t){let n=this._schema[e],r;return typeof n?.httpStatusCode==`function`&&(r=n.httpStatusCode(t)),typeof n?.httpStatusCode==`number`&&(r=n.httpStatusCode),typeof r==`number`?r:this.defaultHttpStatusCode??500}reconcileErrorDataForId(e,t){let n=this._resolveMessage(e,t),r=this._resolveHttpStatusCode(e,t),i=this._schema[e],a;if(t!=null&&i?.context?.serialization!=null){let e=i.context.serialization.toJsonSerializable(t);a={kind:le.hydrated,value:t,serialized:e}}else a={kind:le.serde_unset,value:t};return{contextState:a,message:n,httpStatusCode:r,timeAdded:Date.now()}}},ve=e=>new _e({domain:e.domain,allDomains:[e.domain],schema:e.schema,...e.packAs==null?{}:{packAs:e.packAs}});function A(e){return e??{}}var ye=422,be=500,xe=ve({domain:`err_nice`,schema:{}}),Se=function(e){return e.js_error=`native_error`,e.js_error_like_object=`js_error_like_object`,e.nullish_value=`nullish_value`,e.js_data_type=`js_data_type`,e.js_other=`js_other`,e}({}),Ce=xe.createChildDomain({domain:`err_cast_not_nice`,defaultHttpStatusCode:ye,schema:{native_error:A({context:{required:!0},message:({jsError:e})=>`A native JavaScript Error was encountered during casting: ${e.message}`,httpStatusCode:be}),js_error_like_object:A({context:{required:!0},message:({jsErrorObject:e})=>`An object resembling a JavaScript Error was encountered during casting: [${e.name}] ${e.message}`,httpStatusCode:be}),nullish_value:A({context:{required:!0},message:({value:e})=>`A nullish value [${e===null?`null`:`undefined`}] was encountered during casting`}),js_data_type:A({context:{required:!0},message:({jsDataType:e,jsDataValue:t})=>{let n;try{n=JSON.stringify(t)}catch{}return`A value of type [${e}] with value [${n??`UNSERIALIZABLE`}] was encountered during casting, which is not a valid error type`}}),js_other:A({context:{required:!0},message:({jsDataValue:e})=>{let t;try{t=JSON.stringify(e)}catch{}return`An unhandled type [${typeof e}] with value [${t??`UNSERIALIZABLE`}] was encountered during casting, which is not a valid error type`}})}});xe.createChildDomain({domain:`err_nice_handler`,schema:{}});var we=xe.createChildDomain({domain:`err_nice_error`,defaultHttpStatusCode:be,schema:{[f.context_unhydrated]:A({context:{required:!0},message:({id:e})=>`[NiceError.getContext] Context for id "${e}" is in the "unhydrated" state. The error was reconstructed from a serialized payload but has not been deserialized yet. Call \`niceErrorDomain.hydrate(error)\` to reconstruct the typed context.`}),[f.hydrate_domain_mismatch]:A({context:{required:!0},message:({expected:e,received:t})=>`[NiceErrorDomain.hydrate] Domain mismatch: this definition is "${e}" but the error belongs to "${t}". Call \`niceErrorDomain.isExact(error)\` before hydrating to ensure compatibility.`}),[f.from_context_empty]:A({message:`[NiceErrorDomain.fromContext] context object must contain at least one error id.`}),[f.handler_returned_promise_in_sync]:A({context:{required:!0},message:({identifier:e})=>`[NiceError.handleWithSync] Handler ${e} returned a Promise but was called via \`handleWithSync\` (synchronous). The Promise will not be awaited. Use \`handleWithAsync\` for async handlers.`})}});m((e,t)=>we.fromId(e,t));function Te(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.name==`string`&&typeof t.message==`string`}var Ee=function(e){return e.nullish=`nullish`,e.niceErrorObject=`niceErrorObject`,e.niceError=`niceError`,e.jsError=`jsError`,e.jsErrorObject=`jsErrorObject`,e.jsDataType=`jsDataType`,e.jsOther=`jsOther`,e}({});function De(e){let t;if(typeof e.message==`string`&&e.message.includes(`NE_DUROBJ[[`)&&e.message.includes(`]]NE_DUROBJ`)&&(t=e.message),typeof e.cause==`string`&&e.cause.includes(`NE_DUROBJ[[`)&&e.cause.includes(`]]NE_DUROBJ`)&&(t=e.cause),t!=null){let e=t.split(ne)[1].split(re)[0];try{let t=JSON.parse(e);if(me(t))return{type:Ee.niceErrorObject,niceErrorObject:t}}catch{}}return null}var Oe=e=>{if(e==null)return{type:Ee.nullish,value:e};if(typeof e==`number`)return{type:Ee.jsDataType,jsDataType:`number`,jsDataValue:e};if(typeof e==`boolean`)return{type:Ee.jsDataType,jsDataType:`boolean`,jsDataValue:e};let t=e;if(typeof e==`string`)if(e.includes(`{`)&&e.includes(`name`))try{t=JSON.parse(e)}catch{return{type:Ee.jsDataType,jsDataType:`string`,jsDataValue:e}}else return{type:Ee.jsDataType,jsDataType:`string`,jsDataValue:e};if(typeof t!=`object`||!t)return b().warn(`Received a potential error that is a primitive data type other than string, number, or boolean. This is unexpected and may indicate an issue with error handling in the code.`,{potentialError:e}),{jsDataValue:e,type:Ee.jsOther};if(t instanceof de)return{type:Ee.niceError,niceError:t};let n=ge(t);return n==null?me(t)?{type:Ee.niceErrorObject,niceErrorObject:t}:t instanceof Error?De(t)??{type:Ee.jsError,jsError:t}:Te(t)?De(t)??{type:Ee.jsErrorObject,jsErrorObject:t}:{type:Ee.jsDataType,jsDataType:`object`,jsDataValue:t}:{type:Ee.niceErrorObject,niceErrorObject:n}},ke=e=>{let t=Oe(e);switch(t.type){case Ee.niceError:return t.niceError;case Ee.niceErrorObject:{let e=t.niceErrorObject;return new de(e)}case Ee.jsError:return Ce.fromContext({[Se.js_error]:t}).withOriginError(t.jsError);case Ee.jsErrorObject:{let e=Ce.fromContext({[Se.js_error_like_object]:t});return e.cause=t.jsErrorObject,e}case Ee.nullish:return Ce.fromContext({[Se.nullish_value]:t});case Ee.jsDataType:return Ce.fromContext({[Se.js_data_type]:t});default:return Ce.fromContext({[Se.js_other]:t})}};async function Ae(e){try{return{ok:!0,output:await e()}}catch(e){return{ok:!1,error:ke(e)}}}var je=function(e){return e.unsafe_css_value=`unsafe_css_value`,e.alpha_derivation_unsupported=`alpha_derivation_unsupported`,e.style_reference_unreadable=`style_reference_unreadable`,e.contrast_failed=`contrast_failed`,e}({}),Me=xe.createChildDomain({domain:`err_ui`,schema:{unsafe_css_value:A({message:({property:e,value:t})=>`nice-ui refused to emit ${e}: the value contains CSS-terminating characters (${JSON.stringify(t)}). A theme compiled from an untrusted document cannot be allowed to close a declaration and open its own.`}),alpha_derivation_unsupported:A({message:({value:e})=>`nice-ui cannot derive alpha from ${JSON.stringify(e)}: a 6-digit hex colour is required. Appending alpha to an rgb()/rgba() value produces a string that is not a colour at all, and the style silently drops.`}),style_reference_unreadable:A({message:({reason:e,line:t,column:n})=>`nice-ui could not read the style reference: ${e}`+(t==null?``:` (line ${t}${n==null?``:`, column ${n}`})`)}),contrast_failed:A({message:({pairs:e,scheme:t})=>`nice-ui: ${e.length} contrast pair(s) fail in the ${t} scheme with no ledger entry: ${e.slice(0,5).join(`, `)}${e.length>5?`, …`:``}.`})}}),Ne=`textEmphasis.textSecondary.textMuted.textFaint.semanticError.semanticSuccess.semanticSystem.semanticWarning.semanticMetadata.primary.onPrimary.errorSurface.onErrorSurface.surfaceVoid.surfaceBase.surfaceSelected.surfaceDetail.surfaceDetailHeader.surfaceSection.surfaceSectionAlt.borderPanel.borderDivider.dialogBackdrop.tooltipBackground.tooltipTitleBackground.tooltipTitleBorder.tooltipBorder.jsonKey.jsonString.jsonNumber.jsonKeyword.jsonPunctuation.scrollbarThumb.scrollbarThumbHover.focusRing`.split(`.`);new Set(Ne);var Pe=`data-nice-ui-scheme`,Fe=`data-nice-ui-scheme-source`,Ie=`--nice-ui`;function Le(e){return`${Ie}-${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`}function Re(e){return`${Ie}-lane-accent-${e}`}var ze=/[;{}<>\\]|\/\*|\*\//;function Be(e,t){if(ze.test(t))throw Me.fromId(je.unsafe_css_value,{property:e,value:t});return`${e}: ${t};`}function Ve(e,t){let n=e.schemes[t],r=[];for(let e of Ne)r.push(Be(Le(e),n[e]));return n.laneAccents.forEach((e,t)=>{r.push(Be(Re(t),e))}),r.push(Be(`${Ie}-lane-accent-count`,String(n.laneAccents.length))),r.push(Be(`color-scheme`,t)),r}function He(e,t){if(!Number.isFinite(t))throw Me.fromId(je.unsafe_css_value,{property:e,value:String(t)});return`${e}: ${t}px;`}function Ue(e,t){return[e,...t].map(e=>/^[a-zA-Z][a-zA-Z0-9-]*$/.test(e)?e:`'${e.replace(/'/g,``)}'`).join(`, `)}function We(e){let t=[];for(let[n,r]of Object.entries(e.typography)){let e=`${Ie}-font-${n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;t.push(Be(`${e}-family`,Ue(r.fontFamily,r.fontFamilyFallbacks))),t.push(He(`${e}-size`,r.fontSize)),t.push(Be(`${e}-weight`,r.fontWeight)),t.push(He(`${e}-line-height`,r.lineHeight)),r.letterSpacing!=null&&t.push(He(`${e}-letter-spacing`,r.letterSpacing))}for(let[n,r]of Object.entries(e.rounded))t.push(He(`${Ie}-rounded-${n}`,r));for(let[n,r]of Object.entries(e.spacing))t.push(He(`${Ie}-space-${n}`,r));for(let[n,r]of Object.entries(e.elevation))t.push(He(`${Ie}-elevation-${n}-offset-y`,r.offsetY)),t.push(He(`${Ie}-elevation-${n}-blur`,r.blur)),t.push(He(`${Ie}-elevation-${n}-spread`,r.spread));return t}function Ge(e,t){return`${e} {\n ${t.join(`
2
2
  `)}\n}`}function Ke(e,t=``){let n=e=>`${t}[${Pe}="${e}"]`,r=We(e);return[Ge(`${n(`light`)}, ${n(`dark`)}, ${n(`system`)}`,r),Ge(n(`light`),Ve(e,`light`)),Ge(n(`dark`),Ve(e,`dark`)),Ge(n(`system`),[...Ve(e,`light`).filter(e=>!e.startsWith(`color-scheme`)),Be(`color-scheme`,`light dark`)]),`@media (prefers-color-scheme: dark) {\n${Ge(n(`system`),Ve(e,`dark`).filter(e=>!e.startsWith(`color-scheme`))).split(`
3
3
  `).map(e=>` ${e}`).join(`
4
4
  `)}\n}`].join(`
@@ -20,4 +20,4 @@ Error generating stack: `+e.message+`
20
20
  `),style:{background:vn(N.warning,12),border:`1px solid ${vn(N.warning,35)}`,borderRadius:4,color:N.warning,cursor:`default`,flex:`0 0 auto`,fontSize:10,padding:`0 5px`},children:[`⚠ `,e.chips.length]}),e.stickyOverrides.length>0&&(0,M.jsx)(`span`,{title:`sticky: ${e.stickyOverrides.join(`, `)} — applies to every start until cleared`,style:{background:vn(N.warning,12),border:`1px solid ${vn(N.warning,35)}`,borderRadius:4,color:N.warning,flex:`0 0 auto`,fontSize:10,padding:`0 5px`},children:e.stickyOverrides.length===1?`1 sticky env override`:`${e.stickyOverrides.length} sticky env overrides`}),e.stickyOverrides.length>0&&(0,M.jsx)(`button`,{type:`button`,title:`clear ${e.stickyOverrides.join(`, `)} — back to the config's values`,onClick:()=>void a(e.id,Object.fromEntries(e.stickyOverrides.map(e=>[e,null]))),style:{...bv,color:N.warning,fontSize:10,padding:`0 6px`},children:`clear all`}),ee&&(0,M.jsx)(gv,{row:e,inline:!0})]}),_!=null&&(0,M.jsxs)(`span`,{className:`nc-row-time`,title:`up since ${new Date(h.startedAt??0).toLocaleTimeString()}${b==null?``:` · usually takes ${b}`}`,children:[_,h.kind===`task`&&b!=null&&` / ${b}`]}),v!=null&&(0,M.jsxs)(`span`,{className:`nc-row-time`,title:`${v.outcome}${v.durationMs==null?``:` in ${J_(v.durationMs)}`} · ended ${new Date(v.endedAt).toLocaleTimeString()}${b==null?``:` · usually takes ${b}`}`,children:[v.durationMs!=null&&`${J_(v.durationMs)} · `,J_(Date.now()-v.endedAt),` ago`]}),y!=null&&(0,M.jsxs)(`span`,{className:`nc-row-time`,title:`last started ${new Date(y).toLocaleString()}`,children:[`started `,J_(Date.now()-y),` ago`]}),(0,M.jsx)(lv,{id:e.id,live:Lg(h.state),processes:t,act:i,open:u,onToggleOpen:()=>f(e=>!e),flagsOpen:p,onToggleFlags:h.detail.flags.length>0?()=>m(e=>!e):null})]}),(0,M.jsx)(hv,{row:e,now:g}),p&&(0,M.jsx)(pv,{row:e,act:i,onDone:()=>m(!1)}),h.blockedBy!=null&&(0,M.jsx)(fv,{reason:h.blockedBy,processes:t,onSelect:r}),(u||!Lg(h.state))&&h.detail.endpoints.some(e=>e.ownership===`exclusive`)&&(0,M.jsx)(iv,{id:e.id,ports:o,retry:()=>i(`start`,[e.id]),replace:()=>i(`start`,[e.id],{replaceSame:!0})}),u&&(0,M.jsxs)(M.Fragment,{children:[e.chips.length>0&&(0,M.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4,marginTop:6},children:e.chips.map(e=>(0,M.jsx)(`span`,{style:{background:vn(N.warning,12),border:`1px solid ${vn(N.warning,35)}`,borderRadius:4,color:N.warning,fontSize:11,padding:`1px 6px`},children:e},e))}),!ee&&(0,M.jsx)(gv,{row:e}),(0,M.jsx)(_v,{row:e,setEnv:a})]})]})}function sv({id:e,deps:t,processes:n,row:r,selected:i,onSelect:a}){let o=(0,M.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>a(e),style:{alignItems:`center`,background:`transparent`,border:`none`,color:`inherit`,cursor:`pointer`,display:`flex`,flex:`0 1 auto`,gap:7,minWidth:0,overflow:`hidden`,padding:0,textAlign:`left`},children:[(0,M.jsx)(G_,{node:r.node}),(0,M.jsx)(`span`,{style:{color:N.textEmphasis,fontWeight:600,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:e}),t!=null&&(0,M.jsx)(`span`,{"aria-hidden":`true`,style:{color:N.textMuted,fontSize:10},title:`has a dependency tree — hover to see it`,children:`⬦`}),(0,M.jsx)(`span`,{style:{color:N.textMeta,fontSize:11,whiteSpace:`nowrap`},children:Ig(r.node).label}),(0,M.jsx)(`span`,{style:{color:N.textMuted,fontSize:10,whiteSpace:`nowrap`},children:r.node.kind})]});return t==null?o:(0,M.jsx)(mt,{config:{title:`${e} — dependency tree`,content:(0,M.jsx)(cv,{deps:t,processes:n,onSelect:a}),align:`edge`,maxWidth:320},children:o})}function cv({deps:e,processes:t,onSelect:n}){let r=e=>e.map(e=>(0,M.jsx)(`div`,{style:{paddingLeft:(e.depth-1)*12},children:e.missing?(0,M.jsxs)(`span`,{style:{color:N.textMuted,fontSize:11},children:[e.id,` (not in config)`]}):(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),title:`select ${e.id}`,style:{alignItems:`center`,background:`transparent`,border:`none`,color:N.text,cursor:`pointer`,display:`flex`,fontSize:11,gap:6,padding:`1px 0`},children:[t[e.id]&&(0,M.jsx)(G_,{node:t[e.id],compact:!0}),e.id]})},e.id));return(0,M.jsxs)(`div`,{children:[e.needs.length>0&&(0,M.jsxs)(`div`,{style:{marginBottom:e.neededBy.length>0?6:0},children:[(0,M.jsx)(`div`,{style:{color:N.textMuted,fontSize:10,marginBottom:2},children:`needs`}),r(e.needs)]}),e.neededBy.length>0&&(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`div`,{style:{color:N.textMuted,fontSize:10,marginBottom:2},children:`needed by`}),r(e.neededBy)]})]})}function lv({id:e,live:t,processes:n,act:r,open:i,onToggleOpen:a,flagsOpen:o,onToggleFlags:s}){let c=t?Xg([e],n):null,l=c?.stops.filter(t=>t!==e)??[];return(0,M.jsxs)(`span`,{className:`nc-row-actions`,children:[!t&&(0,M.jsx)(`button`,{type:`button`,"aria-label":`start`,title:`start`,onClick:()=>void r(`start`,[e]),children:`▶`}),t&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,"aria-label":`restart`,title:`restart — a ready dependency is left alone`,onClick:()=>void r(`restart`,[e]),children:`↻`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`stop`,title:`stop`,onClick:()=>void r(`stop`,[e]),children:`■`})]}),l.length>0&&(0,M.jsxs)(`button`,{type:`button`,"aria-label":`stop with dependencies`,"data-stop-with-dependencies":!0,title:`stop with dependencies — also stops ${l.join(`, `)}`+(c!=null&&c.kept.length>0?` · leaves ${c.kept.join(`, `)} (still needed elsewhere)`:``),onClick:()=>void r(`stop`,[e],{withDependencies:!0}),children:[`■`,(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`↳`})]}),s!=null&&(0,M.jsx)(`button`,{type:`button`,"aria-label":`flags`,"aria-expanded":o,title:`${t?`restart`:`start`} with flags`,onClick:s,children:`⚑`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":i?`less`:`detail`,"aria-expanded":i,title:i?`hide detail`:`detail — command, endpoints, env`,onClick:a,children:i?`▴`:`▾`})]})}var uv=3;function dv({id:e,processes:t,onSelect:n}){let r=t[e]?.detail.dependsOn??[];return r.length===0?(0,M.jsx)(M.Fragment,{}):(0,M.jsxs)(`span`,{className:`nc-dep-dots`,"data-dependency-dots":e,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`↳`}),r.slice(0,uv).map(e=>{let r=t[e];return(0,M.jsx)(`button`,{type:`button`,"aria-label":`dependency ${e}: ${r?.state??`not in config`}`,title:`needs ${e} — ${r?.state??`not in config`}`,onClick:()=>n(e),children:r==null?`?`:(0,M.jsx)(G_,{node:r,compact:!0})},e)}),r.length>uv&&(0,M.jsxs)(`span`,{title:r.slice(uv).join(`, `),children:[`+`,r.length-uv]})]})}function fv({reason:e,processes:t,onSelect:n}){let r=/"([^"]+)"/.exec(e)?.[1];return r==null||t[r]==null?(0,M.jsx)(M.Fragment,{}):(0,M.jsxs)(`button`,{type:`button`,onClick:()=>n(r),title:e,style:{...bv,color:N.warning,fontSize:10,marginTop:4,padding:`1px 6px`},children:[`blocked by `,r,` →`]})}function pv({row:e,act:t,onDone:n}){let{node:r}=e,[i,a]=(0,d.useState)(r.flags),o=Lg(r.state),s=o?`restart`:`start`,c=e=>a(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]);return(0,M.jsxs)(`div`,{className:`nc-flags`,"data-flag-picker":e.id,children:[r.detail.flags.map(e=>(0,M.jsxs)(`label`,{title:`appends ${e.args}`,children:[(0,M.jsx)(`input`,{type:`checkbox`,checked:i.includes(e.name),onChange:()=>c(e.name)}),(0,M.jsx)(`span`,{style:{color:N.textEmphasis},children:e.name}),(0,M.jsx)(`span`,{style:{color:N.textMuted},children:e.description??e.args})]},e.name)),(0,M.jsx)(`div`,{children:(0,M.jsxs)(`button`,{type:`button`,onClick:()=>{t(s,[e.id],{flags:{[e.id]:[...i]}}),n()},style:bv,children:[o?`↻ restart`:`▶ start`,i.length>0?` with ${i.join(`, `)}`:` plain`]})})]})}function mv(e){let[t,n]=(0,d.useState)(()=>Date.now());return(0,d.useEffect)(()=>{if(e==null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),e==null?Date.now():t}function hv({row:e,now:t}){let{estimatedMs:n,startedAt:r}=e.node,i=e.node.detail.timeoutMs,a=e.node.kind===`task`&&r!=null&&Lg(e.node.state),o=n??i;if(!a||o==null)return(0,M.jsx)(M.Fragment,{});let s=Math.max(0,t-r),c=Math.min(1,s/o),l=i!=null&&s>i*.8,u=n!=null&&s>n;return(0,M.jsx)(`div`,{role:`progressbar`,"aria-label":n==null?`elapsed ${J_(s)} of ${J_(o)} cap`:`elapsed ${J_(s)} of a usual ${J_(n)}`,"aria-valuenow":Math.round(c*100),"aria-valuemin":0,"aria-valuemax":100,title:n==null?`no successful run to estimate from yet — filling toward its timeout`:`usually takes ~${J_(n)} (the mean of its latest successful runs)`+(i==null?``:` · killed at ${J_(i)}`),style:{background:N.surfaceHeader,borderRadius:2,height:3,marginTop:5,overflow:`hidden`},children:(0,M.jsx)(`div`,{className:`nc-meter-fill`,"data-overrun":u||void 0,style:{background:l?N.warning:N.system,width:`${c*100}%`}})})}function gv({row:e,inline:t=!1}){let n=n_(location.hostname),r=t_(e.node,n);return r.length===0?(0,M.jsx)(M.Fragment,{}):(0,M.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:6,marginTop:t?0:6},children:r.map(e=>e.href==null?(0,M.jsxs)(`span`,{style:Sv,title:e.remote?`bound on the daemon's machine — forward the port to reach it from here`:void 0,children:[e.label,e.remote?` (remote)`:``]},e.name):(0,M.jsxs)(`a`,{href:e.href,title:`${e.name} — ${e.href} (opens in a new tab)`,target:`_blank`,rel:`noreferrer`,style:{...Sv,color:N.system},children:[e.label,` ↗`]},e.name))})}function _v({row:e,setEnv:t}){let{detail:n}=e.node;return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`dl`,{style:{display:`grid`,fontSize:11,gap:`2px 8px`,gridTemplateColumns:`auto minmax(0, 1fr)`,margin:`8px 0 0`},children:[e.node.pid!=null&&(0,M.jsx)(yv,{label:`pid`,value:String(e.node.pid)}),(0,M.jsx)(yv,{label:`run`,value:n.command}),(0,M.jsx)(yv,{label:`cwd`,value:n.cwd}),n.ready!=null&&(0,M.jsx)(yv,{label:`ready`,value:n.ready}),n.dependsOn.length>0&&(0,M.jsx)(yv,{label:`needs`,value:n.dependsOn.join(`, `)})]}),n.envVars.length>0&&(0,M.jsx)(vv,{row:e,setEnv:t})]})}function vv({row:e,setEnv:t}){let[n,r]=(0,d.useState)({}),[i,a]=(0,d.useState)(!1),o=e.node.detail.envVars,s=Object.keys(n).length>0,c=async()=>{a(!0);try{await t(e.id,n),r({})}finally{a(!1)}};return(0,M.jsxs)(`div`,{style:{borderTop:`1px solid ${N.border}`,marginTop:8,paddingTop:8},children:[(0,M.jsx)(`div`,{style:{color:N.textMuted,fontSize:11,marginBottom:6},children:`env`}),(0,M.jsx)(`div`,{style:{display:`grid`,gap:6},children:o.map(i=>(0,M.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,M.jsxs)(`label`,{htmlFor:`env-${e.id}-${i.name}`,style:{color:N.textMeta,flex:`0 0 40%`,fontSize:11},title:i.description,children:[i.name,i.required&&(0,M.jsx)(`span`,{style:{color:N.error},children:` *`}),i.source===`override`&&(0,M.jsx)(`span`,{title:`sticky override — applies to every start until cleared`,style:{background:vn(N.warning,12),border:`1px solid ${vn(N.warning,35)}`,borderRadius:4,color:N.warning,fontSize:10,marginLeft:6,padding:`0px 5px`},children:`sticky`})]}),i.values==null?(0,M.jsx)(`input`,{id:`env-${e.id}-${i.name}`,type:i.secret?`password`:`text`,value:n[i.name]??(i.secret?``:i.value??``),placeholder:i.secret&&i.source!==`unset`?`•••• set`:i.source,onChange:e=>r(t=>({...t,[i.name]:e.target.value})),style:xv}):(0,M.jsx)(`select`,{id:`env-${e.id}-${i.name}`,value:n[i.name]??i.value??``,onChange:e=>r(t=>({...t,[i.name]:e.target.value})),style:xv,children:i.values.map(e=>(0,M.jsx)(`option`,{value:e,children:e},e))}),(0,M.jsx)(`button`,{type:`button`,disabled:i.source!==`override`,title:`drop the override, back to the config's value`,onClick:()=>void t(e.id,{[i.name]:null}),style:{...bv,opacity:i.source===`override`?1:.35},children:`clear`})]},i.name))}),(0,M.jsxs)(`div`,{style:{alignItems:`center`,display:`flex`,gap:8,marginTop:8},children:[(0,M.jsx)(`button`,{type:`button`,disabled:!s||i,onClick:()=>void c(),style:bv,children:i?`saving…`:`save`}),(0,M.jsx)(`span`,{style:{color:N.textMuted,fontSize:10},children:`sticky — applies to every start until cleared`})]})]})}function yv({label:e,value:t}){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`dt`,{style:{color:N.textMuted},children:e}),(0,M.jsx)(`dd`,{style:{color:N.textMeta,margin:0,overflowWrap:`anywhere`},children:t})]})}var bv={background:`transparent`,border:`1px solid ${N.border}`,borderRadius:5,color:N.textMeta,cursor:`pointer`,fontSize:11,padding:`1px 8px`},xv={background:N.surfaceSection,border:`1px solid ${N.border}`,borderRadius:4,color:N.textEmphasis,flex:1,fontSize:11,minWidth:0,padding:`2px 5px`},Sv={background:N.surfaceSection,border:`1px solid ${N.borderStrong}`,borderRadius:4,color:N.textMeta,fontSize:11,padding:`0 6px`,textDecoration:`none`,maxWidth:`100%`,overflowWrap:`anywhere`},Cv=3,wv=e=>e.join(`,`);function Tv({groups:e,processes:t,runs:n,savedFilters:r,filterFor:i,focused:a,onFocus:o,collapsed:s,onCollapse:c,selected:l,onSelect:u,bulk:f,onPin:p,setEnv:m,ports:h}){let[g,_]=(0,d.useState)(null),v=(0,d.useMemo)(()=>{let e=g==null?null:nv(g,t);return g==null||e==null?null:{self:g,upstream:new Set(e.needs.map(e=>e.id)),downstream:new Set(e.neededBy.map(e=>e.id))}},[g,t]),y=e=>{if(v!=null)return e===v.self?`self`:v.upstream.has(e)?`upstream`:v.downstream.has(e)?`downstream`:`unrelated`},b=(0,d.useMemo)(()=>Qg(n),[n]);return e.length===0?(0,M.jsx)(`div`,{style:{color:N.textMuted,padding:8},children:`no processes match this filter`}):(0,M.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:8},children:e.map((n,d)=>{let g=wv(n.signature),v=s.get(g)??(n.signature.length>0&&d>=Cv),x=i(n.signature);return(0,M.jsxs)(`section`,{"data-tag-group":g,"aria-label":`tag group ${g||`all`}`,children:[(n.signature.length>0||e.length>1)&&(0,M.jsx)(Ev,{group:n,processes:t,filter:x,pinned:x!=null&&r.some(e=>e.pinned&&e.mode===x.mode&&hn(e.terms,x.terms)&&hn(e.bucket??[],x.bucket??[])),focused:a!=null&&hn(a,n.signature),onFocus:()=>o(n.signature),collapsed:v,onCollapse:()=>c(g,!v),bulk:f,onPin:p}),!v&&(0,M.jsx)(av,{rows:n.rows,processes:t,selected:l,onSelect:u,act:f.act,setEnv:m,ports:h,origins:b,roleOf:y,onHover:_})]},g)})})}function Ev({group:e,processes:t,filter:n,pinned:r,focused:i,onFocus:a,collapsed:o,onCollapse:s,bulk:c,onPin:l}){let u=e.members.map(e=>e.id),d=u.length>0&&e.members.every(e=>e.node.kind===`task`),f=e.members.some(e=>Lg(e.node.state)),p=Yg(u,t),m=Zg(u,t),h=[`start ${p.starts.length}`,...p.alreadyRunning.length>0?[`already running ${p.alreadyRunning.length} (skipped)`]:[],...p.dependencies.length>0?[`+${p.dependencies.length} dependencies: ${p.dependencies.join(`, `)}`]:[]].join(` · `),g=e.signature.map(e=>e.slice(e.indexOf(`=`)+1));return(0,M.jsxs)(`div`,{className:`nc-tag-group-heading`,"data-focused":i,children:[(0,M.jsxs)(`div`,{style:{alignItems:`center`,display:`flex`,gap:6,minWidth:0},children:[(0,M.jsx)(`button`,{type:`button`,"aria-expanded":!o,"aria-label":o?`expand`:`collapse`,onClick:s,className:`nc-caret`,children:o?`▸`:`▾`}),(0,M.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:a,title:`scope the log pane to this tag group`,className:`nc-tag-group-identity`,children:[e.signature.length===0?(0,M.jsx)(`span`,{style:{color:N.textMuted,fontSize:11},children:`untagged`}):e.signature.map(e=>(0,M.jsx)(`span`,{className:`nc-signature-chip`,title:e,children:e.slice(e.indexOf(`=`)+1)},e)),(0,M.jsxs)(`span`,{style:{color:N.textMuted,fontSize:11,flexShrink:0},children:[u.length,e.optIn.length>0&&` · +${e.optIn.length} manual`]})]}),(0,M.jsx)(`span`,{style:{flex:1}}),(0,M.jsx)(X_,{members:u,processes:t}),u.length>0&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,disabled:c.busy,title:h,"data-tag-group-run":!0,onClick:()=>c.run({ids:u,...n==null?{}:{filter:n}}),className:`nc-quiet-button`,children:d?`▶ run`:`▲ up`}),!d&&f&&(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,disabled:c.busy,title:`restart these — a ready dependency outside the group is left alone`,onClick:()=>void c.act(`restart`,u),className:`nc-quiet-button`,children:`↻`}),(0,M.jsx)(`button`,{type:`button`,disabled:c.busy,title:m.length>0?`stop — leaves live dependents degraded: ${m.join(`, `)}`:`stop these`,"data-warn":m.length>0||void 0,onClick:()=>void c.act(`stop`,u),className:`nc-quiet-button`,children:`▼`})]})]}),n!=null&&(0,M.jsx)(`button`,{type:`button`,"aria-label":r?`pinned`:`pin this tag group`,title:r?`pinned`:`pin — keep this tag group for later sessions`,disabled:r,onClick:()=>l(n,g.join(` · `)),className:`nc-quiet-button`,children:r?`★`:`☆`})]}),!o&&(0,M.jsxs)(`div`,{className:`nc-tag-group-sub`,children:[(0,M.jsx)(K_,{members:u,processes:t}),p.dependencies.length>0&&(0,M.jsxs)(`span`,{title:`started first, because members depend on them`,children:[`also starts: `,p.dependencies.join(`, `)]})]})]})}function Dv({rows:e,tags:t,mode:n,onMode:r,onToggle:i,onClear:a,groupControl:o}){let s=(0,d.useMemo)(()=>Wg(e),[e]),c=(0,d.useMemo)(()=>qg(e,t,n),[e,t,n]);return s.length===0?(0,M.jsx)(M.Fragment,{}):(0,M.jsxs)(`section`,{"aria-label":`tags`,children:[(0,M.jsxs)(`div`,{className:`nc-rail-heading`,children:[(0,M.jsx)(`span`,{className:`nc-section-title`,children:`tags`}),(0,M.jsx)(`span`,{className:`nc-segmented`,"data-match-mode":n,children:[`any`,`all`].map(e=>(0,M.jsx)(`button`,{type:`button`,"aria-pressed":n===e,title:e===`any`?`any — every partial match, strict matches on top`:`all — only processes carrying every selected tag`,onClick:()=>r(e),children:e},e))}),(0,M.jsx)(`span`,{style:{flex:1}}),t.length===0&&o,t.length>0&&(0,M.jsxs)(`button`,{type:`button`,onClick:a,title:`clear ${t.join(`, `)}`,className:`nc-link-button`,children:[`× clear `,t.length]})]}),(0,M.jsx)(`div`,{className:`nc-tag-groups`,children:s.map(e=>(0,M.jsxs)(`div`,{className:`nc-tag-key-group`,children:[(0,M.jsx)(`span`,{className:`nc-tag-key`,title:e.key,children:e.key}),e.values.map(n=>{let r=`${e.key}=${n}`,a=t.includes(r),o=c.get(r)??0;return(0,M.jsxs)(`button`,{type:`button`,"aria-pressed":a,title:`${r} — ${o} process${o===1?``:`es`}`,"data-tag-chip":r,onClick:()=>i(r),className:`nc-tag-chip`,"data-empty":o===0&&!a||void 0,children:[n,(0,M.jsx)(`span`,{className:`nc-tag-count`,children:o})]},n)})]},e.key))})]})}var Ov=(e,t)=>{let n=e.get(t);if(n==null||n===``)return;let r=n.split(`,`).filter(Boolean);return r.length>0?r:void 0};function kv(e){let t=new URLSearchParams(e.startsWith(`#`)?e.slice(1):e),n={},r=Ov(t,`sel`);r!=null&&(n.selected=r);let i=Ov(t,`tags`);i!=null&&(n.tags=i);let a=Ov(t,`bucket`);a!=null&&(n.bucket=a);for(let e of[`suite`,`q`,`by`]){let r=t.get(e);r!=null&&r!==``&&(n[e]=r)}return t.get(`mode`)===`all`&&(n.mode=`all`),n}function Av(e){let t=new URLSearchParams;e.selected!=null&&e.selected.length>0&&t.set(`sel`,e.selected.join(`,`)),e.suite!=null&&e.suite!==``&&t.set(`suite`,e.suite),e.q!=null&&e.q!==``&&t.set(`q`,e.q),e.tags!=null&&e.tags.length>0&&t.set(`tags`,e.tags.join(`,`)),e.mode===`all`&&t.set(`mode`,`all`),e.bucket!=null&&e.bucket.length>0&&t.set(`bucket`,e.bucket.join(`,`)),e.by!=null&&e.by!==``&&t.set(`by`,e.by);let n=t.toString();return n===``?``:`#${n}`}function jv(){let[e,t]=(0,d.useState)({kind:`connecting`}),[n,r]=(0,d.useState)(null),[i]=(0,d.useState)(()=>kv(location.hash)),[a,o]=(0,d.useState)(i.tags??[]),[s,c]=(0,d.useState)(i.q??``),[l,u]=(0,d.useState)(i.selected??[]),[f,p]=(0,d.useState)(i.mode??`any`),[m,h]=(0,d.useState)(i.by??null),[g,_]=(0,d.useState)(w_),[v,y]=(0,d.useState)(i.bucket??null),[b,x]=(0,d.useState)(i.suite??null),[ee,te]=(0,d.useState)(()=>new Map(D_().map(e=>[e,!0]))),[S,C]=(0,d.useState)(!1),[w,ne]=(0,d.useState)(null),[re,ie]=(0,d.useState)(null),[ae,T]=(0,d.useState)(null),[oe,se]=(0,d.useState)(0),[E,D]=(0,d.useState)({status:`connecting`,hasBeenLive:!1}),[ce,le]=(0,d.useState)(!1),[ue,de]=(0,d.useState)(!1),O=(0,d.useRef)(!1),[k,fe]=(0,d.useState)(()=>{let e=document.documentElement.getAttribute(Pe);return e===`light`||e===`system`?e:`dark`}),[pe,me]=(0,d.useState)(x_),he=(0,d.useRef)(null);(0,d.useEffect)(()=>{he.current?.style.setProperty(`--nc-rail-w`,`${pe}px`)},[pe]);let ge=(0,d.useRef)(null),_e=(0,d.useRef)([]),ve=(0,d.useRef)(null),A=(0,d.useRef)([]),ye=(0,d.useRef)([]),be=(0,d.useRef)(null),xe=(0,d.useRef)(!1),Se=(0,d.useRef)(null);(0,d.useEffect)(()=>{let e=!1,n=null;return kg().then(i=>{if(e){i.dispose();return}n=i,t({kind:`live`,session:i}),r(i.realm.store.state),i.realm.store.subscribe(()=>r({...i.realm.store.state})),D({status:i.realm.status,hasBeenLive:i.realm.hasBeenLive}),i.realm.subscribeStatus((e,t)=>D({status:e,hasBeenLive:t.hasBeenLive}))},n=>{e||t({kind:`lost`,message:n.message})}),()=>{e=!0,n?.dispose()}},[]);let[Ce,we]=(0,d.useState)(()=>Date.now());(0,d.useEffect)(()=>{let e=setInterval(()=>we(Date.now()),5e3);return()=>clearInterval(e)},[]),(0,d.useEffect)(()=>{let e=n?.configName;e!=null&&(document.title=`${e} · nice-commander`)},[n?.configName]);let Te=(0,d.useMemo)(()=>n==null?[]:Bg(n,Ce),[n,Ce]),Ee=(0,d.useMemo)(()=>{if(b==null)return Te;let e=n?.suites[b]?.members;return e==null?Te:Vg(Te,e)},[Te,n,b]),De=(0,d.useMemo)(()=>Jg(Ee,a,f,s),[Ee,a,f,s]),Oe=(0,d.useMemo)(()=>Wg(Te).map(e=>e.key),[Te]),ke=(0,d.useMemo)(()=>Kg(De,a,f,b==null?m:null,g),[De,a,f,m,b,g]),Ae=(0,d.useMemo)(()=>v==null?void 0:ke.find(e=>hn(e.signature,v)),[ke,v]),je=(0,d.useMemo)(()=>new Set(Te.filter(e=>Lg(e.node.state)).map(e=>e.id)),[Te]);(0,d.useEffect)(()=>{b!=null&&n!=null&&n.suites[b]==null&&x(null)},[n,b]);let Me=(0,d.useMemo)(()=>l.length===1?{kind:`proc`,id:l[0]}:l.length>1?{kind:`merged`,procs:[...l].sort()}:Ae==null?{kind:`merged`,procs:a.length>0||s.trim()!==``||b!=null?De.map(e=>e.id).sort():null}:{kind:`merged`,procs:Ae.members.map(e=>e.id).sort()},[l,a,s,De,b,Ae]),Ne=(0,d.useCallback)(async(t,n,r)=>{if(!(e.kind!==`live`||O.current||n.length===0)){ie(t),T(null);try{let{results:i,warnings:a}=await e.session.control(t,n,r),o=i.filter(e=>e.outcome===`failed`||e.outcome===`blocked`),s=t===`start`?i.filter(e=>e.outcome===`spawned`):[],c=[s.length>0?`${t}: ${i.length} process(es), ${s.length} running — the grid shows progress`:`${t}: ${i.length} process(es)`,...o.map(e=>`✗ ${e.id} — ${e.outcome}${e.reason==null?``:`: ${e.reason}`}`),...a.map(e=>`⚠ ${e}`)];T(c.join(`
21
21
  `))}catch(e){T(`${t} failed: ${e.message}`)}finally{ie(null)}}},[e]),Ie=(0,d.useMemo)(()=>({busy:re!=null,act:Ne,run:t=>{if(e.kind!==`live`||O.current)return;ie(`run`),T(null);let n=`suite`in t?{suite:t.suite}:{ids:[...t.ids],...t.filter==null?{}:{filter:t.filter}};e.session.runSuite(n).then(e=>{e.accepted||T(`run refused: ${e.reason??`unknown reason`}`)},e=>T(`run failed: ${e.message}`)).finally(()=>ie(null))}}),[Ne,re,e]),Le=(0,d.useCallback)(e=>{if(x(null),c(``),o(e.terms),p(e.mode),y(e.bucket??null),e.bucket!=null){let t=wv(Gg(e.bucket));te(e=>new Map(e).set(t,!1))}},[]),Re=async()=>{if(!(e.kind!==`live`||O.current)){O.current=!0,ie(`shutdown`),T(null);try{await e.session.shutdown(),de(!1),t({kind:`shutdown`}),e.session.dispose()}catch(e){de(!1),T(`shutdown failed: ${e.message}`),O.current=!1}finally{ie(null)}}},ze=(0,d.useCallback)(async(t,n)=>{if(!(e.kind!==`live`||O.current)){T(null);try{let r=await e.session.setEnv(t,n);T(r.length>0?r.map(e=>`⚠ ${e}`).join(`
22
22
  `):`${t}: saved — sticky until cleared, and it applies on the next start`)}catch(e){T(`env change failed: ${e.message}`)}}},[e]);_e.current=l,ve.current=b,A.current=ke.map(e=>e.signature);let Be=(0,d.useMemo)(()=>new Set(l),[l]),Ve=(0,d.useCallback)(e=>u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),[]);ye.current=ke.flatMap(e=>e.rows.map(e=>e.id)),be.current=n,xe.current=ce||ue||S||w!=null,Se.current=Ne,(0,d.useEffect)(()=>{let e=Av({...l.length>0?{selected:l}:{},...b==null?{}:{suite:b},...s.trim()===``?{}:{q:s},...a.length>0?{tags:a}:{},mode:f,...v==null?{}:{bucket:v},...m==null?{}:{by:m}});history.replaceState(null,``,e===``?location.pathname:e)},[l,b,s,a,f,v,m]),(0,d.useEffect)(()=>{let e=e=>{if(O.current||xe.current)return;let t=e.target,n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&t.isContentEditable;if(e.key===`Escape`){if(n)t.blur();else if(xe.current)return;else _e.current.length>0?u([]):(x(null),y(null));return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`){e.preventDefault(),C(!0);return}if(!(n||e.metaKey||e.ctrlKey||e.altKey)){if(e.key===`a`){p(e=>e===`any`?`all`:`any`);return}if(e.key===`[`||e.key===`]`){let t=A.current;if(t.length===0)return;y(n=>{let r=n==null?-1:t.findIndex(e=>hn(e,n)),i=e.key===`]`?r+1:r<0?t.length-1:r-1;return i<0||i>=t.length?null:t[i]??null});return}if(e.key===`/`){e.preventDefault(),ge.current?.focus();return}if(e.key===`?`){le(!0);return}if(e.key===`c`){se(e=>e+1);return}if(e.key===`g`){let e=Object.keys(be.current?.suites??{});if(e.length===0)return;let t=ve.current,n=(t==null?-1:e.indexOf(t))+1;x(n>=e.length?null:e[n]??null);return}if(e.key>=`1`&&e.key<=`9`){let t=ye.current[Number(e.key)-1];t!=null&&Ve(t);return}_e.current.length!==0&&(e.key===`r`&&Se.current?.(`restart`,[..._e.current]),e.key===`s`&&Se.current?.(`stop`,[..._e.current]),e.key===`u`&&Se.current?.(`start`,[..._e.current]))}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Ve]);let He=(0,d.useMemo)(()=>n==null?[]:[...Object.keys(n.suites).flatMap(e=>[{label:e,hint:`suite — show`,run:()=>x(e)},{label:`run ${e}`,hint:`suite — run`,run:()=>Ie.run({suite:e})}]),...n.savedFilters.map(e=>({label:e_(e),hint:e.pinned?`pin`:`recent run`,run:()=>Le(e)})),...Wg(Te).flatMap(({key:e,values:t})=>t.map(t=>({label:`${e}=${t}`,hint:`tag — filter`,run:()=>{x(null),y(null),o([`${e}=${t}`])}}))),...Te.map(e=>({label:e.id,hint:`${e.node.kind} — ${e.node.state}`,run:()=>u([e.id])}))],[n,Te,Ie,Le]);if(e.kind===`shutdown`)return(0,M.jsx)(Lv,{children:(0,M.jsxs)(`div`,{role:`status`,style:{textAlign:`center`,padding:24},children:[(0,M.jsx)(`strong`,{children:`Shutdown accepted`}),(0,M.jsx)(`p`,{children:`The daemon is stopping all managed processes and will exit when cleanup finishes.`}),(0,M.jsxs)(`p`,{children:[`You can close this tab. Run `,(0,M.jsx)(`code`,{children:`nice-commander ui`}),` to start it again.`]})]})});if(e.kind===`connecting`)return(0,M.jsx)(Lv,{children:`connecting…`});if(e.kind===`lost`)return(0,M.jsx)(Lv,{children:(0,M.jsx)(k_,{message:e.message,onShutdown:()=>t({kind:`shutdown`})})});if(n==null)return(0,M.jsx)(Lv,{children:`waiting for the status realm…`});let Ue=Te.filter(e=>e.node.stale&&!e.node.removed).map(e=>e.id);return(0,M.jsxs)(`div`,{className:`nc-shell`,style:{display:`flex`,flexDirection:`column`,height:`100%`},children:[(0,M.jsxs)(`header`,{className:`nc-chrome nc-header`,style:{display:`flex`,alignItems:`center`,gap:10,padding:`7px 14px`,borderBottom:`1px solid ${N.border}`,flexWrap:`wrap`},children:[(0,M.jsx)(`strong`,{style:{color:N.textEmphasis},children:n?.configName??`nice-commander`}),(0,M.jsxs)(`span`,{style:{color:N.textMuted,fontSize:11},title:`config generation ${n.generation} · revision ${n.configRevisionHash}`,children:[`gen `,n.generation,` · `,n.configRevisionHash.slice(0,8)]}),(0,M.jsx)(`input`,{ref:ge,value:s,onChange:e=>c(e.target.value),placeholder:`filter ids… (/)`,"aria-label":`filter ids`,className:`nc-input`}),(0,M.jsx)(`span`,{style:{flex:1}}),(0,M.jsx)(Nv,{link:E}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`theme: ${k}`,title:`colour scheme: ${k} — click for dark → light → system (persisted for this browser)`,onClick:()=>{let e=k===`dark`?`light`:k===`light`?`system`:`dark`;fe(e),document.documentElement.setAttribute(Pe,e),document.documentElement.setAttribute(Fe,`persisted`),v_(e)},style:Fv,children:k===`dark`?`☾`:k===`light`?`☀`:`◐`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`keyboard shortcuts`,title:`keyboard shortcuts (?)`,onClick:()=>le(!0),style:Fv,children:`?`}),(0,M.jsxs)(`button`,{type:`button`,title:`go to a process, tag, suite or pin (⌘K / Ctrl+K)`,onClick:()=>C(!0),style:Pv,children:[`go to… `,(0,M.jsx)(`kbd`,{style:{color:N.textMuted,fontFamily:`inherit`},children:`⌘K`})]}),(0,M.jsx)(`button`,{type:`button`,disabled:re!=null||E.status!==`live`,onClick:()=>de(!0),title:`Shut down this daemon and all its managed processes, including hidden tasks`,"aria-label":`shutdown daemon`,style:{...Pv,color:N.error},children:`⏻ shutdown`})]}),E.status===`detached`&&(0,M.jsx)(Rv,{tone:N.error,children:(0,M.jsxs)(`div`,{style:{alignItems:`center`,display:`flex`,gap:10},children:[(0,M.jsx)(`span`,{style:{flex:1},children:`the daemon refused this page's live link — usually it was restarted on another build. What you see here has stopped updating.`}),(0,M.jsx)(`button`,{type:`button`,onClick:()=>location.reload(),style:Pv,children:`reload`})]})}),n.configError.length>0&&(0,M.jsxs)(Rv,{tone:N.error,children:[`config reload failed — the last good config is still live:`,n.configError.map(e=>(0,M.jsxs)(`div`,{children:[`· `,e]},e))]}),ae!=null&&(0,M.jsx)(Rv,{tone:N.warning,children:(0,M.jsxs)(`div`,{style:{alignItems:`flex-start`,display:`flex`,gap:10},children:[(0,M.jsx)(`span`,{style:{flex:1},children:ae}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`dismiss`,onClick:()=>T(null),style:{...Pv,padding:`0 7px`},children:`×`})]})}),Ue.length>0&&(0,M.jsx)(Rv,{tone:N.warning,children:(0,M.jsxs)(`div`,{style:{alignItems:`center`,display:`flex`,gap:10},children:[(0,M.jsxs)(`span`,{children:[Ue.length,` process`,Ue.length===1?``:`es`,` running an old config revision: `,Ue.join(`, `)]}),(0,M.jsx)(`span`,{style:{flex:1}}),(0,M.jsxs)(`button`,{type:`button`,disabled:re!=null,onClick:()=>void Ne(`restart`,Ue),style:Pv,children:[`restart `,Ue.length,` stale`]})]})}),(0,M.jsxs)(`div`,{className:`nc-main`,children:[(0,M.jsxs)(`div`,{className:`nc-rail`,ref:he,children:[(0,M.jsx)($_,{state:n,selected:b,onSelect:e=>x(t=>t===e?null:e),bulk:Ie,now:Ce}),(0,M.jsx)(q_,{filters:n.savedFilters,rows:Te,processes:n.processes,activeId:n.savedFilters.find(e=>e.mode===f&&hn(e.terms,a)&&hn(e.bucket??[],v??[]))?.id??null,onOpen:Le,onPin:e=>ne({filter:e,name:e_(e)}),onRemove:t=>{e.kind===`live`&&e.session.removeFilter(t.id).catch(e=>T(`remove failed: ${e.message}`))}}),(0,M.jsx)(Dv,{rows:Te,tags:a,mode:f,onMode:p,onToggle:e=>{y(null),o(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},onClear:()=>{y(null),o([])},groupControl:b==null&&Oe.length>0?(0,M.jsxs)(`select`,{value:m??``,"aria-label":`group processes by tag key`,onChange:e=>h(e.target.value===``?null:e.target.value),className:`nc-select`,children:[(0,M.jsx)(`option`,{value:``,children:`no grouping`}),Oe.map(e=>(0,M.jsxs)(`option`,{value:e,children:[`group by `,e]},e))]}):null}),(0,M.jsxs)(`div`,{className:`nc-procs-heading`,children:[(0,M.jsx)(`span`,{className:`nc-section-title`,children:`processes`}),(0,M.jsx)(`span`,{style:{color:N.textMuted,fontSize:11},children:De.length}),(0,M.jsx)(h_,{rows:De}),(0,M.jsxs)(`select`,{value:g,"aria-label":`order processes`,title:`the order each tag group lists its processes in (remembered by this browser)`,onChange:e=>{let t=e.target.value===`recent`?`recent`:`dependency`;_(t),T_(t)},className:`nc-select`,style:{marginLeft:`auto`},children:[(0,M.jsx)(`option`,{value:`dependency`,children:`dependency order`}),(0,M.jsx)(`option`,{value:`recent`,children:`recently started`})]})]}),(0,M.jsxs)(`div`,{className:`nc-procs`,children:[b!=null&&(0,M.jsxs)(`div`,{style:{alignItems:`center`,color:N.textMeta,display:`flex`,fontSize:11,gap:6,marginBottom:6},children:[(0,M.jsxs)(`span`,{style:{minWidth:0,overflowWrap:`anywhere`},children:[`suite: `,b,` (`,De.length,`) —`,` `,g===`recent`?`recently started first`:`dependency order`]}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`clear suite ${b}`,onClick:()=>x(null),style:{background:`transparent`,border:`none`,color:N.textMuted,cursor:`pointer`,fontSize:11,padding:`0 2px`},children:`×`})]}),(0,M.jsx)(Tv,{groups:ke,processes:n.processes,runs:n.runs,savedFilters:n.savedFilters,filterFor:e=>e.length===0?null:a.length>0?{mode:f,terms:Gg(a),bucket:[...e]}:{mode:`any`,terms:[...e]},focused:v,onFocus:e=>y(t=>t!=null&&hn(t,e)?null:[...e]),collapsed:ee,onCollapse:(e,t)=>te(n=>{let r=new Map(n).set(e,t);return O_([...r].filter(([,e])=>e).map(([e])=>e)),r}),selected:Be,onSelect:Ve,bulk:Ie,onPin:(e,t)=>ne({filter:e,name:t}),setEnv:ze,ports:async t=>{if(e.kind!==`live`)throw Error(`Daemon is not connected`);return e.session.ports(t)}})]})]}),(0,M.jsx)(Iv,{width:pe,onChange:me,onCommit:e=>S_(e)}),(0,M.jsxs)(`div`,{className:`nc-logs`,children:[(0,M.jsx)(V_,{processes:n.processes,origins:Qg(n.runs),selected:Be,onToggle:Ve}),(0,M.jsx)(l_,{view:Me,runningIds:je,clearSignal:oe,onSelectProc:e=>u([e])})]})]}),(0,M.jsxs)(Dt,{open:ue,onClose:()=>{O.current||de(!1)},title:`Shut down ${n.configName}?`,description:`This stops all tasks and services managed by this daemon, including processes hidden by filters or suites, then exits the daemon.`,children:[(0,M.jsxs)(`p`,{children:[je.size,` active process(es). This dashboard will disconnect.`]}),(0,M.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8},children:[(0,M.jsx)(`button`,{type:`button`,disabled:re===`shutdown`,onClick:()=>de(!1),style:Pv,children:`cancel`}),(0,M.jsx)(`button`,{type:`button`,disabled:re===`shutdown`,onClick:()=>void Re(),style:{...Pv,color:N.error},children:re===`shutdown`?`shutting down…`:`shut down daemon and all tasks`})]})]}),(0,M.jsx)(wn,{open:S,onClose:()=>C(!1),entries:He}),(0,M.jsx)(Dt,{open:w!=null,onClose:()=>ne(null),title:`pin this tag group`,description:"Saved with this daemon's state, so every tab and later session has it. `nice-commander up @name` selects it from the CLI.",children:(0,M.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),!(w==null||e.kind!==`live`)&&(e.session.saveFilter(w.filter,w.name).catch(e=>T(`pin failed: ${e.message}`)),ne(null))},style:{display:`flex`,gap:8},children:[(0,M.jsx)(`input`,{value:w?.name??``,"aria-label":`pin name`,maxLength:48,onChange:e=>ne(t=>t==null?null:{...t,name:e.target.value}),className:`nc-palette-input`}),(0,M.jsx)(`button`,{type:`submit`,style:Pv,children:`pin`})]})}),(0,M.jsx)(Dt,{open:ce,onClose:()=>le(!1),title:`keyboard shortcuts`,description:`All keys are plain presses and never fire while typing in a field.`,children:(0,M.jsx)(`table`,{style:{borderCollapse:`collapse`,fontSize:12,width:`100%`},children:(0,M.jsx)(`tbody`,{children:Mv.map(([e,t])=>(0,M.jsxs)(`tr`,{children:[(0,M.jsx)(`td`,{style:{color:N.textEmphasis,padding:`3px 12px 3px 0`,whiteSpace:`nowrap`},children:(0,M.jsx)(`code`,{children:e})}),(0,M.jsx)(`td`,{style:{color:N.textMeta,padding:`3px 0`},children:t})]},e))})})})]})}var Mv=[[`/`,`focus the id filter`],[`⌘K / Ctrl+K`,`go to a process, tag, suite or pin`],[`1–9`,`toggle the nth visible process in the selection`],[`a`,`flip the tag filter between any and all`],[`[ / ]`,`move the focus across tag groups (scopes the log pane)`],[`g`,`cycle suite selection (then release)`],[`c`,`clear the log pane (keeps the last lines of running processes)`],[`r / s / u`,`restart / stop / start the whole selection`],[`Esc`,`close dialogs, then clear the selection, then the suite and focus`]];function Nv({link:e}){let t=e.status===`live`?`live`:e.status===`detached`?`detached`:e.hasBeenLive?`reconnecting…`:`connecting…`,n=e.status===`live`?N.success:e.status===`detached`?N.error:e.hasBeenLive?N.warning:N.textMuted;return(0,M.jsxs)(`span`,{role:`status`,title:`the live link to the daemon`,style:{alignItems:`center`,color:n,display:`inline-flex`,fontSize:11,gap:5},children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,style:{background:n,borderRadius:999,height:7,width:7}}),t]})}var Pv={background:`transparent`,border:`1px solid ${N.border}`,borderRadius:6,color:N.text,cursor:`pointer`,fontSize:11,padding:`3px 9px`},Fv={...Pv,lineHeight:`14px`,minWidth:24,padding:`3px 6px`};function Iv({width:e,onChange:t,onCommit:n}){let r=(0,d.useRef)(null),[i,a]=(0,d.useState)(!1),o=()=>{r.current!=null&&(r.current=null,a(!1),document.body.style.userSelect=``,n(e))};return(0,M.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`resize the process rail`,"aria-valuenow":e,"aria-valuemin":300,"aria-valuemax":780,tabIndex:0,className:`nc-gutter`,"data-dragging":i||void 0,title:`drag to resize · arrows nudge · double-click resets`,onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),r.current={startX:t.clientX,startWidth:e},a(!0),document.body.style.userSelect=`none`},onPointerMove:e=>{let n=r.current;n!=null&&t(b_(n.startWidth+e.clientX-n.startX))},onPointerUp:o,onPointerCancel:o,onLostPointerCapture:o,onDoubleClick:()=>{t(440),n(440)},onKeyDown:r=>{let i=r.key===`ArrowLeft`?-16:r.key===`ArrowRight`?16:null;if(i!=null){r.preventDefault();let a=b_(e+i);t(a),n(a)}else r.key===`Home`&&(r.preventDefault(),t(440),n(440))}})}function Lv({children:e}){return(0,M.jsx)(`div`,{style:{alignItems:`center`,display:`flex`,height:`100%`,justifyContent:`center`,color:N.textMeta},children:e})}function Rv({tone:e,children:t}){return(0,M.jsx)(`div`,{style:{background:N.surfaceHeader,borderBottom:`1px solid ${N.border}`,borderLeft:`3px solid ${e}`,color:N.text,fontSize:12,padding:`6px 14px`,whiteSpace:`pre-wrap`},children:t})}var zv=__();Nt(Ze,{document}),document.documentElement.setAttribute(Pe,zv??Ze.defaultScheme),document.documentElement.setAttribute(Fe,zv==null?`default`:`persisted`);var Bv=document.getElementById(`root`);Bv!=null&&(0,dn.createRoot)(Bv).render((0,M.jsx)(d.StrictMode,{children:(0,M.jsx)(jv,{})}));
23
- //# sourceMappingURL=index-CWg-PJ_l.js.map
23
+ //# sourceMappingURL=index-Dc0xCRS3.js.map