@visulima/pail 4.1.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/LICENSE.md +5 -811
- 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-B3yHM4Cb.js +47 -0
- package/dist/packem_shared/PrettyReporter-ClyBiPyQ.js +5 -0
- package/dist/packem_shared/abstract-pretty-reporter-C1W1vIw-.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{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 Et}from"node:module";import te from"@visulima/colorize";import{L as jt,E as Mt}from"./constants-ep2nsfdy.js";import{i as Ft,w as Wt}from"./write-stream-D2XwCKdN.js";let It;const Nt=e=>(It??=Et(import.meta.url))(e),C=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:T,$e=e=>{if(typeof C<"u"&&C.versions&&C.versions.node){const[t,n]=C.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return C.getBuiltinModule(e)}return Nt(e)},T=C,{stdout:Ot,stderr:kt}=T,{execFileSync:Tt}=$e("node:child_process"),V=$e("node:fs"),Bt=$e("node:tty"),Lt=globalThis.process??Object.create(null),ve={versions:{}},G=new Proxy(Lt,{get(e,t){if(t in e)return e[t];if(t in ve)return ve[t]}}),ne=e=>{let t;return()=>{if(t===void 0){if(typeof G.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=G.getBuiltinModule(e)}return t}},_t=e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
+
`),zt=(e,t,n,r)=>{const i={column:0,line:-1,...e.start},s={...i,...e.end},o=i.line,c=i.column,l=s.line,a=s.column;let u=Math.max(o-(n+1),0),d=Math.min(t.length,l+r);o===-1&&(u=0),l===-1&&(d=t.length);const h=l-o,f={};if(h)for(let p=0;p<=h;p++){const g=p+o;if(!c)f[g]=!0;else if(p===0){const m=t[g-1]?.length;f[g]=[c,(m??0)-c+1]}else if(p===h)f[g]=[0,a];else{const m=t[g-p]?.length;f[g]=[0,m]}}else c===a?f[o]=c?[c,0]:!0:f[o]=[c,(a??0)-(c??0)];return{end:d,markerLines:f,start:u}},Rt=G.platform==="win32"&&!G.env?.WT_SESSION?">":"❯",Ct=(e,t,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}},i=typeof t.start.column=="number";let s=(e.includes("\r")?_t(e):e).split(`
|
|
3
|
+
`);typeof r.tabWidth=="number"&&e.includes(" ")&&(s=s.map(p=>p.replaceAll(" "," ".repeat(r.tabWidth))));const{end:o,markerLines:c,start:l}=zt(t,s,r.linesAbove,r.linesBelow),a=String(o).length,{gutter:u,marker:d,message:h}=r.color;let f=s.slice(l,o).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(Rt),u(y),p.length>0?` ${p}`:"",v].join("")}return`${r.prefix} ${u(y)}${p.length>0?` ${p}`:""}`}).join(`
|
|
5
|
+
`);return r.message&&!i&&(f=`${r.prefix+" ".repeat(a+1)+r.message}
|
|
6
|
+
${f}`),f},Pt=()=>G.env?.DEBUG==="true",z=(e,...t)=>{if(Pt()){const n=t.map(r=>typeof r=="function"?r():r);console.debug(`error:parse-stacktrace: ${e}`,...n)}},R="<unknown>",Vt=/^(?:node:internal\/|node:|internal\/)/,Dt=e=>e!==void 0&&Vt.test(e),Gt=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ht=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,Ut=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,Yt=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,qt=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Jt=/in\s(.*)\s\(at\s(.+)\)\sat/,Kt=/^(?:.*@)?(.*):(\d+):(\d+)$/,Xt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Zt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Qt=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,Ae=/\(error: ([^)]*)\)/,en=/at\s/,tn=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,nn=/Error: |AggregateError:/,Je=/^Anonymous function$/,rn=/^\s*in\s.*/,sn=/^.*?\s*at\s.*/,on=/^.*?\s*@.*|\[native code\]/,Ke=(e,t)=>{const n=e.includes("safari-extension"),r=e.includes("safari-web-extension");return n||r?[e.includes("@")?e.split("@")[0]:R,n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Xe=(e,t)=>{const n=Ut.exec(t);n&&(e.file=n[1],e.line=+n[2],e.column=+n[3])},cn=e=>{const t=Jt.exec(e);if(t){z(`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]??R,raw:e,type:void 0}}const n=qt.exec(e);if(n){z(`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(en,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??R,raw:e,type:e.startsWith("internal")?"internal":void 0};return Xe(r,`${n[2]}:${n[3]}:${n[4]}`),r}},ln=e=>{const t=Gt.exec(e);if(t){z(`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 i,s;if(r){const a=Ht.exec(e);if(a){const u=tn.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]&&(i={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=Yt.exec(e);u&&(s={column:u[4]?+u[4]:void 0,file:u[2],line:u[3]?+u[3]:void 0},i={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[o,c]=Ke(t[1]?t[1].replace(Je,"<anonymous>"):R,t[2]),l={column:t[4]?+t[4]:void 0,evalOrigin:i,file:c,line:t[3]?+t[3]:void 0,methodName:o,raw:e,type:r?"eval":n?"native":Dt(c)?"internal":void 0};return s?(l.column=s.column,l.file=s.file,l.line=s.line):Xe(l,`${c}:${t[3]}:${t[4]}`),l}},an=(e,t)=>{const n=Xt.exec(e);if(n){z(`parse gecko error stack line: "${e}"`,()=>`found: ${JSON.stringify(n)}`);const r=n[3]?.includes(" > eval"),i=r&&n[3]&&Zt.exec(n[3]);let s;r&&i&&(n[3]=i[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]=i[2]);const[o,c]=Ke(n[1]?n[1].replace(Je,"<anonymous>"):R,n[3]);let l;(t?.type==="safari"||!r&&t?.type==="firefox")&&t.column?l=t.column:!r&&n[5]&&(l=+n[5]);let a;return(t?.type==="safari"||!r&&t?.type==="firefox")&&t.line?a=t.line:n[4]&&(a=+n[4]),{column:l,evalOrigin:s,file:c,line:a,methodName:o,raw:e,type:r?"eval":c.includes("[native code]")?"native":void 0}}},un=(e,t)=>{const n=Qt.exec(e);if(!(n&&n[2].includes(" > eval"))&&n)return z(`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]||R,raw:e,type:void 0}},fn=e=>{const t=Kt.exec(e);if(t)return z(`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:R,raw:e,type:void 0}},Ze=(e,{filter:t,frameLimit:n=50}={})=>{const r=e;let i=(typeof r.stacktrace=="string"?r.stacktrace:e.stack??"").split(`
|
|
7
|
+
`).map(s=>(Ae.test(s)?s.replace(Ae,"$1"):s).trim()).filter(s=>!nn.test(s)&&s!=="eval code");return t&&(i=i.filter(s=>t(s))),i=i.slice(0,n),i.reduce((s,o,c)=>{if(!o||o.length>1024)return s;let l;if(rn.test(o))l=cn(o);else if(sn.test(o))l=ln(o);else if(on.test(o)){let a;if(c===0){const u=e,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(o,a)??an(o,a)}else l=fn(o);return l?s.push(l):z(`parse error stack line: "${o}"`,"not parser found"),s},[])},xe=ne("node:fs"),Z=ne("node:path"),dn=ne("node:process"),hn=ne("node:url"),M=(e,t,n)=>n===0?e:t===" "?e+" ".repeat(n):e+" ".repeat(t*n),Qe=e=>e.replaceAll("\\","/"),pn=e=>{if(!e.startsWith("file:"))return e;try{return hn().fileURLToPath(e)}catch{return e}},gn=(e,t)=>{const n=e.replace("async file:","file:");return Qe(Z().relative(t,pn(n)))},mn=(e,t,n)=>{if(t)return n.title(e.message);const r=e.message?`: ${e.message}`:"";return n.title(e.name+r)},et=(e,{color:t,hideErrorTitle:n,indentation:r,prefix:i},s)=>`${M(i,r,s)}${mn(e,n,t)}
|
|
8
|
+
`,tt=(e,{color:t,indentation:n,prefix:r},i)=>{if(e.hint===void 0)return;const s=M(r,n,i);let o="";if(Array.isArray(e.hint))for(const c of e.hint)o+=`${s+c}
|
|
9
|
+
`;else o+=s+e.hint;return t.hint(o)},be=(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}}},we=(e,t,n=0)=>{const{color:r,cwd:i,displayShortPath:s,indentation:o,prefix:c}=t,{trace:l}=e;let a;l.file===void 0?a="<unknown>":a=s?gn(l.file,i):Qe(l.file);const{fileLine:u,method:d}=r;return`${M(c,o,n)}at ${l.methodName?`${d(l.methodName)} `:""}${u(a)}:${u(l.line?.toString()??"")}`},yn=(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)},$n=e=>{try{return xe().existsSync(e)?xe().readFileSync(e,"utf8"):void 0}catch{return}},nt=(e,t,n)=>{const{color:r,indentation:i,linesAbove:s,linesBelow:o,prefix:c,showGutter:l,showLineNumbers:a,tabWidth:u}=t,{source:d,trace:h}=e;if(h.file===void 0)return;let f;if(d===void 0){const p=h.file.replace("file://","");if(!yn(p,t))return;const g=$n(p);if(g===void 0)return;f=g}else f=d;return Ct(f,{start:{column:h.column,line:h.line}},{color:r,linesAbove:s,linesBelow:o,prefix:M(c,i,n),showGutter:l,showLineNumbers:a,tabWidth:u})},rt=(e,t,n)=>{if(e.errors.length===0)return;let r=`${M(t.prefix,t.indentation,n)}Errors:
|
|
10
|
+
|
|
11
|
+
`,i=!0;for(const s of e.errors)i?i=!1:r+=`
|
|
12
|
+
|
|
13
|
+
`,r+=st(s,{...t,framesMaxLimit:1,hideErrorCodeView:t.hideErrorErrorsCodeView},n+1);return`
|
|
14
|
+
${r}`},bn=e=>{if(typeof e=="object"&&e!==null)try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}return String(e)},it=(e,t,n,r=new Set)=>{r.add(e);let i=`${M(t.prefix,t.indentation,n)}Caused by:
|
|
15
|
+
|
|
16
|
+
`;const{cause:s}=e;if(!(s instanceof Error)){const l=bn(s);return i+=`${M(t.prefix,t.indentation,n)}${t.color.title(l)}
|
|
17
|
+
`,`
|
|
18
|
+
${i}`}i+=et(s,t,n);const o=Ze(s).shift(),c=tt(s,t,n);if(c&&(i+=`${c}
|
|
19
|
+
`),o){const l=be(o,t.sourceMap);if(i+=we(l,t,n),!t.hideErrorCauseCodeView){const a=nt(l,t,n);a!==void 0&&(i+=`
|
|
20
|
+
${a}`)}}if(s instanceof AggregateError){const l=rt(s,t,n);l!==void 0&&(i+=`
|
|
21
|
+
${l}`)}return s.cause&&(i+=r.has(s)?`
|
|
22
|
+
${M(t.prefix,t.indentation,n+1)}Caused by: [Circular]`:`
|
|
23
|
+
${it(s,t,n+1,r)}`),`
|
|
24
|
+
${i}`},wn=(e,t)=>(e.length>0?`
|
|
25
|
+
`:"")+e.map(n=>we(be(n,t.sourceMap),t)).join(`
|
|
26
|
+
`),st=(e,t,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,...t,color:{fileLine:c=>c,gutter:c=>c,hint:c=>c,marker:c=>c,message:c=>c,method:c=>c,title:c=>c,...t.color}},i=Ze(e,{filter:t.filterStacktrace,frameLimit:r.framesMaxLimit}),s=i.shift(),o=s?be(s,r.sourceMap):void 0;return[t.hideMessage?void 0:et(e,r,n),tt(e,r,n),o?we(o,r,n):void 0,o&&!r.hideErrorCodeView?nt(o,r,n):void 0,e instanceof AggregateError?rt(e,r,n):void 0,e.cause===void 0||e.cause===null?void 0:it(e,r,n),i.length>0?wn(i,r):void 0].filter(Boolean).join(`
|
|
27
|
+
`)},oe=(e,t={})=>{if(t.framesMaxLimit!==void 0&&t.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return st(e,t,0)},B="[Inspection threw]",I=(e,t,n,r,i,s=", ",o=Number.POSITIVE_INFINITY)=>{const c=e.length;if(c===0)return"";const l=Number.isFinite(o)&&c>o,a=l?Math.max(0,Math.floor(o)):c;if(a===0)return`…(${String(c)})`;let u=r;i!==void 0&&(u=i);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=e[m];n.truncate=d-f.length-($?0:s.length);const y=p||u(w,t,n,r)+($?"":s),v=f.length+y.length,x=v+g.length;if($&&v>d&&f.length+g.length<=d||!$&&!S&&x>d)break;w=e[m+1];const b=S?"":s;if($?p="":p=u(w,t,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=`${s}… ${String(c-a)} more`),`${f}${g}`},Sn=([e,t],n,r)=>(r.truncate-=3,t?`${r.stylize(String(e),"yellow")}=${r.stylize(`"${t}"`,"string")}`:r.stylize(String(e),"yellow")),ot=e=>{try{return Object.create(e,{length:{value:e.length}})}catch{return}},vn=(e,t,n,r)=>{let i;try{i=e.nodeType}catch{return B}if(i===1)return ct(e,e,n,r);if(i===3){let s;try{s=e.data}catch{return B}return r(s,void 0,n)}return r(e,void 0,n)},ge=(e,t,n,r)=>{const i=ot(e);return i===void 0?B:I(i,e,t,n,vn,`
|
|
28
|
+
`)},ct=(e,t,n,r)=>{let i,s;try{i=e.getAttributeNames().map(f=>[f,e.getAttribute(f)]),s=e.tagName.toLowerCase()}catch{return B}const o=n.stylize(`<${s}`,"special"),c=n.stylize(">","special"),l=n.stylize(`</${s}>`,"special");n.truncate-=s.length*2+5;let a="";i.length>0&&(a+=" ",a+=I(i,t,n,r,Sn," ")),n.truncate-=a.length;const{truncate:u}=n;let d;try{d=ot(e.children)}catch{d=void 0}let h;return d===void 0?h=B:(h=ge(d,n,r),h&&h.length>u&&(h=`…(${String(d.length)})`)),`${o}${a}${c}${h}${l}`},An=(e,t,n)=>e.length===0?"Arguments []":(t.truncate-=13,`Arguments [ ${I(e,e,t,n,void 0,", ",t.maxArrayLength)} ]`),xn=(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:`
|
|
29
|
+
${Array.from({length:t+1}).join(n)}`}},re=(e,t)=>{if(e.length===0)return"";const n=t.prev+t.base;return n+e.split("\0\0").join(`,${n}`)+t.prev},En=/^[a-z_]\w*$/i,In=/^"|"$/g,Nn=(e,t)=>{if(En.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(In,"'")},H=([e,t],n,r,i)=>{r.truncate-=2;let s;typeof e=="string"?s=Nn(e,r):typeof e=="number"?s=String(e):s=`[${i(e,n,r)}]`,r.truncate-=s.length;const o=i(t,n,r);return`${s}: ${o}`},On=Symbol.for("chai/inspect"),ce=e=>({[On]:()=>e}),U=(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 ce(B)}if(n.get===void 0)return ce("[Setter]");try{return e[t]}catch{return ce(B)}},kn=e=>{for(const t of e)if(Array.isArray(t)||typeof t=="object"&&t!==null)return!0;return!1},Tn=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},Bn=(e,t,n,r)=>{const i=Tn(e);if(e.length===0&&i.length===0)return"[]";t.truncate-=4;const s=!!r&&kn(e);let o=I(e,e,t,n,void 0,s?"\0\0":", ",t.maxArrayLength);t.truncate-=o.length;let c="";return i.length>0&&(c=I(i.map(l=>[l,U(e,l)]),e,t,n,H)),s&&r&&(o=re(o,r)),`[${s?"":" "}${o}${c?`, ${c}`:""}${s?"":" "}]`},jn=50,Ee=(e,t)=>{const n=new Uint8Array(e),r=Math.min(n.length,jn);let i="",s=!1;for(let a=0;a<r;a+=1){const u=n[a];u!==0&&(s=!0),i+=(a===0?"":" ")+u.toString(16).padStart(2,"0")}n.length>r&&(i+=` ... ${String(n.length-r)} more byte${n.length-r===1?"":"s"}`);const o=e instanceof ArrayBuffer?"ArrayBuffer":"SharedArrayBuffer",c=s||n.length>r,l=i!==""&&c?`[Uint8Contents]: <${i}>, `:"";return`${t.stylize(o,"special")} { ${l}byteLength: ${t.stylize(String(e.byteLength),"number")} }`},Ie=/\d(?=(?:\d{3})+(?!\d))/g,Mn=/\d{3}/g,Fn=/_$/,lt=(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),i=t.slice(r.length+1);return`${r.replace(Ie,"$&_")}.${i.replace(Mn,"$&_").replace(Fn,"")}`}}return t.replace(Ie,"$&_")},Wn=e=>e>="\uD800"&&e<="\uDBFF",F=(e,t,n="…")=>{e=String(e);const r=n.length,i=e.length;if(r>t&&i>r)return n;if(i>t&&i>r){let s=t-r;return s>0&&Wn(e[s-1])&&(s-=1),`${e.slice(0,s)}${n}`}return e},Ne=(e,t)=>{let n=F(e.toString(),t.truncate-1);return n!=="…"&&(n+="n"),t.stylize(t.numericSeparator?lt(e,n):n,"bigint")},at=e=>{try{return Array.isArray(e)}catch{return!1}},L=(e,t)=>{try{return e[t]}catch{return}},Ln=(e,t)=>{try{return e instanceof t}catch{return!1}},Oe=(e,t)=>{try{return Object.getOwnPropertyDescriptor(e,t)?.enumerable??!1}catch{return!0}},_n=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:void 0),Q=(e,t,n,r)=>{if("window"in globalThis&&e===globalThis)return"{ [object Window] }";if(e===globalThis)return"{ [object globalThis] }";let i,s;try{i=Object.getOwnPropertyNames(e),s=Object.getOwnPropertySymbols(e)}catch{return B}let o,c;try{o=t.showHidden?i:i.filter(f=>Object.getOwnPropertyDescriptor(e,f)?.enumerable)}catch{o=i.filter(f=>Oe(e,f))}try{c=s.filter(f=>t.showHidden||Object.getOwnPropertyDescriptor(e,f)?.enumerable)}catch{c=s.filter(f=>Oe(e,f))}let l;try{const f=_n(e)===Object.prototype||e.constructor===Object,p=e instanceof Object?"":"null prototype";let g;!f&&Symbol.toStringTag in e?g=e[Symbol.toStringTag]:g=p?"Object":"",l=g||p?`[${[g,p].filter(Boolean).join(": ")}] `:""}catch{l=""}if(o.length===0&&c.length===0)return`${l}{}`;t.truncate-=4;const a=r?"\0\0":", ",u=I(o.map(f=>[f,U(e,f)]),e,t,n,H,a),d=I(c.map(f=>[f,U(e,f)]),e,t,n,H,a);let h="";return u&&d&&(h=a),r?`${l}{${re(u+h+d,r)}}`:`${l}{ ${u}${h}${d} }`},zn=(e,t,n,r)=>{let i;try{i=typeof e.constructor=="function"?e.constructor.name:""}catch{i=""}return(!i||i==="_class")&&(i="<Anonymous Class>"),t.truncate-=i.length,`${i} ${Q(e,t,n,r)}`},Rn=(e,t)=>{const n=t.stylize(String(e.byteLength),"number"),r=t.stylize(String(e.byteOffset),"number"),i=t.stylize(String(e.buffer.byteLength),"number");return`${t.stylize("DataView","special")} { byteLength: ${n}, byteOffset: ${r}, buffer: ArrayBuffer { byteLength: ${i} } }`},Cn=(e,t)=>{const n=e.toJSON();if(n===null)return"Invalid Date";const r=n.split("T"),i=r[0];return t.stylize(`${i}T${F(r[1],t.truncate-i.length-1)}`,"date")},Pn=new Set(["column","columnNumber","description","fileName","line","lineNumber","message","name","number","stack"]),Vn=(e,t,n)=>{const r=Object.getOwnPropertyNames(e).filter(c=>!Pn.has(c)),{name:i}=e;t.truncate-=i.length;let s="";typeof e.message=="string"?s=F(e.message,t.truncate):r.unshift("message"),s=s?`: ${s}`:"",t.truncate-=s.length+5;const o=I(r.map(c=>[c,U(e,c)]),e,t,n,H);return`${i}${s}${o?` { ${o} }`:""}`},ke=(e,t)=>{let n,r,i;try{n=e[Symbol.toStringTag]||"Function",r=e.toString(),{name:i}=e}catch{return t.stylize(B,"special")}return r.length<t.truncate-12?t.stylize(`[${n}: ${r}]`,"special"):i?t.stylize(`[${n} ${F(i,t.truncate-11)}]`,"special"):t.stylize(`[${n}]`,"special")},Te=(e,t)=>{const n=L(e,Symbol.toStringTag),r=typeof n=="string"?n:"Generator";return`${t.stylize(`Object [${r}]`,"special")} {}`},Dn=([e,t],n,r,i)=>(r.truncate-=4,e=i(e,n,r),r.truncate-=e.length,`${e} => ${i(t,n,r)}`),Gn=(e,t,n,r)=>{if(e.size<=0)return"Map (0) {}";t.truncate-=7;let i=I([...e.entries()],e,t,n,Dn,r?"\0\0":", ",t.maxArrayLength);return r&&(i=re(i,r)),`Map (${String(e.size)}) {${r?"":" "}${i}${r?"":" "}}`};function Be(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(F(t.numericSeparator?lt(e,e.toString()):e.toString(),t.truncate),"number")}const Hn=()=>"Promise{…}",Un=(e,t)=>{const n=t.truncate-(2+e.flags.length);return t.stylize(`/${F(e.source,n)}/${e.flags}`,"regexp")},Yn=(e,t,n,r)=>{if(e.size===0)return"Set (0) {}";t.truncate-=7;let i=I([...e],e,t,n,void 0,r?"\0\0":", ",t.maxArrayLength);return r&&(i=re(i,r)),`Set (${String(e.size)}) {${r?"":" "}${i}${r?"":" "}}`},qn=(e,t)=>{const n=t.quoteStyle==="double"?'"':"'";return n+e+n},je=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,Xn=e=>Jn[e]||String.raw`\u${`0000${e.codePointAt(0).toString(Kn)}`.slice(-4)}`,Me=(e,t)=>(je.test(e)&&(e=e.replaceAll(je,Xn)),t.stylize(qn(F(e,t.truncate-2),t),"string")),Fe=e=>"description"in Symbol.prototype?e.description?`Symbol(${e.description})`:"Symbol()":e.toString(),Zn=e=>typeof Buffer=="function"&&e instanceof Buffer?"Buffer":e[Symbol.toStringTag],O=(e,t,n)=>{const r=Zn(e);t.truncate-=r.length+4;const i=Object.keys(e).slice(e.length);if(e.length===0&&i.length===0)return`${r}[]`;let s="";const o=Number.isFinite(t.maxArrayLength)?Math.min(e.length,Math.max(0,Math.floor(t.maxArrayLength))):e.length;for(let l=0;l<o;l++){const a=`${t.stylize(F(e[l],t.truncate),"number")}${l===o-1?"":", "}`;if(t.truncate-=a.length,l!==o-1&&t.truncate<=3){s+=`…(${String(e.length-l)})`;break}s+=a}o<e.length&&(s+=`${s?", ":""}… ${String(e.length-o)} more`);let c="";return i.length>0&&(c=I(i.map(l=>[l,U(e,l)]),e,t,n,H)),`${r}[ ${s}${c?`, ${c}`:""} ]`},We=e=>typeof L(e,Symbol.toStringTag)!="string",Qn=e=>typeof e=="function",ut=(e,t,n)=>{if(e==null)return;const r=Object.getOwnPropertyDescriptor(e,t);if(r===void 0)return;const i=n==="get"?r.get:r.value;return typeof i=="function"?i:void 0},ft=(e,t)=>{if(e!==void 0)return n=>{try{return e.call(n,t),!0}catch{return!1}}},W=(e,t)=>ft(ut(e,t,"get")),j=(e,t,n)=>ft(ut(e,t,"value"),n),Le=Object.freeze({}),k=W(Reflect.getPrototypeOf(Int8Array.prototype),"length"),er=typeof SharedArrayBuffer=="function"?SharedArrayBuffer.prototype:void 0,tr=Object.assign(Object.create(null),{Arguments:We,Array:at,ArrayBuffer:W(ArrayBuffer.prototype,"byteLength"),BigInt:j(BigInt.prototype,"valueOf"),Boolean:j(Boolean.prototype,"valueOf"),DataView:W(DataView.prototype,"byteLength"),Date:j(Date.prototype,"valueOf"),Error:We,Float32Array:k,Float64Array:k,Function:Qn,Int8Array:k,Int16Array:k,Int32Array:k,Map:W(Map.prototype,"size"),Number:j(Number.prototype,"valueOf"),RegExp:W(RegExp.prototype,"source"),Set:W(Set.prototype,"size"),SharedArrayBuffer:W(er,"byteLength"),String:j(String.prototype,"valueOf"),Symbol:j(Symbol.prototype,"valueOf"),Uint8Array:k,Uint8ClampedArray:k,Uint16Array:k,Uint32Array:k,WeakMap:j(WeakMap.prototype,"has",Le),WeakSet:j(WeakSet.prototype,"has",Le)}),nr=(e,t)=>{const n=tr[t];return n===void 0||n(e)},_e=new WeakMap,ze=Object.create(null),rr=Object.assign(Object.create(null),{Arguments:An,Array:Bn,ArrayBuffer:Ee,AsyncGenerator:Te,BigInt:Ne,bigint:Ne,Boolean:(e,t)=>t.stylize(String(e),"boolean"),boolean:(e,t)=>t.stylize(String(e),"boolean"),DataView:Rn,Date:Cn,Error:Vn,Float32Array:O,Float64Array:O,Function:ke,function:ke,Generator:Te,HTMLCollection:ge,Int8Array:O,Int16Array:O,Int32Array:O,Map:Gn,NodeList:ge,null:(e,t)=>t.stylize("null","null"),Number:Be,number:Be,Promise:Hn,RegExp:Un,Set:Yn,SharedArrayBuffer:Ee,String:Me,string:Me,Symbol:Fe,symbol:Fe,Uint8Array:O,Uint8ClampedArray:O,Uint16Array:O,Uint32Array:O,undefined:(e,t)=>t.stylize("undefined","undefined"),WeakMap:(e,t)=>t.stylize("WeakMap{…}","special"),WeakSet:(e,t)=>t.stylize("WeakSet{…}","special")}),ir=Symbol.for("nodejs.util.inspect.custom"),sr=Symbol.for("chai/inspect"),or=(e,t,n,r)=>{const i=L(e,sr);if(typeof i=="function")return i.call(e,t);if(!("window"in globalThis)){const l=L(e,ir);if(typeof l=="function")return l.call(e,r,t)}const s=L(e,"inspect");if(typeof s=="function")return s.call(e,r,t);const o=L(e,"constructor");if(typeof o=="function"&&_e.has(o))return _e.get(o)?.(e,t)??"unknown";const c=Object.hasOwn(ze,n)?ze[n]:void 0;return c?c(e,t):""},le=(e,t,n)=>{const{depth:r,inspect:i,seen:s}=n;if(s.includes(e))return"[Circular]";if(r>=t.depth&&t.depth>0&&typeof e=="object"&&e!==null)return at(e)?"[Array]":"[Object]";const o=t.indent?xn(t.indent,r):void 0;let c=e===null?"null":typeof e;if(c==="object")try{c=Object.prototype.toString.call(e).slice(8,-1)}catch{c="Object"}let l=rr[c];if(l!==void 0&&typeof e=="object"&&e!==null&&!nr(e,c)&&(l=void 0),l!==void 0)return l(e,t,i,o);if(t.customInspect&&e){const d=or(e,t,c,t.depth-r);if(d)return typeof d=="string"?d:i(d,e,t)}let a=!1;if(e)try{a=Object.getPrototypeOf(e)}catch{a=Object.prototype}if(a===Object.prototype||a===null)return Q(e,t,i,o);if(e&&typeof HTMLElement=="function"&&Ln(e,HTMLElement))return ct(e,e,t,i);const u=L(e,"constructor");return u!==void 0?u!==Object?zn(e,t,i,o):Q(e,t,i,o):e===Object(e)?Q(e,t,i,o):t.stylize(String(e),c)},Re=(e,t={})=>{const n={customInspect:!0,depth:5,indent:void 0,maxArrayLength:Number.POSITIVE_INFINITY,numericSeparator:!0,quoteStyle:"single",showHidden:!1,stylize:i=>i,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=(i,s,o)=>{if(s==null){r.depth+=1;const l=le(i,o,r);return r.depth-=1,l}r.seen.push(s),r.depth+=1;const c=le(i,o,r);return r.depth-=1,r.seen.pop(),c},le(e,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,dt=[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],q=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){const i=Math.floor((n+r)/2),s=i*2;if(t<e[s])r=i-1;else if(t>e[s+1])n=i+1;else return!0}return!1},Ce=19968,[br,wr]=Sr(dt);function Sr(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){const i=e[r],s=e[r+1];if(Ce>=i&&Ce<=s)return[i,s];s-i>n-t&&(t=i,n=s)}return[t,n]}const vr=e=>e<161||e>1114109?!1:q(cr,e),Ar=e=>e<lr||e>ar?!1:q(ur,e),xr=e=>e<fr||e>dr?!1:q(hr,e),Er=e=>e<pr||e>gr?!1:q(mr,e),Ir=e=>e>=br&&e<=wr?!0:e<yr||e>$r?!1:q(dt,e);function Nr(e){return vr(e)?"ambiguous":Ar(e)?"fullwidth":xr(e)?"halfwidth":Er(e)?"narrow":Ir(e)?"wide":"neutral"}function Or(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function ht(e){return Or(e),Nr(e)}const pt=String.raw,Pe=pt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,kr=()=>new RegExp(pt`\p{RI}{2}|(?)${Pe}(?:\u200D${Pe})*`,"gu"),P=new Set(["\x1B",""]),ie="\x07",gt="[",Se="m",Y="]8;;",Tr=39,Br=/[\u200B\uFEFF\u2060-\u2064]/g,jr=new RegExp(`(?:\\${gt}(?<code>\\d+)m|\\${Y}(?<uri>.*)${ie})`),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]])),mt=/[\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,Fr=kr(),Ve=new Map,Wr=e=>[e.ambiguousIsNarrow?1:0,e.control,e.fullWidth,e.regular,e.wide].join("|"),Lr=e=>{const t=Wr(e.width);let n=Ve.get(t);return n||(n=new Map,Ve.set(t,n)),n},K=new RegExp(mt.source,"y"),ae=new RegExp(Fr.source,"uy"),X=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,yt=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",_r=(e,t)=>{const n=Lr(t),r=Math.floor(e/65536),i=e%65536;let s=n.get(r);if(s||(s=new Map,n.set(r,s)),s.has(i))return s.get(i);let o;switch(yt(e)){case"control":{o=t.width.control;break}case"latin":{o=t.width.regular;break}case"wide":{o=t.width.wide;break}case"zero":{o=0;break}default:switch(ht(e)){case"ambiguous":{o=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{o=t.width.fullWidth;break}case"wide":{o=t.width.wide;break}default:o=t.width.regular}}return s.set(i,o),o},zr=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,me=(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?me(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:i}=e,s=i>1e4;let o=0,c=0,l=i,a=!1;const u=e.includes("\x1B")||e.includes("");for(;o<i;){if(u&&(e[o]==="\x1B"||e[o]==="")){if(e.startsWith("\x1B]8;;",o)){const m="\x1B]8;;\x07",$=m.length,S=e.indexOf("\x07",o+5);if(S!==-1){const w=e.indexOf(m,S+1);if(w!==-1){const y=w+$,v=e.slice(S+1,w).replace(mt,""),x=me(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,o);else if(c+b>r&&(l=Math.min(l,o),a=!0,c+b>n.truncation.limit))break;if(c+=b,o=y,a&&c>=n.truncation.limit)break;continue}}}if(K.lastIndex=o,K.test(e)){const m=K.lastIndex-o,$=n.truncation.countAnsiEscapeCodes?m:n.width.ansi;if(c+$>r&&(l=Math.min(l,o),c+$>n.truncation.limit)){a=!0;break}c+=$,o=K.lastIndex;continue}}const f=e.codePointAt(o);if(f===8203||f===65279||f>=8288&&f<=8292){o+=1;continue}if(f===9){if(c+n.width.tab>r&&(l=Math.min(l,o),c+n.width.tab>n.truncation.limit)){a=!0;break}c+=n.width.tab,o+=1;continue}if(X.lastIndex=o,X.test(e)){const m=(X.lastIndex-o)*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,o+$),c+m>n.truncation.limit){a=!0;break}}c+=m,o=X.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(J.lastIndex=o,J.test(e))){const m=(J.lastIndex-o)*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,o+$),c+m>n.truncation.limit){a=!0;break}}c+=m,o=J.lastIndex;continue}if(ae.lastIndex=o,ae.test(e)){if(c+n.width.emoji>r&&(l=Math.min(l,o),c+n.width.emoji>n.truncation.limit)){a=!0;break}c+=n.width.emoji,o=ae.lastIndex;continue}const p=e.codePointAt(o)??0;if(zr(p)){o+=p>65535?2:1;continue}let g;if(s)g=_r(p,n);else switch(yt(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(ht(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,o),c+g>n.truncation.limit)){a=!0;break}c+=g,o+=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:i,truncated:a,width:d}},A=(e,t={})=>me(e,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,Rr=/\x1B\[(\d+)m/;class $t{activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(t){const n=Rr.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 i={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];i&&(this.activeFormatting=this.activeFormatting.filter(s=>!s.includes(i)))}}}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 i=n[r];i&&t.push(i)})}return this.activeForeground&&t.push("\x1B[39m"),this.activeBackground&&t.push("\x1B[49m"),t.join("")}}const Cr=(e,t)=>{if(!P.has(e[t]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const n=!0,r=e.slice(t+1,t+1+Y.length).join("")===Y;return{isInsideEscape:n,isInsideLinkEscape:r}},Pr=(e,t={})=>{const n=new $t;let r="",i=!1,s="",o="",c=!1;const l=[...e];for(let a=0;a<l.length;a++){const u=l[a];if(u&&P.has(u)){if(r){const g=t.getWidth?.(r)??0,m={isEscapeSequence:!1,isGrapheme:!0,text:r,width:g};if(c&&(m.isHyperlink=!0,m.hyperlinkUrl=o),t.onSegment?.(m,n)===!1)return;r=""}i=!0,s=u;const f=Cr(l,a),{isInsideLinkEscape:p}=f;if(p){let g=a+1;for(o="";g<l.length;){const $=l[g];if($===ie)break;o+=$,g+=1}o=o.slice(4);const m={hyperlinkUrl:o,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(t.onSegment?.(m,n)===!1)return;a=g,c=!0,i=!1,s="";continue}if(a+1<l.length&&l[a+1]==="\\"&&c){const g={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(t.onSegment?.(g,n)===!1)return;c=!1,o="",a+=1,i=!1,s="";continue}}if(i){if(s!==u&&(s+=u),u===Se){i=!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,h={isEscapeSequence:!1,isGrapheme:!0,text:r,width:d};if(c&&(h.isHyperlink=!0,h.hyperlinkUrl=o),t.onSegment?.(h,n)===!1)return;r=""}if(r){const a=t.getWidth?.(r)??0,u={isEscapeSequence:!1,isGrapheme:!0,text:r,width:a};c&&(u.isHyperlink=!0,u.hyperlinkUrl=o),t.onSegment?.(u,n)}if(s){const a={isEscapeSequence:!0,isGrapheme:!1,text:s,width:0};t.onSegment?.(a,n)}},De=e=>`${P.values().next().value}${gt}${String(e)}${Se}`,Ge=e=>`${P.values().next().value}${Y}${e}${ie}`,Vr=e=>{if(e.length===0)return"";if(e.length===1)return e[0];let t="",n,r;const i=e.join(`
|
|
30
|
+
`),s=[...i];let o=0;for(const[c,l]of s.entries()){if(t+=l,P.has(l)){const u=jr.exec(i.slice(o))?.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));s[c+1]===`
|
|
31
|
+
`?(r&&(t+=Ge("")),n&&a&&(t+=De(a))):l===`
|
|
32
|
+
`&&(n&&a&&(t+=De(n)),r&&(t+=Ge(r))),o+=l.length}return t},bt=/(?=\s)|(?<=\s)/,wt=/^\s+$/,He=new Map,Dr=e=>{const t=He.get(e);if(t!==void 0)return t;const n=A(e);return He.set(e,n),n},ue=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},_=e=>{const t=e.split(" ");let n=t.length;for(;n>0&&A(t[n-1])===0;)n--;return n===t.length?e:t.slice(0,n).join(" ")+t.slice(n).join("")},St=(e,t,n)=>{if(e.length===0)return[""];if(t<=0)return[e];const r=[],i=new $t;let s="",o=0,c=!1,l=!1,a="",u=0;for(;u<e.length;){const d=e.codePointAt(u),h=String.fromCodePoint(d),f=h.length;if(P.has(h)){c=!0,a=h,s+=h,l=e.startsWith(Y,u+1),u+=1;continue}if(c){a+=h,s+=h,l?h===ie&&(c=l=!1):h===Se&&(c=!1,i.processEscape(a)),u+=1;continue}const p=Dr(h),g=h===" ";if(p===0){s+=h,u+=f;continue}if(o+p>t&&(s&&r.push(s+i.getEndEscapesForAllActiveAttributes()),s=i.getStartEscapesForAllActiveAttributes(),o=A(s),g&&n)){for(;u<e.length&&e[u]===" ";)u+=1;continue}if(s+=h,o+=p,o===t&&u+f<e.length&&(r.push(s+i.getEndEscapesForAllActiveAttributes()),s=i.getStartEscapesForAllActiveAttributes(),o=A(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+i.getEndEscapesForAllActiveAttributes()),n?r.map(d=>_(d)):r},Gr=(e,t,n)=>{if(e.length===0)return[];const r=n?e.trim():e;if(r.length===0)return[];const i=[];let s="",o=0;return Pr(r,{getWidth:A,onSegment:(c,l)=>{const a=c.text??"";if(c.isEscapeSequence)s+=a;else{const u=a===" ";if(c.width===0)return s+=a,!0;if(o+c.width>t&&(s&&i.push(s),s=l.getStartEscapesForAllActiveAttributes(),o=0,u))return n||i.push(l.getStartEscapesForAllActiveAttributes()+a),!0;s+=a,o+=c.width}return!0}}),s&&i.push(s),n?i.map(c=>_(c)):i},Hr=(e,t,n)=>{if(e.length===0)return[];const r=n?e.trim():e;if(r.length===0)return[];const i=r.split(bt),s=[];let o="",c=0,l=0;for(;l<i.length;){const a=i[l],u=wt.test(a),d=A(a);if(a.length===0){l+=1;continue}if(n&&u&&c===0){l+=1;continue}if(c+d>t&&c>0){n?s.push(_(o)):s.push(o),o="",c=0;continue}o+=a,c+=d,l+=1}return o&&(n?s.push(_(o)):s.push(o)),s},Ur=(e,t,n)=>{if(e.length===0)return[];const r=n?e.trim():e;if(r.length===0)return[];const i=r.split(bt),s=[];let o="",c=0,l=0;for(;l<i.length;){const a=i[l],u=wt.test(a),d=A(a);if(a.length===0){l+=1;continue}if(n&&u&&c===0){l+=1;continue}if(d>t){o&&s.push(ue(n?_(o):o));const h=St(a,t,n);if(h.length>0){for(let f=0;f<h.length-1;f+=1)s.push(h[f]);o=h.at(-1),c=A(o)}else o="",c=0;l+=1;continue}if(c+d>t&&c>0&&(s.push(ue(n?_(o):o)),o="",c=0,n&&u)){l+=1;continue}o+=a,c+=d,l+=1}return o&&s.push(ue(n?_(o):o)),s},D={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Yr=(e,t={})=>{const{removeZeroWidthCharacters:n=!0,trim:r=!0,width:i=80,wrapMode:s=D.PRESERVE_WORDS}=t;if(r&&e.trim()==="")return"";let o=e.normalize("NFC").replaceAll(`\r
|
|
33
|
+
`,`
|
|
34
|
+
`);return n&&(o=o.replaceAll(Br,"")),o.split(`
|
|
35
|
+
`).map(c=>{if(r&&c.trim()==="")return"";let l;switch(s){case D.BREAK_AT_CHARACTERS:{l=Gr(c,i,r);break}case D.BREAK_WORDS:{l=Ur(c,i,r);break}case D.STRICT_WIDTH:{l=St(c,i,r);break}default:l=Hr(c,i,r)}return Vr(l)}).join(`
|
|
36
|
+
`)},vt=80,At=24,ye=(e,t,{shell:n,env:r}={})=>Tt(e,t,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:n,env:r}).trim(),ee=(e,t)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(t,10)}),xt=(e,t)=>{const{columns:n,rows:r}=ee(e,t);if(!(Number.isNaN(n)||Number.isNaN(r))&&!(n===vt&&r===At))return{columns:n,rows:r}},qr=()=>{if(T.platform!=="linux")return!0;try{const e=V.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),i=Number.parseInt(n[5],10);return Number.isNaN(r)||Number.isNaN(i)||i<=0?!1:r===i}catch{return!1}};function Jr(){const{env:e,stdout:t,stderr:n}=T;if(t?.columns&&t?.rows)return ee(t.columns,t.rows);if(n?.columns&&n?.rows)return ee(n.columns,n.rows);if(e.COLUMNS&&e.LINES)return ee(e.COLUMNS,e.LINES);const r={columns:vt,rows:At};return T.platform==="win32"?fe()??r:T.platform==="darwin"?Ue()??fe()??r:Ue()??fe()??Kr()??r}const Ue=()=>{try{const e=T.platform==="darwin"?V.constants.O_EVTONLY|V.constants.O_NONBLOCK:V.constants.O_NONBLOCK,{columns:t,rows:n}=Bt.WriteStream(V.openSync("/dev/tty",e));return{columns:t,rows:n}}catch{}},fe=()=>{try{const e=ye("tput",["cols"],{env:{TERM:"dumb",...T.env}}),t=ye("tput",["lines"],{env:{TERM:"dumb",...T.env}});if(e&&t)return xt(e,t)}catch{}},Kr=()=>{try{if(!qr())return;const e=ye("resize",["-u"]).match(/\d+/g);if(e.length===2)return xt(e[0],e[1])}catch{}},Xr=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,"")},Zr=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,"")},{bold:Qr,cyan:ei,green:Ye,grey:ti,magenta:ni,red:ri,yellow:de}=te,ii={indent:2,quoteStyle:"single",stylize:(e,t)=>{const n={bigint:de,boolean:de,date:ni,null:Qr,number:de,regexp:ri,special:ei,string:Ye,symbol:Ye,undefined:ti};return Object.hasOwn(n,t)?n[t](e):e}},{bold:si,underline:oi}=te,ci=(e,t)=>{let n=t.uppercase.label?e.toUpperCase():e;return n=t.underline.label?oi(n):n,t.bold.label&&(n=si(n)),n},li=e=>[e.getHours(),e.getMinutes(),e.getSeconds()].map(t=>String(t).padStart(2,"0")).join(":");class ai{styles;loggerTypes;constructor(t){this.styles={bold:{label:!1},dateFormatter:li,underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...t},this.loggerTypes=jt}setLoggerTypes(t){this.loggerTypes=t}}const{bgGrey:ui,cyan:fi,green:di,greenBright:hi,grey:E,red:he,underline:qe,white:pi}=te,gi=/[\\/]pail[\\/]dist/,pe=e=>!gi.test(e);class wi extends ai{#e;#r;#i;#c=!1;#s;#n;#t;#o=!1;#l="";#a="";constructor(t={}){const{error:n,inspect:r,...i}=t;super({uppercase:{label:!0,...i.uppercase},...i}),this.#s={...ii,...r},this.#n={...n,color:{fileLine:di,hint:fi,marker:he,message:he,method:hi,title:he}},this.#e=Ot,this.#r=kt,this.#u()}setLoggerTypes(t){super.setLoggerTypes(t),this.#u()}setStdout(t){this.#e=t,this.#t=void 0,this.#o=!1}setStderr(t){this.#r=t}setInteractiveManager(t){this.#i=t}setIsInteractive(t){this.#c=t}log(t){this._log(this._formatMessage(t),t.type.level)}#u(){this.#l=Xr(this.loggerTypes),this.#a=Zr(this.loggerTypes)}#f(){return!this.#o&&typeof this.#e.on=="function"&&(this.#o=!0,this.#e.on("resize",()=>{this.#t=void 0})),this.#t===void 0&&(this.#t=Jr().columns),this.#t}_formatMessage(t){let n=this.#f();typeof this.styles.messageLength=="number"&&(n=this.styles.messageLength);const{badge:r,context:i,date:s,error:o,file:c,groups:l,label:a,message:u,prefix:d,repeated:h,scope:f,suffix:p,traceError:g,type:m}=t,{color:$}=this.loggerTypes[m.name],S=$?te[$]:pi,w=l.map(()=>" ").join(""),y=[];if(l.length>0&&y.push(`${w+E(`[${l.at(-1)??""}]`)} `),s&&y.push(`${E(this.styles.dateFormatter(typeof s=="string"?new Date(s):s))} `),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(ci(a,this.styles))} `,E(".".repeat(Math.max(0,b-N))))}else y.push(E(".".repeat(v.length+2)));h&&y.push(`${ui.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?qe(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 se=Math.max(0,n-x-N-2);y.push(E(`${".".repeat(se)} ${b}`))}}else y.push(E(".".repeat(Math.max(0,n-x-1))));if(y.length>0&&y.push(`
|
|
37
|
+
|
|
38
|
+
`),u!==Mt){const b=typeof u=="string"?u:Re(u,this.#s);y.push(w+Yr(b,{trim:!1,width:n-3,wrapMode:D.PRESERVE_WORDS}))}if(i){let b=!1;y.push(...i.map(N=>{if(N instanceof Error)return b=!0,`
|
|
39
|
+
|
|
40
|
+
${oe(N,{...this.#n,filterStacktrace:pe,prefix:w})}`;if(typeof N=="object")return` ${Re(N,this.#s)}`;const se=(b?`
|
|
41
|
+
|
|
42
|
+
`:" ")+String(N);return b=!1,se}))}return o&&y.push(oe(o,{...this.#n,filterStacktrace:pe,prefix:w})),g&&y.push(`
|
|
43
|
+
|
|
44
|
+
${oe(g,{...this.#n,filterStacktrace:pe,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:w})}`),p&&y.push(`
|
|
45
|
+
`,w+E(this.styles.underline.suffix?qe(p):p)),y.join("")}_log(t,n){const r=Ft(n)?"stderr":"stdout",i=r==="stderr"?this.#r:this.#e;this.#c&&this.#i!==void 0&&i.isTTY?this.#i.update(r,t.split(`
|
|
46
|
+
`),0):Wt(`${t}
|
|
47
|
+
`,i)}}export{wi 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 Ce 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"),C=fe("node:fs"),vt=fe("node:tty"),Yr={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"}},qr=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,i=", ",s=Number.POSITIVE_INFINITY)=>{const l=e.length;if(l===0)return"";const c=Number.isFinite(s)&&l>s,a=c?Math.max(0,Math.floor(s)):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:i.length);const x=h||u(v,t,n,r)+(y?"":i),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=$?"":i;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=`${i}… ${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")),Pe=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 Ve(e,e,n,r);if(o===3){let i;try{i=e.data}catch{return E}return r(i,void 0,n)}return r(e,void 0,n)},ce=(e,t,n,r)=>{const o=Pe(e);return o===void 0?E:b(o,e,t,n,Et,`
|
|
2
|
+
`)},Ve=(e,t,n,r)=>{let o,i;try{o=e.getAttributeNames().map(f=>[f,e.getAttribute(f)]),i=e.tagName.toLowerCase()}catch{return E}const s=n.stylize(`<${i}`,"special"),l=n.stylize(">","special"),c=n.stylize(`</${i}>`,"special");n.truncate-=i.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=Pe(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)})`)),`${s}${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,"'")},P=([e,t],n,r,o)=>{r.truncate-=2;let i;typeof e=="string"?i=kt(e,r):typeof e=="number"?i=String(e):i=`[${o(e,n,r)}]`,r.truncate-=i.length;const s=o(t,n,r);return`${i}: ${s}`},Bt=Symbol.for("chai/inspect"),ne=e=>({[Bt]:()=>e}),V=(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 i=!!r&&Lt(e);let s=b(e,e,t,n,void 0,i?"\0\0":", ",t.maxArrayLength);t.truncate-=s.length;let l="";return o.length>0&&(l=b(o.map(c=>[c,V(e,c)]),e,t,n,P)),i&&r&&(s=Q(s,r)),`[${i?"":" "}${s}${l?`, ${l}`:""}${i?"":" "}]`},Ft=50,pe=(e,t)=>{const n=new Uint8Array(e),r=Math.min(n.length,Ft);let o="",i=!1;for(let a=0;a<r;a+=1){const u=n[a];u!==0&&(i=!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 s=e instanceof ArrayBuffer?"ArrayBuffer":"SharedArrayBuffer",l=i||n.length>r,c=o!==""&&l?`[Uint8Contents]: <${o}>, `:"";return`${t.stylize(s,"special")} { ${c}byteLength: ${t.stylize(String(e.byteLength),"number")} }`},me=/\d(?=(?:\d{3})+(?!\d))/g,Wt=/\d{3}/g,Mt=/_$/,De=(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 i=t-r;return i>0&&_t(e[i-1])&&(i-=1),`${e.slice(0,i)}${n}`}return e},ye=(e,t)=>{let n=B(e.toString(),t.truncate-1);return n!=="…"&&(n+="n"),t.stylize(t.numericSeparator?De(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,i;try{o=Object.getOwnPropertyNames(e),i=Object.getOwnPropertySymbols(e)}catch{return E}let s,l;try{s=t.showHidden?o:o.filter(f=>Object.getOwnPropertyDescriptor(e,f)?.enumerable)}catch{s=o.filter(f=>be(e,f))}try{l=i.filter(f=>t.showHidden||Object.getOwnPropertyDescriptor(e,f)?.enumerable)}catch{l=i.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(s.length===0&&l.length===0)return`${c}{}`;t.truncate-=4;const a=r?"\0\0":", ",u=b(s.map(f=>[f,V(e,f)]),e,t,n,P,a),d=b(l.map(f=>[f,V(e,f)]),e,t,n,P,a);let g="";return u&&d&&(g=a),r?`${c}{${Q(u+g+d,r)}}`:`${c}{ ${u}${g}${d} }`},Ct=(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)}`},Pt=(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} } }`},Vt=(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")},Dt=new Set(["column","columnNumber","description","fileName","line","lineNumber","message","name","number","stack"]),Gt=(e,t,n)=>{const r=Object.getOwnPropertyNames(e).filter(l=>!Dt.has(l)),{name:o}=e;t.truncate-=o.length;let i="";typeof e.message=="string"?i=B(e.message,t.truncate):r.unshift("message"),i=i?`: ${i}`:"",t.truncate-=i.length+5;const s=b(r.map(l=>[l,V(e,l)]),e,t,n,P);return`${o}${i}${s?` { ${s} }`:""}`},$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?De(e,e.toString()):e.toString(),t.truncate),"number")}const Yt=()=>"Promise{…}",qt=(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"),Xt={" ":String.raw`\t`,"\n":String.raw`\n`,"\f":String.raw`\f`,"\r":String.raw`\r`,"\b":String.raw`\b`,"'":String.raw`\'`,"\\":"\\\\"},Zt=16,Qt=e=>Xt[e]||String.raw`\u${`0000${e.codePointAt(0).toString(Zt)}`.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 i="";const s=Number.isFinite(t.maxArrayLength)?Math.min(e.length,Math.max(0,Math.floor(t.maxArrayLength))):e.length;for(let c=0;c<s;c++){const a=`${t.stylize(B(e[c],t.truncate),"number")}${c===s-1?"":", "}`;if(t.truncate-=a.length,c!==s-1&&t.truncate<=3){i+=`…(${String(e.length-c)})`;break}i+=a}s<e.length&&(i+=`${i?", ":""}… ${String(e.length-s)} more`);let l="";return o.length>0&&(l=b(o.map(c=>[c,V(e,c)]),e,t,n,P)),`${r}[ ${i}${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:Pt,Date:Vt,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:Yt,RegExp:qt,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 i=F(e,"inspect");if(typeof i=="function")return i.call(e,r,t);const s=F(e,"constructor");if(typeof s=="function"&&Ie.has(s))return Ie.get(s)?.(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:i}=n;if(i.includes(e))return"[Circular]";if(r>=t.depth&&t.depth>0&&typeof e=="object"&&e!==null)return Ge(e)?"[Array]":"[Object]";const s=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,s);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,s);if(e&&typeof HTMLElement=="function"&&zt(e,HTMLElement))return Ve(e,e,t,o);const u=F(e,"constructor");return u!==void 0?u!==Object?Ct(e,t,o,s):K(e,t,o,s):e===Object(e)?K(e,t,o,s):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,i,s)=>{if(i==null){r.depth+=1;const c=re(o,s,r);return r.depth-=1,c}r.seen.push(i),r.depth+=1;const l=re(o,s,r);return r.depth-=1,r.seen.pop(),l},re(e,n,r)},un=new Set(["alert","critical","emergency","error","trace","warning"]),Xr=e=>un.has(e),Zr=(e,t)=>t?(t.__write??t.write.bind(t)).call(t,e):!1,fn=globalThis.process??Object.create(null),ke={versions:{}},D=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 D.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=D.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},i={...o,...e.end},s=o.line,l=o.column,c=i.line,a=i.column;let u=Math.max(s-(n+1),0),d=Math.min(t.length,c+r);s===-1&&(u=0),c===-1&&(d=t.length);const g=c-s,f={};if(g)for(let h=0;h<=g;h++){const p=h+s;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[s]=l?[l,0]:!0:f[s]=[l,(a??0)-(l??0)];return{end:d,markerLines:f,start:u}},hn=D.platform==="win32"&&!D.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 i=(e.includes("\r")?dn(e):e).split(`
|
|
5
|
+
`);typeof r.tabWidth=="number"&&e.includes(" ")&&(i=i.map(h=>h.replaceAll(" "," ".repeat(r.tabWidth))));const{end:s,markerLines:l,start:c}=gn(t,i,r.linesAbove,r.linesBelow),a=String(s).length,{gutter:u,marker:d,message:g}=r.color;let f=i.slice(c,s).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=()=>D.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:/,Ye=/^Anonymous function$/,Tn=/^\s*in\s.*/,jn=/^.*?\s*at\s.*/,Fn=/^.*?\s*@.*|\[native code\]/,qe=(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,i;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&&(i={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[s,l]=qe(t[1]?t[1].replace(Ye,"<anonymous>"):_,t[2]),c={column:t[4]?+t[4]:void 0,evalOrigin:o,file:l,line:t[3]?+t[3]:void 0,methodName:s,raw:e,type:r?"eval":n?"native":bn(l)?"internal":void 0};return i?(c.column=i.column,c.file=i.file,c.line=i.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 i;r&&o&&(n[3]=o[1],i={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[s,l]=qe(n[1]?n[1].replace(Ye,"<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:i,file:l,line:a,methodName:s,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(i=>(Be.test(i)?i.replace(Be,"$1"):i).trim()).filter(i=>!Ln.test(i)&&i!=="eval code");return t&&(o=o.filter(i=>t(i))),o=o.slice(0,n),o.reduce((i,s,l)=>{if(!s||s.length>1024)return i;let c;if(Tn.test(s))c=Wn(s);else if(jn.test(s))c=Mn(s);else if(Fn.test(s)){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(s,a)??_n(s,a)}else c=Rn(s);return c?i.push(c):M(`parse error stack line: "${s}"`,"not parser found"),i},[])},Le=ee("node:fs"),X=ee("node:path"),Cn=ee("node:process"),Pn=ee("node:url"),O=(e,t,n)=>n===0?e:t===" "?e+" ".repeat(n):e+" ".repeat(t*n),Xe=e=>e.replaceAll("\\","/"),Vn=e=>{if(!e.startsWith("file:"))return e;try{return Pn().fileURLToPath(e)}catch{return e}},Dn=(e,t)=>{const n=e.replace("async file:","file:");return Xe(X().relative(t,Vn(n)))},Gn=(e,t,n)=>{if(t)return n.title(e.message);const r=e.message?`: ${e.message}`:"";return n.title(e.name+r)},Ze=(e,{color:t,hideErrorTitle:n,indentation:r,prefix:o},i)=>`${O(o,r,i)}${Gn(e,n,t)}
|
|
10
|
+
`,Qe=(e,{color:t,indentation:n,prefix:r},o)=>{if(e.hint===void 0)return;const i=O(r,n,o);let s="";if(Array.isArray(e.hint))for(const l of e.hint)s+=`${i+l}
|
|
11
|
+
`;else s+=i+e.hint;return t.hint(s)},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:i,indentation:s,prefix:l}=t,{trace:c}=e;let a;c.file===void 0?a="<unknown>":a=i?Dn(c.file,o):Xe(c.file);const{fileLine:u,method:d}=r;return`${O(l,s,n)}at ${c.methodName?`${d(c.methodName)} `:""}${u(a)}:${u(c.line?.toString()??"")}`},Hn=(e,t)=>{if(t.allowAllFilePaths)return!0;const n=X().resolve(t.cwd),r=X().resolve(n,e);return r===n||r.startsWith(n+X().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:i,linesBelow:s,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:i,linesBelow:s,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 i of e.errors)o?o=!1:r+=`
|
|
14
|
+
|
|
15
|
+
`,r+=rt(i,{...t,framesMaxLimit:1,hideErrorCodeView:t.hideErrorErrorsCodeView},n+1);return`
|
|
16
|
+
${r}`},Yn=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:i}=e;if(!(i instanceof Error)){const c=Yn(i);return o+=`${O(t.prefix,t.indentation,n)}${t.color.title(c)}
|
|
19
|
+
`,`
|
|
20
|
+
${o}`}o+=Ze(i,t,n);const s=Ke(i).shift(),l=Qe(i,t,n);if(l&&(o+=`${l}
|
|
21
|
+
`),s){const c=de(s,t.sourceMap);if(o+=ge(c,t,n),!t.hideErrorCauseCodeView){const a=et(c,t,n);a!==void 0&&(o+=`
|
|
22
|
+
${a}`)}}if(i instanceof AggregateError){const c=tt(i,t,n);c!==void 0&&(o+=`
|
|
23
|
+
${c}`)}return i.cause&&(o+=r.has(i)?`
|
|
24
|
+
${O(t.prefix,t.indentation,n+1)}Caused by: [Circular]`:`
|
|
25
|
+
${nt(i,t,n+1,r)}`),`
|
|
26
|
+
${o}`},qn=(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:Cn().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}),i=o.shift(),s=i?de(i,r.sourceMap):void 0;return[t.hideMessage?void 0:Ze(e,r,n),Qe(e,r,n),s?ge(s,r,n):void 0,s&&!r.hideErrorCodeView?et(s,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?qn(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,Xn=65510,Zn=[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],ir=4352,sr=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),i=o*2;if(t<e[i])r=o-1;else if(t>e[i+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],i=e[r+1];if(Te>=o&&Te<=i)return[o,i];i-o>n-t&&(t=o,n=i)}return[t,n]}const ur=e=>e<161||e>1114109?!1:H(Jn,e),fr=e=>e<Kn||e>Xn?!1:H(Zn,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<ir||e>sr?!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 it(e){return mr(e),pr(e)}const st=String.raw,je=st`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,yr=()=>new RegExp(st`\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},Y=new RegExp(ct.source,"y"),oe=new RegExp(Sr.source,"uy"),q=/(?:[\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 i=n.get(r);if(i||(i=new Map,n.set(r,i)),i.has(o))return i.get(o);let s;switch(at(e)){case"control":{s=t.width.control;break}case"latin":{s=t.width.regular;break}case"wide":{s=t.width.wide;break}case"zero":{s=0;break}default:switch(it(e)){case"ambiguous":{s=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{s=t.width.fullWidth;break}case"wide":{s=t.width.wide;break}default:s=t.width.regular}}return i.set(o,s),s},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,i=o>1e4;let s=0,l=0,c=o,a=!1;const u=e.includes("\x1B")||e.includes("");for(;s<o;){if(u&&(e[s]==="\x1B"||e[s]==="")){if(e.startsWith("\x1B]8;;",s)){const m="\x1B]8;;\x07",y=m.length,$=e.indexOf("\x07",s+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,s);else if(l+T>r&&(c=Math.min(c,s),a=!0,l+T>n.truncation.limit))break;if(l+=T,s=x,a&&l>=n.truncation.limit)break;continue}}}if(Y.lastIndex=s,Y.test(e)){const m=Y.lastIndex-s,y=n.truncation.countAnsiEscapeCodes?m:n.width.ansi;if(l+y>r&&(c=Math.min(c,s),l+y>n.truncation.limit)){a=!0;break}l+=y,s=Y.lastIndex;continue}}const f=e.codePointAt(s);if(f===8203||f===65279||f>=8288&&f<=8292){s+=1;continue}if(f===9){if(l+n.width.tab>r&&(c=Math.min(c,s),l+n.width.tab>n.truncation.limit)){a=!0;break}l+=n.width.tab,s+=1;continue}if(q.lastIndex=s,q.test(e)){const m=(q.lastIndex-s)*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,s+y),l+m>n.truncation.limit){a=!0;break}}l+=m,s=q.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(U.lastIndex=s,U.test(e))){const m=(U.lastIndex-s)*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,s+y),l+m>n.truncation.limit){a=!0;break}}l+=m,s=U.lastIndex;continue}if(oe.lastIndex=s,oe.test(e)){if(l+n.width.emoji>r&&(c=Math.min(c,s),l+n.width.emoji>n.truncation.limit)){a=!0;break}l+=n.width.emoji,s=oe.lastIndex;continue}const h=e.codePointAt(s)??0;if(Nr(h)){s+=h>65535?2:1;continue}let p;if(i)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(it(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,s),l+p>n.truncation.limit)){a=!0;break}l+=p,s+=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(i=>!i.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,i="",s="",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=s),t.onSegment?.(m,n)===!1)return;r=""}o=!0,i=u;const f=Or(c,a),{isInsideLinkEscape:h}=f;if(h){let p=a+1;for(s="";p<c.length;){const y=c[p];if(y===te)break;s+=y,p+=1}s=s.slice(4);const m={hyperlinkUrl:s,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(t.onSegment?.(m,n)===!1)return;a=p,l=!0,o=!1,i="";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,s="",a+=1,o=!1,i="";continue}}if(o){if(i!==u&&(i+=u),u===he){o=!1,n.processEscape(i);const f={isEscapeSequence:!0,isGrapheme:!1,text:i,width:0};if(t.onSegment?.(f,n)===!1)return;i=""}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=s),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=s),t.onSegment?.(u,n)}if(i){const a={isEscapeSequence:!0,isGrapheme:!1,text:i,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
|
+
`),i=[...o];let s=0;for(const[l,c]of i.entries()){if(t+=c,R.has(c)){const u=wr.exec(o.slice(s))?.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));i[l+1]===`
|
|
31
|
+
`?(r&&(t+=Me("")),n&&a&&(t+=We(a))):c===`
|
|
32
|
+
`&&(n&&a&&(t+=We(n)),r&&(t+=Me(r))),s+=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},ie=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 i="",s=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,i+=g,c=e.startsWith(G,u+1),u+=1;continue}if(l){a+=g,i+=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){i+=g,u+=f;continue}if(s+h>t&&(i&&r.push(i+o.getEndEscapesForAllActiveAttributes()),i=o.getStartEscapesForAllActiveAttributes(),s=k(i),p&&n)){for(;u<e.length&&e[u]===" ";)u+=1;continue}if(i+=g,s+=h,s===t&&u+f<e.length&&(r.push(i+o.getEndEscapesForAllActiveAttributes()),i=o.getStartEscapesForAllActiveAttributes(),s=k(i),u+f<e.length&&e[u+f]===" "&&n)){for(u+=f;u<e.length&&e[u]===" ";)u+=1;continue}u+=f}return i&&r.push(i+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 i="",s=0;return kr(r,{getWidth:k,onSegment:(l,c)=>{const a=l.text??"";if(l.isEscapeSequence)i+=a;else{const u=a===" ";if(l.width===0)return i+=a,!0;if(s+l.width>t&&(i&&o.push(i),i=c.getStartEscapesForAllActiveAttributes(),s=0,u))return n||o.push(c.getStartEscapesForAllActiveAttributes()+a),!0;i+=a,s+=l.width}return!0}}),i&&o.push(i),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),i=[];let s="",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?i.push(W(s)):i.push(s),s="",l=0;continue}s+=a,l+=d,c+=1}return s&&(n?i.push(W(s)):i.push(s)),i},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),i=[];let s="",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){s&&i.push(ie(n?W(s):s));const g=gt(a,t,n);if(g.length>0){for(let f=0;f<g.length-1;f+=1)i.push(g[f]);s=g.at(-1),l=k(s)}else s="",l=0;c+=1;continue}if(l+d>t&&l>0&&(i.push(ie(n?W(s):s)),s="",l=0,n&&u)){c+=1;continue}s+=a,l+=d,c+=1}return s&&i.push(ie(n?W(s):s)),i},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:i=J.PRESERVE_WORDS}=t;if(r&&e.trim()==="")return"";let s=e.normalize("NFC").replaceAll(`\r
|
|
33
|
+
`,`
|
|
34
|
+
`);return n&&(s=s.replaceAll($r,"")),s.split(`
|
|
35
|
+
`).map(l=>{if(r&&l.trim()==="")return"";let c;switch(i){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(),Z=(e,t)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(t,10)}),mt=(e,t)=>{const{columns:n,rows:r}=Z(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=C.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 Z(t.columns,t.rows);if(n?.columns&&n?.rows)return Z(n.columns,n.rows);if(e.COLUMNS&&e.LINES)return Z(e.COLUMNS,e.LINES);const r={columns:ht,rows:pt};return I.platform==="win32"?se()??r:I.platform==="darwin"?ze()??se()??r:ze()??se()??Mr()??r}const ze=()=>{try{const e=I.platform==="darwin"?C.constants.O_EVTONLY|C.constants.O_NONBLOCK:C.constants.O_NONBLOCK,{columns:t,rows:n}=vt.WriteStream(C.openSync("/dev/tty",e));return{columns:t,rows:n}}catch{}},se=()=>{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:Cr,red:Pr,yellow:le}=Ce,ro={indent:2,quoteStyle:"single",stylize:(e,t)=>{const n={bigint:le,boolean:le,date:Cr,null:_r,number:le,regexp:Pr,special:zr,string:Re,symbol:Re,undefined:Rr};return Object.hasOwn(n,t)?n[t](e):e}},{bold:Vr,underline:Dr}=Ce,oo=(e,t)=>{let n=t.uppercase.label?e.toUpperCase():e;return n=t.underline.label?Dr(n):n,t.bold.label&&(n=Vr(n)),n},Gr=e=>[e.getHours(),e.getMinutes(),e.getSeconds()].map(t=>String(t).padStart(2,"0")).join(":");class io{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{io as A,Yr as E,St as L,Kr as Y,qr as a,no as b,k as c,ro as d,Qr as e,oo as f,Jr as g,Xr as i,to as t,J as v,Zr as w,eo 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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const I=()=>{if(!process.env)return{};const{env:e}=process,E={commit:e.COMMIT_SHA||e.GIT_COMMIT||e.VERCEL_GIT_COMMIT_SHA?.slice(0,7)||e.RAILWAY_GIT_COMMIT_SHA?.slice(0,7)||e.RENDER_GIT_COMMIT?.slice(0,7)||e.HEROKU_SLUG_COMMIT?.slice(0,7)||e.CF_PAGES_COMMIT_SHA?.slice(0,7)||void 0,environment:e.NODE_ENV||e.ENVIRONMENT||e.APP_ENV||void 0,hostname:e.HOSTNAME||e.HOST||void 0,pid:process.pid,region:e.AWS_REGION||e.VERCEL_REGION||e.FLY_REGION||e.RENDER_REGION||e.CF_REGION||e.GOOGLE_CLOUD_REGION||e.FUNCTION_REGION||void 0,service:e.SERVICE_NAME||e.APP_NAME||e.K_SERVICE||e.GAE_SERVICE||e.FUNCTION_TARGET||e.VERCEL_PROJECT_PRODUCTION_URL||e.FLY_APP_NAME||e.RAILWAY_SERVICE_NAME||e.RENDER_SERVICE_NAME||e.HEROKU_APP_NAME||void 0,version:e.APP_VERSION||e.npm_package_version||e.K_REVISION||e.GAE_VERSION||e.RAILWAY_GIT_COMMIT_SHA?.slice(0,7)||e.RENDER_GIT_COMMIT?.slice(0,7)||void 0};return Object.fromEntries(Object.entries(E).filter(([,i])=>i!==void 0))};class c{#e;constructor(E={}){const i=I(),_={};if(E.overrides){const s=Object.entries(E.overrides);for(let r=0;r<s.length;r+=1){const[o,t]=s[r];t!==void 0&&(_[o]=t)}}const n={...i,..._};!E.includePid&&_.pid===void 0&&delete n.pid,!E.includeHostname&&_.hostname===void 0&&delete n.hostname,this.#e=n}process(E){return{...E,envStorage:{...this.#e}}}getEnvironmentInfo(){return{...this.#e}}}export{c as default,I as detectEnvironment};
|