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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +371 -0
  2. package/LICENSE.md +148 -879
  3. package/README.md +323 -0
  4. package/dist/error.d.ts +103 -0
  5. package/dist/error.js +5 -0
  6. package/dist/index.browser.d.ts +557 -45
  7. package/dist/index.browser.js +19 -12
  8. package/dist/index.server.d.ts +724 -63
  9. package/dist/index.server.js +27 -529
  10. package/dist/middleware/elysia.d.ts +73 -0
  11. package/dist/middleware/elysia.js +1 -0
  12. package/dist/middleware/express.d.ts +88 -0
  13. package/dist/middleware/express.js +1 -0
  14. package/dist/middleware/fastify.d.ts +83 -0
  15. package/dist/middleware/fastify.js +1 -0
  16. package/dist/middleware/hono.d.ts +87 -0
  17. package/dist/middleware/hono.js +1 -0
  18. package/dist/middleware/next/handler.d.ts +103 -0
  19. package/dist/middleware/next/handler.js +1 -0
  20. package/dist/middleware/sveltekit.d.ts +125 -0
  21. package/dist/middleware/sveltekit.js +1 -0
  22. package/dist/object-tree.d.ts +67 -70
  23. package/dist/object-tree.js +2 -89
  24. package/dist/packem_shared/AbstractJsonReporter-CF0KKdQS.js +1 -0
  25. package/dist/packem_shared/AbstractJsonReporter-CVwjgboT.js +1 -0
  26. package/dist/packem_shared/JsonReporter-BJFnahby.js +1 -0
  27. package/dist/packem_shared/JsonReporter-CnLM-d0U.js +2 -0
  28. package/dist/packem_shared/PrettyReporter-D75CJT0C.js +5 -0
  29. package/dist/packem_shared/PrettyReporter-D9aBMmxI.js +45 -0
  30. package/dist/packem_shared/abstract-json-reporter.d-Boj5w068.d.ts +61 -0
  31. package/dist/packem_shared/abstract-pretty-reporter-zijeSUgy.js +34 -0
  32. package/dist/packem_shared/constants-DKfCaSUR.js +1 -0
  33. package/dist/packem_shared/constants-ep2nsfdy.js +1 -0
  34. package/dist/packem_shared/create-middleware-logger.d-MK7moe4r.d.ts +47 -0
  35. package/dist/packem_shared/createPailError-CbU1Ogfa.js +5 -0
  36. package/dist/packem_shared/headers-D-K_EnkH.js +1 -0
  37. package/dist/packem_shared/index-COQEZODZ.js +1 -0
  38. package/dist/packem_shared/pailMiddleware-B5DJoBYl.js +1 -0
  39. package/dist/packem_shared/storage-DaXAlpiO.js +1 -0
  40. package/dist/packem_shared/types.d-Ck_RSjLg.d.ts +246 -0
  41. package/dist/packem_shared/types.d-Cz9S7jZh.d.ts +201 -0
  42. package/dist/packem_shared/types.d-xxE3FOD3.d.ts +229 -0
  43. package/dist/packem_shared/useLogger-DB34CuU5.js +1 -0
  44. package/dist/packem_shared/wide-event.d-DkYD7YVK.d.ts +705 -0
  45. package/dist/packem_shared/write-console-log-based-on-level-DDSKGBKj.js +1 -0
  46. package/dist/packem_shared/write-stream-B6BXco86.js +1 -0
  47. package/dist/processor/caller/caller-processor.d.ts +49 -47
  48. package/dist/processor/caller/caller-processor.js +1 -59
  49. package/dist/processor/environment-processor.d.ts +124 -0
  50. package/dist/processor/environment-processor.js +1 -0
  51. package/dist/processor/message-formatter-processor.d.ts +51 -50
  52. package/dist/processor/message-formatter-processor.js +1 -66
  53. package/dist/processor/opentelemetry-processor.d.ts +69 -66
  54. package/dist/processor/opentelemetry-processor.js +1 -52
  55. package/dist/processor/redact-processor.d.ts +60 -41
  56. package/dist/processor/redact-processor.js +1 -30
  57. package/dist/processor/sampling-processor.d.ts +112 -0
  58. package/dist/processor/sampling-processor.js +1 -0
  59. package/dist/reporter/file/json-file-reporter.d.ts +91 -42
  60. package/dist/reporter/file/json-file-reporter.js +2 -136
  61. package/dist/reporter/http/abstract-http-reporter.d.ts +213 -211
  62. package/dist/reporter/http/abstract-http-reporter.js +2 -435
  63. package/dist/reporter/http/http-reporter.d.ts +40 -36
  64. package/dist/reporter/http/http-reporter.edge-light.d.ts +430 -38
  65. package/dist/reporter/http/http-reporter.edge-light.js +2 -651
  66. package/dist/reporter/http/http-reporter.js +1 -13
  67. package/dist/reporter/json/index.browser.d.ts +98 -3
  68. package/dist/reporter/json/index.browser.js +1 -2
  69. package/dist/reporter/json/index.d.ts +51 -3
  70. package/dist/reporter/json/index.js +1 -2
  71. package/dist/reporter/pretty/index.browser.d.ts +105 -2
  72. package/dist/reporter/pretty/index.browser.js +1 -1
  73. package/dist/reporter/pretty/index.d.ts +183 -2
  74. package/dist/reporter/pretty/index.js +1 -1
  75. package/dist/reporter/simple/simple-reporter.server.d.ts +133 -18
  76. package/dist/reporter/simple/simple-reporter.server.js +8 -186
  77. package/dist/wide-event.d.ts +5 -0
  78. package/dist/wide-event.js +1 -0
  79. package/package.json +87 -37
  80. package/dist/constants.d.ts +0 -37
  81. package/dist/interactive/index.d.ts +0 -2
  82. package/dist/interactive/index.js +0 -2
  83. package/dist/interactive/interactive-manager.d.ts +0 -108
  84. package/dist/interactive/interactive-stream-hook.d.ts +0 -68
  85. package/dist/packem_shared/AbstractJsonReporter-BaZ33PlE.js +0 -204
  86. package/dist/packem_shared/InteractiveManager-CbE7d1kY.js +0 -172
  87. package/dist/packem_shared/InteractiveStreamHook-DiSubbJ1.js +0 -21
  88. package/dist/packem_shared/JsonReporter-BRw4skd5.js +0 -28
  89. package/dist/packem_shared/JsonReporter-VzgyLEYz.js +0 -58
  90. package/dist/packem_shared/PrettyReporter-C2wVB7yu.js +0 -222
  91. package/dist/packem_shared/PrettyReporter-DySIXBjQ.js +0 -169
  92. package/dist/packem_shared/abstract-pretty-reporter-Di_sdm2r.js +0 -50
  93. package/dist/packem_shared/constants-omsTHUWB.js +0 -119
  94. package/dist/packem_shared/format-label-De49vNPd.js +0 -1193
  95. package/dist/packem_shared/get-longest-label-C9PWeyKq.js +0 -9
  96. package/dist/packem_shared/index-BomQ3E6J.js +0 -650
  97. package/dist/packem_shared/index-EZ_WSQZS.js +0 -1146
  98. package/dist/packem_shared/interactive-stream-hook-DG4BtN12.js +0 -141
  99. package/dist/packem_shared/pail.browser-u2CSR_af.js +0 -1427
  100. package/dist/packem_shared/write-console-log-based-on-level-DBmRYXpj.js +0 -14
  101. package/dist/packem_shared/write-stream-BG8fhcs3.js +0 -6
  102. package/dist/pail.browser.d.ts +0 -412
  103. package/dist/pail.server.d.ts +0 -233
  104. package/dist/processor/caller/get-caller-filename.d.ts +0 -23
  105. package/dist/progress-bar.d.ts +0 -136
  106. package/dist/progress-bar.js +0 -404
  107. package/dist/reporter/file/utils/rotating-file-stream.d.ts +0 -48
  108. package/dist/reporter/http/utils/compression.d.ts +0 -7
  109. package/dist/reporter/http/utils/log-size-error.d.ts +0 -30
  110. package/dist/reporter/http/utils/retry.d.ts +0 -27
  111. package/dist/reporter/json/abstract-json-reporter.d.ts +0 -61
  112. package/dist/reporter/json/json-reporter.browser.d.ts +0 -40
  113. package/dist/reporter/json/json-reporter.server.d.ts +0 -50
  114. package/dist/reporter/pretty/abstract-pretty-reporter.d.ts +0 -83
  115. package/dist/reporter/pretty/pretty-reporter.browser.d.ts +0 -36
  116. package/dist/reporter/pretty/pretty-reporter.server.d.ts +0 -70
  117. package/dist/reporter/raw/raw-reporter.browser.d.ts +0 -5
  118. package/dist/reporter/raw/raw-reporter.server.d.ts +0 -13
  119. package/dist/reporter/utils/default-inspector-config.d.ts +0 -3
  120. package/dist/reporter/utils/format-label.d.ts +0 -3
  121. package/dist/spinner.d.ts +0 -220
  122. package/dist/spinner.js +0 -2150
  123. package/dist/types.d.ts +0 -241
  124. package/dist/utils/ansi-escapes.d.ts +0 -4
  125. package/dist/utils/arrayify.d.ts +0 -2
  126. package/dist/utils/get-longest-badge.d.ts +0 -4
  127. package/dist/utils/get-longest-label.d.ts +0 -4
  128. package/dist/utils/merge-types.d.ts +0 -4
  129. package/dist/utils/stream/safe-stream-handler.d.ts +0 -21
  130. package/dist/utils/write-console-log-based-on-level.d.ts +0 -4
  131. package/dist/utils/write-stream.d.ts +0 -2
