@visulima/pail 4.0.0-alpha.2 → 4.0.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +355 -0
  2. package/LICENSE.md +148 -879
  3. package/README.md +323 -0
  4. package/dist/error.d.ts +103 -0
  5. package/dist/error.js +5 -0
  6. package/dist/index.browser.d.ts +557 -45
  7. package/dist/index.browser.js +19 -12
  8. package/dist/index.server.d.ts +724 -63
  9. package/dist/index.server.js +27 -529
  10. package/dist/middleware/elysia.d.ts +73 -0
  11. package/dist/middleware/elysia.js +1 -0
  12. package/dist/middleware/express.d.ts +88 -0
  13. package/dist/middleware/express.js +1 -0
  14. package/dist/middleware/fastify.d.ts +83 -0
  15. package/dist/middleware/fastify.js +1 -0
  16. package/dist/middleware/hono.d.ts +87 -0
  17. package/dist/middleware/hono.js +1 -0
  18. package/dist/middleware/next/handler.d.ts +103 -0
  19. package/dist/middleware/next/handler.js +1 -0
  20. package/dist/middleware/sveltekit.d.ts +125 -0
  21. package/dist/middleware/sveltekit.js +1 -0
  22. package/dist/object-tree.d.ts +67 -70
  23. package/dist/object-tree.js +2 -89
  24. package/dist/packem_shared/AbstractJsonReporter-D_Pb6kpB.js +1 -0
  25. package/dist/packem_shared/AbstractJsonReporter-PVC4ONf2.js +1 -0
  26. package/dist/packem_shared/JsonReporter-BEEmb0W4.js +2 -0
  27. package/dist/packem_shared/JsonReporter-CE-lw7R0.js +1 -0
  28. package/dist/packem_shared/PrettyReporter-CDv9n1Fy.js +5 -0
  29. package/dist/packem_shared/PrettyReporter-CuFxJm_o.js +44 -0
  30. package/dist/packem_shared/abstract-json-reporter.d-BAgznjyU.d.ts +61 -0
  31. package/dist/packem_shared/abstract-pretty-reporter-BpyhtAoN.js +33 -0
  32. package/dist/packem_shared/constants-DKfCaSUR.js +1 -0
  33. package/dist/packem_shared/constants-ep2nsfdy.js +1 -0
  34. package/dist/packem_shared/create-middleware-logger.d-CR3o6VDh.d.ts +47 -0
  35. package/dist/packem_shared/createPailError-53jAfQ-T.js +5 -0
  36. package/dist/packem_shared/headers-S8WyX-2m.js +1 -0
  37. package/dist/packem_shared/index-Dwp5v97D.js +1 -0
  38. package/dist/packem_shared/pailMiddleware-CWOJRmJq.js +1 -0
  39. package/dist/packem_shared/storage-DHM1EP2P.js +1 -0
  40. package/dist/packem_shared/types.d-BeLumqgD.d.ts +246 -0
  41. package/dist/packem_shared/types.d-Cz9S7jZh.d.ts +201 -0
  42. package/dist/packem_shared/types.d-xxE3FOD3.d.ts +229 -0
  43. package/dist/packem_shared/useLogger-qyZrjy4D.js +1 -0
  44. package/dist/packem_shared/wide-event.d-gb2-ks5w.d.ts +705 -0
  45. package/dist/packem_shared/write-console-log-based-on-level-DfD64owL.js +1 -0
  46. package/dist/packem_shared/write-stream-Dd4_PTcm.js +1 -0
  47. package/dist/processor/caller/caller-processor.d.ts +49 -47
  48. package/dist/processor/caller/caller-processor.js +1 -59
  49. package/dist/processor/environment-processor.d.ts +124 -0
  50. package/dist/processor/environment-processor.js +1 -0
  51. package/dist/processor/message-formatter-processor.d.ts +51 -50
  52. package/dist/processor/message-formatter-processor.js +1 -66
  53. package/dist/processor/opentelemetry-processor.d.ts +69 -66
  54. package/dist/processor/opentelemetry-processor.js +1 -52
  55. package/dist/processor/redact-processor.d.ts +60 -41
  56. package/dist/processor/redact-processor.js +1 -30
  57. package/dist/processor/sampling-processor.d.ts +112 -0
  58. package/dist/processor/sampling-processor.js +1 -0
  59. package/dist/reporter/file/json-file-reporter.d.ts +91 -42
  60. package/dist/reporter/file/json-file-reporter.js +2 -136
  61. package/dist/reporter/http/abstract-http-reporter.d.ts +213 -211
  62. package/dist/reporter/http/abstract-http-reporter.js +2 -435
  63. package/dist/reporter/http/http-reporter.d.ts +40 -36
  64. package/dist/reporter/http/http-reporter.edge-light.d.ts +430 -38
  65. package/dist/reporter/http/http-reporter.edge-light.js +2 -651
  66. package/dist/reporter/http/http-reporter.js +1 -13
  67. package/dist/reporter/json/index.browser.d.ts +98 -3
  68. package/dist/reporter/json/index.browser.js +1 -2
  69. package/dist/reporter/json/index.d.ts +51 -3
  70. package/dist/reporter/json/index.js +1 -2
  71. package/dist/reporter/pretty/index.browser.d.ts +105 -2
  72. package/dist/reporter/pretty/index.browser.js +1 -1
  73. package/dist/reporter/pretty/index.d.ts +150 -2
  74. package/dist/reporter/pretty/index.js +1 -1
  75. package/dist/reporter/simple/simple-reporter.server.d.ts +133 -18
  76. package/dist/reporter/simple/simple-reporter.server.js +8 -186
  77. package/dist/wide-event.d.ts +5 -0
  78. package/dist/wide-event.js +1 -0
  79. package/package.json +87 -37
  80. package/dist/constants.d.ts +0 -37
  81. package/dist/interactive/index.d.ts +0 -2
  82. package/dist/interactive/index.js +0 -2
  83. package/dist/interactive/interactive-manager.d.ts +0 -108
  84. package/dist/interactive/interactive-stream-hook.d.ts +0 -68
  85. package/dist/packem_shared/AbstractJsonReporter-BaZ33PlE.js +0 -204
  86. package/dist/packem_shared/InteractiveManager-CbE7d1kY.js +0 -172
  87. package/dist/packem_shared/InteractiveStreamHook-DiSubbJ1.js +0 -21
  88. package/dist/packem_shared/JsonReporter-BRw4skd5.js +0 -28
  89. package/dist/packem_shared/JsonReporter-VzgyLEYz.js +0 -58
  90. package/dist/packem_shared/PrettyReporter-C2wVB7yu.js +0 -222
  91. package/dist/packem_shared/PrettyReporter-DySIXBjQ.js +0 -169
  92. package/dist/packem_shared/abstract-pretty-reporter-Di_sdm2r.js +0 -50
  93. package/dist/packem_shared/constants-omsTHUWB.js +0 -119
  94. package/dist/packem_shared/format-label-De49vNPd.js +0 -1193
  95. package/dist/packem_shared/get-longest-label-C9PWeyKq.js +0 -9
  96. package/dist/packem_shared/index-BomQ3E6J.js +0 -650
  97. package/dist/packem_shared/index-EZ_WSQZS.js +0 -1146
  98. package/dist/packem_shared/interactive-stream-hook-DG4BtN12.js +0 -141
  99. package/dist/packem_shared/pail.browser-u2CSR_af.js +0 -1427
  100. package/dist/packem_shared/write-console-log-based-on-level-DBmRYXpj.js +0 -14
  101. package/dist/packem_shared/write-stream-BG8fhcs3.js +0 -6
  102. package/dist/pail.browser.d.ts +0 -412
  103. package/dist/pail.server.d.ts +0 -233
  104. package/dist/processor/caller/get-caller-filename.d.ts +0 -23
  105. package/dist/progress-bar.d.ts +0 -136
  106. package/dist/progress-bar.js +0 -404
  107. package/dist/reporter/file/utils/rotating-file-stream.d.ts +0 -48
  108. package/dist/reporter/http/utils/compression.d.ts +0 -7
  109. package/dist/reporter/http/utils/log-size-error.d.ts +0 -30
  110. package/dist/reporter/http/utils/retry.d.ts +0 -27
  111. package/dist/reporter/json/abstract-json-reporter.d.ts +0 -61
  112. package/dist/reporter/json/json-reporter.browser.d.ts +0 -40
  113. package/dist/reporter/json/json-reporter.server.d.ts +0 -50
  114. package/dist/reporter/pretty/abstract-pretty-reporter.d.ts +0 -83
  115. package/dist/reporter/pretty/pretty-reporter.browser.d.ts +0 -36
  116. package/dist/reporter/pretty/pretty-reporter.server.d.ts +0 -70
  117. package/dist/reporter/raw/raw-reporter.browser.d.ts +0 -5
  118. package/dist/reporter/raw/raw-reporter.server.d.ts +0 -13
  119. package/dist/reporter/utils/default-inspector-config.d.ts +0 -3
  120. package/dist/reporter/utils/format-label.d.ts +0 -3
  121. package/dist/spinner.d.ts +0 -220
  122. package/dist/spinner.js +0 -2150
  123. package/dist/types.d.ts +0 -241
  124. package/dist/utils/ansi-escapes.d.ts +0 -4
  125. package/dist/utils/arrayify.d.ts +0 -2
  126. package/dist/utils/get-longest-badge.d.ts +0 -4
  127. package/dist/utils/get-longest-label.d.ts +0 -4
  128. package/dist/utils/merge-types.d.ts +0 -4
  129. package/dist/utils/stream/safe-stream-handler.d.ts +0 -21
  130. package/dist/utils/write-console-log-based-on-level.d.ts +0 -4
  131. package/dist/utils/write-stream.d.ts +0 -2
