likec4 1.52.0 → 1.53.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.
Files changed (36) hide show
  1. package/__app__/src/likec4.js +34 -48
  2. package/__app__/src/routes/index.js +7 -0
  3. package/__app__/src/routes/single.js +30 -18
  4. package/__app__/src/style.css +1 -1
  5. package/__app__/src/vendors.js +2065 -2809
  6. package/config/schema.json +56 -0
  7. package/dist/THIRD-PARTY-LICENSES.md +10 -2
  8. package/dist/_chunks/filesystem.mjs +70 -68
  9. package/dist/_chunks/index.d.mts +10 -1
  10. package/dist/_chunks/index2.d.mts +76 -4
  11. package/dist/_chunks/libs/@hono/mcp.mjs +1 -1
  12. package/dist/_chunks/libs/@logtape/logtape.d.mts +1021 -0
  13. package/dist/_chunks/libs/@logtape/logtape.mjs +4 -6
  14. package/dist/_chunks/libs/@modelcontextprotocol/sdk.d.mts +1 -1
  15. package/dist/_chunks/libs/@nanostores/react.d.mts +5 -5
  16. package/dist/_chunks/libs/destr.mjs +1 -0
  17. package/dist/_chunks/libs/fast-equals.mjs +1 -1
  18. package/dist/_chunks/libs/langium.mjs +1 -1
  19. package/dist/_chunks/libs/remeda.mjs +2 -2
  20. package/dist/_chunks/libs/tinyrainbow.mjs +1 -1
  21. package/dist/_chunks/libs/unstorage.mjs +1 -0
  22. package/dist/_chunks/node.mjs +1 -0
  23. package/dist/_chunks/sequence.mjs +1 -1
  24. package/dist/_chunks/src.mjs +14 -12
  25. package/dist/_chunks/src2.mjs +46 -46
  26. package/dist/cli/index.mjs +164 -84
  27. package/dist/index.d.mts +16 -819
  28. package/dist/index.mjs +1 -1
  29. package/dist/vite-plugin/index.mjs +1 -1
  30. package/dist/vite-plugin/internal.mjs +1 -1
  31. package/package.json +34 -33
  32. package/react/index.d.mts +24 -20
  33. package/react/index.mjs +969 -1728
  34. package/vite-plugin-modules.d.ts +5 -0
  35. package/dist/_chunks/LikeC4.mjs +0 -1
  36. package/dist/_chunks/libs/boxen.d.mts +0 -1
