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

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 (90) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/LICENSE.md +841 -6
  3. package/README.md +53 -24
  4. package/dist/error.js +2 -2
  5. package/dist/index.browser.d.ts +16 -5
  6. package/dist/index.browser.js +19 -19
  7. package/dist/index.server.d.ts +30 -5
  8. package/dist/index.server.js +28 -27
  9. package/dist/middleware/elysia.d.ts +5 -4
  10. package/dist/middleware/elysia.js +1 -1
  11. package/dist/middleware/express.d.ts +5 -4
  12. package/dist/middleware/express.js +1 -1
  13. package/dist/middleware/fastify.d.ts +5 -4
  14. package/dist/middleware/fastify.js +1 -1
  15. package/dist/middleware/hono.d.ts +5 -4
  16. package/dist/middleware/hono.js +1 -1
  17. package/dist/middleware/next/handler.d.ts +5 -4
  18. package/dist/middleware/next/handler.js +1 -1
  19. package/dist/middleware/sveltekit.d.ts +5 -4
  20. package/dist/middleware/sveltekit.js +1 -1
  21. package/dist/object-tree.js +2 -2
  22. package/dist/packem_shared/AbstractJsonReporter-Bp_JCrMQ.js +1 -0
  23. package/dist/packem_shared/AbstractJsonReporter-C6iu_u9-.js +1 -0
  24. package/dist/packem_shared/JsonReporter-BXktpC__.js +2 -0
  25. package/dist/packem_shared/JsonReporter-bmem9lcg.js +1 -0
  26. package/dist/packem_shared/PailError-CbU1Ogfa.js +5 -0
  27. package/dist/packem_shared/PrettyReporter-DNNseeLK.js +44 -0
  28. package/dist/packem_shared/PrettyReporter-DsHfKOU7.js +5 -0
  29. package/dist/packem_shared/{abstract-json-reporter.d-BAgznjyU.d.ts → abstract-json-reporter.d-wfESoEa-.d.ts} +3 -2
  30. package/dist/packem_shared/abstract-pretty-reporter-Bczvp2Zh.js +57 -0
  31. package/dist/packem_shared/addKnownErrorConstructor-C1OJTj2D-f9no2VNI.js +25 -0
  32. package/dist/packem_shared/{create-middleware-logger.d-CR3o6VDh.d.ts → create-middleware-logger.d-B-JmQ1Sl.d.ts} +2 -2
  33. package/dist/packem_shared/headers-DH0H2s8W.js +1 -0
  34. package/dist/packem_shared/index-Q1764hvO.js +1 -0
  35. package/dist/packem_shared/index.d-T71KjNAr.d.ts +16 -0
  36. package/dist/packem_shared/pailMiddleware-B5DJoBYl.js +1 -0
  37. package/dist/packem_shared/serializeError-C-NFvZ8_-D0CA_Qlx.js +1 -0
  38. package/dist/packem_shared/storage-DaXAlpiO.js +1 -0
  39. package/dist/packem_shared/{types.d-BeLumqgD.d.ts → types.d-bWnqHJKL.d.ts} +2 -37
  40. package/dist/packem_shared/useLogger-DB34CuU5.js +1 -0
  41. package/dist/packem_shared/{wide-event.d-gb2-ks5w.d.ts → wide-event.d-D3ATYpoK.d.ts} +17 -5
  42. package/dist/packem_shared/write-console-log-based-on-level-BqjxV016.js +1 -0
  43. package/dist/packem_shared/write-stream-C7jxLxIT.js +1 -0
  44. package/dist/processor/caller/caller-processor.d.ts +2 -1
  45. package/dist/processor/caller/caller-processor.js +1 -1
  46. package/dist/processor/environment-processor.d.ts +2 -1
  47. package/dist/processor/environment-processor.js +1 -1
  48. package/dist/processor/message-formatter-processor.d.ts +9 -1
  49. package/dist/processor/message-formatter-processor.js +1 -1
  50. package/dist/processor/opentelemetry-processor.d.ts +2 -1
  51. package/dist/processor/opentelemetry-processor.js +1 -1
  52. package/dist/processor/redact-processor.d.ts +41 -2
  53. package/dist/processor/redact-processor.js +1 -1
  54. package/dist/processor/sampling-processor.d.ts +2 -1
  55. package/dist/processor/sampling-processor.js +1 -1
  56. package/dist/reporter/file/json-file-reporter.d.ts +21 -3
  57. package/dist/reporter/file/json-file-reporter.js +2 -2
  58. package/dist/reporter/http/abstract-http-reporter.d.ts +46 -3
  59. package/dist/reporter/http/abstract-http-reporter.js +2 -2
  60. package/dist/reporter/http/http-reporter.d.ts +4 -3
  61. package/dist/reporter/http/http-reporter.edge-light.d.ts +57 -1
  62. package/dist/reporter/http/http-reporter.edge-light.js +2 -2
  63. package/dist/reporter/http/http-reporter.js +1 -1
  64. package/dist/reporter/json/index.browser.d.ts +1 -1
  65. package/dist/reporter/json/index.browser.js +1 -1
  66. package/dist/reporter/json/index.d.ts +6 -4
  67. package/dist/reporter/json/index.js +1 -1
  68. package/dist/reporter/pretty/index.browser.js +1 -1
  69. package/dist/reporter/pretty/index.d.ts +125 -5
  70. package/dist/reporter/pretty/index.js +1 -1
  71. package/dist/reporter/simple/simple-reporter.server.d.ts +87 -5
  72. package/dist/reporter/simple/simple-reporter.server.js +8 -8
  73. package/dist/wide-event.d.ts +4 -3
  74. package/dist/wide-event.js +1 -1
  75. package/package.json +4 -4
  76. package/dist/packem_shared/AbstractJsonReporter-D_Pb6kpB.js +0 -1
  77. package/dist/packem_shared/AbstractJsonReporter-PVC4ONf2.js +0 -1
  78. package/dist/packem_shared/JsonReporter-BEEmb0W4.js +0 -2
  79. package/dist/packem_shared/JsonReporter-CE-lw7R0.js +0 -1
  80. package/dist/packem_shared/PrettyReporter-CDv9n1Fy.js +0 -5
  81. package/dist/packem_shared/PrettyReporter-CuFxJm_o.js +0 -44
  82. package/dist/packem_shared/abstract-pretty-reporter-BpyhtAoN.js +0 -33
  83. package/dist/packem_shared/createPailError-53jAfQ-T.js +0 -5
  84. package/dist/packem_shared/headers-S8WyX-2m.js +0 -1
  85. package/dist/packem_shared/index-Dwp5v97D.js +0 -1
  86. package/dist/packem_shared/pailMiddleware-CWOJRmJq.js +0 -1
  87. package/dist/packem_shared/storage-DHM1EP2P.js +0 -1
  88. package/dist/packem_shared/useLogger-qyZrjy4D.js +0 -1
  89. package/dist/packem_shared/write-console-log-based-on-level-DfD64owL.js +0 -1
  90. package/dist/packem_shared/write-stream-Dd4_PTcm.js +0 -1
