@visulima/pail 4.1.1 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/LICENSE.md +5 -811
- package/README.md +2 -2
- package/dist/error.js +3 -3
- package/dist/index.browser.d.ts +2 -4
- package/dist/index.browser.js +19 -19
- package/dist/index.server.d.ts +2 -3
- package/dist/index.server.js +27 -28
- package/dist/middleware/elysia.js +1 -1
- package/dist/middleware/express.js +1 -1
- package/dist/middleware/fastify.js +1 -1
- package/dist/middleware/hono.js +1 -1
- package/dist/middleware/next/handler.d.ts +0 -1
- package/dist/middleware/next/handler.js +1 -1
- package/dist/middleware/sveltekit.js +1 -1
- package/dist/object-tree.js +2 -2
- package/dist/packem_shared/AbstractJsonReporter-DPsVS6w5.js +1 -0
- package/dist/packem_shared/AbstractJsonReporter-elZG6xkO.js +1 -0
- package/dist/packem_shared/JsonReporter-CY90KVxK.js +2 -0
- package/dist/packem_shared/JsonReporter-DX9fJfwQ.js +1 -0
- package/dist/packem_shared/{PailError-CbU1Ogfa.js → PailError-BgUh0gyX.js} +3 -3
- package/dist/packem_shared/PrettyReporter-BR6Olx7E.js +47 -0
- package/dist/packem_shared/PrettyReporter-ClyBiPyQ.js +5 -0
- package/dist/packem_shared/abstract-pretty-reporter-CZoTcUjq.js +36 -0
- package/dist/packem_shared/headers-BjUW0cAm.js +1 -0
- package/dist/packem_shared/{index-CbkPnylC.js → index-pjyHJq0E.js} +1 -1
- package/dist/packem_shared/pailMiddleware-lhLj-hzE.js +1 -0
- package/dist/packem_shared/serializeError-Kr3JL9UN-zwOuO-gY.js +1 -0
- package/dist/packem_shared/storage-DP9QMOmG.js +1 -0
- package/dist/packem_shared/{types.d-DGHeA2iJ.d.ts → types.d-DNoig6eq.d.ts} +37 -3
- package/dist/packem_shared/{types.d-BW8kAXUv.d.ts → types.d-OiMbrp8C.d.ts} +37 -2
- package/dist/packem_shared/{useLogger-7p55yvvc.js → useLogger-HtOIBW7n.js} +1 -1
- package/dist/packem_shared/write-console-log-based-on-level-CG0mniaO.js +1 -0
- package/dist/packem_shared/write-stream-D2XwCKdN.js +1 -0
- package/dist/processor/caller/caller-processor.js +1 -1
- package/dist/processor/environment-processor.js +1 -1
- package/dist/processor/message-formatter-processor.js +1 -1
- package/dist/processor/opentelemetry-processor.js +1 -1
- package/dist/processor/redact-processor.d.ts +58 -0
- package/dist/processor/redact-processor.js +1 -1
- package/dist/processor/sampling-processor.js +1 -1
- package/dist/reporter/file/json-file-reporter.js +2 -2
- package/dist/reporter/http/abstract-http-reporter.js +2 -2
- package/dist/reporter/http/http-reporter.edge-light.d.ts +0 -2
- package/dist/reporter/http/http-reporter.edge-light.js +2 -2
- package/dist/reporter/http/http-reporter.js +1 -1
- package/dist/reporter/json/index.browser.d.ts +1 -3
- package/dist/reporter/json/index.browser.js +1 -1
- package/dist/reporter/json/index.js +1 -1
- package/dist/reporter/pretty/index.browser.d.ts +1 -3
- package/dist/reporter/pretty/index.browser.js +1 -1
- package/dist/reporter/pretty/index.d.ts +41 -5
- package/dist/reporter/pretty/index.js +1 -1
- package/dist/reporter/simple/simple-reporter.server.d.ts +40 -5
- package/dist/reporter/simple/simple-reporter.server.js +7 -7
- package/dist/wide-event.js +1 -1
- package/package.json +3 -3
- package/dist/packem_shared/AbstractJsonReporter-BpWRnN0L.js +0 -1
- package/dist/packem_shared/AbstractJsonReporter-DxZwImm5.js +0 -1
- package/dist/packem_shared/JsonReporter-9IcELa1m.js +0 -2
- package/dist/packem_shared/JsonReporter-Dd3kuj8X.js +0 -1
- package/dist/packem_shared/PrettyReporter-BUWNEg3_.js +0 -5
- package/dist/packem_shared/PrettyReporter-DbgD89ck.js +0 -70
- package/dist/packem_shared/abstract-pretty-reporter-CyfTvmKf.js +0 -59
- package/dist/packem_shared/headers-DI58djdG.js +0 -1
- package/dist/packem_shared/pailMiddleware-B5DJoBYl.js +0 -1
- package/dist/packem_shared/serializeError-52C4oiKx-CrnRcq9R.js +0 -1
- package/dist/packem_shared/storage-DVcJumyk.js +0 -1
- package/dist/packem_shared/write-console-log-based-on-level-BqjxV016.js +0 -1
- package/dist/packem_shared/write-stream-ytl_vhg_.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as m}from"./constants-DKfCaSUR.js";const g=Object.create({},{cause:{enumerable:!1,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!1,value:void 0,writable:!0},message:{enumerable:!1,value:void 0,writable:!0},name:{enumerable:!1,value:void 0,writable:!0},stack:{enumerable:!1,value:void 0,writable:!0}}),d=e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},p=new WeakSet,v=e=>{if(Object.hasOwn(e,"name")&&typeof e.name=="string"&&e.name!=="")return e.name;const r=e.constructor?.name;return typeof r=="string"&&r!==""?r:e.name},O=e=>{const r=Object.getOwnPropertyNames(e);for(const n of r){const t=Object.getOwnPropertyDescriptor(e,n);t&&(t.enumerable||Object.defineProperty(e,n,{...t,enumerable:!0}),t.value&&typeof t.value=="object"&&!Array.isArray(t.value)&&(Object.getPrototypeOf(t.value)===Object.prototype||Object.getPrototypeOf(t.value)===null)&&O(t.value))}},h=e=>{p.add(e);const r=e.toJSON();return p.delete(e),Object.isExtensible(r)&&O(r),r},s=(e,r,n,t,o=new Set)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&"pipe"in e&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return r.has(e)?"[Circular]":(n+=1,f(e,t,r,n));if(t.useToJSON&&e!==null&&typeof e=="object"&&"toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();if(e instanceof Date)return e.toISOString();if(e instanceof RegExp)return e.toString();if(typeof URL<"u"&&e instanceof URL)return e.href;if(e instanceof Map){const u=[];for(const[a,i]of e.entries())u.push([s(a,r,n,t,o),s(i,r,n,t,o)]);return{__dataType:"Map",value:u}}if(e instanceof Set){const u=[];for(const a of e.values())u.push(s(a,r,n,t,o));return{__dataType:"Set",value:u}}if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${String(e)}n`;if(d(e)){if(o.has(e))return"[Circular]";if(t.maxDepth!==void 0&&t.maxDepth!==Number.POSITIVE_INFINITY&&n+1>=t.maxDepth)return{};n+=1,o.add(e);const u={};for(const a in e)u[a]=s(e[a],r,n,t,o);return o.delete(e),u}try{return e}catch{return"[Not Available]"}},f=(e,r,n,t)=>{if(n.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!p.has(e))return h(e);const o=Object.create(g);if(Object.defineProperty(o,"name",{configurable:!0,enumerable:!0,value:v(e),writable:!0}),Object.defineProperty(o,"message",{configurable:!0,enumerable:!0,value:e.message,writable:!0}),Object.defineProperty(o,"stack",{configurable:!0,enumerable:!0,value:e.stack,writable:!0}),Array.isArray(e.errors)){const a=[];for(const i of e.errors){if(!(i instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(n.has(i))return Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),o;a.push(f(i,r,n,t))}Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:a,writable:!0})}const u=e.cause;if(u!=null)if(u instanceof Error)n.has(u)?Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:f(u,r,n,t),writable:!0});else{const a=s(u,n,t,r);Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:a,writable:!0})}for(const a in e){if(a==="name"||a==="message"||a==="stack"||a==="cause"||a==="errors")continue;const i=e[a],c=s(i,n,t,r);Object.defineProperty(o,a,{configurable:!0,enumerable:!0,value:c,writable:!0})}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const a of r.exclude)try{delete o[a]}catch{}return o},y=(e,r={})=>f(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0);class S{stringify;errorOptions;constructor(r={}){this.errorOptions=r.error??{}}setStringify(r){this.stringify=r}log(r){const{context:n,error:t,file:o,message:u,type:a,...i}=r;if(i.label&&(i.label=i.label.trim()),o&&(i.file=`${o.name??""}:${String(o.line)}${o.column?`:${String(o.column)}`:""}`),i.message=u===m?void 0:u,t&&(i.error=y(t,this.errorOptions)),n){const c=[];for(let b=0;b<n.length;b+=1){const l=n[b];l!==m&&(l instanceof Error?c.push(y(l,this.errorOptions)):c.push(l))}i.context=c}this._log(this.stringify(i),a.level)}}export{S as AbstractJsonReporter};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as p}from"node:module";import{AbstractJsonReporter as o}from"./AbstractJsonReporter-DPsVS6w5.js";import{i as a,w as d}from"./write-stream-D2XwCKdN.js";const r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:i,stderr:c}=r;class h extends o{#e;#t;constructor(e={}){super(e),this.#e=i,this.#t=c}setStdout(e){this.#e=e}setStderr(e){this.#t=e}_log(e,t){const s=a(t)?this.#t:this.#e;d(`${e}
|
|
2
|
+
`,s)}}export{h as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AbstractJsonReporter as s}from"./AbstractJsonReporter-elZG6xkO.js";import{w as t}from"./write-console-log-based-on-level-CG0mniaO.js";class a extends s{constructor(o={}){super(o)}_log(o,e){t(e)(o)}}export{a as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
class e extends Error{status;why;fix;link;constructor(s){const
|
|
1
|
+
class e extends Error{status;why;fix;link;constructor(s){const i=typeof s=="string"?{message:s}:s;super(i.message,i.cause===void 0?void 0:{cause:i.cause}),this.name="PailError",this.status=i.status??500,this.why=i.why,this.fix=i.fix,this.link=i.link}toJSON(){const s={message:this.message,name:this.name,status:this.status};return this.why&&(s.why=this.why),this.fix&&(s.fix=this.fix),this.link&&(s.link=this.link),this.stack&&(s.stack=this.stack),this.cause!==void 0&&(s.cause=this.cause instanceof Error?{message:this.cause.message,name:this.cause.name,stack:this.cause.stack}:this.cause),s}toString(){let s=`${this.name} [${String(this.status)}]: ${this.message}`;if(this.why&&(s+=`
|
|
2
2
|
Why: ${this.why}`),this.fix&&(s+=`
|
|
3
3
|
Fix: ${this.fix}`),this.link&&(s+=`
|
|
4
|
-
Link: ${this.link}`),this.cause!==void 0){const
|
|
5
|
-
Cause: ${
|
|
4
|
+
Link: ${this.link}`),this.cause!==void 0){const i=this.cause instanceof Error?this.cause.message:String(this.cause);s+=`
|
|
5
|
+
Cause: ${i}`}return s}}const a=t=>new e(t);export{e as PailError,a as createPailError};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import{createRequire as Ee}from"node:module";import et from"@visulima/colorize";import{L as je,E as Me}from"./constants-ep2nsfdy.js";import{i as We,w as Fe}from"./write-stream-D2XwCKdN.js";let Ie;const Ne=t=>(Ie??=Ee(import.meta.url))(t),C=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:T,$t=t=>{if(typeof C<"u"&&C.versions&&C.versions.node){const[e,n]=C.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return C.getBuiltinModule(t)}return Ne(t)},T=C,{stdout:Oe,stderr:ke}=T,{execFileSync:Te}=$t("node:child_process"),V=$t("node:fs"),Be=$t("node:tty"),Le=globalThis.process??Object.create(null),vt={versions:{}},G=new Proxy(Le,{get(t,e){if(e in t)return t[e];if(e in vt)return vt[e]}}),nt=t=>{let e;return()=>{if(e===void 0){if(typeof G.getBuiltinModule!="function")throw new TypeError(`[@visulima/error] Cannot load ${t}: this runtime implements no process.getBuiltinModule(). Requires Node ^22.14.0 || >=24.10.0, or another runtime providing process.getBuiltinModule().`);e=G.getBuiltinModule(t)}return e}},_e=t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
+
`),ze=(t,e,n,r)=>{const s={column:0,line:-1,...t.start},o={...s,...t.end},i=s.line,c=s.column,l=o.line,a=o.column;let u=Math.max(i-(n+1),0),d=Math.min(e.length,l+r);i===-1&&(u=0),l===-1&&(d=e.length);const h=l-i,f={};if(h)for(let p=0;p<=h;p++){const g=p+i;if(!c)f[g]=!0;else if(p===0){const m=e[g-1]?.length;f[g]=[c,(m??0)-c+1]}else if(p===h)f[g]=[0,a];else{const m=e[g-p]?.length;f[g]=[0,m]}}else c===a?f[i]=c?[c,0]:!0:f[i]=[c,(a??0)-(c??0)];return{end:d,markerLines:f,start:u}},Re=G.platform==="win32"&&!G.env?.WT_SESSION?">":"❯",Ce=(t,e,n)=>{const r={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:p=>p,marker:p=>p,message:p=>p,...n?.color}},s=typeof e.start.column=="number";let o=(t.includes("\r")?_e(t):t).split(`
|
|
3
|
+
`);typeof r.tabWidth=="number"&&t.includes(" ")&&(o=o.map(p=>p.replaceAll(" "," ".repeat(r.tabWidth))));const{end:i,markerLines:c,start:l}=ze(e,o,r.linesAbove,r.linesBelow),a=String(i).length,{gutter:u,marker:d,message:h}=r.color;let f=o.slice(l,i).map((p,g)=>{const m=l+1+g,$=c[m],S=String(m).padStart(a),w=!c[m+1],y=` ${S}${r.showGutter?" |":""}`;if($){let v="";if(Array.isArray($)){const x=p.replaceAll(/[^\t]/g," ").slice(0,Math.max($[0]-1,0)),b=$[1]||1;v=[`
|
|
4
|
+
`,r.prefix+u(y.replaceAll(/\d/g," "))," ",x,d("^").repeat(b)].join(""),w&&r.message&&(v+=` ${h(r.message)}`)}return[r.prefix+d(Re),u(y),p.length>0?` ${p}`:"",v].join("")}return`${r.prefix} ${u(y)}${p.length>0?` ${p}`:""}`}).join(`
|
|
5
|
+
`);return r.message&&!s&&(f=`${r.prefix+" ".repeat(a+1)+r.message}
|
|
6
|
+
${f}`),f},Pe=()=>G.env?.DEBUG==="true",z=(t,...e)=>{if(Pe()){const n=e.map(r=>typeof r=="function"?r():r);console.debug(`error:parse-stacktrace: ${t}`,...n)}},R="<unknown>",Ve=/^(?:node:internal\/|node:|internal\/)/,De=t=>t!==void 0&&Ve.test(t),Ge=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,He=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,Ue=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,qe=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,Ye=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Je=/in\s(.*)\s\(at\s(.+)\)\sat/,Ke=/^(?:.*@)?(.*):(\d+):(\d+)$/,Ze=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Xe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Qe=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,At=/\(error: ([^)]*)\)/,tn=/at\s/,en=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,nn=/Error: |AggregateError:/,Jt=/^Anonymous function$/,rn=/^\s*in\s.*/,sn=/^.*?\s*at\s.*/,on=/^.*?\s*@.*|\[native code\]/,Kt=(t,e)=>{const n=t.includes("safari-extension"),r=t.includes("safari-web-extension");return n||r?[t.includes("@")?t.split("@")[0]:R,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Zt=(t,e)=>{const n=Ue.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},cn=t=>{const e=Je.exec(t);if(e){z(`parse nested node error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`);const r=e[2].split(":");return{column:r[2]?+r[2]:void 0,file:r[0],line:r[1]?+r[1]:void 0,methodName:e[1]??R,raw:t,type:void 0}}const n=Ye.exec(t);if(n){z(`parse node error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const r={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(tn,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??R,raw:t,type:t.startsWith("internal")?"internal":void 0};return Zt(r,`${n[2]}:${n[3]}:${n[4]}`),r}},ln=t=>{const e=Ge.exec(t);if(e){z(`parse chrome error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),r=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let s,o;if(r){const a=He.exec(t);if(a){const u=en.exec(a[1]);u?(e[2]=u[4]??u[1],e[3]=u[5]??u[2],e[4]=u[3]):a[2]&&(e[2]=a[1]),a[2]&&(s={column:a[4]?+a[4]:void 0,file:a[2],line:a[3]?+a[3]:void 0,methodName:"eval",raw:t,type:"eval"})}else{const u=qe.exec(t);u&&(o={column:u[4]?+u[4]:void 0,file:u[2],line:u[3]?+u[3]:void 0},s={column:u[6]?+u[6]:void 0,file:u[1],line:u[5]?+u[5]:void 0,methodName:"eval",raw:u[0],type:"eval"})}}const[i,c]=Kt(e[1]?e[1].replace(Jt,"<anonymous>"):R,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:s,file:c,line:e[3]?+e[3]:void 0,methodName:i,raw:t,type:r?"eval":n?"native":De(c)?"internal":void 0};return o?(l.column=o.column,l.file=o.file,l.line=o.line):Zt(l,`${c}:${e[3]}:${e[4]}`),l}},an=(t,e)=>{const n=Ze.exec(t);if(n){z(`parse gecko error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const r=n[3]?.includes(" > eval"),s=r&&n[3]&&Xe.exec(n[3]);let o;r&&s&&(n[3]=s[1],o={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:t,type:"eval"},n[4]=s[2]);const[i,c]=Kt(n[1]?n[1].replace(Jt,"<anonymous>"):R,n[3]);let l;(e?.type==="safari"||!r&&e?.type==="firefox")&&e.column?l=e.column:!r&&n[5]&&(l=+n[5]);let a;return(e?.type==="safari"||!r&&e?.type==="firefox")&&e.line?a=e.line:n[4]&&(a=+n[4]),{column:l,evalOrigin:o,file:c,line:a,methodName:i,raw:t,type:r?"eval":c.includes("[native code]")?"native":void 0}}},un=(t,e)=>{const n=Qe.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return z(`parse firefox error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:e?.column??void 0,file:n[2],line:n[3]?+n[3]:e?.line??void 0,methodName:n[1]||R,raw:t,type:void 0}},fn=t=>{const e=Ke.exec(t);if(e)return z(`parse react android native error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:R,raw:t,type:void 0}},Xt=(t,{filter:e,frameLimit:n=50}={})=>{const r=t;let s=(typeof r.stacktrace=="string"?r.stacktrace:t.stack??"").split(`
|
|
7
|
+
`).map(o=>(At.test(o)?o.replace(At,"$1"):o).trim()).filter(o=>!nn.test(o)&&o!=="eval code");return e&&(s=s.filter(o=>e(o))),s=s.slice(0,n),s.reduce((o,i,c)=>{if(!i||i.length>1024)return o;let l;if(rn.test(i))l=cn(i);else if(sn.test(i))l=ln(i);else if(on.test(i)){let a;if(c===0){const u=t,d=u.columnNumber,h=u.lineNumber,f=u.line,p=u.column;d||h?a={column:d,line:h,type:"firefox"}:(f||p)&&(a={column:p,line:f,type:"safari"})}l=un(i,a)??an(i,a)}else l=fn(i);return l?o.push(l):z(`parse error stack line: "${i}"`,"not parser found"),o},[])},xt=nt("node:fs"),X=nt("node:path"),dn=nt("node:process"),hn=nt("node:url"),M=(t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),Qt=t=>t.replaceAll("\\","/"),pn=t=>{if(!t.startsWith("file:"))return t;try{return hn().fileURLToPath(t)}catch{return t}},gn=(t,e)=>{const n=t.replace("async file:","file:");return Qt(X().relative(e,pn(n)))},mn=(t,e,n)=>{if(e)return n.title(t.message);const r=t.message?`: ${t.message}`:"";return n.title(t.name+r)},te=(t,{color:e,hideErrorTitle:n,indentation:r,prefix:s},o)=>`${M(s,r,o)}${mn(t,n,e)}
|
|
8
|
+
`,ee=(t,{color:e,indentation:n,prefix:r},s)=>{if(t.hint===void 0)return;const o=M(r,n,s);let i="";if(Array.isArray(t.hint))for(const c of t.hint)i+=`${o+c}
|
|
9
|
+
`;else i+=o+t.hint;return e.hint(i)},bt=(t,e)=>{if(!e||t.file===void 0||t.line===void 0)return{trace:t};try{const n=e({column:t.column,file:t.file,line:t.line});return n?{source:n.source,trace:{...t,column:n.column??t.column,file:n.file??t.file,line:n.line??t.line}}:{trace:t}}catch{return{trace:t}}},wt=(t,e,n=0)=>{const{color:r,cwd:s,displayShortPath:o,indentation:i,prefix:c}=e,{trace:l}=t;let a;l.file===void 0?a="<unknown>":a=o?gn(l.file,s):Qt(l.file);const{fileLine:u,method:d}=r;return`${M(c,i,n)}at ${l.methodName?`${d(l.methodName)} `:""}${u(a)}:${u(l.line?.toString()??"")}`},yn=(t,e)=>{if(e.allowAllFilePaths)return!0;const n=X().resolve(e.cwd),r=X().resolve(n,t);return r===n||r.startsWith(n+X().sep)},$n=t=>{try{return xt().existsSync(t)?xt().readFileSync(t,"utf8"):void 0}catch{return}},ne=(t,e,n)=>{const{color:r,indentation:s,linesAbove:o,linesBelow:i,prefix:c,showGutter:l,showLineNumbers:a,tabWidth:u}=e,{source:d,trace:h}=t;if(h.file===void 0)return;let f;if(d===void 0){const p=h.file.replace("file://","");if(!yn(p,e))return;const g=$n(p);if(g===void 0)return;f=g}else f=d;return Ce(f,{start:{column:h.column,line:h.line}},{color:r,linesAbove:o,linesBelow:i,prefix:M(c,s,n),showGutter:l,showLineNumbers:a,tabWidth:u})},re=(t,e,n)=>{if(t.errors.length===0)return;let r=`${M(e.prefix,e.indentation,n)}Errors:
|
|
10
|
+
|
|
11
|
+
`,s=!0;for(const o of t.errors)s?s=!1:r+=`
|
|
12
|
+
|
|
13
|
+
`,r+=oe(o,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
|
|
14
|
+
${r}`},bn=t=>{if(typeof t=="object"&&t!==null)try{return JSON.stringify(t)}catch{return Object.prototype.toString.call(t)}return String(t)},se=(t,e,n,r=new Set)=>{r.add(t);let s=`${M(e.prefix,e.indentation,n)}Caused by:
|
|
15
|
+
|
|
16
|
+
`;const{cause:o}=t;if(!(o instanceof Error)){const l=bn(o);return s+=`${M(e.prefix,e.indentation,n)}${e.color.title(l)}
|
|
17
|
+
`,`
|
|
18
|
+
${s}`}s+=te(o,e,n);const i=Xt(o).shift(),c=ee(o,e,n);if(c&&(s+=`${c}
|
|
19
|
+
`),i){const l=bt(i,e.sourceMap);if(s+=wt(l,e,n),!e.hideErrorCauseCodeView){const a=ne(l,e,n);a!==void 0&&(s+=`
|
|
20
|
+
${a}`)}}if(o instanceof AggregateError){const l=re(o,e,n);l!==void 0&&(s+=`
|
|
21
|
+
${l}`)}return o.cause&&(s+=r.has(o)?`
|
|
22
|
+
${M(e.prefix,e.indentation,n+1)}Caused by: [Circular]`:`
|
|
23
|
+
${se(o,e,n+1,r)}`),`
|
|
24
|
+
${s}`},wn=(t,e)=>(t.length>0?`
|
|
25
|
+
`:"")+t.map(n=>wt(bt(n,e.sourceMap),e)).join(`
|
|
26
|
+
`),oe=(t,e,n)=>{const r={allowAllFilePaths:!1,cwd:dn().cwd(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...e,color:{fileLine:c=>c,gutter:c=>c,hint:c=>c,marker:c=>c,message:c=>c,method:c=>c,title:c=>c,...e.color}},s=Xt(t,{filter:e.filterStacktrace,frameLimit:r.framesMaxLimit}),o=s.shift(),i=o?bt(o,r.sourceMap):void 0;return[e.hideMessage?void 0:te(t,r,n),ee(t,r,n),i?wt(i,r,n):void 0,i&&!r.hideErrorCodeView?ne(i,r,n):void 0,t instanceof AggregateError?re(t,r,n):void 0,t.cause===void 0||t.cause===null?void 0:se(t,r,n),s.length>0?wn(s,r):void 0].filter(Boolean).join(`
|
|
27
|
+
`)},it=(t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return oe(t,e,0)},B="[Inspection threw]",I=(t,e,n,r,s,o=", ",i=Number.POSITIVE_INFINITY)=>{const c=t.length;if(c===0)return"";const l=Number.isFinite(i)&&c>i,a=l?Math.max(0,Math.floor(i)):c;if(a===0)return`…(${String(c)})`;let u=r;s!==void 0&&(u=s);const d=n.truncate,h=Number.isFinite(d);let f="",p="",g="";for(let m=0;m<a;m+=1){const $=m+1===a,S=m+2===a;h&&(g=`…(${String(a-m)})`);let w=t[m];n.truncate=d-f.length-($?0:o.length);const y=p||u(w,e,n,r)+($?"":o),v=f.length+y.length,x=v+g.length;if($&&v>d&&f.length+g.length<=d||!$&&!S&&x>d)break;w=t[m+1];const b=S?"":o;if($?p="":p=u(w,e,n,r)+b,!$&&S&&x>d&&v+p.length>d)break;if(f+=y,!$&&!S&&v+p.length>=d){g=`…(${String(a-m-1)})`;break}g=""}return l&&g===""&&(g=`${o}… ${String(c-a)} more`),`${f}${g}`},Sn=([t,e],n,r)=>(r.truncate-=3,e?`${r.stylize(String(t),"yellow")}=${r.stylize(`"${e}"`,"string")}`:r.stylize(String(t),"yellow")),ie=t=>{try{return Object.create(t,{length:{value:t.length}})}catch{return}},vn=(t,e,n,r)=>{let s;try{s=t.nodeType}catch{return B}if(s===1)return ce(t,t,n,r);if(s===3){let o;try{o=t.data}catch{return B}return r(o,void 0,n)}return r(t,void 0,n)},gt=(t,e,n,r)=>{const s=ie(t);return s===void 0?B:I(s,t,e,n,vn,`
|
|
28
|
+
`)},ce=(t,e,n,r)=>{let s,o;try{s=t.getAttributeNames().map(f=>[f,t.getAttribute(f)]),o=t.tagName.toLowerCase()}catch{return B}const i=n.stylize(`<${o}`,"special"),c=n.stylize(">","special"),l=n.stylize(`</${o}>`,"special");n.truncate-=o.length*2+5;let a="";s.length>0&&(a+=" ",a+=I(s,e,n,r,Sn," ")),n.truncate-=a.length;const{truncate:u}=n;let d;try{d=ie(t.children)}catch{d=void 0}let h;return d===void 0?h=B:(h=gt(d,n,r),h&&h.length>u&&(h=`…(${String(d.length)})`)),`${i}${a}${c}${h}${l}`},An=(t,e,n)=>t.length===0?"Arguments []":(e.truncate-=13,`Arguments [ ${I(t,t,e,n,void 0,", ",e.maxArrayLength)} ]`),xn=(t,e)=>{let n;if(t===" ")n=" ";else if(typeof t=="number"&&t>0)n=Array.from({length:t+1}).join(" ");else return;return{base:n,prev:`
|
|
29
|
+
${Array.from({length:e+1}).join(n)}`}},rt=(t,e)=>{if(t.length===0)return"";const n=e.prev+e.base;return n+t.split("\0\0").join(`,${n}`)+e.prev},En=/^[a-z_]\w*$/i,In=/^"|"$/g,Nn=(t,e)=>{if(En.test(t))return t;const n=JSON.stringify(t);return e.quoteStyle==="double"?n.replaceAll('"',String.raw`\"`):n.replaceAll("'",String.raw`\'`).replaceAll(String.raw`\"`,'"').replaceAll(In,"'")},H=([t,e],n,r,s)=>{r.truncate-=2;let o;typeof t=="string"?o=Nn(t,r):typeof t=="number"?o=String(t):o=`[${s(t,n,r)}]`,r.truncate-=o.length;const i=s(e,n,r);return`${o}: ${i}`},On=Symbol.for("chai/inspect"),ct=t=>({[On]:()=>t}),U=(t,e)=>{let n;try{n=Object.getOwnPropertyDescriptor(t,e)}catch{n=void 0}if(n===void 0||"value"in n)try{return t[e]}catch{return ct(B)}if(n.get===void 0)return ct("[Setter]");try{return t[e]}catch{return ct(B)}},kn=t=>{for(const e of t)if(Array.isArray(e)||typeof e=="object"&&e!==null)return!0;return!1},Tn=t=>{const e=[];for(const n of Object.keys(t)){const r=Number(n);Number.isInteger(r)&&r>=0&&String(r)===n&&r<4294967295||e.push(n)}return e},Bn=(t,e,n,r)=>{const s=Tn(t);if(t.length===0&&s.length===0)return"[]";e.truncate-=4;const o=!!r&&kn(t);let i=I(t,t,e,n,void 0,o?"\0\0":", ",e.maxArrayLength);e.truncate-=i.length;let c="";return s.length>0&&(c=I(s.map(l=>[l,U(t,l)]),t,e,n,H)),o&&r&&(i=rt(i,r)),`[${o?"":" "}${i}${c?`, ${c}`:""}${o?"":" "}]`},jn=50,Et=(t,e)=>{const n=new Uint8Array(t),r=Math.min(n.length,jn);let s="",o=!1;for(let a=0;a<r;a+=1){const u=n[a];u!==0&&(o=!0),s+=(a===0?"":" ")+u.toString(16).padStart(2,"0")}n.length>r&&(s+=` ... ${String(n.length-r)} more byte${n.length-r===1?"":"s"}`);const i=t instanceof ArrayBuffer?"ArrayBuffer":"SharedArrayBuffer",c=o||n.length>r,l=s!==""&&c?`[Uint8Contents]: <${s}>, `:"";return`${e.stylize(i,"special")} { ${l}byteLength: ${e.stylize(String(t.byteLength),"number")} }`},It=/\d(?=(?:\d{3})+(?!\d))/g,Mn=/\d{3}/g,Wn=/_$/,le=(t,e)=>{if(e.length<4||e.length===4&&e.codePointAt(0)===45||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY||e.includes("e"))return e;if(typeof t=="number"){const n=t<0?-Math.floor(-t):Math.floor(t);if(n!==t){const r=String(n),s=e.slice(r.length+1);return`${r.replace(It,"$&_")}.${s.replace(Mn,"$&_").replace(Wn,"")}`}}return e.replace(It,"$&_")},Fn=t=>t>="\uD800"&&t<="\uDBFF",W=(t,e,n="…")=>{t=String(t);const r=n.length,s=t.length;if(r>e&&s>r)return n;if(s>e&&s>r){let o=e-r;return o>0&&Fn(t[o-1])&&(o-=1),`${t.slice(0,o)}${n}`}return t},Nt=(t,e)=>{let n=W(t.toString(),e.truncate-1);return n!=="…"&&(n+="n"),e.stylize(e.numericSeparator?le(t,n):n,"bigint")},ae=t=>{try{return Array.isArray(t)}catch{return!1}},L=(t,e)=>{try{return t[e]}catch{return}},Ln=(t,e)=>{try{return t instanceof e}catch{return!1}},Ot=(t,e)=>{try{return Object.getOwnPropertyDescriptor(t,e)?.enumerable??!1}catch{return!0}},_n=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:void 0),Q=(t,e,n,r)=>{if("window"in globalThis&&t===globalThis)return"{ [object Window] }";if(t===globalThis)return"{ [object globalThis] }";let s,o;try{s=Object.getOwnPropertyNames(t),o=Object.getOwnPropertySymbols(t)}catch{return B}let i,c;try{i=e.showHidden?s:s.filter(f=>Object.getOwnPropertyDescriptor(t,f)?.enumerable)}catch{i=s.filter(f=>Ot(t,f))}try{c=o.filter(f=>e.showHidden||Object.getOwnPropertyDescriptor(t,f)?.enumerable)}catch{c=o.filter(f=>Ot(t,f))}let l;try{const f=_n(t)===Object.prototype||t.constructor===Object,p=t instanceof Object?"":"null prototype";let g;!f&&Symbol.toStringTag in t?g=t[Symbol.toStringTag]:g=p?"Object":"",l=g||p?`[${[g,p].filter(Boolean).join(": ")}] `:""}catch{l=""}if(i.length===0&&c.length===0)return`${l}{}`;e.truncate-=4;const a=r?"\0\0":", ",u=I(i.map(f=>[f,U(t,f)]),t,e,n,H,a),d=I(c.map(f=>[f,U(t,f)]),t,e,n,H,a);let h="";return u&&d&&(h=a),r?`${l}{${rt(u+h+d,r)}}`:`${l}{ ${u}${h}${d} }`},zn=(t,e,n,r)=>{let s;try{s=typeof t.constructor=="function"?t.constructor.name:""}catch{s=""}return(!s||s==="_class")&&(s="<Anonymous Class>"),e.truncate-=s.length,`${s} ${Q(t,e,n,r)}`},Rn=(t,e)=>{const n=e.stylize(String(t.byteLength),"number"),r=e.stylize(String(t.byteOffset),"number"),s=e.stylize(String(t.buffer.byteLength),"number");return`${e.stylize("DataView","special")} { byteLength: ${n}, byteOffset: ${r}, buffer: ArrayBuffer { byteLength: ${s} } }`},Cn=(t,e)=>{const n=t.toJSON();if(n===null)return"Invalid Date";const r=n.split("T"),s=r[0];return e.stylize(`${s}T${W(r[1],e.truncate-s.length-1)}`,"date")},Pn=new Set(["column","columnNumber","description","fileName","line","lineNumber","message","name","number","stack"]),Vn=(t,e,n)=>{const r=Object.getOwnPropertyNames(t).filter(c=>!Pn.has(c)),{name:s}=t;e.truncate-=s.length;let o="";typeof t.message=="string"?o=W(t.message,e.truncate):r.unshift("message"),o=o?`: ${o}`:"",e.truncate-=o.length+5;const i=I(r.map(c=>[c,U(t,c)]),t,e,n,H);return`${s}${o}${i?` { ${i} }`:""}`},kt=(t,e)=>{let n,r,s;try{n=t[Symbol.toStringTag]||"Function",r=t.toString(),{name:s}=t}catch{return e.stylize(B,"special")}return r.length<e.truncate-12?e.stylize(`[${n}: ${r}]`,"special"):s?e.stylize(`[${n} ${W(s,e.truncate-11)}]`,"special"):e.stylize(`[${n}]`,"special")},Tt=(t,e)=>{const n=L(t,Symbol.toStringTag),r=typeof n=="string"?n:"Generator";return`${e.stylize(`Object [${r}]`,"special")} {}`},Dn=([t,e],n,r,s)=>(r.truncate-=4,t=s(t,n,r),r.truncate-=t.length,`${t} => ${s(e,n,r)}`),Gn=(t,e,n,r)=>{if(t.size<=0)return"Map (0) {}";e.truncate-=7;let s=I([...t.entries()],t,e,n,Dn,r?"\0\0":", ",e.maxArrayLength);return r&&(s=rt(s,r)),`Map (${String(t.size)}) {${r?"":" "}${s}${r?"":" "}}`};function Bt(t,e){return Number.isNaN(t)?e.stylize("NaN","number"):t===Number.POSITIVE_INFINITY?e.stylize("Infinity","number"):t===Number.NEGATIVE_INFINITY?e.stylize("-Infinity","number"):t===0?e.stylize(1/t===Number.POSITIVE_INFINITY?"+0":"-0","number"):e.stylize(W(e.numericSeparator?le(t,t.toString()):t.toString(),e.truncate),"number")}const Hn=()=>"Promise{…}",Un=(t,e)=>{const n=e.truncate-(2+t.flags.length);return e.stylize(`/${W(t.source,n)}/${t.flags}`,"regexp")},qn=(t,e,n,r)=>{if(t.size===0)return"Set (0) {}";e.truncate-=7;let s=I([...t],t,e,n,void 0,r?"\0\0":", ",e.maxArrayLength);return r&&(s=rt(s,r)),`Set (${String(t.size)}) {${r?"":" "}${s}${r?"":" "}}`},Yn=(t,e)=>{const n=e.quoteStyle==="double"?'"':"'";return n+t+n},jt=new RegExp(String.raw`['\0-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5`+String.raw`\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]`,"g"),Jn={" ":String.raw`\t`,"\n":String.raw`\n`,"\f":String.raw`\f`,"\r":String.raw`\r`,"\b":String.raw`\b`,"'":String.raw`\'`,"\\":"\\\\"},Kn=16,Zn=t=>Jn[t]||String.raw`\u${`0000${t.codePointAt(0).toString(Kn)}`.slice(-4)}`,Mt=(t,e)=>(jt.test(t)&&(t=t.replaceAll(jt,Zn)),e.stylize(Yn(W(t,e.truncate-2),e),"string")),Wt=t=>"description"in Symbol.prototype?t.description?`Symbol(${t.description})`:"Symbol()":t.toString(),Xn=t=>typeof Buffer=="function"&&t instanceof Buffer?"Buffer":t[Symbol.toStringTag],O=(t,e,n)=>{const r=Xn(t);e.truncate-=r.length+4;const s=Object.keys(t).slice(t.length);if(t.length===0&&s.length===0)return`${r}[]`;let o="";const i=Number.isFinite(e.maxArrayLength)?Math.min(t.length,Math.max(0,Math.floor(e.maxArrayLength))):t.length;for(let l=0;l<i;l++){const a=`${e.stylize(W(t[l],e.truncate),"number")}${l===i-1?"":", "}`;if(e.truncate-=a.length,l!==i-1&&e.truncate<=3){o+=`…(${String(t.length-l)})`;break}o+=a}i<t.length&&(o+=`${o?", ":""}… ${String(t.length-i)} more`);let c="";return s.length>0&&(c=I(s.map(l=>[l,U(t,l)]),t,e,n,H)),`${r}[ ${o}${c?`, ${c}`:""} ]`},Ft=t=>typeof L(t,Symbol.toStringTag)!="string",Qn=t=>typeof t=="function",ue=(t,e,n)=>{if(t==null)return;const r=Object.getOwnPropertyDescriptor(t,e);if(r===void 0)return;const s=n==="get"?r.get:r.value;return typeof s=="function"?s:void 0},fe=(t,e)=>{if(t!==void 0)return n=>{try{return t.call(n,e),!0}catch{return!1}}},F=(t,e)=>fe(ue(t,e,"get")),j=(t,e,n)=>fe(ue(t,e,"value"),n),Lt=Object.freeze({}),k=F(Reflect.getPrototypeOf(Int8Array.prototype),"length"),tr=typeof SharedArrayBuffer=="function"?SharedArrayBuffer.prototype:void 0,er=Object.assign(Object.create(null),{Arguments:Ft,Array:ae,ArrayBuffer:F(ArrayBuffer.prototype,"byteLength"),BigInt:j(BigInt.prototype,"valueOf"),Boolean:j(Boolean.prototype,"valueOf"),DataView:F(DataView.prototype,"byteLength"),Date:j(Date.prototype,"valueOf"),Error:Ft,Float32Array:k,Float64Array:k,Function:Qn,Int8Array:k,Int16Array:k,Int32Array:k,Map:F(Map.prototype,"size"),Number:j(Number.prototype,"valueOf"),RegExp:F(RegExp.prototype,"source"),Set:F(Set.prototype,"size"),SharedArrayBuffer:F(tr,"byteLength"),String:j(String.prototype,"valueOf"),Symbol:j(Symbol.prototype,"valueOf"),Uint8Array:k,Uint8ClampedArray:k,Uint16Array:k,Uint32Array:k,WeakMap:j(WeakMap.prototype,"has",Lt),WeakSet:j(WeakSet.prototype,"has",Lt)}),nr=(t,e)=>{const n=er[e];return n===void 0||n(t)},_t=new WeakMap,zt=Object.create(null),rr=Object.assign(Object.create(null),{Arguments:An,Array:Bn,ArrayBuffer:Et,AsyncGenerator:Tt,BigInt:Nt,bigint:Nt,Boolean:(t,e)=>e.stylize(String(t),"boolean"),boolean:(t,e)=>e.stylize(String(t),"boolean"),DataView:Rn,Date:Cn,Error:Vn,Float32Array:O,Float64Array:O,Function:kt,function:kt,Generator:Tt,HTMLCollection:gt,Int8Array:O,Int16Array:O,Int32Array:O,Map:Gn,NodeList:gt,null:(t,e)=>e.stylize("null","null"),Number:Bt,number:Bt,Promise:Hn,RegExp:Un,Set:qn,SharedArrayBuffer:Et,String:Mt,string:Mt,Symbol:Wt,symbol:Wt,Uint8Array:O,Uint8ClampedArray:O,Uint16Array:O,Uint32Array:O,undefined:(t,e)=>e.stylize("undefined","undefined"),WeakMap:(t,e)=>e.stylize("WeakMap{…}","special"),WeakSet:(t,e)=>e.stylize("WeakSet{…}","special")}),sr=Symbol.for("nodejs.util.inspect.custom"),or=Symbol.for("chai/inspect"),ir=(t,e,n,r)=>{const s=L(t,or);if(typeof s=="function")return s.call(t,e);if(!("window"in globalThis)){const l=L(t,sr);if(typeof l=="function")return l.call(t,r,e)}const o=L(t,"inspect");if(typeof o=="function")return o.call(t,r,e);const i=L(t,"constructor");if(typeof i=="function"&&_t.has(i))return _t.get(i)?.(t,e)??"unknown";const c=Object.hasOwn(zt,n)?zt[n]:void 0;return c?c(t,e):""},lt=(t,e,n)=>{const{depth:r,inspect:s,seen:o}=n;if(o.includes(t))return"[Circular]";if(r>=e.depth&&e.depth>0&&typeof t=="object"&&t!==null)return ae(t)?"[Array]":"[Object]";const i=e.indent?xn(e.indent,r):void 0;let c=t===null?"null":typeof t;if(c==="object")try{c=Object.prototype.toString.call(t).slice(8,-1)}catch{c="Object"}let l=rr[c];if(l!==void 0&&typeof t=="object"&&t!==null&&!nr(t,c)&&(l=void 0),l!==void 0)return l(t,e,s,i);if(e.customInspect&&t){const d=ir(t,e,c,e.depth-r);if(d)return typeof d=="string"?d:s(d,t,e)}let a=!1;if(t)try{a=Object.getPrototypeOf(t)}catch{a=Object.prototype}if(a===Object.prototype||a===null)return Q(t,e,s,i);if(t&&typeof HTMLElement=="function"&&Ln(t,HTMLElement))return ce(t,t,e,s);const u=L(t,"constructor");return u!==void 0?u!==Object?zn(t,e,s,i):Q(t,e,s,i):t===Object(t)?Q(t,e,s,i):e.stylize(String(t),c)},Rt=(t,e={})=>{const n={customInspect:!0,depth:5,indent:void 0,maxArrayLength:Number.POSITIVE_INFINITY,numericSeparator:!0,quoteStyle:"single",showHidden:!1,stylize:s=>s,truncate:Number.POSITIVE_INFINITY,...e};if(n.indent!==void 0&&n.indent!==" "&&!(Number.parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `undefined`');const r={depth:0,inspect:void 0,seen:[]};return r.inspect=(s,o,i)=>{if(o==null){r.depth+=1;const l=lt(s,i,r);return r.depth-=1,l}r.seen.push(o),r.depth+=1;const c=lt(s,i,r);return r.depth-=1,r.seen.pop(),c},lt(t,n,r)},cr=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],lr=12288,ar=65510,ur=[12288,12288,65281,65376,65504,65510],fr=8361,dr=65518,hr=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],pr=32,gr=10630,mr=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],yr=4352,$r=262141,de=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],Y=(t,e)=>{let n=0,r=Math.floor(t.length/2)-1;for(;n<=r;){const s=Math.floor((n+r)/2),o=s*2;if(e<t[o])r=s-1;else if(e>t[o+1])n=s+1;else return!0}return!1},Ct=19968,[br,wr]=Sr(de);function Sr(t){let e=t[0],n=t[1];for(let r=0;r<t.length;r+=2){const s=t[r],o=t[r+1];if(Ct>=s&&Ct<=o)return[s,o];o-s>n-e&&(e=s,n=o)}return[e,n]}const vr=t=>t<161||t>1114109?!1:Y(cr,t),Ar=t=>t<lr||t>ar?!1:Y(ur,t),xr=t=>t<fr||t>dr?!1:Y(hr,t),Er=t=>t<pr||t>gr?!1:Y(mr,t),Ir=t=>t>=br&&t<=wr?!0:t<yr||t>$r?!1:Y(de,t);function Nr(t){return vr(t)?"ambiguous":Ar(t)?"fullwidth":xr(t)?"halfwidth":Er(t)?"narrow":Ir(t)?"wide":"neutral"}function Or(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function he(t){return Or(t),Nr(t)}const pe=String.raw,Pt=pe`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,kr=()=>new RegExp(pe`\p{RI}{2}|(?)${Pt}(?:\u200D${Pt})*`,"gu"),P=new Set(["\x1B",""]),st="\x07",ge="[",St="m",q="]8;;",Tr=39,Br=/[\u200B\uFEFF\u2060-\u2064]/g,jr=new RegExp(`(?:\\${ge}(?<code>\\d+)m|\\${q}(?<uri>.*)${st})`),Mr=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),me=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,J=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,Wr=kr(),Vt=new Map,Fr=t=>[t.ambiguousIsNarrow?1:0,t.control,t.fullWidth,t.regular,t.wide].join("|"),Lr=t=>{const e=Fr(t.width);let n=Vt.get(e);return n||(n=new Map,Vt.set(e,n)),n},K=new RegExp(me.source,"y"),at=new RegExp(Wr.source,"uy"),Z=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,ye=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",_r=(t,e)=>{const n=Lr(e),r=Math.floor(t/65536),s=t%65536;let o=n.get(r);if(o||(o=new Map,n.set(r,o)),o.has(s))return o.get(s);let i;switch(ye(t)){case"control":{i=e.width.control;break}case"latin":{i=e.width.regular;break}case"wide":{i=e.width.wide;break}case"zero":{i=0;break}default:switch(he(t)){case"ambiguous":{i=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{i=e.width.fullWidth;break}case"wide":{i=e.width.wide;break}default:i=e.width.regular}}return o.set(s,i),i},zr=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,mt=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const n={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?mt(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},r=Math.max(0,n.truncation.limit-n.truncation.ellipsisWidth),{length:s}=t,o=s>1e4;let i=0,c=0,l=s,a=!1;const u=t.includes("\x1B")||t.includes("");for(;i<s;){if(u&&(t[i]==="\x1B"||t[i]==="")){if(t.startsWith("\x1B]8;;",i)){const m="\x1B]8;;\x07",$=m.length,S=t.indexOf("\x07",i+5);if(S!==-1){const w=t.indexOf(m,S+1);if(w!==-1){const y=w+$,v=t.slice(S+1,w).replace(me,""),x=mt(v,{ambiguousIsNarrow:n.width.ambiguousIsNarrow,ansiWidth:n.width.ansi,controlWidth:n.width.control,countAnsiEscapeCodes:!1,ellipsis:n.truncation.ellipsis,ellipsisWidth:n.truncation.ellipsisWidth,emojiWidth:n.width.emoji,fullWidth:n.width.fullWidth,halfWidth:n.width.halfWidth,limit:Math.max(0,r-c),regularWidth:n.width.regular,tabWidth:n.width.tab,wideWidth:n.width.wide}),b=x.width;if(x.truncated)a=!0,l=Math.min(l,i);else if(c+b>r&&(l=Math.min(l,i),a=!0,c+b>n.truncation.limit))break;if(c+=b,i=y,a&&c>=n.truncation.limit)break;continue}}}if(K.lastIndex=i,K.test(t)){const m=K.lastIndex-i,$=n.truncation.countAnsiEscapeCodes?m:n.width.ansi;if(c+$>r&&(l=Math.min(l,i),c+$>n.truncation.limit)){a=!0;break}c+=$,i=K.lastIndex;continue}}const f=t.codePointAt(i);if(f===8203||f===65279||f>=8288&&f<=8292){i+=1;continue}if(f===9){if(c+n.width.tab>r&&(l=Math.min(l,i),c+n.width.tab>n.truncation.limit)){a=!0;break}c+=n.width.tab,i+=1;continue}if(Z.lastIndex=i,Z.test(t)){const m=(Z.lastIndex-i)*n.width.regular;if(c+m>r){const $=n.width.regular>0?Math.floor((r-c)/n.width.regular):0;if(l=Math.min(l,i+$),c+m>n.truncation.limit){a=!0;break}}c+=m,i=Z.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(J.lastIndex=i,J.test(t))){const m=(J.lastIndex-i)*n.width.control;if(c+m>r){const $=n.width.control>0?Math.floor((r-c)/n.width.control):0;if(l=Math.min(l,i+$),c+m>n.truncation.limit){a=!0;break}}c+=m,i=J.lastIndex;continue}if(at.lastIndex=i,at.test(t)){if(c+n.width.emoji>r&&(l=Math.min(l,i),c+n.width.emoji>n.truncation.limit)){a=!0;break}c+=n.width.emoji,i=at.lastIndex;continue}const p=t.codePointAt(i)??0;if(zr(p)){i+=p>65535?2:1;continue}let g;if(o)g=_r(p,n);else switch(ye(p)){case"control":{g=n.width.control;break}case"latin":{g=n.width.regular;break}case"wide":{g=n.width.wide;break}case"zero":{g=0;break}default:switch(he(p)){case"ambiguous":{g=n.width.ambiguousIsNarrow?n.width.regular:n.width.wide;break}case"fullwidth":{g=n.width.fullWidth;break}case"wide":{g=n.width.wide;break}default:g=n.width.regular}}if(c+g>r&&(l=Math.min(l,i),c+g>n.truncation.limit)){a=!0;break}c+=g,i+=p>65535?2:1}let d=c,h=!1;return a&&n.truncation.limit>=n.truncation.ellipsisWidth&&(d=n.truncation.limit,h=!0),{ellipsed:h,index:a?l:s,truncated:a,width:d}},A=(t,e={})=>mt(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Rr=/\x1B\[(\d+)m/;class $e{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const n=Rr.exec(e);if(!n)return;const r=Number.parseInt(n[1],10);switch(r){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(r>=30&&r<=37||r>=90&&r<=97)this.activeForeground=e;else if(r>=40&&r<=47||r>=100&&r<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(r))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(r)){const s={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];s&&(this.activeFormatting=this.activeFormatting.filter(o=>!o.includes(s)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const n={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(r=>{const s=n[r];s&&e.push(s)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}}const Cr=(t,e)=>{if(!P.has(t[e]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const n=!0,r=t.slice(e+1,e+1+q.length).join("")===q;return{isInsideEscape:n,isInsideLinkEscape:r}},Pr=(t,e={})=>{const n=new $e;let r="",s=!1,o="",i="",c=!1;const l=[...t];for(let a=0;a<l.length;a++){const u=l[a];if(u&&P.has(u)){if(r){const g=e.getWidth?.(r)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:r,width:g};if(c&&(m.isHyperlink=!0,m.hyperlinkUrl=i),e.onSegment?.(m,n)===!1)return;r=""}s=!0,o=u;const f=Cr(l,a),{isInsideLinkEscape:p}=f;if(p){let g=a+1;for(i="";g<l.length;){const $=l[g];if($===st)break;i+=$,g+=1}i=i.slice(4);const m={hyperlinkUrl:i,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(e.onSegment?.(m,n)===!1)return;a=g,c=!0,s=!1,o="";continue}if(a+1<l.length&&l[a+1]==="\\"&&c){const g={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(e.onSegment?.(g,n)===!1)return;c=!1,i="",a+=1,s=!1,o="";continue}}if(s){if(o!==u&&(o+=u),u===St){s=!1,n.processEscape(o);const f={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};if(e.onSegment?.(f,n)===!1)return;o=""}continue}r+=u;const d=e.getWidth?.(r)??0,h={isEscapeSequence:!1,isGrapheme:!0,text:r,width:d};if(c&&(h.isHyperlink=!0,h.hyperlinkUrl=i),e.onSegment?.(h,n)===!1)return;r=""}if(r){const a=e.getWidth?.(r)??0,u={isEscapeSequence:!1,isGrapheme:!0,text:r,width:a};c&&(u.isHyperlink=!0,u.hyperlinkUrl=i),e.onSegment?.(u,n)}if(o){const a={isEscapeSequence:!0,isGrapheme:!1,text:o,width:0};e.onSegment?.(a,n)}},Dt=t=>`${P.values().next().value}${ge}${String(t)}${St}`,Gt=t=>`${P.values().next().value}${q}${t}${st}`,Vr=t=>{if(t.length===0)return"";if(t.length===1)return t[0];let e="",n,r;const s=t.join(`
|
|
30
|
+
`),o=[...s];let i=0;for(const[c,l]of o.entries()){if(e+=l,P.has(l)){const u=jr.exec(s.slice(i))?.groups??{};if(u.code!==void 0){const d=Number.parseFloat(u.code);n=d===Tr?void 0:d}else u.uri!==void 0&&(r=u.uri.length===0?void 0:u.uri)}const a=Mr.get(Number(n));o[c+1]===`
|
|
31
|
+
`?(r&&(e+=Gt("")),n&&a&&(e+=Dt(a))):l===`
|
|
32
|
+
`&&(n&&a&&(e+=Dt(n)),r&&(e+=Gt(r))),i+=l.length}return e},be=/(?=\s)|(?<=\s)/,we=/^\s+$/,Ht=new Map,Dr=t=>{const e=Ht.get(t);if(e!==void 0)return e;const n=A(t);return Ht.set(t,n),n},ut=t=>{if(!t.includes("\x1B"))return t;let e=t;return t.includes("\x1B[30m")&&(e+="\x1B[39m"),t.includes("\x1B[42m")&&(e+="\x1B[49m"),e},_=t=>{const e=t.split(" ");let n=e.length;for(;n>0&&A(e[n-1])===0;)n--;return n===e.length?t:e.slice(0,n).join(" ")+e.slice(n).join("")},Se=(t,e,n)=>{if(t.length===0)return[""];if(e<=0)return[t];const r=[],s=new $e;let o="",i=0,c=!1,l=!1,a="",u=0;for(;u<t.length;){const d=t.codePointAt(u),h=String.fromCodePoint(d),f=h.length;if(P.has(h)){c=!0,a=h,o+=h,l=t.startsWith(q,u+1),u+=1;continue}if(c){a+=h,o+=h,l?h===st&&(c=l=!1):h===St&&(c=!1,s.processEscape(a)),u+=1;continue}const p=Dr(h),g=h===" ";if(p===0){o+=h,u+=f;continue}if(i+p>e&&(o&&r.push(o+s.getEndEscapesForAllActiveAttributes()),o=s.getStartEscapesForAllActiveAttributes(),i=A(o),g&&n)){for(;u<t.length&&t[u]===" ";)u+=1;continue}if(o+=h,i+=p,i===e&&u+f<t.length&&(r.push(o+s.getEndEscapesForAllActiveAttributes()),o=s.getStartEscapesForAllActiveAttributes(),i=A(o),u+f<t.length&&t[u+f]===" "&&n)){for(u+=f;u<t.length&&t[u]===" ";)u+=1;continue}u+=f}return o&&r.push(o+s.getEndEscapesForAllActiveAttributes()),n?r.map(d=>_(d)):r},Gr=(t,e,n)=>{if(t.length===0)return[];const r=n?t.trim():t;if(r.length===0)return[];const s=[];let o="",i=0;return Pr(r,{getWidth:A,onSegment:(c,l)=>{const a=c.text??"";if(c.isEscapeSequence)o+=a;else{const u=a===" ";if(c.width===0)return o+=a,!0;if(i+c.width>e&&(o&&s.push(o),o=l.getStartEscapesForAllActiveAttributes(),i=0,u))return n||s.push(l.getStartEscapesForAllActiveAttributes()+a),!0;o+=a,i+=c.width}return!0}}),o&&s.push(o),n?s.map(c=>_(c)):s},Hr=(t,e,n)=>{if(t.length===0)return[];const r=n?t.trim():t;if(r.length===0)return[];const s=r.split(be),o=[];let i="",c=0,l=0;for(;l<s.length;){const a=s[l],u=we.test(a),d=A(a);if(a.length===0){l+=1;continue}if(n&&u&&c===0){l+=1;continue}if(c+d>e&&c>0){n?o.push(_(i)):o.push(i),i="",c=0;continue}i+=a,c+=d,l+=1}return i&&(n?o.push(_(i)):o.push(i)),o},Ur=(t,e,n)=>{if(t.length===0)return[];const r=n?t.trim():t;if(r.length===0)return[];const s=r.split(be),o=[];let i="",c=0,l=0;for(;l<s.length;){const a=s[l],u=we.test(a),d=A(a);if(a.length===0){l+=1;continue}if(n&&u&&c===0){l+=1;continue}if(d>e){i&&o.push(ut(n?_(i):i));const h=Se(a,e,n);if(h.length>0){for(let f=0;f<h.length-1;f+=1)o.push(h[f]);i=h.at(-1),c=A(i)}else i="",c=0;l+=1;continue}if(c+d>e&&c>0&&(o.push(ut(n?_(i):i)),i="",c=0,n&&u)){l+=1;continue}i+=a,c+=d,l+=1}return i&&o.push(ut(n?_(i):i)),o},D={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},qr=(t,e={})=>{const{removeZeroWidthCharacters:n=!0,trim:r=!0,width:s=80,wrapMode:o=D.PRESERVE_WORDS}=e;if(r&&t.trim()==="")return"";let i=t.normalize("NFC").replaceAll(`\r
|
|
33
|
+
`,`
|
|
34
|
+
`);return n&&(i=i.replaceAll(Br,"")),i.split(`
|
|
35
|
+
`).map(c=>{if(r&&c.trim()==="")return"";let l;switch(o){case D.BREAK_AT_CHARACTERS:{l=Gr(c,s,r);break}case D.BREAK_WORDS:{l=Ur(c,s,r);break}case D.STRICT_WIDTH:{l=Se(c,s,r);break}default:l=Hr(c,s,r)}return Vr(l)}).join(`
|
|
36
|
+
`)},ve=80,Ae=24,yt=(t,e,{shell:n,env:r}={})=>Te(t,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:n,env:r}).trim(),tt=(t,e)=>({columns:Number.parseInt(t,10),rows:Number.parseInt(e,10)}),xe=(t,e)=>{const{columns:n,rows:r}=tt(t,e);if(!(Number.isNaN(n)||Number.isNaN(r))&&!(n===ve&&r===Ae))return{columns:n,rows:r}},Yr=()=>{if(T.platform!=="linux")return!0;try{const t=V.readFileSync("/proc/self/stat","utf8"),e=t.lastIndexOf(") ");if(e===-1)return!1;const n=t.slice(e+2).trim().split(/\s+/),r=Number.parseInt(n[2],10),s=Number.parseInt(n[5],10);return Number.isNaN(r)||Number.isNaN(s)||s<=0?!1:r===s}catch{return!1}};function Jr(){const{env:t,stdout:e,stderr:n}=T;if(e?.columns&&e?.rows)return tt(e.columns,e.rows);if(n?.columns&&n?.rows)return tt(n.columns,n.rows);if(t.COLUMNS&&t.LINES)return tt(t.COLUMNS,t.LINES);const r={columns:ve,rows:Ae};return T.platform==="win32"?ft()??r:T.platform==="darwin"?Ut()??ft()??r:Ut()??ft()??Kr()??r}const Ut=()=>{try{const t=T.platform==="darwin"?V.constants.O_EVTONLY|V.constants.O_NONBLOCK:V.constants.O_NONBLOCK,{columns:e,rows:n}=Be.WriteStream(V.openSync("/dev/tty",t));return{columns:e,rows:n}}catch{}},ft=()=>{try{const t=yt("tput",["cols"],{env:{TERM:"dumb",...T.env}}),e=yt("tput",["lines"],{env:{TERM:"dumb",...T.env}});if(t&&e)return xe(t,e)}catch{}},Kr=()=>{try{if(!Yr())return;const t=yt("resize",["-u"]).match(/\d+/g);if(t.length===2)return xe(t[0],t[1])}catch{}},Zr=t=>{const e=Object.keys(t).map(n=>t[n].badge??"");return e.length===0?"":e.reduce((n,r)=>n.length>r.length?n:r,"")},Xr=t=>{const e=Object.keys(t).map(n=>t[n].label??"");return e.length===0?"":e.reduce((n,r)=>n.length>r.length?n:r,"")},{bold:Qr,cyan:ts,green:qt,grey:es,magenta:ns,red:rs,yellow:dt}=et,ss={indent:2,quoteStyle:"single",stylize:(t,e)=>{const n={bigint:dt,boolean:dt,date:ns,null:Qr,number:dt,regexp:rs,special:ts,string:qt,symbol:qt,undefined:es};return Object.hasOwn(n,e)?n[e](t):t}},{bold:os,underline:is}=et,cs=(t,e)=>{let n=e.uppercase.label?t.toUpperCase():t;return n=e.underline.label?is(n):n,e.bold.label&&(n=os(n)),n},ls=t=>[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,"0")).join(":");class as{styles;loggerTypes;constructor(e){this.styles={bold:{label:!1},dateFormatter:ls,underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...e},this.loggerTypes=je}setLoggerTypes(e){this.loggerTypes=e}}const{bgGrey:us,cyan:fs,green:ds,greenBright:hs,grey:E,red:ht,underline:Yt,white:ps}=et,gs=/[\\/]pail[\\/]dist/,pt=t=>!gs.test(t);class ws extends as{#t;#r;#s;#c=!1;#o;#n;#e;#i=!1;#l="";#a="";constructor(e={}){const{error:n,inspect:r,...s}=e;super({uppercase:{label:!0,...s.uppercase},...s}),this.#o={...ss,...r},this.#n={...n,color:{fileLine:ds,hint:fs,marker:ht,message:ht,method:hs,title:ht}},this.#t=Oe,this.#r=ke,this.#u()}setLoggerTypes(e){super.setLoggerTypes(e),this.#u()}setStdout(e){this.#t=e,this.#e=void 0,this.#i=!1}setStderr(e){this.#r=e}setInteractiveManager(e){this.#s=e}setIsInteractive(e){this.#c=e}log(e){this._log(this._formatMessage(e),e.type.level)}#u(){this.#l=Zr(this.loggerTypes),this.#a=Xr(this.loggerTypes)}#f(){return!this.#i&&typeof this.#t.on=="function"&&(this.#i=!0,this.#t.on("resize",()=>{this.#e=void 0})),this.#e===void 0&&(this.#e=Jr().columns),this.#e}_formatMessage(e){let n=this.#f();typeof this.styles.messageLength=="number"&&(n=this.styles.messageLength);const{badge:r,context:s,date:o,error:i,file:c,groups:l,label:a,message:u,prefix:d,repeated:h,scope:f,suffix:p,traceError:g,type:m}=e,{color:$}=this.loggerTypes[m.name],S=$?et[$]:ps,w=l.map(()=>" ").join(""),y=[];if(l.length>0&&y.push(`${w+E(`[${l.at(-1)??""}]`)} `),o&&y.push(`${E(this.styles.dateFormatter(typeof o=="string"?new Date(o):o))} `),r)y.push(S(r));else{const b=this.#l;b.length>0&&y.push(`${E(".".repeat(b.length))} `)}const v=this.#a;if(a){const b=A(v),N=A(a);y.push(`${S(cs(a,this.styles))} `,E(".".repeat(Math.max(0,b-N))))}else y.push(E(".".repeat(v.length+2)));h&&y.push(`${us.white(`[${String(h)}x]`)} `),Array.isArray(f)&&f.length>0&&y.push(` ${E(`[${f.join(" > ")}]`)} `),d&&y.push(`${E(`${Array.isArray(f)&&f.length>0?". ":" "}[${this.styles.underline.prefix?Yt(d):d}]`)} `);const x=A(y.join(" "));if(c){const b=(c.name??"")+(c.line?`:${String(c.line)}`:""),N=A(b);if(N+x+2>n)y.push(E(` ${b}`));else{const ot=Math.max(0,n-x-N-2);y.push(E(`${".".repeat(ot)} ${b}`))}}else y.push(E(".".repeat(Math.max(0,n-x-1))));if(y.length>0&&y.push(`
|
|
37
|
+
|
|
38
|
+
`),u!==Me){const b=typeof u=="string"?u:Rt(u,this.#o);y.push(w+qr(b,{trim:!1,width:n-3,wrapMode:D.PRESERVE_WORDS}))}if(s){let b=!1;y.push(...s.map(N=>{if(N instanceof Error)return b=!0,`
|
|
39
|
+
|
|
40
|
+
${it(N,{...this.#n,filterStacktrace:pt,prefix:w})}`;if(typeof N=="object")return` ${Rt(N,this.#o)}`;const ot=(b?`
|
|
41
|
+
|
|
42
|
+
`:" ")+String(N);return b=!1,ot}))}return i&&y.push(it(i,{...this.#n,filterStacktrace:pt,prefix:w})),g&&y.push(`
|
|
43
|
+
|
|
44
|
+
${it(g,{...this.#n,filterStacktrace:pt,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:w})}`),p&&y.push(`
|
|
45
|
+
`,w+E(this.styles.underline.suffix?Yt(p):p)),y.join("")}_log(e,n){const r=We(n)?"stderr":"stdout",s=r==="stderr"?this.#r:this.#t;this.#c&&this.#s!==void 0&&s.isTTY?this.#s.update(r,e.split(`
|
|
46
|
+
`),0):Fe(`${e}
|
|
47
|
+
`,s)}}export{ws as PrettyReporter};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import O,{white as M,grey as c,underline as $,bold as v}from"@visulima/colorize/browser";import{w as r,g as D}from"./index-pjyHJq0E.js";import{L as E,E as F}from"./constants-DKfCaSUR.js";import{w as R}from"./write-console-log-based-on-level-CG0mniaO.js";const Y=o=>{const l=Object.keys(o).map(t=>o[t].badge??"");return l.length===0?"":l.reduce((t,p)=>t.length>p.length?t:p,"")},_=o=>[o.getHours(),o.getMinutes(),o.getSeconds()].map(l=>String(l).padStart(2,"0")).join(":");class z{styles;loggerTypes;constructor(l){this.styles={bold:{label:!1},dateFormatter:_,underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...l},this.loggerTypes=E}setLoggerTypes(l){this.loggerTypes=l}}class N extends z{constructor(l={}){super({uppercase:{label:!0,...l.uppercase},...l})}log(l){const t=typeof globalThis.window<"u"&&typeof globalThis.document<"u",p=R(l.type.level),{badge:S,context:x,date:f,error:T,groups:h,label:d,message:w,prefix:y,repeated:u,scope:g,suffix:b,type:j}=l,{color:A}=this.loggerTypes[j.name],B=A?O[A]:M,s=[];if(t&&h.length>0){const e=h.map(()=>" ").join(""),i=c(`[${h.at(-1)}]`);s.push(r(e+i[0],i.slice(1)))}if(f){const e=c(this.styles.dateFormatter(typeof f=="string"?new Date(f):f));t?s.push(r(e[0],e.slice(1))):s.push([`${e[0]} `,...e.slice(1)])}if(S){const e=B(S);t?s.push(r(e[0],e.slice(1))):s.push([`${e[0]} `,...e.slice(1)])}else{const e=Y(this.loggerTypes);if(e.length>0){const i=c(".".repeat(e.length));t?s.push(r(`${i[0]} `,i.slice(1))):s.push([`${i[0]} `,...i.slice(1)])}}const P=D(this.loggerTypes);let m;if(u){const e=M(`[${u}x]`);m=t?r(e[0],e.slice(1)):[e[0],...e.slice(1)]}if(d){const e=B(this.#e(d));t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)]),m&&s.push(m);let i=P.length-d.length;if(u?i-=String(u).length+3:i+=1,i>0){const n=c(".".repeat(i));t?s.push(r(n[0],n.slice(1))):s.push([` ${n[0]}`,...n.slice(1)])}}else{const e=c(".".repeat(P.length+1));t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(Array.isArray(g)&&g.length>0){const e=c(`[${g.join(" > ")}]`);t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(y){const e=c(`${Array.isArray(g)&&g.length>0?". ":" "}[${this.styles.underline.prefix?$(y):y}] `);t?s.push(r(e[0],e.slice(1))):s.push([e[0],...e.slice(1)])}if(w!==F&&s.push(w),x&&s.push(...x),T&&s.push(T,`
|
|
2
|
+
|
|
3
|
+
`),b){const e=c(this.styles.underline.suffix?$(b):b);t?s.push(r(`
|
|
4
|
+
${e[0]}`,e.slice(1))):s.push([`
|
|
5
|
+
${e[0]}`,...e.slice(1)])}if(t)p(...s);else{let e="";const i=[],n=[];for(let L=0;L<s.length;L+=1){const a=s[L];Array.isArray(a)&&a.length>1&&a[0].includes("%c")?(e+=String(a[0]),i.push(...a.slice(1))):n.push(a)}p(`${e}%c`,...i,"",...n)}}#e(l){let t=this.styles.uppercase.label?l.toUpperCase():l;return t=this.styles.underline.label?$(t):t,this.styles.bold.label&&(t=v(t)),t}}export{N as default};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import{createRequire as yt}from"node:module";import Pe from"@visulima/colorize";let bt;const $t=e=>(bt??=yt(import.meta.url))(e),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:I,fe=e=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[t,n]=z.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return z.getBuiltinModule(e)}return $t(e)},I=z,{execFileSync:wt}=fe("node:child_process"),P=fe("node:fs"),vt=fe("node:tty"),qr={alert:7,critical:6,debug:1,emergency:8,error:5,informational:2,notice:3,trace:2,warning:4},St={alert:{color:"red",label:"alert",logLevel:"alert"},await:{color:"blue",label:"awaiting",logLevel:"informational"},complete:{color:"cyan",label:"complete",logLevel:"informational"},critical:{color:"redBright",label:"critical",logLevel:"critical"},debug:{color:"gray",label:"debug",logLevel:"debug"},emergency:{color:"redBright",label:"emergency",logLevel:"emergency"},error:{color:"red",label:"error",logLevel:"error"},info:{color:"blueBright",label:"info",logLevel:"informational"},log:{label:"",logLevel:"informational"},notice:{color:"magentaBright",label:"notice",logLevel:"notice"},pending:{color:"magenta",label:"pending",logLevel:"informational"},start:{color:"greenBright",label:"start",logLevel:"informational"},stop:{color:"red",label:"stop",logLevel:"informational"},success:{color:"green",label:"success",logLevel:"informational"},trace:{color:"cyanBright",label:"trace",logLevel:"trace"},wait:{color:"blue",label:"waiting",logLevel:"informational"},warn:{color:"yellow",label:"warning",logLevel:"warning"},warning:{color:"yellow",label:"warning",logLevel:"warning"},watch:{color:"yellowBright",label:"watching",logLevel:"informational"}},Yr=Symbol("EMPTY"),Jr=e=>{const t=Object.keys(e).map(n=>e[n].label??"");return t.length===0?"":t.reduce((n,r)=>n.length>r.length?n:r,"")},E="[Inspection threw]",b=(e,t,n,r,o,s=", ",i=Number.POSITIVE_INFINITY)=>{const l=e.length;if(l===0)return"";const c=Number.isFinite(i)&&l>i,a=c?Math.max(0,Math.floor(i)):l;if(a===0)return`…(${String(l)})`;let u=r;o!==void 0&&(u=o);const d=n.truncate,g=Number.isFinite(d);let f="",h="",p="";for(let m=0;m<a;m+=1){const y=m+1===a,$=m+2===a;g&&(p=`…(${String(a-m)})`);let v=e[m];n.truncate=d-f.length-(y?0:s.length);const x=h||u(v,t,n,r)+(y?"":s),w=f.length+x.length,L=w+p.length;if(y&&w>d&&f.length+p.length<=d||!y&&!$&&L>d)break;v=e[m+1];const T=$?"":s;if(y?h="":h=u(v,t,n,r)+T,!y&&$&&L>d&&w+h.length>d)break;if(f+=x,!y&&!$&&w+h.length>=d){p=`…(${String(a-m-1)})`;break}p=""}return c&&p===""&&(p=`${s}… ${String(l-a)} more`),`${f}${p}`},At=([e,t],n,r)=>(r.truncate-=3,t?`${r.stylize(String(e),"yellow")}=${r.stylize(`"${t}"`,"string")}`:r.stylize(String(e),"yellow")),Ce=e=>{try{return Object.create(e,{length:{value:e.length}})}catch{return}},Et=(e,t,n,r)=>{let o;try{o=e.nodeType}catch{return E}if(o===1)return De(e,e,n,r);if(o===3){let s;try{s=e.data}catch{return E}return r(s,void 0,n)}return r(e,void 0,n)},ce=(e,t,n,r)=>{const o=Ce(e);return o===void 0?E:b(o,e,t,n,Et,`
|
|
2
|
+
`)},De=(e,t,n,r)=>{let o,s;try{o=e.getAttributeNames().map(f=>[f,e.getAttribute(f)]),s=e.tagName.toLowerCase()}catch{return E}const i=n.stylize(`<${s}`,"special"),l=n.stylize(">","special"),c=n.stylize(`</${s}>`,"special");n.truncate-=s.length*2+5;let a="";o.length>0&&(a+=" ",a+=b(o,t,n,r,At," ")),n.truncate-=a.length;const{truncate:u}=n;let d;try{d=Ce(e.children)}catch{d=void 0}let g;return d===void 0?g=E:(g=ce(d,n,r),g&&g.length>u&&(g=`…(${String(d.length)})`)),`${i}${a}${l}${g}${c}`},xt=(e,t,n)=>e.length===0?"Arguments []":(t.truncate-=13,`Arguments [ ${b(e,e,t,n,void 0,", ",t.maxArrayLength)} ]`),Nt=(e,t)=>{let n;if(e===" ")n=" ";else if(typeof e=="number"&&e>0)n=Array.from({length:e+1}).join(" ");else return;return{base:n,prev:`
|
|
3
|
+
${Array.from({length:t+1}).join(n)}`}},Q=(e,t)=>{if(e.length===0)return"";const n=t.prev+t.base;return n+e.split("\0\0").join(`,${n}`)+t.prev},It=/^[a-z_]\w*$/i,Ot=/^"|"$/g,kt=(e,t)=>{if(It.test(e))return e;const n=JSON.stringify(e);return t.quoteStyle==="double"?n.replaceAll('"',String.raw`\"`):n.replaceAll("'",String.raw`\'`).replaceAll(String.raw`\"`,'"').replaceAll(Ot,"'")},C=([e,t],n,r,o)=>{r.truncate-=2;let s;typeof e=="string"?s=kt(e,r):typeof e=="number"?s=String(e):s=`[${o(e,n,r)}]`,r.truncate-=s.length;const i=o(t,n,r);return`${s}: ${i}`},Bt=Symbol.for("chai/inspect"),ne=e=>({[Bt]:()=>e}),D=(e,t)=>{let n;try{n=Object.getOwnPropertyDescriptor(e,t)}catch{n=void 0}if(n===void 0||"value"in n)try{return e[t]}catch{return ne(E)}if(n.get===void 0)return ne("[Setter]");try{return e[t]}catch{return ne(E)}},Lt=e=>{for(const t of e)if(Array.isArray(t)||typeof t=="object"&&t!==null)return!0;return!1},Tt=e=>{const t=[];for(const n of Object.keys(e)){const r=Number(n);Number.isInteger(r)&&r>=0&&String(r)===n&&r<4294967295||t.push(n)}return t},jt=(e,t,n,r)=>{const o=Tt(e);if(e.length===0&&o.length===0)return"[]";t.truncate-=4;const s=!!r&&Lt(e);let i=b(e,e,t,n,void 0,s?"\0\0":", ",t.maxArrayLength);t.truncate-=i.length;let l="";return o.length>0&&(l=b(o.map(c=>[c,D(e,c)]),e,t,n,C)),s&&r&&(i=Q(i,r)),`[${s?"":" "}${i}${l?`, ${l}`:""}${s?"":" "}]`},Ft=50,pe=(e,t)=>{const n=new Uint8Array(e),r=Math.min(n.length,Ft);let o="",s=!1;for(let a=0;a<r;a+=1){const u=n[a];u!==0&&(s=!0),o+=(a===0?"":" ")+u.toString(16).padStart(2,"0")}n.length>r&&(o+=` ... ${String(n.length-r)} more byte${n.length-r===1?"":"s"}`);const i=e instanceof ArrayBuffer?"ArrayBuffer":"SharedArrayBuffer",l=s||n.length>r,c=o!==""&&l?`[Uint8Contents]: <${o}>, `:"";return`${t.stylize(i,"special")} { ${c}byteLength: ${t.stylize(String(e.byteLength),"number")} }`},me=/\d(?=(?:\d{3})+(?!\d))/g,Wt=/\d{3}/g,Mt=/_$/,Ve=(e,t)=>{if(t.length<4||t.length===4&&t.codePointAt(0)===45||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||t.includes("e"))return t;if(typeof e=="number"){const n=e<0?-Math.floor(-e):Math.floor(e);if(n!==e){const r=String(n),o=t.slice(r.length+1);return`${r.replace(me,"$&_")}.${o.replace(Wt,"$&_").replace(Mt,"")}`}}return t.replace(me,"$&_")},_t=e=>e>="\uD800"&&e<="\uDBFF",B=(e,t,n="…")=>{e=String(e);const r=n.length,o=e.length;if(r>t&&o>r)return n;if(o>t&&o>r){let s=t-r;return s>0&&_t(e[s-1])&&(s-=1),`${e.slice(0,s)}${n}`}return e},ye=(e,t)=>{let n=B(e.toString(),t.truncate-1);return n!=="…"&&(n+="n"),t.stylize(t.numericSeparator?Ve(e,n):n,"bigint")},Ge=e=>{try{return Array.isArray(e)}catch{return!1}},F=(e,t)=>{try{return e[t]}catch{return}},zt=(e,t)=>{try{return e instanceof t}catch{return!1}},be=(e,t)=>{try{return Object.getOwnPropertyDescriptor(e,t)?.enumerable??!1}catch{return!0}},Rt=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:void 0),K=(e,t,n,r)=>{if("window"in globalThis&&e===globalThis)return"{ [object Window] }";if(e===globalThis)return"{ [object globalThis] }";let o,s;try{o=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e)}catch{return E}let i,l;try{i=t.showHidden?o:o.filter(f=>Object.getOwnPropertyDescriptor(e,f)?.enumerable)}catch{i=o.filter(f=>be(e,f))}try{l=s.filter(f=>t.showHidden||Object.getOwnPropertyDescriptor(e,f)?.enumerable)}catch{l=s.filter(f=>be(e,f))}let c;try{const f=Rt(e)===Object.prototype||e.constructor===Object,h=e instanceof Object?"":"null prototype";let p;!f&&Symbol.toStringTag in e?p=e[Symbol.toStringTag]:p=h?"Object":"",c=p||h?`[${[p,h].filter(Boolean).join(": ")}] `:""}catch{c=""}if(i.length===0&&l.length===0)return`${c}{}`;t.truncate-=4;const a=r?"\0\0":", ",u=b(i.map(f=>[f,D(e,f)]),e,t,n,C,a),d=b(l.map(f=>[f,D(e,f)]),e,t,n,C,a);let g="";return u&&d&&(g=a),r?`${c}{${Q(u+g+d,r)}}`:`${c}{ ${u}${g}${d} }`},Pt=(e,t,n,r)=>{let o;try{o=typeof e.constructor=="function"?e.constructor.name:""}catch{o=""}return(!o||o==="_class")&&(o="<Anonymous Class>"),t.truncate-=o.length,`${o} ${K(e,t,n,r)}`},Ct=(e,t)=>{const n=t.stylize(String(e.byteLength),"number"),r=t.stylize(String(e.byteOffset),"number"),o=t.stylize(String(e.buffer.byteLength),"number");return`${t.stylize("DataView","special")} { byteLength: ${n}, byteOffset: ${r}, buffer: ArrayBuffer { byteLength: ${o} } }`},Dt=(e,t)=>{const n=e.toJSON();if(n===null)return"Invalid Date";const r=n.split("T"),o=r[0];return t.stylize(`${o}T${B(r[1],t.truncate-o.length-1)}`,"date")},Vt=new Set(["column","columnNumber","description","fileName","line","lineNumber","message","name","number","stack"]),Gt=(e,t,n)=>{const r=Object.getOwnPropertyNames(e).filter(l=>!Vt.has(l)),{name:o}=e;t.truncate-=o.length;let s="";typeof e.message=="string"?s=B(e.message,t.truncate):r.unshift("message"),s=s?`: ${s}`:"",t.truncate-=s.length+5;const i=b(r.map(l=>[l,D(e,l)]),e,t,n,C);return`${o}${s}${i?` { ${i} }`:""}`},$e=(e,t)=>{let n,r,o;try{n=e[Symbol.toStringTag]||"Function",r=e.toString(),{name:o}=e}catch{return t.stylize(E,"special")}return r.length<t.truncate-12?t.stylize(`[${n}: ${r}]`,"special"):o?t.stylize(`[${n} ${B(o,t.truncate-11)}]`,"special"):t.stylize(`[${n}]`,"special")},we=(e,t)=>{const n=F(e,Symbol.toStringTag),r=typeof n=="string"?n:"Generator";return`${t.stylize(`Object [${r}]`,"special")} {}`},Ht=([e,t],n,r,o)=>(r.truncate-=4,e=o(e,n,r),r.truncate-=e.length,`${e} => ${o(t,n,r)}`),Ut=(e,t,n,r)=>{if(e.size<=0)return"Map (0) {}";t.truncate-=7;let o=b([...e.entries()],e,t,n,Ht,r?"\0\0":", ",t.maxArrayLength);return r&&(o=Q(o,r)),`Map (${String(e.size)}) {${r?"":" "}${o}${r?"":" "}}`};function ve(e,t){return Number.isNaN(e)?t.stylize("NaN","number"):e===Number.POSITIVE_INFINITY?t.stylize("Infinity","number"):e===Number.NEGATIVE_INFINITY?t.stylize("-Infinity","number"):e===0?t.stylize(1/e===Number.POSITIVE_INFINITY?"+0":"-0","number"):t.stylize(B(t.numericSeparator?Ve(e,e.toString()):e.toString(),t.truncate),"number")}const qt=()=>"Promise{…}",Yt=(e,t)=>{const n=t.truncate-(2+e.flags.length);return t.stylize(`/${B(e.source,n)}/${e.flags}`,"regexp")},Jt=(e,t,n,r)=>{if(e.size===0)return"Set (0) {}";t.truncate-=7;let o=b([...e],e,t,n,void 0,r?"\0\0":", ",t.maxArrayLength);return r&&(o=Q(o,r)),`Set (${String(e.size)}) {${r?"":" "}${o}${r?"":" "}}`},Kt=(e,t)=>{const n=t.quoteStyle==="double"?'"':"'";return n+e+n},Se=new RegExp(String.raw`['\0-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5`+String.raw`\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]`,"g"),Zt={" ":String.raw`\t`,"\n":String.raw`\n`,"\f":String.raw`\f`,"\r":String.raw`\r`,"\b":String.raw`\b`,"'":String.raw`\'`,"\\":"\\\\"},Xt=16,Qt=e=>Zt[e]||String.raw`\u${`0000${e.codePointAt(0).toString(Xt)}`.slice(-4)}`,Ae=(e,t)=>(Se.test(e)&&(e=e.replaceAll(Se,Qt)),t.stylize(Kt(B(e,t.truncate-2),t),"string")),Ee=e=>"description"in Symbol.prototype?e.description?`Symbol(${e.description})`:"Symbol()":e.toString(),en=e=>typeof Buffer=="function"&&e instanceof Buffer?"Buffer":e[Symbol.toStringTag],S=(e,t,n)=>{const r=en(e);t.truncate-=r.length+4;const o=Object.keys(e).slice(e.length);if(e.length===0&&o.length===0)return`${r}[]`;let s="";const i=Number.isFinite(t.maxArrayLength)?Math.min(e.length,Math.max(0,Math.floor(t.maxArrayLength))):e.length;for(let c=0;c<i;c++){const a=`${t.stylize(B(e[c],t.truncate),"number")}${c===i-1?"":", "}`;if(t.truncate-=a.length,c!==i-1&&t.truncate<=3){s+=`…(${String(e.length-c)})`;break}s+=a}i<e.length&&(s+=`${s?", ":""}… ${String(e.length-i)} more`);let l="";return o.length>0&&(l=b(o.map(c=>[c,D(e,c)]),e,t,n,C)),`${r}[ ${s}${l?`, ${l}`:""} ]`},xe=e=>typeof F(e,Symbol.toStringTag)!="string",tn=e=>typeof e=="function",He=(e,t,n)=>{if(e==null)return;const r=Object.getOwnPropertyDescriptor(e,t);if(r===void 0)return;const o=n==="get"?r.get:r.value;return typeof o=="function"?o:void 0},Ue=(e,t)=>{if(e!==void 0)return n=>{try{return e.call(n,t),!0}catch{return!1}}},j=(e,t)=>Ue(He(e,t,"get")),N=(e,t,n)=>Ue(He(e,t,"value"),n),Ne=Object.freeze({}),A=j(Reflect.getPrototypeOf(Int8Array.prototype),"length"),nn=typeof SharedArrayBuffer=="function"?SharedArrayBuffer.prototype:void 0,rn=Object.assign(Object.create(null),{Arguments:xe,Array:Ge,ArrayBuffer:j(ArrayBuffer.prototype,"byteLength"),BigInt:N(BigInt.prototype,"valueOf"),Boolean:N(Boolean.prototype,"valueOf"),DataView:j(DataView.prototype,"byteLength"),Date:N(Date.prototype,"valueOf"),Error:xe,Float32Array:A,Float64Array:A,Function:tn,Int8Array:A,Int16Array:A,Int32Array:A,Map:j(Map.prototype,"size"),Number:N(Number.prototype,"valueOf"),RegExp:j(RegExp.prototype,"source"),Set:j(Set.prototype,"size"),SharedArrayBuffer:j(nn,"byteLength"),String:N(String.prototype,"valueOf"),Symbol:N(Symbol.prototype,"valueOf"),Uint8Array:A,Uint8ClampedArray:A,Uint16Array:A,Uint32Array:A,WeakMap:N(WeakMap.prototype,"has",Ne),WeakSet:N(WeakSet.prototype,"has",Ne)}),on=(e,t)=>{const n=rn[t];return n===void 0||n(e)},Ie=new WeakMap,Oe=Object.create(null),sn=Object.assign(Object.create(null),{Arguments:xt,Array:jt,ArrayBuffer:pe,AsyncGenerator:we,BigInt:ye,bigint:ye,Boolean:(e,t)=>t.stylize(String(e),"boolean"),boolean:(e,t)=>t.stylize(String(e),"boolean"),DataView:Ct,Date:Dt,Error:Gt,Float32Array:S,Float64Array:S,Function:$e,function:$e,Generator:we,HTMLCollection:ce,Int8Array:S,Int16Array:S,Int32Array:S,Map:Ut,NodeList:ce,null:(e,t)=>t.stylize("null","null"),Number:ve,number:ve,Promise:qt,RegExp:Yt,Set:Jt,SharedArrayBuffer:pe,String:Ae,string:Ae,Symbol:Ee,symbol:Ee,Uint8Array:S,Uint8ClampedArray:S,Uint16Array:S,Uint32Array:S,undefined:(e,t)=>t.stylize("undefined","undefined"),WeakMap:(e,t)=>t.stylize("WeakMap{…}","special"),WeakSet:(e,t)=>t.stylize("WeakSet{…}","special")}),ln=Symbol.for("nodejs.util.inspect.custom"),cn=Symbol.for("chai/inspect"),an=(e,t,n,r)=>{const o=F(e,cn);if(typeof o=="function")return o.call(e,t);if(!("window"in globalThis)){const c=F(e,ln);if(typeof c=="function")return c.call(e,r,t)}const s=F(e,"inspect");if(typeof s=="function")return s.call(e,r,t);const i=F(e,"constructor");if(typeof i=="function"&&Ie.has(i))return Ie.get(i)?.(e,t)??"unknown";const l=Object.hasOwn(Oe,n)?Oe[n]:void 0;return l?l(e,t):""},re=(e,t,n)=>{const{depth:r,inspect:o,seen:s}=n;if(s.includes(e))return"[Circular]";if(r>=t.depth&&t.depth>0&&typeof e=="object"&&e!==null)return Ge(e)?"[Array]":"[Object]";const i=t.indent?Nt(t.indent,r):void 0;let l=e===null?"null":typeof e;if(l==="object")try{l=Object.prototype.toString.call(e).slice(8,-1)}catch{l="Object"}let c=sn[l];if(c!==void 0&&typeof e=="object"&&e!==null&&!on(e,l)&&(c=void 0),c!==void 0)return c(e,t,o,i);if(t.customInspect&&e){const d=an(e,t,l,t.depth-r);if(d)return typeof d=="string"?d:o(d,e,t)}let a=!1;if(e)try{a=Object.getPrototypeOf(e)}catch{a=Object.prototype}if(a===Object.prototype||a===null)return K(e,t,o,i);if(e&&typeof HTMLElement=="function"&&zt(e,HTMLElement))return De(e,e,t,o);const u=F(e,"constructor");return u!==void 0?u!==Object?Pt(e,t,o,i):K(e,t,o,i):e===Object(e)?K(e,t,o,i):t.stylize(String(e),l)},Kr=(e,t={})=>{const n={customInspect:!0,depth:5,indent:void 0,maxArrayLength:Number.POSITIVE_INFINITY,numericSeparator:!0,quoteStyle:"single",showHidden:!1,stylize:o=>o,truncate:Number.POSITIVE_INFINITY,...t};if(n.indent!==void 0&&n.indent!==" "&&!(Number.parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `undefined`');const r={depth:0,inspect:void 0,seen:[]};return r.inspect=(o,s,i)=>{if(s==null){r.depth+=1;const c=re(o,i,r);return r.depth-=1,c}r.seen.push(s),r.depth+=1;const l=re(o,i,r);return r.depth-=1,r.seen.pop(),l},re(e,n,r)},un=new Set(["alert","critical","emergency","error","trace","warning"]),Zr=e=>un.has(e),Xr=(e,t)=>t?(t.__write??t.write.bind(t)).call(t,e):!1,fn=globalThis.process??Object.create(null),ke={versions:{}},V=new Proxy(fn,{get(e,t){if(t in e)return e[t];if(t in ke)return ke[t]}}),ee=e=>{let t;return()=>{if(t===void 0){if(typeof V.getBuiltinModule!="function")throw new TypeError(`[@visulima/error] Cannot load ${e}: this runtime implements no process.getBuiltinModule(). Requires Node ^22.14.0 || >=24.10.0, or another runtime providing process.getBuiltinModule().`);t=V.getBuiltinModule(e)}return t}},dn=e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
4
|
+
`),gn=(e,t,n,r)=>{const o={column:0,line:-1,...e.start},s={...o,...e.end},i=o.line,l=o.column,c=s.line,a=s.column;let u=Math.max(i-(n+1),0),d=Math.min(t.length,c+r);i===-1&&(u=0),c===-1&&(d=t.length);const g=c-i,f={};if(g)for(let h=0;h<=g;h++){const p=h+i;if(!l)f[p]=!0;else if(h===0){const m=t[p-1]?.length;f[p]=[l,(m??0)-l+1]}else if(h===g)f[p]=[0,a];else{const m=t[p-h]?.length;f[p]=[0,m]}}else l===a?f[i]=l?[l,0]:!0:f[i]=[l,(a??0)-(l??0)];return{end:d,markerLines:f,start:u}},hn=V.platform==="win32"&&!V.env?.WT_SESSION?">":"❯",pn=(e,t,n)=>{const r={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:h=>h,marker:h=>h,message:h=>h,...n?.color}},o=typeof t.start.column=="number";let s=(e.includes("\r")?dn(e):e).split(`
|
|
5
|
+
`);typeof r.tabWidth=="number"&&e.includes(" ")&&(s=s.map(h=>h.replaceAll(" "," ".repeat(r.tabWidth))));const{end:i,markerLines:l,start:c}=gn(t,s,r.linesAbove,r.linesBelow),a=String(i).length,{gutter:u,marker:d,message:g}=r.color;let f=s.slice(c,i).map((h,p)=>{const m=c+1+p,y=l[m],$=String(m).padStart(a),v=!l[m+1],x=` ${$}${r.showGutter?" |":""}`;if(y){let w="";if(Array.isArray(y)){const L=h.replaceAll(/[^\t]/g," ").slice(0,Math.max(y[0]-1,0)),T=y[1]||1;w=[`
|
|
6
|
+
`,r.prefix+u(x.replaceAll(/\d/g," "))," ",L,d("^").repeat(T)].join(""),v&&r.message&&(w+=` ${g(r.message)}`)}return[r.prefix+d(hn),u(x),h.length>0?` ${h}`:"",w].join("")}return`${r.prefix} ${u(x)}${h.length>0?` ${h}`:""}`}).join(`
|
|
7
|
+
`);return r.message&&!o&&(f=`${r.prefix+" ".repeat(a+1)+r.message}
|
|
8
|
+
${f}`),f},mn=()=>V.env?.DEBUG==="true",M=(e,...t)=>{if(mn()){const n=t.map(r=>typeof r=="function"?r():r);console.debug(`error:parse-stacktrace: ${e}`,...n)}},_="<unknown>",yn=/^(?:node:internal\/|node:|internal\/)/,bn=e=>e!==void 0&&yn.test(e),$n=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,wn=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,vn=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,Sn=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,An=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,En=/in\s(.*)\s\(at\s(.+)\)\sat/,xn=/^(?:.*@)?(.*):(\d+):(\d+)$/,Nn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,In=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,On=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,Be=/\(error: ([^)]*)\)/,kn=/at\s/,Bn=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,Ln=/Error: |AggregateError:/,qe=/^Anonymous function$/,Tn=/^\s*in\s.*/,jn=/^.*?\s*at\s.*/,Fn=/^.*?\s*@.*|\[native code\]/,Ye=(e,t)=>{const n=e.includes("safari-extension"),r=e.includes("safari-web-extension");return n||r?[e.includes("@")?e.split("@")[0]:_,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Je=(e,t)=>{const n=vn.exec(t);n&&(e.file=n[1],e.line=+n[2],e.column=+n[3])},Wn=e=>{const t=En.exec(e);if(t){M(`parse nested node error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`);const r=t[2].split(":");return{column:r[2]?+r[2]:void 0,file:r[0],line:r[1]?+r[1]:void 0,methodName:t[1]??_,raw:e,type:void 0}}const n=An.exec(e);if(n){M(`parse node error stack line: "${e}"`,()=>`found: ${JSON.stringify(n)}`);const r={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(kn,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??_,raw:e,type:e.startsWith("internal")?"internal":void 0};return Je(r,`${n[2]}:${n[3]}:${n[4]}`),r}},Mn=e=>{const t=$n.exec(e);if(t){M(`parse chrome error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`);const n=t[2]?.startsWith("native"),r=t[2]?.startsWith("eval")||t[1]?.startsWith("eval");let o,s;if(r){const a=wn.exec(e);if(a){const u=Bn.exec(a[1]);u?(t[2]=u[4]??u[1],t[3]=u[5]??u[2],t[4]=u[3]):a[2]&&(t[2]=a[1]),a[2]&&(o={column:a[4]?+a[4]:void 0,file:a[2],line:a[3]?+a[3]:void 0,methodName:"eval",raw:e,type:"eval"})}else{const u=Sn.exec(e);u&&(s={column:u[4]?+u[4]:void 0,file:u[2],line:u[3]?+u[3]:void 0},o={column:u[6]?+u[6]:void 0,file:u[1],line:u[5]?+u[5]:void 0,methodName:"eval",raw:u[0],type:"eval"})}}const[i,l]=Ye(t[1]?t[1].replace(qe,"<anonymous>"):_,t[2]),c={column:t[4]?+t[4]:void 0,evalOrigin:o,file:l,line:t[3]?+t[3]:void 0,methodName:i,raw:e,type:r?"eval":n?"native":bn(l)?"internal":void 0};return s?(c.column=s.column,c.file=s.file,c.line=s.line):Je(c,`${l}:${t[3]}:${t[4]}`),c}},_n=(e,t)=>{const n=Nn.exec(e);if(n){M(`parse gecko error stack line: "${e}"`,()=>`found: ${JSON.stringify(n)}`);const r=n[3]?.includes(" > eval"),o=r&&n[3]&&In.exec(n[3]);let s;r&&o&&(n[3]=o[1],s={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:e,type:"eval"},n[4]=o[2]);const[i,l]=Ye(n[1]?n[1].replace(qe,"<anonymous>"):_,n[3]);let c;(t?.type==="safari"||!r&&t?.type==="firefox")&&t.column?c=t.column:!r&&n[5]&&(c=+n[5]);let a;return(t?.type==="safari"||!r&&t?.type==="firefox")&&t.line?a=t.line:n[4]&&(a=+n[4]),{column:c,evalOrigin:s,file:l,line:a,methodName:i,raw:e,type:r?"eval":l.includes("[native code]")?"native":void 0}}},zn=(e,t)=>{const n=On.exec(e);if(!(n&&n[2].includes(" > eval"))&&n)return M(`parse firefox error stack line: "${e}"`,()=>`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:t?.column??void 0,file:n[2],line:n[3]?+n[3]:t?.line??void 0,methodName:n[1]||_,raw:e,type:void 0}},Rn=e=>{const t=xn.exec(e);if(t)return M(`parse react android native error stack line: "${e}"`,()=>`found: ${JSON.stringify(t)}`),{column:t[3]?+t[3]:void 0,file:t[1],line:t[2]?+t[2]:void 0,methodName:_,raw:e,type:void 0}},Ke=(e,{filter:t,frameLimit:n=50}={})=>{const r=e;let o=(typeof r.stacktrace=="string"?r.stacktrace:e.stack??"").split(`
|
|
9
|
+
`).map(s=>(Be.test(s)?s.replace(Be,"$1"):s).trim()).filter(s=>!Ln.test(s)&&s!=="eval code");return t&&(o=o.filter(s=>t(s))),o=o.slice(0,n),o.reduce((s,i,l)=>{if(!i||i.length>1024)return s;let c;if(Tn.test(i))c=Wn(i);else if(jn.test(i))c=Mn(i);else if(Fn.test(i)){let a;if(l===0){const u=e,d=u.columnNumber,g=u.lineNumber,f=u.line,h=u.column;d||g?a={column:d,line:g,type:"firefox"}:(f||h)&&(a={column:h,line:f,type:"safari"})}c=zn(i,a)??_n(i,a)}else c=Rn(i);return c?s.push(c):M(`parse error stack line: "${i}"`,"not parser found"),s},[])},Le=ee("node:fs"),Z=ee("node:path"),Pn=ee("node:process"),Cn=ee("node:url"),O=(e,t,n)=>n===0?e:t===" "?e+" ".repeat(n):e+" ".repeat(t*n),Ze=e=>e.replaceAll("\\","/"),Dn=e=>{if(!e.startsWith("file:"))return e;try{return Cn().fileURLToPath(e)}catch{return e}},Vn=(e,t)=>{const n=e.replace("async file:","file:");return Ze(Z().relative(t,Dn(n)))},Gn=(e,t,n)=>{if(t)return n.title(e.message);const r=e.message?`: ${e.message}`:"";return n.title(e.name+r)},Xe=(e,{color:t,hideErrorTitle:n,indentation:r,prefix:o},s)=>`${O(o,r,s)}${Gn(e,n,t)}
|
|
10
|
+
`,Qe=(e,{color:t,indentation:n,prefix:r},o)=>{if(e.hint===void 0)return;const s=O(r,n,o);let i="";if(Array.isArray(e.hint))for(const l of e.hint)i+=`${s+l}
|
|
11
|
+
`;else i+=s+e.hint;return t.hint(i)},de=(e,t)=>{if(!t||e.file===void 0||e.line===void 0)return{trace:e};try{const n=t({column:e.column,file:e.file,line:e.line});return n?{source:n.source,trace:{...e,column:n.column??e.column,file:n.file??e.file,line:n.line??e.line}}:{trace:e}}catch{return{trace:e}}},ge=(e,t,n=0)=>{const{color:r,cwd:o,displayShortPath:s,indentation:i,prefix:l}=t,{trace:c}=e;let a;c.file===void 0?a="<unknown>":a=s?Vn(c.file,o):Ze(c.file);const{fileLine:u,method:d}=r;return`${O(l,i,n)}at ${c.methodName?`${d(c.methodName)} `:""}${u(a)}:${u(c.line?.toString()??"")}`},Hn=(e,t)=>{if(t.allowAllFilePaths)return!0;const n=Z().resolve(t.cwd),r=Z().resolve(n,e);return r===n||r.startsWith(n+Z().sep)},Un=e=>{try{return Le().existsSync(e)?Le().readFileSync(e,"utf8"):void 0}catch{return}},et=(e,t,n)=>{const{color:r,indentation:o,linesAbove:s,linesBelow:i,prefix:l,showGutter:c,showLineNumbers:a,tabWidth:u}=t,{source:d,trace:g}=e;if(g.file===void 0)return;let f;if(d===void 0){const h=g.file.replace("file://","");if(!Hn(h,t))return;const p=Un(h);if(p===void 0)return;f=p}else f=d;return pn(f,{start:{column:g.column,line:g.line}},{color:r,linesAbove:s,linesBelow:i,prefix:O(l,o,n),showGutter:c,showLineNumbers:a,tabWidth:u})},tt=(e,t,n)=>{if(e.errors.length===0)return;let r=`${O(t.prefix,t.indentation,n)}Errors:
|
|
12
|
+
|
|
13
|
+
`,o=!0;for(const s of e.errors)o?o=!1:r+=`
|
|
14
|
+
|
|
15
|
+
`,r+=rt(s,{...t,framesMaxLimit:1,hideErrorCodeView:t.hideErrorErrorsCodeView},n+1);return`
|
|
16
|
+
${r}`},qn=e=>{if(typeof e=="object"&&e!==null)try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}return String(e)},nt=(e,t,n,r=new Set)=>{r.add(e);let o=`${O(t.prefix,t.indentation,n)}Caused by:
|
|
17
|
+
|
|
18
|
+
`;const{cause:s}=e;if(!(s instanceof Error)){const c=qn(s);return o+=`${O(t.prefix,t.indentation,n)}${t.color.title(c)}
|
|
19
|
+
`,`
|
|
20
|
+
${o}`}o+=Xe(s,t,n);const i=Ke(s).shift(),l=Qe(s,t,n);if(l&&(o+=`${l}
|
|
21
|
+
`),i){const c=de(i,t.sourceMap);if(o+=ge(c,t,n),!t.hideErrorCauseCodeView){const a=et(c,t,n);a!==void 0&&(o+=`
|
|
22
|
+
${a}`)}}if(s instanceof AggregateError){const c=tt(s,t,n);c!==void 0&&(o+=`
|
|
23
|
+
${c}`)}return s.cause&&(o+=r.has(s)?`
|
|
24
|
+
${O(t.prefix,t.indentation,n+1)}Caused by: [Circular]`:`
|
|
25
|
+
${nt(s,t,n+1,r)}`),`
|
|
26
|
+
${o}`},Yn=(e,t)=>(e.length>0?`
|
|
27
|
+
`:"")+e.map(n=>ge(de(n,t.sourceMap),t)).join(`
|
|
28
|
+
`),rt=(e,t,n)=>{const r={allowAllFilePaths:!1,cwd:Pn().cwd(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...t,color:{fileLine:l=>l,gutter:l=>l,hint:l=>l,marker:l=>l,message:l=>l,method:l=>l,title:l=>l,...t.color}},o=Ke(e,{filter:t.filterStacktrace,frameLimit:r.framesMaxLimit}),s=o.shift(),i=s?de(s,r.sourceMap):void 0;return[t.hideMessage?void 0:Xe(e,r,n),Qe(e,r,n),i?ge(i,r,n):void 0,i&&!r.hideErrorCodeView?et(i,r,n):void 0,e instanceof AggregateError?tt(e,r,n):void 0,e.cause===void 0||e.cause===null?void 0:nt(e,r,n),o.length>0?Yn(o,r):void 0].filter(Boolean).join(`
|
|
29
|
+
`)},Qr=(e,t={})=>{if(t.framesMaxLimit!==void 0&&t.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return rt(e,t,0)},Jn=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],Kn=12288,Zn=65510,Xn=[12288,12288,65281,65376,65504,65510],Qn=8361,er=65518,tr=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],nr=32,rr=10630,or=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],sr=4352,ir=262141,ot=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],H=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){const o=Math.floor((n+r)/2),s=o*2;if(t<e[s])r=o-1;else if(t>e[s+1])n=o+1;else return!0}return!1},Te=19968,[lr,cr]=ar(ot);function ar(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){const o=e[r],s=e[r+1];if(Te>=o&&Te<=s)return[o,s];s-o>n-t&&(t=o,n=s)}return[t,n]}const ur=e=>e<161||e>1114109?!1:H(Jn,e),fr=e=>e<Kn||e>Zn?!1:H(Xn,e),dr=e=>e<Qn||e>er?!1:H(tr,e),gr=e=>e<nr||e>rr?!1:H(or,e),hr=e=>e>=lr&&e<=cr?!0:e<sr||e>ir?!1:H(ot,e);function pr(e){return ur(e)?"ambiguous":fr(e)?"fullwidth":dr(e)?"halfwidth":gr(e)?"narrow":hr(e)?"wide":"neutral"}function mr(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function st(e){return mr(e),pr(e)}const it=String.raw,je=it`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,yr=()=>new RegExp(it`\p{RI}{2}|(?)${je}(?:\u200D${je})*`,"gu"),R=new Set(["\x1B",""]),te="\x07",lt="[",he="m",G="]8;;",br=39,$r=/[\u200B\uFEFF\u2060-\u2064]/g,wr=new RegExp(`(?:\\${lt}(?<code>\\d+)m|\\${G}(?<uri>.*)${te})`),vr=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),ct=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,U=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,Sr=yr(),Fe=new Map,Ar=e=>[e.ambiguousIsNarrow?1:0,e.control,e.fullWidth,e.regular,e.wide].join("|"),Er=e=>{const t=Ar(e.width);let n=Fe.get(t);return n||(n=new Map,Fe.set(t,n)),n},q=new RegExp(ct.source,"y"),oe=new RegExp(Sr.source,"uy"),Y=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,at=e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other",xr=(e,t)=>{const n=Er(t),r=Math.floor(e/65536),o=e%65536;let s=n.get(r);if(s||(s=new Map,n.set(r,s)),s.has(o))return s.get(o);let i;switch(at(e)){case"control":{i=t.width.control;break}case"latin":{i=t.width.regular;break}case"wide":{i=t.width.wide;break}case"zero":{i=0;break}default:switch(st(e)){case"ambiguous":{i=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{i=t.width.fullWidth;break}case"wide":{i=t.width.wide;break}default:i=t.width.regular}}return s.set(o,i),i},Nr=e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,ae=(e,t={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const n={truncation:{countAnsiEscapeCodes:t.countAnsiEscapeCodes??!1,ellipsis:t.ellipsis??"",ellipsisWidth:t.ellipsisWidth??(t.ellipsis?ae(t.ellipsis,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:t.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:t.ambiguousIsNarrow??!1,ansi:t.ansiWidth??0,control:t.controlWidth??0,emoji:t.emojiWidth??2,fullWidth:t.fullWidth??2,halfWidth:t.halfWidth??1,regular:t.regularWidth??1,tab:t.tabWidth??8,wide:t.wideWidth??2}},r=Math.max(0,n.truncation.limit-n.truncation.ellipsisWidth),{length:o}=e,s=o>1e4;let i=0,l=0,c=o,a=!1;const u=e.includes("\x1B")||e.includes("");for(;i<o;){if(u&&(e[i]==="\x1B"||e[i]==="")){if(e.startsWith("\x1B]8;;",i)){const m="\x1B]8;;\x07",y=m.length,$=e.indexOf("\x07",i+5);if($!==-1){const v=e.indexOf(m,$+1);if(v!==-1){const x=v+y,w=e.slice($+1,v).replace(ct,""),L=ae(w,{ambiguousIsNarrow:n.width.ambiguousIsNarrow,ansiWidth:n.width.ansi,controlWidth:n.width.control,countAnsiEscapeCodes:!1,ellipsis:n.truncation.ellipsis,ellipsisWidth:n.truncation.ellipsisWidth,emojiWidth:n.width.emoji,fullWidth:n.width.fullWidth,halfWidth:n.width.halfWidth,limit:Math.max(0,r-l),regularWidth:n.width.regular,tabWidth:n.width.tab,wideWidth:n.width.wide}),T=L.width;if(L.truncated)a=!0,c=Math.min(c,i);else if(l+T>r&&(c=Math.min(c,i),a=!0,l+T>n.truncation.limit))break;if(l+=T,i=x,a&&l>=n.truncation.limit)break;continue}}}if(q.lastIndex=i,q.test(e)){const m=q.lastIndex-i,y=n.truncation.countAnsiEscapeCodes?m:n.width.ansi;if(l+y>r&&(c=Math.min(c,i),l+y>n.truncation.limit)){a=!0;break}l+=y,i=q.lastIndex;continue}}const f=e.codePointAt(i);if(f===8203||f===65279||f>=8288&&f<=8292){i+=1;continue}if(f===9){if(l+n.width.tab>r&&(c=Math.min(c,i),l+n.width.tab>n.truncation.limit)){a=!0;break}l+=n.width.tab,i+=1;continue}if(Y.lastIndex=i,Y.test(e)){const m=(Y.lastIndex-i)*n.width.regular;if(l+m>r){const y=n.width.regular>0?Math.floor((r-l)/n.width.regular):0;if(c=Math.min(c,i+y),l+m>n.truncation.limit){a=!0;break}}l+=m,i=Y.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(U.lastIndex=i,U.test(e))){const m=(U.lastIndex-i)*n.width.control;if(l+m>r){const y=n.width.control>0?Math.floor((r-l)/n.width.control):0;if(c=Math.min(c,i+y),l+m>n.truncation.limit){a=!0;break}}l+=m,i=U.lastIndex;continue}if(oe.lastIndex=i,oe.test(e)){if(l+n.width.emoji>r&&(c=Math.min(c,i),l+n.width.emoji>n.truncation.limit)){a=!0;break}l+=n.width.emoji,i=oe.lastIndex;continue}const h=e.codePointAt(i)??0;if(Nr(h)){i+=h>65535?2:1;continue}let p;if(s)p=xr(h,n);else switch(at(h)){case"control":{p=n.width.control;break}case"latin":{p=n.width.regular;break}case"wide":{p=n.width.wide;break}case"zero":{p=0;break}default:switch(st(h)){case"ambiguous":{p=n.width.ambiguousIsNarrow?n.width.regular:n.width.wide;break}case"fullwidth":{p=n.width.fullWidth;break}case"wide":{p=n.width.wide;break}default:p=n.width.regular}}if(l+p>r&&(c=Math.min(c,i),l+p>n.truncation.limit)){a=!0;break}l+=p,i+=h>65535?2:1}let d=l,g=!1;return a&&n.truncation.limit>=n.truncation.ellipsisWidth&&(d=n.truncation.limit,g=!0),{ellipsed:g,index:a?c:o,truncated:a,width:d}},k=(e,t={})=>ae(e,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Ir=/\x1B\[(\d+)m/;class ut{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(t){const n=Ir.exec(t);if(!n)return;const r=Number.parseInt(n[1],10);switch(r){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(r>=30&&r<=37||r>=90&&r<=97)this.activeForeground=t;else if(r>=40&&r<=47||r>=100&&r<=107)this.activeBackground=t;else if([1,2,3,4,7,8,9].includes(r))this.activeFormatting.push(t);else if([22,23,24,27,28,29].includes(r)){const o={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];o&&(this.activeFormatting=this.activeFormatting.filter(s=>!s.includes(o)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const t=[];if(this.activeFormatting.length>0){const n={"\x1B[1m":"\x1B[22m","\x1B[2m":"\x1B[22m","\x1B[3m":"\x1B[23m","\x1B[4m":"\x1B[24m","\x1B[7m":"\x1B[27m","\x1B[8m":"\x1B[28m","\x1B[9m":"\x1B[29m"};[...this.activeFormatting].toReversed().forEach(r=>{const o=n[r];o&&t.push(o)})}return this.activeForeground&&t.push("\x1B[39m"),this.activeBackground&&t.push("\x1B[49m"),t.join("")}}const Or=(e,t)=>{if(!R.has(e[t]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const n=!0,r=e.slice(t+1,t+1+G.length).join("")===G;return{isInsideEscape:n,isInsideLinkEscape:r}},kr=(e,t={})=>{const n=new ut;let r="",o=!1,s="",i="",l=!1;const c=[...e];for(let a=0;a<c.length;a++){const u=c[a];if(u&&R.has(u)){if(r){const p=t.getWidth?.(r)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:r,width:p};if(l&&(m.isHyperlink=!0,m.hyperlinkUrl=i),t.onSegment?.(m,n)===!1)return;r=""}o=!0,s=u;const f=Or(c,a),{isInsideLinkEscape:h}=f;if(h){let p=a+1;for(i="";p<c.length;){const y=c[p];if(y===te)break;i+=y,p+=1}i=i.slice(4);const m={hyperlinkUrl:i,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(t.onSegment?.(m,n)===!1)return;a=p,l=!0,o=!1,s="";continue}if(a+1<c.length&&c[a+1]==="\\"&&l){const p={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(t.onSegment?.(p,n)===!1)return;l=!1,i="",a+=1,o=!1,s="";continue}}if(o){if(s!==u&&(s+=u),u===he){o=!1,n.processEscape(s);const f={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};if(t.onSegment?.(f,n)===!1)return;s=""}continue}r+=u;const d=t.getWidth?.(r)??0,g={isEscapeSequence:!1,isGrapheme:!0,text:r,width:d};if(l&&(g.isHyperlink=!0,g.hyperlinkUrl=i),t.onSegment?.(g,n)===!1)return;r=""}if(r){const a=t.getWidth?.(r)??0,u={isEscapeSequence:!1,isGrapheme:!0,text:r,width:a};l&&(u.isHyperlink=!0,u.hyperlinkUrl=i),t.onSegment?.(u,n)}if(s){const a={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};t.onSegment?.(a,n)}},We=e=>`${R.values().next().value}${lt}${String(e)}${he}`,Me=e=>`${R.values().next().value}${G}${e}${te}`,Br=e=>{if(e.length===0)return"";if(e.length===1)return e[0];let t="",n,r;const o=e.join(`
|
|
30
|
+
`),s=[...o];let i=0;for(const[l,c]of s.entries()){if(t+=c,R.has(c)){const u=wr.exec(o.slice(i))?.groups??{};if(u.code!==void 0){const d=Number.parseFloat(u.code);n=d===br?void 0:d}else u.uri!==void 0&&(r=u.uri.length===0?void 0:u.uri)}const a=vr.get(Number(n));s[l+1]===`
|
|
31
|
+
`?(r&&(t+=Me("")),n&&a&&(t+=We(a))):c===`
|
|
32
|
+
`&&(n&&a&&(t+=We(n)),r&&(t+=Me(r))),i+=c.length}return t},ft=/(?=\s)|(?<=\s)/,dt=/^\s+$/,_e=new Map,Lr=e=>{const t=_e.get(e);if(t!==void 0)return t;const n=k(e);return _e.set(e,n),n},se=e=>{if(!e.includes("\x1B"))return e;let t=e;return e.includes("\x1B[30m")&&(t+="\x1B[39m"),e.includes("\x1B[42m")&&(t+="\x1B[49m"),t},W=e=>{const t=e.split(" ");let n=t.length;for(;n>0&&k(t[n-1])===0;)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},gt=(e,t,n)=>{if(e.length===0)return[""];if(t<=0)return[e];const r=[],o=new ut;let s="",i=0,l=!1,c=!1,a="",u=0;for(;u<e.length;){const d=e.codePointAt(u),g=String.fromCodePoint(d),f=g.length;if(R.has(g)){l=!0,a=g,s+=g,c=e.startsWith(G,u+1),u+=1;continue}if(l){a+=g,s+=g,c?g===te&&(l=c=!1):g===he&&(l=!1,o.processEscape(a)),u+=1;continue}const h=Lr(g),p=g===" ";if(h===0){s+=g,u+=f;continue}if(i+h>t&&(s&&r.push(s+o.getEndEscapesForAllActiveAttributes()),s=o.getStartEscapesForAllActiveAttributes(),i=k(s),p&&n)){for(;u<e.length&&e[u]===" ";)u+=1;continue}if(s+=g,i+=h,i===t&&u+f<e.length&&(r.push(s+o.getEndEscapesForAllActiveAttributes()),s=o.getStartEscapesForAllActiveAttributes(),i=k(s),u+f<e.length&&e[u+f]===" "&&n)){for(u+=f;u<e.length&&e[u]===" ";)u+=1;continue}u+=f}return s&&r.push(s+o.getEndEscapesForAllActiveAttributes()),n?r.map(d=>W(d)):r},Tr=(e,t,n)=>{if(e.length===0)return[];const r=n?e.trim():e;if(r.length===0)return[];const o=[];let s="",i=0;return kr(r,{getWidth:k,onSegment:(l,c)=>{const a=l.text??"";if(l.isEscapeSequence)s+=a;else{const u=a===" ";if(l.width===0)return s+=a,!0;if(i+l.width>t&&(s&&o.push(s),s=c.getStartEscapesForAllActiveAttributes(),i=0,u))return n||o.push(c.getStartEscapesForAllActiveAttributes()+a),!0;s+=a,i+=l.width}return!0}}),s&&o.push(s),n?o.map(l=>W(l)):o},jr=(e,t,n)=>{if(e.length===0)return[];const r=n?e.trim():e;if(r.length===0)return[];const o=r.split(ft),s=[];let i="",l=0,c=0;for(;c<o.length;){const a=o[c],u=dt.test(a),d=k(a);if(a.length===0){c+=1;continue}if(n&&u&&l===0){c+=1;continue}if(l+d>t&&l>0){n?s.push(W(i)):s.push(i),i="",l=0;continue}i+=a,l+=d,c+=1}return i&&(n?s.push(W(i)):s.push(i)),s},Fr=(e,t,n)=>{if(e.length===0)return[];const r=n?e.trim():e;if(r.length===0)return[];const o=r.split(ft),s=[];let i="",l=0,c=0;for(;c<o.length;){const a=o[c],u=dt.test(a),d=k(a);if(a.length===0){c+=1;continue}if(n&&u&&l===0){c+=1;continue}if(d>t){i&&s.push(se(n?W(i):i));const g=gt(a,t,n);if(g.length>0){for(let f=0;f<g.length-1;f+=1)s.push(g[f]);i=g.at(-1),l=k(i)}else i="",l=0;c+=1;continue}if(l+d>t&&l>0&&(s.push(se(n?W(i):i)),i="",l=0,n&&u)){c+=1;continue}i+=a,l+=d,c+=1}return i&&s.push(se(n?W(i):i)),s},J={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},eo=(e,t={})=>{const{removeZeroWidthCharacters:n=!0,trim:r=!0,width:o=80,wrapMode:s=J.PRESERVE_WORDS}=t;if(r&&e.trim()==="")return"";let i=e.normalize("NFC").replaceAll(`\r
|
|
33
|
+
`,`
|
|
34
|
+
`);return n&&(i=i.replaceAll($r,"")),i.split(`
|
|
35
|
+
`).map(l=>{if(r&&l.trim()==="")return"";let c;switch(s){case J.BREAK_AT_CHARACTERS:{c=Tr(l,o,r);break}case J.BREAK_WORDS:{c=Fr(l,o,r);break}case J.STRICT_WIDTH:{c=gt(l,o,r);break}default:c=jr(l,o,r)}return Br(c)}).join(`
|
|
36
|
+
`)},ht=80,pt=24,ue=(e,t,{shell:n,env:r}={})=>wt(e,t,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:n,env:r}).trim(),X=(e,t)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(t,10)}),mt=(e,t)=>{const{columns:n,rows:r}=X(e,t);if(!(Number.isNaN(n)||Number.isNaN(r))&&!(n===ht&&r===pt))return{columns:n,rows:r}},Wr=()=>{if(I.platform!=="linux")return!0;try{const e=P.readFileSync("/proc/self/stat","utf8"),t=e.lastIndexOf(") ");if(t===-1)return!1;const n=e.slice(t+2).trim().split(/\s+/),r=Number.parseInt(n[2],10),o=Number.parseInt(n[5],10);return Number.isNaN(r)||Number.isNaN(o)||o<=0?!1:r===o}catch{return!1}};function to(){const{env:e,stdout:t,stderr:n}=I;if(t?.columns&&t?.rows)return X(t.columns,t.rows);if(n?.columns&&n?.rows)return X(n.columns,n.rows);if(e.COLUMNS&&e.LINES)return X(e.COLUMNS,e.LINES);const r={columns:ht,rows:pt};return I.platform==="win32"?ie()??r:I.platform==="darwin"?ze()??ie()??r:ze()??ie()??Mr()??r}const ze=()=>{try{const e=I.platform==="darwin"?P.constants.O_EVTONLY|P.constants.O_NONBLOCK:P.constants.O_NONBLOCK,{columns:t,rows:n}=vt.WriteStream(P.openSync("/dev/tty",e));return{columns:t,rows:n}}catch{}},ie=()=>{try{const e=ue("tput",["cols"],{env:{TERM:"dumb",...I.env}}),t=ue("tput",["lines"],{env:{TERM:"dumb",...I.env}});if(e&&t)return mt(e,t)}catch{}},Mr=()=>{try{if(!Wr())return;const e=ue("resize",["-u"]).match(/\d+/g);if(e.length===2)return mt(e[0],e[1])}catch{}},no=e=>{const t=Object.keys(e).map(n=>e[n].badge??"");return t.length===0?"":t.reduce((n,r)=>n.length>r.length?n:r,"")},{bold:_r,cyan:zr,green:Re,grey:Rr,magenta:Pr,red:Cr,yellow:le}=Pe,ro={indent:2,quoteStyle:"single",stylize:(e,t)=>{const n={bigint:le,boolean:le,date:Pr,null:_r,number:le,regexp:Cr,special:zr,string:Re,symbol:Re,undefined:Rr};return Object.hasOwn(n,t)?n[t](e):e}},{bold:Dr,underline:Vr}=Pe,oo=(e,t)=>{let n=t.uppercase.label?e.toUpperCase():e;return n=t.underline.label?Vr(n):n,t.bold.label&&(n=Dr(n)),n},Gr=e=>[e.getHours(),e.getMinutes(),e.getSeconds()].map(t=>String(t).padStart(2,"0")).join(":");class so{styles;loggerTypes;constructor(t){this.styles={bold:{label:!1},dateFormatter:Gr,underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...t},this.loggerTypes=St}setLoggerTypes(t){this.loggerTypes=t}}export{so as A,qr as E,St as L,Kr as Y,eo as Z,Yr as a,no as b,k as c,ro as d,oo as f,Jr as g,Zr as i,to as t,J as v,Xr as w,Qr as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{WideEvent as h}from"../wide-event.js";const S=r=>{let e="^",t=0;for(;t<r.length;){const s=r[t];if(s==="*"&&r[t+1]==="*")t+=2,r[t]==="/"&&(t+=1),t>=r.length&&e.endsWith("/")?e=`${e.slice(0,-1)}(/.*)?`:t>=r.length?e+=".*":e+="(.*/)?";else switch(s){case"*":{e+="[^/]*",t+=1;break}case".":{e+=String.raw`\.`,t+=1;break}case"?":{e+="[^/]",t+=1;break}default:e+=s.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`),t+=1}}return e+="$",new RegExp(e)},u=new Map,k=r=>{let e=u.get(r);return e===void 0&&(e=S(r),u.set(r,e)),e},f=(r,e)=>k(e).test(r),m=(r,e,t)=>t?.some(s=>f(r,s))?!1:e?.length?e.some(s=>f(r,s)):!0,p=(r,e)=>{if(!e)return;const t=Object.entries(e);for(let s=0;s<t.length;s+=1){const[n,o]=t[s];if(f(r,n))return o.service}},L=(r,e)=>{const{exclude:t,include:s,pail:n,routes:o,service:w}=r,{headers:g,method:a,path:i,requestId:x}=e;if(!m(i,s,t)){const l=new h({autoEmit:!1,name:`${a} ${i}`,pail:n});return{finish:()=>{},logger:l,skipped:!0}}const v=p(i,o)??w,c=new h({name:`${a} ${i}`,pail:n,service:v});return c.set({method:a,path:i,requestId:x,...g?{headers:g}:{}}),{finish:l=>{c.finish(l)},logger:c,skipped:!1}},d=new Set(["authorization","cookie","proxy-authorization","set-cookie","x-api-key","x-auth-token"]),b=r=>{const e={};return r.forEach((t,s)=>{d.has(s.toLowerCase())||(e[s.toLowerCase()]=t)}),e},C=r=>{const e={},t=Object.entries(r);for(let s=0;s<t.length;s+=1){const[n,o]=t[s];!d.has(n.toLowerCase())&&o!==void 0&&(e[n.toLowerCase()]=Array.isArray(o)?o.join(", "):o)}return e};export{C as a,L as c,b as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const O=e=>{const t=Object.keys(e).map(o=>e[o].label??"");return t.length===0?"":t.reduce((o,i)=>o.length>i.length?o:i,"")};let h;const B=()=>(h!==void 0||(h=new Map([["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["black","#000000"],["blanchedalmond","#ffebcd"],["blue","#0000ff"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["fuchsia","#ff00ff"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["gray","#808080"],["green","#008000"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["lime","#00ff00"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["maroon","#800000"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["navy","#000080"],["oldlace","#fdf5e6"],["olive","#808000"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#ff0000"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["silver","#c0c0c0"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["teal","#008080"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["white","#ffffff"],["whitesmoke","#f5f5f5"],["yellow","#ffff00"],["yellowgreen","#9acd32"]])),h),$=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,A=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,v=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,S=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,x=()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),y=/\s+/,m=e=>{const t=B();t.has(e)&&(e=t.get(e));const o=$.exec(e);if(o)return[Number.parseInt(o[1],16),Number.parseInt(o[2],16),Number.parseInt(o[3],16)];const i=A.exec(e);if(i)return[Number.parseInt(`${i[1]}${i[1]}`,16),Number.parseInt(`${i[2]}${i[2]}`,16),Number.parseInt(`${i[3]}${i[3]}`,16)];const f=v.exec(e);if(f)return[Math.round(Math.max(0,Math.min(255,Number(f[1])))),Math.round(Math.max(0,Math.min(255,Number(f[2])))),Math.round(Math.max(0,Math.min(255,Number(f[3]))))];const r=S.exec(e);if(r){let a=Number(r[1])%360;a<0&&(a+=360);const l=Math.max(0,Math.min(100,Number(r[2])))/100,d=Math.max(0,Math.min(100,Number(r[3])))/100,u=(1-Math.abs(2*d-1))*l,b=u*(1-Math.abs(a/60%2-1)),n=d-u/2;let s,c,g;return a<60?{0:s,1:c,2:g}=[u,b,0]:a<120?{0:s,1:c,2:g}=[b,u,0]:a<180?{0:s,1:c,2:g}=[0,u,b]:a<240?{0:s,1:c,2:g}=[0,b,u]:a<300?{0:s,1:c,2:g}=[b,0,u]:{0:s,1:c,2:g}=[u,0,b],[Math.round((s+n)*255),Math.round((c+n)*255),Math.round((g+n)*255)]}return null},k=(e,t)=>typeof e=="string"||typeof t=="string"?e===t:e?.[0]===t?.[0]&&e?.[1]===t?.[1]&&e?.[2]===t?.[2],D=e=>{if(typeof e!="string")return x();const t=x(),o=[];let i=!1,f=null,r=0,a="";for(const l of e){if(l==="(")r+=1;else if(r>0)l===")"&&(r-=1);else if(i){if(l===";"){const d=a.trim();d!==""&&o.push([f,d]),f=null,a="",i=!1;continue}}else if(l===":"){f=a.trim(),a="",i=!0;continue}a+=l}if(i&&r===0){const l=a.trim();l!==""&&o.push([f,l]),f=null,a=""}for(const{0:l,1:d}of o)switch(l){case"background-color":{d!=null&&(t.backgroundColor=d);break}case"color":{d!=null&&(t.color=d);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(d)&&(t.fontStyle="italic");break}case"font-weight":{d==="bold"&&(t.fontWeight=d);break}case"text-decoration":{t.textDecorationColor=null,t.textDecorationLine=[];const u=d.split(y);for(const b of u){const n=m(b);n!=null?t.textDecorationColor=n:["line-through","overline","underline"].includes(b)&&t.textDecorationLine.push(b)}break}case"text-decoration-color":{const u=m(d);u!=null&&(t.textDecorationColor=u);break}case"text-decoration-line":{t.textDecorationLine=[];const u=d.split(y);for(const b of u)["line-through","overline","underline"].includes(b)&&t.textDecorationLine.push(b);break}}return t},M=(e,t)=>{t=t??x();let o="";if(!k(e.backgroundColor,t.backgroundColor))if(e.backgroundColor==null)o+="\x1B[49m";else switch(e.backgroundColor){case"black":{o+="\x1B[40m";break}case"blue":{o+="\x1B[44m";break}case"cyan":{o+="\x1B[46m";break}case"green":{o+="\x1B[42m";break}case"magenta":{o+="\x1B[45m";break}case"red":{o+="\x1B[41m";break}case"white":{o+="\x1B[47m";break}case"yellow":{o+="\x1B[43m";break}default:if(Array.isArray(e.backgroundColor)){const{0:i,1:f,2:r}=e.backgroundColor;o+=`\x1B[48;2;${String(i)};${String(f)};${String(r)}m`}else{const i=m(e.backgroundColor);if(i===null)o+="\x1B[49m";else{const{0:f,1:r,2:a}=i;o+=`\x1B[48;2;${String(f)};${String(r)};${String(a)}m`}}}if(!k(e.color,t.color))if(e.color==null)o+="\x1B[39m";else switch(e.color){case"black":{o+="\x1B[30m";break}case"blue":{o+="\x1B[34m";break}case"cyan":{o+="\x1B[36m";break}case"green":{o+="\x1B[32m";break}case"magenta":{o+="\x1B[35m";break}case"red":{o+="\x1B[31m";break}case"white":{o+="\x1B[37m";break}case"yellow":{o+="\x1B[33m";break}default:if(Array.isArray(e.color)){const{0:i,1:f,2:r}=e.color;o+=`\x1B[38;2;${String(i)};${String(f)};${String(r)}m`}else{const i=m(e.color);if(i===null)o+="\x1B[39m";else{const{0:f,1:r,2:a}=i;o+=`\x1B[38;2;${String(f)};${String(r)};${String(a)}m`}}}if(e.fontWeight!==t.fontWeight&&(o+=e.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),e.fontStyle!==t.fontStyle&&(o+=e.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!k(e.textDecorationColor,t.textDecorationColor))if(e.textDecorationColor==null)o+="\x1B[59m";else{const{0:i,1:f,2:r}=e.textDecorationColor;o+=`\x1B[58;2;${String(i)};${String(f)};${String(r)}m`}return e.textDecorationLine.includes("line-through")!==t.textDecorationLine.includes("line-through")&&(o+=e.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),e.textDecorationLine.includes("overline")!==t.textDecorationLine.includes("overline")&&(o+=e.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),e.textDecorationLine.includes("underline")!==t.textDecorationLine.includes("underline")&&(o+=e.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),o},N=e=>{try{return JSON.stringify(e)}catch{return'"[Circular]"'}},p="%".codePointAt(0),C="s".codePointAt(0),L="d".codePointAt(0),F="f".codePointAt(0),P="i".codePointAt(0),j="O".codePointAt(0),q="o".codePointAt(0),E="j".codePointAt(0),I="c".codePointAt(0),w=(e,t=[],o={})=>{if(typeof e!="string"&&typeof e!="object"||e===null)throw new TypeError(`fmt must be a string or object, got ${e===null?"null":typeof e}`);const i=o.stringify??N,f=1;if(typeof e=="object"){const n=t.length+f;if(n===1)return"{}";const s=Array.from({length:n});s[0]=i(e);for(let c=1;c<n;c+=1)s[c]=i(t[c-f]);return s.join(" ")}if(t.length===0)return e;let r="",a=1-f,l=-1,d=!1,u;const b=o.colors??globalThis.window===void 0;for(let n=0;n<e.length;){if(e.codePointAt(n)===p&&n+1<e.length){l=l>-1?l:0;const s=e.codePointAt(n+1);switch(s){case I:{if(l<n&&(r+=e.slice(l,n)),b){const c=D(t[a]),g=M(c,u);r+=g,g!==""&&(d=!0,u=c)}l=n+2,n+=1;break}case L:case F:{const c=t[a];if(a>=t.length||c==null)break;l<n&&(r+=e.slice(l,n)),r+=(typeof c=="symbol"?Number.NaN:Number(c)).toString(),l=n+2,n+=1;break}case P:{const c=t[a];if(a>=t.length||c==null)break;l<n&&(r+=e.slice(l,n)),r+=Math.floor(typeof c=="symbol"?Number.NaN:Number(c)).toString(),l=n+2,n+=1;break}case E:case j:case q:{if(a>=t.length||t[a]===void 0)break;l<n&&(r+=e.slice(l,n));const c=t[a],g=typeof c;if(g==="string"){r+=`'${c}'`,l=n+2,n+=1;break}if(g==="function"){r+=c.name?`[Function: ${c.name}]`:"[Function: <anonymous>]",l=n+2,n+=1;break}r+=i(c),l=n+2,n+=1;break}case p:{l<n&&(r+=e.slice(l,n)),r+="%",l=n+2,n+=1,a-=1;break}case C:{if(a>=t.length)break;l<n&&(r+=e.slice(l,n));const c=t[a];r+=typeof c=="object"&&c!==null?i(c):String(c),l=n+2,n+=1;break}default:typeof o.formatters?.[s]=="function"?(l<n&&(r+=e.slice(l,n)),r+=o.formatters[s](t[a]),l=n+2,n+=1):a-=1}a+=1}n+=1}if(l===-1&&!(o.appendExtraArguments&&a<t.length))return e;if(l===-1?r=e:l<e.length&&(r+=e.slice(l)),l!==-1&&d&&(r+="\x1B[0m"),o.appendExtraArguments&&a<t.length)for(let n=Math.max(a,0);n<t.length;n+=1){const s=t[n];r+=` ${typeof s=="object"&&s!==null?i(s):String(s)}`}return r},W=(e={})=>{const t={};typeof e.formatters=="object"&&Object.entries(e.formatters).forEach(([f,r])=>{if(f.length===0)throw new Error(`Formatter %${f} has no characters`);if(f.length>1)throw new Error(`Formatter %${f} has more than one character`);if(typeof r!="function")throw new TypeError(`Formatter for %${f} is not a function`);const a=f.codePointAt(0);if(a===void 0)throw new Error(`${f}.codePointAt(0) failed to return a value, please report this issue`);t[a]=r});const o={...e};delete o.formatters;const i=Object.freeze({...o,formatters:t});return(f,r=[],a)=>a===void 0?w(f,r,i):w(f,r,{...o,...a,formatters:t})};export{W as O,O as g,w as y};
|
|
1
|
+
const O=e=>{const t=Object.keys(e).map(o=>e[o].label??"");return t.length===0?"":t.reduce((o,i)=>o.length>i.length?o:i,"")};let h;const B=()=>(h!==void 0||(h=new Map([["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["black","#000000"],["blanchedalmond","#ffebcd"],["blue","#0000ff"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["fuchsia","#ff00ff"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["gray","#808080"],["green","#008000"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["lime","#00ff00"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["maroon","#800000"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["navy","#000080"],["oldlace","#fdf5e6"],["olive","#808000"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#ff0000"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["silver","#c0c0c0"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["teal","#008080"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["white","#ffffff"],["whitesmoke","#f5f5f5"],["yellow","#ffff00"],["yellowgreen","#9acd32"]])),h),$=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,A=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,v=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,S=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,x=()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),y=/\s+/,m=e=>{const t=B();t.has(e)&&(e=t.get(e));const o=$.exec(e);if(o)return[Number.parseInt(o[1],16),Number.parseInt(o[2],16),Number.parseInt(o[3],16)];const i=A.exec(e);if(i)return[Number.parseInt(`${i[1]}${i[1]}`,16),Number.parseInt(`${i[2]}${i[2]}`,16),Number.parseInt(`${i[3]}${i[3]}`,16)];const f=v.exec(e);if(f)return[Math.round(Math.max(0,Math.min(255,Number(f[1])))),Math.round(Math.max(0,Math.min(255,Number(f[2])))),Math.round(Math.max(0,Math.min(255,Number(f[3]))))];const n=S.exec(e);if(n){let a=Number(n[1])%360;a<0&&(a+=360);const l=Math.max(0,Math.min(100,Number(n[2])))/100,d=Math.max(0,Math.min(100,Number(n[3])))/100,u=(1-Math.abs(2*d-1))*l,b=u*(1-Math.abs(a/60%2-1)),r=d-u/2;let s,c,g;return a<60?{0:s,1:c,2:g}=[u,b,0]:a<120?{0:s,1:c,2:g}=[b,u,0]:a<180?{0:s,1:c,2:g}=[0,u,b]:a<240?{0:s,1:c,2:g}=[0,b,u]:a<300?{0:s,1:c,2:g}=[b,0,u]:{0:s,1:c,2:g}=[u,0,b],[Math.round((s+r)*255),Math.round((c+r)*255),Math.round((g+r)*255)]}return null},k=(e,t)=>typeof e=="string"||typeof t=="string"?e===t:e?.[0]===t?.[0]&&e?.[1]===t?.[1]&&e?.[2]===t?.[2],D=e=>{if(typeof e!="string")return x();const t=x(),o=[];let i=!1,f=null,n=0,a="";for(const l of e){if(l==="(")n+=1;else if(n>0)l===")"&&(n-=1);else if(i){if(l===";"){const d=a.trim();d!==""&&o.push([f,d]),f=null,a="",i=!1;continue}}else if(l===":"){f=a.trim(),a="",i=!0;continue}a+=l}if(i&&n===0){const l=a.trim();l!==""&&o.push([f,l]),f=null,a=""}for(const{0:l,1:d}of o)switch(l){case"background-color":{d!=null&&(t.backgroundColor=d);break}case"color":{d!=null&&(t.color=d);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(d)&&(t.fontStyle="italic");break}case"font-weight":{d==="bold"&&(t.fontWeight=d);break}case"text-decoration":{t.textDecorationColor=null,t.textDecorationLine=[];const u=d.split(y);for(const b of u){const r=m(b);r!=null?t.textDecorationColor=r:["line-through","overline","underline"].includes(b)&&t.textDecorationLine.push(b)}break}case"text-decoration-color":{const u=m(d);u!=null&&(t.textDecorationColor=u);break}case"text-decoration-line":{t.textDecorationLine=[];const u=d.split(y);for(const b of u)["line-through","overline","underline"].includes(b)&&t.textDecorationLine.push(b);break}}return t},M=(e,t)=>{t=t??x();let o="";if(!k(e.backgroundColor,t.backgroundColor))if(e.backgroundColor==null)o+="\x1B[49m";else switch(e.backgroundColor){case"black":{o+="\x1B[40m";break}case"blue":{o+="\x1B[44m";break}case"cyan":{o+="\x1B[46m";break}case"green":{o+="\x1B[42m";break}case"magenta":{o+="\x1B[45m";break}case"red":{o+="\x1B[41m";break}case"white":{o+="\x1B[47m";break}case"yellow":{o+="\x1B[43m";break}default:if(Array.isArray(e.backgroundColor)){const{0:i,1:f,2:n}=e.backgroundColor;o+=`\x1B[48;2;${String(i)};${String(f)};${String(n)}m`}else{const i=m(e.backgroundColor);if(i===null)o+="\x1B[49m";else{const{0:f,1:n,2:a}=i;o+=`\x1B[48;2;${String(f)};${String(n)};${String(a)}m`}}}if(!k(e.color,t.color))if(e.color==null)o+="\x1B[39m";else switch(e.color){case"black":{o+="\x1B[30m";break}case"blue":{o+="\x1B[34m";break}case"cyan":{o+="\x1B[36m";break}case"green":{o+="\x1B[32m";break}case"magenta":{o+="\x1B[35m";break}case"red":{o+="\x1B[31m";break}case"white":{o+="\x1B[37m";break}case"yellow":{o+="\x1B[33m";break}default:if(Array.isArray(e.color)){const{0:i,1:f,2:n}=e.color;o+=`\x1B[38;2;${String(i)};${String(f)};${String(n)}m`}else{const i=m(e.color);if(i===null)o+="\x1B[39m";else{const{0:f,1:n,2:a}=i;o+=`\x1B[38;2;${String(f)};${String(n)};${String(a)}m`}}}if(e.fontWeight!==t.fontWeight&&(o+=e.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),e.fontStyle!==t.fontStyle&&(o+=e.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!k(e.textDecorationColor,t.textDecorationColor))if(e.textDecorationColor==null)o+="\x1B[59m";else{const{0:i,1:f,2:n}=e.textDecorationColor;o+=`\x1B[58;2;${String(i)};${String(f)};${String(n)}m`}return e.textDecorationLine.includes("line-through")!==t.textDecorationLine.includes("line-through")&&(o+=e.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),e.textDecorationLine.includes("overline")!==t.textDecorationLine.includes("overline")&&(o+=e.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),e.textDecorationLine.includes("underline")!==t.textDecorationLine.includes("underline")&&(o+=e.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),o},N=e=>{try{return JSON.stringify(e)}catch{return'"[Circular]"'}},p="%".codePointAt(0),C="s".codePointAt(0),L="d".codePointAt(0),P="f".codePointAt(0),j="i".codePointAt(0),F="O".codePointAt(0),q="o".codePointAt(0),E="j".codePointAt(0),I="c".codePointAt(0),w=(e,t=[],o={})=>{if(typeof e!="string"&&typeof e!="object"||e===null)throw new TypeError(`fmt must be a string or object, got ${e===null?"null":typeof e}`);const i=o.stringify??N,f=1;if(typeof e=="object"){const r=t.length+f;if(r===1)return"{}";const s=Array.from({length:r});s[0]=i(e);for(let c=1;c<r;c+=1)s[c]=i(t[c-f]);return s.join(" ")}if(t.length===0)return e;let n="",a=1-f,l=-1,d=!1,u;const b=o.colors??globalThis.window===void 0;for(let r=0;r<e.length;){if(e.codePointAt(r)===p&&r+1<e.length){l=l>-1?l:0;const s=e.codePointAt(r+1);switch(s){case I:{if(l<r&&(n+=e.slice(l,r)),b){const c=D(t[a]),g=M(c,u);n+=g,g!==""&&(d=!0,u=c)}l=r+2,r+=1;break}case L:case P:{const c=t[a];if(a>=t.length||c==null)break;l<r&&(n+=e.slice(l,r)),n+=(typeof c=="symbol"?Number.NaN:Number(c)).toString(),l=r+2,r+=1;break}case j:{const c=t[a];if(a>=t.length||c==null)break;l<r&&(n+=e.slice(l,r)),n+=Math.floor(typeof c=="symbol"?Number.NaN:Number(c)).toString(),l=r+2,r+=1;break}case E:case F:case q:{if(a>=t.length||t[a]===void 0)break;l<r&&(n+=e.slice(l,r));const c=t[a],g=typeof c;if(g==="string"){n+=`'${c}'`,l=r+2,r+=1;break}if(g==="function"){n+=c.name?`[Function: ${c.name}]`:"[Function: <anonymous>]",l=r+2,r+=1;break}n+=i(c),l=r+2,r+=1;break}case p:{l<r&&(n+=e.slice(l,r)),n+="%",l=r+2,r+=1,a-=1;break}case C:{if(a>=t.length)break;l<r&&(n+=e.slice(l,r));const c=t[a];n+=typeof c=="object"&&c!==null?i(c):String(c),l=r+2,r+=1;break}default:typeof o.formatters?.[s]=="function"?(l<r&&(n+=e.slice(l,r)),n+=o.formatters[s](t[a]),l=r+2,r+=1):a-=1}a+=1}r+=1}if(l===-1&&!(o.appendExtraArguments&&a<t.length))return e;if(l===-1?n=e:l<e.length&&(n+=e.slice(l)),l!==-1&&d&&(n+="\x1B[0m"),o.appendExtraArguments&&a<t.length)for(let r=Math.max(a,0);r<t.length;r+=1){const s=t[r];n+=` ${typeof s=="object"&&s!==null?i(s):String(s)}`}return n},W=(e={})=>{const t={};typeof e.formatters=="object"&&Object.entries(e.formatters).forEach(([f,n])=>{if(f.length===0)throw new Error(`Formatter %${f} has no characters`);if(f.length>1)throw new Error(`Formatter %${f} has more than one character`);if(typeof n!="function")throw new TypeError(`Formatter for %${f} is not a function`);const a=f.codePointAt(0);if(a===void 0)throw new Error(`${f}.codePointAt(0) failed to return a value, please report this issue`);t[a]=n});const o={...e};delete o.formatters;const i=Object.freeze({...o,formatters:t});return(f,n=[],a)=>a===void 0?w(f,n,i):w(f,n,{...o,...a,formatters:t})};export{O as g,W as q,w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=/\*+/g,u=(e,o)=>{const{exclude:l,include:s}=o??{};return t=>{const a=t.nextUrl.pathname;if(l?.some(n=>a.startsWith(n.replaceAll(i,"")))||s?.length&&!s.some(n=>a.startsWith(n.replaceAll(i,""))))return e.next();const d=t.headers.get("x-request-id")??crypto.randomUUID(),r=new Headers(t.headers);r.set("x-request-id",d),r.set("x-pail-start",String(Date.now()));const c=e.next({request:{headers:r}});return c.headers.set("x-request-id",d),c}};export{u as pailMiddleware};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const p=Object.create({},{cause:{enumerable:!1,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!1,value:void 0,writable:!0},message:{enumerable:!1,value:void 0,writable:!0},name:{enumerable:!1,value:void 0,writable:!0},stack:{enumerable:!1,value:void 0,writable:!0}}),m=e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},s=new WeakSet,y=e=>{if(Object.hasOwn(e,"name")&&typeof e.name=="string"&&e.name!=="")return e.name;const r=e.constructor?.name;return typeof r=="string"&&r!==""?r:e.name},f=e=>{const r=Object.getOwnPropertyNames(e);for(const o of r){const t=Object.getOwnPropertyDescriptor(e,o);t&&(t.enumerable||Object.defineProperty(e,o,{...t,enumerable:!0}),t.value&&typeof t.value=="object"&&!Array.isArray(t.value)&&(Object.getPrototypeOf(t.value)===Object.prototype||Object.getPrototypeOf(t.value)===null)&&f(t.value))}},O=e=>{s.add(e);const r=e.toJSON();return s.delete(e),Object.isExtensible(r)&&f(r),r},i=(e,r,o,t,n=new Set)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&"pipe"in e&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return r.has(e)?"[Circular]":(o+=1,l(e,t,r,o));if(t.useToJSON&&e!==null&&typeof e=="object"&&"toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();if(e instanceof Date)return e.toISOString();if(e instanceof RegExp)return e.toString();if(typeof URL<"u"&&e instanceof URL)return e.href;if(e instanceof Map){const u=[];for(const[a,c]of e.entries())u.push([i(a,r,o,t,n),i(c,r,o,t,n)]);return{__dataType:"Map",value:u}}if(e instanceof Set){const u=[];for(const a of e.values())u.push(i(a,r,o,t,n));return{__dataType:"Set",value:u}}if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${String(e)}n`;if(m(e)){if(n.has(e))return"[Circular]";if(t.maxDepth!==void 0&&t.maxDepth!==Number.POSITIVE_INFINITY&&o+1>=t.maxDepth)return{};o+=1,n.add(e);const u={};for(const a in e)u[a]=i(e[a],r,o,t,n);return n.delete(e),u}try{return e}catch{return"[Not Available]"}},l=(e,r,o,t)=>{if(o.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!s.has(e))return O(e);const n=Object.create(p);if(Object.defineProperty(n,"name",{configurable:!0,enumerable:!0,value:y(e),writable:!0}),Object.defineProperty(n,"message",{configurable:!0,enumerable:!0,value:e.message,writable:!0}),Object.defineProperty(n,"stack",{configurable:!0,enumerable:!0,value:e.stack,writable:!0}),Array.isArray(e.errors)){const a=[];for(const c of e.errors){if(!(c instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(o.has(c))return Object.defineProperty(n,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),n;a.push(l(c,r,o,t))}Object.defineProperty(n,"errors",{configurable:!0,enumerable:!0,value:a,writable:!0})}const u=e.cause;if(u!=null)if(u instanceof Error)o.has(u)?Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:l(u,r,o,t),writable:!0});else{const a=i(u,o,t,r);Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:a,writable:!0})}for(const a in e){if(a==="name"||a==="message"||a==="stack"||a==="cause"||a==="errors")continue;const c=e[a],b=i(c,o,t,r);Object.defineProperty(n,a,{configurable:!0,enumerable:!0,value:b,writable:!0})}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const a of r.exclude)try{delete n[a]}catch{}return n},d=(e,r={})=>l(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0);export{d as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as n}from"node:module";let c;const i=e=>(c??=n(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,s]=r.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return r.getBuiltinModule(e)}return i(e)},{AsyncLocalStorage:g}=u("node:async_hooks"),l=e=>{const o=new g;return{storage:o,useLogger:()=>{const t=o.getStore();if(!t)throw new Error(`[pail] useLogger() called outside of ${e}`);return t}}};export{l as c};
|
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
import { AnsiColors } from '@visulima/colorize';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
4
|
+
|
|
5
|
+
@category Type
|
|
6
|
+
*/
|
|
7
|
+
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
8
|
+
/**
|
|
9
|
+
Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
|
10
|
+
|
|
11
|
+
Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
|
|
12
|
+
|
|
13
|
+
This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
|
|
14
|
+
|
|
15
|
+
@example
|
|
16
|
+
```
|
|
17
|
+
import type {LiteralUnion} from 'type-fest';
|
|
18
|
+
|
|
19
|
+
// Before
|
|
20
|
+
|
|
21
|
+
type Pet = 'dog' | 'cat' | string;
|
|
22
|
+
|
|
23
|
+
const petWithoutAutocomplete: Pet = '';
|
|
24
|
+
// Start typing in your TypeScript-enabled IDE.
|
|
25
|
+
// You **will not** get auto-completion for `dog` and `cat` literals.
|
|
26
|
+
|
|
27
|
+
// After
|
|
28
|
+
|
|
29
|
+
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
|
30
|
+
|
|
31
|
+
const petWithAutoComplete: Pet2 = '';
|
|
32
|
+
// You **will** get auto-completion for `dog` and `cat` literals.
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
@category Type
|
|
36
|
+
*/
|
|
37
|
+
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
4
38
|
/**
|
|
5
39
|
* Global namespace for extending Pail's metadata interface.
|
|
6
40
|
*
|
|
@@ -191,4 +225,4 @@ type Message = {
|
|
|
191
225
|
prefix?: string;
|
|
192
226
|
suffix?: string;
|
|
193
227
|
};
|
|
194
|
-
export { ConstructorOptions as C, DefaultLogTypes as D, ExtendedRfc5424LogLevels as E,
|
|
228
|
+
export { ConstructorOptions as C, DefaultLogTypes as D, ExtendedRfc5424LogLevels as E, LiteralUnion as L, Meta as M, Processor as P, ReadonlyMeta as R, StringifyAwareReporter as S, LoggerTypesConfig as a, LoggerTypesAwareReporter as b, Reporter as c, LoggerFunction as d, DefaultLoggerTypes as e, LoggerConfiguration as f, StreamAwareReporter as g };
|
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
import { AnsiColors } from '@visulima/colorize';
|
|
2
2
|
import { InteractiveManager } from '@visulima/interactive-manager';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
5
|
+
|
|
6
|
+
@category Type
|
|
7
|
+
*/
|
|
8
|
+
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
9
|
+
/**
|
|
10
|
+
Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
|
11
|
+
|
|
12
|
+
Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
|
|
13
|
+
|
|
14
|
+
This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
|
|
15
|
+
|
|
16
|
+
@example
|
|
17
|
+
```
|
|
18
|
+
import type {LiteralUnion} from 'type-fest';
|
|
19
|
+
|
|
20
|
+
// Before
|
|
21
|
+
|
|
22
|
+
type Pet = 'dog' | 'cat' | string;
|
|
23
|
+
|
|
24
|
+
const petWithoutAutocomplete: Pet = '';
|
|
25
|
+
// Start typing in your TypeScript-enabled IDE.
|
|
26
|
+
// You **will not** get auto-completion for `dog` and `cat` literals.
|
|
27
|
+
|
|
28
|
+
// After
|
|
29
|
+
|
|
30
|
+
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
|
31
|
+
|
|
32
|
+
const petWithAutoComplete: Pet2 = '';
|
|
33
|
+
// You **will** get auto-completion for `dog` and `cat` literals.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
@category Type
|
|
37
|
+
*/
|
|
38
|
+
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
4
39
|
/**
|
|
5
40
|
* Global namespace for extending Pail's metadata interface.
|
|
6
41
|
*
|
|
@@ -198,4 +233,4 @@ type Message = {
|
|
|
198
233
|
prefix?: string;
|
|
199
234
|
suffix?: string;
|
|
200
235
|
};
|
|
201
|
-
export { ConstructorOptions as C, DefaultLogTypes as D, ExtendedRfc5424LogLevels as E, InteractiveStreamReporter as I,
|
|
236
|
+
export { ConstructorOptions as C, DefaultLogTypes as D, ExtendedRfc5424LogLevels as E, InteractiveStreamReporter as I, LiteralUnion as L, Meta as M, Processor as P, Reporter as R, ServerConstructorOptions as S, LoggerTypesConfig as a, LoggerFunction as b, DefaultLoggerTypes as c, LoggerConfiguration as d, LoggerTypesAwareReporter as e, StreamAwareReporter as f, ReadonlyMeta as g };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as s}from"node:module";let
|
|
1
|
+
import{createRequire as s}from"node:module";let n;const i=e=>(n??=s(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[r,t]=o.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return o.getBuiltinModule(e)}return i(e)},{AsyncLocalStorage:a}=c("node:async_hooks"),l=new a,_=()=>{const e=l.getStore();if(!e)throw new Error("[pail] useLogger() called outside of withPail() context. Wrap your route handler or server action with withPail().");return e};export{l as pailStorage,_ as useLogger};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=new Set(["alert","critical","emergency","error"]),n=e=>{const r=console;return o.has(e)?r.__error??console.error:e==="warning"?r.__warn??console.warn:e==="trace"?r.__trace??console.trace:r.__log??console.log};export{n as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=new Set(["alert","critical","emergency","error","trace","warning"]),n=r=>t.has(r),c=(r,e)=>e?(e.__write??e.write.bind(e)).call(e,r):!1;export{n as i,c as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o=()=>{const t=Error.prepareStackTrace;try{let n=[];Error.prepareStackTrace=(l,e)=>{const a=e.slice(1);return n=a,a},new Error().stack;const r=n.reduce((l,e)=>(e.isNative()||e.getFileName()?.includes("pail/dist")||l.push({columnNumber:e.getColumnNumber(),fileName:e.getFileName()??void 0,lineNumber:e.getLineNumber()}),l),[]).at(0);return r?{columnNumber:r.columnNumber??void 0,fileName:r.fileName,lineNumber:r.lineNumber??void 0}:{fileName:"anonymous",lineNumber:void 0}}finally{Error.prepareStackTrace=t}};class u{process(n){const{columnNumber:i,fileName:r,lineNumber:l}=o();return n.file={column:i,line:l,name:r},n}}export{u as default};
|