@@ -1,6 +1,4 @@
1
- import{r as e}from"../../rolldown-runtime.mjs";import t from"node:util";function n(e){return typeof e==`function`?e:r(e)}function r(e){if(e==null)return()=>!1;if(e===`fatal`)return e=>e.level===`fatal`;if(e===`error`)return e=>e.level===`fatal`||e.level===`error`;if(e===`warning`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`;if(e===`info`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`||e.level===`info`;if(e===`debug`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`||e.level===`info`||e.level===`debug`;if(e===`trace`)return()=>!0;throw TypeError(`Invalid log level: ${e}.`)}const i=[`trace`,`debug`,`info`,`warning`,`error`,`fatal`];function a(e,t){let n=i.indexOf(e);if(n<0)throw TypeError(`Invalid log level: ${JSON.stringify(e)}.`);let r=i.indexOf(t);if(r<0)throw TypeError(`Invalid log level: ${JSON.stringify(t)}.`);return n-r}function o(e=[]){return c.getLogger(e)}const s=Symbol.for(`logtape.rootLogger`);var c=class e{parent;children;category;sinks;parentSinks=`inherit`;filters;lowestLevel=`trace`;contextLocalStorage;static getLogger(t=[]){let n=s in globalThis?globalThis[s]??null:null;return n??(n=new e(null,[]),globalThis[s]=n),typeof t==`string`?n.getChild(t):t.length===0?n:n.getChild(t)}constructor(e,t){this.parent=e,this.children={},this.category=t,this.sinks=[],this.filters=[]}getChild(t){let n=typeof t==`string`?t:t[0],r=this.children[n],i=r instanceof e?r:r?.deref();return i??(i=new e(this,[...this.category,n]),this.children[n]=`WeakRef`in globalThis?new WeakRef(i):i),typeof t==`string`||t.length===1?i:i.getChild(t.slice(1))}reset(){for(;this.sinks.length>0;)this.sinks.shift();for(this.parentSinks=`inherit`;this.filters.length>0;)this.filters.shift();this.lowestLevel=`trace`}resetDescendants(){for(let t of Object.values(this.children))(t instanceof e?t:t.deref())?.resetDescendants();this.reset()}with(e){return new l(this,{...e})}filter(e){for(let t of this.filters)if(!t(e))return!1;return this.filters.length<1?this.parent?.filter(e)??!0:!0}*getSinks(e){if(!(this.lowestLevel===null||a(e,this.lowestLevel)<0)){if(this.parent!=null&&this.parentSinks===`inherit`)for(let t of this.parent.getSinks(e))yield t;for(let e of this.sinks)yield e}}emit(e,t){let n=y(),r=`category`in e?e.category:this.category,i=n.length>0?[...n,...r]:r,o=Object.getOwnPropertyDescriptors(e);o.category={value:i,enumerable:!0,configurable:!0};let s=Object.defineProperties({},o);if(!(this.lowestLevel===null||a(s.level,this.lowestLevel)<0||!this.filter(s))){for(let e of this.getSinks(s.level))if(!t?.has(e))try{e(s)}catch(n){let r=new Set(t);r.add(e),u.log(`fatal`,`Failed to emit a log record to sink {sink}: {error}`,{sink:e,error:n,record:s},r)}}}log(e,t,n,r){let i=b(),a,o=typeof n==`function`?{category:this.category,level:e,timestamp:Date.now(),get message(){return g(t,this.properties)},rawMessage:t,get properties(){return a??={...i,...n()},a}}:{category:this.category,level:e,timestamp:Date.now(),message:g(t,{...i,...n}),rawMessage:t,properties:{...i,...n}};this.emit(o,r)}logLazily(e,t,n={}){let r=b(),i,a;function o(){if((a==null||i==null)&&(a=t((e,...t)=>(i=e,_(e,t))),i==null))throw TypeError(`No log record was made.`);return[a,i]}this.emit({category:this.category,level:e,get message(){return o()[0]},get rawMessage(){return o()[1]},timestamp:Date.now(),properties:{...r,...n}})}logTemplate(e,t,n,r={}){let i=b();this.emit({category:this.category,level:e,message:_(t,n),rawMessage:t,timestamp:Date.now(),properties:{...i,...r}})}trace(e,...t){typeof e==`string`?this.log(`trace`,e,t[0]??{}):typeof e==`function`?this.logLazily(`trace`,e):Array.isArray(e)?this.logTemplate(`trace`,e,t):this.log(`trace`,`{*}`,e)}debug(e,...t){typeof e==`string`?this.log(`debug`,e,t[0]??{}):typeof e==`function`?this.logLazily(`debug`,e):Array.isArray(e)?this.logTemplate(`debug`,e,t):this.log(`debug`,`{*}`,e)}info(e,...t){typeof e==`string`?this.log(`info`,e,t[0]??{}):typeof e==`function`?this.logLazily(`info`,e):Array.isArray(e)?this.logTemplate(`info`,e,t):this.log(`info`,`{*}`,e)}warn(e,...t){typeof e==`string`?this.log(`warning`,e,t[0]??{}):typeof e==`function`?this.logLazily(`warning`,e):Array.isArray(e)?this.logTemplate(`warning`,e,t):this.log(`warning`,`{*}`,e)}warning(e,...t){this.warn(e,...t)}error(e,...t){typeof e==`string`?this.log(`error`,e,t[0]??{}):typeof e==`function`?this.logLazily(`error`,e):Array.isArray(e)?this.logTemplate(`error`,e,t):this.log(`error`,`{*}`,e)}fatal(e,...t){typeof e==`string`?this.log(`fatal`,e,t[0]??{}):typeof e==`function`?this.logLazily(`fatal`,e):Array.isArray(e)?this.logTemplate(`fatal`,e,t):this.log(`fatal`,`{*}`,e)}},l=class e{logger;properties;constructor(e,t){this.logger=e,this.properties=t}get category(){return this.logger.category}get parent(){return this.logger.parent}getChild(e){return this.logger.getChild(e).with(this.properties)}with(t){return new e(this.logger,{...this.properties,...t})}log(e,t,n,r){this.logger.log(e,t,typeof n==`function`?()=>({...this.properties,...n()}):{...this.properties,...n},r)}logLazily(e,t){this.logger.logLazily(e,t,this.properties)}logTemplate(e,t,n){this.logger.logTemplate(e,t,n,this.properties)}emit(e){let t={...e,properties:{...this.properties,...e.properties}};this.logger.emit(t)}trace(e,...t){typeof e==`string`?this.log(`trace`,e,t[0]??{}):typeof e==`function`?this.logLazily(`trace`,e):Array.isArray(e)?this.logTemplate(`trace`,e,t):this.log(`trace`,`{*}`,e)}debug(e,...t){typeof e==`string`?this.log(`debug`,e,t[0]??{}):typeof e==`function`?this.logLazily(`debug`,e):Array.isArray(e)?this.logTemplate(`debug`,e,t):this.log(`debug`,`{*}`,e)}info(e,...t){typeof e==`string`?this.log(`info`,e,t[0]??{}):typeof e==`function`?this.logLazily(`info`,e):Array.isArray(e)?this.logTemplate(`info`,e,t):this.log(`info`,`{*}`,e)}warn(e,...t){typeof e==`string`?this.log(`warning`,e,t[0]??{}):typeof e==`function`?this.logLazily(`warning`,e):Array.isArray(e)?this.logTemplate(`warning`,e,t):this.log(`warning`,`{*}`,e)}warning(e,...t){this.warn(e,...t)}error(e,...t){typeof e==`string`?this.log(`error`,e,t[0]??{}):typeof e==`function`?this.logLazily(`error`,e):Array.isArray(e)?this.logTemplate(`error`,e,t):this.log(`error`,`{*}`,e)}fatal(e,...t){typeof e==`string`?this.log(`fatal`,e,t[0]??{}):typeof e==`function`?this.logLazily(`fatal`,e):Array.isArray(e)?this.logTemplate(`fatal`,e,t):this.log(`fatal`,`{*}`,e)}};const u=c.getLogger([`logtape`,`meta`]);function d(e){return e.includes(`.`)||e.includes(`[`)||e.includes(`?.`)}function f(e,t){if(!(t===`__proto__`||t===`prototype`||t===`constructor`)&&(typeof e==`object`||typeof e==`function`)&&e!==null)return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function p(e,t){let n=e.length,r=t;if(r>=n)return null;let i;if(e[r]===`[`){if(r++,r>=n)return null;if(e[r]===`"`||e[r]===`'`){let t=e[r];r++;let a=``;for(;r<n&&e[r]!==t;)if(e[r]===`\\`){if(r++,r<n){let t=e[r];switch(t){case`n`:a+=`
2
- `;break;case`t`:a+=` `;break;case`r`:a+=`\r`;break;case`b`:a+=`\b`;break;case`f`:a+=`\f`;break;case`v`:a+=`\v`;break;case`0`:a+=`\0`;break;case`\\`:a+=`\\`;break;case`"`:a+=`"`;break;case`'`:a+=`'`;break;case`u`:if(r+4<n){let n=e.slice(r+1,r+5),i=Number.parseInt(n,16);Number.isNaN(i)?a+=t:(a+=String.fromCharCode(i),r+=4)}else a+=t;break;default:a+=t}r++}}else a+=e[r],r++;if(r>=n)return null;i=a,r++}else{let t=r;for(;r<n&&e[r]!==`]`&&e[r]!==`'`&&e[r]!==`"`;)r++;if(r>=n)return null;let a=e.slice(t,r);if(a.length===0)return null;let o=Number(a);i=Number.isNaN(o)?a:o}for(;r<n&&e[r]!==`]`;)r++;r<n&&r++}else{let t=r;for(;r<n&&e[r]!==`.`&&e[r]!==`[`&&e[r]!==`?`&&e[r]!==`]`;)r++;if(i=e.slice(t,r),i.length===0)return null}return r<n&&e[r]===`.`&&r++,{segment:i,nextIndex:r}}function m(e,t){if(typeof t==`string`)return f(e,t);if(Array.isArray(e)&&t>=0&&t<e.length)return e[t]}function h(e,t){if(e==null||t.length===0||t.endsWith(`.`))return;let n=e,r=0,i=t.length;for(;r<i;){if(t.slice(r,r+2)===`?.`){if(r+=2,n==null)return}else if(n==null)return;let e=p(t,r);if(e===null)return;let{segment:i,nextIndex:a}=e;if(r=a,n=m(n,i),n===void 0)return}return n}function g(e,t){let n=e.length;if(n===0)return[``];if(!e.includes(`{`))return[e];let r=[],i=0;for(let a=0;a<n;a++){let o=e[a];if(o===`{`){if((a+1<n?e[a+1]:``)===`{`){a++;continue}let o=e.indexOf(`}`,a+1);if(o===-1)continue;let s=e.slice(i,a);r.push(s.replace(/{{/g,`{`).replace(/}}/g,`}`));let c=e.slice(a+1,o),l,u=c.trim();u===`*`?l=c in t?t[c]:`*`in t?t[`*`]:t:(l=c===u||c in t?t[c]:t[u],l===void 0&&d(u)&&(l=h(t,u))),r.push(l),a=o,i=a+1}else o===`}`&&a+1<n&&e[a+1]===`}`&&a++}let a=e.slice(i);return r.push(a.replace(/{{/g,`{`).replace(/}}/g,`}`)),r}function _(e,t){let n=[];for(let r=0;r<e.length;r++)n.push(e[r]),r<t.length&&n.push(t[r]);return n}const v=Symbol.for(`logtape.categoryPrefix`);function y(){let e=c.getLogger().contextLocalStorage?.getStore();if(e==null)return[];let t=e[v];return Array.isArray(t)?t:[]}function b(){let e=c.getLogger().contextLocalStorage?.getStore();if(e==null)return{};let t={};for(let n of Object.keys(e))t[n]=e[n];return t}var x=e({inspect:()=>S});function S(e,n){return t.inspect(e,n)}const C={trace:`TRC`,debug:`DBG`,info:`INF`,warning:`WRN`,error:`ERR`,fatal:`FTL`},w=typeof document<`u`||typeof navigator<`u`&&navigator.product===`ReactNative`?e=>JSON.stringify(e):`Deno`in globalThis&&`inspect`in globalThis.Deno&&typeof globalThis.Deno.inspect==`function`?(e,t)=>globalThis.Deno.inspect(e,{strAbbreviateSize:1/0,iterableLimit:1/0,...t}):x!=null&&`inspect`in x&&typeof S==`function`?(e,t)=>S(e,{maxArrayLength:1/0,maxStringLength:1/0,...t}):e=>JSON.stringify(e);function T(e){return e<10?`0${e}`:`${e}`}function E(e){return e<10?`00${e}`:e<100?`0${e}`:`${e}`}const D={"date-time-timezone":e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${T(t.getUTCMonth()+1)}-${T(t.getUTCDate())} ${T(t.getUTCHours())}:${T(t.getUTCMinutes())}:${T(t.getUTCSeconds())}.${E(t.getUTCMilliseconds())} +00:00`},"date-time-tz":e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${T(t.getUTCMonth()+1)}-${T(t.getUTCDate())} ${T(t.getUTCHours())}:${T(t.getUTCMinutes())}:${T(t.getUTCSeconds())}.${E(t.getUTCMilliseconds())} +00`},"date-time":e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${T(t.getUTCMonth()+1)}-${T(t.getUTCDate())} ${T(t.getUTCHours())}:${T(t.getUTCMinutes())}:${T(t.getUTCSeconds())}.${E(t.getUTCMilliseconds())}`},"time-timezone":e=>{let t=new Date(e);return`${T(t.getUTCHours())}:${T(t.getUTCMinutes())}:${T(t.getUTCSeconds())}.${E(t.getUTCMilliseconds())} +00:00`},"time-tz":e=>{let t=new Date(e);return`${T(t.getUTCHours())}:${T(t.getUTCMinutes())}:${T(t.getUTCSeconds())}.${E(t.getUTCMilliseconds())} +00`},time:e=>{let t=new Date(e);return`${T(t.getUTCHours())}:${T(t.getUTCMinutes())}:${T(t.getUTCSeconds())}.${E(t.getUTCMilliseconds())}`},date:e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${T(t.getUTCMonth()+1)}-${T(t.getUTCDate())}`},rfc3339:e=>new Date(e).toISOString(),none:()=>null},O={ABBR:C,abbr:{trace:`trc`,debug:`dbg`,info:`inf`,warning:`wrn`,error:`err`,fatal:`ftl`},FULL:{trace:`TRACE`,debug:`DEBUG`,info:`INFO`,warning:`WARNING`,error:`ERROR`,fatal:`FATAL`},full:{trace:`trace`,debug:`debug`,info:`info`,warning:`warning`,error:`error`,fatal:`fatal`},L:{trace:`T`,debug:`D`,info:`I`,warning:`W`,error:`E`,fatal:`F`},l:{trace:`t`,debug:`d`,info:`i`,warning:`w`,error:`e`,fatal:`f`}};function k(e={}){let t=(()=>{let t=e.timestamp;return t==null?D[`date-time-timezone`]:t===`disabled`?D.none:typeof t==`string`&&t in D?D[t]:t})(),n=e.category??`·`,r=e.value?t=>e.value(t,w):w,i=(()=>{let t=e.level;return t==null||t===`ABBR`?e=>O.ABBR[e]:t===`abbr`?e=>O.abbr[e]:t===`FULL`?e=>O.FULL[e]:t===`full`?e=>O.full[e]:t===`L`?e=>O.L[e]:t===`l`?e=>O.l[e]:t})(),a=e.format??(({timestamp:e,level:t,category:n,message:r})=>`${e?`${e} `:``}[${t}] ${n}: ${r}`);return e=>{let o=e.message,s=o.length,c;if(s===1)c=o[0];else if(s<=6){c=``;for(let e=0;e<s;e++)c+=e%2==0?o[e]:r(o[e])}else{let e=Array(s);for(let t=0;t<s;t++)e[t]=t%2==0?o[t]:r(o[t]);c=e.join(``)}return`${a({timestamp:t(e.timestamp),level:i(e.level),category:typeof n==`function`?n(e.category):e.category.join(n),message:c,record:e})}\n`}}k();const A=`\x1B[0m`,j={black:`\x1B[30m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,magenta:`\x1B[35m`,cyan:`\x1B[36m`,white:`\x1B[37m`},M={bold:`\x1B[1m`,dim:`\x1B[2m`,italic:`\x1B[3m`,underline:`\x1B[4m`,strikethrough:`\x1B[9m`},N={trace:null,debug:`blue`,info:`green`,warning:`yellow`,error:`red`,fatal:`magenta`};function P(e={}){let t=e.format,n=e.timestampStyle===void 0?`dim`:e.timestampStyle,r=e.timestampColor??null,i=`${n==null?``:M[n]}${r==null?``:j[r]}`,a=n==null&&r==null?``:A,o=e.levelStyle===void 0?`bold`:e.levelStyle,s=e.levelColors??N,c=e.categoryStyle===void 0?`dim`:e.categoryStyle,l=e.categoryColor??null,u=`${c==null?``:M[c]}${l==null?``:j[l]}`,d=c==null&&l==null?``:A;return k({timestamp:`date-time-tz`,value(e,t){return t(e,{colors:!0})},...e,format({timestamp:e,level:n,category:r,message:c,record:l}){let f=s[l.level];return e=`${i}${e}${a}`,n=`${o==null?``:M[o]}${f==null?``:j[f]}${n}${o==null&&f==null?``:A}`,t==null?`${e} ${n} ${u}${r}:${d} ${c}`:t({timestamp:e,level:n,category:`${u}${r}${d}`,message:c,record:l})}})}P();function F(e={}){if(!e.categorySeparator&&!e.message&&!e.properties)return e=>{if(e.message.length===3)return JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:e.message[0]+JSON.stringify(e.message[1])+e.message[2],logger:e.category.join(`.`),properties:e.properties})+`
3
- `;if(e.message.length===1)return JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:e.message[0],logger:e.category.join(`.`),properties:e.properties})+`
4
- `;let t=e.message[0];for(let n=1;n<e.message.length;n++)t+=n&1?JSON.stringify(e.message[n]):e.message[n];return JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:t,logger:e.category.join(`.`),properties:e.properties})+`
5
- `};let t=e.message===`template`,n=e.properties??`nest:properties`,r;if(typeof e.categorySeparator==`function`)r=e.categorySeparator;else{let t=e.categorySeparator??`.`;r=e=>e.join(t)}let i;if(n===`flatten`)i=e=>e;else if(n.startsWith(`prepend:`)){let e=n.substring(8);if(e===``)throw TypeError(`Invalid properties option: ${JSON.stringify(n)}. It must be of the form "prepend:<prefix>" where <prefix> is a non-empty string.`);i=t=>{let n={};for(let r in t)n[`${e}${r}`]=t[r];return n}}else if(n.startsWith(`nest:`)){let e=n.substring(5);i=t=>({[e]:t})}else throw TypeError(`Invalid properties option: ${JSON.stringify(n)}. It must be "flatten", "prepend:<prefix>", or "nest:<key>".`);let a;return a=t?e=>{if(typeof e.rawMessage==`string`)return e.rawMessage;let t=``;for(let n=0;n<e.rawMessage.length;n++)t+=n%2<1?e.rawMessage[n]:`{}`;return t}:e=>{let t=e.message.length;if(t===1)return e.message[0];let n=``;for(let r=0;r<t;r++)n+=r%2<1?e.message[r]:JSON.stringify(e.message[r]);return n},e=>JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:a(e),logger:r(e.category),...i(e.properties)})+`
6
- `}F();const I={trace:`background-color: gray; color: white;`,debug:`background-color: gray; color: white;`,info:`background-color: white; color: black;`,warning:`background-color: orange; color: black;`,error:`background-color: red; color: white;`,fatal:`background-color: maroon; color: white;`};function L(e){let t=``,n=[];for(let r=0;r<e.message.length;r++)r%2==0?t+=e.message[r]:(t+=`%o`,n.push(e.message[r]));let r=new Date(e.timestamp);return[`%c${`${r.getUTCHours().toString().padStart(2,`0`)}:${r.getUTCMinutes().toString().padStart(2,`0`)}:${r.getUTCSeconds().toString().padStart(2,`0`)}.${r.getUTCMilliseconds().toString().padStart(3,`0`)}`} %c${C[e.level]}%c %c${e.category.join(`·`)} %c${t}`,`color: gray;`,I[e.level],`background-color: default;`,`color: gray;`,`color: default;`,...n]}function R(e={}){let t=e.formatter??L,n={trace:`debug`,debug:`debug`,info:`info`,warning:`warn`,error:`error`,fatal:`error`,...e.levelMap??{}},r=e.console??globalThis.console,i=e=>{let i=t(e),a=n[e.level];if(a===void 0)throw TypeError(`Invalid log level: ${e.level}.`);if(typeof i==`string`){let e=i.replace(/\r?\n$/,``);r[a](e)}else r[a](...i)};if(!e.nonBlocking)return i;let a=e.nonBlocking===!0?{}:e.nonBlocking,o=a.bufferSize??100,s=a.flushInterval??100,c=[],l=null,u=!1,d=!1,f=o*2;function p(){if(c.length===0)return;let e=c.splice(0);for(let t of e)try{i(t)}catch{}}function m(){d||(d=!0,setTimeout(()=>{d=!1,p()},0))}function h(){l!==null||u||(l=setInterval(()=>{p()},s))}let g=e=>{u||(c.length>=f&&c.shift(),c.push(e),c.length>=o?m():l===null&&h())};return g[Symbol.dispose]=()=>{u=!0,l!==null&&(clearInterval(l),l=null),p()},g}let z=null;const B=new Set,V=new Set,H=new Set;function U(e){return e.category.length===0||e.category.length===1&&e.category[0]===`logtape`||e.category.length===2&&e.category[0]===`logtape`&&e.category[1]===`meta`}function W(e){if(z!=null&&!e.reset)throw new X(`Already configured; if you want to reset, turn on the reset flag.`);if(H.size>0)throw new X(`Previously configured async disposables are still active. Use configure() instead or explicitly dispose them using dispose().`);K();try{G(e,!1)}catch(e){throw e instanceof X&&K(),e}}function G(e,t){z=e;let r=!1,i=new Set;for(let t of e.loggers){U(t)&&(r=!0);let a=Array.isArray(t.category)?JSON.stringify(t.category):JSON.stringify([t.category]);if(i.has(a))throw new X(`Duplicate logger configuration for category: ${a}. Each category can only be configured once.`);i.add(a);let o=c.getLogger(t.category);for(let n of t.sinks??[]){let t=e.sinks[n];if(!t)throw new X(`Sink not found: ${n}.`);o.sinks.push(t)}o.parentSinks=t.parentSinks??`inherit`,t.lowestLevel!==void 0&&(o.lowestLevel=t.lowestLevel);for(let r of t.filters??[]){let t=e.filters?.[r];if(t===void 0)throw new X(`Filter not found: ${r}.`);o.filters.push(n(t))}B.add(o)}c.getLogger().contextLocalStorage=e.contextLocalStorage;for(let n of Object.values(e.sinks)){if(Symbol.asyncDispose in n)if(t)H.add(n);else throw new X(`Async disposables cannot be used with configureSync().`);Symbol.dispose in n&&V.add(n)}for(let n of Object.values(e.filters??{}))if(!(n==null||typeof n==`string`)){if(Symbol.asyncDispose in n)if(t)H.add(n);else throw new X(`Async disposables cannot be used with configureSync().`);Symbol.dispose in n&&V.add(n)}if(typeof globalThis.EdgeRuntime!=`string`&&`process`in globalThis&&!(`Deno`in globalThis)){let e=globalThis.process,n=e?.on;typeof n==`function`&&n.call(e,`exit`,t?J:Y)}else addEventListener(`unload`,t?J:Y);let a=c.getLogger([`logtape`,`meta`]);r||a.sinks.push(R()),a.info(`LogTape loggers are configured. Note that LogTape itself uses the meta logger, which has category {metaLoggerCategory}. The meta logger purposes to log internal errors such as sink exceptions. If you are seeing this message, the meta logger is automatically configured. It's recommended to configure the meta logger with a separate sink so that you can easily notice if logging itself fails or is misconfigured. To turn off this message, configure the meta logger with higher log levels than {dismissLevel}. See also <https://logtape.org/manual/categories#meta-logger>.`,{metaLoggerCategory:[`logtape`,`meta`],dismissLevel:`info`})}function K(){Y(),q()}function q(){let e=c.getLogger([]);e.resetDescendants(),delete e.contextLocalStorage,B.clear(),z=null}async function J(){Y();let e=[];for(let t of H)e.push(t[Symbol.asyncDispose]()),H.delete(t);await Promise.all(e)}function Y(){for(let e of V)e[Symbol.dispose]();V.clear()}var X=class extends Error{constructor(e){super(e),this.name=`ConfigureError`}};export{o as a,k as i,R as n,P as r,W as t};
1
+ import{r as e}from"../../rolldown-runtime.mjs";import t from"node:util";function n(e){return typeof e==`function`?e:r(e)}function r(e){if(e==null)return()=>!1;if(e===`fatal`)return e=>e.level===`fatal`;if(e===`error`)return e=>e.level===`fatal`||e.level===`error`;if(e===`warning`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`;if(e===`info`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`||e.level===`info`;if(e===`debug`)return e=>e.level===`fatal`||e.level===`error`||e.level===`warning`||e.level===`info`||e.level===`debug`;if(e===`trace`)return()=>!0;throw TypeError(`Invalid log level: ${e}.`)}const i=[`trace`,`debug`,`info`,`warning`,`error`,`fatal`];function a(e,t){let n=i.indexOf(e);if(n<0)throw TypeError(`Invalid log level: ${JSON.stringify(e)}.`);let r=i.indexOf(t);if(r<0)throw TypeError(`Invalid log level: ${JSON.stringify(t)}.`);return n-r}const o=Symbol.for(`logtape.lazy`);function s(e){return typeof e==`object`&&!!e&&o in e&&e[o]===!0}function c(e){let t={};for(let n in e){let r=e[n];t[n]=s(r)?r.getter():r}return t}function l(e=[]){return d.getLogger(e)}const u=Symbol.for(`logtape.rootLogger`);var d=class e{parent;children;category;sinks;parentSinks=`inherit`;filters;lowestLevel=`trace`;contextLocalStorage;static getLogger(t=[]){let n=u in globalThis?globalThis[u]??null:null;return n??(n=new e(null,[]),globalThis[u]=n),typeof t==`string`?n.getChild(t):t.length===0?n:n.getChild(t)}constructor(e,t){this.parent=e,this.children={},this.category=t,this.sinks=[],this.filters=[]}getChild(t){let n=typeof t==`string`?t:t[0],r=this.children[n],i=r instanceof e?r:r?.deref();return i??(i=new e(this,[...this.category,n]),this.children[n]=`WeakRef`in globalThis?new WeakRef(i):i),typeof t==`string`||t.length===1?i:i.getChild(t.slice(1))}reset(){for(;this.sinks.length>0;)this.sinks.shift();for(this.parentSinks=`inherit`;this.filters.length>0;)this.filters.shift();this.lowestLevel=`trace`}resetDescendants(){for(let t of Object.values(this.children))(t instanceof e?t:t.deref())?.resetDescendants();this.reset()}with(e){return new f(this,{...e})}filter(e){for(let t of this.filters)if(!t(e))return!1;return this.filters.length<1?this.parent?.filter(e)??!0:!0}*getSinks(e){if(!(this.lowestLevel===null||a(e,this.lowestLevel)<0)){if(this.parent!=null&&this.parentSinks===`inherit`)for(let t of this.parent.getSinks(e))yield t;for(let e of this.sinks)yield e}}isEnabledFor(e){if(this.lowestLevel===null||a(e,this.lowestLevel)<0)return!1;for(let t of this.getSinks(e))return!0;return!1}emit(e,t){let n=ee(),r=`category`in e?e.category:this.category,i=n.length>0?[...n,...r]:r,o=Object.getOwnPropertyDescriptors(e);o.category={value:i,enumerable:!0,configurable:!0};let s=Object.defineProperties({},o);if(!(this.lowestLevel===null||a(s.level,this.lowestLevel)<0||!this.filter(s))){for(let e of this.getSinks(s.level))if(!t?.has(e))try{e(s)}catch(n){let r=new Set(t);r.add(e),p.log(`fatal`,`Failed to emit a log record to sink {sink}: {error}`,{sink:e,error:n,record:s},r)}}}log(e,t,n,r){let i=S(),a,o=typeof n==`function`?{category:this.category,level:e,timestamp:Date.now(),get message(){return y(t,this.properties)},rawMessage:t,get properties(){return a??={...i,...n()},a}}:{category:this.category,level:e,timestamp:Date.now(),message:y(t,{...i,...n}),rawMessage:t,properties:{...i,...n}};this.emit(o,r)}logLazily(e,t,n={}){let r=S(),i,a;function o(){if((a==null||i==null)&&(a=t((e,...t)=>(i=e,b(e,t))),i==null))throw TypeError(`No log record was made.`);return[a,i]}this.emit({category:this.category,level:e,get message(){return o()[0]},get rawMessage(){return o()[1]},timestamp:Date.now(),properties:{...r,...n}})}logTemplate(e,t,n,r={}){let i=S();this.emit({category:this.category,level:e,message:b(t,n),rawMessage:t,timestamp:Date.now(),properties:{...i,...r}})}trace(e,...t){if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`trace`)?n().then(t=>{this.log(`trace`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`trace`)?t.then(t=>{this.log(`trace`,e,t)}):Promise.resolve();this.log(`trace`,e,t);return}this.log(`trace`,e,n??{})}else typeof e==`function`?this.logLazily(`trace`,e):Array.isArray(e)?this.logTemplate(`trace`,e,t):this.log(`trace`,`{*}`,e)}debug(e,...t){if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`debug`)?n().then(t=>{this.log(`debug`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`debug`)?t.then(t=>{this.log(`debug`,e,t)}):Promise.resolve();this.log(`debug`,e,t);return}this.log(`debug`,e,n??{})}else typeof e==`function`?this.logLazily(`debug`,e):Array.isArray(e)?this.logTemplate(`debug`,e,t):this.log(`debug`,`{*}`,e)}info(e,...t){if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`info`)?n().then(t=>{this.log(`info`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`info`)?t.then(t=>{this.log(`info`,e,t)}):Promise.resolve();this.log(`info`,e,t);return}this.log(`info`,e,n??{})}else typeof e==`function`?this.logLazily(`info`,e):Array.isArray(e)?this.logTemplate(`info`,e,t):this.log(`info`,`{*}`,e)}warn(e,...t){if(e instanceof Error)this.log(`warning`,`{error.message}`,{error:e});else if(typeof e==`string`&&t[0]instanceof Error)this.log(`warning`,e,{error:t[0]});else if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`warning`)?n().then(t=>{this.log(`warning`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`warning`)?t.then(t=>{this.log(`warning`,e,t)}):Promise.resolve();this.log(`warning`,e,t);return}this.log(`warning`,e,n??{})}else typeof e==`function`?this.logLazily(`warning`,e):Array.isArray(e)?this.logTemplate(`warning`,e,t):this.log(`warning`,`{*}`,e)}warning(e,...t){if(e instanceof Error)this.log(`warning`,`{error.message}`,{error:e});else if(typeof e==`string`&&t[0]instanceof Error)this.log(`warning`,e,{error:t[0]});else if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`warning`)?n().then(t=>{this.log(`warning`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`warning`)?t.then(t=>{this.log(`warning`,e,t)}):Promise.resolve();this.log(`warning`,e,t);return}this.log(`warning`,e,n??{})}else typeof e==`function`?this.logLazily(`warning`,e):Array.isArray(e)?this.logTemplate(`warning`,e,t):this.log(`warning`,`{*}`,e)}error(e,...t){if(e instanceof Error)this.log(`error`,`{error.message}`,{error:e});else if(typeof e==`string`&&t[0]instanceof Error)this.log(`error`,e,{error:t[0]});else if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`error`)?n().then(t=>{this.log(`error`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`error`)?t.then(t=>{this.log(`error`,e,t)}):Promise.resolve();this.log(`error`,e,t);return}this.log(`error`,e,n??{})}else typeof e==`function`?this.logLazily(`error`,e):Array.isArray(e)?this.logTemplate(`error`,e,t):this.log(`error`,`{*}`,e)}fatal(e,...t){if(e instanceof Error)this.log(`fatal`,`{error.message}`,{error:e});else if(typeof e==`string`&&t[0]instanceof Error)this.log(`fatal`,e,{error:t[0]});else if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`fatal`)?n().then(t=>{this.log(`fatal`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`fatal`)?t.then(t=>{this.log(`fatal`,e,t)}):Promise.resolve();this.log(`fatal`,e,t);return}this.log(`fatal`,e,n??{})}else typeof e==`function`?this.logLazily(`fatal`,e):Array.isArray(e)?this.logTemplate(`fatal`,e,t):this.log(`fatal`,`{*}`,e)}},f=class e{logger;properties;constructor(e,t){this.logger=e,this.properties=t}get category(){return this.logger.category}get parent(){return this.logger.parent}getChild(e){return this.logger.getChild(e).with(this.properties)}with(t){return new e(this.logger,{...this.properties,...t})}log(e,t,n,r){let i=this.properties;this.logger.log(e,t,typeof n==`function`?()=>c({...i,...n()}):()=>c({...i,...n}),r)}logLazily(e,t){this.logger.logLazily(e,t,c(this.properties))}logTemplate(e,t,n){this.logger.logTemplate(e,t,n,c(this.properties))}emit(e){let t={...e,properties:c({...this.properties,...e.properties})};this.logger.emit(t)}isEnabledFor(e){return this.logger.isEnabledFor(e)}trace(e,...t){if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`trace`)?n().then(t=>{this.log(`trace`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`trace`)?t.then(t=>{this.log(`trace`,e,t)}):Promise.resolve();this.log(`trace`,e,t);return}this.log(`trace`,e,n??{})}else typeof e==`function`?this.logLazily(`trace`,e):Array.isArray(e)?this.logTemplate(`trace`,e,t):this.log(`trace`,`{*}`,e)}debug(e,...t){if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`debug`)?n().then(t=>{this.log(`debug`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`debug`)?t.then(t=>{this.log(`debug`,e,t)}):Promise.resolve();this.log(`debug`,e,t);return}this.log(`debug`,e,n??{})}else typeof e==`function`?this.logLazily(`debug`,e):Array.isArray(e)?this.logTemplate(`debug`,e,t):this.log(`debug`,`{*}`,e)}info(e,...t){if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`info`)?n().then(t=>{this.log(`info`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`info`)?t.then(t=>{this.log(`info`,e,t)}):Promise.resolve();this.log(`info`,e,t);return}this.log(`info`,e,n??{})}else typeof e==`function`?this.logLazily(`info`,e):Array.isArray(e)?this.logTemplate(`info`,e,t):this.log(`info`,`{*}`,e)}warn(e,...t){if(e instanceof Error)this.log(`warning`,`{error.message}`,{error:e});else if(typeof e==`string`&&t[0]instanceof Error)this.log(`warning`,e,{error:t[0]});else if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`warning`)?n().then(t=>{this.log(`warning`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`warning`)?t.then(t=>{this.log(`warning`,e,t)}):Promise.resolve();this.log(`warning`,e,t);return}this.log(`warning`,e,n??{})}else typeof e==`function`?this.logLazily(`warning`,e):Array.isArray(e)?this.logTemplate(`warning`,e,t):this.log(`warning`,`{*}`,e)}warning(e,...t){if(e instanceof Error)this.log(`warning`,`{error.message}`,{error:e});else if(typeof e==`string`&&t[0]instanceof Error)this.log(`warning`,e,{error:t[0]});else if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`warning`)?n().then(t=>{this.log(`warning`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`warning`)?t.then(t=>{this.log(`warning`,e,t)}):Promise.resolve();this.log(`warning`,e,t);return}this.log(`warning`,e,n??{})}else typeof e==`function`?this.logLazily(`warning`,e):Array.isArray(e)?this.logTemplate(`warning`,e,t):this.log(`warning`,`{*}`,e)}error(e,...t){if(e instanceof Error)this.log(`error`,`{error.message}`,{error:e});else if(typeof e==`string`&&t[0]instanceof Error)this.log(`error`,e,{error:t[0]});else if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`error`)?n().then(t=>{this.log(`error`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`error`)?t.then(t=>{this.log(`error`,e,t)}):Promise.resolve();this.log(`error`,e,t);return}this.log(`error`,e,n??{})}else typeof e==`function`?this.logLazily(`error`,e):Array.isArray(e)?this.logTemplate(`error`,e,t):this.log(`error`,`{*}`,e)}fatal(e,...t){if(e instanceof Error)this.log(`fatal`,`{error.message}`,{error:e});else if(typeof e==`string`&&t[0]instanceof Error)this.log(`fatal`,e,{error:t[0]});else if(typeof e==`string`){let n=t[0];if(typeof n==`function`){if(n.constructor.name===`AsyncFunction`)return this.isEnabledFor(`fatal`)?n().then(t=>{this.log(`fatal`,e,t)}):Promise.resolve();let t=n();if(t instanceof Promise)return this.isEnabledFor(`fatal`)?t.then(t=>{this.log(`fatal`,e,t)}):Promise.resolve();this.log(`fatal`,e,t);return}this.log(`fatal`,e,n??{})}else typeof e==`function`?this.logLazily(`fatal`,e):Array.isArray(e)?this.logTemplate(`fatal`,e,t):this.log(`fatal`,`{*}`,e)}};const p=d.getLogger([`logtape`,`meta`]);function m(e){return e.includes(`.`)||e.includes(`[`)||e.includes(`?.`)}function h(e,t){if(!(t===`__proto__`||t===`prototype`||t===`constructor`)&&(typeof e==`object`||typeof e==`function`)&&e!==null)return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function g(e,t){let n=e.length,r=t;if(r>=n)return null;let i;if(e[r]===`[`){if(r++,r>=n)return null;if(e[r]===`"`||e[r]===`'`){let t=e[r];r++;let a=``;for(;r<n&&e[r]!==t;)if(e[r]===`\\`){if(r++,r<n){let t=e[r];switch(t){case`n`:a+=`
2
+ `;break;case`t`:a+=` `;break;case`r`:a+=`\r`;break;case`b`:a+=`\b`;break;case`f`:a+=`\f`;break;case`v`:a+=`\v`;break;case`0`:a+=`\0`;break;case`\\`:a+=`\\`;break;case`"`:a+=`"`;break;case`'`:a+=`'`;break;case`u`:if(r+4<n){let n=e.slice(r+1,r+5),i=Number.parseInt(n,16);Number.isNaN(i)?a+=t:(a+=String.fromCharCode(i),r+=4)}else a+=t;break;default:a+=t}r++}}else a+=e[r],r++;if(r>=n)return null;i=a,r++}else{let t=r;for(;r<n&&e[r]!==`]`&&e[r]!==`'`&&e[r]!==`"`;)r++;if(r>=n)return null;let a=e.slice(t,r);if(a.length===0)return null;let o=Number(a);i=Number.isNaN(o)?a:o}for(;r<n&&e[r]!==`]`;)r++;r<n&&r++}else{let t=r;for(;r<n&&e[r]!==`.`&&e[r]!==`[`&&e[r]!==`?`&&e[r]!==`]`;)r++;if(i=e.slice(t,r),i.length===0)return null}return r<n&&e[r]===`.`&&r++,{segment:i,nextIndex:r}}function _(e,t){if(typeof t==`string`)return h(e,t);if(Array.isArray(e)&&t>=0&&t<e.length)return e[t]}function v(e,t){if(e==null||t.length===0||t.endsWith(`.`))return;let n=e,r=0,i=t.length;for(;r<i;){if(t.slice(r,r+2)===`?.`){if(r+=2,n==null)return}else if(n==null)return;let e=g(t,r);if(e===null)return;let{segment:i,nextIndex:a}=e;if(r=a,n=_(n,i),n===void 0)return}return n}function y(e,t){let n=e.length;if(n===0)return[``];if(!e.includes(`{`))return[e];let r=[],i=0;for(let a=0;a<n;a++){let o=e[a];if(o===`{`){if((a+1<n?e[a+1]:``)===`{`){a++;continue}let o=e.indexOf(`}`,a+1);if(o===-1)continue;let s=e.slice(i,a);r.push(s.replace(/{{/g,`{`).replace(/}}/g,`}`));let c=e.slice(a+1,o),l,u=c.trim();u===`*`?l=c in t?t[c]:`*`in t?t[`*`]:t:(l=c===u||c in t?t[c]:t[u],l===void 0&&m(u)&&(l=v(t,u))),r.push(l),a=o,i=a+1}else o===`}`&&a+1<n&&e[a+1]===`}`&&a++}let a=e.slice(i);return r.push(a.replace(/{{/g,`{`).replace(/}}/g,`}`)),r}function b(e,t){let n=[];for(let r=0;r<e.length;r++)n.push(e[r]),r<t.length&&n.push(t[r]);return n}const x=Symbol.for(`logtape.categoryPrefix`);function ee(){let e=d.getLogger().contextLocalStorage?.getStore();if(e==null)return[];let t=e[x];return Array.isArray(t)?t:[]}function S(){let e=d.getLogger().contextLocalStorage?.getStore();if(e==null)return{};let t={};for(let n of Object.keys(e))t[n]=e[n];return t}var C=e({inspect:()=>w});function w(e,n){return t.inspect(e,n)}const T={trace:`TRC`,debug:`DBG`,info:`INF`,warning:`WRN`,error:`ERR`,fatal:`FTL`},E=typeof document<`u`||typeof navigator<`u`&&navigator.product===`ReactNative`?e=>JSON.stringify(e):`Deno`in globalThis&&`inspect`in globalThis.Deno&&typeof globalThis.Deno.inspect==`function`?(e,t)=>globalThis.Deno.inspect(e,{strAbbreviateSize:1/0,iterableLimit:1/0,...t}):C!=null&&`inspect`in C&&typeof w==`function`?(e,t)=>w(e,{maxArrayLength:1/0,maxStringLength:1/0,...t}):e=>JSON.stringify(e);function D(e){return e<10?`0${e}`:`${e}`}function O(e){return e<10?`00${e}`:e<100?`0${e}`:`${e}`}const k={"date-time-timezone":e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${D(t.getUTCMonth()+1)}-${D(t.getUTCDate())} ${D(t.getUTCHours())}:${D(t.getUTCMinutes())}:${D(t.getUTCSeconds())}.${O(t.getUTCMilliseconds())} +00:00`},"date-time-tz":e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${D(t.getUTCMonth()+1)}-${D(t.getUTCDate())} ${D(t.getUTCHours())}:${D(t.getUTCMinutes())}:${D(t.getUTCSeconds())}.${O(t.getUTCMilliseconds())} +00`},"date-time":e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${D(t.getUTCMonth()+1)}-${D(t.getUTCDate())} ${D(t.getUTCHours())}:${D(t.getUTCMinutes())}:${D(t.getUTCSeconds())}.${O(t.getUTCMilliseconds())}`},"time-timezone":e=>{let t=new Date(e);return`${D(t.getUTCHours())}:${D(t.getUTCMinutes())}:${D(t.getUTCSeconds())}.${O(t.getUTCMilliseconds())} +00:00`},"time-tz":e=>{let t=new Date(e);return`${D(t.getUTCHours())}:${D(t.getUTCMinutes())}:${D(t.getUTCSeconds())}.${O(t.getUTCMilliseconds())} +00`},time:e=>{let t=new Date(e);return`${D(t.getUTCHours())}:${D(t.getUTCMinutes())}:${D(t.getUTCSeconds())}.${O(t.getUTCMilliseconds())}`},date:e=>{let t=new Date(e);return`${t.getUTCFullYear()}-${D(t.getUTCMonth()+1)}-${D(t.getUTCDate())}`},rfc3339:e=>new Date(e).toISOString(),none:()=>null},A={ABBR:T,abbr:{trace:`trc`,debug:`dbg`,info:`inf`,warning:`wrn`,error:`err`,fatal:`ftl`},FULL:{trace:`TRACE`,debug:`DEBUG`,info:`INFO`,warning:`WARNING`,error:`ERROR`,fatal:`FATAL`},full:{trace:`trace`,debug:`debug`,info:`info`,warning:`warning`,error:`error`,fatal:`fatal`},L:{trace:`T`,debug:`D`,info:`I`,warning:`W`,error:`E`,fatal:`F`},l:{trace:`t`,debug:`d`,info:`i`,warning:`w`,error:`e`,fatal:`f`}};function j(e){return e===`crlf`?`\r
3
+ `:`
4
+ `}function M(e,t){if(!(t instanceof Error))return t;let n={name:t.name,message:t.message};typeof t.stack==`string`&&(n.stack=t.stack);let r=t.cause;r!==void 0&&(n.cause=r),typeof AggregateError<`u`&&t instanceof AggregateError&&(n.errors=t.errors);for(let e of Object.keys(t))e in n||(n[e]=t[e]);return n}function N(e={}){let t=(()=>{let t=e.timestamp;return t==null?k[`date-time-timezone`]:t===`disabled`?k.none:typeof t==`string`&&t in k?k[t]:t})(),n=e.category??`·`,r=e.value?t=>e.value(t,E):E,i=(()=>{let t=e.level;return t==null||t===`ABBR`?e=>A.ABBR[e]:t===`abbr`?e=>A.abbr[e]:t===`FULL`?e=>A.FULL[e]:t===`full`?e=>A.full[e]:t===`L`?e=>A.L[e]:t===`l`?e=>A.l[e]:t})(),a=j(e.lineEnding),o=e.format??(({timestamp:e,level:t,category:n,message:r})=>`${e?`${e} `:``}[${t}] ${n}: ${r}`);return e=>{let s=e.message,c=s.length,l;if(c===1)l=s[0];else if(c<=6){l=``;for(let e=0;e<c;e++)l+=e%2==0?s[e]:r(s[e])}else{let e=Array(c);for(let t=0;t<c;t++)e[t]=t%2==0?s[t]:r(s[t]);l=e.join(``)}return`${o({timestamp:t(e.timestamp),level:i(e.level),category:typeof n==`function`?n(e.category):e.category.join(n),message:l,record:e})}${a}`}}N();const P=`\x1B[0m`,F={black:`\x1B[30m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,magenta:`\x1B[35m`,cyan:`\x1B[36m`,white:`\x1B[37m`},I={bold:`\x1B[1m`,dim:`\x1B[2m`,italic:`\x1B[3m`,underline:`\x1B[4m`,strikethrough:`\x1B[9m`},L={trace:null,debug:`blue`,info:`green`,warning:`yellow`,error:`red`,fatal:`magenta`};function R(e={}){let t=e.format,n=e.timestampStyle===void 0?`dim`:e.timestampStyle,r=e.timestampColor??null,i=`${n==null?``:I[n]}${r==null?``:F[r]}`,a=n==null&&r==null?``:P,o=e.levelStyle===void 0?`bold`:e.levelStyle,s=e.levelColors??L,c=e.categoryStyle===void 0?`dim`:e.categoryStyle,l=e.categoryColor??null,u=`${c==null?``:I[c]}${l==null?``:F[l]}`,d=c==null&&l==null?``:P;return N({timestamp:`date-time-tz`,value(e,t){return t(e,{colors:!0})},...e,format({timestamp:e,level:n,category:r,message:c,record:l}){let f=s[l.level];return e=e==null?null:`${i}${e}${a}`,n=`${o==null?``:I[o]}${f==null?``:F[f]}${n}${o==null&&f==null?``:P}`,t==null?`${e==null?``:`${e} `}${n} ${u}${r}:${d} ${c}`:t({timestamp:e,level:n,category:`${u}${r}${d}`,message:c,record:l})}})}R();function z(e={}){let t=j(e.lineEnding);if(!e.categorySeparator&&!e.message&&!e.properties)return e=>{if(e.message.length===3)return JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:e.message[0]+JSON.stringify(e.message[1])+e.message[2],logger:e.category.join(`.`),properties:e.properties},M)+t;if(e.message.length===1)return JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:e.message[0],logger:e.category.join(`.`),properties:e.properties},M)+t;let n=e.message[0];for(let t=1;t<e.message.length;t++)n+=t&1?JSON.stringify(e.message[t]):e.message[t];return JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:n,logger:e.category.join(`.`),properties:e.properties},M)+t};let n=e.message===`template`,r=e.properties??`nest:properties`,i;if(typeof e.categorySeparator==`function`)i=e.categorySeparator;else{let t=e.categorySeparator??`.`;i=e=>e.join(t)}let a;if(r===`flatten`)a=e=>e;else if(r.startsWith(`prepend:`)){let e=r.substring(8);if(e===``)throw TypeError(`Invalid properties option: ${JSON.stringify(r)}. It must be of the form "prepend:<prefix>" where <prefix> is a non-empty string.`);a=t=>{let n={};for(let r in t)n[`${e}${r}`]=t[r];return n}}else if(r.startsWith(`nest:`)){let e=r.substring(5);a=t=>({[e]:t})}else throw TypeError(`Invalid properties option: ${JSON.stringify(r)}. It must be "flatten", "prepend:<prefix>", or "nest:<key>".`);let o;return o=n?e=>{if(typeof e.rawMessage==`string`)return e.rawMessage;let t=``;for(let n=0;n<e.rawMessage.length;n++)t+=n%2<1?e.rawMessage[n]:`{}`;return t}:e=>{let t=e.message.length;if(t===1)return e.message[0];let n=``;for(let r=0;r<t;r++)n+=r%2<1?e.message[r]:JSON.stringify(e.message[r]);return n},e=>JSON.stringify({"@timestamp":new Date(e.timestamp).toISOString(),level:e.level===`warning`?`WARN`:e.level.toUpperCase(),message:o(e),logger:i(e.category),...a(e.properties)},M)+t}z();const B={trace:`background-color: gray; color: white;`,debug:`background-color: gray; color: white;`,info:`background-color: white; color: black;`,warning:`background-color: orange; color: black;`,error:`background-color: red; color: white;`,fatal:`background-color: maroon; color: white;`};function V(e){let t=``,n=[];for(let r=0;r<e.message.length;r++)r%2==0?t+=e.message[r]:(t+=`%o`,n.push(e.message[r]));let r=new Date(e.timestamp);return[`%c${`${r.getUTCHours().toString().padStart(2,`0`)}:${r.getUTCMinutes().toString().padStart(2,`0`)}:${r.getUTCSeconds().toString().padStart(2,`0`)}.${r.getUTCMilliseconds().toString().padStart(3,`0`)}`} %c${T[e.level]}%c %c${e.category.join(`·`)} %c${t}`,`color: gray;`,B[e.level],`background-color: default;`,`color: gray;`,`color: default;`,...n]}function H(e={}){let t=e.formatter??V,n={trace:`debug`,debug:`debug`,info:`info`,warning:`warn`,error:`error`,fatal:`error`,...e.levelMap??{}},r=e.console??globalThis.console,i=e=>{let i=t(e),a=n[e.level];if(a===void 0)throw TypeError(`Invalid log level: ${e.level}.`);if(typeof i==`string`){let e=i.replace(/\r?\n$/,``);r[a](e)}else r[a](...i)};if(!e.nonBlocking)return i;let a=e.nonBlocking===!0?{}:e.nonBlocking,o=a.bufferSize??100,s=a.flushInterval??100,c=[],l=null,u=!1,d=!1,f=o*2;function p(){if(c.length===0)return;let e=c.splice(0);for(let t of e)try{i(t)}catch{}}function m(){d||(d=!0,setTimeout(()=>{d=!1,p()},0))}function h(){l!==null||u||(l=setInterval(()=>{p()},s))}let g=e=>{u||(c.length>=f&&c.shift(),c.push(e),c.length>=o?m():l===null&&h())};return g[Symbol.dispose]=()=>{u=!0,l!==null&&(clearInterval(l),l=null),p()},g}let U=null;const W=new Set,G=new Set,K=new Set;function q(e){return e.category.length===0||e.category.length===1&&e.category[0]===`logtape`||e.category.length===2&&e.category[0]===`logtape`&&e.category[1]===`meta`}function J(e){if(U!=null&&!e.reset)throw new $(`Already configured; if you want to reset, turn on the reset flag.`);if(K.size>0)throw new $(`Previously configured async disposables are still active. Use configure() instead or explicitly dispose them using dispose().`);X();try{Y(e,!1)}catch(e){throw e instanceof $&&X(),e}}function Y(e,t){U=e;let r=!1,i=new Set;for(let t of e.loggers){q(t)&&(r=!0);let a=Array.isArray(t.category)?JSON.stringify(t.category):JSON.stringify([t.category]);if(i.has(a))throw new $(`Duplicate logger configuration for category: ${a}. Each category can only be configured once.`);i.add(a);let o=d.getLogger(t.category);for(let n of t.sinks??[]){let t=e.sinks[n];if(!t)throw new $(`Sink not found: ${n}.`);o.sinks.push(t)}o.parentSinks=t.parentSinks??`inherit`,t.lowestLevel!==void 0&&(o.lowestLevel=t.lowestLevel);for(let r of t.filters??[]){let t=e.filters?.[r];if(t===void 0)throw new $(`Filter not found: ${r}.`);o.filters.push(n(t))}W.add(o)}d.getLogger().contextLocalStorage=e.contextLocalStorage;for(let n of Object.values(e.sinks)){if(Symbol.asyncDispose in n)if(t)K.add(n);else throw new $(`Async disposables cannot be used with configureSync().`);Symbol.dispose in n&&G.add(n)}for(let n of Object.values(e.filters??{}))if(!(n==null||typeof n==`string`)){if(Symbol.asyncDispose in n)if(t)K.add(n);else throw new $(`Async disposables cannot be used with configureSync().`);Symbol.dispose in n&&G.add(n)}if(typeof globalThis.EdgeRuntime!=`string`&&`process`in globalThis&&!(`Deno`in globalThis)){let e=globalThis.process,n=e?.on;typeof n==`function`&&n.call(e,`exit`,t?Z:Q)}else `Deno`in globalThis?addEventListener(`unload`,t?Z:Q):addEventListener(`pagehide`,t?Z:Q);let a=d.getLogger([`logtape`,`meta`]);r||a.sinks.push(H()),a.info(`LogTape loggers are configured. Note that LogTape itself uses the meta logger, which has category {metaLoggerCategory}. The meta logger is used to log internal diagnostics such as sink exceptions. It's recommended to configure the meta logger with a separate sink so that you can easily notice if logging itself fails or is misconfigured. To turn off this message, configure the meta logger with higher log levels than {dismissLevel}. See also <https://logtape.org/manual/categories#meta-logger>.`,{metaLoggerCategory:[`logtape`,`meta`],dismissLevel:`info`})}function X(){Q(),te()}function te(){let e=d.getLogger([]);e.resetDescendants(),delete e.contextLocalStorage,W.clear(),U=null}async function Z(){Q();let e=[];for(let t of K)e.push(t[Symbol.asyncDispose]()),K.delete(t);await Promise.all(e)}function Q(){for(let e of G)e[Symbol.dispose]();G.clear()}var $=class extends Error{constructor(e){super(e),this.name=`ConfigureError`}};export{l as a,N as i,H as n,R as r,J as t};
@@ -8722,4 +8722,4 @@ type RegisteredPrompt = {
8722
8722
  remove(): void;
8723
8723
  };