@@ -1,533 +1,31 @@
1
- import { createRequire as __cjs_createRequire } from "node:module";
1
+ import{createRequire as De}from"node:module";import{InteractiveManager as Ce,InteractiveStreamHook as we}from"@visulima/interactive-manager";import{g as ie,E as Ie,a as be,L as Re,h as oe,r as Ae,A as qe,b as Fe,c as Je,d as Ve,e as re,f as Ge,U as He,_ as le,i as Ue}from"./packem_shared/abstract-pretty-reporter-zijeSUgy.js";import Be from"@visulima/colorize";import{PailError as or,createPailError as nr}from"./packem_shared/createPailError-CbU1Ogfa.js";const Xt=De(import.meta.url),Pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:pe,stderr:me,env:K}=Pe,ze="\x1B",M="\x1B[",je=";";var We=Object.defineProperty,Ye=(t,e)=>We(t,"name",{value:e,configurable:!0});const Qe=typeof globalThis<"u"&&typeof globalThis.window=="object"&&globalThis.window.document!==void 0,Xe=/^(?:msys|cygwin)$/,Ke=!Qe&&(process.platform==="win32"||Xe.test(process.env.OSTYPE));var Ze=Object.defineProperty,P=Ye((t,e)=>Ze(t,"name",{value:e,configurable:!0}),"n");const et=P((t=1)=>`${M}${String(t)}D`,"cursorBackward");P((t=1)=>`${M}${String(t)}B`,"cursorDown");P((t=1)=>`${M}${String(t)}C`,"cursorForward");const tt=`${M}G`;P((t=1)=>et(t),"cursorLeft");const rt=P((t=1)=>`${M}${String(t)}G`,"cursorHorizontalAbsolute");P((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");P((t=1)=>`${M}${String(t)}E`,"cursorNextLine");P((t=1)=>`${M}${String(t)}F`,"cursorPreviousLine");const st=P((t,e)=>e===void 0?rt(t+1):`${M}${String(e+1)}${je}${String(t+1)}H`,"cursorTo");P((t,e)=>e===void 0?`${M}${String(t)}H`:`${M}${String(t)}${je}${String(e)}H`,"cursorPosition");P((t=1)=>`${M}${String(t)}I`,"cursorHorizontalForwardTab");P((t=1)=>`${M}${String(t)}Z`,"cursorBackwardTab");P((t=1)=>`${M}${String(t)}X`,"eraseCharacter");P((t=1)=>`${M}${String(t)}d`,"cursorVerticalAbsolute");const it=P((t=1)=>`${M}${String(t)}A`,"cursorUp");var ot=(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))(ot||{});P(t=>`${M}${String(t)} q`,"setCursorStyle");var nt=Object.defineProperty,at=(t,e)=>nt(t,"name",{value:e,configurable:!0}),lt=Object.defineProperty,ye=at((t,e)=>lt(t,"name",{value:e,configurable:!0}),"o"),Y=(t=>(t[t.ToEnd=0]="ToEnd",t[t.ToBeginning=1]="ToBeginning",t[t.EntireScreen=2]="EntireScreen",t[t.EntireScreenAndScrollback=3]="EntireScreenAndScrollback",t))(Y||{});const H=ye(t=>{const e=t>=0&&t<=3?t:0;return`${M}${e===0?"":String(e)}J`},"eraseDisplay");var Oe=(t=>(t[t.ToEnd=0]="ToEnd",t[t.ToBeginning=1]="ToBeginning",t[t.EntireLine=2]="EntireLine",t))(Oe||{});const ae=ye(t=>{const e=t>=0&&t<=2?t:0;return`${M}${e===0?"":String(e)}K`},"eraseInLine");H(0);const ct=ae(2);ae(0);ae(1);ye(t=>{if(t<=0)return"";let e="";for(let r=0;r<t;r+=1)e+=ct,r<t-1&&(e+=it());return e+=tt,e},"eraseLines");H(2);H(1);H(3);st(0,0)+H(Y.ToEnd);`${ae(Oe.EntireLine)}${M}`;`${M}${H(Y.EntireScreen)}`;const xe=Ke?`${H(Y.EntireScreen)}${M}0f`:`${H(Y.EntireScreen)}${H(Y.EntireScreenAndScrollback)}${M}H${ze}c`;function ft(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var se={exports:{}},Le;function ut(){return Le||(Le=1,(function(t,e){const{hasOwnProperty:r}=Object.prototype,s=R();s.configure=R,s.stringify=s,s.default=s,e.stringify=s,e.configure=R,t.exports=s;const o=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function a(f){return f.length<5e3&&!o.test(f)?`"${f}"`:JSON.stringify(f)}function c(f,u){if(f.length>200||u)return f.sort(u);for(let y=1;y<f.length;y++){const $=f[y];let _=y;for(;_!==0&&f[_-1]>$;)f[_]=f[_-1],_--;f[_]=$}return f}const n=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function g(f){return n.call(f)!==void 0&&f.length!==0}function b(f,u,y){f.length<y&&(y=f.length);const $=u===","?"":" ";let _=`"0":${$}${f[0]}`;for(let q=1;q<y;q++)_+=`${u}"${q}":${$}${f[q]}`;return _}function l(f){if(r.call(f,"circularValue")){const u=f.circularValue;if(typeof u=="string")return`"${u}"`;if(u==null)return u;if(u===Error||u===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 p(f){let u;if(r.call(f,"deterministic")&&(u=f.deterministic,typeof u!="boolean"&&typeof u!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return u===void 0?!0:u}function d(f,u){let y;if(r.call(f,u)&&(y=f[u],typeof y!="boolean"))throw new TypeError(`The "${u}" argument must be of type boolean`);return y===void 0?!0:y}function E(f,u){let y;if(r.call(f,u)){if(y=f[u],typeof y!="number")throw new TypeError(`The "${u}" argument must be of type number`);if(!Number.isInteger(y))throw new TypeError(`The "${u}" argument must be an integer`);if(y<1)throw new RangeError(`The "${u}" argument must be >= 1`)}return y===void 0?1/0:y}function N(f){return f===1?"1 item":`${f} items`}function U(f){const u=new Set;for(const y of f)(typeof y=="string"||typeof y=="number")&&u.add(String(y));return u}function W(f){if(r.call(f,"strict")){const u=f.strict;if(typeof u!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(u)return y=>{let $=`Object can not safely be stringified. Received type ${typeof y}`;throw typeof y!="function"&&($+=` (${y.toString()})`),new Error($)}}}function R(f){f={...f};const u=W(f);u&&(f.bigint===void 0&&(f.bigint=!1),"circularValue"in f||(f.circularValue=Error));const y=l(f),$=d(f,"bigint"),_=p(f),q=typeof _=="function"?_:void 0,A=E(f,"maximumDepth"),S=E(f,"maximumBreadth");function z(D,i,h,x,v,L){let m=i[D];switch(typeof m=="object"&&m!==null&&typeof m.toJSON=="function"&&(m=m.toJSON(D)),m=x.call(i,D,m),typeof m){case"string":return a(m);case"object":{if(m===null)return"null";if(h.indexOf(m)!==-1)return y;let w="",B=",";const j=L;if(Array.isArray(m)){if(m.length===0)return"[]";if(A<h.length+1)return'"[Array]"';h.push(m),v!==""&&(L+=v,w+=`
2
+ ${L}`,B=`,
3
+ ${L}`);const I=Math.min(m.length,S);let V=0;for(;V<I-1;V++){const te=z(String(V),m,h,x,v,L);w+=te!==void 0?te:"null",w+=B}const G=z(String(V),m,h,x,v,L);if(w+=G!==void 0?G:"null",m.length-1>S){const te=m.length-S-1;w+=`${B}"... ${N(te)} not stringified"`}return v!==""&&(w+=`
4
+ ${j}`),h.pop(),`[${w}]`}let k=Object.keys(m);const O=k.length;if(O===0)return"{}";if(A<h.length+1)return'"[Object]"';let T="",C="";v!==""&&(L+=v,B=`,
5
+ ${L}`,T=" ");const F=Math.min(O,S);_&&!g(m)&&(k=c(k,q)),h.push(m);for(let I=0;I<F;I++){const V=k[I],G=z(V,m,h,x,v,L);G!==void 0&&(w+=`${C}${a(V)}:${T}${G}`,C=B)}if(O>S){const I=O-S;w+=`${C}"...":${T}"${N(I)} not stringified"`,C=B}return v!==""&&C.length>1&&(w=`
6
+ ${L}${w}
7
+ ${j}`),h.pop(),`{${w}}`}case"number":return isFinite(m)?String(m):u?u(m):"null";case"boolean":return m===!0?"true":"false";case"undefined":return;case"bigint":if($)return String(m);default:return u?u(m):void 0}}function ee(D,i,h,x,v,L){switch(typeof i=="object"&&i!==null&&typeof i.toJSON=="function"&&(i=i.toJSON(D)),typeof i){case"string":return a(i);case"object":{if(i===null)return"null";if(h.indexOf(i)!==-1)return y;const m=L;let w="",B=",";if(Array.isArray(i)){if(i.length===0)return"[]";if(A<h.length+1)return'"[Array]"';h.push(i),v!==""&&(L+=v,w+=`
8
+ ${L}`,B=`,
9
+ ${L}`);const O=Math.min(i.length,S);let T=0;for(;T<O-1;T++){const F=ee(String(T),i[T],h,x,v,L);w+=F!==void 0?F:"null",w+=B}const C=ee(String(T),i[T],h,x,v,L);if(w+=C!==void 0?C:"null",i.length-1>S){const F=i.length-S-1;w+=`${B}"... ${N(F)} not stringified"`}return v!==""&&(w+=`
10
+ ${m}`),h.pop(),`[${w}]`}h.push(i);let j="";v!==""&&(L+=v,B=`,
11
+ ${L}`,j=" ");let k="";for(const O of x){const T=ee(O,i[O],h,x,v,L);T!==void 0&&(w+=`${k}${a(O)}:${j}${T}`,k=B)}return v!==""&&k.length>1&&(w=`
12
+ ${L}${w}
13
+ ${m}`),h.pop(),`{${w}}`}case"number":return isFinite(i)?String(i):u?u(i):"null";case"boolean":return i===!0?"true":"false";case"undefined":return;case"bigint":if($)return String(i);default:return u?u(i):void 0}}function Q(D,i,h,x,v){switch(typeof i){case"string":return a(i);case"object":{if(i===null)return"null";if(typeof i.toJSON=="function"){if(i=i.toJSON(D),typeof i!="object")return Q(D,i,h,x,v);if(i===null)return"null"}if(h.indexOf(i)!==-1)return y;const L=v;if(Array.isArray(i)){if(i.length===0)return"[]";if(A<h.length+1)return'"[Array]"';h.push(i),v+=x;let T=`
14
+ ${v}`;const C=`,
15
+ ${v}`,F=Math.min(i.length,S);let I=0;for(;I<F-1;I++){const G=Q(String(I),i[I],h,x,v);T+=G!==void 0?G:"null",T+=C}const V=Q(String(I),i[I],h,x,v);if(T+=V!==void 0?V:"null",i.length-1>S){const G=i.length-S-1;T+=`${C}"... ${N(G)} not stringified"`}return T+=`
16
+ ${L}`,h.pop(),`[${T}]`}let m=Object.keys(i);const w=m.length;if(w===0)return"{}";if(A<h.length+1)return'"[Object]"';v+=x;const B=`,
17
+ ${v}`;let j="",k="",O=Math.min(w,S);g(i)&&(j+=b(i,B,S),m=m.slice(i.length),O-=i.length,k=B),_&&(m=c(m,q)),h.push(i);for(let T=0;T<O;T++){const C=m[T],F=Q(C,i[C],h,x,v);F!==void 0&&(j+=`${k}${a(C)}: ${F}`,k=B)}if(w>S){const T=w-S;j+=`${k}"...": "${N(T)} not stringified"`,k=B}return k!==""&&(j=`
18
+ ${v}${j}
19
+ ${L}`),h.pop(),`{${j}}`}case"number":return isFinite(i)?String(i):u?u(i):"null";case"boolean":return i===!0?"true":"false";case"undefined":return;case"bigint":if($)return String(i);default:return u?u(i):void 0}}function X(D,i,h){switch(typeof i){case"string":return a(i);case"object":{if(i===null)return"null";if(typeof i.toJSON=="function"){if(i=i.toJSON(D),typeof i!="object")return X(D,i,h);if(i===null)return"null"}if(h.indexOf(i)!==-1)return y;let x="";const v=i.length!==void 0;if(v&&Array.isArray(i)){if(i.length===0)return"[]";if(A<h.length+1)return'"[Array]"';h.push(i);const j=Math.min(i.length,S);let k=0;for(;k<j-1;k++){const T=X(String(k),i[k],h);x+=T!==void 0?T:"null",x+=","}const O=X(String(k),i[k],h);if(x+=O!==void 0?O:"null",i.length-1>S){const T=i.length-S-1;x+=`,"... ${N(T)} not stringified"`}return h.pop(),`[${x}]`}let L=Object.keys(i);const m=L.length;if(m===0)return"{}";if(A<h.length+1)return'"[Object]"';let w="",B=Math.min(m,S);v&&g(i)&&(x+=b(i,",",S),L=L.slice(i.length),B-=i.length,w=","),_&&(L=c(L,q)),h.push(i);for(let j=0;j<B;j++){const k=L[j],O=X(k,i[k],h);O!==void 0&&(x+=`${w}${a(k)}:${O}`,w=",")}if(m>S){const j=m-S;x+=`${w}"...":"${N(j)} not stringified"`}return h.pop(),`{${x}}`}case"number":return isFinite(i)?String(i):u?u(i):"null";case"boolean":return i===!0?"true":"false";case"undefined":return;case"bigint":if($)return String(i);default:return u?u(i):void 0}}function Ne(D,i,h){if(arguments.length>1){let x="";if(typeof h=="number"?x=" ".repeat(Math.min(h,10)):typeof h=="string"&&(x=h.slice(0,10)),i!=null){if(typeof i=="function")return z("",{"":D},[],i,x,"");if(Array.isArray(i))return ee("",D,[],U(i),x,"")}if(x.length!==0)return Q("",D,[],x,"")}return X("",D,[])}return Ne}})(se,se.exports)),se.exports}var gt=ut();const ht=ft(gt),dt=ht.configure,pt=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};class mt{log(e){const{context:r=[],message:s,type:o}=e;pt(o.level)(s,...r)}}const ge=t=>t===void 0?[]:Array.isArray(t)?t:[t],he=(t,e)=>{const r={...t};return Object.keys(e).forEach(s=>{r[s]={...r[s],...e[s]}}),r},bt=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}}}};class $e{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,o=e.parentStringify,a=e.parentLogLevels;this.stringify=o??dt({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=he(Re,e.types??{}),this.longestLabel=ie(this.types)),this.logLevels=a&&!e.logLevels?a:{...Ie,...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=ge(e.scope).filter(Boolean),this.timersMap=new Map,this.countMap=new Map,this.groups=[],this.seqTimers=new Set,this.lastLog={},this.logger=bt(this.logger.bind(this)),this.#r(),Array.isArray(e.reporters)&&this.registerReporters(e.reporters),this.rawReporter=this.extendReporter(e.rawReporter??new mt),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:o,type:a}=e[r];this.logger(a,o,!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?he(this.types,e.types):this.types,o=e?.reporters??[],a=o.length>0?[...this.reporters,...o]:[...this.reporters],c=e?.processors??[],n=c.length>0?[...this.processors,...c]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let b;if(e?.scope){const d=ge(e.scope).filter(Boolean);b=this.scopeName.length>0?[...this.scopeName,...d]:d}else b=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:b,throttle:e?.throttle??this.throttle,throttleMin:e?.throttleMin??this.throttleMin};return r?(p.parentTypes=s,p.parentLongestLabel=ie(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 $e(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 o={badge:void 0,context:void 0,error:void 0,label:void 0,message:be,prefix:void 0,repeated:void 0,scope:void 0,suffix:void 0};if(o.type={level:r.logLevel,name:e},o.groups=this.groups,o.scope=this.scopeName,o.date=new Date,s.length>0&&s[0]instanceof Error)o.error=s[0],s.length>1&&(o.context=s.slice(1));else if(s.length>0&&typeof s[0]=="object"&&s[0]!==null&&"message"in s[0]){const{context:a,message:c,prefix:n,suffix:g}=s[0];if(a&&(o.context=a),n&&(o.prefix=n),g&&(o.suffix=g),o.message=c,s.length>1){const b=s.slice(1);o.context?o.context=Array.isArray(o.context)?[...o.context,...b]:[o.context,...b]:o.context=b}}else s.length>1?(o.message=s[0],o.context=s.slice(1)):s.length===1?o.message=s[0]:o.message=void 0;return r.logLevel==="trace"&&(o.traceError=new Error("Trace")),r.badge&&(o.badge=r.badge),r.label&&(o.label=r.label),o}logger(e,r,s,...o){if(this.disabled)return;if(this.paused){this.messageQueue.push({messageObject:o,raw:r,type:e});return}const a=this.types[e],c=this.#e(a.logLevel);if(s||this.logLevels[c]>=this.logLevels[this.generalLogLevel]){let n=this.#s(e,a,...o);const g=(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)}};clearTimeout(this.lastLog.timeout);const b=this.lastLog.time&&n.date?new Date(n.date).getTime()-this.lastLog.time.getTime():0;if(this.lastLog.time=new Date(n.date),b<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)}}}let yt=class{#r;#t;#e;#s=!1;#i;constructor(e={}){this.#r=pe,this.#t=me,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:o,type:a}=e,c=[];if(o!==be){const l=typeof o=="string"?o:oe(o,this.#i);c.push(l)}r&&c.push(...r.map(l=>typeof l=="object"?` ${oe(l,this.#i)}`:` ${String(l)}`));const n=["error","trace","warn"].includes(a.level)?"stderr":"stdout",g=n==="stderr"?this.#t:this.#r,b=s.map(()=>" ").join("");this.#s&&this.#e!==void 0&&g.isTTY?this.#e.update(n,(b+c.join("")).split(`
20
+ `),0):Ae(b+c.join(""),g)}};class Se extends $e{constructor(e){const r=e.parentStderr,s=e.parentStdout,{interactive:o,processors:a,rawReporter:c,reporters:n,stderr:g,stdout:b}=e,l=r??g,p=s??b,d=e.parentLongestLabel,E=e.parentTypes,{parentLogLevels:N,parentMessages:U,parentStringify:W}=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;E&&d&&!f?(R.parentTypes=E,R.parentLongestLabel=d):f&&e.types!==void 0&&(R.types=e.types),W&&(R.parentStringify=W),N&&!e.logLevels&&(R.parentLogLevels=N),U&&!e.messages&&(R.parentMessages=U),super(R),this.options=e,this.interactive=o??!1,this.stdout=p,this.stderr=l,this.interactive&&(this.interactiveManager=new Ce(new we(this.stdout),new we(this.stderr))),Array.isArray(n)&&this.registerReporters(n),this.rawReporter=this.extendReporter(c??new yt),Array.isArray(a)&&this.registerProcessors(a)}options;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?he(this.types,e.types):this.types,o=e?.reporters??[],a=o.length>0?[...this.reporters,...o]:[...this.reporters],c=e?.processors??[],n=c.length>0?[...this.processors,...c]:[...this.processors],g=e?.logLevels?{...this.logLevels,...e.logLevels}:this.logLevels;let b;if(e?.scope){const d=ge(e.scope).filter(Boolean);b=this.scopeName.length>0?[...this.scopeName,...d]:d}else b=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:b,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 Se(p)}#r(e,r,s,o){s?(e.parentTypes=o,e.parentLongestLabel=ie(o)):(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(xe),this.stderr.write(xe)}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 $t=Se;var St=Object.defineProperty,_e=(t,e)=>St(t,"name",{value:e,configurable:!0}),vt=Object.defineProperty,Z=_e((t,e)=>vt(t,"name",{value:e,configurable:!0}),"g$1");const Te=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"]]),wt=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,xt=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,Lt=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,Tt=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,de=Z(()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),"getDefaultCss"),ke=/\s+/,ne=Z(t=>{Te.has(t)&&(t=Te.get(t));const e=wt.exec(t);if(e)return[Number.parseInt(e[1],16),Number.parseInt(e[2],16),Number.parseInt(e[3],16)];const r=xt.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=Lt.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 o=Tt.exec(t);if(o){let a=Number(o[1])%360;a<0&&(a+=360);const c=Math.max(0,Math.min(100,Number(o[2])))/100,n=Math.max(0,Math.min(100,Number(o[3])))/100,g=(1-Math.abs(2*n-1))*c,b=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,b,0]:a<120?{0:p,1:d,2:E}=[b,g,0]:a<180?{0:p,1:d,2:E}=[0,g,b]:a<240?{0:p,1:d,2:E}=[0,b,g]:a<300?{0:p,1:d,2:E}=[b,0,g]:{0:p,1:d,2:E}=[g,0,b],[Math.round((p+l)*255),Math.round((d+l)*255),Math.round((E+l)*255)]}return null},"parseCssColor"),ce=Z((t,e)=>t?.[0]===e?.[0]&&t?.[1]===e?.[1]&&t?.[2]===e?.[2],"colorEquals"),kt=Z(t=>{if(typeof t!="string")return de();const e=de(),r=[];let s=!1,o=null,a=0,c="";for(const n of t){if(n==="(")a+=1;else if(a>0)n===")"&&(a-=1);else if(s){if(n===";"){const g=c.trim();g!==""&&r.push([o,g]),o=null,c="",s=!1;continue}}else if(n===":"){o=c.trim(),c="",s=!0;continue}c+=n}if(s&&a===0){const n=c.trim();n!==""&&r.push([o,n]),o=null,c=""}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 b=g.split(ke);for(const l of b){const p=ne(l);p!=null?e.textDecorationColor=p:["line-through","overline","underline"].includes(l)&&e.textDecorationLine.push(l)}break}case"text-decoration-color":{const b=ne(g);b!=null&&(e.textDecorationColor=b);break}case"text-decoration-line":{e.textDecorationLine=[];const b=g.split(ke);for(const l of b)["line-through","overline","underline"].includes(l)&&e.textDecorationLine.push(l);break}}return e},"parseCss"),Mt=Z((t,e)=>{e=e??de();let r="";if(!ce(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:o,2:a}=t.backgroundColor;r+=`\x1B[48;2;${String(s)};${String(o)};${String(a)}m`}else{const s=ne(t.backgroundColor);if(s===null)r+="\x1B[49m";else{const{0:o,1:a,2:c}=s;r+=`\x1B[48;2;${String(o)};${String(a)};${String(c)}m`}}}if(!ce(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:o,2:a}=t.color;r+=`\x1B[38;2;${String(s)};${String(o)};${String(a)}m`}else{const s=ne(t.color);if(s===null)r+="\x1B[39m";else{const{0:o,1:a,2:c}=s;r+=`\x1B[38;2;${String(o)};${String(a)};${String(c)}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"),!ce(t.textDecorationColor,e.textDecorationColor))if(t.textDecorationColor==null)r+="\x1B[59m";else{const{0:s,1:o,2:a}=t.textDecorationColor;r+=`\x1B[58;2;${String(s)};${String(o)};${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 Et=Object.defineProperty,ve=_e((t,e)=>Et(t,"name",{value:e,configurable:!0}),"u");const At=ve(t=>{try{return JSON.stringify(t)}catch{return'"[Circular]"'}},"tryStringify"),Me="%".codePointAt(0),Bt="s".codePointAt(0),jt="d".codePointAt(0),Ot="f".codePointAt(0),_t="i".codePointAt(0),Nt="O".codePointAt(0),Dt="o".codePointAt(0),Pt="j".codePointAt(0),Ct="c".codePointAt(0),It=ve((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??At,o=1;if(typeof t=="object"){const l=e.length+o;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-o]);return p.join(" ")}if(e.length===0)return t;let a="",c=1-o,n=-1,g=!1,b;for(let l=0;l<t.length;){if(t.codePointAt(l)===Me&&l+1<t.length){n=n>-1?n:0;const p=t.codePointAt(l+1);if(p===void 0){c+=1;break}switch(p){case Ct:{if(globalThis.window===void 0){const d=kt(e[c]);n<l&&(a+=t.slice(n,l));const E=Mt(d,b);a+=E,E!==""&&(g=!0,b=d)}n=l+2,l+=1;break}case jt:case Ot:{if(c>=e.length||e[c]==null)break;n<l&&(a+=t.slice(n,l));const d=e[c];a+=(typeof d=="symbol"?Number.NaN:Number(d)).toString(),n=l+2,l+=1;break}case _t:{if(c>=e.length||e[c]==null)break;n<l&&(a+=t.slice(n,l));const d=e[c];a+=Math.floor(typeof d=="symbol"?Number.NaN:Number(d)).toString(),n=l+2,l+=1;break}case Pt:case Nt:case Dt:{if(c>=e.length||e[c]===void 0)break;n<l&&(a+=t.slice(n,l));const d=e[c],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 Me:{n<l&&(a+=t.slice(n,l)),a+="%",n=l+2,l+=1,c-=1;break}case Bt:{if(c>=e.length)break;n<l&&(a+=t.slice(n,l)),a+=typeof e[c]=="object"?s(e[c]):String(e[c]),n=l+2,l+=1;break}default:typeof r.formatters?.[p]=="function"&&(n<l&&(a+=t.slice(n,l)),a+=r.formatters[p](e[c]),n=l+2,l+=1)}c+=1}l+=1}return n===-1?t:(n<t.length&&(a+=t.slice(n)),g&&(a+="\x1B[0m"),a)},"format"),Rt=ve((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 o=r.codePointAt(0);if(o===void 0)throw new Error(`${r}.codePointAt(0) failed to return a value, please report this issue`);e[o]=s}),(r,s=[],o={})=>It(r,s,{...o,formatters:e})},"build");class qt{#r;#t;#e;constructor(e={}){this.#t=e.formatters}setStringify(e){this.#r=e}process(e){this.#e===void 0&&(this.#e=Rt({formatters:this.#t,stringify:s=>this.#r?this.#r(s):JSON.stringify(s)}));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 o=r,a=Object.keys(o);for(let c=0;c<a.length;c+=1){const n=a[c],g=o[n];(typeof g=="string"||Array.isArray(g)||typeof g=="object")&&(o[n]=this.#s(e,g,s))}}return r}}const{bgGrey:Ft,cyan:Jt,green:Vt,greenBright:Gt,grey:J,red:fe,underline:Ee,white:Ht}=Be,Ut=/[\\/]pail[\\/]dist/,ue=t=>!Ut.test(t);class zt extends qe{#r;#t;#e;#s=!1;#i;#o;constructor(e={}){const{error:r,inspect:s,...o}=e;super({uppercase:{label:!0,...o.uppercase},...o}),this.#i={...Fe,...s},this.#o={...r,color:{fileLine:Vt,hint:Jt,marker:fe,message:fe,method:Gt,title:fe}},this.#r=pe,this.#t=me}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}=Je();let s=r;typeof this.styles.messageLength=="number"&&(s=this.styles.messageLength);const{badge:o,context:a,date:c,error:n,file:g,groups:b,label:l,message:p,prefix:d,repeated:E,scope:N,suffix:U,traceError:W,type:R}=e,{color:f}=this.loggerTypes[R.name],u=f?Be[f]:Ht,y=b.map(()=>" ").join(""),$=[];if(b.length>0&&$.push(`${y+J(`[${b.at(-1)??""}]`)} `),c&&$.push(`${J(this.styles.dateFormatter(typeof c=="string"?new Date(c):c))} `),o)$.push(u(o));else{const A=Ve(this.loggerTypes);A.length>0&&$.push(`${J(".".repeat(A.length))} `)}const _=ie(this.loggerTypes);if(l){const A=re(_),S=re(l);$.push(`${u(Ge(l,this.styles))} `,J(".".repeat(Math.max(0,A-S))))}else $.push(J(".".repeat(_.length+2)));E&&$.push(`${Ft.white(`[${String(E)}x]`)} `),Array.isArray(N)&&N.length>0&&$.push(` ${J(`[${N.join(" > ")}]`)} `),d&&$.push(`${J(`${Array.isArray(N)&&N.length>0?". ":" "}[${this.styles.underline.prefix?Ee(d):d}]`)} `);const q=re($.join(" "));if(g){const A=(g.name??"")+(g.line?`:${String(g.line)}`:""),S=re(A);if(S+q+2>s)$.push(J(` ${A}`));else{const z=Math.max(0,s-q-S-2);$.push(J(`${".".repeat(z)} ${A}`))}}else $.push(J(".".repeat(Math.max(0,s-q-1))));if($.length>0&&$.push(`
2
21
 
3
- const __cjs_require = __cjs_createRequire(import.meta.url);
22
+ `),p!==be){const A=typeof p=="string"?p:oe(p,this.#i);$.push(y+He(A,{trim:!1,width:s-3,wrapMode:Ue.STRICT_WIDTH}))}if(a){let A=!1;$.push(...a.map(S=>{if(S instanceof Error)return A=!0,`
4
23
 
5
- const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
24
+ ${le(S,{...this.#o,filterStacktrace:ue,prefix:y})}`;if(typeof S=="object")return` ${oe(S,this.#i)}`;const z=(A?`
6
25
 
7
- const {
8
- stdout,
9
- stderr,
10
- env
11
- } = __cjs_getProcess;
12
- import InteractiveManager from './packem_shared/InteractiveManager-CbE7d1kY.js';
13
- import { I as InteractiveStreamHook, c as clearTerminal } from './packem_shared/interactive-stream-hook-DG4BtN12.js';
14
- import { a as PailBrowserImpl, m as mergeTypes, b as arrayify } from './packem_shared/pail.browser-u2CSR_af.js';
15
- import { ProgressBar, applyStyleToOptions, MultiProgressBar } from './progress-bar.js';
16
- export { getBarChar } from './progress-bar.js';
17
- import { i as inspect } from './packem_shared/format-label-De49vNPd.js';
18
- import { E as EMPTY_SYMBOL } from './packem_shared/constants-omsTHUWB.js';
19
- import { w as writeStream } from './packem_shared/write-stream-BG8fhcs3.js';
20
- import { Spinner, MultiSpinner } from './spinner.js';
21
- import { g as getLongestLabel } from './packem_shared/get-longest-label-C9PWeyKq.js';
22
- import MessageFormatterProcessor from './processor/message-formatter-processor.js';
23
- import { PrettyReporter } from './packem_shared/PrettyReporter-C2wVB7yu.js';
26
+ `:" ")+String(S);return A=!1,z}))}return n&&$.push(le(n,{...this.#o,filterStacktrace:ue,prefix:y})),W&&$.push(`
24
27
 
25
- class RawReporter {
26
- #stdout;
27
- #stderr;
28
- #interactiveManager;
29
- #interactive = false;
30
- #inspectOptions;
31
- constructor(inspectOptions = {}) {
32
- this.#stdout = stdout;
33
- this.#stderr = stderr;
34
- this.#inspectOptions = inspectOptions;
35
- }
36
- setStdout(stdout_) {
37
- this.#stdout = stdout_;
38
- }
39
- setStderr(stderr_) {
40
- this.#stderr = stderr_;
41
- }
42
- setInteractiveManager(manager) {
43
- this.#interactiveManager = manager;
44
- }
45
- setIsInteractive(interactive) {
46
- this.#interactive = interactive;
47
- }
48
- log(meta) {
49
- const { context, groups, message, type } = meta;
50
- const items = [];
51
- if (message !== EMPTY_SYMBOL) {
52
- const formattedMessage = typeof message === "string" ? message : inspect(message, this.#inspectOptions);
53
- items.push(formattedMessage);
54
- }
55
- if (context) {
56
- items.push(
57
- ...context.map((value) => {
58
- if (typeof value === "object") {
59
- return ` ${inspect(value, this.#inspectOptions)}`;
60
- }
61
- return ` ${value}`;
62
- })
63
- );
64
- }
65
- const streamType = ["error", "trace", "warn"].includes(type.level) ? "stderr" : "stdout";
66
- const stream = streamType === "stderr" ? this.#stderr : this.#stdout;
67
- const groupSpaces = groups.map(() => " ").join("");
68
- if (this.#interactive && this.#interactiveManager !== void 0 && stream.isTTY) {
69
- this.#interactiveManager.update(streamType, (groupSpaces + items.join("")).split("\n"), 0);
70
- } else {
71
- writeStream(groupSpaces + items.join(""), stream);
72
- }
73
- }
74
- }
75
-
76
- class PailServerImpl extends PailBrowserImpl {
77
- /**
78
- * Creates a new Pail server logger instance.
79
- *
80
- * Initializes the server-compatible logger with streams, interactive support,
81
- * and server-specific configuration options.
82
- * @param options Server-specific configuration options
83
- */
84
- constructor(options) {
85
- const parentStderr = options.parentStderr;
86
- const parentStdout = options.parentStdout;
87
- const { interactive, processors, rawReporter, reporters, stderr: optionsStderr, stdout: optionsStdout } = options;
88
- const stderr = parentStderr ?? optionsStderr;
89
- const stdout = parentStdout ?? optionsStdout;
90
- const parentLongestLabel = options.parentLongestLabel;
91
- const parentTypes = options.parentTypes;
92
- const { parentLogLevels, parentMessages, parentStringify } = options;
93
- const parentOptions = {
94
- disabled: options.disabled,
95
- logLevel: options.logLevel,
96
- logLevels: options.logLevels,
97
- messages: options.messages,
98
- processors: [],
99
- rawReporter: options.rawReporter,
100
- reporters: [],
101
- scope: options.scope,
102
- throttle: options.throttle,
103
- throttleMin: options.throttleMin
104
- };
105
- const hasTypesProperty = "types" in options;
106
- if (parentTypes && parentLongestLabel && !hasTypesProperty) {
107
- parentOptions.parentTypes = parentTypes;
108
- parentOptions.parentLongestLabel = parentLongestLabel;
109
- } else if (hasTypesProperty && options.types !== void 0) {
110
- parentOptions.types = options.types;
111
- }
112
- if (parentStringify) {
113
- parentOptions.parentStringify = parentStringify;
114
- }
115
- if (parentLogLevels && !options.logLevels) {
116
- parentOptions.parentLogLevels = parentLogLevels;
117
- }
118
- if (parentMessages && !options.messages) {
119
- parentOptions.parentMessages = parentMessages;
120
- }
121
- super(parentOptions);
122
- this.options = options;
123
- this.interactive = interactive ?? false;
124
- this.stdout = stdout;
125
- this.stderr = stderr;
126
- if (this.interactive) {
127
- this.interactiveManager = new InteractiveManager(new InteractiveStreamHook(this.stdout), new InteractiveStreamHook(this.stderr));
128
- }
129
- if (Array.isArray(reporters)) {
130
- this.registerReporters(reporters);
131
- }
132
- this.rawReporter = this.extendReporter(rawReporter ?? new RawReporter());
133
- if (Array.isArray(processors)) {
134
- this.registerProcessors(processors);
135
- }
136
- }
137
- stdout;
138
- stderr;
139
- interactiveManager;
140
- interactive;
141
- // @ts-expect-error - this returns a different type
142
- scope(...name) {
143
- if (name.length === 0) {
144
- throw new Error("No scope name was defined.");
145
- }
146
- this.scopeName = name.flat();
147
- return this;
148
- }
149
- /**
150
- * Creates a child logger that inherits settings from the parent.
151
- *
152
- * Returns a new logger instance that inherits all configuration from the parent
153
- * (reporters, processors, types, log levels, throttle settings, etc.) while allowing
154
- * you to override only what you need. Child loggers are independent instances with
155
- * their own state (timers, counters, etc.).
156
- * @template N - The new custom logger type names
157
- * @template LC - The new log level types
158
- * @param options Configuration options to override or extend parent settings
159
- * @returns A new child logger instance
160
- * @example
161
- * ```typescript
162
- * const parent = createPail({
163
- * logLevel: "info",
164
- * types: { http: { label: "HTTP", logLevel: "info" } },
165
- * reporters: [new PrettyReporter()],
166
- * });
167
- *
168
- * // Child inherits parent settings but overrides log level
169
- * const child = parent.child({ logLevel: "debug" });
170
- * child.info("This will be logged"); // Uses debug level from child
171
- * child.http("GET /api 200"); // Inherits http type from parent
172
- *
173
- * // Child can add new types
174
- * const childWithNewType = parent.child({
175
- * types: { db: { label: "DB", logLevel: "info" } },
176
- * });
177
- * childWithNewType.db("Query executed"); // New type available
178
- * ```
179
- */
180
- // @ts-expect-error - override signature differs due to server-specific options
181
- child(options) {
182
- const typesChanged = options?.types !== void 0 && options.types !== null;
183
- const mergedTypes = typesChanged ? mergeTypes(this.types, options.types) : this.types;
184
- const childReporters = options?.reporters ?? [];
185
- const allReporters = childReporters.length > 0 ? [...this.reporters, ...childReporters] : [...this.reporters];
186
- const childProcessors = options?.processors ?? [];
187
- const allProcessors = childProcessors.length > 0 ? [...this.processors, ...childProcessors] : [...this.processors];
188
- const mergedLogLevels = options?.logLevels ? { ...this.logLevels, ...options.logLevels } : this.logLevels;
189
- let mergedScope;
190
- if (options?.scope) {
191
- const childScope = arrayify(options.scope).filter(Boolean);
192
- mergedScope = this.scopeName.length > 0 ? [...this.scopeName, ...childScope] : childScope;
193
- } else {
194
- mergedScope = this.scopeName.length > 0 ? this.scopeName : [];
195
- }
196
- const mergedMessages = options?.messages ? {
197
- timerEnd: this.endTimerMessage,
198
- timerStart: this.startTimerMessage,
199
- ...options.messages
200
- } : {
201
- timerEnd: this.endTimerMessage,
202
- timerStart: this.startTimerMessage
203
- };
204
- const childOptions = {
205
- disabled: options?.disabled ?? this.disabled,
206
- interactive: options?.interactive ?? this.interactive,
207
- logLevel: options?.logLevel ?? this.generalLogLevel,
208
- logLevels: mergedLogLevels,
209
- messages: mergedMessages,
210
- processors: allProcessors,
211
- rawReporter: options?.rawReporter ?? this.rawReporter,
212
- reporters: allReporters,
213
- scope: mergedScope,
214
- stderr: options?.stderr ?? this.stderr,
215
- stdout: options?.stdout ?? this.stdout,
216
- throttle: options?.throttle ?? this.throttle,
217
- throttleMin: options?.throttleMin ?? this.throttleMin
218
- };
219
- this.#assignParentValues(childOptions, options, typesChanged, mergedTypes);
220
- return new PailServerImpl(childOptions);
221
- }
222
- /**
223
- * Assigns parent values to child options for optimization.
224
- *
225
- * Reuses parent values when they haven't changed to avoid unnecessary recalculations.
226
- */
227
- /* eslint-disable no-param-reassign */
228
- #assignParentValues(childOptions, options, typesChanged, mergedTypes) {
229
- if (typesChanged) {
230
- childOptions.parentTypes = mergedTypes;
231
- childOptions.parentLongestLabel = getLongestLabel(mergedTypes);
232
- } else {
233
- childOptions.parentTypes = this.types;
234
- childOptions.parentLongestLabel = this.longestLabel;
235
- }
236
- if (!options?.logLevels) {
237
- childOptions.parentLogLevels = this.logLevels;
238
- }
239
- if (!options?.messages) {
240
- childOptions.parentMessages = {
241
- timerEnd: this.endTimerMessage,
242
- timerStart: this.startTimerMessage
243
- };
244
- }
245
- childOptions.parentStringify = this.stringify;
246
- if (!options?.stdout) {
247
- childOptions.parentStdout = this.stdout;
248
- }
249
- if (!options?.stderr) {
250
- childOptions.parentStderr = this.stderr;
251
- }
252
- }
253
- /* eslint-enable no-param-reassign */
254
- /**
255
- * Gets the interactive manager instance if interactive mode is enabled.
256
- *
257
- * Returns the InteractiveManager instance that handles interactive terminal
258
- * features like progress bars and dynamic updates. Only available when
259
- * interactive mode is enabled in the constructor options.
260
- * @returns The interactive manager instance, or undefined if not in interactive mode
261
- * @example
262
- * ```typescript
263
- * const logger = createPail({ interactive: true });
264
- * const manager = logger.getInteractiveManager();
265
- * if (manager) {
266
- * manager.hook();
267
- * // Use interactive features
268
- * manager.unhook();
269
- * }
270
- * ```
271
- */
272
- getInteractiveManager() {
273
- return this.interactiveManager;
274
- }
275
- /**
276
- * Wraps stdout and stderr streams to redirect them through the logger.
277
- *
278
- * Intercepts writes to process.stdout and process.stderr, redirecting them
279
- * through the logger instead of writing directly to the streams. This allows
280
- * all output to be processed by the logging pipeline.
281
- * @example
282
- * ```typescript
283
- * const logger = createPail();
284
- * logger.wrapStd();
285
- *
286
- * console.log("This goes through logger");
287
- * process.stdout.write("This too");
288
- *
289
- * logger.restoreStd(); // Restore original streams
290
- * ```
291
- */
292
- wrapStd() {
293
- this.#wrapStream(this.stdout, "log");
294
- this.#wrapStream(this.stderr, "log");
295
- }
296
- /**
297
- * Restores the original stdout and stderr streams.
298
- *
299
- * Removes the stream wrapping that was applied by wrapStd(),
300
- * restoring the original stream write methods.
301
- * @example
302
- * ```typescript
303
- * const logger = createPail();
304
- * logger.wrapStd();
305
- * // Streams are wrapped
306
- * logger.restoreStd();
307
- * // Streams are restored to original behavior
308
- * ```
309
- */
310
- restoreStd() {
311
- this.#restoreStream(this.stdout);
312
- this.#restoreStream(this.stderr);
313
- }
314
- /**
315
- * Wraps all output sources (console and streams).
316
- *
317
- * Convenience method that calls both wrapConsole() and wrapStd()
318
- * to redirect all output through the logger.
319
- * @example
320
- * ```typescript
321
- * const logger = createPail();
322
- * logger.wrapAll(); // Wraps console and streams
323
- *
324
- * // All output now goes through logger
325
- * console.log("Console output");
326
- * process.stdout.write("Stream output");
327
- *
328
- * logger.restoreAll(); // Restore everything
329
- * ```
330
- */
331
- wrapAll() {
332
- this.wrapConsole();
333
- this.wrapStd();
334
- }
335
- /**
336
- * Restores all wrapped output sources.
337
- *
338
- * Convenience method that calls both restoreConsole() and restoreStd()
339
- * to restore all original output behavior.
340
- * @example
341
- * ```typescript
342
- * const logger = createPail();
343
- * logger.wrapAll();
344
- * // All output is wrapped
345
- * logger.restoreAll();
346
- * // All output sources are restored
347
- * ```
348
- */
349
- restoreAll() {
350
- this.restoreConsole();
351
- this.restoreStd();
352
- }
353
- /**
354
- * Creates a single progress bar.
355
- * @param options Configuration options for the progress bar
356
- * @returns A new ProgressBar instance
357
- * @example
358
- * ```typescript
359
- * const logger = createPail({ interactive: true });
360
- * const bar = logger.createProgressBar({
361
- * total: 100,
362
- * format: 'Downloading [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}'
363
- * });
364
- *
365
- * bar.start();
366
- * // ... do work and update progress
367
- * bar.update(50);
368
- * bar.stop();
369
- * ```
370
- */
371
- createProgressBar(options) {
372
- if (!this.interactiveManager) {
373
- throw new Error("Interactive mode is not enabled. Create Pail with { interactive: true } to use progress bars.");
374
- }
375
- const styledOptions = applyStyleToOptions(options);
376
- return new ProgressBar(styledOptions, this.interactiveManager);
377
- }
378
- /**
379
- * Creates a multi-bar progress manager for displaying multiple progress bars.
380
- * @param options Configuration options for the multi-bar manager
381
- * @returns A new MultiProgressBar instance
382
- * @example
383
- * ```typescript
384
- * const logger = createPail({ interactive: true });
385
- * const multiBar = logger.createMultiProgressBar();
386
- *
387
- * const bar1 = multiBar.create(100);
388
- * const bar2 = multiBar.create(200);
389
- *
390
- * bar1.start();
391
- * bar2.start();
392
- * // ... update bars as needed
393
- * multiBar.stop();
394
- * ```
395
- */
396
- createMultiProgressBar(options = {}) {
397
- if (!this.interactiveManager) {
398
- throw new Error("Interactive mode is not enabled. Create Pail with { interactive: true } to use progress bars.");
399
- }
400
- const styledOptions = applyStyleToOptions(options);
401
- return new MultiProgressBar(styledOptions, this.interactiveManager);
402
- }
403
- /**
404
- * Creates a single spinner.
405
- * @param options Configuration options for the spinner
406
- * @returns A new Spinner instance
407
- * @example
408
- * ```typescript
409
- * const logger = createPail({ interactive: true });
410
- * const spinner = logger.createSpinner({ name: 'dots' });
411
- * spinner.start('Loading...');
412
- * // ... do work
413
- * spinner.succeed('Done');
414
- * ```
415
- */
416
- createSpinner(options = {}) {
417
- if (!this.interactiveManager) {
418
- throw new Error("Interactive mode is not enabled. Create Pail with { interactive: true } to use spinners.");
419
- }
420
- return new Spinner(options, this.interactiveManager);
421
- }
422
- /**
423
- * Creates a multi-spinner manager for displaying multiple spinners.
424
- * @param options Configuration options for the multi-spinner manager
425
- * @returns A new MultiSpinner instance
426
- * @example
427
- * ```typescript
428
- * const logger = createPail({ interactive: true });
429
- * const multiSpinner = logger.createMultiSpinner();
430
- *
431
- * const spinner1 = multiSpinner.create('Loading 1');
432
- * const spinner2 = multiSpinner.create('Loading 2');
433
- *
434
- * spinner1.start();
435
- * spinner2.start();
436
- * // ... update spinners as needed
437
- * multiSpinner.stop();
438
- * ```
439
- */
440
- createMultiSpinner(options = {}) {
441
- if (!this.interactiveManager) {
442
- throw new Error("Interactive mode is not enabled. Create Pail with { interactive: true } to use spinners.");
443
- }
444
- return new MultiSpinner(options, this.interactiveManager);
445
- }
446
- /**
447
- * Clears the terminal screen.
448
- *
449
- * Sends ANSI escape sequences to clear the terminal screen and move
450
- * the cursor to the top-left position. This overrides the browser
451
- * implementation to work with terminal streams.
452
- * @example
453
- * ```typescript
454
- * const logger = createPail();
455
- * logger.info("Some output");
456
- * logger.clear(); // Clears the terminal screen
457
- * ```
458
- */
459
- clear() {
460
- this.stdout.write(clearTerminal);
461
- this.stderr.write(clearTerminal);
462
- }
463
- extendReporter(reporter) {
464
- if (typeof reporter.setStdout === "function") {
465
- reporter.setStdout(this.stdout);
466
- }
467
- if (typeof reporter.setStderr === "function") {
468
- reporter.setStderr(this.stderr);
469
- }
470
- if (typeof reporter.setLoggerTypes === "function") {
471
- reporter.setLoggerTypes(this.types);
472
- }
473
- if (typeof reporter.setStringify === "function") {
474
- reporter.setStringify(this.stringify);
475
- }
476
- if (typeof reporter.setIsInteractive === "function") {
477
- reporter.setIsInteractive(this.interactive);
478
- }
479
- if (this.interactive && typeof reporter.setInteractiveManager === "function") {
480
- reporter.setInteractiveManager(this.interactiveManager);
481
- }
482
- return reporter;
483
- }
484
- #wrapStream(stream, type) {
485
- if (!stream) {
486
- return;
487
- }
488
- if (!stream.__write) {
489
- stream.__write = stream.write;
490
- }
491
- stream.write = (data) => {
492
- this[type](String(data).trim());
493
- };
494
- }
495
- // eslint-disable-next-line class-methods-use-this
496
- #restoreStream(stream) {
497
- if (!stream) {
498
- return;
499
- }
500
- if (stream.__write) {
501
- stream.write = stream.__write;
502
- delete stream.__write;
503
- }
504
- }
505
- }
506
- const PailServer = PailServerImpl;
507
-
508
- const getDefaultLogLevel = () => {
509
- if (env.NODE_ENV === "debug" || env.DEBUG !== void 0) {
510
- return "debug";
511
- }
512
- if (env.NODE_ENV === "test") {
513
- return "warning";
514
- }
515
- return "informational";
516
- };
517
- const createPail = (options) => {
518
- let logLevel = getDefaultLogLevel();
519
- if (env.PAIL_LOG_LEVEL !== void 0) {
520
- logLevel = env.PAIL_LOG_LEVEL;
521
- }
522
- return new PailServer({
523
- logLevel,
524
- processors: [new MessageFormatterProcessor()],
525
- reporters: [new PrettyReporter()],
526
- stderr,
527
- stdout,
528
- ...options
529
- });
530
- };
531
- const pail = createPail();
532
-
533
- export { MultiProgressBar, MultiSpinner, ProgressBar, Spinner, createPail, pail };
28
+ ${le(W,{...this.#o,filterStacktrace:ue,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:y})}`),U&&$.push(`
29
+ `,y+J(this.styles.underline.suffix?Ee(U):U)),$.join("")}_log(e,r){const s=["error","trace","warn"].includes(r)?"stderr":"stdout",o=s==="stderr"?this.#t:this.#r;this.#s&&this.#e!==void 0&&o.isTTY?this.#e.update(s,e.split(`
30
+ `),0):Ae(`${e}
31
+ `,o)}}const Wt=()=>K.NODE_ENV==="debug"||K.DEBUG!==void 0?"debug":K.NODE_ENV==="test"?"warning":"informational",Yt=t=>{let e=Wt();return K.PAIL_LOG_LEVEL!==void 0&&(e=K.PAIL_LOG_LEVEL),new $t({logLevel:e,processors:[new qt],reporters:[new zt],stderr:me,stdout:pe,...t})},rr=Yt();export{or as PailError,Yt as createPail,nr as createPailError,rr as pail};