@@ -0,0 +1,33 @@
1
+ var Ft=Object.defineProperty;var b=(e,t)=>Ft(e,"name",{value:t,configurable:!0});import{createRequire as Lt}from"node:module";import Je from"@visulima/colorize";const _t=Lt(import.meta.url),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,se=b(e=>{if(typeof _<"u"&&_.versions&&_.versions.node){const[t,r]=_.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return _.getBuiltinModule(e)}return _t(e)},"__cjs_getBuiltinModule"),{createRequire:Mt}=se("node:module"),k=_,{execFileSync:Ct}=se("node:child_process"),G=se("node:fs"),Rt=se("node:tty"),Ha={alert:7,critical:6,debug:1,emergency:8,error:5,informational:2,notice:3,trace:2,warning:4},zt={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"}},Da=Symbol("EMPTY");var Vt=Object.defineProperty,Ht=b((e,t)=>Vt(e,"name",{value:t,configurable:!0}),"g$6");const Ga=Ht(e=>{const t=Object.keys(e).map(r=>e[r].label??"");return t.length===0?"":t.reduce((r,n)=>r.length>n.length?r:n,"")},"getLongestLabel");var Dt=Object.defineProperty,Ke=b((e,t)=>Dt(e,"name",{value:t,configurable:!0}),"w$5"),Gt=Object.defineProperty,$=Ke((e,t)=>Gt(e,"name",{value:t,configurable:!0}),"c"),qt=Object.defineProperty,Yt=$((e,t)=>qt(e,"name",{value:t,configurable:!0}),"L");const S=Yt((e,t,r,n,i,a=", ")=>{const o=e.length;if(o===0)return"";let l=n;i!==void 0&&(l=i);const s=r.truncate;let c="",u="",f="";for(let p=0;p<o;p+=1){const d=p+1===e.length,g=p+2===e.length;f=`…(${String(e.length-p)})`;let m=e[p];r.truncate=s-c.length-(d?0:a.length);const h=u||l(m,t,r,n)+(d?"":a),v=c.length+h.length,j=v+f.length;if(d&&v>s&&c.length+f.length<=s||!d&&!g&&j>s)break;m=e[p+1];const P=g?"":a;if(d?u="":u=l(m,t,r,n)+P,!d&&g&&j>s&&v+u.length>s)break;if(c+=h,!d&&!g&&v+u.length>=s){f=`…(${String(e.length-p-1)})`;break}f=""}return`${c}${f}`},"inspectList");var Ut=Object.defineProperty,ce=$((e,t)=>Ut(e,"name",{value:t,configurable:!0}),"s$7");const Jt=ce(([e,t],r,n)=>(n.truncate-=3,t?`${n.stylize(String(e),"yellow")}=${n.stylize(`"${t}"`,"string")}`:n.stylize(String(e),"yellow")),"inspectAttribute"),Kt=ce((e,t,r)=>{switch(e.nodeType){case 1:return Qe(e,e,r,t);case 3:return t(e.data,t,r);default:return t(e,t,r)}},"inspectNode"),we=ce((e,t,r,n)=>S(e,e,t,r,Kt,`
2
+ `),"inspectNodeCollection"),Qe=ce((e,t,r,n)=>{const i=e.getAttributeNames(),a=e.tagName.toLowerCase(),o=r.stylize(`<${a}`,"special"),l=r.stylize(">","special"),s=r.stylize(`</${a}>`,"special");r.truncate-=a.length*2+5;let c="";i.length>0&&(c+=" ",c+=S(i.map(p=>[p,e.getAttribute(p)]),t,r,n,Jt," ")),r.truncate-=c.length;const{truncate:u}=r;let f=we(e.children,r,n,void 0);return f&&f.length>u&&(f=`…(${String(e.children.length)})`),`${o}${c}${l}${f}${s}`},"inspectHTMLElement");var Qt=Object.defineProperty,Zt=$((e,t)=>Qt(e,"name",{value:t,configurable:!0}),"n$4");const Xt=Zt((e,t,r)=>e.length===0?"Arguments []":(t.truncate-=13,`Arguments [ ${S(e,e,t,r)} ]`),"inspectArguments");var er=Object.defineProperty,Ze=$((e,t)=>er(e,"name",{value:t,configurable:!0}),"r$3");const tr=Ze((e,t)=>{let r;if(e===" ")r=" ";else if(typeof e=="number"&&e>0)r=Array.from({length:e+1}).join(" ");else return;return{base:r,prev:`
3
+ ${Array.from({length:t+1}).join(r)}`}},"getIndent"),ue=Ze((e,t)=>{if(e.length===0)return"";const r=t.prev+t.base;return r+e.split("\0\0").join(`,${r}`)+t.prev},"indentedJoin");var rr=Object.defineProperty,Xe=$((e,t)=>rr(e,"name",{value:t,configurable:!0}),"i$6");const nr=/^[a-z_]\w*$/i,ir=/^"|"$/g,ar=Xe((e,t)=>{if(nr.test(e))return e;const r=JSON.stringify(e);return t.quoteStyle==="double"?r.replaceAll('"',String.raw`\"`):r.replaceAll("'",String.raw`\'`).replaceAll(String.raw`\"`,'"').replaceAll(ir,"'")},"quoteComplexKey"),q=Xe(([e,t],r,n,i)=>{n.truncate-=2;let a;typeof e=="string"?a=ar(e,n):typeof e=="number"?a=String(e):a=`[${i(e,r,n)}]`,n.truncate-=a.length;const o=i(t,r,n);return`${a}: ${o}`},"inspectProperty");var or=Object.defineProperty,et=$((e,t)=>or(e,"name",{value:t,configurable:!0}),"i$5");const lr=et(e=>{for(const t of e)if(Array.isArray(t)||typeof t=="object"&&t!==null)return!0;return!1},"multiLineValues"),sr=et((e,t,r,n)=>{const i=Object.keys(e).slice(e.length);if(e.length===0&&i.length===0)return"[]";t.truncate-=4;const a=!!n&&lr(e);let o=S(e,e,t,r,void 0,a?"\0\0":", ");t.truncate-=o.length;let l="";return i.length>0&&(l=S(i.map(s=>[s,e[s]]),e,t,r,q)),a&&n&&(o=ue(o,n)),`[${a?"":" "}${o}${l?`, ${l}`:""}${a?"":" "}]`},"inspectArray");var cr=Object.defineProperty,ur=$((e,t)=>cr(e,"name",{value:t,configurable:!0}),"o$6");const Te=/\d(?=(?:\d{3})+(?!\d))/g,fr=/\d{3}/g,dr=/_$/,tt=ur((e,t)=>{if(e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||t.includes("e"))return t;if(typeof e=="number"){const r=e<0?-Math.floor(-e):Math.floor(e);if(r!==e){const n=String(r),i=t.slice(n.length+1);return`${n.replace(Te,"$&_")}.${i.replace(fr,"$&_").replace(dr,"")}`}}return t.replace(Te,"$&_")},"addNumericSeparator");var gr=Object.defineProperty,rt=$((e,t)=>gr(e,"name",{value:t,configurable:!0}),"i$4");const pr=rt(e=>e>="\uD800"&&e<="\uDBFF","isHighSurrogate"),x=rt((e,t,r="…")=>{e=String(e);const n=r.length,i=e.length;if(n>t&&i>n)return r;if(i>t&&i>n){let a=t-n;return a>0&&pr(e[a-1])&&(a-=1),`${e.slice(0,a)}${r}`}return e},"truncate");var mr=Object.defineProperty,hr=$((e,t)=>mr(e,"name",{value:t,configurable:!0}),"e$4");const We=hr((e,t)=>{let r=x(e.toString(),t.truncate-1);return r!=="…"&&(r+="n"),t.stylize(t.numericSeparator?tt(e,r):r,"bigint")},"inspectBigInt");var br=Object.defineProperty,$r=$((e,t)=>br(e,"name",{value:t,configurable:!0}),"m$1");const vr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:void 0),ne=$r((e,t,r,n)=>{if("window"in globalThis&&e===globalThis)return"{ [object Window] }";if(e===globalThis)return"{ [object globalThis] }";const i=Object.getOwnPropertyNames(e),a=Object.getOwnPropertySymbols(e),o=vr(e)===Object.prototype||e.constructor===Object,l=e instanceof Object?"":"null prototype";let s;!o&&Symbol.toStringTag in e?s=e[Symbol.toStringTag]:s=l?"Object":"";const c=s||l?`[${[s,l].filter(Boolean).join(": ")}] `:"";if(i.length===0&&a.length===0)return`${c}{}`;t.truncate-=4;const u=n?"\0\0":", ",f=S(i.map(g=>[g,e[g]]),e,t,r,q,u),p=S(a.map(g=>[g,e[g]]),e,t,r,q,u);let d="";return f&&p&&(d=u),n?`${c}{${ue(f+d+p,n)}}`:`${c}{ ${f}${d}${p} }`},"inspectObject");var yr=Object.defineProperty,wr=$((e,t)=>yr(e,"name",{value:t,configurable:!0}),"s$4");const Sr=wr((e,t,r,n)=>{let i="";return i=i||e.constructor.name,(!i||i==="_class")&&(i="<Anonymous Class>"),t.truncate-=i.length,`${i} ${ne(e,t,r,n)}`},"inspectClass");var Or=Object.defineProperty,Er=$((e,t)=>Or(e,"name",{value:t,configurable:!0}),"i$3");const jr=Er((e,t)=>{const r=e.toJSON();if(r===null)return"Invalid Date";const n=r.split("T"),i=n[0];return t.stylize(`${i}T${x(n[1],t.truncate-i.length-1)}`,"date")},"inspectDate");var Ar=Object.defineProperty,Nr=$((e,t)=>Ar(e,"name",{value:t,configurable:!0}),"c$4");const xr=new Set(["column","columnNumber","description","fileName","line","lineNumber","message","name","number","stack"]),Ir=Nr((e,t,r)=>{const n=Object.getOwnPropertyNames(e).filter(l=>!xr.has(l)),{name:i}=e;t.truncate-=i.length;let a="";typeof e.message=="string"?a=x(e.message,t.truncate):n.unshift("message"),a=a?`: ${a}`:"",t.truncate-=a.length+5;const o=S(n.map(l=>[l,e[l]]),e,t,r,q);return`${i}${a}${o?` { ${o} }`:""}`},"inspectObject");var Pr=Object.defineProperty,kr=$((e,t)=>Pr(e,"name",{value:t,configurable:!0}),"c$3");const Be=kr((e,t)=>{const r=e[Symbol.toStringTag]||"Function",n=e.toString();if(n.length<t.truncate-12)return t.stylize(`[${r}: ${n}]`,"special");const{name:i}=e;return i?t.stylize(`[${r} ${x(i,t.truncate-11)}]`,"special"):t.stylize(`[${r}]`,"special")},"inspectFunction");var Tr=Object.defineProperty,nt=$((e,t)=>Tr(e,"name",{value:t,configurable:!0}),"p$3");const Wr=nt(([e,t],r,n,i)=>(n.truncate-=4,e=i(e,r,n),n.truncate-=e.length,`${e} => ${i(t,r,n)}`),"inspectMapEntry"),Br=nt((e,t,r,n)=>{if(e.size<=0)return"Map (0) {}";t.truncate-=7;let i=S([...e.entries()],e,t,r,Wr,n?"\0\0":", ");return n&&(i=ue(i,n)),`Map (${String(e.size)}) {${n?"":" "}${i}${n?"":" "}}`},"inspectMap");var Fr=Object.defineProperty,Lr=$((e,t)=>Fr(e,"name",{value:t,configurable:!0}),"e$3");function Y(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(x(t.numericSeparator?tt(e,e.toString()):e.toString(),t.truncate),"number")}b(Y,"j$5");Ke(Y,"P");$(Y,"u$3");Lr(Y,"inspectNumber");var _r=Object.defineProperty,Mr=$((e,t)=>_r(e,"name",{value:t,configurable:!0}),"e$2");const Cr=Mr(()=>"Promise{…}","getPromiseValue");var Rr=Object.defineProperty,zr=$((e,t)=>Rr(e,"name",{value:t,configurable:!0}),"p$1");const Vr=zr((e,t)=>{const r=t.truncate-(2+e.flags.length);return t.stylize(`/${x(e.source,r)}/${e.flags}`,"regexp")},"inspectRegExp");var Hr=Object.defineProperty,Dr=$((e,t)=>Hr(e,"name",{value:t,configurable:!0}),"i$1");const Gr=Dr((e,t,r,n)=>{if(e.size===0)return"Set (0) {}";t.truncate-=7;let i=S([...e],e,t,r,void 0,n?"\0\0":", ");return n&&(i=ue(i,n)),`Set (${String(e.size)}) {${n?"":" "}${i}${n?"":" "}}`},"inspectSet");var qr=Object.defineProperty,Yr=$((e,t)=>qr(e,"name",{value:t,configurable:!0}),"l");const Ur=Yr((e,t)=>{const r=t.quoteStyle==="double"?'"':"'";return t.quoteStyle==="double"&&(e=e.replaceAll('"','"')),r+e+r},"wrapQuotes");var Jr=Object.defineProperty,it=$((e,t)=>Jr(e,"name",{value:t,configurable:!0}),"e$1");const Fe=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"),Kr={" ":String.raw`\t`,"\n":String.raw`\n`,"\f":String.raw`\f`,"\r":String.raw`\r`,"\b":String.raw`\b`,"'":String.raw`\'`,"\\":"\\\\"},Qr=16,Zr=it(e=>Kr[e]||String.raw`\u${`0000${e.codePointAt(0).toString(Qr)}`.slice(-4)}`,"escape"),Le=it((e,t)=>(Fe.test(e)&&(e=e.replaceAll(Fe,Zr)),t.stylize(Ur(x(e,t.truncate-2),t),"string")),"inspectString");var Xr=Object.defineProperty,en=$((e,t)=>Xr(e,"name",{value:t,configurable:!0}),"o");const _e=en(e=>"description"in Symbol.prototype?e.description?`Symbol(${e.description})`:"Symbol()":e.toString(),"inspectSymbol");var tn=Object.defineProperty,at=$((e,t)=>tn(e,"name",{value:t,configurable:!0}),"f");const rn=at(e=>typeof Buffer=="function"&&e instanceof Buffer?"Buffer":e[Symbol.toStringTag],"getArrayName"),O=at((e,t,r)=>{const n=rn(e);t.truncate-=n.length+4;const i=Object.keys(e).slice(e.length);if(e.length===0&&i.length===0)return`${n}[]`;let a="";for(let l=0;l<e.length;l++){const s=`${t.stylize(x(e[l],t.truncate),"number")}${l===e.length-1?"":", "}`;if(t.truncate-=s.length,l!==e.length-1&&t.truncate<=3){a+=`…(${String(e.length-l)})`;break}a+=s}let o="";return i.length>0&&(o=S(i.map(l=>[l,e[l]]),e,t,r,q)),`${n}[ ${a}${o?`, ${o}`:""} ]`},"inspectTypedArray");var nn=Object.defineProperty,w=$((e,t)=>nn(e,"name",{value:t,configurable:!0}),"r");const le=new WeakMap,Se={},an={Arguments:Xt,Array:sr,ArrayBuffer:w(()=>"","ArrayBuffer"),BigInt:We,bigint:We,Boolean:w((e,t)=>t.stylize(String(e),"boolean"),"Boolean"),boolean:w((e,t)=>t.stylize(String(e),"boolean"),"boolean"),DataView:w(()=>"","DataView"),Date:jr,Error:Ir,Float32Array:O,Float64Array:O,Function:Be,function:Be,Generator:w(()=>"","Generator"),HTMLCollection:we,Int8Array:O,Int16Array:O,Int32Array:O,Map:Br,NodeList:we,null:w((e,t)=>t.stylize("null","null"),"null"),Number:Y,number:Y,Promise:Cr,RegExp:Vr,Set:Gr,String:Le,string:Le,Symbol:_e,symbol:_e,Uint8Array:O,Uint8ClampedArray:O,Uint16Array:O,Uint32Array:O,undefined:w((e,t)=>t.stylize("undefined","undefined"),"undefined"),WeakMap:w((e,t)=>t.stylize("WeakMap{…}","special"),"WeakMap"),WeakSet:w((e,t)=>t.stylize("WeakSet{…}","special"),"WeakSet")},Me=Symbol.for("nodejs.util.inspect.custom"),on=w((e,t,r,n)=>{if(!("window"in globalThis)&&typeof e[Me]=="function")return e[Me](n,t);if("inspect"in e&&typeof e.inspect=="function")return e.inspect(n,t);if("constructor"in e&&le.has(e.constructor))return le.get(e.constructor)?.(e,t)??"unknown";const i=Se[r];return i?i(e,t):""},"inspectCustom"),ot=w((e,t,r,n)=>{if(n.includes(e))return"[Circular]";if(r>=t.depth&&t.depth>0&&typeof e=="object")return Array.isArray(e)?"[Array]":"[Object]";const i=w((c,u,f)=>(u&&(n=[...n,u]),ot(c,f,r+1,n)),"inspect"),a=t.indent?tr(t.indent,r):void 0;let o=e===null?"null":typeof e;o==="object"&&(o=Object.prototype.toString.call(e).slice(8,-1));const l=an[o];if(l!==void 0)return l(e,t,i,a);if(t.customInspect&&e){const c=on(e,t,o,t.depth-r);if(c)return typeof c=="string"?c:i(c,e,t)}const s=e?Object.getPrototypeOf(e):!1;return s===Object.prototype||s===null?ne(e,t,i,a):e&&typeof HTMLElement=="function"&&e instanceof HTMLElement?Qe(e,e,t,i):"constructor"in e?e.constructor!==Object?Sr(e,t,i,a):ne(e,t,i,a):e===Object(e)?ne(e,t,i,a):t.stylize(String(e),o)},"internalInspect"),qa=w((e,t={})=>{const r={breakLength:Number.POSITIVE_INFINITY,customInspect:!0,depth:5,indent:void 0,maxArrayLength:Number.POSITIVE_INFINITY,numericSeparator:!0,quoteStyle:"single",showHidden:!1,showProxy:!1,stylize:w(n=>n,"stylize"),truncate:Number.POSITIVE_INFINITY,...t};if(r.indent!==void 0&&r.indent!==" "&&!(Number.parseInt(r.indent,10)===r.indent&&r.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `undefined`');return ot(e,r,0,[])},"inspect");w((e,t)=>le.has(e)?!1:(le.set(e,t),!0),"registerConstructor");w((e,t)=>e in Se?!1:(Se[e]=t,!0),"registerStringTag");var ln=Object.defineProperty,sn=b((e,t)=>ln(e,"name",{value:t,configurable:!0}),"r$6");const Ya=sn((e,t)=>(t.__write??t.write.bind(t)).call(t,e),"writeStream");var cn=Object.defineProperty,un=b((e,t)=>cn(e,"name",{value:t,configurable:!0}),"A$4"),fn=Object.defineProperty,je=un((e,t)=>fn(e,"name",{value:t,configurable:!0}),"$"),dn=Object.defineProperty,gn=je((e,t)=>dn(e,"name",{value:t,configurable:!0}),"r$1");const pn=gn(e=>e.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
4
+ `),"normalizeLF"),mn=globalThis.process??Object.create(null),Ce={versions:{}},Re=new Proxy(mn,{get(e,t){if(t in e)return e[t];if(t in Ce)return Ce[t]}});var hn=Object.defineProperty,bn=je((e,t)=>hn(e,"name",{value:t,configurable:!0}),"b");const $n=bn((e,t,r,n)=>{const i={column:0,line:-1,...e.start},a={...i,...e.end},o=i.line,l=i.column,s=a.line,c=a.column;let u=Math.max(o-(r+1),0),f=Math.min(t.length,s+n);o===-1&&(u=0),s===-1&&(f=t.length);const p=s-o,d={};if(p)for(let g=0;g<=p;g++){const m=g+o;if(!l)d[m]=!0;else if(g===0){const h=t[m-1]?.length;d[m]=[l,(h??0)-l+1]}else if(g===p)d[m]=[0,c];else{const h=t[m-g]?.length;d[m]=[0,h]}}else l===c?d[o]=l?[l,0]:!0:d[o]=[l,(c??0)-(l??0)];return{end:f,markerLines:d,start:u}},"getMarkerLines");var vn=Object.defineProperty,X=je((e,t)=>vn(e,"name",{value:t,configurable:!0}),"t");const yn=Re.platform==="win32"&&!Re.env?.WT_SESSION?">":"❯",wn=X((e,t,r)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...r,color:{gutter:X(g=>g,"gutter"),marker:X(g=>g,"marker"),message:X(g=>g,"message"),...r?.color}},i=typeof t.start.column=="number";let a=pn(e).split(`
5
+ `);typeof n.tabWidth=="number"&&(a=a.map(g=>g.replaceAll(" "," ".repeat(n.tabWidth))));const{end:o,markerLines:l,start:s}=$n(t,a,n.linesAbove,n.linesBelow),c=String(o).length,{gutter:u,marker:f,message:p}=n.color;let d=a.slice(s,o).map((g,m)=>{const h=s+1+m,v=l[h],j=` ${String(h)}`.slice(-c),P=!l[h+1],z=` ${j}${n.showGutter?" |":""}`;if(v){let V="";if(Array.isArray(v)){const Z=g.replaceAll(/[^\t]/g," ").slice(0,Math.max(v[0]-1,0)),H=v[1]||1;V=[`
6
+ `,n.prefix+u(z.replaceAll(/\d/g," "))," ",Z,f("^").repeat(H)].join(""),P&&n.message&&(V+=` ${p(n.message)}`)}return[n.prefix+f(yn),u(z),g.length>0?` ${g}`:"",V].join("")}return`${n.prefix} ${u(z)}${g.length>0?` ${g}`:""}`}).join(`
7
+ `);return n.message&&!i&&(d=`${n.prefix+" ".repeat(c+1)+n.message}
8
+ ${d}`),d},"codeFrame");var Sn=Object.defineProperty,On=b((e,t)=>Sn(e,"name",{value:t,configurable:!0}),"x$4"),En=Object.defineProperty,jn=On((e,t)=>En(e,"name",{value:t,configurable:!0}),"x"),An=Object.defineProperty,E=jn((e,t)=>An(e,"name",{value:t,configurable:!0}),"u");const W=E((e,...t)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${e}`,...t)},"debugLog"),B="<unknown>",Nn=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,xn=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,In=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,Pn=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,kn=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Tn=/in\s(.*)\s\(at\s(.+)\)\sat/,Wn=/^(?:.*@)?(.*):(\d+):(\d+)$/,Bn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Fn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ln=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,ze=/\(error: (.*)\)/,_n=/at\s/,Mn=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,Cn=/\S*(?:Error: |AggregateError:)/,lt=/^Anonymous function$/,Rn=/^\s*in\s.*/,zn=/^.*?\s*at\s.*/,Vn=/^.*?\s*@.*|\[native code\]/,st=E((e,t)=>{const r=e.includes("safari-extension"),n=e.includes("safari-web-extension");return r||n?[e.includes("@")?e.split("@")[0]:B,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},"extractSafariExtensionDetails"),ct=E((e,t)=>{const r=In.exec(t);r&&(e.file=r[1],e.line=+r[2],e.column=+r[3])},"parseMapped"),Hn=E(e=>{const t=Tn.exec(e);if(t){W(`parse nested node error stack line: "${e}"`,`found: ${JSON.stringify(t)}`);const n=t[2].split(":");return{column:n[2]?+n[2]:void 0,file:n[0],line:n[1]?+n[1]:void 0,methodName:t[1]??B,raw:e,type:void 0}}const r=kn.exec(e);if(r){W(`parse node error stack line: "${e}"`,`found: ${JSON.stringify(r)}`);const n={column:r[4]?+r[4]:void 0,file:r[2]?r[2].replace(_n,""):void 0,line:r[3]?+r[3]:void 0,methodName:r[1]??B,raw:e,type:e.startsWith("internal")?"internal":void 0};return ct(n,`${r[2]}:${r[3]}:${r[4]}`),n}},"parseNode"),Dn=E(e=>{const t=Nn.exec(e);if(t){W(`parse chrome error stack line: "${e}"`,`found: ${JSON.stringify(t)}`);const r=t[2]?.startsWith("native"),n=t[2]?.startsWith("eval")||t[1]?.startsWith("eval");let i,a;if(n){const c=xn.exec(e);if(c){const u=Mn.exec(c[1]);u?(t[2]=u[4]??u[1],t[3]=u[5]??u[2],t[4]=u[3]):c[2]&&(t[2]=c[1]),c[2]&&(i={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0,methodName:"eval",raw:e,type:"eval"})}else{const u=Pn.exec(e);u&&(a={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,l]=st(t[1]?t[1].replace(lt,"<anonymous>"):B,t[2]),s={column:t[4]?+t[4]:void 0,evalOrigin:i,file:l,line:t[3]?+t[3]:void 0,methodName:o,raw:e,type:n?"eval":r?"native":void 0};return a?(s.column=a.column,s.file=a.file,s.line=a.line):ct(s,`${l}:${t[3]}:${t[4]}`),s}},"parseChromium"),Gn=E((e,t)=>{const r=Bn.exec(e);if(r){W(`parse gecko error stack line: "${e}"`,`found: ${JSON.stringify(r)}`);const n=r[3]?.includes(" > eval"),i=n&&r[3]&&Fn.exec(r[3]);let a;n&&i&&(r[3]=i[1],a={column:r[5]?+r[5]:void 0,file:r[3],line:r[4]?+r[4]:void 0,methodName:"eval",raw:e,type:"eval"},r[4]=i[2]);const[o,l]=st(r[1]?r[1].replace(lt,"<anonymous>"):B,r[3]);let s;(t?.type==="safari"||!n&&t?.type==="firefox")&&t.column?s=t.column:!n&&r[5]&&(s=+r[5]);let c;return(t?.type==="safari"||!n&&t?.type==="firefox")&&t.line?c=t.line:r[4]&&(c=+r[4]),{column:s,evalOrigin:a,file:l,line:c,methodName:o,raw:e,type:n?"eval":l.includes("[native code]")?"native":void 0}}},"parseGecko"),qn=E((e,t)=>{const r=Ln.exec(e);if(!(r&&r[2].includes(" > eval"))&&r)return W(`parse firefox error stack line: "${e}"`,`found: ${JSON.stringify(r)}`),{column:r[4]?+r[4]:t?.column??void 0,file:r[2],line:r[3]?+r[3]:t?.line??void 0,methodName:r[1]||B,raw:e,type:void 0}},"parseFirefox"),Yn=E(e=>{const t=Wn.exec(e);if(t)return W(`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:B,raw:e,type:void 0}},"parseReactAndroidNative"),ut=E((e,{filter:t,frameLimit:r=50}={})=>{const n=e;let i=(typeof n.stacktrace=="string"?n.stacktrace:e.stack??"").split(`
9
+ `).map(a=>(ze.test(a)?a.replace(ze,"$1"):a).trim()).filter(a=>!Cn.test(a)&&a!=="eval code");return t&&(i=i.filter(a=>t(a))),i=i.slice(0,r),i.reduce((a,o,l)=>{if(!o||o.length>1024)return a;let s;if(Rn.test(o))s=Hn(o);else if(zn.test(o))s=Dn(o);else if(Vn.test(o)){let c;if(l===0){const u=e,f=u.columnNumber,p=u.lineNumber,d=u.line,g=u.column;f||p?c={column:f,line:p,type:"firefox"}:(d||g)&&(c={column:g,line:d,type:"safari"})}s=qn(o,c)??Gn(o,c)}else s=Yn(o);return s?a.push(s):W(`parse error stack line: "${o}"`,"not parser found"),a},[])},"parseStacktrace");var Un=Object.defineProperty,Jn=b((e,t)=>Un(e,"name",{value:t,configurable:!0}),"p$6"),Kn=Object.defineProperty,ft=Jn((e,t)=>Kn(e,"name",{value:t,configurable:!0}),"m");const Qn=Mt(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ae=ft(e=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[t,r]=M.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return M.getBuiltinModule(e)}return Qn(e)},"__cjs_getBuiltinModule"),{existsSync:Zn,readFileSync:Xn}=Ae("node:fs"),{relative:ei}=Ae("node:path"),{cwd:ti}=M,{fileURLToPath:ri}=Ae("node:url");var ni=Object.defineProperty,y=ft((e,t)=>ni(e,"name",{value:t,configurable:!0}),"o");const C=y((e,t,r)=>r===0?e:t===" "?e+" ".repeat(r):e+" ".repeat(t*r),"getPrefix"),ii=y((e,t)=>{const r=e.replace("async file:","file:");return ei(t,r.startsWith("file:")?ri(r):r)},"getRelativePath"),ai=y((e,t,r)=>{if(t)return r.title(e.message);const n=e.message?`: ${e.message}`:"";return r.title(e.name+n)},"getTitleText"),dt=y((e,{color:t,hideErrorTitle:r,indentation:n,prefix:i},a)=>`${C(i,n,a)}${ai(e,r,t)}
10
+ `,"getMessage"),gt=y((e,{color:t,indentation:r,prefix:n},i)=>{if(e.hint===void 0)return;const a=C(n,r,i);let o="";if(Array.isArray(e.hint))for(const l of e.hint)o+=`${a+l}
11
+ `;else o+=a+e.hint;return t.hint(o)},"getHint"),Ne=y((e,{color:t,cwd:r,displayShortPath:n,indentation:i,prefix:a},o=0)=>{const l=n?ii(e.file,r):e.file,{fileLine:s,method:c}=t;return`${C(a,i,o)}at ${e.methodName?`${c(e.methodName)} `:""}${s(l)}:${s(e.line?.toString()??"")}`},"getMainFrame"),pt=y((e,{color:t,indentation:r,linesAbove:n,linesBelow:i,prefix:a,showGutter:o,showLineNumbers:l,tabWidth:s},c)=>{if(e.file===void 0)return;const u=e.file.replace("file://","");if(!Zn(u))return;const f=Xn(u,"utf8");return wn(f,{start:{column:e.column,line:e.line}},{color:t,linesAbove:n,linesBelow:i,prefix:C(a,r,c),showGutter:o,showLineNumbers:l,tabWidth:s})},"getCode"),mt=y((e,t,r)=>{if(e.errors.length===0)return;let n=`${C(t.prefix,t.indentation,r)}Errors:
12
+
13
+ `,i=!0;for(const a of e.errors)i?i=!1:n+=`
14
+
15
+ `,n+=bt(a,{...t,framesMaxLimit:1,hideErrorCodeView:t.hideErrorErrorsCodeView},r+1);return`
16
+ ${n}`},"getErrors"),ht=y((e,t,r)=>{let n=`${C(t.prefix,t.indentation,r)}Caused by:
17
+
18
+ `;const i=e.cause;n+=dt(i,t,r);const a=ut(i).shift(),o=gt(i,t,r);if(o&&(n+=`${o}
19
+ `),a&&(n+=Ne(a,t,r),!t.hideErrorCauseCodeView)){const l=pt(a,t,r);l!==void 0&&(n+=`
20
+ ${l}`)}if(i.cause)n+=`
21
+ ${ht(i,t,r+1)}`;else if(i instanceof AggregateError){const l=mt(i,t,r);l!==void 0&&(n+=`
22
+ ${l}`)}return`
23
+ ${n}`},"getCause"),oi=y((e,t)=>(e.length>0?`
24
+ `:"")+e.map(r=>Ne(r,t)).join(`
25
+ `),"getStacktrace"),bt=y((e,t,r)=>{const n={cwd:ti(),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:y(o=>o,"fileLine"),gutter:y(o=>o,"gutter"),hint:y(o=>o,"hint"),marker:y(o=>o,"marker"),message:y(o=>o,"message"),method:y(o=>o,"method"),title:y(o=>o,"title"),...t.color}},i=ut(e,{filter:t.filterStacktrace,frameLimit:n.framesMaxLimit}),a=i.shift();return[t.hideMessage?void 0:dt(e,n,r),gt(e,n,r),a?Ne(a,n,r):void 0,a&&!n.hideErrorCodeView?pt(a,n,r):void 0,e instanceof AggregateError?mt(e,n,r):void 0,e.cause===void 0?void 0:ht(e,n,r),i.length>0?oi(i,n):void 0].filter(Boolean).join(`
26
+ `).replaceAll("\\","/")},"internalRenderError"),Ua=y((e,t={})=>{if(t.framesMaxLimit!==void 0&&t.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return bt(e,t,0)},"renderError");var li=Object.defineProperty,xe=b((e,t)=>li(e,"name",{value:t,configurable:!0}),"u$3"),si=Object.defineProperty,fe=xe((e,t)=>si(e,"name",{value:t,configurable:!0}),"l");const ci=[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],ui=12288,fi=65510,di=[12288,12288,65281,65376,65504,65510],gi=8361,pi=65518,mi=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],hi=32,bi=10630,$i=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],vi=4352,yi=262141,$t=[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];var wi=Object.defineProperty,Si=fe((e,t)=>wi(e,"name",{value:t,configurable:!0}),"r$1");const J=Si((e,t)=>{let r=0,n=Math.floor(e.length/2)-1;for(;r<=n;){const i=Math.floor((r+n)/2),a=i*2;if(t<e[a])n=i-1;else if(t>e[a+1])r=i+1;else return!0}return!1},"isInRange");var Oi=Object.defineProperty,F=fe((e,t)=>Oi(e,"name",{value:t,configurable:!0}),"r");const Ve=19968,[Ei,ji]=de($t);function de(e){let t=e[0],r=e[1];for(let n=0;n<e.length;n+=2){const i=e[n],a=e[n+1];if(Ve>=i&&Ve<=a)return[i,a];a-i>r-t&&(t=i,r=a)}return[t,r]}b(de,"c$2");xe(de,"f");fe(de,"k");F(de,"findWideFastPathRange");const vt=F(e=>e<161||e>1114109?!1:J(ci,e),"isAmbiguous"),yt=F(e=>e<ui||e>fi?!1:J(di,e),"isFullWidth"),Ai=F(e=>e<gi||e>pi?!1:J(mi,e),"isHalfWidth"),Ni=F(e=>e<hi||e>bi?!1:J($i,e),"isNarrow"),wt=F(e=>e>=Ei&&e<=ji?!0:e<vi||e>yi?!1:J($t,e),"isWide");function ge(e){return vt(e)?"ambiguous":yt(e)?"fullwidth":Ai(e)?"halfwidth":Ni(e)?"narrow":wt(e)?"wide":"neutral"}b(ge,"g$4");xe(ge,"S");fe(ge,"getCategory");F(ge,"getCategory");var xi=Object.defineProperty,pe=b((e,t)=>xi(e,"name",{value:t,configurable:!0}),"i$3"),Ii=Object.defineProperty,me=pe((e,t)=>Ii(e,"name",{value:t,configurable:!0}),"a"),Pi=Object.defineProperty,Ie=me((e,t)=>Pi(e,"name",{value:t,configurable:!0}),"e");function K(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}b(K,"s$2");pe(K,"s");me(K,"r");Ie(K,"validate");function Q(e){return K(e),ge(e)}b(Q,"r$5");pe(Q,"p");me(Q,"eastAsianWidthType");Ie(Q,"eastAsianWidthType");function Pe(e,{ambiguousAsWide:t=!1}={}){return K(e),yt(e)||wt(e)||t&&vt(e)?2:1}b(Pe,"o$5");pe(Pe,"W");me(Pe,"eastAsianWidth");Ie(Pe,"eastAsianWidth");var ki=Object.defineProperty,Ti=b((e,t)=>ki(e,"name",{value:t,configurable:!0}),"p$3"),Wi=Object.defineProperty,St=Ti((e,t)=>Wi(e,"name",{value:t,configurable:!0}),"e"),Bi=Object.defineProperty,Fi=St((e,t)=>Bi(e,"name",{value:t,configurable:!0}),"E");const Ot=String.raw,He=Ot`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Li=Fi(()=>new RegExp(Ot`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${He}(?:\u200D${He})*`,"gu"),"default");var _i=Object.defineProperty,Mi=St((e,t)=>_i(e,"name",{value:t,configurable:!0}),"p");const R=new Set(["\x1B","›"]),he="\x07",Et="[",ke="m",U="]8;;",Ci=39,Ri=/[\u200B\uFEFF\u2060-\u2064]/g,zi=new RegExp(`(?:\\${Et}(?<code>\\d+)m|\\${U}(?<uri>.*)${he})`),Vi=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]])),D=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ee=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,ie=Li();Mi(e=>e.replace(ie,""),"stripEmoji");var Hi=Object.defineProperty,Di=b((e,t)=>Hi(e,"name",{value:t,configurable:!0}),"E"),Gi=Object.defineProperty,qi=Di((e,t)=>Gi(e,"name",{value:t,configurable:!0}),"A"),Yi=Object.defineProperty,be=qi((e,t)=>Yi(e,"name",{value:t,configurable:!0}),"d");const De=new Map,te=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,ae=be(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","getCharType"),Ui=be((e,t)=>{const r=Math.floor(e/65536),n=e%65536;let i=De.get(r);if(i||(i=new Map,De.set(r,i)),i.has(n))return i.get(n);let a;if(ae(e)==="latin")a=t.width.regular;else if(ae(e)==="control")a=t.width.control;else if(ae(e)==="wide")a=t.width.wide;else switch(Q(e)){case"ambiguous":{a=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{a=t.width.fullWidth;break}case"wide":{a=t.width.wide;break}default:a=t.width.regular}return i.set(n,a),a},"getCachedCharWidth"),Ji=be(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,"isCombiningCharacter"),Oe=be((e,t={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:t.countAnsiEscapeCodes??!1,ellipsis:t.ellipsis??"",ellipsisWidth:t.ellipsisWidth??(t.ellipsis?Oe(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}},n=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:i}=e,a=i>1e4;let o=0,l=0,s=i,c=!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 h="\x1B]8;;\x07",v=h.length,j=e.indexOf("\x07",o+5);if(j!==-1){const P=e.indexOf(h,j+1);if(P!==-1){const z=P+v,V=e.slice(j+1,P).replace(D,""),Z=Oe(V,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,n-l),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),H=Z.width;if(Z.truncated)c=!0,s=Math.min(s,o);else if(l+H>n&&(s=Math.min(s,o),c=!0,l+H>r.truncation.limit))break;if(l+=H,o=z,c&&l>=r.truncation.limit)break;continue}}}if(D.lastIndex=o,D.test(e)){const h=D.lastIndex-o,v=r.truncation.countAnsiEscapeCodes?h:r.width.ansi;if(l+v>n&&(s=Math.min(s,o),l+v>r.truncation.limit)){c=!0;break}l+=v,o=D.lastIndex;continue}}const d=e.codePointAt(o);if(d===8203||d===65279||d>=8288&&d<=8292){o+=1;continue}if(d===9){if(l+r.width.tab>n&&(s=Math.min(s,o),l+r.width.tab>r.truncation.limit)){c=!0;break}l+=r.width.tab,o+=1;continue}if(te.lastIndex=o,te.test(e)){const h=(te.lastIndex-o)*r.width.regular;if(l+h>n){const v=Math.floor((n-l)/r.width.regular);if(s=Math.min(s,o+v),l+h>r.truncation.limit){c=!0;break}}l+=h,o=te.lastIndex;continue}if((d<=31||d>=127&&d<=159)&&(ee.lastIndex=o,ee.test(e))){const h=(ee.lastIndex-o)*r.width.control;if(l+h>n&&(s=Math.min(s,o+Math.floor((n-l)/r.width.control)),l+h>r.truncation.limit)){c=!0;break}l+=h,o=ee.lastIndex;continue}if(ie.lastIndex=o,ie.test(e)){if(l+r.width.emoji>n&&(s=Math.min(s,o),l+r.width.emoji>r.truncation.limit)){c=!0;break}l+=r.width.emoji,o=ie.lastIndex;continue}const g=e.codePointAt(o)??0;if(Ji(g)){o+=g>65535?2:1;continue}let m;if(a)m=Ui(g,r);else switch(ae(g)){case"control":{m=r.width.control;break}case"latin":{m=r.width.regular;break}case"wide":{m=r.width.wide;break}case"zero":{m=0;break}default:switch(Q(g)){case"ambiguous":{m=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{m=r.width.fullWidth;break}case"wide":{m=r.width.wide;break}default:m=r.width.regular}}if(l+m>n&&(s=Math.min(s,o),l+m>r.truncation.limit)){c=!0;break}l+=m,o+=g>65535?2:1}let f=l,p=!1;return c&&r.truncation.limit>=r.truncation.ellipsisWidth&&(f=r.truncation.limit,p=!0),{ellipsed:p,index:c?s:i,truncated:c,width:f}},"getStringTruncatedWidth");var Ki=Object.defineProperty,Qi=b((e,t)=>Ki(e,"name",{value:t,configurable:!0}),"i$1"),Zi=Object.defineProperty,Xi=Qi((e,t)=>Zi(e,"name",{value:t,configurable:!0}),"e"),ea=Object.defineProperty,ta=Xi((e,t)=>ea(e,"name",{value:t,configurable:!0}),"r");const A=ta((e,t={})=>Oe(e,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");var ra=Object.defineProperty,jt=b((e,t)=>ra(e,"name",{value:t,configurable:!0}),"k"),na=Object.defineProperty,L=jt((e,t)=>na(e,"name",{value:t,configurable:!0}),"d"),ia=Object.defineProperty,aa=L((e,t)=>ia(e,"name",{value:t,configurable:!0}),"a");const oa=/\x1B\[(\d+)m/;let At=class{static{b(this,"T")}static{jt(this,"T")}static{L(this,"d")}static{aa(this,"AnsiStateTracker")}activeForeground=void 0;activeBackground=void 0;activeFormatting=[];processEscape(e){const t=oa.exec(e);if(!t)return;const r=Number.parseInt(t[1],10);switch(r){case 0:{this.activeForeground=void 0,this.activeBackground=void 0,this.activeFormatting=[];break}case 39:{this.activeForeground=void 0;break}case 49:{this.activeBackground=void 0;break}default:if(r>=30&&r<=37||r>=90&&r<=97)this.activeForeground=e;else if(r>=40&&r<=47||r>=100&&r<=107)this.activeBackground=e;else if([1,2,3,4,7,8,9].includes(r))this.activeFormatting.push(e);else if([22,23,24,27,28,29].includes(r)){const n={22:"[1m",23:"[3m",24:"[4m",27:"[7m",28:"[8m",29:"[9m"}[r];n&&(this.activeFormatting=this.activeFormatting.filter(i=>!i.includes(n)))}}}getStartEscapesForAllActiveAttributes(){return[this.activeBackground,this.activeForeground,...this.activeFormatting].filter(Boolean).join("")}getEndEscapesForAllActiveAttributes(){const e=[];if(this.activeFormatting.length>0){const t={"\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 n=t[r];n&&e.push(n)})}return this.activeForeground&&e.push("\x1B[39m"),this.activeBackground&&e.push("\x1B[49m"),e.join("")}};var la=Object.defineProperty,Nt=L((e,t)=>la(e,"name",{value:t,configurable:!0}),"o");const sa=Nt((e,t)=>{if(!R.has(e[t]))return{isInsideEscape:!1,isInsideLinkEscape:!1};const r=!0,n=e.slice(t+1,t+1+U.length).join("")===U;return{isInsideEscape:r,isInsideLinkEscape:n}},"checkEscapeSequence"),ca=Nt((e,t={})=>{const r=new At;let n="",i=!1,a="",o="",l=!1;const s=[...e];for(let c=0;c<s.length;c++){const u=s[c];if(u&&R.has(u)){if(n){const m=t.getWidth?.(n)??0,h={isEscapeSequence:!1,isGrapheme:!0,text:n,width:m};if(l&&(h.isHyperlink=!0,h.hyperlinkUrl=o),t.onSegment?.(h,r)===!1)return;n=""}i=!0,a=u;const d=sa(s,c),{isInsideLinkEscape:g}=d;if(g){let m=c+1;for(o="";m<s.length;){const v=s[m];if(v===he)break;o+=v,m+=1}o=o.slice(4);const h={hyperlinkUrl:o,isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkStart:!0,width:0};if(t.onSegment?.(h,r)===!1)return;c=m,l=!0,i=!1,a="";continue}if(c+1<s.length&&s[c+1]==="\\"&&l){const m={isEscapeSequence:!0,isGrapheme:!1,isHyperlink:!0,isHyperlinkEnd:!0,width:0};if(t.onSegment?.(m,r)===!1)return;l=!1,o="",c+=1,i=!1,a="";continue}}if(i){if(a!==u&&(a+=u),u===ke){i=!1,r.processEscape(a);const d={isEscapeSequence:!0,isGrapheme:!1,text:a,width:0};if(t.onSegment?.(d,r)===!1)return;a=""}continue}n+=u;const f=t.getWidth?.(n)??0,p={isEscapeSequence:!1,isGrapheme:!0,text:n,width:f};if(l&&(p.isHyperlink=!0,p.hyperlinkUrl=o),t.onSegment?.(p,r)===!1)return;n=""}if(n){const c=t.getWidth?.(n)??0,u={isEscapeSequence:!1,isGrapheme:!0,text:n,width:c};l&&(u.isHyperlink=!0,u.hyperlinkUrl=o),t.onSegment?.(u,r)}if(a){const c={isEscapeSequence:!0,isGrapheme:!1,text:a,width:0};t.onSegment?.(c,r)}},"processAnsiString");var ua=Object.defineProperty,fa=L((e,t)=>ua(e,"name",{value:t,configurable:!0}),"t$1");const Ge=fa(e=>`${R.values().next().value}${Et}${String(e)}${ke}`,"wrapAnsiCode");var da=Object.defineProperty,ga=L((e,t)=>da(e,"name",{value:t,configurable:!0}),"s");const qe=ga(e=>`${R.values().next().value}${U}${e}${he}`,"wrapAnsiHyperlink");var pa=Object.defineProperty,ma=L((e,t)=>pa(e,"name",{value:t,configurable:!0}),"l");const ha=ma(e=>{if(e.length===0)return"";if(e.length===1)return e[0];let t="",r,n;const i=e.join(`
27
+ `),a=[...i];let o=0;for(const[l,s]of a.entries()){if(t+=s,R.has(s)){const u=zi.exec(i.slice(o))?.groups??{};if(u.code!==void 0){const f=Number.parseFloat(u.code);r=f===Ci?void 0:f}else u.uri!==void 0&&(n=u.uri.length===0?void 0:u.uri)}const c=Vi.get(Number(r));a[l+1]===`
28
+ `?(n&&(t+=qe("")),r&&c&&(t+=Ge(c))):s===`
29
+ `&&(r&&c&&(t+=Ge(r)),n&&(t+=qe(n))),o+=s.length}return t},"preserveAnsi");var ba=Object.defineProperty,N=L((e,t)=>ba(e,"name",{value:t,configurable:!0}),"h");const xt=/(?=\s)|(?<=\s)/,It=/^\s+$/,$e=N(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},"resetAnsiAtLineBreak"),T=N(e=>{const t=e.split(" ");let r=t.length;for(;r>0&&A(t[r-1])===0;)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},"stringVisibleTrimSpacesRight"),Pt=N((e,t,r)=>{if(e.length===0)return[""];if(t<=0)return[e];const n=[],i=new At;let a="",o=0,l=!1,s=!1,c="",u=0;for(;u<e.length;){const f=e[u];if(R.has(f)){l=!0,c=f,a+=f,s=e.startsWith(U,u+1),u+=1;continue}if(l){c+=f,a+=f,s?f===he&&(l=s=!1):f===ke&&(l=!1,i.processEscape(c)),u+=1;continue}const p=A(f),d=f===" ";if(p===0){a+=f,u+=1;continue}if(o+p>t&&(a&&n.push(a+i.getEndEscapesForAllActiveAttributes()),a=i.getStartEscapesForAllActiveAttributes(),o=A(a),d&&r)){for(;u<e.length&&e[u]===" ";)u+=1;continue}if(a+=f,o+=p,o===t&&u<e.length-1&&(n.push(a+i.getEndEscapesForAllActiveAttributes()),a=i.getStartEscapesForAllActiveAttributes(),o=A(a),u+1<e.length&&e[u+1]===" "&&r)){for(u+=1;u<e.length&&e[u]===" ";)u+=1;continue}u+=1}return a&&n.push(a+i.getEndEscapesForAllActiveAttributes()),r?n.map(f=>T(f)):n},"wrapWithBreakAtWidth"),$a=N((e,t,r)=>{if(e.length===0)return[];const n=r?e.trim():e;if(n.length===0)return[];const i=[];let a="",o=0;return ca(n,{getWidth:A,onSegment:N((l,s)=>{const c=l.text??"";if(l.isEscapeSequence)a+=c;else{const u=c===" ";if(l.width===0)return a+=c,!0;if(o+l.width>t&&(a&&i.push(a),a=s.getStartEscapesForAllActiveAttributes(),o=0,u))return r||i.push(s.getStartEscapesForAllActiveAttributes()+c),!0;a+=c,o+=l.width}return!0},"onSegment")}),a&&i.push(a),r?i.map(l=>T(l)):i},"wrapCharByChar"),va=N((e,t,r)=>{if(e.length===0)return[];const n=r?e.trim():e;if(n.length===0)return[];const i=n.split(xt),a=[];let o="",l=0,s=0;for(;s<i.length;){const c=i[s],u=It.test(c),f=A(c);if(c.length===0){s+=1;continue}if(r&&u&&l===0){s+=1;continue}if(l+f>t&&l>0){r?a.push(T(o)):a.push(o),o="",l=0;continue}o+=c,l+=f,s+=1}return o&&(r?a.push(T(o)):a.push(o)),a},"wrapWithWordBoundaries"),ya=N((e,t,r)=>{if(e.length===0)return[];const n=r?e.trim():e;if(n.length===0)return[];const i=n.split(xt),a=[];let o="",l=0,s=0;for(;s<i.length;){const c=i[s],u=It.test(c),f=A(c);if(c.length===0){s+=1;continue}if(r&&u&&l===0){s+=1;continue}if(f>t){o&&a.push($e(r?T(o):o));const p=Pt(c,t,r);if(p.length>0){for(let d=0;d<p.length-1;d+=1)a.push(p[d]);o=p.at(-1),l=A(o)}else o="",l=0;s+=1;continue}if(l+f>t&&l>0&&(a.push($e(r?T(o):o)),o="",l=0,r&&u)){s+=1;continue}o+=c,l+=f,s+=1}return o&&a.push($e(r?T(o):o)),a},"wrapAndBreakWords"),re={BREAK_AT_CHARACTERS:"BREAK_AT_CHARACTERS",BREAK_WORDS:"BREAK_WORDS",PRESERVE_WORDS:"PRESERVE_WORDS",STRICT_WIDTH:"STRICT_WIDTH"},Ja=N((e,t={})=>{const{removeZeroWidthCharacters:r=!0,trim:n=!0,width:i=80,wrapMode:a=re.PRESERVE_WORDS}=t;if(n&&e.trim()==="")return"";let o=e.normalize("NFC").replaceAll(`\r
30
+ `,`
31
+ `);return r&&(o=o.replaceAll(Ri,"")),o.split(`
32
+ `).map(l=>{if(n&&l.trim()==="")return"";let s;switch(a){case re.BREAK_AT_CHARACTERS:{s=$a(l,i,n);break}case re.BREAK_WORDS:{s=ya(l,i,n);break}case re.STRICT_WIDTH:{s=Pt(l,i,n);break}default:s=va(l,i,n)}return ha(s)}).join(`
33
+ `)},"wordWrap");var wa=Object.defineProperty,I=b((e,t)=>wa(e,"name",{value:t,configurable:!0}),"n$2");const kt=80,Tt=24,Ee=I((e,t,{shell:r,env:n}={})=>Ct(e,t,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:r,env:n}).trim(),"exec"),oe=I((e,t)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(t,10)}),"create"),Wt=I((e,t)=>{const{columns:r,rows:n}=oe(e,t);if(!(Number.isNaN(r)||Number.isNaN(n))&&!(r===kt&&n===Tt))return{columns:r,rows:n}},"createIfNotDefault"),Sa=I(()=>{if(k.platform!=="linux")return!0;try{const e=G.readFileSync("/proc/self/stat","utf8"),t=e.lastIndexOf(") ");if(t===-1)return!1;const r=e.slice(t+2).trim().split(/\s+/),n=Number.parseInt(r[2],10),i=Number.parseInt(r[5],10);return Number.isNaN(n)||Number.isNaN(i)||i<=0?!1:n===i}catch{return!1}},"isForegroundProcess");function Oa(){const{env:e,stdout:t,stderr:r}=k;if(t?.columns&&t?.rows)return oe(t.columns,t.rows);if(r?.columns&&r?.rows)return oe(r.columns,r.rows);if(e.COLUMNS&&e.LINES)return oe(e.COLUMNS,e.LINES);const n={columns:kt,rows:Tt};return k.platform==="win32"?ve()??n:k.platform==="darwin"?Ye()??ve()??n:Ye()??ve()??Ea()??n}b(Oa,"O");I(Oa,"terminalSize");const Ye=I(()=>{try{const e=k.platform==="darwin"?G.constants.O_EVTONLY|G.constants.O_NONBLOCK:G.constants.O_NONBLOCK,{columns:t,rows:r}=Rt.WriteStream(G.openSync("/dev/tty",e));return{columns:t,rows:r}}catch{}},"devTty"),ve=I(()=>{try{const e=Ee("tput",["cols"],{env:{TERM:"dumb",...k.env}}),t=Ee("tput",["lines"],{env:{TERM:"dumb",...k.env}});if(e&&t)return Wt(e,t)}catch{}},"tput"),Ea=I(()=>{try{if(!Sa())return;const e=Ee("resize",["-u"]).match(/\d+/g);if(e.length===2)return Wt(e[0],e[1])}catch{}},"resize");var ja=Object.defineProperty,Aa=b((e,t)=>ja(e,"name",{value:t,configurable:!0}),"r$2");const Ka=Aa(e=>{const t=Object.keys(e).map(r=>e[r].badge??"");return t.length===0?"":t.reduce((r,n)=>r.length>n.length?r:n,"")},"getLongestBadge");var Na=Object.defineProperty,xa=b((e,t)=>Na(e,"name",{value:t,configurable:!0}),"r$1");const{bold:Ia,cyan:Pa,green:Ue,grey:ka,magenta:Ta,red:Wa,yellow:ye}=Je,Qa={indent:2,quoteStyle:"single",stylize:xa((e,t)=>{const r={bigint:ye,boolean:ye,date:Ta,null:Ia,number:ye,regexp:Wa,special:Pa,string:Ue,symbol:Ue,undefined:ka};return Object.hasOwn(r,t)?r[t](e):e},"stylize")};var Ba=Object.defineProperty,Fa=b((e,t)=>Ba(e,"name",{value:t,configurable:!0}),"o$1");const{bold:La,underline:_a}=Je,Za=Fa((e,t)=>{let r=t.uppercase.label?e.toUpperCase():e;return r=t.underline.label?_a(r):r,t.bold.label&&(r=La(r)),r},"formatLabel");var Ma=Object.defineProperty,Bt=b((e,t)=>Ma(e,"name",{value:t,configurable:!0}),"o");const Ca=Bt(e=>[e.getHours(),e.getMinutes(),e.getSeconds()].map(t=>String(t).padStart(2,"0")).join(":"),"dateFormatter");class Xa{static{b(this,"AbstractPrettyReporter")}static{Bt(this,"AbstractPrettyReporter")}styles;loggerTypes;constructor(t){this.styles={bold:{label:!1},dateFormatter:Ca,underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...t},this.loggerTypes=zt}setLoggerTypes(t){this.loggerTypes=t}}export{Xa as A,re as B,Ha as E,Ua as G,zt as L,Oa as O,Da as a,Ka as b,Za as c,Ja as d,Ya as i,A as o,qa as p,Ga as s,Qa as u};
@@ -0,0 +1 @@
1
+ const l={alert:7,critical:6,debug:1,emergency:8,error:5,informational:2,notice:3,trace:2,warning:4},e={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"}},o=Symbol("EMPTY");export{o as E,e as L,l as a};
@@ -0,0 +1 @@
1
+ const l={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"}},e=Symbol("EMPTY");export{e as E,l as L};
@@ -0,0 +1,47 @@
1
+ import { P as PailBrowserImpl } from "./wide-event.d-gb2-ks5w.js";
2
+ import { D as DefaultLogTypes, e as LoggerFunction } from "./types.d-BeLumqgD.js";
3
+ /**
4
+ * Route configuration for a specific path pattern.
5
+ */
6
+ interface RouteConfig {
7
+ /** Override the service name for requests matching this route. */
8
+ service?: string;
9
+ }
10
+ /**
11
+ * A pail instance with dynamically generated log methods.
12
+ */
13
+ type PailLike<T extends string = string> = PailBrowserImpl<T> & Record<DefaultLogTypes | T, LoggerFunction>;
14
+ /**
15
+ * Base options shared by all framework middleware adapters.
16
+ * @template T - Custom logger type names from the pail instance
17
+ */
18
+ interface PailMiddlewareOptions<T extends string = string> {
19
+ /**
20
+ * Glob patterns for paths to exclude from logging.
21
+ * Exclusions take precedence over inclusions.
22
+ * @example ["/health", "/api/_internal/**"]
23
+ */
24
+ exclude?: string[];
25
+ /**
26
+ * Glob patterns for paths to include in logging.
27
+ * If not set, all non-excluded paths are logged.
28
+ * @example ["/api/**"]
29
+ */
30
+ include?: string[];
31
+ /**
32
+ * The pail logger instance to use for wide event emission.
33
+ */
34
+ pail: PailLike<T>;
35
+ /**
36
+ * Route-specific configuration. Maps glob patterns to config.
37
+ * First matching route wins.
38
+ * @example { "/api/auth/**": { service: "auth-service" } }
39
+ */
40
+ routes?: Record<string, RouteConfig>;
41
+ /**
42
+ * Default service name for all wide events.
43
+ * Can be overridden per-route via `routes`.
44
+ */
45
+ service?: string;
46
+ }
47
+ export { PailMiddlewareOptions as P };
@@ -0,0 +1,5 @@
1
+ var h=Object.defineProperty;var e=(i,s)=>h(i,"name",{value:s,configurable:!0});var r=Object.defineProperty,a=e((i,s)=>r(i,"name",{value:s,configurable:!0}),"e");class n extends Error{static{e(this,"n")}static{a(this,"PailError")}status;why;fix;link;constructor(s){const t=typeof s=="string"?{message:s}:s;super(t.message,t.cause===void 0?void 0:{cause:t.cause}),this.name="PailError",this.status=t.status??500,this.why=t.why,this.fix=t.fix,this.link=t.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
+ Why: ${this.why}`),this.fix&&(s+=`
3
+ Fix: ${this.fix}`),this.link&&(s+=`
4
+ Link: ${this.link}`),this.cause!==void 0){const t=this.cause instanceof Error?this.cause.message:String(this.cause);s+=`
5
+ Cause: ${t}`}return s}}const u=a(i=>new n(i),"createPailError");export{n as PailError,u as createPailError};
@@ -0,0 +1 @@
1
+ var k=Object.defineProperty;var i=(t,e)=>k(t,"name",{value:e,configurable:!0});import{WideEvent as p}from"../wide-event.js";var L=Object.defineProperty,c=i((t,e)=>L(t,"name",{value:e,configurable:!0}),"i$1");const S=c(t=>{let e="^",r=0;for(;r<t.length;){const a=t[r];if(a==="*"&&t[r+1]==="*")r+=2,t[r]==="/"&&(r+=1),r>=t.length&&e.endsWith("/")?e=`${e.slice(0,-1)}(/.*)?`:r>=t.length?e+=".*":e+="(.*/)?";else switch(a){case"*":{e+="[^/]*",r+=1;break}case".":{e+=String.raw`\.`,r+=1;break}case"?":{e+="[^/]",r+=1;break}default:e+=a,r+=1}}return e+="$",new RegExp(e)},"patternToRegex"),f=c((t,e)=>S(e).test(t),"matchesPattern"),$=c((t,e,r)=>r?.some(a=>f(t,a))?!1:e?.length?e.some(a=>f(t,a)):!0,"shouldLog"),y=c((t,e)=>{if(!e)return;const r=Object.entries(e);for(let a=0;a<r.length;a+=1){const[s,o]=r[a];if(f(t,s))return o.service}},"getServiceForPath");var P=Object.defineProperty,d=i((t,e)=>P(t,"name",{value:e,configurable:!0}),"i");const E=d((t,e)=>{const{exclude:r,include:a,pail:s,routes:o,service:w}=t,{headers:g,method:l,path:n,requestId:b}=e;if(!$(n,a,r)){const u=new p({autoEmit:!1,name:`${l} ${n}`,pail:s});return{finish:d(()=>{},"finish"),logger:u,skipped:!0}}const x=y(n,o)??w,h=new p({name:`${l} ${n}`,pail:s,service:x});return h.set({method:l,path:n,requestId:b,...g?{headers:g}:{}}),{finish:d(u=>{h.finish(u)},"finish"),logger:h,skipped:!1}},"createMiddlewareLogger");var j=Object.defineProperty,v=i((t,e)=>j(t,"name",{value:e,configurable:!0}),"s");const m=new Set(["authorization","cookie","proxy-authorization","set-cookie","x-api-key","x-auth-token"]),H=v(t=>{const e={};return t.forEach((r,a)=>{m.has(a.toLowerCase())||(e[a.toLowerCase()]=r)}),e},"extractSafeHeaders"),q=v(t=>{const e={},r=Object.entries(t);for(let a=0;a<r.length;a+=1){const[s,o]=r[a];!m.has(s.toLowerCase())&&o!==void 0&&(e[s.toLowerCase()]=Array.isArray(o)?o.join(", "):o)}return e},"extractSafeNodeHeaders");export{H as a,E as c,q as e};
@@ -0,0 +1 @@
1
+ var $=Object.defineProperty;var h=(e,t)=>$(e,"name",{value:t,configurable:!0});var A=Object.defineProperty,S=h((e,t)=>A(e,"name",{value:t,configurable:!0}),"g$1");const U=S(e=>{const t=Object.keys(e).map(r=>e[r].label??"");return t.length===0?"":t.reduce((r,l)=>r.length>l.length?r:l,"")},"getLongestLabel");var D=Object.defineProperty,C=h((e,t)=>D(e,"name",{value:t,configurable:!0}),"x"),N=Object.defineProperty,v=C((e,t)=>N(e,"name",{value:t,configurable:!0}),"h"),M=Object.defineProperty,g=v((e,t)=>M(e,"name",{value:t,configurable:!0}),"g$1");const p=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"]]),P=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,L=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,j=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,F=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,y=g(()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),"getDefaultCss"),w=/\s+/,m=g(e=>{p.has(e)&&(e=p.get(e));const t=P.exec(e);if(t)return[Number.parseInt(t[1],16),Number.parseInt(t[2],16),Number.parseInt(t[3],16)];const r=L.exec(e);if(r)return[Number.parseInt(`${r[1]}${r[1]}`,16),Number.parseInt(`${r[2]}${r[2]}`,16),Number.parseInt(`${r[3]}${r[3]}`,16)];const l=j.exec(e);if(l)return[Math.round(Math.max(0,Math.min(255,Number(l[1])))),Math.round(Math.max(0,Math.min(255,Number(l[2])))),Math.round(Math.max(0,Math.min(255,Number(l[3]))))];const f=F.exec(e);if(f){let a=Number(f[1])%360;a<0&&(a+=360);const i=Math.max(0,Math.min(100,Number(f[2])))/100,n=Math.max(0,Math.min(100,Number(f[3])))/100,s=(1-Math.abs(2*n-1))*i,u=s*(1-Math.abs(a/60%2-1)),o=n-s/2;let d,c,b;return a<60?{0:d,1:c,2:b}=[s,u,0]:a<120?{0:d,1:c,2:b}=[u,s,0]:a<180?{0:d,1:c,2:b}=[0,s,u]:a<240?{0:d,1:c,2:b}=[0,u,s]:a<300?{0:d,1:c,2:b}=[u,0,s]:{0:d,1:c,2:b}=[s,0,u],[Math.round((d+o)*255),Math.round((c+o)*255),Math.round((b+o)*255)]}return null},"parseCssColor"),k=g((e,t)=>e?.[0]===t?.[0]&&e?.[1]===t?.[1]&&e?.[2]===t?.[2],"colorEquals"),q=g(e=>{if(typeof e!="string")return y();const t=y(),r=[];let l=!1,f=null,a=0,i="";for(const n of e){if(n==="(")a+=1;else if(a>0)n===")"&&(a-=1);else if(l){if(n===";"){const s=i.trim();s!==""&&r.push([f,s]),f=null,i="",l=!1;continue}}else if(n===":"){f=i.trim(),i="",l=!0;continue}i+=n}if(l&&a===0){const n=i.trim();n!==""&&r.push([f,n]),f=null,i=""}for(const{0:n,1:s}of r)switch(n){case"background-color":{s!=null&&(t.backgroundColor=s);break}case"color":{s!=null&&(t.color=s);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(s)&&(t.fontStyle="italic");break}case"font-weight":{s==="bold"&&(t.fontWeight=s);break}case"text-decoration":{t.textDecorationColor=null,t.textDecorationLine=[];const u=s.split(w);for(const o of u){const d=m(o);d!=null?t.textDecorationColor=d:["line-through","overline","underline"].includes(o)&&t.textDecorationLine.push(o)}break}case"text-decoration-color":{const u=m(s);u!=null&&(t.textDecorationColor=u);break}case"text-decoration-line":{t.textDecorationLine=[];const u=s.split(w);for(const o of u)["line-through","overline","underline"].includes(o)&&t.textDecorationLine.push(o);break}}return t},"parseCss"),O=g((e,t)=>{t=t??y();let r="";if(!k(e.backgroundColor,t.backgroundColor))if(e.backgroundColor==null)r+="\x1B[49m";else switch(e.backgroundColor){case"black":{r+="\x1B[40m";break}case"blue":{r+="\x1B[44m";break}case"cyan":{r+="\x1B[46m";break}case"green":{r+="\x1B[42m";break}case"magenta":{r+="\x1B[45m";break}case"red":{r+="\x1B[41m";break}case"white":{r+="\x1B[47m";break}case"yellow":{r+="\x1B[43m";break}default:if(Array.isArray(e.backgroundColor)){const{0:l,1:f,2:a}=e.backgroundColor;r+=`\x1B[48;2;${String(l)};${String(f)};${String(a)}m`}else{const l=m(e.backgroundColor);if(l===null)r+="\x1B[49m";else{const{0:f,1:a,2:i}=l;r+=`\x1B[48;2;${String(f)};${String(a)};${String(i)}m`}}}if(!k(e.color,t.color))if(e.color==null)r+="\x1B[39m";else switch(e.color){case"black":{r+="\x1B[30m";break}case"blue":{r+="\x1B[34m";break}case"cyan":{r+="\x1B[36m";break}case"green":{r+="\x1B[32m";break}case"magenta":{r+="\x1B[35m";break}case"red":{r+="\x1B[31m";break}case"white":{r+="\x1B[37m";break}case"yellow":{r+="\x1B[33m";break}default:if(Array.isArray(e.color)){const{0:l,1:f,2:a}=e.color;r+=`\x1B[38;2;${String(l)};${String(f)};${String(a)}m`}else{const l=m(e.color);if(l===null)r+="\x1B[39m";else{const{0:f,1:a,2:i}=l;r+=`\x1B[38;2;${String(f)};${String(a)};${String(i)}m`}}}if(e.fontWeight!==t.fontWeight&&(r+=e.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),e.fontStyle!==t.fontStyle&&(r+=e.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!k(e.textDecorationColor,t.textDecorationColor))if(e.textDecorationColor==null)r+="\x1B[59m";else{const{0:l,1:f,2:a}=e.textDecorationColor;r+=`\x1B[58;2;${String(l)};${String(f)};${String(a)}m`}return e.textDecorationLine.includes("line-through")!==t.textDecorationLine.includes("line-through")&&(r+=e.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),e.textDecorationLine.includes("overline")!==t.textDecorationLine.includes("overline")&&(r+=e.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),e.textDecorationLine.includes("underline")!==t.textDecorationLine.includes("underline")&&(r+=e.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),r},"cssToAnsi");var E=Object.defineProperty,x=v((e,t)=>E(e,"name",{value:t,configurable:!0}),"u");const I=x(e=>{try{return JSON.stringify(e)}catch{return'"[Circular]"'}},"tryStringify"),B="%".codePointAt(0),W="s".codePointAt(0),T="d".codePointAt(0),_="f".codePointAt(0),z="i".codePointAt(0),J="O".codePointAt(0),G="o".codePointAt(0),H="j".codePointAt(0),K="c".codePointAt(0),Q=x((e,t=[],r={})=>{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 l=r.stringify??I,f=1;if(typeof e=="object"){const o=t.length+f;if(o===1)return"{}";const d=Array.from({length:o});d[0]=l(e);for(let c=1;c<o;c+=1)d[c]=l(t[c-f]);return d.join(" ")}if(t.length===0)return e;let a="",i=1-f,n=-1,s=!1,u;for(let o=0;o<e.length;){if(e.codePointAt(o)===B&&o+1<e.length){n=n>-1?n:0;const d=e.codePointAt(o+1);if(d===void 0){i+=1;break}switch(d){case K:{if(globalThis.window===void 0){const c=q(t[i]);n<o&&(a+=e.slice(n,o));const b=O(c,u);a+=b,b!==""&&(s=!0,u=c)}n=o+2,o+=1;break}case T:case _:{if(i>=t.length||t[i]==null)break;n<o&&(a+=e.slice(n,o));const c=t[i];a+=(typeof c=="symbol"?Number.NaN:Number(c)).toString(),n=o+2,o+=1;break}case z:{if(i>=t.length||t[i]==null)break;n<o&&(a+=e.slice(n,o));const c=t[i];a+=Math.floor(typeof c=="symbol"?Number.NaN:Number(c)).toString(),n=o+2,o+=1;break}case H:case J:case G:{if(i>=t.length||t[i]===void 0)break;n<o&&(a+=e.slice(n,o));const c=t[i],b=typeof c;if(b==="string"){a+=`'${c}'`,n=o+2,o+=1;break}if(b==="function"){a+=c.name?`[Function: ${c.name}]`:"[Function: <anonymous>]",n=o+2,o+=1;break}a+=l(c),n=o+2,o+=1;break}case B:{n<o&&(a+=e.slice(n,o)),a+="%",n=o+2,o+=1,i-=1;break}case W:{if(i>=t.length)break;n<o&&(a+=e.slice(n,o)),a+=typeof t[i]=="object"?l(t[i]):String(t[i]),n=o+2,o+=1;break}default:typeof r.formatters?.[d]=="function"&&(n<o&&(a+=e.slice(n,o)),a+=r.formatters[d](t[i]),n=o+2,o+=1)}i+=1}o+=1}return n===-1?e:(n<e.length&&(a+=e.slice(n)),s&&(a+="\x1B[0m"),a)},"format"),V=x((e={})=>{const t={};return typeof e.formatters=="object"&&Object.entries(e.formatters).forEach(([r,l])=>{if(r.length===0)throw new Error(`Formatter %${r} has no characters`);if(r.length>1)throw new Error(`Formatter %${r} has more than one character`);if(typeof l!="function")throw new TypeError(`Formatter for %${r} is not a function`);const f=r.codePointAt(0);if(f===void 0)throw new Error(`${r}.codePointAt(0) failed to return a value, please report this issue`);t[f]=l}),(r,l=[],f={})=>Q(r,l,{...f,formatters:t})},"build");export{V as G,U as s,Q as v};
@@ -0,0 +1 @@
1
+ var p=Object.defineProperty;var o=(e,t)=>p(e,"name",{value:t,configurable:!0});var x=Object.defineProperty,h=o((e,t)=>x(e,"name",{value:t,configurable:!0}),"x");const c=/\*+/g,m=h((e,t)=>{const{exclude:u,include:n}=t??{};return r=>{const l=r.nextUrl.pathname;if(u?.some(a=>l.startsWith(a.replaceAll(c,"")))||n?.length&&!n.some(a=>l.startsWith(a.replaceAll(c,""))))return e.next();const d=r.headers.get("x-request-id")??crypto.randomUUID(),s=new Headers(r.headers);s.set("x-request-id",d),s.set("x-pail-start",String(Date.now()));const i=e.next({request:{headers:s}});return i.headers.set("x-request-id",d),i}},"pailMiddleware");export{m as pailMiddleware};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var s=(r,e)=>c(r,"name",{value:e,configurable:!0});import{createRequire as i}from"node:module";const a=i(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=s(r=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,o]=t.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return t.getBuiltinModule(r)}return a(r)},"__cjs_getBuiltinModule"),{AsyncLocalStorage:u}=g("node:async_hooks");var l=Object.defineProperty,n=s((r,e)=>l(r,"name",{value:e,configurable:!0}),"r");const p=n(r=>{const e=new u;return{storage:e,useLogger:n(()=>{const o=e.getStore();if(!o)throw new Error(`[pail] useLogger() called outside of ${r}`);return o},"useLogger")}},"createLoggerStorage");export{p as c};
@@ -0,0 +1,246 @@
1
+ import { AnsiColors } from '@visulima/colorize';
2
+ import { InteractiveManager } from '@visulima/interactive-manager';
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>);
39
+ /**
40
+ * Global namespace for extending Pail's metadata interface.
41
+ *
42
+ * This global declaration allows other packages and applications to extend
43
+ * the Meta interface with custom properties by declaring additional properties
44
+ * in the VisulimaPail.CustomMeta interface.
45
+ * @example
46
+ * ```typescript
47
+ * declare global {
48
+ * namespace VisulimaPail {
49
+ * interface CustomMeta<L> {
50
+ * userId?: string;
51
+ * requestId?: string;
52
+ * }
53
+ * }
54
+ * }
55
+ * ```
56
+ */
57
+ declare global {
58
+ namespace VisulimaPail {
59
+ interface CustomMeta<L> {}
60
+ }
61
+ }
62
+ /**
63
+ * Metadata object containing all information about a log entry.
64
+ *
65
+ * This interface defines the structure of metadata that is passed to reporters
66
+ * and processors. It contains all the contextual information about a log message
67
+ * including the message itself, timing information, error details, and more.
68
+ * @template L - The log level type
69
+ */
70
+ interface Meta<L> extends VisulimaPail.CustomMeta<L> {
71
+ badge: string | undefined;
72
+ context: any[] | undefined;
73
+ date: Date | string;
74
+ error: Error | undefined;
75
+ groups: string[];
76
+ label: string | undefined;
77
+ message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
78
+ prefix: string | undefined;
79
+ repeated?: number;
80
+ scope: string[] | undefined;
81
+ suffix: string | undefined;
82
+ traceError: Error | undefined;
83
+ type: {
84
+ level: ExtendedRfc5424LogLevels | L;
85
+ name: string;
86
+ };
87
+ }
88
+ /**
89
+ * Extended RFC 5424 Log Levels.
90
+ *
91
+ * Standard syslog severity levels as defined in RFC 5424, plus additional
92
+ * levels commonly used in modern applications. Each level has a numeric
93
+ * priority where lower numbers indicate higher severity.
94
+ * @see https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
95
+ */
96
+ type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
97
+ /**
98
+ * Default Log Types.
99
+ *
100
+ * Predefined semantic log types that provide meaningful categorization
101
+ * for different kinds of log messages. Each type has associated styling
102
+ * and log level configuration.
103
+ */
104
+ type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "warning" | "watch";
105
+ /**
106
+ * Logger Function Type.
107
+ *
108
+ * Represents a logging function that can accept either a structured Message object
109
+ * or multiple arguments in the traditional console.log style.
110
+ */
111
+ interface LoggerFunction {
112
+ (message: Message): void;
113
+ (...message: any[]): void;
114
+ }
115
+ /**
116
+ * Logger Configuration.
117
+ *
118
+ * Configuration object that defines how a specific logger type should behave,
119
+ * including its visual appearance and log level.
120
+ * @template L - The log level type
121
+ */
122
+ interface LoggerConfiguration<L extends string> {
123
+ badge?: string;
124
+ color?: AnsiColors;
125
+ label: string;
126
+ logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
127
+ }
128
+ /**
129
+ * Logger Types Configuration.
130
+ *
131
+ * A record mapping logger type names to their configurations.
132
+ * @template T - Custom logger type names
133
+ * @template L - Log level types
134
+ */
135
+ type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
136
+ /**
137
+ * Read-only Metadata.
138
+ *
139
+ * Immutable version of the Meta interface for use in reporters.
140
+ * @template L - The log level type
141
+ */
142
+ type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
143
+ /**
144
+ * Reporter Interface.
145
+ *
146
+ * Base interface for all reporters. Reporters are responsible for
147
+ * outputting log messages to various destinations (console, files, etc.).
148
+ * @template L - The log level type
149
+ */
150
+ interface Reporter<L extends string> {
151
+ log: (meta: ReadonlyMeta<L>) => void;
152
+ }
153
+ /**
154
+ * Stream-Aware Reporter Interface.
155
+ *
156
+ * Extends Reporter with the ability to work with Node.js streams.
157
+ * Used for server-side reporters that need to write to stdout/stderr.
158
+ * @template L - The log level type
159
+ */
160
+ interface StreamAwareReporter<L extends string> extends Reporter<L> {
161
+ /** Set the stderr stream for error output */
162
+ setStderr: (stderr: NodeJS.WriteStream) => void;
163
+ /** Set the stdout stream for standard output */
164
+ setStdout: (stdout: NodeJS.WriteStream) => void;
165
+ }
166
+ /**
167
+ * Logger Types Aware Reporter Interface.
168
+ *
169
+ * Extends Reporter with the ability to receive logger type configurations.
170
+ * Allows reporters to customize their output based on logger types.
171
+ * @template T - Custom logger type names
172
+ * @template L - The log level type
173
+ */
174
+ interface LoggerTypesAwareReporter<T extends string, L extends string> extends Reporter<L> {
175
+ /** Set the logger types configuration */
176
+ setLoggerTypes: (types: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>) => void;
177
+ }
178
+ /**
179
+ * Stringify-Aware Reporter Interface.
180
+ *
181
+ * Extends Reporter with the ability to receive a custom stringify function.
182
+ * Useful for reporters that need to serialize complex objects.
183
+ * @template L - The log level type
184
+ */
185
+ interface StringifyAwareReporter<L extends string> extends Reporter<L> {
186
+ /** Set the stringify function for object serialization */
187
+ setStringify: (stringify: any) => void;
188
+ }
189
+ /**
190
+ * Interactive Stream Reporter Interface.
191
+ *
192
+ * Extends StreamAwareReporter with interactive capabilities for terminal UIs.
193
+ * Supports features like progress bars and dynamic updates.
194
+ * @template L - The log level type
195
+ */
196
+ interface InteractiveStreamReporter<L extends string> extends StreamAwareReporter<L> {
197
+ /** Set the interactive manager for handling interactive output */
198
+ setInteractiveManager: (manager?: InteractiveManager) => void;
199
+ /** Enable or disable interactive mode */
200
+ setIsInteractive: (interactive: boolean) => void;
201
+ }
202
+ /**
203
+ * Processor Interface.
204
+ *
205
+ * Base interface for all processors. Processors can modify or enhance
206
+ * log metadata before it reaches reporters.
207
+ * @template L - The log level type
208
+ */
209
+ interface Processor<L extends string> {
210
+ /** Process the log metadata */
211
+ process: (meta: Meta<L>) => Meta<L>;
212
+ }
213
+ /**
214
+ * Stringify-Aware Processor Interface.
215
+ *
216
+ * Extends Processor with the ability to receive a custom stringify function.
217
+ * Useful for processors that need to serialize complex objects.
218
+ * @template L - The log level type
219
+ */
220
+ interface StringifyAwareProcessor<L extends string> extends Processor<L> {
221
+ /** Set the stringify function for object serialization */
222
+ setStringify: (stringify: typeof JSON.stringify) => void;
223
+ }
224
+ interface ConstructorOptions<T extends string, L extends string> {
225
+ disabled?: boolean;
226
+ logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
227
+ logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
228
+ messages?: {
229
+ timerEnd?: string;
230
+ timerStart?: string;
231
+ };
232
+ processors?: Processor<L>[];
233
+ rawReporter?: Reporter<L>;
234
+ reporters?: Reporter<L>[];
235
+ scope?: string[] | string;
236
+ throttle?: number;
237
+ throttleMin?: number;
238
+ types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
239
+ }
240
+ type Message = {
241
+ context?: any[];
242
+ message: any;
243
+ prefix?: string;
244
+ suffix?: string;
245
+ };
246
+ export { ConstructorOptions as C, DefaultLogTypes as D, ExtendedRfc5424LogLevels as E, InteractiveStreamReporter as I, LiteralUnion as L, Meta as M, Processor as P, ReadonlyMeta as R, StringifyAwareReporter as S, StreamAwareReporter as a, StringifyAwareProcessor as b, LoggerTypesConfig as c, Reporter as d, LoggerFunction as e, LoggerTypesAwareReporter as f };