8724
8724
  //#endregion
8725
- export { $strip as S, ZodUnion$1 as _, ZodBoolean as a, $partial as b, ZodEnum$1 as c, ZodObject$1 as d, ZodOptional$1 as f, ZodTransform as g, ZodString as h, ZodArray$1 as i, ZodInt as l, ZodRecord as m, ServerOptions as n, ZodCustom as o, ZodPipe as p, ZodAny as r, ZodDefault$1 as s, McpServer as t, ZodNumber as u, input$1 as v, $strict as x, output$1 as y };
8725
+ export { $strip as C, $strict as S, ZodTransform as _, ZodBoolean as a, output$1 as b, ZodEnum$1 as c, ZodNumber as d, ZodObject$1 as f, ZodString as g, ZodRecord as h, ZodArray$1 as i, ZodInt as l, ZodPipe as m, ServerOptions as n, ZodCustom as o, ZodOptional$1 as p, ZodAny as r, ZodDefault$1 as s, McpServer as t, ZodLiteral as u, ZodUnion$1 as v, $partial as x, input$1 as y };
@@ -1,6 +1,6 @@
1
1
  import { DependencyList } from "react";
2
2
 
3
- //#region ../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/atom/index.d.ts
3
+ //#region ../../node_modules/.pnpm/nanostores@1.1.1/node_modules/nanostores/atom/index.d.ts
4
4
  type AllKeys<T> = T extends any ? keyof T : never;
5
5
  type Primitive = boolean | number | string;
6
6
  type ReadonlyIfObject<Value> = Value extends undefined ? Value : Value extends ((...args: any) => any) ? Value : Value extends Primitive ? Value : Value extends object ? Readonly<Value> : Value;
@@ -119,7 +119,7 @@ type Atom<Value = any> = ReadableAtom<Value> | WritableAtom<Value>;
119
119
  */
120
120
  declare function atom<Value, StoreExt = object>(...args: undefined extends Value ? [] | [Value] : [Value]): PreinitializedWritableAtom<Value> & StoreExt;
121
121
  //#endregion
122
- //#region ../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/map/index.d.ts
122
+ //#region ../../node_modules/.pnpm/nanostores@1.1.1/node_modules/nanostores/map/index.d.ts
123
123
  type KeyofBase = keyof any;
124
124
  type Get<T, K extends KeyofBase> = Extract<T, { [K1 in K]: any }>[K];
125
125
  type HasIndexSignature<T> = string extends keyof T ? true : false;
@@ -213,12 +213,12 @@ interface PreinitializedMapStore<Value extends object = any> extends MapStore<Va
213
213
  */
214
214
  declare function map<Value extends object, StoreExt extends object = object>(value?: Value): PreinitializedMapStore<Value> & StoreExt;
215
215
  //#endregion
216
- //#region ../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/task/index.d.ts
216
+ //#region ../../node_modules/.pnpm/nanostores@1.1.1/node_modules/nanostores/task/index.d.ts
217
217
  interface Task<Value> extends Promise<Value> {
218
218
  t: true;
219
219
  }
220
220
  //#endregion
221
- //#region ../../node_modules/.pnpm/nanostores@1.1.0/node_modules/nanostores/computed/index.d.ts
221
+ //#region ../../node_modules/.pnpm/nanostores@1.1.1/node_modules/nanostores/computed/index.d.ts
222
222
  type StoreValues<Stores extends AnyStore[]> = { [Index in keyof Stores]: StoreValue<Stores[Index]> };