@@ -1,31 +1,32 @@
1
- var Ge=Object.defineProperty;var m=(t,e)=>Ge(t,"name",{value:e,configurable:!0});import{createRequire as ze}from"node:module";import{InteractiveManager as We,InteractiveStreamHook as Oe}from"@visulima/interactive-manager";import{L as Ue,s as le,E as Ye,a as we,p as ce,i as De,A as Qe,u as Ke,O as Xe,b as Ze,o as ne,c as et,d as tt,B as rt,G as ge}from"./packem_shared/abstract-pretty-reporter-BpyhtAoN.js";import Ce from"@visulima/colorize";import{PailError as Jr,createPailError as Vr}from"./packem_shared/createPailError-53jAfQ-T.js";const Br=ze(import.meta.url),He=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:ve,stderr:Se,env:se}=He,st="\x1B",M="\x1B[",Re=";";var it=Object.defineProperty,ot=m((t,e)=>it(t,"name",{value:e,configurable:!0}),"t$3"),nt=Object.defineProperty,at=ot((t,e)=>nt(t,"name",{value:e,configurable:!0}),"t");const lt=typeof globalThis<"u"&&typeof globalThis.window=="object"&&globalThis.window.document!==void 0,ct=/^(?:msys|cygwin)$/,ft=!lt&&(process.platform==="win32"||ct.test(process.env.OSTYPE));var ut=Object.defineProperty,D=at((t,e)=>ut(t,"name",{value:e,configurable:!0}),"n");const gt=D((t=1)=>`${M}${String(t)}D`,"cursorBackward");D((t=1)=>`${M}${String(t)}B`,"cursorDown");D((t=1)=>`${M}${String(t)}C`,"cursorForward");const ht=`${M}G`;D((t=1)=>gt(t),"cursorLeft");const dt=D((t=1)=>`${M}${String(t)}G`,"cursorHorizontalAbsolute");D((t,e)=>{let r="";return t<0?r+=`${M}${String(-t)}D`:t>0&&(r+=`${M}${String(t)}C`),e<0?r+=`${M}${String(-e)}A`:e>0&&(r+=`${M}${String(e)}B`),r},"cursorMove");D((t=1)=>`${M}${String(t)}E`,"cursorNextLine");D((t=1)=>`${M}${String(t)}F`,"cursorPreviousLine");const pt=D((t,e)=>e===void 0?dt(t+1):`${M}${String(e+1)}${Re}${String(t+1)}H`,"cursorTo");D((t,e)=>e===void 0?`${M}${String(t)}H`:`${M}${String(t)}${Re}${String(e)}H`,"cursorPosition");D((t=1)=>`${M}${String(t)}I`,"cursorHorizontalForwardTab");D((t=1)=>`${M}${String(t)}Z`,"cursorBackwardTab");D((t=1)=>`${M}${String(t)}X`,"eraseCharacter");D((t=1)=>`${M}${String(t)}d`,"cursorVerticalAbsolute");const mt=D((t=1)=>`${M}${String(t)}A`,"cursorUp");var bt=(t=>(t[t.Default=0]="Default",t[t.BlinkingBlock=1]="BlinkingBlock",t[t.SteadyBlock=2]="SteadyBlock",t[t.BlinkingUnderline=3]="BlinkingUnderline",t[t.SteadyUnderline=4]="SteadyUnderline",t[t.BlinkingBar=5]="BlinkingBar",t[t.SteadyBar=6]="SteadyBar",t))(bt||{});D(t=>`${M}${String(t)} q`,"setCursorStyle");var yt=Object.defineProperty,$t=m((t,e)=>yt(t,"name",{value:e,configurable:!0}),"o$3"),vt=Object.defineProperty,St=$t((t,e)=>vt(t,"name",{value:e,configurable:!0}),"s"),wt=Object.defineProperty,xe=St((t,e)=>wt(t,"name",{value:e,configurable:!0}),"o"),Z=(t=>(t[t.ToEnd=0]="ToEnd",t[t.ToBeginning=1]="ToBeginning",t[t.EntireScreen=2]="EntireScreen",t[t.EntireScreenAndScrollback=3]="EntireScreenAndScrollback",t))(Z||{});const U=xe(t=>{const e=t>=0&&t<=3?t:0;return`${M}${e===0?"":String(e)}J`},"eraseDisplay");var Ie=(t=>(t[t.ToEnd=0]="ToEnd",t[t.ToBeginning=1]="ToBeginning",t[t.EntireLine=2]="EntireLine",t))(Ie||{});const ue=xe(t=>{const e=t>=0&&t<=2?t:0;return`${M}${e===0?"":String(e)}K`},"eraseInLine");U(0);const xt=ue(2);ue(0);ue(1);xe(t=>{if(t<=0)return"";let e="";for(let r=0;r<t;r+=1)e+=xt,r<t-1&&(e+=mt());return e+=ht,e},"eraseLines");U(2);U(1);U(3);pt(0,0)+U(Z.ToEnd);`${ue(Ie.EntireLine)}${M}`;`${M}${U(Z.EntireScreen)}`;const Ee=ft?`${U(Z.EntireScreen)}${M}0f`:`${U(Z.EntireScreen)}${U(Z.EntireScreenAndScrollback)}${M}H${st}c`;var Lt=Object.defineProperty,ee=m((t,e)=>Lt(t,"name",{value:e,configurable:!0}),"t$2");function Fe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}m(Fe,"getDefaultExportFromCjs");ee(Fe,"getDefaultExportFromCjs");function Tt(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}m(Tt,"getDefaultExportFromNamespaceIfPresent");ee(Tt,"getDefaultExportFromNamespaceIfPresent");function kt(t){return t&&Object.prototype.hasOwnProperty.call(t,"default")&&Object.keys(t).length===1?t.default:t}m(kt,"getDefaultExportFromNamespaceIfNotNamed");ee(kt,"getDefaultExportFromNamespaceIfNotNamed");function Mt(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=ee(m(function s(){var i=!1;try{i=this instanceof s}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)},"a"),"a");r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(s){var i=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,i.get?i:{enumerable:!0,get:ee(function(){return t[s]},"get")})}),r}m(Mt,"getAugmentedNamespace");ee(Mt,"getAugmentedNamespace");var ae={exports:{}},je;function Ot(){return je||(je=1,(function(t,e){var r=Object.defineProperty,s=m((f,c)=>r(f,"name",{value:c,configurable:!0}),"$");const{hasOwnProperty:i}=Object.prototype,a=Q();a.configure=Q,a.stringify=a,a.default=a,e.stringify=a,e.configure=Q,t.exports=a;const u=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function n(f){return f.length<5e3&&!u.test(f)?`"${f}"`:JSON.stringify(f)}m(n,"strEscape"),s(n,"strEscape");function g(f,c){if(f.length>200||c)return f.sort(c);for(let $=1;$<f.length;$++){const N=f[$];let T=$;for(;T!==0&&f[T-1]>N;)f[T]=f[T-1],T--;f[T]=N}return f}m(g,"sort"),s(g,"sort");const y=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(f){return y.call(f)!==void 0&&f.length!==0}m(l,"isTypedArrayWithEntries"),s(l,"isTypedArrayWithEntries");function p(f,c,$){f.length<$&&($=f.length);const N=c===","?"":" ";let T=`"0":${N}${f[0]}`;for(let P=1;P<$;P++)T+=`${c}"${P}":${N}${f[P]}`;return T}m(p,"stringifyTypedArray"),s(p,"stringifyTypedArray");function d(f){if(i.call(f,"circularValue")){const c=f.circularValue;if(typeof c=="string")return`"${c}"`;if(c==null)return c;if(c===Error||c===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}m(d,"getCircularValueOption"),s(d,"getCircularValueOption");function E(f){let c;if(i.call(f,"deterministic")&&(c=f.deterministic,typeof c!="boolean"&&typeof c!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return c===void 0?!0:c}m(E,"getDeterministicOption"),s(E,"getDeterministicOption");function q(f,c){let $;if(i.call(f,c)&&($=f[c],typeof $!="boolean"))throw new TypeError(`The "${c}" argument must be of type boolean`);return $===void 0?!0:$}m(q,"getBooleanOption"),s(q,"getBooleanOption");function z(f,c){let $;if(i.call(f,c)){if($=f[c],typeof $!="number")throw new TypeError(`The "${c}" argument must be of type number`);if(!Number.isInteger($))throw new TypeError(`The "${c}" argument must be an integer`);if($<1)throw new RangeError(`The "${c}" argument must be >= 1`)}return $===void 0?1/0:$}m(z,"getPositiveIntegerOption"),s(z,"getPositiveIntegerOption");function R(f){return f===1?"1 item":`${f} items`}m(R,"getItemCount"),s(R,"getItemCount");function F(f){const c=new Set;for(const $ of f)(typeof $=="string"||typeof $=="number")&&c.add(String($));return c}m(F,"getUniqueReplacerSet"),s(F,"getUniqueReplacerSet");function Y(f){if(i.call(f,"strict")){const c=f.strict;if(typeof c!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(c)return $=>{let N=`Object can not safely be stringified. Received type ${typeof $}`;throw typeof $!="function"&&(N+=` (${$.toString()})`),new Error(N)}}}m(Y,"getStrictOption"),s(Y,"getStrictOption");function Q(f){f={...f};const c=Y(f);c&&(f.bigint===void 0&&(f.bigint=!1),"circularValue"in f||(f.circularValue=Error));const $=d(f),N=q(f,"bigint"),T=E(f),P=typeof T=="function"?T:void 0,J=z(f,"maximumDepth"),O=z(f,"maximumBreadth");function te(_,o,h,w,v,x){let b=o[_];switch(typeof b=="object"&&b!==null&&typeof b.toJSON=="function"&&(b=b.toJSON(_)),b=w.call(o,_,b),typeof b){case"string":return n(b);case"object":{if(b===null)return"null";if(h.indexOf(b)!==-1)return $;let S="",j=",";const A=x;if(Array.isArray(b)){if(b.length===0)return"[]";if(J<h.length+1)return'"[Array]"';h.push(b),v!==""&&(x+=v,S+=`
2
- ${x}`,j=`,
3
- ${x}`);const I=Math.min(b.length,O);let H=0;for(;H<I-1;H++){const oe=te(String(H),b,h,w,v,x);S+=oe!==void 0?oe:"null",S+=j}const W=te(String(H),b,h,w,v,x);if(S+=W!==void 0?W:"null",b.length-1>O){const oe=b.length-O-1;S+=`${j}"... ${R(oe)} not stringified"`}return v!==""&&(S+=`
4
- ${A}`),h.pop(),`[${S}]`}let k=Object.keys(b);const B=k.length;if(B===0)return"{}";if(J<h.length+1)return'"[Object]"';let L="",C="";v!==""&&(x+=v,j=`,
5
- ${x}`,L=" ");const V=Math.min(B,O);T&&!l(b)&&(k=g(k,P)),h.push(b);for(let I=0;I<V;I++){const H=k[I],W=te(H,b,h,w,v,x);W!==void 0&&(S+=`${C}${n(H)}:${L}${W}`,C=j)}if(B>O){const I=B-O;S+=`${C}"...":${L}"${R(I)} not stringified"`,C=j}return v!==""&&C.length>1&&(S=`
6
- ${x}${S}
7
- ${A}`),h.pop(),`{${S}}`}case"number":return isFinite(b)?String(b):c?c(b):"null";case"boolean":return b===!0?"true":"false";case"undefined":return;case"bigint":if(N)return String(b);default:return c?c(b):void 0}}m(te,"J"),s(te,"stringifyFnReplacer");function re(_,o,h,w,v,x){switch(typeof o=="object"&&o!==null&&typeof o.toJSON=="function"&&(o=o.toJSON(_)),typeof o){case"string":return n(o);case"object":{if(o===null)return"null";if(h.indexOf(o)!==-1)return $;const b=x;let S="",j=",";if(Array.isArray(o)){if(o.length===0)return"[]";if(J<h.length+1)return'"[Array]"';h.push(o),v!==""&&(x+=v,S+=`
8
- ${x}`,j=`,
9
- ${x}`);const B=Math.min(o.length,O);let L=0;for(;L<B-1;L++){const V=re(String(L),o[L],h,w,v,x);S+=V!==void 0?V:"null",S+=j}const C=re(String(L),o[L],h,w,v,x);if(S+=C!==void 0?C:"null",o.length-1>O){const V=o.length-O-1;S+=`${j}"... ${R(V)} not stringified"`}return v!==""&&(S+=`
10
- ${b}`),h.pop(),`[${S}]`}h.push(o);let A="";v!==""&&(x+=v,j=`,
11
- ${x}`,A=" ");let k="";for(const B of w){const L=re(B,o[B],h,w,v,x);L!==void 0&&(S+=`${k}${n(B)}:${A}${L}`,k=j)}return v!==""&&k.length>1&&(S=`
12
- ${x}${S}
13
- ${b}`),h.pop(),`{${S}}`}case"number":return isFinite(o)?String(o):c?c(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(N)return String(o);default:return c?c(o):void 0}}m(re,"I"),s(re,"stringifyArrayReplacer");function K(_,o,h,w,v){switch(typeof o){case"string":return n(o);case"object":{if(o===null)return"null";if(typeof o.toJSON=="function"){if(o=o.toJSON(_),typeof o!="object")return K(_,o,h,w,v);if(o===null)return"null"}if(h.indexOf(o)!==-1)return $;const x=v;if(Array.isArray(o)){if(o.length===0)return"[]";if(J<h.length+1)return'"[Array]"';h.push(o),v+=w;let L=`
14
- ${v}`;const C=`,
15
- ${v}`,V=Math.min(o.length,O);let I=0;for(;I<V-1;I++){const W=K(String(I),o[I],h,w,v);L+=W!==void 0?W:"null",L+=C}const H=K(String(I),o[I],h,w,v);if(L+=H!==void 0?H:"null",o.length-1>O){const W=o.length-O-1;L+=`${C}"... ${R(W)} not stringified"`}return L+=`
16
- ${x}`,h.pop(),`[${L}]`}let b=Object.keys(o);const S=b.length;if(S===0)return"{}";if(J<h.length+1)return'"[Object]"';v+=w;const j=`,
17
- ${v}`;let A="",k="",B=Math.min(S,O);l(o)&&(A+=p(o,j,O),b=b.slice(o.length),B-=o.length,k=j),T&&(b=g(b,P)),h.push(o);for(let L=0;L<B;L++){const C=b[L],V=K(C,o[C],h,w,v);V!==void 0&&(A+=`${k}${n(C)}: ${V}`,k=j)}if(S>O){const L=S-O;A+=`${k}"...": "${R(L)} not stringified"`,k=j}return k!==""&&(A=`
18
- ${v}${A}
19
- ${x}`),h.pop(),`{${A}}`}case"number":return isFinite(o)?String(o):c?c(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(N)return String(o);default:return c?c(o):void 0}}m(K,"V"),s(K,"stringifyIndent");function X(_,o,h){switch(typeof o){case"string":return n(o);case"object":{if(o===null)return"null";if(typeof o.toJSON=="function"){if(o=o.toJSON(_),typeof o!="object")return X(_,o,h);if(o===null)return"null"}if(h.indexOf(o)!==-1)return $;let w="";const v=o.length!==void 0;if(v&&Array.isArray(o)){if(o.length===0)return"[]";if(J<h.length+1)return'"[Array]"';h.push(o);const A=Math.min(o.length,O);let k=0;for(;k<A-1;k++){const L=X(String(k),o[k],h);w+=L!==void 0?L:"null",w+=","}const B=X(String(k),o[k],h);if(w+=B!==void 0?B:"null",o.length-1>O){const L=o.length-O-1;w+=`,"... ${R(L)} not stringified"`}return h.pop(),`[${w}]`}let x=Object.keys(o);const b=x.length;if(b===0)return"{}";if(J<h.length+1)return'"[Object]"';let S="",j=Math.min(b,O);v&&l(o)&&(w+=p(o,",",O),x=x.slice(o.length),j-=o.length,S=","),T&&(x=g(x,P)),h.push(o);for(let A=0;A<j;A++){const k=x[A],B=X(k,o[k],h);B!==void 0&&(w+=`${S}${n(k)}:${B}`,S=",")}if(b>O){const A=b-O;w+=`${S}"...":"${R(A)} not stringified"`}return h.pop(),`{${w}}`}case"number":return isFinite(o)?String(o):c?c(o):"null";case"boolean":return o===!0?"true":"false";case"undefined":return;case"bigint":if(N)return String(o);default:return c?c(o):void 0}}m(X,"N"),s(X,"stringifySimple");function Me(_,o,h){if(arguments.length>1){let w="";if(typeof h=="number"?w=" ".repeat(Math.min(h,10)):typeof h=="string"&&(w=h.slice(0,10)),o!=null){if(typeof o=="function")return te("",{"":_},[],o,w,"");if(Array.isArray(o))return re("",_,[],F(o),w,"")}if(w.length!==0)return K("",_,[],w,"")}return X("",_,[])}return m(Me,"M"),s(Me,"stringify"),Me}m(Q,"configure"),s(Q,"configure")})(ae,ae.exports)),ae.exports}m(Ot,"requireSafeStableStringify");var Et=Ot();const jt=Fe(Et),At=jt.configure;var Pt=Object.defineProperty,Bt=m((t,e)=>Pt(t,"name",{value:e,configurable:!0}),"o$1");const Nt=Bt(t=>{const e=console;return t==="error"?e.__error??console.error:t==="warn"?e.__warn??console.warn:t==="trace"?e.__trace??console.trace:e.__log??console.log},"writeConsoleLogBasedOnLevel");var _t=Object.defineProperty,Dt=m((t,e)=>_t(t,"name",{value:e,configurable:!0}),"t");let Ct=class{static{m(this,"a")}static{Dt(this,"RawReporter")}log(e){const{context:r=[],message:s,type:i}=e;Nt(i.level)(s,...r)}};var Rt=Object.defineProperty,It=m((t,e)=>Rt(t,"name",{value:e,configurable:!0}),"a");const me=It(t=>t===void 0?[]:Array.isArray(t)?t:[t],"arrayify");var Ft=Object.defineProperty,qt=m((t,e)=>Ft(t,"name",{value:e,configurable:!0}),"g$2");const be=qt((t,e)=>{const r={...t};return Object.keys(e).forEach(s=>{r[s]={...r[s],...e[s]}}),r},"mergeTypes");var Jt=Object.defineProperty,ye=m((t,e)=>Jt(t,"name",{value:e,configurable:!0}),"d");const Vt=ye(t=>{let e=!1;return function(...r){if(!e){e=!0;try{const s=t.apply(this,r);return e=!1,s}catch(s){throw e=!1,s}}}},"preventLoop");class Le{static{m(this,"PailBrowserImpl")}static{ye(this,"PailBrowserImpl")}timersMap;countMap;seqTimers;lastLog;logLevels;disabled;paused;messageQueue;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;force={};constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5;const r=e.parentLongestLabel,s=e.parentTypes,i=e.parentStringify,a=e.parentLogLevels;this.stringify=i??At({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",s&&r?(this.types=s,this.longestLabel=r):(this.types=be(Ue,e.types??{}),this.longestLabel=le(this.types)),this.logLevels=a&&!e.logLevels?a:{...Ye,...e.logLevels},this.generalLogLevel=this.#e(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.paused=!1,this.messageQueue=[],this.scopeName=me(e.scope).filter(Boolean),this.timersMap=new Map,this.countMap=new Map,this.groups=[],this.seqTimers=new Set,this.lastLog={},this.logger=Vt(this.logger.bind(this)),this.#r(),Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new Ct),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}#r(){for(const e in this.types)this[e]=this.logger.bind(this,e,!1,!1);for(const e in this.types)this.force[e]=this.logger.bind(this,e,!1,!0);this.raw=this.raw.bind(this)}wrapConsole(){for(const e in this.types)console[`__${e}`]||(console[`__${e}`]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)console[`__${e}`]&&(console[e]=console[`__${e}`],delete console[`__${e}`])}wrapException(){process.on("uncaughtException",e=>{this.error(e)}),process.on("unhandledRejection",e=>{this.error(e)})}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}pause(){this.paused=!0}resume(){this.paused=!1;const e=this.messageQueue.splice(0);for(let r=0;r<e.length;r+=1){const{messageObject:s,raw:i,type:a}=e[r];this.logger(a,i,!1,...s)}}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}unscope(){this.scopeName=[]}child(e){const r=e?.types!==void 0,s=r?be(this.types,e.types):this.types,i=e?.reporters??[],a=i.length>0?[...this.reporters,...i]:[...this.reporters],u=e?.processors??[],n=u.length>0?[...this.processors,...u]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let y;if(e?.scope){const d=me(e.scope).filter(Boolean);y=this.scopeName.length>0?[...this.scopeName,...d]:d}else y=this.scopeName.length>0?this.scopeName:[];const l=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},p={disabled:e?.disabled??this.disabled,logLevel:e?.logLevel??this.generalLogLevel,logLevels:g,messages:l,processors:n,rawReporter:e?.rawReporter??this.rawReporter,reporters:a,scope:y,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return r?(p.parentTypes=s,p.parentLongestLabel=le(s)):(p.parentTypes=this.types,p.parentLongestLabel=this.longestLabel),e?.logLevels||(p.parentLogLevels=this.logLevels),e?.messages||(p.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),p.parentStringify=this.stringify,new Le(p)}time(e="default"){this.seqTimers.has(e)?this.logger("warn",!1,!1,{message:`Timer '${e}' already exists`,prefix:e}):(this.seqTimers.add(e),this.timersMap.set(e,Date.now()),this.logger("start",!1,!1,{message:this.startTimerMessage,prefix:e}))}timeLog(e,...r){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const s=Date.now()-this.timersMap.get(e);this.logger("info",!1,!1,{context:r,message:s<1e3?`${String(s)} ms`:`${(s/1e3).toFixed(2)} s`,prefix:e})}else this.logger("warn",!1,!1,{context:r,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.seqTimers.size>0&&(e=[...this.seqTimers].pop()),e&&this.timersMap.has(e)){const r=Date.now()-this.timersMap.get(e);this.timersMap.delete(e),this.logger("stop",!1,!1,{message:`${this.endTimerMessage} ${r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(2)} s`}`,prefix:e})}else this.logger("warn",!1,!1,{message:"Timer not found",prefix:e})}group(e="console.group"){globalThis.window===void 0?this.groups.push(e):console.group(e)}groupEnd(){globalThis.window===void 0?this.groups.pop():console.groupEnd()}count(e="default"){const r=this.countMap.get(e)??0;this.countMap.set(e,r+1),this.logger("log",!1,!1,{message:`${e}: ${String(r+1)}`,prefix:e})}countReset(e="default"){this.countMap.has(e)?this.countMap.delete(e):this.logger("warn",!1,!1,{message:`Count for ${e} does not exist`,prefix:e})}clear(){console.clear()}raw(e,...r){this.disabled||this.logger("log",!0,!1,{context:r,message:e})}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(let r=0;r<e.length;r+=1)this.reporters.add(this.extendReporter(e[r]))}registerProcessors(e){for(let r=0;r<e.length;r+=1){const s=e[r];typeof s.setStringify=="function"&&s.setStringify(this.stringify),this.processors.add(s)}}#t(e,r){if(r)this.rawReporter.log(Object.freeze(e));else for(const s of this.reporters)s.log(Object.freeze(e))}#e(e){return e&&this.logLevels[e]?e:"debug"}#s(e,r,...s){const i={badge:void 0,context:void 0,error:void 0,label:void 0,message:we,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(i.type={level:r.logLevel,name:e},i.groups=this.groups,i.scope=this.scopeName,i.date=new Date,s.length>0&&s[0]instanceof Error)i.error=s[0],s.length>1&&(i.context=s.slice(1));else if(s.length>0&&typeof s[0]=="object"&&s[0]!==null&&"message"in s[0]){const{context:a,message:u,prefix:n,suffix:g}=s[0];if(a&&(i.context=a),n&&(i.prefix=n),g&&(i.suffix=g),i.message=u,s.length>1){const y=s.slice(1);i.context?i.context=Array.isArray(i.context)?[...i.context,...y]:[i.context,...y]:i.context=y}}else s.length>1?(i.message=s[0],i.context=s.slice(1)):s.length===1?i.message=s[0]:i.message=void 0;return r.logLevel==="trace"&&(i.traceError=new Error("Trace")),r.badge&&(i.badge=r.badge),r.label&&(i.label=r.label),i}logger(e,r,s,...i){if(this.disabled)return;if(this.paused){this.messageQueue.push({messageObject:i,raw:r,type:e});return}const a=this.types[e],u=this.#e(a.logLevel);if(s||this.logLevels[u]>=this.logLevels[this.generalLogLevel]){let n=this.#s(e,a,...i);const g=ye((l=!1)=>{const p=(this.lastLog.count??0)-this.throttleMin;if(this.lastLog.object&&p>0){const d={...this.lastLog.object};p>1&&(d.repeated=p),this.#t(d,r),this.lastLog.count=1}if(l){for(const d of this.processors)n={...d.process(n)};if(n.dropped===!0)return;this.lastLog.object=n;try{this.lastLog.signature=JSON.stringify([n.label,n.scope,n.type,n.message,n.prefix,n.suffix,n.context])}catch{this.lastLog.signature=void 0}this.#t(n,r)}},"resolveLog");clearTimeout(this.lastLog.timeout);const y=this.lastLog.time&&n.date?new Date(n.date).getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=new Date(n.date),y<this.throttle)try{const l=JSON.stringify([n.label,n.scope,n.type,n.message,n.prefix,n.suffix,n.context]);if(this.lastLog.object&&l===this.lastLog.signature&&(this.lastLog.count=(this.lastLog.count??0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(g,this.throttle);return}}catch{}g(!0)}}}var Gt=Object.defineProperty,zt=m((t,e)=>Gt(t,"name",{value:e,configurable:!0}),"c$1");let Ht=class{static{m(this,"v")}static{zt(this,"RawReporter")}#r;#t;#e;#s=!1;#i;constructor(e={}){this.#r=ve,this.#t=Se,this.#i=e}setStdout(e){this.#r=e}setStderr(e){this.#t=e}setInteractiveManager(e){this.#e=e}setIsInteractive(e){this.#s=e}log(e){const{context:r,groups:s,message:i,type:a}=e,u=[];if(i!==we){const l=typeof i=="string"?i:ce(i,this.#i);u.push(l)}r&&u.push(...r.map(l=>typeof l=="object"?` ${ce(l,this.#i)}`:` ${String(l)}`));const n=["error","trace","warn"].includes(a.level)?"stderr":"stdout",g=n==="stderr"?this.#t:this.#r,y=s.map(()=>" ").join("");this.#s&&this.#e!==void 0&&g.isTTY?this.#e.update(n,(y+u.join("")).split(`
20
- `),0):De(y+u.join(""),g)}};var Wt=Object.defineProperty,Ut=m((t,e)=>Wt(t,"name",{value:e,configurable:!0}),"m$1");class Te extends Le{static{m(this,"c")}constructor(e){const r=e.parentStderr,s=e.parentStdout,{interactive:i,processors:a,rawReporter:u,reporters:n,stderr:g,stdout:y}=e,l=r??g,p=s??y,d=e.parentLongestLabel,E=e.parentTypes,{parentLogLevels:q,parentMessages:z,parentStringify:R}=e,F={disabled:e.disabled,logLevel:e.logLevel,logLevels:e.logLevels,messages:e.messages,processors:[],rawReporter:e.rawReporter,reporters:[],scope:e.scope,throttle:e.throttle,throttleMin:e.throttleMin},Y="types"in e;E&&d&&!Y?(F.parentTypes=E,F.parentLongestLabel=d):Y&&e.types!==void 0&&(F.types=e.types),R&&(F.parentStringify=R),q&&!e.logLevels&&(F.parentLogLevels=q),z&&!e.messages&&(F.parentMessages=z),super(F),this.options=e,this.interactive=i??!1,this.stdout=p,this.stderr=l,this.interactive&&(this.interactiveManager=new We(new Oe(this.stdout),new Oe(this.stderr))),Array.isArray(n)&&this.registerReporters(n),this.rawReporter=this.extendReporter(u??new Ht),Array.isArray(a)&&this.registerProcessors(a)}options;static{Ut(this,"PailServerImpl")}stdout;stderr;interactiveManager;interactive;scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.scopeName=e.flat(),this}child(e){const r=e?.types!==void 0,s=r?be(this.types,e.types):this.types,i=e?.reporters??[],a=i.length>0?[...this.reporters,...i]:[...this.reporters],u=e?.processors??[],n=u.length>0?[...this.processors,...u]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let y;if(e?.scope){const d=me(e.scope).filter(Boolean);y=this.scopeName.length>0?[...this.scopeName,...d]:d}else y=this.scopeName.length>0?this.scopeName:[];const l=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},p={disabled:e?.disabled??this.disabled,interactive:e?.interactive??this.interactive,logLevel:e?.logLevel??this.generalLogLevel,logLevels:g,messages:l,processors:n,rawReporter:e?.rawReporter??this.rawReporter,reporters:a,scope:y,stderr:e?.stderr??this.stderr,stdout:e?.stdout??this.stdout,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return this.#r(p,e,r,s),new Te(p)}#r(e,r,s,i){s?(e.parentTypes=i,e.parentLongestLabel=le(i)):(e.parentTypes=this.types,e.parentLongestLabel=this.longestLabel),r?.logLevels||(e.parentLogLevels=this.logLevels),r?.messages||(e.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),e.parentStringify=this.stringify,r?.stdout||(e.parentStdout=this.stdout),r?.stderr||(e.parentStderr=this.stderr)}getInteractiveManager(){return this.interactiveManager}wrapStd(){this.#t(this.stdout,"log"),this.#t(this.stderr,"error")}restoreStd(){this.#e(this.stdout),this.#e(this.stderr)}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}clear(){this.stdout.write(Ee),this.stderr.write(Ee)}extendReporter(e){return typeof e.setStdout=="function"&&e.setStdout(this.stdout),typeof e.setStderr=="function"&&e.setStderr(this.stderr),typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),typeof e.setIsInteractive=="function"&&e.setIsInteractive(this.interactive),this.interactive&&typeof e.setInteractiveManager=="function"&&e.setInteractiveManager(this.interactiveManager),e}#t(e,r){e&&(e.__write||(e.__write=e.write),e.write=s=>{this[r](String(s).trim())})}#e(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}}const Yt=Te;var Qt=Object.defineProperty,Kt=m((t,e)=>Qt(t,"name",{value:e,configurable:!0}),"x"),Xt=Object.defineProperty,qe=Kt((t,e)=>Xt(t,"name",{value:e,configurable:!0}),"h"),Zt=Object.defineProperty,ie=qe((t,e)=>Zt(t,"name",{value:e,configurable:!0}),"g$1");const Ae=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"]]),er=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,tr=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,rr=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,sr=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,$e=ie(()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),"getDefaultCss"),Pe=/\s+/,fe=ie(t=>{Ae.has(t)&&(t=Ae.get(t));const e=er.exec(t);if(e)return[Number.parseInt(e[1],16),Number.parseInt(e[2],16),Number.parseInt(e[3],16)];const r=tr.exec(t);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 s=rr.exec(t);if(s)return[Math.round(Math.max(0,Math.min(255,Number(s[1])))),Math.round(Math.max(0,Math.min(255,Number(s[2])))),Math.round(Math.max(0,Math.min(255,Number(s[3]))))];const i=sr.exec(t);if(i){let a=Number(i[1])%360;a<0&&(a+=360);const u=Math.max(0,Math.min(100,Number(i[2])))/100,n=Math.max(0,Math.min(100,Number(i[3])))/100,g=(1-Math.abs(2*n-1))*u,y=g*(1-Math.abs(a/60%2-1)),l=n-g/2;let p,d,E;return a<60?{0:p,1:d,2:E}=[g,y,0]:a<120?{0:p,1:d,2:E}=[y,g,0]:a<180?{0:p,1:d,2:E}=[0,g,y]:a<240?{0:p,1:d,2:E}=[0,y,g]:a<300?{0:p,1:d,2:E}=[y,0,g]:{0:p,1:d,2:E}=[g,0,y],[Math.round((p+l)*255),Math.round((d+l)*255),Math.round((E+l)*255)]}return null},"parseCssColor"),he=ie((t,e)=>t?.[0]===e?.[0]&&t?.[1]===e?.[1]&&t?.[2]===e?.[2],"colorEquals"),ir=ie(t=>{if(typeof t!="string")return $e();const e=$e(),r=[];let s=!1,i=null,a=0,u="";for(const n of t){if(n==="(")a+=1;else if(a>0)n===")"&&(a-=1);else if(s){if(n===";"){const g=u.trim();g!==""&&r.push([i,g]),i=null,u="",s=!1;continue}}else if(n===":"){i=u.trim(),u="",s=!0;continue}u+=n}if(s&&a===0){const n=u.trim();n!==""&&r.push([i,n]),i=null,u=""}for(const{0:n,1:g}of r)switch(n){case"background-color":{g!=null&&(e.backgroundColor=g);break}case"color":{g!=null&&(e.color=g);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(g)&&(e.fontStyle="italic");break}case"font-weight":{g==="bold"&&(e.fontWeight=g);break}case"text-decoration":{e.textDecorationColor=null,e.textDecorationLine=[];const y=g.split(Pe);for(const l of y){const p=fe(l);p!=null?e.textDecorationColor=p:["line-through","overline","underline"].includes(l)&&e.textDecorationLine.push(l)}break}case"text-decoration-color":{const y=fe(g);y!=null&&(e.textDecorationColor=y);break}case"text-decoration-line":{e.textDecorationLine=[];const y=g.split(Pe);for(const l of y)["line-through","overline","underline"].includes(l)&&e.textDecorationLine.push(l);break}}return e},"parseCss"),or=ie((t,e)=>{e=e??$e();let r="";if(!he(t.backgroundColor,e.backgroundColor))if(t.backgroundColor==null)r+="\x1B[49m";else switch(t.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(t.backgroundColor)){const{0:s,1:i,2:a}=t.backgroundColor;r+=`\x1B[48;2;${String(s)};${String(i)};${String(a)}m`}else{const s=fe(t.backgroundColor);if(s===null)r+="\x1B[49m";else{const{0:i,1:a,2:u}=s;r+=`\x1B[48;2;${String(i)};${String(a)};${String(u)}m`}}}if(!he(t.color,e.color))if(t.color==null)r+="\x1B[39m";else switch(t.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(t.color)){const{0:s,1:i,2:a}=t.color;r+=`\x1B[38;2;${String(s)};${String(i)};${String(a)}m`}else{const s=fe(t.color);if(s===null)r+="\x1B[39m";else{const{0:i,1:a,2:u}=s;r+=`\x1B[38;2;${String(i)};${String(a)};${String(u)}m`}}}if(t.fontWeight!==e.fontWeight&&(r+=t.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),t.fontStyle!==e.fontStyle&&(r+=t.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!he(t.textDecorationColor,e.textDecorationColor))if(t.textDecorationColor==null)r+="\x1B[59m";else{const{0:s,1:i,2:a}=t.textDecorationColor;r+=`\x1B[58;2;${String(s)};${String(i)};${String(a)}m`}return t.textDecorationLine.includes("line-through")!==e.textDecorationLine.includes("line-through")&&(r+=t.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),t.textDecorationLine.includes("overline")!==e.textDecorationLine.includes("overline")&&(r+=t.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),t.textDecorationLine.includes("underline")!==e.textDecorationLine.includes("underline")&&(r+=t.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),r},"cssToAnsi");var nr=Object.defineProperty,ke=qe((t,e)=>nr(t,"name",{value:e,configurable:!0}),"u");const ar=ke(t=>{try{return JSON.stringify(t)}catch{return'"[Circular]"'}},"tryStringify"),Be="%".codePointAt(0),lr="s".codePointAt(0),cr="d".codePointAt(0),fr="f".codePointAt(0),ur="i".codePointAt(0),gr="O".codePointAt(0),hr="o".codePointAt(0),dr="j".codePointAt(0),pr="c".codePointAt(0),mr=ke((t,e=[],r={})=>{if(typeof t!="string"&&typeof t!="object"||t===null)throw new TypeError(`fmt must be a string or object, got ${t===null?"null":typeof t}`);const s=r.stringify??ar,i=1;if(typeof t=="object"){const l=e.length+i;if(l===1)return"{}";const p=Array.from({length:l});p[0]=s(t);for(let d=1;d<l;d+=1)p[d]=s(e[d-i]);return p.join(" ")}if(e.length===0)return t;let a="",u=1-i,n=-1,g=!1,y;for(let l=0;l<t.length;){if(t.codePointAt(l)===Be&&l+1<t.length){n=n>-1?n:0;const p=t.codePointAt(l+1);if(p===void 0){u+=1;break}switch(p){case pr:{if(globalThis.window===void 0){const d=ir(e[u]);n<l&&(a+=t.slice(n,l));const E=or(d,y);a+=E,E!==""&&(g=!0,y=d)}n=l+2,l+=1;break}case cr:case fr:{if(u>=e.length||e[u]==null)break;n<l&&(a+=t.slice(n,l));const d=e[u];a+=(typeof d=="symbol"?Number.NaN:Number(d)).toString(),n=l+2,l+=1;break}case ur:{if(u>=e.length||e[u]==null)break;n<l&&(a+=t.slice(n,l));const d=e[u];a+=Math.floor(typeof d=="symbol"?Number.NaN:Number(d)).toString(),n=l+2,l+=1;break}case dr:case gr:case hr:{if(u>=e.length||e[u]===void 0)break;n<l&&(a+=t.slice(n,l));const d=e[u],E=typeof d;if(E==="string"){a+=`'${d}'`,n=l+2,l+=1;break}if(E==="function"){a+=d.name?`[Function: ${d.name}]`:"[Function: <anonymous>]",n=l+2,l+=1;break}a+=s(d),n=l+2,l+=1;break}case Be:{n<l&&(a+=t.slice(n,l)),a+="%",n=l+2,l+=1,u-=1;break}case lr:{if(u>=e.length)break;n<l&&(a+=t.slice(n,l)),a+=typeof e[u]=="object"?s(e[u]):String(e[u]),n=l+2,l+=1;break}default:typeof r.formatters?.[p]=="function"&&(n<l&&(a+=t.slice(n,l)),a+=r.formatters[p](e[u]),n=l+2,l+=1)}u+=1}l+=1}return n===-1?t:(n<t.length&&(a+=t.slice(n)),g&&(a+="\x1B[0m"),a)},"format"),br=ke((t={})=>{const e={};return typeof t.formatters=="object"&&Object.entries(t.formatters).forEach(([r,s])=>{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 s!="function")throw new TypeError(`Formatter for %${r} is not a function`);const i=r.codePointAt(0);if(i===void 0)throw new Error(`${r}.codePointAt(0) failed to return a value, please report this issue`);e[i]=s}),(r,s=[],i={})=>mr(r,s,{...i,formatters:e})},"build");var yr=Object.defineProperty,Ne=m((t,e)=>yr(t,"name",{value:e,configurable:!0}),"s$1");class $r{static{m(this,"p")}static{Ne(this,"MessageFormatterProcessor")}#r;#t;#e;constructor(e={}){this.#t=e.formatters}setStringify(e){this.#r=e}process(e){this.#e===void 0&&(this.#e=br({formatters:this.#t,stringify:Ne(s=>this.#r?this.#r(s):JSON.stringify(s),"stringify")}));const r=this.#e;return e.message!==void 0&&(e.message=this.#s(r,e.message,e.context??[])),e}#s(e,r,s=[]){if(typeof r=="string")return e(r,s);if(typeof r=="object"&&r!==null){const i=r,a=Object.keys(i);for(let u=0;u<a.length;u+=1){const n=a[u],g=i[n];(typeof g=="string"||Array.isArray(g)||typeof g=="object")&&(i[n]=this.#s(e,g,s))}}return r}}var vr=Object.defineProperty,Je=m((t,e)=>vr(t,"name",{value:e,configurable:!0}),"M");const{bgGrey:Sr,cyan:wr,green:xr,greenBright:Lr,grey:G,red:de,underline:_e,white:Tr}=Ce,kr=/[\\/]pail[\\/]dist/,pe=Je(t=>!kr.test(t),"pailFileFilter");class Mr extends Qe{static{m(this,"PrettyReporter")}static{Je(this,"PrettyReporter")}#r;#t;#e;#s=!1;#i;#o;constructor(e={}){const{error:r,inspect:s,...i}=e;super({uppercase:{label:!0,...i.uppercase},...i}),this.#i={...Ke,...s},this.#o={...r,color:{fileLine:xr,hint:wr,marker:de,message:de,method:Lr,title:de}},this.#r=ve,this.#t=Se}setStdout(e){this.#r=e}setStderr(e){this.#t=e}setInteractiveManager(e){this.#e=e}setIsInteractive(e){this.#s=e}log(e){this._log(this._formatMessage(e),e.type.level)}_formatMessage(e){const{columns:r}=Xe();let s=r;typeof this.styles.messageLength=="number"&&(s=this.styles.messageLength);const{badge:i,context:a,date:u,error:n,file:g,groups:y,label:l,message:p,prefix:d,repeated:E,scope:q,suffix:z,traceError:R,type:F}=e,{color:Y}=this.loggerTypes[F.name],Q=Y?Ce[Y]:Tr,f=y.map(()=>" ").join(""),c=[];if(y.length>0&&c.push(`${f+G(`[${y.at(-1)??""}]`)} `),u&&c.push(`${G(this.styles.dateFormatter(typeof u=="string"?new Date(u):u))} `),i)c.push(Q(i));else{const T=Ze(this.loggerTypes);T.length>0&&c.push(`${G(".".repeat(T.length))} `)}const $=le(this.loggerTypes);if(l){const T=ne($),P=ne(l);c.push(`${Q(et(l,this.styles))} `,G(".".repeat(Math.max(0,T-P))))}else c.push(G(".".repeat($.length+2)));E&&c.push(`${Sr.white(`[${String(E)}x]`)} `),Array.isArray(q)&&q.length>0&&c.push(` ${G(`[${q.join(" > ")}]`)} `),d&&c.push(`${G(`${Array.isArray(q)&&q.length>0?". ":" "}[${this.styles.underline.prefix?_e(d):d}]`)} `);const N=ne(c.join(" "));if(g){const T=(g.name??"")+(g.line?`:${String(g.line)}`:""),P=ne(T);if(P+N+2>s)c.push(G(` ${T}`));else{const J=Math.max(0,s-N-P-2);c.push(G(`${".".repeat(J)} ${T}`))}}else c.push(G(".".repeat(Math.max(0,s-N-1))));if(c.length>0&&c.push(`
1
+ import{createRequire as Ge}from"node:module";import{InteractiveManager as Je,InteractiveStreamHook as ke}from"@visulima/interactive-manager";import{g as ie,E as Ue,a as $e,L as We,j as oe,r as Ie,b as Ne,A as ze,c as Ye,d as He,e as Qe,f as Z,h as Xe,V as Ke,U as le,i as Ze}from"./packem_shared/abstract-pretty-reporter-Bczvp2Zh.js";import Pe from"@visulima/colorize";import{PailError as pr,createPailError as mr}from"./packem_shared/PailError-CbU1Ogfa.js";const Fe=Ge(import.meta.url),U=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qe=r=>{if(typeof U<"u"&&U.versions&&U.versions.node){const[e,t]=U.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return U.getBuiltinModule(r)}return Fe(r)},{stdout:Se,stderr:ve,env:H}=U,{createRequire:Ve}=qe("node:module"),et="\x1B",me="\x1B[";Ve(import.meta.url);const tt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ee=tt,rt=(r,e,t,s)=>{if(t==="length"||t==="prototype"||t==="arguments"||t==="caller")return;const i=Object.getOwnPropertyDescriptor(r,t),o=Object.getOwnPropertyDescriptor(e,t);!st(i,o)&&s||Object.defineProperty(r,t,o)},st=function(r,e){return r===void 0||r.configurable||r.writable===e.writable&&r.enumerable===e.enumerable&&r.configurable===e.configurable&&(r.writable||r.value===e.value)},it=(r,e)=>{const t=Object.getPrototypeOf(e);t!==Object.getPrototypeOf(r)&&Object.setPrototypeOf(r,t)},ot=(r,e)=>`/* Wrapped ${r}*/
2
+ ${e}`,nt=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),at=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),lt=(r,e,t)=>{const s=t===""?"":`with ${t.trim()}() `,i=ot.bind(null,s,e.toString());Object.defineProperty(i,"name",at);const{writable:o,enumerable:l,configurable:a}=nt;Object.defineProperty(r,"toString",{value:i,writable:o,enumerable:l,configurable:a})};function ct(r,e,{ignoreNonConfigurable:t=!1}={}){const{name:s}=r;for(const i of Reflect.ownKeys(e))rt(r,e,i,t);return it(r,e),lt(r,e,s),r}const ne=new WeakMap,Re=(r,e={})=>{if(typeof r!="function")throw new TypeError("Expected a function");let t,s=0;const i=r.displayName||r.name||"<anonymous>",o=function(...l){if(ne.set(o,++s),s===1)t=r.apply(this,l),r=void 0;else if(e.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return t};return ct(o,r),ne.set(o,s),o};Re.callCount=r=>{if(!ne.has(r))throw new Error(`The given function \`${r.name}\` is not wrapped by the \`onetime\` package`);return ne.get(r)};const W=[];W.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&W.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&W.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");const re=r=>!!r&&!0&&typeof r.removeListener=="function"&&typeof r.emit=="function"&&typeof r.reallyExit=="function"&&typeof r.listeners=="function"&&typeof r.kill=="function"&&typeof r.pid=="number"&&typeof r.on=="function",ce=Symbol.for("signal-exit emitter"),fe=globalThis,ft=Object.defineProperty.bind(Object);let ht=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(fe[ce])return fe[ce];ft(fe,ce,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,t){this.listeners[e].push(t)}removeListener(e,t){const s=this.listeners[e],i=s.indexOf(t);i!==-1&&(i===0&&s.length===1?s.length=0:s.splice(i,1))}emit(e,t,s){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(const o of this.listeners[e])i=o(t,s)===!0||i;return e==="exit"&&(i=this.emit("afterExit",t,s)||i),i}},Ce=class{};const ut=r=>({onExit(e,t){return r.onExit(e,t)},load(){return r.load()},unload(){return r.unload()}});let gt=class extends Ce{onExit(){return()=>{}}load(){}unload(){}};class dt extends Ce{#r=be.platform==="win32"?"SIGINT":"SIGHUP";#t=new ht;#e;#i;#s;#n={};#o=!1;constructor(e){super(),this.#e=e,this.#n={};for(const t of W)this.#n[t]=()=>{const s=this.#e.listeners(t);let{count:i}=this.#t;const o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(i+=o.__signal_exit_emitter__.count),s.length===i){this.unload();const l=this.#t.emit("exit",null,t),a=t==="SIGHUP"?this.#r:t;l||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#i=e.emit}onExit(e,t){if(!re(this.#e))return()=>{};this.#o===!1&&this.load();const s=t?.alwaysLast?"afterExit":"exit";return this.#t.on(s,e),()=>{this.#t.removeListener(s,e),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#t.count+=1;for(const e of W)try{const t=this.#n[e];t&&this.#e.on(e,t)}catch{}this.#e.emit=(e,...t)=>this.#l(e,...t),this.#e.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,W.forEach(e=>{const t=this.#n[e];if(!t)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,t)}catch{}}),this.#e.emit=this.#i,this.#e.reallyExit=this.#s,this.#t.count-=1)}#a(e){return re(this.#e)?(this.#e.exitCode=e||0,this.#t.emit("exit",this.#e.exitCode,null),this.#s.call(this.#e,this.#e.exitCode)):0}#l(e,...t){const s=this.#i;if(e==="exit"&&re(this.#e)){typeof t[0]=="number"&&(this.#e.exitCode=t[0]);const i=s.call(this.#e,e,...t);return this.#t.emit("exit",this.#e.exitCode,null),i}else return s.call(this.#e,e,...t)}}const be=globalThis.process,{onExit:pt}=ut(re(be)?new dt(be):new gt),Ee=ee.stderr.isTTY?ee.stderr:ee.stdout.isTTY?ee.stdout:void 0;Ee&&Re(()=>{pt(()=>{Ee.write("\x1B[?25h")},{alwaysLast:!0})});const mt=typeof globalThis<"u"&&typeof globalThis.window=="object"&&globalThis.window.document!==void 0,bt=/^(?:msys|cygwin)$/,yt=!mt&&(process.platform==="win32"||bt.test(process.env.OSTYPE));var wt=(r=>(r[r.Default=0]="Default",r[r.BlinkingBlock=1]="BlinkingBlock",r[r.SteadyBlock=2]="SteadyBlock",r[r.BlinkingUnderline=3]="BlinkingUnderline",r[r.SteadyUnderline=4]="SteadyUnderline",r[r.BlinkingBar=5]="BlinkingBar",r[r.SteadyBar=6]="SteadyBar",r))(wt||{}),se=(r=>(r[r.ToEnd=0]="ToEnd",r[r.ToBeginning=1]="ToBeginning",r[r.EntireScreen=2]="EntireScreen",r[r.EntireScreenAndScrollback=3]="EntireScreenAndScrollback",r))(se||{});const he=r=>{const e=r>=0&&r<=3?r:0;return`${me}${e===0?"":String(e)}J`};var xt=(r=>(r[r.ToEnd=0]="ToEnd",r[r.ToBeginning=1]="ToBeginning",r[r.EntireLine=2]="EntireLine",r))(xt||{});const Me=yt?`${he(se.EntireScreen)}${me}0f`:`${he(se.EntireScreen)}${he(se.EntireScreenAndScrollback)}${me}H${et}c`;var te={exports:{}},Oe;function St(){return Oe||(Oe=1,(function(r,e){const{hasOwnProperty:t}=Object.prototype,s=R();s.configure=R,s.stringify=s,s.default=s,e.stringify=s,e.configure=R,r.exports=s;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(f){return f.length<5e3&&!i.test(f)?`"${f}"`:JSON.stringify(f)}function l(f,h){if(f.length>200||h)return f.sort(h);for(let u=1;u<f.length;u++){const I=f[u];let A=u;for(;A!==0&&f[A-1]>I;)f[A]=f[A-1],A--;f[A]=I}return f}const a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function g(f){return a.call(f)!==void 0&&f.length!==0}function m(f,h,u){f.length<u&&(u=f.length);const I=h===","?"":" ";let A=`"0":${I}${f[0]}`;for(let M=1;M<u;M++)A+=`${h}"${M}":${I}${f[M]}`;return A}function y(f){if(t.call(f,"circularValue")){const h=f.circularValue;if(typeof h=="string")return`"${h}"`;if(h==null)return h;if(h===Error||h===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function c(f){let h;if(t.call(f,"deterministic")&&(h=f.deterministic,typeof h!="boolean"&&typeof h!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return h===void 0?!0:h}function w(f,h){let u;if(t.call(f,h)&&(u=f[h],typeof u!="boolean"))throw new TypeError(`The "${h}" argument must be of type boolean`);return u===void 0?!0:u}function d(f,h){let u;if(t.call(f,h)){if(u=f[h],typeof u!="number")throw new TypeError(`The "${h}" argument must be of type number`);if(!Number.isInteger(u))throw new TypeError(`The "${h}" argument must be an integer`);if(u<1)throw new RangeError(`The "${h}" argument must be >= 1`)}return u===void 0?1/0:u}function $(f){return f===1?"1 item":`${f} items`}function D(f){const h=new Set;for(const u of f)(typeof u=="string"||typeof u=="number")&&h.add(String(u));return h}function J(f){if(t.call(f,"strict")){const h=f.strict;if(typeof h!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(h)return u=>{let I=`Object can not safely be stringified. Received type ${typeof u}`;throw typeof u!="function"&&(I+=` (${u.toString()})`),new Error(I)}}}function R(f){f={...f};const h=J(f);h&&(f.bigint===void 0&&(f.bigint=!1),"circularValue"in f||(f.circularValue=Error));const u=y(f),I=w(f,"bigint"),A=c(f),M=typeof A=="function"?A:void 0,B=d(f,"maximumDepth"),k=d(f,"maximumBreadth");function Q(N,n,p,v,x,L){let b=n[N];switch(typeof b=="object"&&b!==null&&typeof b.toJSON=="function"&&(b=b.toJSON(N)),b=v.call(n,N,b),typeof b){case"string":return o(b);case"object":{if(b===null)return"null";if(p.indexOf(b)!==-1)return u;let S="",O=",";const j=L;if(Array.isArray(b)){if(b.length===0)return"[]";if(B<p.length+1)return'"[Array]"';p.push(b),x!==""&&(L+=x,S+=`
3
+ ${L}`,O=`,
4
+ ${L}`);const C=Math.min(b.length,k);let q=0;for(;q<C-1;q++){const K=Q(String(q),b,p,v,x,L);S+=K!==void 0?K:"null",S+=O}const V=Q(String(q),b,p,v,x,L);if(S+=V!==void 0?V:"null",b.length-1>k){const K=b.length-k-1;S+=`${O}"... ${$(K)} not stringified"`}return x!==""&&(S+=`
5
+ ${j}`),p.pop(),`[${S}]`}let E=Object.keys(b);const _=E.length;if(_===0)return"{}";if(B<p.length+1)return'"[Object]"';let T="",P="";x!==""&&(L+=x,O=`,
6
+ ${L}`,T=" ");const G=Math.min(_,k);A&&!g(b)&&(E=l(E,M)),p.push(b);for(let C=0;C<G;C++){const q=E[C],V=Q(q,b,p,v,x,L);V!==void 0&&(S+=`${P}${o(q)}:${T}${V}`,P=O)}if(_>k){const C=_-k;S+=`${P}"...":${T}"${$(C)} not stringified"`,P=O}return x!==""&&P.length>1&&(S=`
7
+ ${L}${S}
8
+ ${j}`),p.pop(),`{${S}}`}case"number":return isFinite(b)?String(b):h?h(b):"null";case"boolean":return b===!0?"true":"false";case"undefined":return;case"bigint":if(I)return String(b);default:return h?h(b):void 0}}function X(N,n,p,v,x,L){switch(typeof n=="object"&&n!==null&&typeof n.toJSON=="function"&&(n=n.toJSON(N)),typeof n){case"string":return o(n);case"object":{if(n===null)return"null";if(p.indexOf(n)!==-1)return u;const b=L;let S="",O=",";if(Array.isArray(n)){if(n.length===0)return"[]";if(B<p.length+1)return'"[Array]"';p.push(n),x!==""&&(L+=x,S+=`
9
+ ${L}`,O=`,
10
+ ${L}`);const _=Math.min(n.length,k);let T=0;for(;T<_-1;T++){const G=X(String(T),n[T],p,v,x,L);S+=G!==void 0?G:"null",S+=O}const P=X(String(T),n[T],p,v,x,L);if(S+=P!==void 0?P:"null",n.length-1>k){const G=n.length-k-1;S+=`${O}"... ${$(G)} not stringified"`}return x!==""&&(S+=`
11
+ ${b}`),p.pop(),`[${S}]`}p.push(n);let j="";x!==""&&(L+=x,O=`,
12
+ ${L}`,j=" ");let E="";for(const _ of v){const T=X(_,n[_],p,v,x,L);T!==void 0&&(S+=`${E}${o(_)}:${j}${T}`,E=O)}return x!==""&&E.length>1&&(S=`
13
+ ${L}${S}
14
+ ${b}`),p.pop(),`{${S}}`}case"number":return isFinite(n)?String(n):h?h(n):"null";case"boolean":return n===!0?"true":"false";case"undefined":return;case"bigint":if(I)return String(n);default:return h?h(n):void 0}}function z(N,n,p,v,x){switch(typeof n){case"string":return o(n);case"object":{if(n===null)return"null";if(typeof n.toJSON=="function"){if(n=n.toJSON(N),typeof n!="object")return z(N,n,p,v,x);if(n===null)return"null"}if(p.indexOf(n)!==-1)return u;const L=x;if(Array.isArray(n)){if(n.length===0)return"[]";if(B<p.length+1)return'"[Array]"';p.push(n),x+=v;let T=`
15
+ ${x}`;const P=`,
16
+ ${x}`,G=Math.min(n.length,k);let C=0;for(;C<G-1;C++){const V=z(String(C),n[C],p,v,x);T+=V!==void 0?V:"null",T+=P}const q=z(String(C),n[C],p,v,x);if(T+=q!==void 0?q:"null",n.length-1>k){const V=n.length-k-1;T+=`${P}"... ${$(V)} not stringified"`}return T+=`
17
+ ${L}`,p.pop(),`[${T}]`}let b=Object.keys(n);const S=b.length;if(S===0)return"{}";if(B<p.length+1)return'"[Object]"';x+=v;const O=`,
18
+ ${x}`;let j="",E="",_=Math.min(S,k);g(n)&&(j+=m(n,O,k),b=b.slice(n.length),_-=n.length,E=O),A&&(b=l(b,M)),p.push(n);for(let T=0;T<_;T++){const P=b[T],G=z(P,n[P],p,v,x);G!==void 0&&(j+=`${E}${o(P)}: ${G}`,E=O)}if(S>k){const T=S-k;j+=`${E}"...": "${$(T)} not stringified"`,E=O}return E!==""&&(j=`
19
+ ${x}${j}
20
+ ${L}`),p.pop(),`{${j}}`}case"number":return isFinite(n)?String(n):h?h(n):"null";case"boolean":return n===!0?"true":"false";case"undefined":return;case"bigint":if(I)return String(n);default:return h?h(n):void 0}}function Y(N,n,p){switch(typeof n){case"string":return o(n);case"object":{if(n===null)return"null";if(typeof n.toJSON=="function"){if(n=n.toJSON(N),typeof n!="object")return Y(N,n,p);if(n===null)return"null"}if(p.indexOf(n)!==-1)return u;let v="";const x=n.length!==void 0;if(x&&Array.isArray(n)){if(n.length===0)return"[]";if(B<p.length+1)return'"[Array]"';p.push(n);const j=Math.min(n.length,k);let E=0;for(;E<j-1;E++){const T=Y(String(E),n[E],p);v+=T!==void 0?T:"null",v+=","}const _=Y(String(E),n[E],p);if(v+=_!==void 0?_:"null",n.length-1>k){const T=n.length-k-1;v+=`,"... ${$(T)} not stringified"`}return p.pop(),`[${v}]`}let L=Object.keys(n);const b=L.length;if(b===0)return"{}";if(B<p.length+1)return'"[Object]"';let S="",O=Math.min(b,k);x&&g(n)&&(v+=m(n,",",k),L=L.slice(n.length),O-=n.length,S=","),A&&(L=l(L,M)),p.push(n);for(let j=0;j<O;j++){const E=L[j],_=Y(E,n[E],p);_!==void 0&&(v+=`${S}${o(E)}:${_}`,S=",")}if(b>k){const j=b-k;v+=`${S}"...":"${$(j)} not stringified"`}return p.pop(),`{${v}}`}case"number":return isFinite(n)?String(n):h?h(n):"null";case"boolean":return n===!0?"true":"false";case"undefined":return;case"bigint":if(I)return String(n);default:return h?h(n):void 0}}function De(N,n,p){if(arguments.length>1){let v="";if(typeof p=="number"?v=" ".repeat(Math.min(p,10)):typeof p=="string"&&(v=p.slice(0,10)),n!=null){if(typeof n=="function")return Q("",{"":N},[],n,v,"");if(Array.isArray(n))return X("",N,[],D(n),v,"")}if(v.length!==0)return z("",N,[],v,"")}return Y("",N,[])}return De}})(te,te.exports)),te.exports}var vt=St();class $t{#r=new Map;#t;constructor(e){this.#t=e}count(e="default"){const t=this.#r.get(e)??0;this.#r.set(e,t+1),this.#t("log",!1,!1,{message:`${e}: ${String(t+1)}`,prefix:e})}countReset(e="default"){this.#r.has(e)?this.#r.delete(e):this.#t("warn",!1,!1,{message:`Count for ${e} does not exist`,prefix:e})}}const Lt=new Set(["alert","critical","emergency","error"]),Tt=r=>{const e=console;return Lt.has(r)?e.__error??console.error:r==="warning"?e.__warn??console.warn:r==="trace"?e.__trace??console.trace:e.__log??console.log};class kt{log(e){const{context:t=[],message:s,type:i}=e;Tt(i.level)(s,...t)}}class Et{#r=new Map;#t=new Set;#e;#i;#s;constructor(e,t,s){this.#s=e,this.#e=t,this.#i=s}time(e="default"){this.#t.has(e)?this.#s("warn",!1,!1,{message:`Timer '${e}' already exists`,prefix:e}):(this.#t.add(e),this.#r.set(e,Date.now()),this.#s("start",!1,!1,{message:this.#e,prefix:e}))}timeLog(e,...t){if(!e&&this.#t.size>0&&(e=[...this.#t].pop()),e&&this.#r.has(e)){const s=Date.now()-this.#r.get(e);this.#s("info",!1,!1,{context:t,message:s<1e3?`${String(s)} ms`:`${(s/1e3).toFixed(2)} s`,prefix:e})}else this.#s("warn",!1,!1,{context:t,message:"Timer not found",prefix:e})}timeEnd(e){if(!e&&this.#t.size>0&&(e=[...this.#t].pop()),e&&this.#r.has(e)){const t=Date.now()-this.#r.get(e);this.#r.delete(e),this.#s("stop",!1,!1,{message:`${this.#i} ${t<1e3?`${String(t)} ms`:`${(t/1e3).toFixed(2)} s`}`,prefix:e})}else this.#s("warn",!1,!1,{message:"Timer not found",prefix:e})}}const ye=r=>r===void 0?[]:Array.isArray(r)?r:[r],we=(r,e)=>{const t={...r};return Object.keys(e).forEach(s=>{t[s]={...t[s],...e[s]}}),t},Mt=r=>{let e=!1;return function(...t){if(!e){e=!0;try{const s=r.apply(this,t);return e=!1,s}catch(s){throw e=!1,s}}}};class Le{timerManager;counterManager;lastLog;logLevels;disabled;paused;messageQueue;scopeName;types;longestLabel;processors;generalLogLevel;reporters;throttle;throttleMin;stringify;groups;startTimerMessage;endTimerMessage;rawReporter;force={};#r=new Set;#t;#e;constructor(e){this.throttle=e.throttle??1e3,this.throttleMin=e.throttleMin??5;const t=e.parentLongestLabel,s=e.parentTypes,i=e.parentStringify,o=e.parentLogLevels;this.stringify=i??vt.configure({strict:!0}),this.startTimerMessage=e.messages?.timerStart??"Initialized timer...",this.endTimerMessage=e.messages?.timerEnd??"Timer run for:",s&&t?(this.types=s,this.longestLabel=t):(this.types=we(We,e.types??{}),this.longestLabel=ie(this.types)),this.logLevels=o&&!e.logLevels?o:{...Ue,...e.logLevels},this.generalLogLevel=this.#n(e.logLevel),this.reporters=new Set,this.processors=new Set,this.disabled=e.disabled??!1,this.paused=!1,this.messageQueue=[],this.scopeName=ye(e.scope).filter(Boolean),this.timerManager=new Et((l,a,g,...m)=>{this.logger(l,a,g,...m)},this.startTimerMessage,this.endTimerMessage),this.counterManager=new $t((l,a,g,...m)=>{this.logger(l,a,g,...m)}),this.groups=[],this.lastLog={},this.logger=Mt(this.logger.bind(this)),this.#i(),Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new kt),Array.isArray(e.processors)&&this.registerProcessors(e.processors)}#i(){for(const e in this.types)this[e]=this.logger.bind(this,e,!1,!1);for(const e in this.types)this.force[e]=this.logger.bind(this,e,!1,!0);this.raw=this.raw.bind(this)}wrapConsole(){for(const e in this.types)console[`__${e}`]||(console[`__${e}`]=console[e]),console[e]=this[e]}restoreConsole(){for(const e in this.types)console[`__${e}`]&&(console[e]=console[`__${e}`],delete console[`__${e}`])}wrapException(){this.#t||this.#e||(this.#t=e=>{this.error(e)},this.#e=e=>{this.error(e)},process.on("uncaughtException",this.#t),process.on("unhandledRejection",this.#e))}restoreException(){this.#t&&(process.off("uncaughtException",this.#t),this.#t=void 0),this.#e&&(process.off("unhandledRejection",this.#e),this.#e=void 0)}disable(){this.disabled=!0}enable(){this.disabled=!1}isEnabled(){return!this.disabled}pause(){this.paused=!0}resume(){this.paused=!1;const e=this.messageQueue.splice(0);for(let t=0;t<e.length;t+=1){const{messageObject:s,raw:i,type:o}=e[t];this.logger(o,i,!1,...s)}}scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.child({scope:e})}unscope(){this.scopeName=[]}child(e){const t=e?.types!==void 0,s=t?we(this.types,e.types):this.types,i=e?.reporters??[],o=i.length>0?[...this.reporters,...i]:[...this.reporters],l=e?.processors??[],a=l.length>0?[...this.processors,...l]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let m;if(e?.scope){const w=ye(e.scope).filter(Boolean);m=this.scopeName.length>0?[...this.scopeName,...w]:w}else m=this.scopeName.length>0?this.scopeName:[];const y=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},c={disabled:e?.disabled??this.disabled,logLevel:e?.logLevel??this.generalLogLevel,logLevels:g,messages:y,processors:a,rawReporter:e?.rawReporter??this.rawReporter,reporters:o,scope:m,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return t?(c.parentTypes=s,c.parentLongestLabel=ie(s)):(c.parentTypes=this.types,c.parentLongestLabel=this.longestLabel),e?.logLevels||(c.parentLogLevels=this.logLevels),e?.messages||(c.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),c.parentStringify=this.stringify,new Le(c)}time(e="default"){this.timerManager.time(e)}timeLog(e,...t){this.timerManager.timeLog(e,...t)}timeEnd(e){this.timerManager.timeEnd(e)}group(e="console.group"){globalThis.window===void 0?this.groups.push(e):console.group(e)}groupEnd(){globalThis.window===void 0?this.groups.pop():console.groupEnd()}count(e="default"){this.counterManager.count(e)}countReset(e="default"){this.counterManager.countReset(e)}clear(){console.clear()}raw(e,...t){this.disabled||this.logger("log",!0,!1,{context:t,message:e})}extendReporter(e){return typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),e}registerReporters(e){for(let t=0;t<e.length;t+=1)this.reporters.add(this.extendReporter(e[t]))}registerProcessors(e){for(let t=0;t<e.length;t+=1){const s=e[t];typeof s.setStringify=="function"&&s.setStringify(this.stringify),this.processors.add(s)}}#s(e,t){if(t)this.rawReporter.log(Object.freeze(e));else for(const s of this.reporters)s.log(Object.freeze(e))}#n(e){let t="debug";return e!==void 0&&Object.hasOwn(this.logLevels,e)?t=e:e!==void 0&&!this.#r.has(e)&&(this.#r.add(e),console.warn(`[pail] Unknown log level "${String(e)}". Valid levels: ${Object.keys(this.logLevels).join(", ")}. Falling back to "debug".`)),t}#o(e,t,...s){const i={badge:void 0,context:void 0,error:void 0,label:void 0,message:$e,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(i.type={level:t.logLevel,name:e},i.groups=this.groups,i.scope=this.scopeName,i.date=new Date,s.length>0&&s[0]instanceof Error)i.error=s[0],s.length>1&&(i.context=s.slice(1));else if(s.length>0&&typeof s[0]=="object"&&s[0]!==null&&"message"in s[0]){const{context:o,message:l,prefix:a,suffix:g}=s[0];if(o&&(i.context=o),a&&(i.prefix=a),g&&(i.suffix=g),i.message=l,s.length>1){const m=s.slice(1);i.context?i.context=Array.isArray(i.context)?[...i.context,...m]:[i.context,...m]:i.context=m}}else s.length>1?(i.message=s[0],i.context=s.slice(1)):s.length===1?i.message=s[0]:i.message=void 0;return t.logLevel==="trace"&&(i.traceError=new Error("Trace")),t.badge&&(i.badge=t.badge),t.label&&(i.label=t.label),i}logger(e,t,s,...i){if(this.disabled)return;if(this.paused){this.messageQueue.push({messageObject:i,raw:t,type:e});return}const o=this.types[e],l=this.#n(o.logLevel);if(s||this.logLevels[l]>=this.logLevels[this.generalLogLevel]){let a=this.#o(e,o,...i),g;try{g=JSON.stringify([a.label,a.scope,a.type,a.message,a.prefix,a.suffix,a.context])}catch{g=void 0}const m=this.processors.size>0,y=(d=!1)=>{const $=(this.lastLog.count??0)-this.throttleMin;if(this.lastLog.object&&$>0){const D={...this.lastLog.object};$>1&&(D.repeated=$),this.#s(D,t),this.lastLog.count=1}if(d){for(const D of this.processors)a=D.process(a);if(a.dropped===!0)return;if(this.lastLog.object=a,m)try{this.lastLog.signature=JSON.stringify([a.label,a.scope,a.type,a.message,a.prefix,a.suffix,a.context])}catch{this.lastLog.signature=void 0}else this.lastLog.signature=g;this.#s(a,t)}};clearTimeout(this.lastLog.timeout);const c=a.date instanceof Date?a.date:new Date(a.date),w=this.lastLog.time?c.getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=c,w<this.throttle)try{const d=g;if(this.lastLog.object&&d!==void 0&&d===this.lastLog.signature&&(this.lastLog.count=(this.lastLog.count??0)+1,this.lastLog.count>this.throttleMin)){this.lastLog.timeout=setTimeout(y,this.throttle);return}}catch{}y(!0)}}}let Ot=class{#r;#t;#e;#i=!1;#s;constructor(e={}){this.#r=Se,this.#t=ve,this.#s=e}setStdout(e){this.#r=e}setStderr(e){this.#t=e}setInteractiveManager(e){this.#e=e}setIsInteractive(e){this.#i=e}log(e){const{context:t,groups:s,message:i,type:o}=e,l=[];if(i!==$e){const y=typeof i=="string"?i:oe(i,this.#s);l.push(y)}t&&l.push(...t.map(y=>typeof y=="object"?` ${oe(y,this.#s)}`:` ${String(y)}`));const a=Ie(o.level)?"stderr":"stdout",g=a==="stderr"?this.#t:this.#r,m=s.map(()=>" ").join("");this.#i&&this.#e!==void 0&&g.isTTY?this.#e.update(a,(m+l.join("")).split(`
21
+ `),0):Ne(m+l.join(""),g)}};class Te extends Le{constructor(e){const t=e.parentStderr,s=e.parentStdout,{interactive:i,processors:o,rawReporter:l,reporters:a,stderr:g,stdout:m}=e,y=t??g,c=s??m,w=e.parentLongestLabel,d=e.parentTypes,{parentLogLevels:$,parentMessages:D,parentStringify:J}=e,R={disabled:e.disabled,logLevel:e.logLevel,logLevels:e.logLevels,messages:e.messages,processors:[],rawReporter:e.rawReporter,reporters:[],scope:e.scope,throttle:e.throttle,throttleMin:e.throttleMin},f="types"in e;d&&w&&!f?(R.parentTypes=d,R.parentLongestLabel=w):f&&e.types!==void 0&&(R.types=e.types),J&&(R.parentStringify=J),$&&!e.logLevels&&(R.parentLogLevels=$),D&&!e.messages&&(R.parentMessages=D),super(R),this.options=e,this.interactive=i??!1,this.stdout=c,this.stderr=y,this.interactive&&(this.interactiveManager=new Je(new ke(this.stdout),new ke(this.stderr))),Array.isArray(a)&&this.registerReporters(a),this.rawReporter=this.extendReporter(l??new Ot),Array.isArray(o)&&this.registerProcessors(o)}options;stdout;stderr;interactiveManager;interactive;scope(...e){if(e.length===0)throw new Error("No scope name was defined.");return this.child({scope:e})}child(e){const t=e?.types!==void 0,s=t?we(this.types,e.types):this.types,i=e?.reporters??[],o=i.length>0?[...this.reporters,...i]:[...this.reporters],l=e?.processors??[],a=l.length>0?[...this.processors,...l]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let m;if(e?.scope){const w=ye(e.scope).filter(Boolean);m=this.scopeName.length>0?[...this.scopeName,...w]:w}else m=this.scopeName.length>0?this.scopeName:[];const y=e?.messages?{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage,...e.messages}:{timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage},c={disabled:e?.disabled??this.disabled,interactive:e?.interactive??this.interactive,logLevel:e?.logLevel??this.generalLogLevel,logLevels:g,messages:y,processors:a,rawReporter:e?.rawReporter??this.rawReporter,reporters:o,scope:m,stderr:e?.stderr??this.stderr,stdout:e?.stdout??this.stdout,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return this.#r(c,e,t,s),new Te(c)}#r(e,t,s,i){s?(e.parentTypes=i,e.parentLongestLabel=ie(i)):(e.parentTypes=this.types,e.parentLongestLabel=this.longestLabel),t?.logLevels||(e.parentLogLevels=this.logLevels),t?.messages||(e.parentMessages={timerEnd:this.endTimerMessage,timerStart:this.startTimerMessage}),e.parentStringify=this.stringify,t?.stdout||(e.parentStdout=this.stdout),t?.stderr||(e.parentStderr=this.stderr)}getInteractiveManager(){return this.interactiveManager}wrapStd(){this.#t(this.stdout,"log"),this.#t(this.stderr,"error")}restoreStd(){this.#e(this.stdout),this.#e(this.stderr)}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}clear(){this.stdout.write(Me),this.stderr.write(Me)}extendReporter(e){return typeof e.setStdout=="function"&&e.setStdout(this.stdout),typeof e.setStderr=="function"&&e.setStderr(this.stderr),typeof e.setLoggerTypes=="function"&&e.setLoggerTypes(this.types),typeof e.setStringify=="function"&&e.setStringify(this.stringify),typeof e.setIsInteractive=="function"&&e.setIsInteractive(this.interactive),this.interactive&&typeof e.setInteractiveManager=="function"&&e.setInteractiveManager(this.interactiveManager),e}#t(e,t){e&&(e.__write||(e.__write=e.write),e.write=s=>{this[t](String(s).trim())})}#e(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}}const jt=Te;let ue;const At=()=>(ue!==void 0||(ue=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"]])),ue),_t=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,Bt=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,It=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,Nt=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,xe=()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),je=/\s+/,ae=r=>{const e=At();e.has(r)&&(r=e.get(r));const t=_t.exec(r);if(t)return[Number.parseInt(t[1],16),Number.parseInt(t[2],16),Number.parseInt(t[3],16)];const s=Bt.exec(r);if(s)return[Number.parseInt(`${s[1]}${s[1]}`,16),Number.parseInt(`${s[2]}${s[2]}`,16),Number.parseInt(`${s[3]}${s[3]}`,16)];const i=It.exec(r);if(i)return[Math.round(Math.max(0,Math.min(255,Number(i[1])))),Math.round(Math.max(0,Math.min(255,Number(i[2])))),Math.round(Math.max(0,Math.min(255,Number(i[3]))))];const o=Nt.exec(r);if(o){let l=Number(o[1])%360;l<0&&(l+=360);const a=Math.max(0,Math.min(100,Number(o[2])))/100,g=Math.max(0,Math.min(100,Number(o[3])))/100,m=(1-Math.abs(2*g-1))*a,y=m*(1-Math.abs(l/60%2-1)),c=g-m/2;let w,d,$;return l<60?{0:w,1:d,2:$}=[m,y,0]:l<120?{0:w,1:d,2:$}=[y,m,0]:l<180?{0:w,1:d,2:$}=[0,m,y]:l<240?{0:w,1:d,2:$}=[0,y,m]:l<300?{0:w,1:d,2:$}=[y,0,m]:{0:w,1:d,2:$}=[m,0,y],[Math.round((w+c)*255),Math.round((d+c)*255),Math.round(($+c)*255)]}return null},ge=(r,e)=>r?.[0]===e?.[0]&&r?.[1]===e?.[1]&&r?.[2]===e?.[2],Pt=r=>{if(typeof r!="string")return xe();const e=xe(),t=[];let s=!1,i=null,o=0,l="";for(const a of r){if(a==="(")o+=1;else if(o>0)a===")"&&(o-=1);else if(s){if(a===";"){const g=l.trim();g!==""&&t.push([i,g]),i=null,l="",s=!1;continue}}else if(a===":"){i=l.trim(),l="",s=!0;continue}l+=a}if(s&&o===0){const a=l.trim();a!==""&&t.push([i,a]),i=null,l=""}for(const{0:a,1:g}of t)switch(a){case"background-color":{g!=null&&(e.backgroundColor=g);break}case"color":{g!=null&&(e.color=g);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(g)&&(e.fontStyle="italic");break}case"font-weight":{g==="bold"&&(e.fontWeight=g);break}case"text-decoration":{e.textDecorationColor=null,e.textDecorationLine=[];const m=g.split(je);for(const y of m){const c=ae(y);c!=null?e.textDecorationColor=c:["line-through","overline","underline"].includes(y)&&e.textDecorationLine.push(y)}break}case"text-decoration-color":{const m=ae(g);m!=null&&(e.textDecorationColor=m);break}case"text-decoration-line":{e.textDecorationLine=[];const m=g.split(je);for(const y of m)["line-through","overline","underline"].includes(y)&&e.textDecorationLine.push(y);break}}return e},Rt=(r,e)=>{e=e??xe();let t="";if(!ge(r.backgroundColor,e.backgroundColor))if(r.backgroundColor==null)t+="\x1B[49m";else switch(r.backgroundColor){case"black":{t+="\x1B[40m";break}case"blue":{t+="\x1B[44m";break}case"cyan":{t+="\x1B[46m";break}case"green":{t+="\x1B[42m";break}case"magenta":{t+="\x1B[45m";break}case"red":{t+="\x1B[41m";break}case"white":{t+="\x1B[47m";break}case"yellow":{t+="\x1B[43m";break}default:if(Array.isArray(r.backgroundColor)){const{0:s,1:i,2:o}=r.backgroundColor;t+=`\x1B[48;2;${String(s)};${String(i)};${String(o)}m`}else{const s=ae(r.backgroundColor);if(s===null)t+="\x1B[49m";else{const{0:i,1:o,2:l}=s;t+=`\x1B[48;2;${String(i)};${String(o)};${String(l)}m`}}}if(!ge(r.color,e.color))if(r.color==null)t+="\x1B[39m";else switch(r.color){case"black":{t+="\x1B[30m";break}case"blue":{t+="\x1B[34m";break}case"cyan":{t+="\x1B[36m";break}case"green":{t+="\x1B[32m";break}case"magenta":{t+="\x1B[35m";break}case"red":{t+="\x1B[31m";break}case"white":{t+="\x1B[37m";break}case"yellow":{t+="\x1B[33m";break}default:if(Array.isArray(r.color)){const{0:s,1:i,2:o}=r.color;t+=`\x1B[38;2;${String(s)};${String(i)};${String(o)}m`}else{const s=ae(r.color);if(s===null)t+="\x1B[39m";else{const{0:i,1:o,2:l}=s;t+=`\x1B[38;2;${String(i)};${String(o)};${String(l)}m`}}}if(r.fontWeight!==e.fontWeight&&(t+=r.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),r.fontStyle!==e.fontStyle&&(t+=r.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!ge(r.textDecorationColor,e.textDecorationColor))if(r.textDecorationColor==null)t+="\x1B[59m";else{const{0:s,1:i,2:o}=r.textDecorationColor;t+=`\x1B[58;2;${String(s)};${String(i)};${String(o)}m`}return r.textDecorationLine.includes("line-through")!==e.textDecorationLine.includes("line-through")&&(t+=r.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),r.textDecorationLine.includes("overline")!==e.textDecorationLine.includes("overline")&&(t+=r.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),r.textDecorationLine.includes("underline")!==e.textDecorationLine.includes("underline")&&(t+=r.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),t},Ct=r=>{try{return JSON.stringify(r)}catch{return'"[Circular]"'}},Ae="%".codePointAt(0),Dt="s".codePointAt(0),Gt="d".codePointAt(0),Ft="f".codePointAt(0),qt="i".codePointAt(0),Vt="O".codePointAt(0),Jt="o".codePointAt(0),Ut="j".codePointAt(0),Wt="c".codePointAt(0),_e=(r,e=[],t={})=>{if(typeof r!="string"&&typeof r!="object"||r===null)throw new TypeError(`fmt must be a string or object, got ${r===null?"null":typeof r}`);const s=t.stringify??Ct,i=1;if(typeof r=="object"){const c=e.length+i;if(c===1)return"{}";const w=Array.from({length:c});w[0]=s(r);for(let d=1;d<c;d+=1)w[d]=s(e[d-i]);return w.join(" ")}if(e.length===0)return r;let o="",l=1-i,a=-1,g=!1,m;const y=t.colors??globalThis.window===void 0;for(let c=0;c<r.length;){if(r.codePointAt(c)===Ae&&c+1<r.length){a=a>-1?a:0;const w=r.codePointAt(c+1);switch(w){case Wt:{if(y){const d=Pt(e[l]);a<c&&(o+=r.slice(a,c));const $=Rt(d,m);o+=$,$!==""&&(g=!0,m=d)}a=c+2,c+=1;break}case Gt:case Ft:{const d=e[l];if(l>=e.length||d==null)break;a<c&&(o+=r.slice(a,c)),o+=(typeof d=="symbol"?Number.NaN:Number(d)).toString(),a=c+2,c+=1;break}case qt:{const d=e[l];if(l>=e.length||d==null)break;a<c&&(o+=r.slice(a,c)),o+=Math.floor(typeof d=="symbol"?Number.NaN:Number(d)).toString(),a=c+2,c+=1;break}case Ut:case Vt:case Jt:{if(l>=e.length||e[l]===void 0)break;a<c&&(o+=r.slice(a,c));const d=e[l],$=typeof d;if($==="string"){o+=`'${d}'`,a=c+2,c+=1;break}if($==="function"){o+=d.name?`[Function: ${d.name}]`:"[Function: <anonymous>]",a=c+2,c+=1;break}o+=s(d),a=c+2,c+=1;break}case Ae:{a<c&&(o+=r.slice(a,c)),o+="%",a=c+2,c+=1,l-=1;break}case Dt:{if(l>=e.length)break;a<c&&(o+=r.slice(a,c));const d=e[l];o+=typeof d=="object"&&d!==null?s(d):String(d),a=c+2,c+=1;break}default:typeof t.formatters?.[w]=="function"?(a<c&&(o+=r.slice(a,c)),o+=t.formatters[w](e[l]),a=c+2,c+=1):l-=1}l+=1}c+=1}if(a===-1&&!(t.appendExtraArguments&&l<e.length))return r;if(a===-1?o=r:a<r.length&&(o+=r.slice(a)),a!==-1&&g&&(o+="\x1B[0m"),t.appendExtraArguments&&l<e.length)for(let c=Math.max(l,0);c<e.length;c+=1){const w=e[c];o+=` ${typeof w=="object"&&w!==null?s(w):String(w)}`}return o},zt=(r={})=>{const e={};typeof r.formatters=="object"&&Object.entries(r.formatters).forEach(([s,i])=>{if(s.length===0)throw new Error(`Formatter %${s} has no characters`);if(s.length>1)throw new Error(`Formatter %${s} has more than one character`);if(typeof i!="function")throw new TypeError(`Formatter for %${s} is not a function`);const o=s.codePointAt(0);if(o===void 0)throw new Error(`${s}.codePointAt(0) failed to return a value, please report this issue`);e[o]=i});const t=Object.freeze({formatters:e});return(s,i=[],o)=>o===void 0?_e(s,i,t):_e(s,i,{...o,formatters:e})};class Yt{#r;#t;#e;constructor(e={}){this.#t=e.formatters}setStringify(e){this.#r=e}process(e){this.#e===void 0&&(this.#e=zt({formatters:this.#t}));const t=this.#e;return e.message!==void 0&&(e.message=this.#i(t,e.message,e.context??[])),e}#i(e,t,s=[]){if(typeof t=="string")return e(t,s);if(typeof t=="object"&&t!==null){const i=t,o=Object.keys(i);for(let l=0;l<o.length;l+=1){const a=o[l],g=i[a];(typeof g=="string"||Array.isArray(g)||typeof g=="object")&&(i[a]=this.#i(e,g,s))}}return t}}const{bgGrey:Ht,cyan:Qt,green:Xt,greenBright:Kt,grey:F,red:de,underline:Be,white:Zt}=Pe,er=/[\\/]pail[\\/]dist/,pe=r=>!er.test(r);class tr extends ze{#r;#t;#e;#i=!1;#s;#n;#o;#a=!1;#l="";#c="";constructor(e={}){const{error:t,inspect:s,...i}=e;super({uppercase:{label:!0,...i.uppercase},...i}),this.#s={...Ye,...s},this.#n={...t,color:{fileLine:Xt,hint:Qt,marker:de,message:de,method:Kt,title:de}},this.#r=Se,this.#t=ve,this.#f()}setLoggerTypes(e){super.setLoggerTypes(e),this.#f()}setStdout(e){this.#r=e,this.#o=void 0,this.#a=!1}setStderr(e){this.#t=e}setInteractiveManager(e){this.#e=e}setIsInteractive(e){this.#i=e}log(e){this._log(this._formatMessage(e),e.type.level)}#f(){this.#l=He(this.loggerTypes),this.#c=ie(this.loggerTypes)}#h(){return!this.#a&&typeof this.#r.on=="function"&&(this.#a=!0,this.#r.on("resize",()=>{this.#o=void 0})),this.#o===void 0&&(this.#o=Qe().columns),this.#o}_formatMessage(e){let t=this.#h();typeof this.styles.messageLength=="number"&&(t=this.styles.messageLength);const{badge:s,context:i,date:o,error:l,file:a,groups:g,label:m,message:y,prefix:c,repeated:w,scope:d,suffix:$,traceError:D,type:J}=e,{color:R}=this.loggerTypes[J.name],f=R?Pe[R]:Zt,h=g.map(()=>" ").join(""),u=[];if(g.length>0&&u.push(`${h+F(`[${g.at(-1)??""}]`)} `),o&&u.push(`${F(this.styles.dateFormatter(typeof o=="string"?new Date(o):o))} `),s)u.push(f(s));else{const M=this.#l;M.length>0&&u.push(`${F(".".repeat(M.length))} `)}const I=this.#c;if(m){const M=Z(I),B=Z(m);u.push(`${f(Xe(m,this.styles))} `,F(".".repeat(Math.max(0,M-B))))}else u.push(F(".".repeat(I.length+2)));w&&u.push(`${Ht.white(`[${String(w)}x]`)} `),Array.isArray(d)&&d.length>0&&u.push(` ${F(`[${d.join(" > ")}]`)} `),c&&u.push(`${F(`${Array.isArray(d)&&d.length>0?". ":" "}[${this.styles.underline.prefix?Be(c):c}]`)} `);const A=Z(u.join(" "));if(a){const M=(a.name??"")+(a.line?`:${String(a.line)}`:""),B=Z(M);if(B+A+2>t)u.push(F(` ${M}`));else{const k=Math.max(0,t-A-B-2);u.push(F(`${".".repeat(k)} ${M}`))}}else u.push(F(".".repeat(Math.max(0,t-A-1))));if(u.length>0&&u.push(`
21
22
 
22
- `),p!==we){const T=typeof p=="string"?p:ce(p,this.#i);c.push(f+tt(T,{trim:!1,width:s-3,wrapMode:rt.STRICT_WIDTH}))}if(a){let T=!1;c.push(...a.map(P=>{if(P instanceof Error)return T=!0,`
23
+ `),y!==$e){const M=typeof y=="string"?y:oe(y,this.#s);u.push(h+Ke(M,{trim:!1,width:t-3,wrapMode:Ze.STRICT_WIDTH}))}if(i){let M=!1;u.push(...i.map(B=>{if(B instanceof Error)return M=!0,`
23
24
 
24
- ${ge(P,{...this.#o,filterStacktrace:pe,prefix:f})}`;if(typeof P=="object")return` ${ce(P,this.#i)}`;const J=(T?`
25
+ ${le(B,{...this.#n,filterStacktrace:pe,prefix:h})}`;if(typeof B=="object")return` ${oe(B,this.#s)}`;const k=(M?`
25
26
 
26
- `:" ")+String(P);return T=!1,J}))}return n&&c.push(ge(n,{...this.#o,filterStacktrace:pe,prefix:f})),R&&c.push(`
27
+ `:" ")+String(B);return M=!1,k}))}return l&&u.push(le(l,{...this.#n,filterStacktrace:pe,prefix:h})),D&&u.push(`
27
28
 
28
- ${ge(R,{...this.#o,filterStacktrace:pe,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:f})}`),z&&c.push(`
29
- `,f+G(this.styles.underline.suffix?_e(z):z)),c.join("")}_log(e,r){const s=["error","trace","warn"].includes(r)?"stderr":"stdout",i=s==="stderr"?this.#t:this.#r;this.#s&&this.#e!==void 0&&i.isTTY?this.#e.update(s,e.split(`
30
- `),0):De(`${e}
31
- `,i)}}var Or=Object.defineProperty,Ve=m((t,e)=>Or(t,"name",{value:e,configurable:!0}),"o");const Er=Ve(()=>se.NODE_ENV==="debug"||se.DEBUG!==void 0?"debug":se.NODE_ENV==="test"?"warning":"informational","getDefaultLogLevel"),jr=Ve(t=>{let e=Er();return se.PAIL_LOG_LEVEL!==void 0&&(e=se.PAIL_LOG_LEVEL),new Yt({logLevel:e,processors:[new $r],reporters:[new Mr],stderr:Se,stdout:ve,...t})},"createPail"),Ir=jr();export{Jr as PailError,jr as createPail,Vr as createPailError,Ir as pail};
29
+ ${le(D,{...this.#n,filterStacktrace:pe,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:h})}`),$&&u.push(`
30
+ `,h+F(this.styles.underline.suffix?Be($):$)),u.join("")}_log(e,t){const s=Ie(t)?"stderr":"stdout",i=s==="stderr"?this.#t:this.#r;this.#i&&this.#e!==void 0&&i.isTTY?this.#e.update(s,e.split(`
31
+ `),0):Ne(`${e}
32
+ `,i)}}const rr=()=>H.NODE_ENV==="debug"||H.DEBUG!==void 0?"debug":H.NODE_ENV==="test"?"warning":"informational",sr=r=>{let e=rr();return H.PAIL_LOG_LEVEL!==void 0&&(e=H.PAIL_LOG_LEVEL),new jt({logLevel:e,processors:[new Yt],reporters:[new tr],stderr:ve,stdout:Se,...r})},ur=sr();export{pr as PailError,sr as createPail,mr as createPailError,ur as pail};
@@ -1,7 +1,8 @@
1
- import { W as WideEvent } from "../packem_shared/wide-event.d-gb2-ks5w.js";
2
- import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-CR3o6VDh.js";
3
- import 'safe-stable-stringify';
4
- import "../packem_shared/types.d-BeLumqgD.js";
1
+ import { W as WideEvent } from "../packem_shared/wide-event.d-D3ATYpoK.js";
2
+ import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-B-JmQ1Sl.js";
3
+ import "../packem_shared/index.d-T71KjNAr.js";
4
+ import 'type-fest';
5
+ import "../packem_shared/types.d-bWnqHJKL.js";
5
6
  import '@visulima/colorize';
6
7
  import '@visulima/interactive-manager';
7
8
  /**
@@ -1 +1 @@
1
- var f=Object.defineProperty;var g=(e,t)=>f(e,"name",{value:t,configurable:!0});import{createRequire as h}from"node:module";import{a as b,c as q}from"../packem_shared/headers-S8WyX-2m.js";const m=h(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=g(e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[t,a]=i.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return i.getBuiltinModule(e)}return m(e)},"__cjs_getBuiltinModule"),{AsyncLocalStorage:y}=_("node:async_hooks");var w=Object.defineProperty,c=g((e,t)=>w(e,"name",{value:t,configurable:!0}),"d");const u=new y,d=new WeakSet,L=c(()=>{const e=u.getStore();if(!e||!d.has(e))throw new Error("[pail] useLogger() called outside of Elysia pail plugin context.");return e},"useLogger"),S=c((e,t)=>{const a=new WeakMap,l=new WeakSet;return e.derive({as:"global"},({request:r})=>{const o=new URL(r.url),s=r.headers.get("x-request-id")??crypto.randomUUID(),p=b(r.headers),n=q(t,{headers:p,method:r.method,path:o.pathname,requestId:s});return a.set(r,n),n.skipped||(d.add(n.logger),u.enterWith(n.logger)),{log:n.logger}}).onAfterHandle({as:"global"},async({request:r,set:o})=>{const s=a.get(r);!s?.skipped&&s&&!l.has(r)&&(l.add(r),s.finish({status:o.status??200}),d.delete(s.logger))}).onError({as:"global"},async({error:r,request:o})=>{const s=a.get(o);!s?.skipped&&s&&!l.has(o)&&(l.add(o),s.finish({error:r}),d.delete(s.logger))})},"pailPlugin");export{S as pailPlugin,L as useLogger};
1
+ import{createRequire as u}from"node:module";import{e as m,c as _}from"../packem_shared/headers-DH0H2s8W.js";const p=u(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=s=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[a,o]=i.versions.node.split(".").map(Number);if(a>22||a===22&&o>=3||a===20&&o>=16)return i.getBuiltinModule(s)}return p(s)},{AsyncLocalStorage:f}=h("node:async_hooks"),g=new f,d=new WeakSet,w=()=>{const s=g.getStore();if(!s||!d.has(s))throw new Error("[pail] useLogger() called outside of Elysia pail plugin context.");return s},b=(s,a)=>{const o=new WeakMap,l=new WeakSet;return s.derive({as:"global"},({request:e})=>{const t=new URL(e.url),r=e.headers.get("x-request-id")??crypto.randomUUID(),c=m(e.headers),n=_(a,{headers:c,method:e.method,path:t.pathname,requestId:r});return o.set(e,n),n.skipped||(d.add(n.logger),g.enterWith(n.logger)),{log:n.logger}}).onAfterHandle({as:"global"},async({request:e,set:t})=>{const r=o.get(e);!r?.skipped&&r&&!l.has(e)&&(l.add(e),r.finish({status:t.status??200}),d.delete(r.logger))}).onError({as:"global"},async({error:e,request:t})=>{const r=o.get(t);!r?.skipped&&r&&!l.has(t)&&(l.add(t),r.finish({error:e}),d.delete(r.logger))})};export{b as pailPlugin,w as useLogger};
@@ -1,7 +1,8 @@
1
- import { W as WideEvent } from "../packem_shared/wide-event.d-gb2-ks5w.js";
2
- import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-CR3o6VDh.js";
3
- import 'safe-stable-stringify';
4
- import "../packem_shared/types.d-BeLumqgD.js";
1
+ import { W as WideEvent } from "../packem_shared/wide-event.d-D3ATYpoK.js";
2
+ import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-B-JmQ1Sl.js";
3
+ import "../packem_shared/index.d-T71KjNAr.js";
4
+ import 'type-fest';
5
+ import "../packem_shared/types.d-bWnqHJKL.js";
5
6
  import '@visulima/colorize';
6
7
  import '@visulima/interactive-manager';
7
8
  /**
@@ -1 +1 @@
1
- var c=Object.defineProperty;var t=(r,e)=>c(r,"name",{value:e,configurable:!0});import{e as m,c as f}from"../packem_shared/headers-S8WyX-2m.js";import{c as h}from"../packem_shared/storage-DHM1EP2P.js";var w=Object.defineProperty,d=t((r,e)=>w(r,"name",{value:e,configurable:!0}),"i");const i=h("Express middleware context. Make sure pail middleware is registered before your route handlers."),b=d(()=>i.useLogger(),"useLogger"),v=d(r=>(e,a,o)=>{const g=e.headers["x-request-id"]??crypto.randomUUID(),l=e.originalUrl??e.url??"/",u=m(e.headers),{finish:n,logger:s,skipped:p}=f(r,{headers:u,method:e.method,path:l,requestId:g});if(p){o();return}e.log=s,a.on("finish",()=>{n({status:a.statusCode})}),i.storage.run(s,()=>{o()})},"pailMiddleware");export{v as pailMiddleware,b as useLogger};
1
+ import{a as u,c as p}from"../packem_shared/headers-DH0H2s8W.js";import{c}from"../packem_shared/storage-DaXAlpiO.js";const o=c("Express middleware context. Make sure pail middleware is registered before your route handlers."),f=()=>o.useLogger(),x=t=>(e,r,s)=>{const d=e.headers["x-request-id"]??crypto.randomUUID(),i=e.originalUrl??e.url??"/",g=u(e.headers),{finish:l,logger:a,skipped:n}=p(t,{headers:g,method:e.method,path:i,requestId:d});if(n){s();return}e.log=a,r.on("finish",()=>{l({status:r.statusCode})}),o.storage.run(a,()=>{s()})};export{x as pailMiddleware,f as useLogger};
@@ -1,7 +1,8 @@
1
- import { W as WideEvent } from "../packem_shared/wide-event.d-gb2-ks5w.js";
2
- import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-CR3o6VDh.js";
3
- import 'safe-stable-stringify';
4
- import "../packem_shared/types.d-BeLumqgD.js";
1
+ import { W as WideEvent } from "../packem_shared/wide-event.d-D3ATYpoK.js";
2
+ import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-B-JmQ1Sl.js";
3
+ import "../packem_shared/index.d-T71KjNAr.js";
4
+ import 'type-fest';
5
+ import "../packem_shared/types.d-bWnqHJKL.js";
5
6
  import '@visulima/colorize';
6
7
  import '@visulima/interactive-manager';
7
8
  /**
@@ -1 +1 @@
1
- var h=Object.defineProperty;var g=(r,a)=>h(r,"name",{value:a,configurable:!0});import{e as m,c as k}from"../packem_shared/headers-S8WyX-2m.js";import{c as y}from"../packem_shared/storage-DHM1EP2P.js";var L=Object.defineProperty,u=g((r,a)=>L(r,"name",{value:a,configurable:!0}),"d");const c=y("Fastify middleware context. Make sure pail plugin is registered before your route handlers."),b=u(()=>c.useLogger(),"useLogger"),q=u((r,a)=>{const n=new WeakMap,s=new WeakSet;r.addHook("onRequest",(e,d,o)=>{const t=e.headers["x-request-id"]??crypto.randomUUID(),l=m(e.headers),{finish:p,logger:i,skipped:f}=k(a,{headers:l,method:e.method,path:e.url,requestId:t});if(f){o();return}e.log=i,n.set(e,{finish:p}),c.storage.run(i,()=>{o()})}),r.addHook("onResponse",async(e,d)=>{const o=n.get(e);!o||s.has(e)||(s.add(e),o.finish({status:d.statusCode}))}),r.addHook("onError",async(e,d,o)=>{const t=n.get(e);!t||s.has(e)||(s.add(e),t.finish({error:o}))})},"pailPlugin");export{q as pailPlugin,b as useLogger};
1
+ import{a as p,c as f}from"../packem_shared/headers-DH0H2s8W.js";import{c as l}from"../packem_shared/storage-DaXAlpiO.js";const i=l("Fastify middleware context. Make sure pail plugin is registered before your route handlers."),y=()=>i.useLogger(),w=(o,g)=>{const t=new WeakMap,s=new WeakSet;o.addHook("onRequest",(e,d,r)=>{const a=e.headers["x-request-id"]??crypto.randomUUID(),c=p(e.headers),{finish:u,logger:n,skipped:h}=f(g,{headers:c,method:e.method,path:e.url,requestId:a});if(h){r();return}e.log=n,t.set(e,{finish:u}),i.storage.run(n,()=>{r()})}),o.addHook("onResponse",async(e,d)=>{const r=t.get(e);!r||s.has(e)||(s.add(e),r.finish({status:d.statusCode}))}),o.addHook("onError",async(e,d,r)=>{const a=t.get(e);!a||s.has(e)||(s.add(e),a.finish({error:r}))})};export{w as pailPlugin,y as useLogger};
@@ -1,7 +1,8 @@
1
- import { W as WideEvent } from "../packem_shared/wide-event.d-gb2-ks5w.js";
2
- import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-CR3o6VDh.js";
3
- import 'safe-stable-stringify';
4
- import "../packem_shared/types.d-BeLumqgD.js";
1
+ import { W as WideEvent } from "../packem_shared/wide-event.d-D3ATYpoK.js";
2
+ import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-B-JmQ1Sl.js";
3
+ import "../packem_shared/index.d-T71KjNAr.js";
4
+ import 'type-fest';
5
+ import "../packem_shared/types.d-bWnqHJKL.js";
5
6
  import '@visulima/colorize';
6
7
  import '@visulima/interactive-manager';
7
8
  /**
@@ -1 +1 @@
1
- var c=Object.defineProperty;var s=(r,e)=>c(r,"name",{value:e,configurable:!0});import{a as u,c as p}from"../packem_shared/headers-S8WyX-2m.js";var h=Object.defineProperty,d=s((r,e)=>h(r,"name",{value:e,configurable:!0}),"o");const m=d(r=>{const e=r.get("log");if(!e)throw new Error("[pail] useLogger() called but pail middleware is not registered.");return e},"useLogger"),q=d(r=>async(e,t)=>{const i=e.req.header("x-request-id")??crypto.randomUUID(),n=u(e.req.raw.headers),{finish:o,logger:g,skipped:l}=p(r,{headers:n,method:e.req.method,path:e.req.path,requestId:i});if(l){await t();return}e.set("log",g);try{await t(),o({status:e.res.status})}catch(a){throw o({error:a instanceof Error?a:new Error(String(a))}),a}},"pailMiddleware");export{q as pailMiddleware,m as useLogger};
1
+ import{e as c,c as g}from"../packem_shared/headers-DH0H2s8W.js";const l=t=>{const r=t.get("log");if(!r)throw new Error("[pail] useLogger() called but pail middleware is not registered.");return r},p=t=>async(r,a)=>{const o=r.req.header("x-request-id")??crypto.randomUUID(),i=c(r.req.raw.headers),{finish:s,logger:d,skipped:n}=g(t,{headers:i,method:r.req.method,path:r.req.path,requestId:o});if(n){await a();return}r.set("log",d);try{await a(),s({status:r.res.status})}catch(e){throw s({error:e instanceof Error?e:new Error(String(e))}),e}};export{p as pailMiddleware,l as useLogger};
@@ -1,10 +1,11 @@
1
- import { P as PailMiddlewareOptions } from "../../packem_shared/create-middleware-logger.d-CR3o6VDh.js";
2
- import { W as WideEvent } from "../../packem_shared/wide-event.d-gb2-ks5w.js";
1
+ import { P as PailMiddlewareOptions } from "../../packem_shared/create-middleware-logger.d-B-JmQ1Sl.js";
2
+ import { W as WideEvent } from "../../packem_shared/wide-event.d-D3ATYpoK.js";
3
3
  import 'node:async_hooks';
4
- import "../../packem_shared/types.d-BeLumqgD.js";
4
+ import "../../packem_shared/types.d-bWnqHJKL.js";
5
5
  import '@visulima/colorize';
6
6
  import '@visulima/interactive-manager';
7
- import 'safe-stable-stringify';
7
+ import 'type-fest';
8
+ import "../../packem_shared/index.d-T71KjNAr.js";
8
9
  /**
9
10
  * Minimal type definitions to avoid requiring next as a dependency.
10
11
  */
@@ -1 +1 @@
1
- var g=Object.defineProperty;var f=(a,r)=>g(a,"name",{value:r,configurable:!0});import{a as w,c as x}from"../../packem_shared/headers-S8WyX-2m.js";import{pailStorage as y}from"../../packem_shared/useLogger-qyZrjy4D.js";import{useLogger as W}from"../../packem_shared/useLogger-qyZrjy4D.js";import{pailMiddleware as E}from"../../packem_shared/pailMiddleware-CWOJRmJq.js";var U=Object.defineProperty,q=f((a,r)=>U(a,"name",{value:r,configurable:!0}),"l");const P=q(a=>r=>async(...o)=>{const[n]=o,h=n instanceof Request;let i="UNKNOWN",c="/",d=crypto.randomUUID(),u={};if(h){const e=n,t=new URL(e.url);i=e.method,c=t.pathname,u=w(e.headers);const s=e.headers.get("x-request-id");s&&(d=s)}const{finish:p,logger:l,skipped:m}=x(a,{headers:u,method:i,path:c,requestId:d});if(m)return r(...o);try{const e=await y.run(l,()=>r(...o)),t=e instanceof Response?e.status:200;return p({status:t}),e}catch(e){const t=e instanceof Error?e:new Error(String(e)),s=t.status??t.statusCode??500;throw p({error:t,status:s}),e}},"createWithPail");export{P as createWithPail,E as pailMiddleware,W as useLogger};
1
+ import{e as m,c as l}from"../../packem_shared/headers-DH0H2s8W.js";import{pailStorage as w}from"../../packem_shared/useLogger-DB34CuU5.js";import{useLogger as N}from"../../packem_shared/useLogger-DB34CuU5.js";import{pailMiddleware as S}from"../../packem_shared/pailMiddleware-B5DJoBYl.js";const q=u=>s=>async(...a)=>{const[o]=a,f=o instanceof Request;let n="UNKNOWN",i="/",c=crypto.randomUUID(),d={};if(f){const e=o,t=new URL(e.url);n=e.method,i=t.pathname,d=m(e.headers);const r=e.headers.get("x-request-id");r&&(c=r)}const{finish:p,logger:h,skipped:g}=l(u,{headers:d,method:n,path:i,requestId:c});if(g)return s(...a);try{const e=await w.run(h,()=>s(...a)),t=e instanceof Response?e.status:200;return p({status:t}),e}catch(e){const t=e instanceof Error?e:new Error(String(e)),r=t.status??t.statusCode??500;throw p({error:t,status:r}),e}};export{q as createWithPail,S as pailMiddleware,N as useLogger};
@@ -1,7 +1,8 @@
1
- import { W as WideEvent } from "../packem_shared/wide-event.d-gb2-ks5w.js";
2
- import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-CR3o6VDh.js";
3
- import 'safe-stable-stringify';
4
- import "../packem_shared/types.d-BeLumqgD.js";
1
+ import { W as WideEvent } from "../packem_shared/wide-event.d-D3ATYpoK.js";
2
+ import { P as PailMiddlewareOptions } from "../packem_shared/create-middleware-logger.d-B-JmQ1Sl.js";
3
+ import "../packem_shared/index.d-T71KjNAr.js";
4
+ import 'type-fest';
5
+ import "../packem_shared/types.d-bWnqHJKL.js";
5
6
  import '@visulima/colorize';
6
7
  import '@visulima/interactive-manager';
7
8
  /**
@@ -1 +1 @@
1
- var u=Object.defineProperty;var l=(r,e)=>u(r,"name",{value:e,configurable:!0});import{a as h,c as p}from"../packem_shared/headers-S8WyX-2m.js";import{c as m}from"../packem_shared/storage-DHM1EP2P.js";var v=Object.defineProperty,t=l((r,e)=>v(r,"name",{value:e,configurable:!0}),"n");const d=m("SvelteKit handle hook context. Make sure pailHandle is added to your hooks.server.ts."),q=t(()=>d.useLogger(),"useLogger"),f=t(r=>async({event:e,resolve:o})=>{const c=e.request.headers.get("x-request-id")??crypto.randomUUID(),i=h(e.request.headers),{finish:s,logger:n,skipped:g}=p(r,{headers:i,method:e.request.method,path:e.url.pathname,requestId:c});return g?o(e):(e.locals.log=n,d.storage.run(n,async()=>{try{const a=await o(e);return s({status:a.status}),a}catch(a){throw s({error:a instanceof Error?a:new Error(String(a))}),a}}))},"pailHandle"),H=t(()=>({error:r,event:e})=>{const o=e.locals.log;o&&r instanceof Error&&o.error(r.message,r)},"pailHandleError"),L=t(r=>({handle:f(r),handleError:H()}),"createPailHooks");export{L as createPailHooks,f as pailHandle,H as pailHandleError,q as useLogger};
1
+ import{e as g,c as i}from"../packem_shared/headers-DH0H2s8W.js";import{c as u}from"../packem_shared/storage-DaXAlpiO.js";const n=u("SvelteKit handle hook context. Make sure pailHandle is added to your hooks.server.ts."),k=()=>n.useLogger(),h=r=>async({event:e,resolve:a})=>{const d=e.request.headers.get("x-request-id")??crypto.randomUUID(),l=g(e.request.headers),{finish:t,logger:s,skipped:c}=i(r,{headers:l,method:e.request.method,path:e.url.pathname,requestId:d});return c?a(e):(e.locals.log=s,n.storage.run(s,async()=>{try{const o=await a(e);return t({status:o.status}),o}catch(o){throw t({error:o instanceof Error?o:new Error(String(o))}),o}}))},p=()=>({error:r,event:e})=>{const a=e.locals.log;a&&r instanceof Error&&a.error(r.message,r)},q=r=>({handle:h(r),handleError:p()});export{q as createPailHooks,h as pailHandle,p as pailHandleError,k as useLogger};
@@ -1,2 +1,2 @@
1
- var O=Object.defineProperty;var y=(o,r)=>O(o,"name",{value:r,configurable:!0});var m=Object.defineProperty,u=y((o,r)=>m(o,"name",{value:r,configurable:!0}),"s");const j=u(o=>{const r={breakCircularWith:" (circular ref.)",joined:!0,keyNeighbour:"├─ ",keyNoNeighbour:"└─ ",renderFn:u(e=>{if(["boolean","number","string"].includes(typeof e))return String(e)},"renderFn"),separator:": ",sortFn:void 0,spacerNeighbour:"│ ",spacerNoNeighbour:" ",...o};if(typeof r.joined!="boolean")throw new TypeError('Option "joined" must be a boolean');if(typeof r.spacerNoNeighbour!="string")throw new TypeError('Option "spacerNoNeighbour" must be a string');if(typeof r.spacerNeighbour!="string")throw new TypeError('Option "spacerNeighbour" must be a string');if(typeof r.keyNoNeighbour!="string")throw new TypeError('Option "keyNoNeighbour" must be a string');if(typeof r.keyNeighbour!="string")throw new TypeError('Option "keyNeighbour" must be a string');if(typeof r.separator!="string")throw new TypeError('Option "separator" must be a string');if(typeof r.renderFn!="function")throw new TypeError('Option "renderFn" must be a function');if(r.sortFn!==void 0&&typeof r.sortFn!="function")throw new TypeError('Option "sortFn" must be a function or undefined');if(r.breakCircularWith!==null&&typeof r.breakCircularWith!="string")throw new TypeError('Option "breakCircularWith" must be a string or null');return r},"buildContext"),T=u((o,r)=>{const e=j(r),s=[],g=e.renderFn(o);g!==void 0&&s.push(g);const c=u(t=>e.sortFn===void 0?t:t.toSorted((n,a)=>e.sortFn?.(a,n)??0),"sort"),p=[],i=c(Object.keys(o)).map(t=>[t]),h=[o];for(;i.length>0;){const t=i.pop()??[],n=h[t.length-1][t.at(-1)??""],a=e.breakCircularWith!==null&&h.slice(0,t.length).includes(n);p[t.length-1]=i.length>0&&(i.at(-1)?.length??0)===t.length;const f=p.slice(0,t.length-1).map(b=>b?e.spacerNeighbour:e.spacerNoNeighbour).join(""),d=p[t.length-1]?e.keyNeighbour:e.keyNoNeighbour,N=t.at(-1)??"",l=e.renderFn(n),w=l===void 0?"":`${e.separator}${l}`,k=a?e.breakCircularWith??"":"";s.push(`${f}${d}${N}${w}${k}`),n!==null&&typeof n=="object"&&!Array.isArray(n)&&!a&&(i.push(...c(Object.keys(n)).map(b=>[...t,b])),h[t.length]=n)}return e.joined?s.join(`
2
- `):s},"renderObjectTree");export{T as default,T as renderObjectTree};
1
+ const w=n=>{const o={breakCircularWith:" (circular ref.)",joined:!0,keyNeighbour:"├─ ",keyNoNeighbour:"└─ ",renderFn:r=>{if(["boolean","number","string"].includes(typeof r))return String(r)},separator:": ",sortFn:void 0,spacerNeighbour:"│ ",spacerNoNeighbour:" ",...n};if(typeof o.joined!="boolean")throw new TypeError('Option "joined" must be a boolean');if(typeof o.spacerNoNeighbour!="string")throw new TypeError('Option "spacerNoNeighbour" must be a string');if(typeof o.spacerNeighbour!="string")throw new TypeError('Option "spacerNeighbour" must be a string');if(typeof o.keyNoNeighbour!="string")throw new TypeError('Option "keyNoNeighbour" must be a string');if(typeof o.keyNeighbour!="string")throw new TypeError('Option "keyNeighbour" must be a string');if(typeof o.separator!="string")throw new TypeError('Option "separator" must be a string');if(typeof o.renderFn!="function")throw new TypeError('Option "renderFn" must be a function');if(o.sortFn!==void 0&&typeof o.sortFn!="function")throw new TypeError('Option "sortFn" must be a function or undefined');if(o.breakCircularWith!==null&&typeof o.breakCircularWith!="string")throw new TypeError('Option "breakCircularWith" must be a string or null');return o},k=(n,o)=>{const r=w(o),s=[],b=r.renderFn(n);b!==void 0&&s.push(b);const g=e=>r.sortFn===void 0?e:e.toSorted((t,u)=>r.sortFn?.(u,t)??0),a=[],i=g(Object.keys(n)).map(e=>[e]),p=[n];for(;i.length>0;){const e=i.pop()??[],t=p[e.length-1][e.at(-1)??""],u=r.breakCircularWith!==null&&p.slice(0,e.length).includes(t);a[e.length-1]=i.length>0&&(i.at(-1)?.length??0)===e.length;const l=a.slice(0,e.length-1).map(h=>h?r.spacerNeighbour:r.spacerNoNeighbour).join(""),y=a[e.length-1]?r.keyNeighbour:r.keyNoNeighbour,f=e.at(-1)??"",c=r.renderFn(t),N=c===void 0?"":`${r.separator}${c}`,d=u?r.breakCircularWith??"":"";s.push(`${l}${y}${f}${N}${d}`),t!==null&&typeof t=="object"&&!Array.isArray(t)&&!u&&(i.push(...g(Object.keys(t)).map(h=>[...e,h])),p[e.length]=t)}return r.joined?s.join(`
2
+ `):s};export{k as default,k as renderObjectTree};
@@ -0,0 +1 @@
1
+ import{createRequire as E}from"node:module";import{E as O}from"./constants-DKfCaSUR.js";const S=E(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=e=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[r,t]=c.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return c.getBuiltinModule(e)}return S(e)},{createRequire:h}=w("node:module"),T=h(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=e=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[r,t]=f.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return f.getBuiltinModule(e)}return T(e)};N("node:util");const P=h(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=e=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[r,t]=p.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return p.getBuiltinModule(e)}return P(e)};d("node:fs");d("node:path");d("node:url");const _=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&_.set("AggregateError",AggregateError);const x=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}}),A=e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},y=new WeakSet,j=e=>{const r=Object.getOwnPropertyNames(e);for(const t of r){const o=Object.getOwnPropertyDescriptor(e,t);o&&(o.enumerable||Object.defineProperty(e,t,{...o,enumerable:!0}),o.value&&typeof o.value=="object"&&!Array.isArray(o.value)&&(Object.getPrototypeOf(o.value)===Object.prototype||Object.getPrototypeOf(o.value)===null)&&j(o.value))}},I=e=>{y.add(e);const r=e.toJSON();return y.delete(e),Object.isExtensible(r)&&j(r),r},a=(e,r,t,o,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]":(t+=1,m(e,o,r,t));if(o.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 s=[];for(const[u,i]of e.entries())s.push([a(u,r,t,o,n),a(i,r,t,o,n)]);return{__dataType:"Map",value:s}}if(e instanceof Set){const s=[];for(const u of e.values())s.push(a(u,r,t,o,n));return{__dataType:"Set",value:s}}if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${String(e)}n`;if(A(e)){if(n.has(e))return"[Circular]";if(o.maxDepth!==void 0&&o.maxDepth!==Number.POSITIVE_INFINITY&&t+1>=o.maxDepth)return{};t+=1,n.add(e);const s={};for(const u in e)s[u]=a(e[u],r,t,o,n);return n.delete(e),s}try{return e}catch{return"[Not Available]"}},m=(e,r,t,o)=>{if(t.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!y.has(e))return I(e);const n=Object.create(x);if(Object.defineProperty(n,"name",{configurable:!0,enumerable:!0,value:Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,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 u=[];for(const i of e.errors){if(!(i instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(t.has(i))return Object.defineProperty(n,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),n;u.push(m(i,r,t,o))}Object.defineProperty(n,"errors",{configurable:!0,enumerable:!0,value:u,writable:!0})}const s=e.cause;if(s!=null)if(s instanceof Error)t.has(s)?Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:m(s,r,t,o),writable:!0});else{const u=a(s,t,o,r);Object.defineProperty(n,"cause",{configurable:!0,enumerable:!0,value:u,writable:!0})}for(const u in e){if(u==="name"||u==="message"||u==="stack"||u==="cause"||u==="errors")continue;const i=e[u],l=a(i,t,o,r);Object.defineProperty(n,u,{configurable:!0,enumerable:!0,value:l,writable:!0})}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const u of r.exclude)try{delete n[u]}catch{}return n},v=(e,r={})=>m(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0);class M{stringify;errorOptions;constructor(r={}){this.errorOptions=r.error??{}}setStringify(r){this.stringify=r}log(r){const{context:t,error:o,file:n,message:s,type:u,...i}=r;if(i.label&&(i.label=i.label.trim()),n&&(i.file=`${n.name??""}:${String(n.line)}${n.column?`:${String(n.column)}`:""}`),i.message=s===O?void 0:s,o&&(i.error=v(o,this.errorOptions)),t){const l=[];for(let g=0;g<t.length;g+=1){const b=t[g];b!==O&&(b instanceof Error?l.push(v(b,this.errorOptions)):l.push(b))}i.context=l}this._log(this.stringify(i),u.level)}}export{M as AbstractJsonReporter};
@@ -0,0 +1 @@
1
+ import"./addKnownErrorConstructor-C1OJTj2D-f9no2VNI.js";import{O as g}from"./serializeError-C-NFvZ8_-D0CA_Qlx.js";import{E as p}from"./constants-ep2nsfdy.js";class u{stringify;errorOptions;constructor(t={}){this.errorOptions=t.error??{}}setStringify(t){this.stringify=t}log(t){const{context:i,error:l,file:o,message:c,type:a,...r}=t;if(r.label&&(r.label=r.label.trim()),o&&(r.file=`${o.name??""}:${String(o.line)}${o.column?`:${String(o.column)}`:""}`),r.message=c===p?void 0:c,l&&(r.error=g(l,this.errorOptions)),i){const s=[];for(let n=0;n<i.length;n+=1){const e=i[n];e!==p&&(e instanceof Error?s.push(g(e,this.errorOptions)):s.push(e))}r.context=s}this._log(this.stringify(r),a.level)}}export{u as AbstractJsonReporter};
@@ -0,0 +1,2 @@
1
+ import{createRequire as r}from"node:module";import{r as a,a as p}from"./write-stream-C7jxLxIT.js";import{AbstractJsonReporter as d}from"./AbstractJsonReporter-C6iu_u9-.js";const l=r(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:i,stderr:c}=o;class f extends d{#s;#t;constructor(s={}){super(s),this.#s=i,this.#t=c}setStdout(s){this.#s=s}setStderr(s){this.#t=s}_log(s,t){const e=a(t)?this.#t:this.#s;p(`${s}
2
+ `,e)}}export{f as default};
@@ -0,0 +1 @@
1
+ import{t as o}from"./write-console-log-based-on-level-BqjxV016.js";import{AbstractJsonReporter as s}from"./AbstractJsonReporter-Bp_JCrMQ.js";class c extends s{constructor(r={}){super(r)}_log(r,t){o(t)(r)}}export{c as default};
@@ -0,0 +1,5 @@
1
+ class e extends Error{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 a=i=>new e(i);export{e as PailError,a as createPailError};