223
223
  interface Computed {
224
224
  <Value, OriginStore extends Store>(stores: OriginStore, cb: (value: StoreValue<OriginStore>) => Task<Value>): ReadableAtom<undefined | Value>;
@@ -273,7 +273,7 @@ interface Batched {
273
273
  }
274
274
  declare const batched: Batched;
275
275
  //#endregion
276
- //#region ../../node_modules/.pnpm/@nanostores+react@1.0.0_nanostores@1.1.0_react@19.2.4/node_modules/@nanostores/react/index.d.ts
276
+ //#region ../../node_modules/.pnpm/@nanostores+react@1.0.0_nanostores@1.1.1_react@19.2.4/node_modules/@nanostores/react/index.d.ts
277
277
  type StoreKeys<T> = T extends {
278
278
  setKey: (k: infer K, v: any) => unknown;
279
279
  } ? K : never;
@@ -0,0 +1 @@
1
+ const e=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,t=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,n=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function r(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){i(e);return}return t}function i(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function a(i,a={}){if(typeof i!=`string`)return i;if(i[0]===`"`&&i[i.length-1]===`"`&&i.indexOf(`\\`)===-1)return i.slice(1,-1);let o=i.trim();if(o.length<=9)switch(o.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!n.test(i)){if(a.strict)throw SyntaxError(`[destr] Invalid JSON`);return i}try{if(e.test(i)||t.test(i)){if(a.strict)throw Error(`[destr] Possible prototype pollution`);return JSON.parse(i,r)}return JSON.parse(i)}catch(e){if(a.strict)throw e;return i}}export{a as t};
@@ -1 +1 @@
1
- const{getOwnPropertyNames:e,getOwnPropertySymbols:t}=Object,{hasOwnProperty:n}=Object.prototype;function r(e,t){return function n(r,i,a){return e(r,i,a)&&t(r,i,a)}}function i(e){return function t(n,r,i){if(!n||!r||typeof n!=`object`||typeof r!=`object`)return e(n,r,i);let{cache:a}=i,o=a.get(n),s=a.get(r);if(o&&s)return o===r&&s===n;a.set(n,r),a.set(r,n);let c=e(n,r,i);return a.delete(n),a.delete(r),c}}function a(n){return e(n).concat(t(n))}const o=Object.hasOwn||((e,t)=>n.call(e,t)),{getOwnPropertyDescriptor:s,keys:c}=Object,l=Object.is||function e(t,n){return t===n?t!==0||1/t==1/n:t!==t&&n!==n};function u(e,t){return e===t}function d(e,t){return e.byteLength===t.byteLength&&S(new Uint8Array(e),new Uint8Array(t))}function f(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function p(e,t){return e.byteLength===t.byteLength&&S(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function m(e,t){return l(e.getTime(),t.getTime())}function h(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function g(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}function _(e,t,n){let r=c(e),i=r.length;if(c(t).length!==i)return!1;for(;i-- >0;)if(!w(e,t,n,r[i]))return!1;return!0}function v(e,t,n){let r=a(e),i=r.length;if(a(t).length!==i)return!1;let o,c,l;for(;i-- >0;)if(o=r[i],!w(e,t,n,o)||(c=s(e,o),l=s(t,o),(c||l)&&(!c||!l||c.configurable!==l.configurable||c.enumerable!==l.enumerable||c.writable!==l.writable)))return!1;return!0}function y(e,t){return l(e.valueOf(),t.valueOf())}function b(e,t){return e.source===t.source&&e.flags===t.flags}function x(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function S(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function C(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function w(e,t,n,r){return(r===`_owner`||r===`__o`||r===`__v`)&&(e.$$typeof||t.$$typeof)?!0:o(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const T=Object.prototype.toString;function E(e){let t=A(e),{areArraysEqual:n,areDatesEqual:r,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:o,areObjectsEqual:s,areRegExpsEqual:c,areSetsEqual:l,getUnsupportedCustomComparator:u}=e;return function e(d,f,p){if(d===f)return!0;if(d==null||f==null)return!1;let m=typeof d;if(m!==typeof f)return!1;if(m!==`object`)return m===`number`||m===`bigint`?o(d,f,p):m===`function`?i(d,f,p):!1;let h=d.constructor;if(h!==f.constructor)return!1;if(h===Object)return s(d,f,p);if(h===Array)return n(d,f,p);if(h===Date)return r(d,f,p);if(h===RegExp)return c(d,f,p);if(h===Map)return a(d,f,p);if(h===Set)return l(d,f,p);if(h===Promise)return!1;if(Array.isArray(d))return n(d,f,p);let g=T.call(d),_=t[g];if(_)return _(d,f,p);let v=u&&u(d,f,p,g);return v?v(d,f,p):!1}}function D({circular:e,createCustomConfig:t,strict:n}){let a={areArrayBuffersEqual:d,areArraysEqual:n?v:f,areDataViewsEqual:p,areDatesEqual:m,areErrorsEqual:h,areFunctionsEqual:u,areMapsEqual:n?r(g,v):g,areNumbersEqual:l,areObjectsEqual:n?v:_,arePrimitiveWrappersEqual:y,areRegExpsEqual:b,areSetsEqual:n?r(x,v):x,areTypedArraysEqual:n?r(S,v):S,areUrlsEqual:C,getUnsupportedCustomComparator:void 0};if(t&&(a=Object.assign({},a,t(a))),e){let e=i(a.areArraysEqual),t=i(a.areMapsEqual),n=i(a.areObjectsEqual),r=i(a.areSetsEqual);a=Object.assign({},a,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:r})}return a}function O(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function k({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function a(o,s){let{cache:c=e?new WeakMap:void 0,meta:l}=n();return t(o,s,{cache:c,equals:r,meta:l,strict:i})};if(e)return function e(n,a){return t(n,a,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function e(n,r){return t(n,r,a)}}function A({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p}){return{"[object Arguments]":c,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":s,"[object BigInt64Array]":f,"[object BigUint64Array]":f,"[object Boolean]":l,"[object DataView]":n,"[object Date]":r,"[object Error]":i,"[object Float16Array]":f,"[object Float32Array]":f,"[object Float64Array]":f,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":f,"[object Int16Array]":f,"[object Int32Array]":f,"[object Map]":o,"[object Number]":l,"[object Object]":(e,t,n)=>typeof e.then!=`function`&&typeof t.then!=`function`&&c(e,t,n),"[object RegExp]":u,"[object Set]":d,"[object String]":l,"[object URL]":p,"[object Uint8Array]":f,"[object Uint8ClampedArray]":f,"[object Uint16Array]":f,"[object Uint32Array]":f}}const j=M();M({strict:!0}),M({circular:!0}),M({circular:!0,strict:!0}),M({createInternalComparator:()=>l}),M({strict:!0,createInternalComparator:()=>l}),M({circular:!0,createInternalComparator:()=>l}),M({circular:!0,createInternalComparator:()=>l,strict:!0});function M(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=E(D(e));return k({circular:t,comparator:a,createState:r,equals:n?n(a):O(a),strict:i})}export{j as t};
1
+ const{getOwnPropertyNames:e,getOwnPropertySymbols:t}=Object,{hasOwnProperty:n}=Object.prototype;function r(e,t){return function n(r,i,a){return e(r,i,a)&&t(r,i,a)}}function i(e){return function t(n,r,i){if(!n||!r||typeof n!=`object`||typeof r!=`object`)return e(n,r,i);let{cache:a}=i,o=a.get(n),s=a.get(r);if(o&&s)return o===r&&s===n;a.set(n,r),a.set(r,n);let c=e(n,r,i);return a.delete(n),a.delete(r),c}}function a(n){return e(n).concat(t(n))}const o=Object.hasOwn||((e,t)=>n.call(e,t)),{getOwnPropertyDescriptor:s,keys:c}=Object,l=Object.is||function e(t,n){return t===n?t!==0||1/t==1/n:t!==t&&n!==n};function u(e,t){return e===t}function d(e,t){return e.byteLength===t.byteLength&&S(new Uint8Array(e),new Uint8Array(t))}function f(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function p(e,t){return e.byteLength===t.byteLength&&S(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function m(e,t){return l(e.getTime(),t.getTime())}function h(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function g(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}function _(e,t,n){let r=c(e),i=r.length;if(c(t).length!==i)return!1;for(;i-- >0;)if(!w(e,t,n,r[i]))return!1;return!0}function v(e,t,n){let r=a(e),i=r.length;if(a(t).length!==i)return!1;let o,c,l;for(;i-- >0;)if(o=r[i],!w(e,t,n,o)||(c=s(e,o),l=s(t,o),(c||l)&&(!c||!l||c.configurable!==l.configurable||c.enumerable!==l.enumerable||c.writable!==l.writable)))return!1;return!0}function y(e,t){return l(e.valueOf(),t.valueOf())}function b(e,t){return e.source===t.source&&e.flags===t.flags}function x(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function S(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function C(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function w(e,t,n,r){return(r===`_owner`||r===`__o`||r===`__v`)&&(e.$$typeof||t.$$typeof)?!0:o(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const T=Object.prototype.toString;function E(e){let t=A(e),{areArraysEqual:n,areDatesEqual:r,areFunctionsEqual:i,areMapsEqual:a,areNumbersEqual:o,areObjectsEqual:s,areRegExpsEqual:c,areSetsEqual:l,getUnsupportedCustomComparator:u}=e;return function e(d,f,p){if(d===f)return!0;if(d==null||f==null)return!1;let m=typeof d;if(m!==typeof f)return!1;if(m!==`object`)return m===`number`||m===`bigint`?o(d,f,p):m===`function`?i(d,f,p):!1;let h=d.constructor;if(h!==f.constructor)return!1;if(h===Object)return s(d,f,p);if(h===Array)return n(d,f,p);if(h===Date)return r(d,f,p);if(h===RegExp)return c(d,f,p);if(h===Map)return a(d,f,p);if(h===Set)return l(d,f,p);if(h===Promise)return!1;if(Array.isArray(d))return n(d,f,p);let g=T.call(d),_=t[g];if(_)return _(d,f,p);let v=u&&u(d,f,p,g);return v?v(d,f,p):!1}}function D({circular:e,createCustomConfig:t,strict:n}){let a={areArrayBuffersEqual:d,areArraysEqual:n?v:f,areDataViewsEqual:p,areDatesEqual:m,areErrorsEqual:h,areFunctionsEqual:u,areMapsEqual:n?r(g,v):g,areNumbersEqual:l,areObjectsEqual:n?v:_,arePrimitiveWrappersEqual:y,areRegExpsEqual:b,areSetsEqual:n?r(x,v):x,areTypedArraysEqual:n?r(S,v):S,areUrlsEqual:C,getUnsupportedCustomComparator:void 0};if(t&&(a=Object.assign({},a,t(a))),e){let e=i(a.areArraysEqual),t=i(a.areMapsEqual),n=i(a.areObjectsEqual),r=i(a.areSetsEqual);a=Object.assign({},a,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:r})}return a}function O(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function k({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function a(o,s){let{cache:c=e?new WeakMap:void 0,meta:l}=n();return t(o,s,{cache:c,equals:r,meta:l,strict:i})};if(e)return function e(n,a){return t(n,a,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function e(n,r){return t(n,r,a)}}function A({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p}){return{"[object Arguments]":c,"[object Array]":t,"[object ArrayBuffer]":e,"[object AsyncGeneratorFunction]":a,"[object BigInt]":s,"[object BigInt64Array]":f,"[object BigUint64Array]":f,"[object Boolean]":l,"[object DataView]":n,"[object Date]":r,"[object Error]":i,"[object Float16Array]":f,"[object Float32Array]":f,"[object Float64Array]":f,"[object Function]":a,"[object GeneratorFunction]":a,"[object Int8Array]":f,"[object Int16Array]":f,"[object Int32Array]":f,"[object Map]":o,"[object Number]":l,"[object Object]":(e,t,n)=>typeof e.then!=`function`&&typeof t.then!=`function`&&c(e,t,n),"[object RegExp]":u,"[object Set]":d,"[object String]":l,"[object URL]":p,"[object Uint8Array]":f,"[object Uint8ClampedArray]":f,"[object Uint16Array]":f,"[object Uint32Array]":f}}j(),j({strict:!0}),j({circular:!0}),j({circular:!0,strict:!0}),j({createInternalComparator:()=>l}),j({strict:!0,createInternalComparator:()=>l}),j({circular:!0,createInternalComparator:()=>l}),j({circular:!0,createInternalComparator:()=>l,strict:!0});function j(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=E(D(e));return k({circular:t,comparator:a,createState:r,equals:n?n(a):O(a),strict:i})}export{};
@@ -30,4 +30,4 @@ import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"../rolldown-runtime.mjs"
30
30
  `.repeat(a)}${r}`,range:e}}fitIntoOptions(e,t,n){return n.allowMore?e=Math.max(t,e):n.allowLess&&(e=Math.min(t,e)),e}findFittingMove(e,t,n){if(t.length===0)return;if(t.length===1)return t[0];let r=e.end.line-e.start.line;for(let e of t)if(e.lines!==void 0&&r<=e.lines)return e;else if(e.lines===void 0&&r===0)return e;return t[t.length-1]}iterateCstTree(e,t){let n=e.parseResult.value.$cstNode;return n?new ne(n,e=>this.iterateCst(e,t)):k}iterateCst(e,t){if(!T(e))return k;let n=t.indentation;return new O(()=>({index:0}),r=>r.index<e.content.length?{done:!1,value:e.content[r.index++]}:(t.indentation=n,A))}},ju=class{constructor(e,t){this.astNode=e,this.collector=t}node(e){return new Mu(e.$cstNode?[e.$cstNode]:[],this.collector)}nodes(...e){let t=[];for(let n of e)n.$cstNode&&t.push(n.$cstNode);return new Mu(t,this.collector)}property(e,t){let n=Kn(this.astNode.$cstNode,e,t);return new Mu(n?[n]:[],this.collector)}properties(...e){let t=[];for(let n of e){let e=Gn(this.astNode.$cstNode,n);t.push(...e)}return new Mu(t,this.collector)}keyword(e,t){let n=Yn(this.astNode.$cstNode,e,t);return new Mu(n?[n]:[],this.collector)}keywords(...e){let t=[];for(let n of e){let e=Jn(this.astNode.$cstNode,n);t.push(...e)}return new Mu(t,this.collector)}cst(e){return new Mu([...e],this.collector)}interior(e,t){let n=e.nodes,r=t.nodes;if(n.length!==1||r.length!==1)return new Mu([],this.collector);let i=n[0],a=r[0];if(i.offset>a.offset){let e=i;i=a,a=e}return new Mu(_e(i,a),this.collector)}},Mu=class e{constructor(e,t){this.nodes=e,this.collector=t}prepend(e){for(let t of this.nodes)this.collector(t,`prepend`,e);return this}append(e){for(let t of this.nodes)this.collector(t,`append`,e);return this}surround(e){for(let t of this.nodes)this.collector(t,`prepend`,e),this.collector(t,`append`,e);return this}slice(t,n){return new e(this.nodes.slice(t,n),this.collector)}},Nu;(function(e){function t(...e){return{options:{},moves:e.flatMap(e=>e.moves).sort(l)}}e.fit=t;function n(e){return i(0,e)}e.noSpace=n;function r(e){return i(1,e)}e.oneSpace=r;function i(e,t){return{options:t??{},moves:[{characters:e}]}}e.spaces=i;function a(e){return o(1,e)}e.newLine=a;function o(e,t){return{options:t??{},moves:[{lines:e}]}}e.newLines=o;function s(e){return{options:e??{},moves:[{tabs:1,lines:1}]}}e.indent=s;function c(e){return{options:e??{},moves:[{tabs:0}]}}e.noIndent=c;function l(e,t){let n=e.lines??0,r=t.lines??0,i=e.tabs??0,a=t.tabs??0,o=e.characters??0,s=t.characters??0;return n<r?-1:n>r?1:i<a?-1:i>a?1:o<s?-1:o>s?1:0}})(Nu||={});var Pu=class{constructor(){this.encoding=`utf-8`}readFile(e){return y.promises.readFile(e.fsPath,this.encoding)}async readDirectory(e){return(await y.promises.readdir(e.fsPath,{withFileTypes:!0})).map(t=>({dirent:t,isFile:t.isFile(),isDirectory:t.isDirectory(),uri:J.joinPath(e,t.name)}))}};function Fu(e){if(e){if(`astNode`in e)return Ru(e);if(Array.isArray(e))return e.reduce(Vu,void 0);{let t=e;return Bu(t,Iu(t)?Lu(t?.root?.astNode??t?.astNode):void 0)}}}function Iu(e){return e!==void 0&&`element`in e&&`text`in e}function Lu(e){try{return B(e).uri.toString()}catch{return}}function Ru(e){let{astNode:t,property:n,index:r}=e??{},i=t?.$cstNode??t?.$textRegion;if(!(t===void 0||i===void 0)){if(n===void 0)return Bu(i,zu(t));{let e=e=>r!==void 0&&r>-1&&Array.isArray(t[n])?r<e.length?e[r]:void 0:e.reduce(Vu,void 0);if(i.assignments?.[n]){let r=e(i.assignments[n]);return r&&Bu(r,zu(t))}else if(t.$cstNode){let r=e(Gn(t.$cstNode,n));return r&&Bu(r,zu(t))}else return}}}function zu(e){if(e.$cstNode)return(B(e)?.uri)?.toString();if(e.$textRegion)return e.$textRegion.documentURI||new ne(e,e=>e.$container?[e.$container]:[]).find(e=>e.$textRegion?.documentURI)?.$textRegion?.documentURI}function Bu(e,t){let n={offset:e.offset,end:e.end??e.offset+e.length,length:e.length??e.end-e.offset};return e.range&&(n.range=e.range),t??=e.fileURI,t&&(n.fileURI=t),n}function Vu(e,t){if(!e)return t&&Bu(t);if(!t)return e&&Bu(e);let n=e.end??e.offset+e.length,r=t.end??t.offset+t.length,i=Math.min(e.offset,t.offset),a=Math.max(n,r),o={offset:i,end:a,length:a-i};if(e.range&&t.range&&(o.range={start:t.range.start.line<e.range.start.line||t.range.start.line===e.range.start.line&&t.range.start.character<e.range.start.character?t.range.start:e.range.start,end:t.range.end.line>e.range.end.line||t.range.end.line===e.range.end.line&&t.range.end.character>e.range.end.character?t.range.end:e.range.end}),e.fileURI||t.fileURI){let n=e.fileURI,r=t.fileURI;o.fileURI=n&&r&&n!==r?`<unmergable text regions of ${n}, ${r}>`:n??r}return o}var Hu=class{constructor(e){this.defaultIndentation=` `,this.pendingIndent=!0,this.currentIndents=[],this.recentNonImmediateIndents=[],this.traceData=[],this.lines=[[]],this.length=0,typeof e==`string`?this.defaultIndentation=e:typeof e==`number`&&(this.defaultIndentation=``.padStart(e))}get content(){return this.lines.map(e=>e.join(``)).join(``)}get contentLength(){return this.length}get currentLineNumber(){return this.lines.length-1}get currentLineContent(){return this.lines[this.currentLineNumber].join(``)}get currentPosition(){return{offset:this.contentLength,line:this.currentLineNumber,character:this.currentLineContent.length}}append(e,t){if(e.length>0){let n=t&&this.currentPosition;this.lines[this.currentLineNumber].push(e),this.length+=e.length,n&&this.indentPendingTraceRegions(n)}}indentPendingTraceRegions(e){for(let t=this.traceData.length-1;t>=0;t--){let n=this.traceData[t];n.targetStart&&n.targetStart.offset===e.offset&&(n.targetStart=this.currentPosition)}}increaseIndent(e){this.currentIndents.push(e),e.indentImmediately||this.recentNonImmediateIndents.push(e)}decreaseIndent(){this.currentIndents.pop()}get relevantIndents(){return this.currentIndents.filter(e=>!this.recentNonImmediateIndents.includes(e))}resetCurrentLine(){this.length-=this.lines[this.currentLineNumber].join(``).length,this.lines[this.currentLineNumber]=[],this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}addNewLine(){this.lines.push([]),this.pendingIndent=!0,this.recentNonImmediateIndents.length=0}pushTraceRegion(e){let t=Uu(e,this.currentPosition,e=>(this.traceData[this.traceData.length-1]?.children)?.push(e));return this.traceData.push(t),t}popTraceRegion(e){let t=this.traceData.pop();return this.assertTrue(t===e,`Trace region mismatch!`),t}getParentTraceSourceFileURI(){for(let e=this.traceData.length-1;e>-1;e--){let t=this.traceData[e].sourceRegion?.fileURI;if(t)return t}}assertTrue(e,t){if(!e)throw Error(t)}};function Uu(e,t,n){let r={sourceRegion:e,targetRegion:void 0,children:[],targetStart:t,complete:e=>(r.targetRegion={offset:r.targetStart.offset,end:e.offset,length:e.offset-r.targetStart.offset,range:{start:{line:r.targetStart.line,character:r.targetStart.character},end:{line:e.line,character:e.character}}},delete r.targetStart,r.children?.length===0&&delete r.children,r.targetRegion?.length&&n(r),delete r.complete,r)};return r}function Wu(e,t){let n=new Hu(t),r=n.pushTraceRegion(void 0);Gu(e,n),n.popTraceRegion(r),r.complete&&r.complete(n.currentPosition);let i=r.children&&r.children.length===1?r.children[0]:void 0,a=i?.targetRegion,o=r.targetRegion;return a&&i.sourceRegion&&a.offset===o.offset&&a.length===o.length?{text:n.content,trace:i}:{text:n.content,trace:r}}function Gu(e,t){typeof e==`string`?qu(e,t):e instanceof gd?Xu(e,t):e instanceof md?Yu(e,t):e instanceof _d&&Zu(e,t)}function Ku(e,t){return typeof e==`string`?e.length!==0:e instanceof md?e.contents.some(e=>Ku(e,t)):e instanceof _d?!(e.ifNotEmpty&&t.currentLineContent.length===0):!1}function qu(e,t){e&&(Ju(t,!1),t.append(e))}function Ju(e,t){if(e.pendingIndent){let n=``;for(let r of e.relevantIndents.filter(e=>e.indentEmptyLines||!t))n+=r.indentation??e.defaultIndentation;e.append(n,!0),e.pendingIndent=!1}}function Yu(e,t){let n,r=Fu(e.tracedSource);r&&(n=t.pushTraceRegion(r));for(let n of e.contents)Gu(n,t);if(n){t.popTraceRegion(n);let e=t.getParentTraceSourceFileURI();e&&r?.fileURI===e&&delete r.fileURI,n.complete&&n.complete(t.currentPosition)}}function Xu(e,t){if(Ku(e,t)){e.indentImmediately&&!t.pendingIndent&&t.append(e.indentation??t.defaultIndentation,!0);try{t.increaseIndent(e),Yu(e,t)}finally{t.decreaseIndent()}}}function Zu(e,t){e.ifNotEmpty&&!Qu(t.currentLineContent)?t.resetCurrentLine():(Ju(t,!0),t.append(e.lineDelimiter),t.addNewLine())}function Qu(e){return e.trimStart()!==``}Object.freeze(`__«SKIP^NEW^LINE^IF^EMPTY»__`);const $u=/\S|$/;function ed(e){let t=e.filter(e=>e.length>0).map(e=>e.search($u)),n=t.length===0?0:Math.min(...t);return Math.max(0,n)}function td(e,...t){return ud(id(e,t,rd(e)))}function nd(e,t,n){return(r,...i)=>hd(e,t,n)(td(r,...i))}function rd(e){let t=e.join(`_`).split(En),n=t.length>1&&t[0].trim().length===0,r=n&&t.length>1&&t[t.length-1].trim().length===0;if(t.length===1||t.length!==0&&t[0].trim().length!==0||t.length===2&&t[1].trim().length===0)return{indentation:0,omitFirstLine:n,omitLastLine:r,trimLastLine:t.length!==1&&t[t.length-1].trim().length===0};{let e=n?t.slice(1):t;e=r?e.slice(0,e.length-1):e,e=e.filter(e=>e.length!==0);let i=ed(e);return{indentation:i,omitFirstLine:n,omitLastLine:r&&(t[t.length-1].length<i||!t[t.length-1].startsWith(e[0].substring(0,i)))}}}function id(e,t,{indentation:n,omitFirstLine:r,omitLastLine:i,trimLastLine:a}){let o=[];e.forEach((e,i)=>{o.push(...e.split(En).map((e,t)=>t===0||e.length<n?e:e.substring(n)).reduce(i===0?(e,t,n)=>n===0?r?[]:[t]:n===1&&e.length===0?[t]:e.concat(ad,t):(e,t,n)=>n===0?[t]:e.concat(ad,t),[]).filter(e=>!(typeof e==`string`&&e.length===0)).concat(fd(t[i])?t[i]:t[i]===void 0?i<t.length?od:[]:{content:String(t[i])}))});let s=o.length,c=s===0?void 0:o[s-1];return(i||a)&&typeof c==`string`&&c.trim().length===0?r&&s!==1&&o[s-2]===ad?o.slice(0,s-2):o.slice(0,s-1):o}const ad={isNewLine:!0},od={isUndefinedSegment:!0},sd=e=>e===ad,cd=e=>e===od,ld=e=>e.content!==void 0;function ud(e){return e.reduce((t,n,r)=>cd(n)?t:sd(n)?{node:r!==0&&(cd(e[r-1])||fd(e[r-1]))||r>1&&typeof e[r-1]==`string`&&(cd(e[r-2])||fd(e[r-2]))?t.node.appendNewLineIfNotEmpty():t.node.appendNewLine()}:(()=>{let i=(r===0||sd(e[r-1]))&&typeof n==`string`&&n.length!==0?``.padStart(n.length-n.trimStart().length):``,a=ld(n)?n.content:n,o;return{node:t.indented?t.node:i.length===0?t.node.append(a):t.node.indent({indentation:i,indentImmediately:!1,indentedChildren:e=>o=e.append(a)}),indented:o??t.indented?.append(a)}})(),{node:new md}).node}const dd=typeof process>`u`?`
31
31
  `:process.platform===`win32`?`\r
32
32
  `:`
33
- `;function fd(e){return e instanceof md||e instanceof gd||e instanceof _d}function pd(e,t){return fd(e)?Wu(e,t).text:String(e)}var md=class e{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,t,n){if(b(e)){if(this.tracedSource={astNode:e,property:t,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw Error(`Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.`)}else this.tracedSource=e;return this}append(...e){for(let t of e)typeof t==`function`?t(this):t&&this.contents.push(t);return this}appendIf(e,...t){return e?this.append(...t):this}appendNewLine(){return this.append(vd)}appendNewLineIf(e){return e?this.append(vd):this}appendNewLineIfNotEmpty(){return this.append(yd)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...t){return this.append(td(e,...t))}appendTemplateIf(e){return e?(e,...t)=>this.appendTemplate(e,...t):()=>this}indent(e){let{indentedChildren:t,indentation:n,indentEmptyLines:r,indentImmediately:i}=Array.isArray(e)||typeof e==`function`?{indentedChildren:e}:typeof e==`object`?e:{},a=new gd(n,i,r);return this.contents.push(a),Array.isArray(t)?a.append(...t):t&&a.append(t),this}appendTraced(t,n,r){return i=>this.append(new e().trace(t,n,r).append(i))}appendTracedIf(e,t,n,r){return e?this.appendTraced(typeof t==`function`?t():t,n,r):()=>this}appendTracedTemplate(e,t,n){return(r,...i)=>this.append(nd(e,t,n)(r,...i))}appendTracedTemplateIf(e,t,n,r){return e?this.appendTracedTemplate(typeof t==`function`?t():t,n,r):()=>this}};function hd(e,t,n){return r=>r instanceof md&&r.tracedSource===void 0?r.trace(e,t,n):new md().trace(e,t,n).append(r)}var gd=class extends md{constructor(e,t=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e==`string`?this.indentation=e:typeof e==`number`&&(this.indentation=``.padStart(e)),this.indentImmediately=t,this.indentEmptyLines=n}},_d=class{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??dd,this.ifNotEmpty=t}};const vd=new _d,yd=new _d(void 0,!0),bd=e=>e===void 0||typeof e==`string`||fd(e)?e:String(e);function xd(e,t=bd,n={}){let r=typeof t==`function`?t:bd,{filter:i,prefix:a,suffix:o,separator:s,appendNewLineIfNotEmpty:c,skipNewLineAfterLastItem:l}=typeof t==`object`?t:n,u=typeof a==`function`?a:(()=>a),d=typeof o==`function`?o:(()=>o);return Sd(e,(e,t,n,a)=>{if(i&&!i(t,n,a))return e;let o=r(t,n,a);return o===void 0?e:(e??=new md).append(u(t,n,a)).append(o).append(d(t,n,a)).appendIf(!a,s).appendNewLineIfNotEmptyIf(!e.isEmpty()&&!!c&&(!a||!l))})}function Sd(e,t,n){let r=e[Symbol.iterator](),i=r.next(),a=0,o=n;for(;!i.done;){let e=r.next();o=t(o,i.value,a,!!e.done),i=e,a++}return o}export{Mi as $,So as A,J as B,Wo as C,jo as D,Io as E,fo as F,Ia as G,Za as H,lo as I,Lr as J,La as K,co as L,go as M,ho as N,Co as O,mo as P,Ni as Q,ao as R,ws as S,Vo as T,K as U,q as V,Ja as W,V as X,oi as Y,H as Z,al as _,j as _t,td as a,Gn as at,Xs as b,Nu as c,pn as ct,Su as d,_n as dt,yi as et,Hl as f,Rt as ft,yl as g,k as gt,xl as h,le as ht,pd as i,Kn as it,_o as j,yo as k,Eu as l,B as lt,jl as m,Xt as mt,md as n,Qi as nt,Pu as o,Ln as ot,Ll as p,Wt as pt,ai as q,vd as r,Yn as rt,Au as s,dn as st,xd as t,Hr as tt,Ou as u,mn as ut,Z as v,w as vt,Uo as w,Ps as x,uc as y,b as yt,Y as z};
33
+ `;function fd(e){return e instanceof md||e instanceof gd||e instanceof _d}function pd(e,t){return fd(e)?Wu(e,t).text:String(e)}var md=class e{constructor(...e){this.contents=[],this.append(...e)}isEmpty(){return this.contents.length===0}trace(e,t,n){if(b(e)){if(this.tracedSource={astNode:e,property:t,index:n},this.tracedSource.property===void 0&&this.tracedSource.index!==void 0&&this.tracedSource.index>-1)throw Error(`Generation support: 'property' argument must not be 'undefined' if a non-negative value is assigned to 'index' in 'CompositeGeneratorNode.trace(...)'.`)}else this.tracedSource=e;return this}append(...e){for(let t of e)typeof t==`function`?t(this):t&&this.contents.push(t);return this}appendIf(e,...t){return e?this.append(...t):this}appendNewLine(){return this.append(vd)}appendNewLineIf(e){return e?this.append(vd):this}appendNewLineIfNotEmpty(){return this.append(yd)}appendNewLineIfNotEmptyIf(e){return e?this.appendNewLineIfNotEmpty():this}appendTemplate(e,...t){return this.append(td(e,...t))}appendTemplateIf(e){return e?(e,...t)=>this.appendTemplate(e,...t):()=>this}indent(e){let{indentedChildren:t,indentation:n,indentEmptyLines:r,indentImmediately:i}=Array.isArray(e)||typeof e==`function`?{indentedChildren:e}:typeof e==`object`?e:{},a=new gd(n,i,r);return this.contents.push(a),Array.isArray(t)?a.append(...t):t&&a.append(t),this}appendTraced(t,n,r){return i=>this.append(new e().trace(t,n,r).append(i))}appendTracedIf(e,t,n,r){return e?this.appendTraced(typeof t==`function`?t():t,n,r):()=>this}appendTracedTemplate(e,t,n){return(r,...i)=>this.append(nd(e,t,n)(r,...i))}appendTracedTemplateIf(e,t,n,r){return e?this.appendTracedTemplate(typeof t==`function`?t():t,n,r):()=>this}};function hd(e,t,n){return r=>r instanceof md&&r.tracedSource===void 0?r.trace(e,t,n):new md().trace(e,t,n).append(r)}var gd=class extends md{constructor(e,t=!0,n=!1){super(),this.indentImmediately=!0,this.indentEmptyLines=!1,typeof e==`string`?this.indentation=e:typeof e==`number`&&(this.indentation=``.padStart(e)),this.indentImmediately=t,this.indentEmptyLines=n}},_d=class{constructor(e,t=!1){this.ifNotEmpty=!1,this.lineDelimiter=e??dd,this.ifNotEmpty=t}};const vd=new _d,yd=new _d(void 0,!0),bd=e=>e===void 0||typeof e==`string`||fd(e)?e:String(e);function xd(e,t=bd,n={}){let r=typeof t==`function`?t:bd,{filter:i,prefix:a,suffix:o,separator:s,appendNewLineIfNotEmpty:c,skipNewLineAfterLastItem:l}=typeof t==`object`?t:n,u=typeof a==`function`?a:(()=>a),d=typeof o==`function`?o:(()=>o);return Sd(e,(e,t,n,a)=>{if(i&&!i(t,n,a))return e;let o=r(t,n,a);return o===void 0?e:(e??=new md).append(u(t,n,a)).append(o).append(d(t,n,a)).appendIf(!a,s).appendNewLineIfNotEmptyIf(!e.isEmpty()&&!!c&&(!a||!l))})}function Sd(e,t,n){let r=e[Symbol.iterator](),i=r.next(),a=0,o=n;for(;!i.done;){let e=r.next();o=t(o,i.value,a,!!e.done),i=e,a++}return o}export{Ni as $,yo as A,Y as B,Wo as C,jo as D,Io as E,mo as F,Ja as G,q as H,fo as I,ai as J,Ia as K,lo as L,_o as M,go as N,Co as O,ho as P,H as Q,co as R,ws as S,Vo as T,Za as U,J as V,K as W,oi as X,Lr as Y,V as Z,al as _,k as _t,td as a,Kn as at,Xs as b,b as bt,Nu as c,dn as ct,Su as d,mn as dt,Mi as et,Hl as f,_n as ft,yl as g,le as gt,xl as h,Xt as ht,pd as i,Yn as it,So as j,bo as k,Eu as l,pn as lt,jl as m,Wt as mt,md as n,Hr as nt,Pu as o,Gn as ot,Ll as p,Rt as pt,La as q,vd as r,Qi as rt,Au as s,Ln as st,xd as t,yi as tt,Ou as u,B as ut,Z as v,j as vt,Uo as w,Ps as x,uc as y,w as yt,ao as z};
@@ -1,2 +1,2 @@
1
- function e(e,t,n){let r=n=>e(n,...t);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:t})}function t(t,n,r){let i=t.length-n.length;if(i===0)return t(...n);if(i===1)return e(t,n,r);throw Error(`Wrong number of arguments`)}function n(...e){return t(r,e)}const r=(e,t)=>t.some(t=>t(e));function i(...e){return t(a,e)}function a(e,t){if(t<1)throw RangeError(`chunk: A chunk size of '${t.toString()}' would result in an infinite array`);if(e.length===0)return[];if(t>=e.length)return[[...e]];let n=Math.ceil(e.length/t),r=Array(n);if(t===1)for(let[t,n]of e.entries())r[t]=[n];else for(let i=0;i<n;i+=1){let n=i*t;r[i]=e.slice(n,n+t)}return r}function o(...e){return t(s,e)}const s=(e,{min:t,max:n})=>t!==void 0&&e<t?t:n!==void 0&&e>n?n:e;function c(...e){return t(l,e)}const l=(e,t)=>[...e,...t],u={done:!0,hasNext:!1},d={done:!1,hasNext:!1},f=()=>u,p=e=>({hasNext:!0,next:e,done:!1});function m(e,...t){let n=e,r=t.map(e=>`lazy`in e?g(e):void 0),i=0;for(;i<t.length;){if(r[i]===void 0||!ee(n)){let e=t[i];n=e(n),i+=1;continue}let e=[];for(let n=i;n<t.length;n++){let t=r[n];if(t===void 0||(e.push(t),t.isSingle))break}let a=[];for(let t of n)if(h(t,a,e))break;let{isSingle:o}=e.at(-1);n=o?a[0]:a,i+=e.length}return n}function h(e,t,n){if(n.length===0)return t.push(e),!1;let r=e,i=d,a=!1;for(let[e,o]of n.entries()){let{index:s,items:c}=o;if(c.push(r),i=o(r,s,c),o.index+=1,i.hasNext){if(i.hasMany??!1){for(let r of i.next)if(h(r,t,n.slice(e+1)))return!0;return a}r=i.next}if(!i.hasNext)break;i.done&&(a=!0)}return i.hasNext&&t.push(r),a}function g(e){let{lazy:t,lazyArgs:n}=e,r=t(...n);return Object.assign(r,{isSingle:t.single??!1,index:0,items:[]})}function ee(e){return typeof e==`string`||typeof e==`object`&&!!e&&Symbol.iterator in e}function _(e,t){let n=t.length-e.length;if(n===1){let[n,...r]=t;return m(n,{lazy:e,lazyArgs:r})}if(n===0){let n={lazy:e,lazyArgs:t};return Object.assign(e=>m(e,n),n)}throw Error(`Wrong number of arguments`)}function v(...e){return _(y,e)}function y(e){if(e.length===0)return p;let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return e=>{let n=t.get(e);return n===void 0||n===0?{done:!1,hasNext:!0,next:e}:(t.set(e,n-1),d)}}function b(...e){return t(te,e)}const te=(e,t)=>e.length>=t;function ne(...e){return t(Object.entries,e)}function re(...e){return t(x,e,S)}const x=(e,t)=>e.filter(t),S=e=>(t,n,r)=>e(t,n,r)?{done:!1,hasNext:!0,next:t}:d,C=e=>Object.assign(e,{single:!0});function w(...e){return t(T,e,C(E))}const T=(e,t)=>e.find(t),E=e=>(t,n,r)=>e(t,n,r)?{done:!0,hasNext:!0,next:t}:d;function D(...e){return t(O,e)}const O=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}};function k(...e){return t(A,e,C(j))}const A=([e])=>e,j=()=>M,M=e=>({hasNext:!0,next:e,done:!0});function N(t,n){return typeof t==`object`?P(t,n):e(P,t===void 0?[]:[t],F)}const P=(e,t)=>t===void 0?e.flat():e.flat(t),F=e=>e===void 0||e===1?I:e<=0?p:t=>Array.isArray(t)?{next:t.flat(e-1),hasNext:!0,hasMany:!0,done:!1}:{next:t,hasNext:!0,done:!1},I=e=>Array.isArray(e)?{next:e,hasNext:!0,hasMany:!0,done:!1}:{next:e,hasNext:!0,done:!1};function L(...e){return t(R,e,z)}const R=(e,t)=>e.flatMap(t),z=e=>(t,n,r)=>{let i=e(t,n,r);return Array.isArray(i)?{done:!1,hasNext:!0,hasMany:!0,next:i}:{done:!1,hasNext:!0,next:i}};function B(...e){return t(V,e,H)}function V(e,t){return e.forEach(t),e}const H=e=>(t,n,r)=>(e(t,n,r),{done:!1,hasNext:!0,next:t});function U(...e){return t(W,e)}function W(e,t){for(let[n,r]of Object.entries(e))t(r,n,e);return e}const G=Symbol(`funnel/voidReducer`),K=()=>G;function q(e,{triggerAt:t=`end`,minQuietPeriodMs:n,maxBurstDurationMs:r,minGapMs:i,reducer:a=K}){let o,s,c,l,u=()=>{let t=c;t!==void 0&&(c=void 0,t===G?e():e(t),i!==void 0&&(s=setTimeout(d,i)))},d=()=>{clearTimeout(s),s=void 0,o===void 0&&u()},f=()=>{clearTimeout(o),o=void 0,l=void 0,s===void 0&&u()};return{call:(...e)=>{let d=o===void 0&&s===void 0;if((t!==`start`||d)&&(c=a(c,...e)),!(o===void 0&&!d)){if(n!==void 0||r!==void 0||i===void 0){clearTimeout(o);let e=Date.now();l??=e;let t=r===void 0?n??0:Math.min(n??r,Math.max(0,r-(e-l)));o=setTimeout(f,t)}t!==`end`&&d&&u()}},cancel:()=>{clearTimeout(o),o=void 0,l=void 0,clearTimeout(s),s=void 0,c=void 0},flush:()=>{f(),d()},get isIdle(){return o===void 0&&s===void 0}}}function J(...e){return t(Y,e)}const Y=(e,t)=>{let n=Object.create(null);for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);if(a!==void 0){let e=n[a];e===void 0?n[a]=[i]:e.push(i)}}return Object.setPrototypeOf(n,Object.prototype),n};function X(...e){return t(ie,e)}function ie(e,t){let n=Object.create(null);for(let r of e){let e=r?.[t];if(e!==void 0){let t=n[e];t===void 0?n[e]=[r]:t.push(r)}}return Object.setPrototypeOf(n,Object.prototype),n}function ae(...e){return t(Z,e)}function Z(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Array.isArray(e))return oe(e,t);if(e instanceof Map)return se(e,t);if(e instanceof Set)return ce(e,t);if(e instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp)return e.toString()===t.toString();if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let[n,r]of Object.entries(e))if(!(n in t)||!Z(r,t[n]))return!1;return!0}function oe(e,t){if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(!Z(r,t[n]))return!1;return!0}function se(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e.entries())if(!t.has(n)||!Z(r,t.get(n)))return!1;return!0}function ce(e,t){if(e.size!==t.size)return!1;let n=[...t];for(let t of e){let e=!1;for(let[r,i]of n.entries())if(Z(t,i)){e=!0,n.splice(r,1);break}if(!e)return!1}return!0}function le(){return ue}const ue=e=>e;function de(...e){return t(fe,e)}function fe(e,t){let n={};for(let[r,i]of e.entries()){let a=t(i,r,e);n[a]=i}return n}function pe(e){return Array.isArray(e)}function me(e){return typeof e==`boolean`}function he(e){return e!==void 0}function ge(e){return e===``||e===void 0?!0:Array.isArray(e)?e.length===0:Object.keys(e).length===0}function _e(e){if(e==null||e===``)return!0;if(typeof e!=`object`)return!1;if(`length`in e&&typeof e.length==`number`)return e.length===0;if(`size`in e&&typeof e.size==`number`)return e.size===0;for(let t in e)return!1;return Object.getOwnPropertySymbols(e).length===0}function ve(e){return e!=null}function ye(e){return e==null}function be(e){return typeof e==`number`&&!Number.isNaN(e)}function xe(e){return e instanceof Promise}function Se(e){return typeof e==`string`}function Ce(e){return!!e}function we(...e){return t(Object.keys,e)}function Te(...e){return t(Ee,e)}const Ee=e=>e.at(-1);function De(...e){return t(Oe,e,ke)}const Oe=(e,t)=>e.map(t),ke=e=>(t,n,r)=>({done:!1,hasNext:!0,next:e(t,n,r)});function Ae(...e){return t(je,e)}function je(e,t){let n={};for(let[r,i]of e.entries()){let[a,o]=t(i,r,e);n[a]=o}return n}function Me(...e){return t(Ne,e)}function Ne(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=t(i,r,e);return n}function Pe(...e){return t(Fe,e)}function Fe(e,t){if(!b(t,1))return{...e};if(!b(t,2)){let{[t[0]]:n,...r}=e;return r}let n={...e};for(let e of t)delete n[e];return n}function Ie(...e){return t(Le,e)}function Le(e,t){let n={...e};for(let[r,i]of Object.entries(n))t(i,r,e)&&delete n[r];return n}function Re(e){let t=!1,n;return()=>(t||=(n=e(),!0),n)}function ze(...e){return t(Be,e)}const Be=e=>e.length===1?e[0]:void 0;function Ve(...e){return t(He,e)}const He=(e,t)=>{let n=[[],[]];for(let[r,i]of e.entries())t(i,r,e)?n[0].push(i):n[1].push(i);return n};function Ue(...e){return t(We,e)}function We(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function Ge(...e){return t=>m(t,...e)}function Ke(e,...t){return typeof e==`string`||typeof e==`number`||typeof e==`symbol`?n=>Q(n,e,...t):Q(e,...t)}function Q(e,...t){let n=e;for(let e of t){if(n==null)return;n=n[e]}return n}function qe(...e){return t(Je,e)}function Je(e){let t=[];for(let n=0;n<e;n++){let e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`[Math.floor(Math.random()*62)];t.push(e)}return t.join(``)}function $(...e){return t(Ye,e)}const Ye=(e,t,n)=>e.reduce(t,n);function Xe(...e){return t(Ze,e)}function Ze(e){return[...e].reverse()}function Qe(...e){return t($e,e)}function $e(e,t){let n=[...e];return n.sort(t),n}function et(...e){return t(tt,e,nt)}const tt=(e,t)=>t<0?[]:e.slice(0,t);function nt(e){if(e<=0)return f;let t=e;return e=>(--t,{done:t<=0,hasNext:!0,next:e})}function rt(...e){return t(it,e)}function it(e,t){return t(e),e}new Set([`-`,`_`,...` .
2
- .\v.\f.\r. .….\xA0. . . . . . . . . . . . .\u2028.\u2029. . . .`.split(`.`)]);function at(...e){return _(ot,e)}function ot(){let e=new Set;return t=>e.has(t)?d:(e.add(t),{done:!1,hasNext:!0,next:t})}function st(...e){return _(ct,e)}function ct(e){let t=e,n=new Set;return(e,r,i)=>{let a=t(e,r,i);return n.has(a)?d:(n.add(a),{done:!1,hasNext:!0,next:e})}}function lt(...e){return t(Object.values,e)}export{o as $,ge as A,U as B,Ce as C,ye as D,be as E,le as F,D as G,L as H,ae as I,ne as J,w as K,X as L,me as M,pe as N,ve as O,de as P,c as Q,J as R,we as S,xe as T,N as U,B as V,k as W,v as X,b as Y,m as Z,Pe as _,et as a,De as b,$ as c,Ge as d,i as et,Ue as f,Ie as g,Re as h,rt as i,he as j,_e as k,qe as l,ze as m,st as n,t as nt,Qe as o,Ve as p,re as q,at as r,Xe as s,lt as t,n as tt,Ke as u,Me as v,Se as w,Te as x,Ae as y,q as z};
1
+ function e(e,t,n){let r=n=>e(n,...t);return n===void 0?r:Object.assign(r,{lazy:n,lazyArgs:t})}function t(t,n,r){let i=t.length-n.length;if(i===0)return t(...n);if(i===1)return e(t,n,r);throw Error(`Wrong number of arguments`)}function n(...e){return t(r,e)}const r=(e,t)=>t.some(t=>t(e));function i(...e){return t(a,e)}function a(e,t){if(t<1)throw RangeError(`chunk: A chunk size of '${t.toString()}' would result in an infinite array`);if(e.length===0)return[];if(t>=e.length)return[[...e]];let n=Math.ceil(e.length/t),r=Array(n);if(t===1)for(let[t,n]of e.entries())r[t]=[n];else for(let i=0;i<n;i+=1){let n=i*t;r[i]=e.slice(n,n+t)}return r}function o(...e){return t(s,e)}const s=(e,{min:t,max:n})=>t!==void 0&&e<t?t:n!==void 0&&e>n?n:e;function c(...e){return t(l,e)}const l=(e,t)=>[...e,...t],u={done:!0,hasNext:!1},d={done:!1,hasNext:!1},f=()=>u,p=e=>({hasNext:!0,next:e,done:!1});function m(e,...t){let n=e,r=t.map(e=>`lazy`in e?g(e):void 0),i=0;for(;i<t.length;){if(r[i]===void 0||!ee(n)){let e=t[i];n=e(n),i+=1;continue}let e=[];for(let n=i;n<t.length;n++){let t=r[n];if(t===void 0||(e.push(t),t.isSingle))break}let a=[];for(let t of n)if(h(t,a,e))break;let{isSingle:o}=e.at(-1);n=o?a[0]:a,i+=e.length}return n}function h(e,t,n){if(n.length===0)return t.push(e),!1;let r=e,i=d,a=!1;for(let[e,o]of n.entries()){let{index:s,items:c}=o;if(c.push(r),i=o(r,s,c),o.index+=1,i.hasNext){if(i.hasMany??!1){for(let r of i.next)if(h(r,t,n.slice(e+1)))return!0;return a}r=i.next}if(!i.hasNext)break;i.done&&(a=!0)}return i.hasNext&&t.push(r),a}function g(e){let{lazy:t,lazyArgs:n}=e,r=t(...n);return Object.assign(r,{isSingle:t.single??!1,index:0,items:[]})}function ee(e){return typeof e==`string`||typeof e==`object`&&!!e&&Symbol.iterator in e}function _(e,t){let n=t.length-e.length;if(n===1){let[n,...r]=t;return m(n,{lazy:e,lazyArgs:r})}if(n===0){let n={lazy:e,lazyArgs:t};return Object.assign(e=>m(e,n),n)}throw Error(`Wrong number of arguments`)}function v(...e){return _(y,e)}function y(e){if(e.length===0)return p;let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return e=>{let n=t.get(e);return n===void 0||n===0?{done:!1,hasNext:!0,next:e}:(t.set(e,n-1),d)}}function b(...e){return t(te,e)}const te=(e,t)=>e.length>=t;function ne(...e){return t(Object.entries,e)}function re(...e){return t(x,e,S)}const x=(e,t)=>e.filter(t),S=e=>(t,n,r)=>e(t,n,r)?{done:!1,hasNext:!0,next:t}:d,C=e=>Object.assign(e,{single:!0});function w(...e){return t(T,e,C(E))}const T=(e,t)=>e.find(t),E=e=>(t,n,r)=>e(t,n,r)?{done:!0,hasNext:!0,next:t}:d;function D(...e){return t(O,e)}const O=(e,t)=>{for(let n=e.length-1;n>=0;n--){let r=e[n];if(t(r,n,e))return r}};function k(...e){return t(A,e,C(j))}const A=([e])=>e,j=()=>M,M=e=>({hasNext:!0,next:e,done:!0});function N(t,n){return typeof t==`object`?P(t,n):e(P,t===void 0?[]:[t],F)}const P=(e,t)=>t===void 0?e.flat():e.flat(t),F=e=>e===void 0||e===1?I:e<=0?p:t=>Array.isArray(t)?{next:t.flat(e-1),hasNext:!0,hasMany:!0,done:!1}:{next:t,hasNext:!0,done:!1},I=e=>Array.isArray(e)?{next:e,hasNext:!0,hasMany:!0,done:!1}:{next:e,hasNext:!0,done:!1};function L(...e){return t(R,e,z)}const R=(e,t)=>e.flatMap(t),z=e=>(t,n,r)=>{let i=e(t,n,r);return Array.isArray(i)?{done:!1,hasNext:!0,hasMany:!0,next:i}:{done:!1,hasNext:!0,next:i}};function B(...e){return t(V,e,H)}function V(e,t){return e.forEach(t),e}const H=e=>(t,n,r)=>(e(t,n,r),{done:!1,hasNext:!0,next:t});function U(...e){return t(W,e)}function W(e,t){for(let[n,r]of Object.entries(e))t(r,n,e);return e}const G=Symbol(`funnel/voidReducer`),K=()=>G;function q(e,{triggerAt:t=`end`,minQuietPeriodMs:n,maxBurstDurationMs:r,minGapMs:i,reducer:a=K}){let o,s,c,l,u=()=>{let t=c;t!==void 0&&(c=void 0,t===G?e():e(t),i!==void 0&&(s=setTimeout(d,i)))},d=()=>{clearTimeout(s),s=void 0,o===void 0&&u()},f=()=>{clearTimeout(o),o=void 0,l=void 0,s===void 0&&u()};return{call:(...e)=>{let d=o===void 0&&s===void 0;if((t!==`start`||d)&&(c=a(c,...e)),!(o===void 0&&!d)){if(n!==void 0||r!==void 0||i===void 0){clearTimeout(o);let e=Date.now();l??=e;let t=r===void 0?n??0:Math.min(n??r,Math.max(0,r-(e-l)));o=setTimeout(f,t)}t!==`end`&&d&&u()}},cancel:()=>{clearTimeout(o),o=void 0,l=void 0,clearTimeout(s),s=void 0,c=void 0},flush:()=>{f(),d()},get isIdle(){return o===void 0&&s===void 0}}}function J(...e){return t(Y,e)}const Y=(e,t)=>{let n=Object.create(null);for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);if(a!==void 0){let e=n[a];e===void 0?n[a]=[i]:e.push(i)}}return Object.setPrototypeOf(n,Object.prototype),n};function X(...e){return t(ie,e)}function ie(e,t){let n=Object.create(null);for(let r of e){let e=r?.[t];if(e!==void 0){let t=n[e];t===void 0?n[e]=[r]:t.push(r)}}return Object.setPrototypeOf(n,Object.prototype),n}function ae(...e){return t(Z,e)}function Z(e,t){if(e===t||Object.is(e,t))return!0;if(typeof e!=`object`||typeof t!=`object`||e===null||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Array.isArray(e))return oe(e,t);if(e instanceof Map)return se(e,t);if(e instanceof Set)return ce(e,t);if(e instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp)return e.toString()===t.toString();if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let[n,r]of Object.entries(e))if(!(n in t)||!Z(r,t[n]))return!1;return!0}function oe(e,t){if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(!Z(r,t[n]))return!1;return!0}function se(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e.entries())if(!t.has(n)||!Z(r,t.get(n)))return!1;return!0}function ce(e,t){if(e.size!==t.size)return!1;let n=[...t];for(let t of e){let e=!1;for(let[r,i]of n.entries())if(Z(t,i)){e=!0,n.splice(r,1);break}if(!e)return!1}return!0}function le(){return ue}const ue=e=>e;function de(...e){return t(fe,e)}function fe(e,t){let n={};for(let[r,i]of e.entries()){let a=t(i,r,e);n[a]=i}return n}function pe(e){return Array.isArray(e)}function me(e){return typeof e==`boolean`}function he(e){return e!==void 0}function ge(e){return e===``||e===void 0?!0:Array.isArray(e)?e.length===0:Object.keys(e).length===0}function _e(e){if(e==null||e===``)return!0;if(typeof e!=`object`)return!1;if(`length`in e&&typeof e.length==`number`)return e.length===0;if(`size`in e&&typeof e.size==`number`)return e.size===0;for(let t in e)return!1;return Object.getOwnPropertySymbols(e).length===0}function ve(e){return e!=null}function ye(e){return e==null}function be(e){return typeof e==`number`&&!Number.isNaN(e)}function xe(e){return e instanceof Promise}function Se(e){return typeof e==`string`}function Ce(e){return!!e}function we(...e){return t(Te,e)}const Te=(e,t)=>e.join(t);function Ee(...e){return t(Object.keys,e)}function De(...e){return t(Oe,e)}const Oe=e=>e.at(-1);function ke(...e){return t(Ae,e,je)}const Ae=(e,t)=>e.map(t),je=e=>(t,n,r)=>({done:!1,hasNext:!0,next:e(t,n,r)});function Me(...e){return t(Ne,e)}function Ne(e,t){let n={};for(let[r,i]of e.entries()){let[a,o]=t(i,r,e);n[a]=o}return n}function Pe(...e){return t(Fe,e)}function Fe(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=t(i,r,e);return n}function Ie(...e){return t(Le,e)}function Le(e,t){if(!b(t,1))return{...e};if(!b(t,2)){let{[t[0]]:n,...r}=e;return r}let n={...e};for(let e of t)delete n[e];return n}function Re(...e){return t(ze,e)}function ze(e,t){let n={...e};for(let[r,i]of Object.entries(n))t(i,r,e)&&delete n[r];return n}function Be(e){let t=!1,n;return()=>(t||=(n=e(),!0),n)}function Ve(...e){return t(He,e)}const He=e=>e.length===1?e[0]:void 0;function Ue(...e){return t(We,e)}const We=(e,t)=>{let n=[[],[]];for(let[r,i]of e.entries())t(i,r,e)?n[0].push(i):n[1].push(i);return n};function Ge(...e){return t=>m(t,...e)}function Ke(e,...t){return typeof e==`string`||typeof e==`number`||typeof e==`symbol`?n=>Q(n,e,...t):Q(e,...t)}function Q(e,...t){let n=e;for(let e of t){if(n==null)return;n=n[e]}return n}function qe(...e){return t(Je,e)}function Je(e){let t=[];for(let n=0;n<e;n++){let e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`[Math.floor(Math.random()*62)];t.push(e)}return t.join(``)}function $(...e){return t(Ye,e)}const Ye=(e,t,n)=>e.reduce(t,n);function Xe(...e){return t(Ze,e)}function Ze(e){return[...e].reverse()}function Qe(...e){return t($e,e)}function $e(e,t){let n=[...e];return n.sort(t),n}function et(...e){return t(tt,e,nt)}const tt=(e,t)=>t<0?[]:e.slice(0,t);function nt(e){if(e<=0)return f;let t=e;return e=>(--t,{done:t<=0,hasNext:!0,next:e})}function rt(...e){return t(it,e)}function it(e,t){return t(e),e}new Set([`-`,`_`,...` .
2
+ .\v.\f.\r. .….\xA0. . . . . . . . . . . . .\u2028.\u2029. . . .`.split(`.`)]);function at(...e){return _(ot,e)}function ot(){let e=new Set;return t=>e.has(t)?d:(e.add(t),{done:!1,hasNext:!0,next:t})}function st(...e){return _(ct,e)}function ct(e){let t=e,n=new Set;return(e,r,i)=>{let a=t(e,r,i);return n.has(a)?d:(n.add(a),{done:!1,hasNext:!0,next:e})}}function lt(...e){return t(Object.values,e)}export{o as $,ge as A,U as B,Ce as C,ye as D,be as E,le as F,D as G,L as H,ae as I,ne as J,w as K,X as L,me as M,pe as N,ve as O,de as P,c as Q,J as R,we as S,xe as T,N as U,B as V,k as W,v as X,b as Y,m as Z,Pe as _,et as a,De as b,$ as c,Ge as d,i as et,Ue as f,Ie as g,Re as h,rt as i,he as j,_e as k,qe as l,Be as m,st as n,t as nt,Qe as o,Ve as p,re as q,at as r,Xe as s,lt as t,n as tt,Ke as u,Me as v,Se as w,Ee as x,ke as y,q as z};
@@ -1 +1 @@
1
- import{isatty as e}from"tty";var t={reset:[0,0],bold:[1,22,`\x1B[22m\x1B[1m`],dim:[2,22,`\x1B[22m\x1B[2m`],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function n(e){return String(e)}n.open=``,n.close=``;function r(){let e=typeof process<`u`?process:void 0,t=e?.env||{},n=t.FORCE_TTY!==`false`,r=e?.argv||[];return!(`NO_COLOR`in t||r.includes(`--no-color`))&&(`FORCE_COLOR`in t||r.includes(`--color`)||e?.platform===`win32`||n&&t.TERM!==`dumb`||`CI`in t)||typeof window<`u`&&!!window.chrome}function i(){let e=r(),i=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},a=(e,t,n=e)=>{let r=r=>{let a=String(r),o=a.indexOf(t,e.length);return~o?e+i(a,t,n,o)+t:e+a+t};return r.open=e,r.close=t,r},o={isColorSupported:e},s=e=>`\x1B[${e}m`;for(let r in t){let i=t[r];o[r]=e?a(s(i[0]),s(i[1]),i[2]):n}return o}var a=i(),o=Object.entries({reset:[0,0],bold:[1,22,`\x1B[22m\x1B[1m`],dim:[2,22,`\x1B[22m\x1B[2m`],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]});function s(e){return String(e)}s.open=``,s.close=``;function c(e=!1){let t=typeof process<`u`?process:void 0,n=t?.env||{},r=t?.argv||[];return!(`NO_COLOR`in n||r.includes(`--no-color`))&&(`FORCE_COLOR`in n||r.includes(`--color`)||t?.platform===`win32`||e&&n.TERM!==`dumb`||`CI`in n)||typeof window<`u`&&!!window.chrome}function l(e=!1){let t=c(e),n=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},r=(e,t,r=e)=>{let i=i=>{let a=String(i),o=a.indexOf(t,e.length);return~o?e+n(a,t,r,o)+t:e+a+t};return i.open=e,i.close=t,i},i={isColorSupported:t},a=e=>`\x1B[${e}m`;for(let[e,n]of o)i[e]=t?r(a(n[0]),a(n[1]),n[2]):s;return i}var u=l(process.env.FORCE_TTY!==void 0||e(1));export{a as n,u as t};
1
+ var e={reset:[0,0],bold:[1,22,`\x1B[22m\x1B[1m`],dim:[2,22,`\x1B[22m\x1B[2m`],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]};function t(e){return String(e)}t.open=``,t.close=``;function n(){let e=typeof process<`u`?process:void 0,t=e?.env||{},n=t.FORCE_TTY!==`false`,r=e?.argv||[];return!(`NO_COLOR`in t||r.includes(`--no-color`))&&(`FORCE_COLOR`in t||r.includes(`--color`)||e?.platform===`win32`||n&&t.TERM!==`dumb`||`CI`in t)||typeof window<`u`&&!!window.chrome}function r(){let r=n(),i=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},a=(e,t,n=e)=>{let r=r=>{let a=String(r),o=a.indexOf(t,e.length);return~o?e+i(a,t,n,o)+t:e+a+t};return r.open=e,r.close=t,r},o={isColorSupported:r},s=e=>`\x1B[${e}m`;for(let n in e){let i=e[n];o[n]=r?a(s(i[0]),s(i[1]),i[2]):t}return o}var i=r();export{i as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./destr.mjs";function t(e){return!e||typeof e.then!=`function`?Promise.resolve(e):e}function n(e,...n){try{return t(e(...n))}catch(e){return Promise.reject(e)}}function r(e){let t=typeof e;return e===null||t!==`object`&&t!==`function`}function i(e){let t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function a(e){if(r(e))return String(e);if(i(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON==`function`)return a(e.toJSON());throw Error(`[unstorage] Cannot stringify value!`)}const o=`base64:`;function s(e){return typeof e==`string`?e:o+u(e)}function c(e){return typeof e!=`string`||!e.startsWith(o)?e:l(e.slice(7))}function l(e){return globalThis.Buffer?Buffer.from(e,`base64`):Uint8Array.from(globalThis.atob(e),e=>e.codePointAt(0))}function u(e){return globalThis.Buffer?Buffer.from(e).toString(`base64`):globalThis.btoa(String.fromCodePoint(...e))}const d=[`has`,`hasItem`,`get`,`getItem`,`getItemRaw`,`set`,`setItem`,`setItemRaw`,`del`,`remove`,`removeItem`,`getMeta`,`setMeta`,`removeMeta`,`getKeys`,`clear`,`mount`,`unmount`];function f(e,t){if(t=h(t),!t)return e;let n={...e};for(let r of d)n[r]=(n=``,...i)=>e[r](t+n,...i);return n.getKeys=(n=``,...r)=>e.getKeys(t+n,...r).then(e=>e.map(e=>e.slice(t.length))),n.keys=n.getKeys,n.getItems=async(n,r)=>{let i=n.map(e=>typeof e==`string`?t+e:{...e,key:t+e.key});return(await e.getItems(i,r)).map(e=>({key:e.key.slice(t.length),value:e.value}))},n.setItems=async(n,r)=>{let i=n.map(e=>({key:t+e.key,value:e.value,options:e.options}));return e.setItems(i,r)},n}function p(e){return e&&e.split(`?`)[0]?.replace(/[/\\]/g,`:`).replace(/:+/g,`:`).replace(/^:|:$/g,``)||``}function m(...e){return p(e.join(`:`))}function h(e){return e=p(e),e?e+`:`:``}function g(e,t){if(t===void 0)return!0;let n=0,r=e.indexOf(`:`);for(;r>-1;)n++,r=e.indexOf(`:`,r+1);return n<=t}function _(e,t){return t?e.startsWith(t)&&e[e.length-1]!==`$`:e[e.length-1]!==`$`}function v(e){return e}const y=v(()=>{let e=new Map;return{name:`memory`,getInstance:()=>e,hasItem(t){return e.has(t)},getItem(t){return e.get(t)??null},getItemRaw(t){return e.get(t)??null},setItem(t,n){e.set(t,n)},setItemRaw(t,n){e.set(t,n)},removeItem(t){e.delete(t)},getKeys(){return[...e.keys()]},clear(){e.clear()},dispose(){e.clear()}}});function b(t={}){let r={mounts:{"":t.driver||y()},mountpoints:[``],watching:!1,watchListeners:[],unwatch:{}},i=e=>{for(let t of r.mountpoints)if(e.startsWith(t))return{base:t,relativeKey:e.slice(t.length),driver:r.mounts[t]};return{base:``,relativeKey:e,driver:r.mounts[``]}},o=(e,t)=>r.mountpoints.filter(n=>n.startsWith(e)||t&&e.startsWith(n)).map(t=>({relativeBase:e.length>t.length?e.slice(t.length):void 0,mountpoint:t,driver:r.mounts[t]})),l=(e,t)=>{if(r.watching){t=p(t);for(let n of r.watchListeners)n(e,t)}},u=async()=>{if(!r.watching){r.watching=!0;for(let e in r.mounts)r.unwatch[e]=await x(r.mounts[e],l,e)}},d=async()=>{if(r.watching){for(let e in r.unwatch)await r.unwatch[e]();r.unwatch={},r.watching=!1}},f=(e,t,n)=>{let r=new Map,a=e=>{let t=r.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},r.set(e.base,t)),t};for(let n of e){let e=typeof n==`string`,r=p(e?n:n.key),o=e?void 0:n.value,s=e||!n.options?t:{...t,...n.options},c=i(r);a(c).items.push({key:r,value:o,relativeKey:c.relativeKey,options:s})}return Promise.all([...r.values()].map(e=>n(e))).then(e=>e.flat())},v={hasItem(e,t={}){e=p(e);let{relativeKey:r,driver:a}=i(e);return n(a.hasItem,r,t)},getItem(t,r={}){t=p(t);let{relativeKey:a,driver:o}=i(t);return n(o.getItem,a,r).then(t=>e(t))},getItems(t,r={}){return f(t,r,t=>t.driver.getItems?n(t.driver.getItems,t.items.map(e=>({key:e.relativeKey,options:e.options})),r).then(n=>n.map(n=>({key:m(t.base,n.key),value:e(n.value)}))):Promise.all(t.items.map(r=>n(t.driver.getItem,r.relativeKey,r.options).then(t=>({key:r.key,value:e(t)})))))},getItemRaw(e,t={}){e=p(e);let{relativeKey:r,driver:a}=i(e);return a.getItemRaw?n(a.getItemRaw,r,t):n(a.getItem,r,t).then(e=>c(e))},async setItem(e,t,r={}){if(t===void 0)return v.removeItem(e);e=p(e);let{relativeKey:o,driver:s}=i(e);s.setItem&&(await n(s.setItem,o,a(t),r),s.watch||l(`update`,e))},async setItems(e,t){await f(e,t,async e=>{if(e.driver.setItems)return n(e.driver.setItems,e.items.map(e=>({key:e.relativeKey,value:a(e.value),options:e.options})),t);e.driver.setItem&&await Promise.all(e.items.map(t=>n(e.driver.setItem,t.relativeKey,a(t.value),t.options)))})},async setItemRaw(e,t,r={}){if(t===void 0)return v.removeItem(e,r);e=p(e);let{relativeKey:a,driver:o}=i(e);if(o.setItemRaw)await n(o.setItemRaw,a,t,r);else if(o.setItem)await n(o.setItem,a,s(t),r);else return;o.watch||l(`update`,e)},async removeItem(e,t={}){typeof t==`boolean`&&(t={removeMeta:t}),e=p(e);let{relativeKey:r,driver:a}=i(e);a.removeItem&&(await n(a.removeItem,r,t),(t.removeMeta||t.removeMata)&&await n(a.removeItem,r+`$`,t),a.watch||l(`remove`,e))},async getMeta(t,r={}){typeof r==`boolean`&&(r={nativeOnly:r}),t=p(t);let{relativeKey:a,driver:o}=i(t),s=Object.create(null);if(o.getMeta&&Object.assign(s,await n(o.getMeta,a,r)),!r.nativeOnly){let t=await n(o.getItem,a+`$`,r).then(t=>e(t));t&&typeof t==`object`&&(typeof t.atime==`string`&&(t.atime=new Date(t.atime)),typeof t.mtime==`string`&&(t.mtime=new Date(t.mtime)),Object.assign(s,t))}return s},setMeta(e,t,n={}){return this.setItem(e+`$`,t,n)},removeMeta(e,t={}){return this.removeItem(e+`$`,t)},async getKeys(e,t={}){e=h(e);let r=o(e,!0),i=[],a=[],s=!0;for(let e of r){e.driver.flags?.maxDepth||(s=!1);let r=await n(e.driver.getKeys,e.relativeBase,t);for(let t of r){let n=e.mountpoint+p(t);i.some(e=>n.startsWith(e))||a.push(n)}i=[e.mountpoint,...i.filter(t=>!t.startsWith(e.mountpoint))]}let c=t.maxDepth!==void 0&&!s;return a.filter(n=>(!c||g(n,t.maxDepth))&&_(n,e))},async clear(e,t={}){e=h(e),await Promise.all(o(e,!1).map(async e=>{if(e.driver.clear)return n(e.driver.clear,e.relativeBase,t);if(e.driver.removeItem){let n=await e.driver.getKeys(e.relativeBase||``,t);return Promise.all(n.map(n=>e.driver.removeItem(n,t)))}}))},async dispose(){await Promise.all(Object.values(r.mounts).map(e=>S(e)))},async watch(e){return await u(),r.watchListeners.push(e),async()=>{r.watchListeners=r.watchListeners.filter(t=>t!==e),r.watchListeners.length===0&&await d()}},async unwatch(){r.watchListeners=[],await d()},mount(e,t){if(e=h(e),e&&r.mounts[e])throw Error(`already mounted at ${e}`);return e&&(r.mountpoints.push(e),r.mountpoints.sort((e,t)=>t.length-e.length)),r.mounts[e]=t,r.watching&&Promise.resolve(x(t,l,e)).then(t=>{r.unwatch[e]=t}).catch(console.error),v},async unmount(e,t=!0){e=h(e),!(!e||!r.mounts[e])&&(r.watching&&e in r.unwatch&&(r.unwatch[e]?.(),delete r.unwatch[e]),t&&await S(r.mounts[e]),r.mountpoints=r.mountpoints.filter(t=>t!==e),delete r.mounts[e])},getMount(e=``){e=p(e)+`:`;let t=i(e);return{driver:t.driver,base:t.base}},getMounts(e=``,t={}){return e=p(e),o(e,t.parents).map(e=>({driver:e.driver,base:e.mountpoint}))},keys:(e,t={})=>v.getKeys(e,t),get:(e,t={})=>v.getItem(e,t),set:(e,t,n={})=>v.setItem(e,t,n),has:(e,t={})=>v.hasItem(e,t),del:(e,t={})=>v.removeItem(e,t),remove:(e,t={})=>v.removeItem(e,t)};return v}function x(e,t,n){return e.watch?e.watch((e,r)=>t(e,n+r)):()=>{}}async function S(e){typeof e.dispose==`function`&&await n(e.dispose)}export{f as n,b as t};
@@ -0,0 +1 @@
1
+ import{_ as e,a as t,c as n,d as r,f as i,h as a,i as o,l as s,m as c,o as l,p as u,r as d,s as f,t as p,x as m}from"./filesystem.mjs";import{t as h}from"./libs/defu.mjs";import{r as g,t as _}from"./libs/pathe.mjs";import{t as v}from"./libs/tinyrainbow.mjs";import{l as y}from"./libs/ufo.mjs";import{memoizeProp as b}from"@likec4/core";import{pathToFileURL as x}from"url";function S(a){let c=e.getChild(`lang`),u=h(a,{useFileSystem:!0,manualLayouts:!0,watch:!1,graphviz:`wasm`,mcp:!1}),p=u.graphviz===`binary`;c.info(`${v.dim(`layout`)} ${p?`binary`:`wasm`}`);let g=d({...u.useFileSystem?{...l(u.watch),...u.manualLayouts?s:n}:{...f,...n},...u.mcp?t(u.mcp===`stdio`?`stdio`:u.mcp):{},...o(p?new r:new i)});return typeof u.mcp==`object`&&u.mcp.port&&g.likec4.mcp.Server.start(u.mcp.port).catch(e=>{c.error(m(e))}),u.mcp===`stdio`&&g.likec4.mcp.Server.start().catch(e=>{c.error(m(e))}),g}async function C(t,n){let r=g(t),i=y(x(r).toString());return b(globalThis,`likec4:`+r,async()=>{let t=e.getChild(`lang`),o=h(n,{...a,useFileSystem:!0,manualLayouts:!0,watch:!1,mcp:!1});p(o);let s=S(o),l={name:_(r),uri:i},u=s.shared.workspace.WorkspaceManager;t.info(`${v.dim(`workspace:`)} ${r}`),u.initialize({capabilities:{},processId:null,rootUri:null,workspaceFolders:[l]}),await u.initializeWorkspace([l]);let d=s.shared.workspace.LangiumDocuments.userDocuments.toArray();if(d.length===0&&(t.error(`no LikeC4 sources found`),n?.throwIfInvalid))throw Error(`no LikeC4 sources found`);return t.info(`${v.dim(`workspace:`)} found ${d.length} source files`),c(s,e,n)})}async function w(t,n){p(n);let r=e.getChild(`lang`);return await u(S(h(n,{...a,useFileSystem:!1,watch:!1,manualLayouts:!1,mcp:!1})),r,t,n)}async function T(e,t){return w({"source.c4":e},t)}export{C as n,T as t};
@@ -1 +1 @@
1
- import{L as e,R as t,U as n,Y as r,Z as i,b as a,m as o,t as s,v as c,x as l}from"./libs/remeda.mjs";import{a as u,i as d,n as f,r as p,t as m}from"./libs/@lume/kiwi.mjs";import{getParallelStepsPrefix as h,isStepEdgeId as g}from"@likec4/core/types";import{DefaultMap as _,Stack as v,invariant as y,isAncestor as b,nonNullable as x,nonexhaustive as S}from"@likec4/core/utils";function C(e){return i(e,t(e=>e.parallelPrefix??void 0),c((e,t)=>e.reduce((e,t)=>(e.min.column=Math.min(e.min.column,t.from.column,t.to.column),e.min.row=Math.min(e.min.row,t.from.row,t.to.row),e.max.column=Math.max(e.max.column,t.from.column,t.to.column),e.max.row=Math.max(e.max.row,t.from.row,t.to.row),e),{parallelPrefix:t,min:{column:1/0,row:1/0},max:{column:-1/0,row:-1/0}})),s())}function w(e,t){if(e.length===0||e.length===t.length)return[];let n=e=>x(t.find(t=>t.id===e));function r(e){let t=e.parent?n(e.parent):null;return t?[t,...r(t)]:[]}let i=new v,a=[];return e.forEach(e=>{let t=r(e);if(t.length===0){i.clear();return}let n=v.from(t),o,s;for(;o=i.peek()?.node,s=n.peek(),!(!s||!o);){if(b(s.id,o.id)||s.id===o.id){n.pop();continue}if(!b(o.id,s.id)){i.pop();continue}break}for(;s=n.pop();){let t={node:s,from:e,to:e,nested:[]},n=i.peek();n?n.nested.push(t):a.push(t),i.push(t)}i.forEach(t=>t.to=e)}),a}var T=class{#e=new m;#t;#n=[];#r;#i;#a;#o=[];#s=[];constructor({actors:e,steps:t,compounds:n}){this.#a=this.newVar(30),this.#r=this.newVar(0),this.#i=this.newVar(0),this.#t=this.addActors(e);for(let e of n){let t=this.addCompound(e),n=t[0];this.constraint(n.y1,`==`,0,d.strong),this.put(this.#i).after(n.bottom),this.put(this.#a).after(n.y2),this.#n.push(...t)}for(let e of t)this.addStep(e);for(let e of C(t))this.addParallelRect(e);let r=this.#t[0];this.constraint(r.offset.left,`==`,0,d.strong);let i=this.#t.reduce((e,t)=>(this.put(t.x).after(e.right,60),this.put(t.offset.left,d.strong).after(e.offset.right,32),this.constraint(t.centerY,`==`,e.centerY,d.strong),this.put(this.#a).after(t.offset.bottom),t));if(this.put(this.#r).after(i.offset.right),this.put(this.#i).after(l(this.#o)?.bottom??this.#a),n.length>0)for(let e of this.#n){let t=e.from.column,n=e.to.column,r=Math.max(e.from.maxRow,e.to.maxRow);for(let e=t+1;e<n;e++){let t=this.actorBox(e);r=Math.max(r,t.maxRow)}let i=x(this.#o[r],`row ${r} not found`);this.put(e.bottom).after(i.bottom,16),this.put(this.#i).after(e.bottom)}this.#e.updateVariables()}getParallelBoxes(){return this.#s.map(({parallelPrefix:e,x1:t,y1:n,x2:r,y2:i})=>({parallelPrefix:e,x:t.value(),y:n.value(),width:r.value()-t.value(),height:i.value()-n.value()}))}getActorBox(e){let t=this.actorBox(e);return{x:t.x.value(),y:t.y.value(),width:t.width,height:t.height}}getCompoundBoxes(){return this.#n.map(({node:e,depth:t,x1:n,y1:r,x2:i,bottom:a})=>({node:e,depth:t,x:n.value(),y:r.value(),width:i.value()-n.value(),height:a.value()-r.value()}))}getPortCenter(e,t){let{column:n,row:r}=t===`source`?e.from:e.to,i=this.actorBox(n).centerX,{y:a}=x(this.#o[r]);return{cx:i.value(),cy:a.value()+32/2+e.offset,height:t===`source`?40:24}}getViewBounds(){return{x:0,y:0,width:this.#r.value(),height:this.#i.value()}}actorBox(e){if(typeof e!=`number`){let t=typeof e==`string`?e:e.id;e=this.#t.findIndex(e=>e.actor.id===t),y(e>=0,`actor ${t} not found`)}return x(this.#t[e],`actor at index ${e} not found`)}addActors(e){let t=0;return a(e,(e,n)=>{let r=this.newVar(t);t+=e.width+60;let i=this.newVar(0),a={column:n,actor:e,x:r,y:i,centerX:r.plus(Math.round(e.width/2)),centerY:i.plus(Math.round(e.height/2)),width:e.width,height:e.height,right:r.plus(e.width),bottom:i.plus(e.height),minRow:1/0,maxRow:-1/0},o=this.newVar(0),s=this.newVar(0),c=this.newVar(0),l=this.newVar(0);return this.put(o,d.strong).before(i),this.put(s,d.strong).before(r),this.put(c,d.strong).after(a.right),this.put(l,d.strong).after(a.bottom),{...a,offset:{top:o,left:s,right:c,bottom:l}}})}addStep(e){let t=this.actorBox(e.source),n=this.actorBox(e.target);t.minRow=Math.min(t.minRow,e.from.row),t.maxRow=Math.max(t.maxRow,e.from.row),n.minRow=Math.min(n.minRow,e.to.row),n.maxRow=Math.max(n.maxRow,e.to.row);let[r,i]=t.column<=n.column?[t,n]:[n,t],a=(e.label?.width??100)+50;r===i?this.constraint(r.centerX.plus(a),`<=`,r.offset.right):this.constraint(r.centerX.plus(a),`<=`,i.centerX);let o=e.label?.height?e.label.height+50+32/2:80;return o=Math.max(o,80)+e.offset,this.ensureRow(e.from.row,o),e.isSelfLoop&&this.ensureRow(e.to.row,80),this}addParallelRect({parallelPrefix:e,min:t,max:n}){let r=this.actorBox(t.column).centerX.minus(30),i=this.actorBox(n.column).centerX.plus(30),a=this.#o[t.row],o=this.#o[n.row];y(a&&o,`parallel box invalid minRow=${t.row} maxRow=${n.row}`);let s=this.newVar(0);this.put(s).before(a.y,40);let c=o.bottom,l=t.row>0&&this.#o[t.row-1];l&&this.put(s).after(l.bottom,16);let u=n.row<this.#o.length-1&&this.#o[n.row+1];u&&this.put(c).before(u.y,16),this.#s.push({parallelPrefix:e,x1:r,y1:s,x2:i,y2:c})}addCompound(e){let t=[],n=e.nested.flatMap(e=>{let n=this.addCompound(e);return t.push(n[0]),n}),r=Math.max(...n.map(e=>e.depth+1),0),i=this.actorBox(e.from),a=this.actorBox(e.to),s=i.offset.left.minus(32);i.offset.left=s;let c=a.offset.right.plus(32);a.offset.right=c;let l=this.newVar(0),u=o(t),d,f;switch(!0){case!!u:d=u.y1.minus(40),f=u.y2.plus(32),this.put(l).after(u.bottom,32);break;case a===i:d=this.newVar(0),f=this.newVar(0),this.put(d).before(i.offset.top,52),this.put(f).after(i.offset.bottom,32),this.put(l).after(f);break;case t.length>0:d=this.newVar(0),f=this.newVar(0);for(let e of t)this.put(d).before(e.y1,32),this.put(f).after(e.y2,32),this.put(l).after(e.bottom,32);break;default:d=this.newVar(0),f=this.newVar(0);for(var p=i.column;p<=a.column;p++){let e=this.actorBox(p).offset;this.put(d).before(e.top,52),this.put(f).after(e.bottom,32)}this.put(l).after(f);break}for(var p=i.column;p<=a.column;p++){let e=this.actorBox(p).offset;e.top=d,e.bottom=f}return[{node:e.node,depth:r,from:i,to:a,x1:s,y1:d,x2:c,y2:f,bottom:l},...n]}ensureRow(e,t){for(;e>=this.#o.length;){let e=this.#o.length>0&&this.#o[this.#o.length-1]?.bottom||this.#a.plus(30),t=this.newVar(this.#o.length*80);this.put(t).after(e);let n=this.newVar(80);this.require(n,`>=`,80),this.#o.push({y:t,height:n,bottom:t.plus(n),lastHeight:80})}let n=x(this.#o[e]);t>n.lastHeight&&(n.lastHeight=t,this.require(n.height,`>=`,t),this.#e.suggestValue(n.height,t))}newVar(e){let t=new u;return this.#e.addEditVariable(t,d.weak),typeof e==`number`&&(this.#e.suggestValue(t,e),this.constraint(t,`>=`,0,d.strong)),t}require(e,t,n=void 0){switch(this.constraint(e,t,n,d.required),t){case`<=`:case`>=`:this.constraint(e,`==`,n,d.weak);break;case`<= 0`:case`>= 0`:this.constraint(e,`== 0`,void 0,d.weak);break}}constraint(e,t,n=void 0,r=d.medium){let i;switch(t){case`==`:i=p.Eq;break;case`>=`:i=p.Ge;break;case`<=`:i=p.Le;break;case`== 0`:i=p.Eq,n=0;break;case`>= 0`:i=p.Ge,n=0;break;case`<= 0`:i=p.Le,n=0;break;default:S(t)}this.#e.addConstraint(new f(e,i,n??0,r))}put(e,t=d.required){let n=t===d.required?d.medium:d.weak;return{before:(r,i)=>{i&&(r=r.minus(i)),this.constraint(e,`<=`,r,t),this.constraint(e,`==`,r,n)},after:(r,i)=>{i&&(r=r.plus(i)),this.constraint(e,`>=`,r,t),this.constraint(e,`==`,r,n)}}}};function E(t){let o=new Set,l=e=>x(t.nodes.find(t=>t.id===e)),u=[];for(let e of t.edges.filter(e=>g(e.id))){let t=l(e.source),n=l(e.target);if(t.children.length||n.children.length){console.error(`Sequence view does not support nested actors`);continue}o.add(t),o.add(n),u.push({edge:e,source:t,target:n})}let d=t.nodes.filter(e=>o.has(e));y(r(d,1),`actors array must not be empty`);let f=new _(()=>[]),p=[],m=0;for(let{edge:e,source:t,target:n}of u){let r=p.at(-1),i=d.indexOf(t),a=d.indexOf(n),o=t===n,s=i>a,c=h(e.id),l=!1;r&&r.target==t&&r.parallelPrefix===c&&(l=r.isSelfLoop!==o||r.isBack===s),l||m++;let u={id:e.id,from:{column:i,row:m},to:{column:a,row:o?++m:m},edge:e,isSelfLoop:o,isBack:s,parallelPrefix:c,offset:l?(r?.offset??0)+22:0,source:t,target:n,label:e.labelBBox?{height:e.labelBBox.height+8+(e.navigateTo?20:0),width:e.labelBBox.width+16,text:e.label}:null};p.push(u),f.get(t).push({step:u,row:m,type:`source`,position:s&&!o?`left`:`right`}),f.get(n).push({step:u,row:m,type:`target`,position:s||o?`right`:`left`})}let v=new T({actors:d,steps:p,compounds:w(d,t.nodes)}),b=v.getViewBounds(),S=i(v.getCompoundBoxes(),a(({node:e,...t})=>({...t,id:e.id,origin:e.id})),e(`id`),c((e,t)=>r(e,2)?a(e,(e,n)=>({...e,id:`${t}-${n+1}`})):e),s(),n());return{actors:d.map(e=>D({actor:e,ports:f.get(e),layout:v})),compounds:S,steps:a(p,e=>({id:e.id,sourceHandle:e.id+`_source`,targetHandle:e.id+`_target`,...e.label&&{labelBBox:{width:e.label.width,height:e.label.height}}})),parallelAreas:v.getParallelBoxes(),bounds:b}}function D({actor:e,ports:t,layout:n}){let{x:r,y:i,width:a,height:o}=n.getActorBox(e);return{id:e.id,x:r,y:i,width:a,height:o,ports:t.map(e=>{let t=n.getPortCenter(e.step,e.type);return{id:`${e.step.id}_${e.type}`,cx:t.cx-r,cy:t.cy-i,height:t.height,type:e.type,position:e.position}})}}export{E as t};
1
+ import{L as e,R as t,U as n,Y as r,Z as i,_ as a,b as o,p as s,t as c,y as l}from"./libs/remeda.mjs";import{a as u,i as d,n as f,r as p,t as m}from"./libs/@lume/kiwi.mjs";import{getParallelStepsPrefix as h,isStepEdgeId as g}from"@likec4/core/types";import{DefaultMap as _,Stack as v,invariant as y,isAncestor as b,nonNullable as x,nonexhaustive as S}from"@likec4/core/utils";function C(e){return i(e,t(e=>e.parallelPrefix??void 0),a((e,t)=>e.reduce((e,t)=>(e.min.column=Math.min(e.min.column,t.from.column,t.to.column),e.min.row=Math.min(e.min.row,t.from.row,t.to.row),e.max.column=Math.max(e.max.column,t.from.column,t.to.column),e.max.row=Math.max(e.max.row,t.from.row,t.to.row),e),{parallelPrefix:t,min:{column:1/0,row:1/0},max:{column:-1/0,row:-1/0}})),c())}function w(e,t){if(e.length===0||e.length===t.length)return[];let n=e=>x(t.find(t=>t.id===e));function r(e){let t=e.parent?n(e.parent):null;return t?[t,...r(t)]:[]}let i=new v,a=[];return e.forEach(e=>{let t=r(e);if(t.length===0){i.clear();return}let n=v.from(t),o,s;for(;o=i.peek()?.node,s=n.peek(),!(!s||!o);){if(b(s.id,o.id)||s.id===o.id){n.pop();continue}if(!b(o.id,s.id)){i.pop();continue}break}for(;s=n.pop();){let t={node:s,from:e,to:e,nested:[]},n=i.peek();n?n.nested.push(t):a.push(t),i.push(t)}i.forEach(t=>t.to=e)}),a}var T=class{#e=new m;#t;#n=[];#r;#i;#a;#o=[];#s=[];constructor({actors:e,steps:t,compounds:n}){this.#a=this.newVar(30),this.#r=this.newVar(0),this.#i=this.newVar(0),this.#t=this.addActors(e);for(let e of n){let t=this.addCompound(e),n=t[0];this.constraint(n.y1,`==`,0,d.strong),this.put(this.#i).after(n.bottom),this.put(this.#a).after(n.y2),this.#n.push(...t)}for(let e of t)this.addStep(e);for(let e of C(t))this.addParallelRect(e);let r=this.#t[0];this.constraint(r.offset.left,`==`,0,d.strong);let i=this.#t.reduce((e,t)=>(this.put(t.x).after(e.right,60),this.put(t.offset.left,d.strong).after(e.offset.right,32),this.constraint(t.centerY,`==`,e.centerY,d.strong),this.put(this.#a).after(t.offset.bottom),t));if(this.put(this.#r).after(i.offset.right),this.put(this.#i).after(o(this.#o)?.bottom??this.#a),n.length>0)for(let e of this.#n){let t=e.from.column,n=e.to.column,r=Math.max(e.from.maxRow,e.to.maxRow);for(let e=t+1;e<n;e++){let t=this.actorBox(e);r=Math.max(r,t.maxRow)}let i=x(this.#o[r],`row ${r} not found`);this.put(e.bottom).after(i.bottom,16),this.put(this.#i).after(e.bottom)}this.#e.updateVariables()}getParallelBoxes(){return this.#s.map(({parallelPrefix:e,x1:t,y1:n,x2:r,y2:i})=>({parallelPrefix:e,x:t.value(),y:n.value(),width:r.value()-t.value(),height:i.value()-n.value()}))}getActorBox(e){let t=this.actorBox(e);return{x:t.x.value(),y:t.y.value(),width:t.width,height:t.height}}getCompoundBoxes(){return this.#n.map(({node:e,depth:t,x1:n,y1:r,x2:i,bottom:a})=>({node:e,depth:t,x:n.value(),y:r.value(),width:i.value()-n.value(),height:a.value()-r.value()}))}getPortCenter(e,t){let{column:n,row:r}=t===`source`?e.from:e.to,i=this.actorBox(n).centerX,{y:a}=x(this.#o[r]);return{cx:i.value(),cy:a.value()+32/2+e.offset,height:t===`source`?40:24}}getViewBounds(){return{x:0,y:0,width:this.#r.value(),height:this.#i.value()}}actorBox(e){if(typeof e!=`number`){let t=typeof e==`string`?e:e.id;e=this.#t.findIndex(e=>e.actor.id===t),y(e>=0,`actor ${t} not found`)}return x(this.#t[e],`actor at index ${e} not found`)}addActors(e){let t=0;return l(e,(e,n)=>{let r=this.newVar(t);t+=e.width+60;let i=this.newVar(0),a={column:n,actor:e,x:r,y:i,centerX:r.plus(Math.round(e.width/2)),centerY:i.plus(Math.round(e.height/2)),width:e.width,height:e.height,right:r.plus(e.width),bottom:i.plus(e.height),minRow:1/0,maxRow:-1/0},o=this.newVar(0),s=this.newVar(0),c=this.newVar(0),l=this.newVar(0);return this.put(o,d.strong).before(i),this.put(s,d.strong).before(r),this.put(c,d.strong).after(a.right),this.put(l,d.strong).after(a.bottom),{...a,offset:{top:o,left:s,right:c,bottom:l}}})}addStep(e){let t=this.actorBox(e.source),n=this.actorBox(e.target);t.minRow=Math.min(t.minRow,e.from.row),t.maxRow=Math.max(t.maxRow,e.from.row),n.minRow=Math.min(n.minRow,e.to.row),n.maxRow=Math.max(n.maxRow,e.to.row);let[r,i]=t.column<=n.column?[t,n]:[n,t],a=(e.label?.width??100)+50;r===i?this.constraint(r.centerX.plus(a),`<=`,r.offset.right):this.constraint(r.centerX.plus(a),`<=`,i.centerX);let o=e.label?.height?e.label.height+50+32/2:80;return o=Math.max(o,80)+e.offset,this.ensureRow(e.from.row,o),e.isSelfLoop&&this.ensureRow(e.to.row,80),this}addParallelRect({parallelPrefix:e,min:t,max:n}){let r=this.actorBox(t.column).centerX.minus(30),i=this.actorBox(n.column).centerX.plus(30),a=this.#o[t.row],o=this.#o[n.row];y(a&&o,`parallel box invalid minRow=${t.row} maxRow=${n.row}`);let s=this.newVar(0);this.put(s).before(a.y,40);let c=o.bottom,l=t.row>0&&this.#o[t.row-1];l&&this.put(s).after(l.bottom,16);let u=n.row<this.#o.length-1&&this.#o[n.row+1];u&&this.put(c).before(u.y,16),this.#s.push({parallelPrefix:e,x1:r,y1:s,x2:i,y2:c})}addCompound(e){let t=[],n=e.nested.flatMap(e=>{let n=this.addCompound(e);return t.push(n[0]),n}),r=Math.max(...n.map(e=>e.depth+1),0),i=this.actorBox(e.from),a=this.actorBox(e.to),o=i.offset.left.minus(32);i.offset.left=o;let c=a.offset.right.plus(32);a.offset.right=c;let l=this.newVar(0),u=s(t),d,f;switch(!0){case!!u:d=u.y1.minus(40),f=u.y2.plus(32),this.put(l).after(u.bottom,32);break;case a===i:d=this.newVar(0),f=this.newVar(0),this.put(d).before(i.offset.top,52),this.put(f).after(i.offset.bottom,32),this.put(l).after(f);break;case t.length>0:d=this.newVar(0),f=this.newVar(0);for(let e of t)this.put(d).before(e.y1,32),this.put(f).after(e.y2,32),this.put(l).after(e.bottom,32);break;default:d=this.newVar(0),f=this.newVar(0);for(var p=i.column;p<=a.column;p++){let e=this.actorBox(p).offset;this.put(d).before(e.top,52),this.put(f).after(e.bottom,32)}this.put(l).after(f);break}for(var p=i.column;p<=a.column;p++){let e=this.actorBox(p).offset;e.top=d,e.bottom=f}return[{node:e.node,depth:r,from:i,to:a,x1:o,y1:d,x2:c,y2:f,bottom:l},...n]}ensureRow(e,t){for(;e>=this.#o.length;){let e=this.#o.length>0&&this.#o[this.#o.length-1]?.bottom||this.#a.plus(30),t=this.newVar(this.#o.length*80);this.put(t).after(e);let n=this.newVar(80);this.require(n,`>=`,80),this.#o.push({y:t,height:n,bottom:t.plus(n),lastHeight:80})}let n=x(this.#o[e]);t>n.lastHeight&&(n.lastHeight=t,this.require(n.height,`>=`,t),this.#e.suggestValue(n.height,t))}newVar(e){let t=new u;return this.#e.addEditVariable(t,d.weak),typeof e==`number`&&(this.#e.suggestValue(t,e),this.constraint(t,`>=`,0,d.strong)),t}require(e,t,n=void 0){switch(this.constraint(e,t,n,d.required),t){case`<=`:case`>=`:this.constraint(e,`==`,n,d.weak);break;case`<= 0`:case`>= 0`:this.constraint(e,`== 0`,void 0,d.weak);break}}constraint(e,t,n=void 0,r=d.medium){let i;switch(t){case`==`:i=p.Eq;break;case`>=`:i=p.Ge;break;case`<=`:i=p.Le;break;case`== 0`:i=p.Eq,n=0;break;case`>= 0`:i=p.Ge,n=0;break;case`<= 0`:i=p.Le,n=0;break;default:S(t)}this.#e.addConstraint(new f(e,i,n??0,r))}put(e,t=d.required){let n=t===d.required?d.medium:d.weak;return{before:(r,i)=>{i&&(r=r.minus(i)),this.constraint(e,`<=`,r,t),this.constraint(e,`==`,r,n)},after:(r,i)=>{i&&(r=r.plus(i)),this.constraint(e,`>=`,r,t),this.constraint(e,`==`,r,n)}}}};function E(t){let o=new Set,s=e=>x(t.nodes.find(t=>t.id===e)),u=[];for(let e of t.edges.filter(e=>g(e.id))){let t=s(e.source),n=s(e.target);if(t.children.length||n.children.length){console.error(`Sequence view does not support nested actors`);continue}o.add(t),o.add(n),u.push({edge:e,source:t,target:n})}let d=t.nodes.filter(e=>o.has(e));y(r(d,1),`actors array must not be empty`);let f=new _(()=>[]),p=[],m=0;for(let{edge:e,source:t,target:n}of u){let r=p.at(-1),i=d.indexOf(t),a=d.indexOf(n),o=t===n,s=i>a,c=h(e.id),l=!1;r&&r.target==t&&r.parallelPrefix===c&&(l=r.isSelfLoop!==o||r.isBack===s),l||m++;let u={id:e.id,from:{column:i,row:m},to:{column:a,row:o?++m:m},edge:e,isSelfLoop:o,isBack:s,parallelPrefix:c,offset:l?(r?.offset??0)+22:0,source:t,target:n,label:e.labelBBox?{height:e.labelBBox.height+8+(e.navigateTo?20:0),width:e.labelBBox.width+16,text:e.label}:null};p.push(u),f.get(t).push({step:u,row:m,type:`source`,position:s&&!o?`left`:`right`}),f.get(n).push({step:u,row:m,type:`target`,position:s||o?`right`:`left`})}let v=new T({actors:d,steps:p,compounds:w(d,t.nodes)}),b=v.getViewBounds(),S=i(v.getCompoundBoxes(),l(({node:e,...t})=>({...t,id:e.id,origin:e.id})),e(`id`),a((e,t)=>r(e,2)?l(e,(e,n)=>({...e,id:`${t}-${n+1}`})):e),c(),n());return{actors:d.map(e=>D({actor:e,ports:f.get(e),layout:v})),compounds:S,steps:l(p,e=>({id:e.id,sourceHandle:e.id+`_source`,targetHandle:e.id+`_target`,...e.label&&{labelBBox:{width:e.label.width,height:e.label.height}}})),parallelAreas:v.getParallelBoxes(),bounds:b}}function D({actor:e,ports:t,layout:n}){let{x:r,y:i,width:a,height:o}=n.getActorBox(e);return{id:e.id,x:r,y:i,width:a,height:o,ports:t.map(e=>{let t=n.getPortCenter(e.step,e.type);return{id:`${e.step.id}_${e.type}`,cx:t.cx-r,cy:t.cy-i,height:t.height,type:e.type,position:e.position}})}}export{E as t};
@@ -1,15 +1,17 @@
1
- import{t as e}from"./libs/json5.mjs";import{J as t}from"./libs/@hono/mcp.mjs";import{BorderStyles as n,ElementShapes as r,IconPositions as i,RelationshipArrowTypes as a,Sizes as o,ThemeColors as s,computeColorValues as c}from"@likec4/core/styles";import{exact as l}from"@likec4/core/types";const u=/^@[A-Za-z0-9_-]*$/,d=/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,f=t.string().min(1,`Image alias key cannot be empty`).regex(u,`Image alias key must match /^@\\w+$/`),p=t.string().min(1,`Image alias value cannot be empty`).regex(d,`Image alias value must be a relative path (no leading slash or protocol)`),m=t.record(f,p).meta({id:`ImageAliases`,description:`Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash).`}),h=t.string().min(1,`Include path cannot be empty`).regex(/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,`Include path must be a relative path (no leading slash, drive letter, or protocol)`),g=t.strictObject({paths:t.array(h).meta({description:[`Additional relative directory paths to include LikeC4 source files from, searched recursively.`,`Paths are relative to the project folder (the folder containing this config file).`,`Example: ["../shared", "../common/specs"]`].join(`
1
+ import{t as e}from"./libs/json5.mjs";import{J as t}from"./libs/@hono/mcp.mjs";import{BorderStyles as n,ElementShapes as r,IconPositions as i,RelationshipArrowTypes as a,Sizes as o,ThemeColors as s,computeColorValues as c}from"@likec4/core/styles";import{exact as l}from"@likec4/core/types";const u=/^@[A-Za-z0-9_-]*$/,ee=/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,d=t.string().min(1,`Image alias key cannot be empty`).regex(u,`Image alias key must match /^@\\w+$/`),te=t.string().min(1,`Image alias value cannot be empty`).regex(ee,`Image alias value must be a relative path (no leading slash or protocol)`),ne=t.record(d,te).meta({id:`ImageAliases`,description:`Map of image alias prefixes to relative paths (keys must match /^@\\w+$/; values must be relative paths without protocol or leading slash).`}),f=t.string().min(1,`Include path cannot be empty`).regex(/^(?!\/|[A-Za-z]:[\\\/])(?!.*:\/\/).*$/,`Include path must be a relative path (no leading slash, drive letter, or protocol)`),p=t.strictObject({paths:t.array(f).meta({description:[`Additional relative directory paths to include LikeC4 source files from, searched recursively.`,`Paths are relative to the project folder (the folder containing this config file).`,`Example: ["../shared", "../common/specs"]`].join(`
2
2
  `)}),maxDepth:t.number().int().min(1).max(20).default(3).meta({description:[`Maximum directory depth to scan when searching for .c4 files in include paths.`,`Prevents excessive scanning of deeply nested directories.`,`Default: 3`].join(`
3
3
  `)}),fileThreshold:t.number().int().min(1).max(1e4).default(30).meta({description:[`Maximum number of files to load from include paths before warning.`,`Helps identify performance issues from accidentally including large directories.`,`Default: 30`].join(`
4
4
  `)})}).meta({id:`include-config`,description:[`Configuration for including additional LikeC4 source files from other directories.`,`Example: { "paths": ["../shared", "../common/specs"], "maxDepth": 5, "fileThreshold": 50 }`].join(`
5
- `)}),_=t.int().min(0,`Opacity must be between 0 and 100`).max(100,`Opacity must be between 0 and 100`).meta({id:`Opacity`,description:`Opacity 0-100%`}),v=t.enum(r).meta({id:`ElementShape`}),y=t.enum(n).meta({id:`BorderStyle`}),b=t.enum(o).meta({id:`ElementSize`}),x=t.enum(i).meta({id:`IconPosition`}),S=t.enum(a).meta({id:`ArrowType`}),ee=t.enum([`dashed`,`solid`,`dotted`]).meta({id:`LineType`}),te=t.enum(s).meta({id:`ThemeColorName`}),C=t.custom().refine(e=>typeof e==`string`,`Custom color name must be a string`).transform(e=>e).meta({id:`CustomColorName`}),w=te.or(C).transform(e=>e).meta({id:`ColorName`}),T=t.string().min(1,`Color value cannot be empty`).meta({id:`ColorLiteral`}),E=t.strictObject({fill:T.meta({description:`Background color`}),stroke:T.meta({description:`Stroke color (border, paths above background)`}),hiContrast:T.meta({description:`High contrast text color (title)`}),loContrast:T.meta({description:`Low contrast text color (description)`})}).meta({id:`ElementColorValues`}).transform(e=>e),D=t.strictObject({line:T.meta({description:`Line color`}),label:T.meta({description:`Label text color`}),labelBg:T.optional().default(`rgba(0, 0, 0, 0.5)`).meta({description:`Label background color`})}).meta({id:`RelationshipColorValues`}).transform(e=>e),O=t.strictObject({elements:E.or(T.transform(e=>c(e).elements)).meta({description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`}),relationships:D.or(T.transform(e=>c(e).relationships)).meta({description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`})}).transform(e=>e).meta({id:`StrictThemeColorValues`,description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color value`}).or(T.transform(e=>c(e))).transform(e=>e).meta({id:`ThemeColorValues`,description:`Exact value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`}),k=t.partialRecord(w,O).transform(e=>e),A=t.strictObject({width:t.number().min(50),height:t.number().min(50)}).meta({id:`Dimensions`,description:`Defines dimensions for theme size`}),j=t.partialRecord(b,A),M=t.strictObject({colors:k.optional().meta({description:`Override theme colors`}),sizes:j.optional().meta({description:`Override theme sizes`})}).meta({id:`ThemeCustomization`,description:`Customize theme colors and sizes`}).transform(({colors:e,sizes:t})=>l({colors:e?l(e):void 0,sizes:t?l(t):void 0})),N=t.strictObject({color:w.optional().meta({description:`Default color for groups
6
- (must be a valid color name from the theme)`}),opacity:_.optional().meta({description:`Default opacity for groups`}),border:y.optional().meta({description:`Default border for groups`})}).meta({id:`GroupDefaultStyleValues`}),P=t.strictObject({color:w.optional().meta({description:`Default color for relationships
7
- (must be a valid color name from the theme)`}),line:ee.optional().meta({description:`Default line style for relationships`}),arrow:S.optional().meta({description:`Default arrow style for relationships`})}).meta({id:`RelationshipDefaultStyleValues`,description:`Override default values for relationship style properties
8
- These values will be used if such property is not defined`}),F=t.strictObject({color:w.optional().meta({description:`Default color for elements
9
- (must be a valid color name from the theme)`}),opacity:_.optional().meta({description:`Default opacity (0-100%) for elements when displayed as a group (like a container)`}),border:y.optional().meta({description:`Default border style for elements when displayed as a group (like a container)`}),size:b.optional().meta({description:`Default size for elements`}),shape:v.optional().meta({description:`Default shape for elements`}),iconPosition:x.optional().meta({description:`Default icon position for elements`}),group:N.optional().meta({description:`Override default values for group style properties
10
- These values will be used if such property is not defined`}),relationship:P.optional().meta({description:`Override default values for relationship style properties
11
- These values will be used if such property is not defined`})}).meta({id:`DefaultStyleValues`}),I=t.union([t.string().min(1,`Custom CSS file path cannot be empty`),t.array(t.string().min(1,`Custom CSS file path cannot be empty`))]).meta({id:`CustomStylesheets`}),L=t.strictObject({theme:M.optional().meta({description:`Project theme customization`}),defaults:F.optional().meta({description:`Override default values for style properties
12
- These values will be used if such property is not defined`}),customCss:I.optional().meta({description:`Custom CSS (or list of CSS files) to be included in the generated diagrams`})}).transform(({theme:e,defaults:t,customCss:n})=>l({defaults:R(t),customCss:ne(n),theme:e}));function R(e){if(!e)return;let{relationship:t,group:n,...r}=e;return l({...r,relationship:t&&l(t),group:n&&l(n)})}function ne(e){if(!e)return;let t=(Array.isArray(e)?e:[e]).filter(Boolean);if(t.length!==0)return{paths:t,content:``}}const z=t.strictObject({outDir:t.string().default(`.likec4`).meta({description:[`Path to the directory where manual layouts will be stored,`,`relative to the folder containing the project config. `,``,`Defaults to '.likec4'.`].join(`
13
- `)})}).meta({id:`ManualLayoutsConfig`,description:`Configuration for manual layouts`}),B=t.object({name:t.string().nonempty(`Project name cannot be empty`).refine(e=>e!==`default`,{abort:!0,error:`Project name cannot be "default"`}).refine(e=>!e.includes(`.`)&&!e.includes(`@`)&&!e.includes(`#`),{abort:!0,error:`Project name cannot contain ".", "@" or "#", try to use A-z, 0-9, _ and -`}).meta({description:`Project name, must be unique in the workspace`}),extends:t.union([t.string().min(1,`Extend path cannot be empty`),t.array(t.string().min(1,`Extend path cannot be empty`)).min(1,`Extend list cannot be empty`)]).optional().meta({description:`Extend styles from other config files`}),title:t.string().nonempty(`Project title cannot be empty if specified`).optional().meta({description:`A human readable title for the project`}),contactPerson:t.string().nonempty(`Contact person cannot be empty if specified`).optional().meta({description:`A person who has been involved in creating or maintaining this project`}),metadata:t.record(t.string(),t.any()).optional().meta({description:`Arbitrary metadata as key-value pairs for custom project information`}),styles:L.optional().meta({description:`Project styles customization`}),imageAliases:m.optional(),include:g.optional(),exclude:t.array(t.string()).optional().meta({description:`List of file patterns to exclude from the project, default is ["**/node_modules/**"]`}),manualLayouts:z.optional(),inferTechnologyFromIcon:t.boolean().optional().meta({description:[`Automatically derive element technology from icon name when technology is not set explicitly.`,`Applies to aws:, azure:, gcp:, and tech: icons. Bootstrap icons are excluded.`,`Defaults to true.`].join(`
14
- `)}),implicitViews:t.boolean().optional().meta({description:`Auto-generate scoped views for elements without explicit views. Defaults to false.`})}).meta({id:`LikeC4ProjectConfig`,description:`LikeC4 Project Configuration`}),V=t.instanceof(Function),H=t.record(t.string(),V),U=B.extend({generators:H.optional()});function W(e){let n=U.safeParse(e);if(n.success)return n.data;throw Error(`Config validation failed:
15
- `+t.prettifyError(n.error))}function G(t){return W(e.parse(t.trim()||`{}`))}const K={parse:G,validate:W,normalizeInclude:e=>{let t=g.safeParse(e);return t.success?t.data:{paths:[],maxDepth:3,fileThreshold:30}}};function q(e){let t=e.length;for(;t>0&&(e[t-1]===`/`||e[t-1]===`\\`);)t--;return e.slice(0,t)}function J(e){return e.split(`/`).flatMap(e=>e.split(`\\`))}function Y(e){let t=q(e),n=J(t);return n[n.length-1]||t}const X=[`.likec4rc`,`.likec4.config.json`,`likec4.config.json`],Z=[`likec4.config.js`,`likec4.config.cjs`,`likec4.config.mjs`,`likec4.config.ts`,`likec4.config.cts`,`likec4.config.mts`];[...X,...Z];function Q(e){return X.includes(Y(e))}function $(e){return Z.includes(Y(e))}function re(e){return Q(e)||$(e)}function ie(e){return U.parse(e)}function ae(e){return H.parse(e)}function oe(e){return O.parse(e)}function se(e){return M.parse(e)}function ce(e){return L.parse(e)}export{oe as a,$ as c,W as d,se as i,K as l,ae as n,re as o,ce as r,Q as s,ie as t,B as u};
5
+ `)}),m=t.int().min(0,`Opacity must be between 0 and 100`).max(100,`Opacity must be between 0 and 100`).meta({id:`Opacity`,description:`Opacity 0-100%`}),h=t.enum(r).meta({id:`ElementShape`}),g=t.enum(n).meta({id:`BorderStyle`}),_=t.enum(o).meta({id:`ElementSize`}),v=t.enum(i).meta({id:`IconPosition`}),y=t.enum(a).meta({id:`ArrowType`}),b=t.enum([`dashed`,`solid`,`dotted`]).meta({id:`LineType`}),re=t.enum(s).meta({id:`ThemeColorName`}),ie=t.custom().refine(e=>typeof e==`string`,`Custom color name must be a string`).transform(e=>e).meta({id:`CustomColorName`}),x=re.or(ie).transform(e=>e).meta({id:`ColorName`}),S=t.string().min(1,`Color value cannot be empty`).meta({id:`ColorLiteral`}),C=t.strictObject({fill:S.meta({description:`Background color`}),stroke:S.meta({description:`Stroke color (border, paths above background)`}),hiContrast:S.meta({description:`High contrast text color (title)`}),loContrast:S.meta({description:`Low contrast text color (description)`})}).meta({id:`ElementColorValues`}).transform(e=>e),w=t.strictObject({line:S.meta({description:`Line color`}),label:S.meta({description:`Label text color`}),labelBg:S.optional().default(`rgba(0, 0, 0, 0.5)`).meta({description:`Label background color`})}).meta({id:`RelationshipColorValues`}).transform(e=>e),T=t.strictObject({elements:C.or(S.transform(e=>c(e).elements)).meta({description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`}),relationships:w.or(S.transform(e=>c(e).relationships)).meta({description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`})}).transform(e=>e).meta({id:`StrictThemeColorValues`,description:`Exact color value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color value`}).or(S.transform(e=>c(e))).transform(e=>e).meta({id:`ThemeColorValues`,description:`Exact value (hex, rgb, rgba, hsl, hsla ...) or break down of specific color values`}),E=t.partialRecord(x,T).transform(e=>e),D=t.strictObject({width:t.number().min(50),height:t.number().min(50)}).meta({id:`Dimensions`,description:`Defines dimensions for theme size`}),O=t.partialRecord(_,D),k=t.strictObject({colors:E.optional().meta({description:`Override theme colors`}),sizes:O.optional().meta({description:`Override theme sizes`})}).meta({id:`ThemeCustomization`,description:`Customize theme colors and sizes`}).transform(({colors:e,sizes:t})=>l({colors:e?l(e):void 0,sizes:t?l(t):void 0})),A=t.strictObject({color:x.optional().meta({description:`Default color for groups
6
+ (must be a valid color name from the theme)`}),opacity:m.optional().meta({description:`Default opacity for groups`}),border:g.optional().meta({description:`Default border for groups`})}).meta({id:`GroupDefaultStyleValues`}),j=t.strictObject({color:x.optional().meta({description:`Default color for relationships
7
+ (must be a valid color name from the theme)`}),line:b.optional().meta({description:`Default line style for relationships`}),arrow:y.optional().meta({description:`Default arrow style for relationships`})}).meta({id:`RelationshipDefaultStyleValues`,description:`Override default values for relationship style properties
8
+ These values will be used if such property is not defined`}),M=t.strictObject({color:x.optional().meta({description:`Default color for elements
9
+ (must be a valid color name from the theme)`}),opacity:m.optional().meta({description:`Default opacity (0-100%) for elements when displayed as a group (like a container)`}),border:g.optional().meta({description:`Default border style for elements when displayed as a group (like a container)`}),size:_.optional().meta({description:`Default size for elements`}),shape:h.optional().meta({description:`Default shape for elements`}),iconPosition:v.optional().meta({description:`Default icon position for elements`}),group:A.optional().meta({description:`Override default values for group style properties
10
+ These values will be used if such property is not defined`}),relationship:j.optional().meta({description:`Override default values for relationship style properties
11
+ These values will be used if such property is not defined`})}).meta({id:`DefaultStyleValues`}),N=t.union([t.string().min(1,`Custom CSS file path cannot be empty`),t.array(t.string().min(1,`Custom CSS file path cannot be empty`))]).meta({id:`CustomStylesheets`}),P=t.strictObject({theme:k.optional().meta({description:`Project theme customization`}),defaults:M.optional().meta({description:`Override default values for style properties
12
+ These values will be used if such property is not defined`}),customCss:N.optional().meta({description:`Custom CSS (or list of CSS files) to be included in the generated diagrams`})}).transform(({theme:e,defaults:t,customCss:n})=>l({defaults:F(t),customCss:I(n),theme:e}));function F(e){if(!e)return;let{relationship:t,group:n,...r}=e;return l({...r,relationship:t&&l(t),group:n&&l(n)})}function I(e){if(!e)return;let t=(Array.isArray(e)?e:[e]).filter(Boolean);if(t.length!==0)return{paths:t,content:``}}const L=t.strictObject({outDir:t.string().default(`.likec4`).meta({description:[`Path to the directory where manual layouts will be stored,`,`relative to the folder containing the project config. `,``,`Defaults to '.likec4'.`].join(`
13
+ `)})}).meta({id:`ManualLayoutsConfig`,description:`Configuration for manual layouts`}),R=t.union([t.strictObject({redirect:t.literal(!0)}),t.strictObject({include:t.array(t.string().nonempty().refine(e=>e!==`#`,{message:`selector cannot be "#"`})).nonempty(`include list cannot be empty`)}),t.strictObject({exclude:t.array(t.string().nonempty().refine(e=>e!==`#`,{message:`selector cannot be "#"`})).nonempty(`exclude list cannot be empty`)})]).meta({id:`LandingPageConfig`,description:`Configure the landing page. Use redirect to go to the index view, or include/exclude to filter the view grid.`}),z=t.object({name:t.string().nonempty(`Project name cannot be empty`).refine(e=>e!==`default`,{abort:!0,error:`Project name cannot be "default"`}).refine(e=>!e.includes(`.`)&&!e.includes(`@`)&&!e.includes(`#`),{abort:!0,error:`Project name cannot contain ".", "@" or "#", try to use A-z, 0-9, _ and -`}).meta({description:`Project name, must be unique in the workspace`}),extends:t.union([t.string().min(1,`Extend path cannot be empty`),t.array(t.string().min(1,`Extend path cannot be empty`)).min(1,`Extend list cannot be empty`)]).optional().meta({description:`Extend styles from other config files`}),title:t.string().nonempty(`Project title cannot be empty if specified`).optional().meta({description:`A human readable title for the project`}),contactPerson:t.string().nonempty(`Contact person cannot be empty if specified`).optional().meta({description:`A person who has been involved in creating or maintaining this project`}),metadata:t.record(t.string(),t.any()).optional().meta({description:`Arbitrary metadata as key-value pairs for custom project information`}),styles:P.optional().meta({description:`Project styles customization`}),imageAliases:ne.optional(),include:p.optional(),exclude:t.array(t.string()).optional().meta({description:`List of file patterns to exclude from the project, default is ["**/node_modules/**"]`}),manualLayouts:L.optional(),inferTechnologyFromIcon:t.boolean().optional().meta({description:[`Automatically derive element technology from icon name when technology is not set explicitly.`,`Applies to aws:, azure:, gcp:, and tech: icons. Bootstrap icons are excluded.`,`Defaults to true.`].join(`
14
+ `)}),implicitViews:t.boolean().optional().meta({description:`Auto-generate scoped views for elements without explicit views. Defaults to false.`}),landingPage:R.optional()}).meta({id:`LikeC4ProjectConfig`,description:`LikeC4 Project Configuration`}),B=t.instanceof(Function),V=t.record(t.string(),B),H=z.extend({generators:V.optional()});function U(e){let n=e.landingPage,r=null;if(n!=null){let e=R.safeParse(n);if(!e.success)throw Error(`Config validation failed:
15
+ `+t.prettifyError(e.error));r=e.data}let i=z.safeParse(e);if(!i.success)throw Error(`Config validation failed:
16
+ `+t.prettifyError(i.error));let a=i.data;r!==null&&(a={...a,landingPage:r});let o=e.generators;if(typeof o==`object`&&o&&!Array.isArray(o)){let e=V.safeParse(o);if(!e.success)throw Error(`Config validation failed (generators):
17
+ `+t.prettifyError(e.error));return{...a,generators:e.data}}return a}function W(t){return U(e.parse(t.trim()||`{}`))}const G={parse:W,validate:U,normalizeInclude:e=>{let t=p.safeParse(e);return t.success?t.data:{paths:[],maxDepth:3,fileThreshold:30}}};function K(e){let t=e.length;for(;t>0&&(e[t-1]===`/`||e[t-1]===`\\`);)t--;return e.slice(0,t)}function q(e){return e.split(`/`).flatMap(e=>e.split(`\\`))}function J(e){let t=K(e),n=q(t);return n[n.length-1]||t}const Y=[`.likec4rc`,`.likec4.config.json`,`likec4.config.json`],X=[`likec4.config.js`,`likec4.config.cjs`,`likec4.config.mjs`,`likec4.config.ts`,`likec4.config.cts`,`likec4.config.mts`];[...Y,...X];function Z(e){return Y.includes(J(e))}function Q(e){return X.includes(J(e))}function ae(e){return Z(e)||Q(e)}function oe(e){return H.parse(e)}function se(e){return V.parse(e)}function ce(e){return T.parse(e)}function le(e){return k.parse(e)}function $(e){return P.parse(e)}export{ce as a,Q as c,U as d,le as i,G as l,se as n,ae as o,$ as r,Z as s,oe as t,z as u};