@visulima/vis 1.0.0-alpha.34 → 1.0.0-alpha.36

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 (193) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/LICENSE.md +3244 -1611
  3. package/README.md +44 -0
  4. package/dashboard/dist/index.html +11 -11
  5. package/dist/bin.js +1 -1
  6. package/dist/binx.js +1 -1
  7. package/dist/config/index.d.ts +74 -2
  8. package/dist/config/index.js +1 -1
  9. package/dist/generate/index.js +1 -1
  10. package/dist/packem_chunks/bin.js +584 -588
  11. package/dist/packem_chunks/bloom-status.js +2 -2
  12. package/dist/packem_chunks/bloom-sync.js +2 -2
  13. package/dist/packem_chunks/cache-attestation.js +1 -1
  14. package/dist/packem_chunks/config.js +18 -16
  15. package/dist/packem_chunks/devtools.js +56 -57
  16. package/dist/packem_chunks/doctor-probe.js +2 -2
  17. package/dist/packem_chunks/fix.js +11 -11
  18. package/dist/packem_chunks/handler.js +1 -1
  19. package/dist/packem_chunks/handler10.js +1 -1
  20. package/dist/packem_chunks/handler11.js +5 -5
  21. package/dist/packem_chunks/handler12.js +1 -1
  22. package/dist/packem_chunks/handler13.js +7 -7
  23. package/dist/packem_chunks/handler14.js +4 -4
  24. package/dist/packem_chunks/handler15.js +1 -1
  25. package/dist/packem_chunks/handler16.js +1 -1
  26. package/dist/packem_chunks/handler17.js +1 -1
  27. package/dist/packem_chunks/handler18.js +1 -1
  28. package/dist/packem_chunks/handler19.js +1 -1
  29. package/dist/packem_chunks/handler2.js +3 -3
  30. package/dist/packem_chunks/handler20.js +5 -5
  31. package/dist/packem_chunks/handler21.js +2 -2
  32. package/dist/packem_chunks/handler22.js +2 -2
  33. package/dist/packem_chunks/handler23.js +1 -1
  34. package/dist/packem_chunks/handler24.js +1 -1
  35. package/dist/packem_chunks/handler25.js +1 -5
  36. package/dist/packem_chunks/handler26.js +5 -1
  37. package/dist/packem_chunks/handler27.js +1 -3
  38. package/dist/packem_chunks/handler28.js +3 -1
  39. package/dist/packem_chunks/handler29.js +1 -7
  40. package/dist/packem_chunks/handler3.js +4 -4
  41. package/dist/packem_chunks/handler30.js +6 -32
  42. package/dist/packem_chunks/handler31.js +33 -3
  43. package/dist/packem_chunks/handler32.js +3 -8
  44. package/dist/packem_chunks/handler33.js +8 -1
  45. package/dist/packem_chunks/handler34.js +4 -5
  46. package/dist/packem_chunks/handler35.js +1 -11
  47. package/dist/packem_chunks/handler36.js +5 -3
  48. package/dist/packem_chunks/handler37.js +11 -22
  49. package/dist/packem_chunks/handler38.js +3 -61
  50. package/dist/packem_chunks/handler39.js +22 -3
  51. package/dist/packem_chunks/handler4.js +6 -6
  52. package/dist/packem_chunks/handler40.js +61 -6
  53. package/dist/packem_chunks/handler41.js +3 -24
  54. package/dist/packem_chunks/handler42.js +6 -25
  55. package/dist/packem_chunks/handler43.js +24 -153
  56. package/dist/packem_chunks/handler44.js +25 -10
  57. package/dist/packem_chunks/handler45.js +152 -707
  58. package/dist/packem_chunks/handler46.js +10 -24
  59. package/dist/packem_chunks/handler47.js +24 -322
  60. package/dist/packem_chunks/handler48.js +322 -48
  61. package/dist/packem_chunks/handler49.js +708 -3
  62. package/dist/packem_chunks/handler5.js +7 -7
  63. package/dist/packem_chunks/handler50.js +48 -27
  64. package/dist/packem_chunks/handler51.js +21 -189
  65. package/dist/packem_chunks/handler52.js +3 -34
  66. package/dist/packem_chunks/handler53.js +200 -0
  67. package/dist/packem_chunks/handler54.js +38 -0
  68. package/dist/packem_chunks/handler6.js +1 -1
  69. package/dist/packem_chunks/handler7.js +1 -1
  70. package/dist/packem_chunks/handler8.js +1 -1
  71. package/dist/packem_chunks/handler9.js +1 -1
  72. package/dist/packem_chunks/heal-accept.js +7 -7
  73. package/dist/packem_chunks/heal.js +11 -11
  74. package/dist/packem_chunks/help-command.js +30 -7
  75. package/dist/packem_chunks/index.js +6 -6
  76. package/dist/packem_chunks/keys-refresh.js +4 -4
  77. package/dist/packem_chunks/list.js +2 -2
  78. package/dist/packem_chunks/loader.js +4 -4
  79. package/dist/packem_chunks/loader2.js +1 -1
  80. package/dist/packem_chunks/prune.js +3 -3
  81. package/dist/packem_chunks/run.js +1 -1
  82. package/dist/packem_chunks/status.js +2 -2
  83. package/dist/packem_chunks/sync.js +2 -2
  84. package/dist/packem_chunks/sync2.js +2 -2
  85. package/dist/packem_chunks/tar.js +3 -3
  86. package/dist/packem_chunks/tripwire.js +2 -2
  87. package/dist/packem_chunks/verify-lockfile.js +2 -2
  88. package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +1 -0
  89. package/dist/packem_shared/MultiSpinner-B9U0-aE3-B-gIXhFk.js +3 -0
  90. package/dist/packem_shared/Table-CcVkyULl-B_ef6zfS.js +35 -0
  91. package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +1 -0
  92. package/dist/packem_shared/advisories-DLeO5KMN.js +1 -0
  93. package/dist/packem_shared/affected-shas-cVnX8-zs.js +1 -0
  94. package/dist/packem_shared/ai-analysis-DT3bU-_M.js +68 -0
  95. package/dist/packem_shared/ai-fix-BkNqd5nP.js +43 -0
  96. package/dist/packem_shared/build-scripts-CCCi8U66.js +1 -0
  97. package/dist/packem_shared/cyclonedx-86-DbHtf.js +4 -0
  98. package/dist/packem_shared/definePlugin-DoUcoYSy.js +1 -0
  99. package/dist/packem_shared/dependency-scan-BDTH898x.js +1 -0
  100. package/dist/packem_shared/docker-tNrDU3oK.js +59 -0
  101. package/dist/packem_shared/failure-log-Dwqt6_Ga.js +2 -0
  102. package/dist/packem_shared/giget-DHY1sQZC.js +2 -0
  103. package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +1 -0
  104. package/dist/packem_shared/index-BDmTbWX1.js +19 -0
  105. package/dist/packem_shared/index-C0Vj3XF8.js +30 -0
  106. package/dist/packem_shared/index-CB4p298r.js +1 -0
  107. package/dist/packem_shared/index-DMefdF51.js +1 -0
  108. package/dist/packem_shared/license-t5KnNX6v.js +1 -0
  109. package/dist/packem_shared/lifecycle-4z9hHE5b.js +2 -0
  110. package/dist/packem_shared/lockfile-C8Q1_4KK.js +1 -0
  111. package/dist/packem_shared/manifests-Dj3pRKBT.js +1 -0
  112. package/dist/packem_shared/min-release-age-D1alDE3K.js +34 -0
  113. package/dist/packem_shared/missing-package-json-41VUWFBY.js +1 -0
  114. package/dist/packem_shared/native-config-sync-BKAZ0NIs.js +21 -0
  115. package/dist/packem_shared/osv-bloom-B03tUWf3.js +2 -0
  116. package/dist/packem_shared/otelPlugin-DmKDBaPo.js +1 -0
  117. package/dist/packem_shared/peer-warnings-BXAzXqY3.js +1 -0
  118. package/dist/packem_shared/pm-runner-pVihAfxV.js +1 -0
  119. package/dist/packem_shared/provenance-DMuEftgc.js +1 -0
  120. package/dist/packem_shared/registry-keys-Bf2zzlcZ.js +1 -0
  121. package/dist/packem_shared/resolve-explicit-jH0RKyMJ.js +5 -0
  122. package/dist/packem_shared/runtime-check-Stc9AI78.js +1 -0
  123. package/dist/packem_shared/s1ngularity-BkfgC6NO.js +1 -0
  124. package/dist/packem_shared/scan-progress-JBbd9QeT.js +2 -0
  125. package/dist/packem_shared/selectors-GCJIe342.js +3 -0
  126. package/dist/packem_shared/signatures-D1H6h6GH.js +2 -0
  127. package/dist/packem_shared/spinner-BXSl864p.js +1 -0
  128. package/dist/packem_shared/subtree-C7bZuiSQ.js +2 -0
  129. package/dist/packem_shared/symbols-DPTlrJ3B.js +1 -0
  130. package/dist/packem_shared/tabs-BqUepRaD.js +1 -0
  131. package/dist/packem_shared/toolchain-pR7AJ-tB.js +5 -0
  132. package/dist/packem_shared/typosquats-C8qg1neE.js +1 -0
  133. package/dist/packem_shared/use-measured-height-BBJ9intr.js +1 -0
  134. package/dist/packem_shared/utils-Cxree603.js +1 -0
  135. package/dist/packem_shared/verify-Du7xZ2BJ.js +1 -0
  136. package/dist/packem_shared/vis-update-app-CTwRkNgj.js +1 -0
  137. package/dist/packem_shared/watch-BvIwLG4N.js +1 -0
  138. package/dist/packem_shared/watch-loop-DWkvv2tK.js +11 -0
  139. package/index.d.ts +201 -201
  140. package/index.js +751 -567
  141. package/package.json +16 -16
  142. package/schemas/vis-config.schema.json +4 -0
  143. package/dist/packem_shared/Table-3pFgIUZ2-DABgc6rj.js +0 -12
  144. package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +0 -1
  145. package/dist/packem_shared/advisories-CGKZo9Rx.js +0 -1
  146. package/dist/packem_shared/affected-shas-BdnlfiV1.js +0 -1
  147. package/dist/packem_shared/ai-analysis-3QD_RS6F.js +0 -68
  148. package/dist/packem_shared/ai-fix-TsjDQz_0.js +0 -43
  149. package/dist/packem_shared/applyDefaults-BogleaFi.js +0 -1
  150. package/dist/packem_shared/build-scripts-DE6U8jVq.js +0 -1
  151. package/dist/packem_shared/cyclonedx-zf9R2jCs.js +0 -4
  152. package/dist/packem_shared/definePlugin-CWm4Dv_t.js +0 -1
  153. package/dist/packem_shared/dependency-scan-B70azq4x.js +0 -1
  154. package/dist/packem_shared/docker-EJiTY0Sz.js +0 -60
  155. package/dist/packem_shared/failure-log-Dxafk3t4.js +0 -2
  156. package/dist/packem_shared/giget-CcEy_Elm.js +0 -2
  157. package/dist/packem_shared/glob-D_7bct6p-D8itOHsr.js +0 -1
  158. package/dist/packem_shared/index-BpbjpCNL.js +0 -1
  159. package/dist/packem_shared/index-DH-5hsrC.js +0 -1
  160. package/dist/packem_shared/index-di3jpyZS.js +0 -30
  161. package/dist/packem_shared/license-zZU7aavK.js +0 -1
  162. package/dist/packem_shared/lifecycle-DvVTL8nx.js +0 -2
  163. package/dist/packem_shared/lockfile-CedmXr44.js +0 -1
  164. package/dist/packem_shared/lockfile-Cu2BH6bl.js +0 -1
  165. package/dist/packem_shared/manifests-BzWpKW8F.js +0 -1
  166. package/dist/packem_shared/min-release-age-DKMW2N_v.js +0 -34
  167. package/dist/packem_shared/missing-package-json-DKAwoiWK.js +0 -1
  168. package/dist/packem_shared/native-config-sync-DBkJ-hsF.js +0 -21
  169. package/dist/packem_shared/osv-bloom-0Vu8YRhg.js +0 -2
  170. package/dist/packem_shared/otelPlugin-CJR2T_lk.js +0 -1
  171. package/dist/packem_shared/peer-warnings-EvSJ18gE.js +0 -1
  172. package/dist/packem_shared/pm-runner-DmKT2FqF.js +0 -1
  173. package/dist/packem_shared/provenance-Cu6VR1Hy.js +0 -1
  174. package/dist/packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js +0 -1
  175. package/dist/packem_shared/registry-keys-CuBAVdsk.js +0 -1
  176. package/dist/packem_shared/resolve-explicit-Xue0oq8V.js +0 -5
  177. package/dist/packem_shared/runtime-check-CilFOqUU.js +0 -1
  178. package/dist/packem_shared/s1ngularity-adnHbyTd.js +0 -1
  179. package/dist/packem_shared/scan-progress-lZdk5KJ-.js +0 -2
  180. package/dist/packem_shared/selectors-DkgYFzdq.js +0 -3
  181. package/dist/packem_shared/signatures-FGbYV5QE.js +0 -2
  182. package/dist/packem_shared/spinner-0acw5pd_.js +0 -1
  183. package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +0 -1
  184. package/dist/packem_shared/symbols-CQmER5MT.js +0 -1
  185. package/dist/packem_shared/tabs-zUSdR1HI.js +0 -1
  186. package/dist/packem_shared/toolchain-DoG6b_G_.js +0 -5
  187. package/dist/packem_shared/typosquats-acxQ7blw.js +0 -1
  188. package/dist/packem_shared/use-measured-height-DyCBfLtu.js +0 -1
  189. package/dist/packem_shared/utils-DrNg0XTR.js +0 -1
  190. package/dist/packem_shared/verify-BYzxSKWD.js +0 -1
  191. package/dist/packem_shared/vis-update-app-D0QyGneK.js +0 -1
  192. package/dist/packem_shared/watch-DEL0yol9.js +0 -1
  193. package/dist/packem_shared/watch-loop-jmQQl2Qe.js +0 -11
@@ -0,0 +1,2 @@
1
+ import{createRequire as ce}from"node:module";const le=ce(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=r=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[e,t]=y.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return y.getBuiltinModule(r)}return le(r)},{existsSync:m,openSync:ue,readSync:de,closeSync:pe,statSync:he,createWriteStream:X,readdirSync:fe,renameSync:me}=w("node:fs"),{readFile:q,mkdir:S,rm:x,writeFile:ge,mkdtemp:we}=w("node:fs/promises"),{PassThrough:J,Readable:z,pipeline:$e}=w("node:stream"),{pipeline:V}=w("node:stream/promises"),{spawn:Y}=w("node:child_process"),{basename:ve,normalize:be,delimiter:C,resolve:Z,dirname:F,join:I}=w("node:path"),{cwd:K}=y,_e=w("node:readline"),{homedir:ye,tmpdir:Q}=w("node:os"),{promisify:ke}=w("node:util");var G=Object.defineProperty,Ee=(r,e)=>{let t={};for(var n in r)G(t,n,{get:r[n],enumerable:!0});return G(t,Symbol.toStringTag,{value:"Module"}),t};const xe=/^[A-Za-z]:\//;function T(r=""){return r&&r.replace(/\\/g,"/").replace(xe,e=>e.toUpperCase())}const Ce=/^[/\\]{2}/,Te=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,ee=/^[A-Za-z]:$/,te=function(r){if(r.length===0)return".";r=T(r);let e=r.match(Ce),t=k(r),n=r[r.length-1]==="/";return r=re(r,!t),r.length===0?t?"/":n?"./":".":(n&&(r+="/"),ee.test(r)&&(r+="/"),e?t?`//${r}`:`//./${r}`:t&&!k(r)?`/${r}`:r)},M=function(...r){let e="";for(let t of r)if(t)if(e.length>0){let n=e[e.length-1]==="/",o=t[0]==="/";n&&o?e+=t.slice(1):e+=n||o?t:`/${t}`}else e+=t;return te(e)};function Oe(){return typeof process.cwd=="function"?process.cwd().replace(/\\/g,"/"):"/"}const f=function(...r){r=r.map(n=>T(n));let e="",t=!1;for(let n=r.length-1;n>=-1&&!t;n--){let o=n>=0?r[n]:Oe();!o||o.length===0||(e=`${o}/${e}`,t=k(o))}return e=re(e,!t),t&&!k(e)?`/${e}`:e.length>0?e:"."};function re(r,e){let t="",n=0,o=-1,s=0,i=null;for(let a=0;a<=r.length;++a){if(a<r.length)i=r[a];else{if(i==="/")break;i="/"}if(i==="/"){if(!(o===a-1||s===1))if(s===2){if(t.length<2||n!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let c=t.lastIndexOf("/");c===-1?(t="",n=0):(t=t.slice(0,c),n=t.length-1-t.lastIndexOf("/")),o=a,s=0;continue}else if(t.length>0){t="",n=0,o=a,s=0;continue}}e&&(t+=t.length>0?"/..":"..",n=2)}else t.length>0?t+=`/${r.slice(o+1,a)}`:t=r.slice(o+1,a),n=a-o-1;o=a,s=0}else i==="."&&s!==-1?++s:s=-1}return t}const k=function(r){return Te.test(r)},ne=function(r){let e=T(r).replace(/\/$/,"").split("/").slice(0,-1);return e.length===1&&ee.test(e[0])&&(e[0]+="/"),e.join("/")||(k(r)?"/":".")},oe=function(r,e){let t=T(r).split("/"),n="";for(let o=t.length-1;o>=0;o--){let s=t[o];if(s){n=s;break}}return n},Ae=/^path$/i,D={key:"PATH",value:""};function se(r){for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e)||!Ae.test(e))continue;let t=r[e];return t?{key:e,value:t}:D}return D}function Se(r,e){let t=e.value.split(C),n=[],o=r,s;do n.push(Z(o,"node_modules",".bin")),s=o,o=F(o);while(o!==s);n.push(F(process.execPath));let i=n.concat(t).join(C);return{key:e.key,value:i}}function je(r,e,t=!0){let n={...process.env,...e};if(!t)return n;let o=Se(r,se(n));return n[o.key]=o.value,n}const ze=r=>{let e=r.length,t=new J,n=()=>{--e===0&&t.end()};for(let o of r)V(o,t,{end:!1}).then(n).catch(n);return t},A=/([()\][%!^"`<>&|;, *?])/g,Fe=/^#!\s*(.+)/,Ie=/\.(?:com|exe)$/i,Ge=/node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i,Me=process.platform==="win32",De=[".EXE",".CMD",".BAT",".COM"];function Pe(r,e=[],t={}){if(t.shell===!0||!Me)return{command:r,args:e,options:t};let n=P(r,t),o=null;if(n!==null){let s=Buffer.alloc(150),i=null;try{i=ue(n,"r"),de(i,s,0,150,0)}catch{}finally{i!==null&&pe(i)}let a=s.toString().match(Fe);if(a!==null){let c=a[1].trim(),d=c.indexOf(" "),l=d===-1?c:c.slice(0,d),h=d===-1?"":c.slice(d+1),p=ve(l);o=p==="env"?h||null:p}}if(o!==null&&n!==null&&(e=[n,...e],r=o,n=P(r,t)),n===null||!Ie.test(n)){let s=n!==null&&Ge.test(n);r=be(r),r=r.replace(A,"^$1"),e=e.map(i=>(i=i.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),i=i.replace(/(?=(\\+?)?)\1$/,"$1$1"),i=`"${i}"`,i=i.replace(A,"^$1"),s&&(i=i.replace(A,"^$1")),i)),e=["/d","/s","/c",`"${[r,...e].join(" ")}"`],r=t.env?.comspec??"cmd.exe",t={...t,windowsVerbatimArguments:!0}}return{command:r,args:e,options:t}}function P(r,e){let t=(e.cwd??K()).toString(),n=e.env??process.env,o=se(n).value,s=r.includes("/")||r.includes("\\")?[""]:[t,...o.split(C)],i=n.PATHEXT?n.PATHEXT.split(C):De;r.includes(".")&&i[0]!==""&&i.unshift("");for(let a of s){let c=Z(t,a.startsWith('"')&&a.endsWith('"')&&a.length>1?a.slice(1,-1):a,r);for(let d of i){let l=c+d;try{if(he(l).isFile())return l}catch{}}}return null}var B=class extends Error{result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(e,t){super(`Process exited with non-zero status (${e.exitCode})`),this.result=e,this.output=t}};const Be={timeout:void 0,persist:!1},He={windowsHide:!0};function Ne(r){let e=new AbortController;for(let t of r){if(t.aborted)return e.abort(),t;t.addEventListener("abort",()=>{e.abort(t.reason)},{signal:e.signal})}return e.signal}async function H(r){let e="";try{for await(let t of r)e+=t.toString()}catch{}return e}var Re=class{_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(e,t,n){this._options={...Be,...n},this._command=e,this._args=t??[],this._processClosed=new Promise(o=>{this._resolveClose=o})}kill(e){return this._process?.kill(e)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(e,t,n){return Ue(e,t,{...n,stdin:this})}async*[Symbol.asyncIterator](){let e=this._process;if(!e)return;let t=[];this._streamErr&&t.push(this._streamErr),this._streamOut&&t.push(this._streamOut);let n=ze(t),o=_e.createInterface({input:n});for await(let s of o)yield s.toString();if(await this._processClosed,e.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new B(this)}async _waitForOutput(){let e=this._process;if(!e)throw Error("No process was started");let[t,n]=await Promise.all([this._streamOut?H(this._streamOut):"",this._streamErr?H(this._streamErr):""]);await this._processClosed;let{stdin:o}=this._options;if(o&&typeof o!="string"&&await o,e.removeAllListeners(),this._thrownError)throw this._thrownError;let s={stderr:n,stdout:t,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new B(this,s);return s}then(e,t){return this._waitForOutput().then(e,t)}_streamOut;_streamErr;spawn(){let e=K(),t=this._options,n={...He,...t.nodeOptions},o=[];this._resetState(),t.timeout!==void 0&&o.push(AbortSignal.timeout(t.timeout)),t.signal!==void 0&&o.push(t.signal),t.persist===!0&&(n.detached=!0),o.length>0&&(n.signal=Ne(o)),n.env=je(e,n.env,t.nodePath);let s=Pe(this._command,this._args,n),i=Y(s.command,s.args,s.options);if(i.stderr&&(this._streamErr=i.stderr),i.stdout&&(this._streamOut=i.stdout),this._process=i,i.once("error",this._onError),i.once("close",this._onClose),i.stdin){let{stdin:a}=t;typeof a=="string"?i.stdin.end(a):a?.process?.stdout?.pipe(i.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(e=>{this._resolveClose=e}),this._thrownError=void 0}_onError=e=>{if(e.name==="AbortError"&&(!(e.cause instanceof Error)||e.cause.name!=="TimeoutError")){this._aborted=!0;return}this._thrownError=e};_onClose=()=>{this._resolveClose&&this._resolveClose()}};const j=(r,e,t)=>{let n=new Re(r,e,t);return n.spawn(),n},Ue=j;var Le=Ee({detectPackageManager:()=>ie,installDependencies:()=>Ze,packageManagers:()=>v});async function We(r,e,t={}){let n=te(r).split("/");for(;n.length>0;){let o=await e(n.join("/")||"/");if(o||!t.includeParentDirs)return o;n.pop()}}function Xe(r){let e;return()=>(e===void 0&&(e=r().then(t=>(e=t,e))),e)}const qe=Xe(async()=>{if(globalThis.process?.versions?.webcontainer)return!1;try{let{exitCode:r}=await j("corepack",["--version"]);return r===0}catch{return!1}});async function Je(r,e,t={}){let n=r!=="npm"&&r!=="bun"&&r!=="deno"&&t.corepack!==!1&&await qe()?["corepack",[r,...e]]:[r,e],{exitCode:o,stdout:s,stderr:i}=await j(n[0],n[1],{nodeOptions:{cwd:f(t.cwd||process.cwd()),env:t.env,stdio:t.silent?"pipe":"inherit"}});if(o!==0)throw Error(`\`${n.flat().join(" ")}\` failed.${t.silent?["",s,i].join(`
2
+ `):""}`)}async function Ve(r={}){let e=r.cwd||process.cwd(),t={...process.env,...r.env},n=(typeof r.packageManager=="string"?v.find(o=>o.name===r.packageManager):r.packageManager)||await ie(r.cwd||process.cwd());if(!n)throw Error("No package manager auto-detected.");return{cwd:e,env:t,silent:r.silent??!1,packageManager:n,dev:r.dev??!1,workspace:r.workspace,global:r.global??!1,dry:r.dry??!1,corepack:r.corepack??!0}}function Ye(r){let[e,t]=(r||"").split("@"),[n,o]=t?.split("+")||[];if(e&&e!=="-"&&/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(e))return{name:e,version:n,buildMeta:o};let s=(e||"").replace(/\W+/g,"");return{name:s,version:n,buildMeta:o,warnings:[`Abnormal characters found in \`packageManager\` field, sanitizing from \`${e}\` to \`${s}\``]}}const v=[{name:"npm",command:"npm",lockFile:"package-lock.json"},{name:"pnpm",command:"pnpm",lockFile:"pnpm-lock.yaml",files:["pnpm-workspace.yaml"]},{name:"bun",command:"bun",lockFile:["bun.lockb","bun.lock"]},{name:"yarn",command:"yarn",lockFile:"yarn.lock",files:[".yarnrc.yml"]},{name:"deno",command:"deno",lockFile:"deno.lock",files:["deno.json"]}];async function ie(r,e={}){let t=await We(f(r||"."),async n=>{if(!e.ignorePackageJSON){let o=M(n,"package.json");if(m(o)){let s=JSON.parse(await q(o,"utf8"));if(s?.packageManager){let{name:i,version:a="0.0.0",buildMeta:c,warnings:d}=Ye(s.packageManager);if(i){let l=a.split(".")[0],h=v.find(p=>p.name===i&&p.majorVersion===l)||v.find(p=>p.name===i);return{name:i,command:i,version:a,majorVersion:l,buildMeta:c,warnings:d,files:h?.files,lockFile:h?.lockFile}}}}if(m(M(n,"deno.json")))return v.find(s=>s.name==="deno")}if(!e.ignoreLockFile){for(let o of v)if([o.lockFile,o.files].flat().filter(Boolean).some(s=>m(f(n,s))))return{...o}}},{includeParentDirs:e.includeParentDirs??!0});if(!t&&!e.ignoreArgv){let n=process.argv[1];if(n){for(let o of v)if(RegExp(`[/\\\\]\\.?${o.command}`).test(n))return o}}return t}async function Ze(r={}){let e=await Ve(r),t=r.frozenLockFile?{npm:["ci"],yarn:["install","--immutable"],bun:["install","--frozen-lockfile"],pnpm:["install","--frozen-lockfile"],deno:["install","--frozen"]}[e.packageManager.name]:["install"];return r.ignoreWorkspace&&e.packageManager.name==="pnpm"&&t.push("--ignore-workspace"),e.dry||await Je(e.packageManager.command,t,{cwd:e.cwd,silent:e.silent,corepack:e.corepack}),{exec:{command:e.packageManager.command,args:t}}}const Ke=Object.defineProperty({__proto__:null,basename:oe,dirname:ne,dist_exports:Le,resolve:f},Symbol.toStringTag,{value:"Module"});async function Qe(r,e,t={}){const n=e+".json",o=JSON.parse(await q(n,"utf8").catch(()=>"{}")),s=(await E(r,{method:"HEAD",headers:t.headers}).catch(()=>{}))?.headers.get("etag");if(o.etag===s&&m(e))return;typeof s=="string"&&(o.etag=s);const i=await E(r,{headers:t.headers});if(i.status>=400)throw new Error(`Failed to download ${r}: ${i.status} ${i.statusText}`);const a=X(e);await ke($e)(i.body,a),await ge(n,JSON.stringify(o),"utf8")}const et=/^(?<repo>[-\w.]+\/[-\w.]+)(?<subdir>[^#]+)?(?<ref>#[-\w./@]+)?/,tt=/^(?<repo>[-\w.]+(?:\/[-\w.]+)+?)(?:::(?<subdir>[^#]*))?(?<ref>#[-\w./@]+)?$/;function O(r,e){const t=e?.expandRepo||r.includes("::"),n=r.match(t?tt:et)?.groups||{},o=t?n.subdir?"/"+n.subdir:"/":n.subdir||"/";return{repo:n.repo||"",subdir:o,ref:n.ref?n.ref.slice(1):"main"}}function $(...r){process.env.DEBUG&&console.debug("[giget]",...r)}async function E(r,e={}){e.headers?.["sec-fetch-mode"]&&(e.mode=e.headers["sec-fetch-mode"]);const t=await fetch(r,{...e,headers:ae(e.headers)}).catch(n=>{throw new Error(`Failed to download ${r}: ${n}`,{cause:n})});if(e.validateStatus&&t.status>=400)throw new Error(`Failed to fetch ${r}: ${t.status} ${t.statusText}`);return t}function rt(){const r=process.env.XDG_CACHE_HOME?f(process.env.XDG_CACHE_HOME,"giget"):f(ye(),".cache/giget");if(process.platform==="win32"){const e=f(Q(),"giget");if(!m(e)&&m(r))try{me(r,e)}catch{}return e}return r}function ae(r={}){const e={};for(const[t,n]of Object.entries(r))n&&(e[t.toLowerCase()]=n);return e}const nt=(r,e)=>{const t=ot(r);return{name:t.name,version:t.subdir?`${t.version||"default"}-${t.subdir.replaceAll("/","-")}`:t.version,tar:({auth:n}={})=>st(t,n??e.auth)}};function ot(r,e={}){const t=e.cwd??process.cwd();let n=r.replace(/#.*$/,""),o;if(/^[./]/.test(r))n=f(t,n);else if(/^https?:\/\//.test(n)){const l=/^(https?:\/\/[^/]+)\/([\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(l){const[,h,p,g]=l;n=`${h}/${p}`,g&&(o=g)}}else if(n.includes("@")){const l=/^(.*?:[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(l){const[,h,p]=l;n=h,p&&(o=p)}}else{const l={"github:":"https://github.com/","gh:":"https://github.com/","gitlab:":"https://gitlab.com/","bitbucket:":"https://bitbucket.org/","sourcehut:":"https://git.sr.ht/~"},h=/^(.+?:)/.exec(n)?.at(1);h&&l[h]?n=n.replace(h,l[h]):h||(n=`${(process.env.GIGET_GIT_HOST||"https://github.com/").replace(/\/$/,"")}/${n}`);const p=/^(https?:\/\/[^/]+\/~?[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(p){const[,g,u]=p;n=g,u&&(o=u)}}const s=n.replace(/^https?:\/\//,"").replace(/^.+@/,"").replace(/(\.git)?(#.*)?$/,"").replace(/^\W+/,"").replaceAll(/[:/]/g,"-"),[i,a]=/#(.+)$/.exec(r)?.at(1)?.split(":")??[],c=i||void 0,d=a||o;return{uri:n,name:s,...c&&{version:c},...d&&{subdir:d}}}async function st(r,e){const t=await we(I(Q(),"giget-git-"));if(e&&/[\r\n]/.test(e))throw new Error("Auth token must not contain newline characters");const n={...process.env,GIT_TERMINAL_PROMPT:"0"};e&&(n.GIT_CONFIG_COUNT="1",n.GIT_CONFIG_KEY_0="http.extraHeader",n.GIT_CONFIG_VALUE_0=`Authorization: Bearer ${e}`);const o={env:n,timeout:6e4},s=it(),i=c=>R(c,o,s),a=c=>R(c,{...o,cwd:t},s);try{const c=["clone","--progress","--depth","1"];r.subdir&&c.push("--filter=blob:none","--sparse","--no-checkout"),r.version&&c.push("--branch",r.version),c.push("--",r.uri,t);try{s.update("Cloning..."),await i(c),s.update("Cloned.")}catch(u){if(!r.version)throw u;$("Shallow clone failed, falling back to full clone:",u),s.update("Shallow clone failed, cloning..."),await x(t,{recursive:!0,force:!0}),await S(t,{recursive:!0}),await a(["init"]),await a(["remote","add","origin",r.uri]),await a(["fetch","origin"]),await a(["checkout",r.version]),s.update("Fetched.")}r.subdir&&(s.update(`Sparse checkout ${r.subdir}...`),await a(["sparse-checkout","set",r.subdir]),await a(["checkout"])),s.update("Packing...");const d=r.subdir?I(t,r.subdir):t,{create:l}=await import("../packem_chunks/tar.js").then(u=>u.index_min_exports);s.done();const h=l({gzip:!0,cwd:d,filter:u=>!u.startsWith(".git/")&&u!==".git"&&!u.startsWith("./.git/")&&u!=="./.git"},["."]).pipe(new J);let p=!1;const g=()=>{p||(p=!0,x(t,{recursive:!0,force:!0}))};return h.on("end",g),h.on("error",g),h.on("close",g),h}catch(c){throw s.done(),await x(t,{recursive:!0,force:!0}),c}}const N=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function R(r,e,t){return new Promise((n,o)=>{const s=Y("git",r,{...e,stdio:["ignore","pipe","pipe"]});s.stdout.resume();let i="";s.stderr?.on("data",a=>{const c=a.toString();for(const d of c.split(/[\r\n]/)){const l=d.trim();l&&(i=l)}t&&t.update(i)}),s.on("close",a=>{a===0?n(i):o(new Error(`git ${r[0]} exited with code ${a}. Is git installed?`))}),s.on("error",a=>{a.code==="ENOENT"?o(new Error("git is not installed or not found in PATH")):o(a)})})}function it(){if(!process.stderr.isTTY)return{update(o){},done(){}};let r="",e=0;const t=()=>{const o=N[e%N.length];e++,process.stderr.write(`\x1B[2K\r\x1B[2m${o} ${r}\x1B[0m`)},n=setInterval(t,80);return{update(o){r=o,t()},done(){clearInterval(n),process.stderr.write("\x1B[2K\r")}}}const U=async(r,e)=>{if(r.endsWith(".json"))return await L(r,e);const t=new URL(r);let n=oe(t.pathname);try{const o=await E(t.href,{method:"HEAD",validateStatus:!0,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}});if((o.headers.get("content-type")||"").includes("application/json"))return await L(r,e);const s=o.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];s&&(n=s.split(".")[0])}catch(o){$(`Failed to fetch HEAD for ${t.href}:`,o)}return{name:`${n}-${t.href.slice(0,8)}`,version:"",subdir:"",tar:t.href,defaultDir:n,headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0}}},L=async(r,e)=>{const t=await(await E(r,{validateStatus:!0,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}})).json();if(!t.tar||!t.name)throw new Error(`Invalid template info from ${r}. name or tar fields are missing!`);return t},W=(r,e)=>{const t=O(r),n=process.env.GIGET_GITHUB_URL||"https://api.github.com";return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`${n.replace("api.github.com","github.com")}/${t.repo}/tree/${t.ref}${t.subdir}`,tar:`${n}/repos/${t.repo}/tarball/${t.ref}`}},at=(r,e)=>{const t=O(r,{expandRepo:!0}),n=process.env.GIGET_GITLAB_URL||"https://gitlab.com";return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0,"sec-fetch-mode":"same-origin"},url:`${n}/${t.repo}/tree/${t.ref}${t.subdir}`,tar:`${n}/${t.repo}/-/archive/${t.ref}.tar.gz`}},ct=(r,e)=>{const t=O(r);return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0},url:`https://bitbucket.com/${t.repo}/src/${t.ref}${t.subdir}`,tar:`https://bitbucket.org/${t.repo}/get/${t.ref}.tar.gz`}},lt=(r,e)=>{const t=O(r);return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0},url:`https://git.sr.ht/~${t.repo}/tree/${t.ref}/item${t.subdir}`,tar:`https://git.sr.ht/~${t.repo}/archive/${t.ref}.tar.gz`}},ut={http:U,https:U,git:nt,github:W,gh:W,gitlab:at,bitbucket:ct,sourcehut:lt},dt="https://raw.githubusercontent.com/unjs/giget/main/templates",pt=(r=dt,e={})=>(async t=>{const n=Date.now(),o=`${r}/${t}.json`,s=await E(o,{headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}});if(s.status>=400)throw new Error(`Failed to download ${t} template info from ${o}: ${s.status} ${s.statusText}`);const i=await s.json();if(!i.tar||!i.name)throw new Error(`Invalid template info from ${o}. name or tar fields are missing!`);return $(`Fetched ${t} template info from ${o} in ${Date.now()-n}ms`),i}),ht=/^([\w+-.]+):/;function ft(r){if(!r)return;if(typeof r=="function")return r;const e=globalThis.process.getBuiltinModule?.("node:path")?.matchesGlob;if(typeof e!="function")throw new TypeError("Ignore patterns require `path.matchesGlob` which is supported in Node.js v22.5.0, v20.17.0 or later.");return t=>r.some(n=>e(t,n))}async function $t(r,e={}){const t=ft(e.ignore);e.registry=process.env.GIGET_REGISTRY??e.registry,e.auth=process.env.GIGET_AUTH??e.auth;const n=e.registry===!1?void 0:pt(e.registry,{auth:e.auth});let o=e.provider||(n?"registry":"github"),s=r;const i=r.match(ht);i&&(o=i[1],s=r.slice(i[0].length),(o==="http"||o==="https")&&(s=r)),o.endsWith("+git")&&(s=`${o.slice(0,-4)}:${s}`,o="git");const a=e.providers?.[o]||ut[o]||n;if(!a)throw new Error(`Unsupported provider: ${o}`);const c=await Promise.resolve().then(()=>a(s,{auth:e.auth})).catch(u=>{throw new Error(`Failed to download template from ${o}: ${u.message}`)});if(!c)throw new Error(`Failed to resolve template from ${o}`);c.name=(c.name||"template").replace(/[^\da-z-]/gi,"-"),c.defaultDir=(c.defaultDir||c.name).replace(/[^\da-z-]/gi,"-");const d=f(f(rt(),o,c.name),(c.version||c.name)+".tar.gz");if(e.preferOffline&&m(d)&&(e.offline=!0),!e.offline){await S(ne(d),{recursive:!0});const u=Date.now();if(typeof c.tar=="function"){const b=c.tar;await(async()=>{const _=await b({auth:e.auth});await V(_ instanceof z?_:z.fromWeb(_),X(d))})().catch(_=>{if(!m(d))throw _;$("Download error. Using cached version:",_),e.offline=!0})}else await Qe(c.tar,d,{headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0,...ae(c.headers)}}).catch(b=>{if(!m(d))throw b;$("Download error. Using cached version:",b),e.offline=!0});$(`Downloaded to ${d} in ${Date.now()-u}ms`)}if(!m(d))throw new Error(`Tarball not found: ${d} (offline: ${e.offline})`);const l=f(f(e.cwd||"."),e.dir||c.defaultDir);if(e.forceClean&&await x(l,{recursive:!0,force:!0}),!e.force&&m(l)&&fe(l).length>0)throw new Error(`Destination ${l} already exists.`);await S(l,{recursive:!0});const h=Date.now(),p=c.subdir?.replace(/^\//,"")||"",{extract:g}=await import("../packem_chunks/tar.js").then(u=>u.index_min_exports);if(await g({file:d,cwd:l,onReadEntry(u){u.path=u.path.split("/").splice(1).join("/"),p&&(u.path.startsWith(p+"/")?u.path=u.path.slice(p.length):u.path=""),t&&u.path&&t(u.path.replace(/^\//,""))&&(u.path="")}}),$(`Extracted to ${l} in ${Date.now()-h}ms`),e.install){$("Installing dependencies...");const{installDependencies:u}=await Promise.resolve().then(()=>Ke).then(b=>b.dist_exports);await u({cwd:l,silent:e.silent,...typeof e.install=="object"?e.install:{}})}return{...c,source:s,dir:l}}export{$t as f,Ee as l};
@@ -0,0 +1 @@
1
+ import{W as o}from"./index-BDmTbWX1.js";const r=async(s,a)=>await o(s,a);export{r as s};
@@ -0,0 +1,19 @@
1
+ import{createRequire as Dr}from"node:module";const Ir=Dr(import.meta.url),Et=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pr=t=>{if(typeof Et<"u"&&Et.versions&&Et.versions.node){const[e,r]=Et.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Et.getBuiltinModule(t)}return Ir(t)},{createRequire:B}=Pr("node:module"),_e=0,Fr=4,Gr=Symbol("findUpStop"),Ji=/"(?:[^"\\]|\\.)*"|\/\/[^\r\n]*|\/\*[\s\S]*?\*\//g,Ur=/^[A-Z]:\//i,vt=(t="")=>t&&t.replaceAll("\\","/").replace(Ur,e=>e.toUpperCase()),jr=/^[/\\]{2}/,zr=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,cr=/^[A-Z]:$/i,Le=/^\/([A-Z]:)?$/i,Wr=/.(\.[^./]+)$/,qr=/^[/\\]|^[a-z]:[/\\]/i,Kr=/\/$/,Xr=()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/",tu="/",pr=(t,e)=>{let r="",o=0,n=-1,s=0,i;for(let u=0;u<=t.length;++u){if(u<t.length)i=t[u];else{if(i==="/")break;i="/"}if(i==="/"){if(!(n===u-1||s===1))if(s===2){if(r.length<2||o!==2||!r.endsWith(".")||r.at(-2)!=="."){if(r.length>2){const a=r.lastIndexOf("/");a===-1?(r="",o=0):(r=r.slice(0,a),o=r.length-1-r.lastIndexOf("/")),n=u,s=0;continue}else if(r.length>0){r="",o=0,n=u,s=0;continue}}e&&(r+=r.length>0?"/..":"..",o=2)}else r.length>0?r+=`/${t.slice(n+1,u)}`:r=t.slice(n+1,u),o=u-n-1;n=u,s=0}else i==="."&&s!==-1?++s:s=-1}return r},bt=t=>zr.test(t),ae=function(t){if(t.length===0)return".";t=vt(t);const e=jr.exec(t),r=bt(t),o=t.at(-1)==="/";return t=pr(t,!r),t.length===0?r?"/":o?"./":".":(o&&(t+="/"),cr.test(t)&&(t+="/"),e?r?`//${t}`:`//./${t}`:r&&!bt(t)?`/${t}`:t)},Qr=(...t)=>{let e="";for(const r of t)if(r)if(e.length>0){const o=e.at(-1)==="/",n=r[0]==="/";o&&n?e+=r.slice(1):e+=o||n?r:`/${r}`}else e+=r;return ae(e)},$t=function(...t){t=t.map(o=>vt(o));let e="",r=!1;for(let o=t.length-1;o>=-1&&!r;o--){const n=o>=0?t[o]:Xr();!n||n.length===0||(e=`${n}/${e}`,r=bt(n))}return e=pr(e,!r),r&&!bt(e)?`/${e}`:e.length>0?e:"."},Zr=function(t){return Wr.exec(vt(t))?.[1]??""},eu=function(t,e){const r=$t(t).replace(Le,"$1").split("/"),o=$t(e).replace(Le,"$1").split("/");if(o[0][1]===":"&&r[0][1]===":"&&r[0]!==o[0])return o.join("/");const n=Math.min(r.length,o.length);let s=0;for(;s<n&&r[s]===o[s];)s+=1;const i=r.length-s;return[...Array.from({length:i}).fill(".."),...o.slice(s)].join("/")},ke=t=>{const e=vt(t).replace(Kr,""),r=e.lastIndexOf("/");if(r===-1)return bt(t)?"/":".";const o=e.slice(0,r);return cr.test(o)?`${o}/`:o||(bt(t)?"/":".")},fr=(t,e)=>{const r=vt(t),o=r.slice(r.lastIndexOf("/")+1);if(e&&o.endsWith(e)){if(e===r)return"";const n=o.slice(0,-e.length);if(n.length>0)return n}return o},Yr=function(t){const e=qr.exec(t)?.[0]?.replaceAll("\\","/")??"",r=fr(t),o=Zr(r);return{base:r,dir:ke(t),ext:o,name:r.slice(0,r.length-o.length),root:e}},Vr=B(import.meta.url),xt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Jr=t=>{if(typeof xt<"u"&&xt.versions&&xt.versions.node){const[e,r]=xt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return xt.getBuiltinModule(t)}return Vr(t)},{fileURLToPath:ts}=Jr("node:url");function es(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var He,Be;function rs(){return Be||(Be=1,He=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),He}var ss=rs();const os=es(ss);new Set(os);const ct=t=>vt(t instanceof URL?ts(t):t);let ns=class extends Error{constructor(e){super(`EEXIST: ${e}`)}get code(){return"EEXIST"}set code(e){throw new Error("Cannot overwrite code EEXIST")}get name(){return"AlreadyExistsError"}set name(e){throw new Error("Cannot overwrite name of AlreadyExistsError")}};const pt=t=>{if(!t||!(t instanceof URL)&&typeof t!="string")throw new TypeError("Path must be a non-empty string or URL.")},is=B(import.meta.url),At=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,us=t=>{if(typeof At<"u"&&At.versions&&At.versions.node){const[e,r]=At.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return At.getBuiltinModule(t)}return is(t)};us("node:fs/promises");const ls=B(import.meta.url),St=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,as=t=>{if(typeof St<"u"&&St.versions&&St.versions.node){const[e,r]=St.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return St.getBuiltinModule(t)}return ls(t)};as("node:fs");const ce=t=>{if(t.isFile())return"file";if(t.isDirectory())return"dir";if(t.isSymbolicLink())return"symlink"},cs=B(import.meta.url),wt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ps=t=>{if(typeof wt<"u"&&wt.versions&&wt.versions.node){const[e,r]=wt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return wt.getBuiltinModule(t)}return cs(t)},{lstat:Me,mkdir:fs}=ps("node:fs/promises"),su=async t=>{pt(t);try{const e=await Me(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(ce(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await fs(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const r=await Me(t);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(ce(r))}'`,{cause:e})}},hs=B(import.meta.url),Rt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,gs=t=>{if(typeof Rt<"u"&&Rt.versions&&Rt.versions.node){const[e,r]=Rt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Rt.getBuiltinModule(t)}return hs(t)},{lstatSync:De,mkdirSync:ds}=gs("node:fs"),ou=t=>{pt(t);try{const e=De(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(ce(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{ds(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const r=De(t);if(!r.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(ce(r))}'`,{cause:e})}},ys=B(import.meta.url),Tt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ms=t=>{if(typeof Tt<"u"&&Tt.versions&&Tt.versions.node){const[e,r]=Tt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Tt.getBuiltinModule(t)}return ys(t)};ms("node:fs/promises");const bs=B(import.meta.url),_t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$s=t=>{if(typeof _t<"u"&&_t.versions&&_t.versions.node){const[e,r]=_t.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return _t.getBuiltinModule(t)}return bs(t)};$s("node:fs");const vs=B(import.meta.url),kt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Es=t=>{if(typeof kt<"u"&&kt.versions&&kt.versions.node){const[e,r]=kt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return kt.getBuiltinModule(t)}return vs(t)};Es("node:fs/promises");const xs=B(import.meta.url),Ct=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,As=t=>{if(typeof Ct<"u"&&Ct.versions&&Ct.versions.node){const[e,r]=Ct.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Ct.getBuiltinModule(t)}return xs(t)};As("node:fs");const Ss=B(import.meta.url),Ot=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ws=t=>{if(typeof Ot<"u"&&Ot.versions&&Ot.versions.node){const[e,r]=Ot.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Ot.getBuiltinModule(t)}return Ss(t)};ws("node:fs/promises");const Rs=B(import.meta.url),Nt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ts=t=>{if(typeof Nt<"u"&&Nt.versions&&Nt.versions.node){const[e,r]=Nt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Nt.getBuiltinModule(t)}return Rs(t)};Ts("node:fs");B(import.meta.url);let Ie=class extends Error{root;constructor(e,r){super(`${e instanceof Error?e.message:String(e)} for path "${r}"`),this.cause=e,this.root=r}get name(){return"WalkError"}set name(e){throw new Error("Cannot overwrite name of WalkError")}};const Pe=t=>{const e=t.replace(/[$()+\\^]/g,String.raw`\$&`).replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,String.raw`\.`).replace(/\{/g,"(").replace(/\}/g,")").replace(/,/g,"|").replace(/\[!(.*?)\]/g,"[^$1]");try{return new RegExp(`^${e}$`)}catch(r){throw new Error(`Invalid glob pattern: ${t}`,{cause:r})}};let _s=class{name;path;#t;constructor(e,r,o){this.#t=e,this.name=r,this.path=o}isDirectory(){return this.#t.isDirectory()}isFile(){return this.#t.isFile()}isSymbolicLink(){return this.#t.isSymbolicLink()}};const we=(t,e,r)=>new _s(t,e,r),le=(t,e,r,o)=>{if(Array.isArray(e)&&e.length>0&&!e.some(s=>t.endsWith(s)))return!1;const n=t.includes("\\")?t.replaceAll("\\","/"):t;return r&&!r.some(s=>s.test(n))?!1:!o?.some(s=>s.test(n))},ks=B(import.meta.url),Lt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Cs=t=>{if(typeof Lt<"u"&&Lt.versions&&Lt.versions.node){const[e,r]=Lt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Lt.getBuiltinModule(t)}return ks(t)};Cs("node:fs/promises");const Os=B(import.meta.url),Ht=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ns=t=>{if(typeof Ht<"u"&&Ht.versions&&Ht.versions.node){const[e,r]=Ht.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Ht.getBuiltinModule(t)}return Os(t)},{readdirSync:Ls,realpathSync:Hs,statSync:hr}=Ns("node:fs"),Bs=t=>{const e=ae(t),r=hr(e);return we(r,fr(e),e)};function*Ms(t,e={}){const{extensions:r,followSymlinks:o=!1,includeDirs:n=!0,includeFiles:s=!0,includeSymlinks:i=!0,match:u,maxDepth:a=Number.POSITIVE_INFINITY,skip:b}=e;if(pt(t),a<0)return;const h=e.visited??new Set,y=u?u.map(g=>typeof g=="string"?Pe(g):g):void 0,x=b?b.map(g=>typeof g=="string"?Pe(g):g):void 0;if(t=$t(ct(t)),n&&le(t,r,y,x)&&(yield Bs(t)),!(a<1||!le(t,void 0,void 0,x)))try{const g=Ls(t,{withFileTypes:!0});for(const $ of g){let _=Qr(t,$.name),R=$.isDirectory(),O=$.isFile();if($.isSymbolicLink())if(o){const d=Hs(_);if(h.has(d))continue;_=d;const E=hr(d);R=E.isDirectory(),O=E.isFile()}else if(i&&le(_,r,y,x)){yield we($,$.name,ae(_));continue}else continue;R?(o&&h.add(_),yield*Ms(_,{extensions:r,followSymlinks:o,includeDirs:n,includeFiles:s,includeSymlinks:i,match:y,maxDepth:a-1,skip:x,visited:h})):O&&s&&le(_,r,y,x)&&(yield we($,$.name,ae(_)))}}catch(g){throw g instanceof Ie?g:new Ie(g,t)}}const Ds=B(import.meta.url),Bt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Is=t=>{if(typeof Bt<"u"&&Bt.versions&&Bt.versions.node){const[e,r]=Bt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Bt.getBuiltinModule(t)}return Ds(t)};Is("node:fs/promises");const Ps=B(import.meta.url),Mt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Fs=t=>{if(typeof Mt<"u"&&Mt.versions&&Mt.versions.node){const[e,r]=Mt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Mt.getBuiltinModule(t)}return Ps(t)},{statSync:Gs,lstatSync:Us}=Fs("node:fs"),uu=(t,e={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const r=e.cwd?ct(e.cwd):process.cwd();let o=$t(r);const{root:n}=Yr(o),s=ct(e.stopAt??n),i=$t(o,s),u=e.type??"file",a=function(h){return typeof t=="function"?[t(h)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};e.allowSymlinks??=!0;const b=e.allowSymlinks?Gs:Us;for(;o&&o!==i&&o!==n;){for(let h of a(o)){if(h===Gr)return;if(h===void 0)continue;Buffer.isBuffer(h)?h=h.toString():h instanceof URL&&(h=ct(h));const y=bt(h)?h:$t(o,h);try{const x=b(y);if(u==="file"&&x.isFile()||u==="directory"&&x.isDirectory())return y}catch{}}o=ke(o)}};function Ce(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Fe={},ge,Ge;function pe(){if(Ge)return ge;Ge=1;const t="[^\\\\/]",e=Symbol("unignore"),r="\\.",o="\\+",n="\\?",s="\\/",i="(?=.)",u="[^/]",a=`(?:${s}|$)`,b=`(?:^|${s})`,h=`${r}{1,2}${a}`,y=`(?!${r})`,x=`(?!${b}${h})`,g=`(?!${r}{0,1}${a})`,$=`(?!${h})`,_=`[^.${s}]`,R=`${u}*?`,O="/",d={DOT_LITERAL:r,PLUS_LITERAL:o,QMARK_LITERAL:n,SLASH_LITERAL:s,ONE_CHAR:i,QMARK:u,END_ANCHOR:a,DOTS_SLASH:h,NO_DOT:y,NO_DOTS:x,NO_DOT_SLASH:g,NO_DOTS_SLASH:$,QMARK_NO_DOT:_,STAR:R,START_ANCHOR:b,SEP:O},E={...d,SLASH_LITERAL:"[\\\\/]",QMARK:t,STAR:`${t}*?`,DOTS_SLASH:`${r}{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!${r})`,NO_DOTS:`(?!(?:^|[\\\\/])${r}{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!${r}{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!${r}{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},l={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return ge={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:l,UNIGNORE:e,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(A){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${A.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(A){return A===!0?E:d}},ge}var Ue;function fe(){return Ue||(Ue=1,(function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:r,REGEX_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_GLOBAL:n}=pe();t.isObject=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),t.hasRegexChars=s=>o.test(s),t.isRegexChar=s=>s.length===1&&t.hasRegexChars(s),t.escapeRegex=s=>s.replace(n,"\\$1"),t.toPosixSlashes=s=>s.replace(e,"/"),t.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const s=navigator.platform.toLowerCase();return s==="win32"||s==="windows"}return process.platform?process.platform==="win32":!1},t.removeBackslashes=s=>s.replace(r,i=>i==="\\"?"":i),t.escapeLast=(s,i,u)=>{const a=s.lastIndexOf(i,u);return a===-1?s:s[a-1]==="\\"?t.escapeLast(s,i,a-1):`${s.slice(0,a)}\\${s.slice(a)}`},t.removePrefix=(s,i={})=>{let u=s;return u.startsWith("./")&&(u=u.slice(2),i.prefix="./"),u},t.wrapOutput=(s,i={},u={})=>{const a=u.contains?"":"^",b=u.contains?"":"$";let h=`${a}(?:${s})${b}`;return i.negated===!0&&(h=`(?:^(?!${h}).*$)`),h},t.basename=(s,{windows:i}={})=>{const u=s.split(i?/[\\/]/:"/"),a=u[u.length-1];return a===""?u[u.length-2]:a}})(Fe)),Fe}var de,je;function js(){if(je)return de;je=1;const t=fe(),{CHAR_ASTERISK:e,CHAR_AT:r,CHAR_BACKWARD_SLASH:o,CHAR_COMMA:n,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:i,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:a,CHAR_LEFT_PARENTHESES:b,CHAR_LEFT_SQUARE_BRACKET:h,CHAR_PLUS:y,CHAR_QUESTION_MARK:x,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:$,CHAR_RIGHT_SQUARE_BRACKET:_}=pe(),R=d=>d===u||d===o,O=d=>{d.isPrefix!==!0&&(d.depth=d.isGlobstar?1/0:1)};return de=(d,E)=>{const l=E||{},A=d.length-1,w=l.parts===!0||l.scanToEnd===!0,T=[],S=[],k=[];let F=d,D=-1,U=0,rt=0,Z=!1,st=!1,j=!1,lt=!1,gt=!1,ot=!1,P=!1,nt=!1,dt=!1,Y=!1,Q=0,J,C,H={value:"",depth:0,isGlob:!1};const f=()=>D>=A,V=()=>F.charCodeAt(D+1),K=()=>(J=C,F.charCodeAt(++D));for(;D<A;){C=K();let M;if(C===o){P=H.backslashes=!0,C=K(),C===a&&(ot=!0);continue}if(ot===!0||C===a){for(Q++;f()!==!0&&(C=K());){if(C===o){P=H.backslashes=!0,K();continue}if(C===a){Q++;continue}if(ot!==!0&&C===s&&(C=K())===s){if(Z=H.isBrace=!0,j=H.isGlob=!0,Y=!0,w===!0)continue;break}if(ot!==!0&&C===n){if(Z=H.isBrace=!0,j=H.isGlob=!0,Y=!0,w===!0)continue;break}if(C===g&&(Q--,Q===0)){ot=!1,Z=H.isBrace=!0,Y=!0;break}}if(w===!0)continue;break}if(C===u){if(T.push(D),S.push(H),H={value:"",depth:0,isGlob:!1},Y===!0)continue;if(J===s&&D===U+1){U+=2;continue}rt=D+1;continue}if(l.noext!==!0&&(C===y||C===r||C===e||C===x||C===i)&&V()===b){if(j=H.isGlob=!0,lt=H.isExtglob=!0,Y=!0,C===i&&D===U&&(dt=!0),w===!0){for(;f()!==!0&&(C=K());){if(C===o){P=H.backslashes=!0,C=K();continue}if(C===$){j=H.isGlob=!0,Y=!0;break}}continue}break}if(C===e){if(J===e&&(gt=H.isGlobstar=!0),j=H.isGlob=!0,Y=!0,w===!0)continue;break}if(C===x){if(j=H.isGlob=!0,Y=!0,w===!0)continue;break}if(C===h){for(;f()!==!0&&(M=K());){if(M===o){P=H.backslashes=!0,K();continue}if(M===_){st=H.isBracket=!0,j=H.isGlob=!0,Y=!0;break}}if(w===!0)continue;break}if(l.nonegate!==!0&&C===i&&D===U){nt=H.negated=!0,U++;continue}if(l.noparen!==!0&&C===b){if(j=H.isGlob=!0,w===!0){for(;f()!==!0&&(C=K());){if(C===b){P=H.backslashes=!0,C=K();continue}if(C===$){Y=!0;break}}continue}break}if(j===!0){if(Y=!0,w===!0)continue;break}}l.noext===!0&&(lt=!1,j=!1);let q=F,c="",p="";U>0&&(c=F.slice(0,U),F=F.slice(U),rt-=U),q&&j===!0&&rt>0?(q=F.slice(0,rt),p=F.slice(rt)):j===!0?(q="",p=F):q=F,q&&q!==""&&q!=="/"&&q!==F&&R(q.charCodeAt(q.length-1))&&(q=q.slice(0,-1)),l.unescape===!0&&(p&&(p=t.removeBackslashes(p)),q&&P===!0&&(q=t.removeBackslashes(q)));const et={prefix:c,input:d,start:U,base:q,glob:p,isBrace:Z,isBracket:st,isGlob:j,isExtglob:lt,isGlobstar:gt,negated:nt,negatedExtglob:dt};if(l.tokens===!0&&(et.maxDepth=0,R(C)||S.push(H),et.tokens=S),l.parts===!0||l.tokens===!0){let M;for(let z=0;z<T.length;z++){const at=M?M+1:U,tt=T[z],ft=d.slice(at,tt);l.tokens&&(z===0&&U!==0?(S[z].isPrefix=!0,S[z].value=c):S[z].value=ft,O(S[z]),et.maxDepth+=S[z].depth),(z!==0||ft!=="")&&k.push(ft),M=tt}if(M&&M+1<d.length){const z=d.slice(M+1);k.push(z),l.tokens&&(S[S.length-1].value=z,O(S[S.length-1]),et.maxDepth+=S[S.length-1].depth)}et.slashes=T,et.parts=k}return et},de}var ye,ze;function zs(){if(ze)return ye;ze=1;const t=pe(),e=fe(),{MAX_LENGTH:r,POSIX_REGEX_SOURCE:o,REGEX_NON_SPECIAL_CHARS:n,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:i}=t,u=(d,E)=>typeof E.expandRange=="function"?E.expandRange(...d,E):(d.sort(),`[${d.join("-")}]`),a=(d,E)=>`Missing ${d}: "${E}" - use "\\\\${E}" to match literal characters`,b=d=>{const E=[];let l=0,A=0,w=0,T="",S=!1;for(const k of d){if(S===!0){T+=k,S=!1;continue}if(k==="\\"){T+=k,S=!0;continue}if(k==='"'){w=w===1?0:1,T+=k;continue}if(w===0){if(k==="[")l++;else if(k==="]"&&l>0)l--;else if(l===0){if(k==="(")A++;else if(k===")"&&A>0)A--;else if(k==="|"&&A===0){E.push(T),T="";continue}}}T+=k}return E.push(T),E},h=d=>{let E=!1;for(const l of d){if(E===!0){E=!1;continue}if(l==="\\"){E=!0;continue}if(/[?*+@!()[\]{}]/.test(l))return!1}return!0},y=d=>{let E=d.trim(),l=!0;for(;l===!0;)l=!1,/^@\([^\\()[\]{}|]+\)$/.test(E)&&(E=E.slice(2,-1),l=!0);if(h(E))return E.replace(/\\(.)/g,"$1")},x=d=>{const E=d.map(y).filter(Boolean);for(let l=0;l<E.length;l++)for(let A=l+1;A<E.length;A++){const w=E[l],T=E[A],S=w[0];if(!(!S||w!==S.repeat(w.length)||T!==S.repeat(T.length))&&(w===T||w.startsWith(T)||T.startsWith(w)))return!0}return!1},g=(d,E=!0)=>{if(d[0]!=="+"&&d[0]!=="*"||d[1]!=="(")return;let l=0,A=0,w=0,T=!1;for(let S=1;S<d.length;S++){const k=d[S];if(T===!0){T=!1;continue}if(k==="\\"){T=!0;continue}if(k==='"'){w=w===1?0:1;continue}if(w!==1){if(k==="["){l++;continue}if(k==="]"&&l>0){l--;continue}if(!(l>0)){if(k==="("){A++;continue}if(k===")"&&(A--,A===0))return E===!0&&S!==d.length-1?void 0:{type:d[0],body:d.slice(2,S),end:S}}}}},$=d=>{let E=0;const l=[];for(;E<d.length;){const A=g(d.slice(E),!1);if(!A||A.type!=="*")return;const w=b(A.body).map(S=>S.trim());if(w.length!==1)return;const T=y(w[0]);if(!T||T.length!==1)return;l.push(T),E+=A.end+1}return l.length<1?void 0:`${l.length===1?e.escapeRegex(l[0]):`[${l.map(A=>e.escapeRegex(A)).join("")}]`}*`},_=d=>{let E=0,l=d.trim(),A=g(l);for(;A;)E++,l=A.body.trim(),A=g(l);return E},R=(d,E)=>{if(E.maxExtglobRecursion===!1)return{risky:!1};const l=typeof E.maxExtglobRecursion=="number"?E.maxExtglobRecursion:t.DEFAULT_MAX_EXTGLOB_RECURSION,A=b(d).map(w=>w.trim());if(A.length>1&&(A.some(w=>w==="")||A.some(w=>/^[*?]+$/.test(w))||x(A)))return{risky:!0};for(const w of A){const T=$(w);if(T)return{risky:!0,safeOutput:T};if(_(w)>l)return{risky:!0}}return{risky:!1}},O=(d,E)=>{if(typeof d!="string")throw new TypeError("Expected a string");d=i[d]||d;const l={...E},A=typeof l.maxLength=="number"?Math.min(r,l.maxLength):r;let w=d.length;if(w>A)throw new SyntaxError(`Input length: ${w}, exceeds maximum allowed length: ${A}`);const T={type:"bos",value:"",output:l.prepend||""},S=[T],k=l.capture?"":"?:",F=t.globChars(l.windows),D=t.extglobChars(F),{DOT_LITERAL:U,PLUS_LITERAL:rt,SLASH_LITERAL:Z,ONE_CHAR:st,DOTS_SLASH:j,NO_DOT:lt,NO_DOT_SLASH:gt,NO_DOTS_SLASH:ot,QMARK:P,QMARK_NO_DOT:nt,STAR:dt,START_ANCHOR:Y}=F,Q=v=>`(${k}(?:(?!${Y}${v.dot?j:U}).)*?)`,J=l.dot?"":lt,C=l.dot?P:nt;let H=l.bash===!0?Q(l):dt;l.capture&&(H=`(${H})`),typeof l.noext=="boolean"&&(l.noextglob=l.noext);const f={input:d,index:-1,start:0,dot:l.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:S};d=e.removePrefix(d,f),w=d.length;const V=[],K=[],q=[];let c=T,p;const et=()=>f.index===w-1,M=f.peek=(v=1)=>d[f.index+v],z=f.advance=()=>d[++f.index]||"",at=()=>d.slice(f.index+1),tt=(v="",G=0)=>{f.consumed+=v,f.index+=G},ft=v=>{f.output+=v.output!=null?v.output:v.value,tt(v.value)},Br=()=>{let v=1;for(;M()==="!"&&(M(2)!=="("||M(3)==="?");)z(),f.start++,v++;return v%2===0?!1:(f.negated=!0,f.start++,!0)},ie=v=>{f[v]++,q.push(v)},ht=v=>{f[v]--,q.pop()},N=v=>{if(c.type==="globstar"){const G=f.braces>0&&(v.type==="comma"||v.type==="brace"),m=v.extglob===!0||V.length&&(v.type==="pipe"||v.type==="paren");v.type!=="slash"&&v.type!=="paren"&&!G&&!m&&(f.output=f.output.slice(0,-c.output.length),c.type="star",c.value="*",c.output=H,f.output+=c.output)}if(V.length&&v.type!=="paren"&&(V[V.length-1].inner+=v.value),(v.value||v.output)&&ft(v),c&&c.type==="text"&&v.type==="text"){c.output=(c.output||c.value)+v.value,c.value+=v.value;return}v.prev=c,S.push(v),c=v},ue=(v,G)=>{const m={...D[G],conditions:1,inner:""};m.prev=c,m.parens=f.parens,m.output=f.output,m.startIndex=f.index,m.tokensIndex=S.length;const L=(l.capture?"(":"")+m.open;ie("parens"),N({type:v,value:G,output:f.output?"":st}),N({type:"paren",extglob:!0,value:z(),output:L}),V.push(m)},Mr=v=>{const G=d.slice(v.startIndex,f.index+1),m=d.slice(v.startIndex+2,f.index),L=R(m,l);if((v.type==="plus"||v.type==="star")&&L.risky){const I=L.safeOutput?(v.output?"":st)+(l.capture?`(${L.safeOutput})`:L.safeOutput):void 0,it=S[v.tokensIndex];it.type="text",it.value=G,it.output=I||e.escapeRegex(G);for(let ut=v.tokensIndex+1;ut<S.length;ut++)S[ut].value="",S[ut].output="",delete S[ut].suffix;f.output=v.output+it.output,f.backtrack=!0,N({type:"paren",extglob:!0,value:p,output:""}),ht("parens");return}let W=v.close+(l.capture?")":""),X;if(v.type==="negate"){let I=H;if(v.inner&&v.inner.length>1&&v.inner.includes("/")&&(I=Q(l)),(I!==H||et()||/^\)+$/.test(at()))&&(W=v.close=`)$))${I}`),v.inner.includes("*")&&(X=at())&&/^\.[^\\/.]+$/.test(X)){const it=O(X,{...E,fastpaths:!1}).output;W=v.close=`)${it})${I})`}v.prev.type==="bos"&&(f.negatedExtglob=!0)}N({type:"paren",extglob:!0,value:p,output:W}),ht("parens")};if(l.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(d)){let v=!1,G=d.replace(s,(m,L,W,X,I,it)=>X==="\\"?(v=!0,m):X==="?"?L?L+X+(I?P.repeat(I.length):""):it===0?C+(I?P.repeat(I.length):""):P.repeat(W.length):X==="."?U.repeat(W.length):X==="*"?L?L+X+(I?H:""):H:L?m:`\\${m}`);return v===!0&&(l.unescape===!0?G=G.replace(/\\/g,""):G=G.replace(/\\+/g,m=>m.length%2===0?"\\\\":m?"\\":"")),G===d&&l.contains===!0?(f.output=d,f):(f.output=e.wrapOutput(G,f,E),f)}for(;!et();){if(p=z(),p==="\0")continue;if(p==="\\"){const m=M();if(m==="/"&&l.bash!==!0||m==="."||m===";")continue;if(!m){p+="\\",N({type:"text",value:p});continue}const L=/^\\+/.exec(at());let W=0;if(L&&L[0].length>2&&(W=L[0].length,f.index+=W,W%2!==0&&(p+="\\")),l.unescape===!0?p=z():p+=z(),f.brackets===0){N({type:"text",value:p});continue}}if(f.brackets>0&&(p!=="]"||c.value==="["||c.value==="[^")){if(l.posix!==!1&&p===":"){const m=c.value.slice(1);if(m.includes("[")&&(c.posix=!0,m.includes(":"))){const L=c.value.lastIndexOf("["),W=c.value.slice(0,L),X=c.value.slice(L+2),I=o[X];if(I){c.value=W+I,f.backtrack=!0,z(),!T.output&&S.indexOf(c)===1&&(T.output=st);continue}}}(p==="["&&M()!==":"||p==="-"&&M()==="]")&&(p=`\\${p}`),p==="]"&&(c.value==="["||c.value==="[^")&&(p=`\\${p}`),l.posix===!0&&p==="!"&&c.value==="["&&(p="^"),c.value+=p,ft({value:p});continue}if(f.quotes===1&&p!=='"'){p=e.escapeRegex(p),c.value+=p,ft({value:p});continue}if(p==='"'){f.quotes=f.quotes===1?0:1,l.keepQuotes===!0&&N({type:"text",value:p});continue}if(p==="("){ie("parens"),N({type:"paren",value:p});continue}if(p===")"){if(f.parens===0&&l.strictBrackets===!0)throw new SyntaxError(a("opening","("));const m=V[V.length-1];if(m&&f.parens===m.parens+1){Mr(V.pop());continue}N({type:"paren",value:p,output:f.parens?")":"\\)"}),ht("parens");continue}if(p==="["){if(l.nobracket===!0||!at().includes("]")){if(l.nobracket!==!0&&l.strictBrackets===!0)throw new SyntaxError(a("closing","]"));p=`\\${p}`}else ie("brackets");N({type:"bracket",value:p});continue}if(p==="]"){if(l.nobracket===!0||c&&c.type==="bracket"&&c.value.length===1){N({type:"text",value:p,output:`\\${p}`});continue}if(f.brackets===0){if(l.strictBrackets===!0)throw new SyntaxError(a("opening","["));N({type:"text",value:p,output:`\\${p}`});continue}ht("brackets");const m=c.value.slice(1);if(c.posix!==!0&&m[0]==="^"&&!m.includes("/")&&(p=`/${p}`),c.value+=p,ft({value:p}),l.literalBrackets===!1||e.hasRegexChars(m))continue;const L=e.escapeRegex(c.value);if(f.output=f.output.slice(0,-c.value.length),l.literalBrackets===!0){f.output+=L,c.value=L;continue}c.value=`(${k}${L}|${c.value})`,f.output+=c.value;continue}if(p==="{"&&l.nobrace!==!0){ie("braces");const m={type:"brace",value:p,output:"(",outputIndex:f.output.length,tokensIndex:f.tokens.length};K.push(m),N(m);continue}if(p==="}"){const m=K[K.length-1];if(l.nobrace===!0||!m){N({type:"text",value:p,output:p});continue}let L=")";if(m.dots===!0){const W=S.slice(),X=[];for(let I=W.length-1;I>=0&&(S.pop(),W[I].type!=="brace");I--)W[I].type!=="dots"&&X.unshift(W[I].value);L=u(X,l),f.backtrack=!0}if(m.comma!==!0&&m.dots!==!0){const W=f.output.slice(0,m.outputIndex),X=f.tokens.slice(m.tokensIndex);m.value=m.output="\\{",p=L="\\}",f.output=W;for(const I of X)f.output+=I.output||I.value}N({type:"brace",value:p,output:L}),ht("braces"),K.pop();continue}if(p==="|"){V.length>0&&V[V.length-1].conditions++,N({type:"text",value:p});continue}if(p===","){let m=p;const L=K[K.length-1];L&&q[q.length-1]==="braces"&&(L.comma=!0,m="|"),N({type:"comma",value:p,output:m});continue}if(p==="/"){if(c.type==="dot"&&f.index===f.start+1){f.start=f.index+1,f.consumed="",f.output="",S.pop(),c=T;continue}N({type:"slash",value:p,output:Z});continue}if(p==="."){if(f.braces>0&&c.type==="dot"){c.value==="."&&(c.output=U);const m=K[K.length-1];c.type="dots",c.output+=p,c.value+=p,m.dots=!0;continue}if(f.braces+f.parens===0&&c.type!=="bos"&&c.type!=="slash"){N({type:"text",value:p,output:U});continue}N({type:"dot",value:p,output:U});continue}if(p==="?"){if(!(c&&c.value==="(")&&l.noextglob!==!0&&M()==="("&&M(2)!=="?"){ue("qmark",p);continue}if(c&&c.type==="paren"){const m=M();let L=p;(c.value==="("&&!/[!=<:]/.test(m)||m==="<"&&!/<([!=]|\w+>)/.test(at()))&&(L=`\\${p}`),N({type:"text",value:p,output:L});continue}if(l.dot!==!0&&(c.type==="slash"||c.type==="bos")){N({type:"qmark",value:p,output:nt});continue}N({type:"qmark",value:p,output:P});continue}if(p==="!"){if(l.noextglob!==!0&&M()==="("&&(M(2)!=="?"||!/[!=<:]/.test(M(3)))){ue("negate",p);continue}if(l.nonegate!==!0&&f.index===0){Br();continue}}if(p==="+"){if(l.noextglob!==!0&&M()==="("&&M(2)!=="?"){ue("plus",p);continue}if(c&&c.value==="("||l.regex===!1){N({type:"plus",value:p,output:rt});continue}if(c&&(c.type==="bracket"||c.type==="paren"||c.type==="brace")||f.parens>0){N({type:"plus",value:p});continue}N({type:"plus",value:rt});continue}if(p==="@"){if(l.noextglob!==!0&&M()==="("&&M(2)!=="?"){N({type:"at",extglob:!0,value:p,output:""});continue}N({type:"text",value:p});continue}if(p!=="*"){(p==="$"||p==="^")&&(p=`\\${p}`);const m=n.exec(at());m&&(p+=m[0],f.index+=m[0].length),N({type:"text",value:p});continue}if(c&&(c.type==="globstar"||c.star===!0)){c.type="star",c.star=!0,c.value+=p,c.output=H,f.backtrack=!0,f.globstar=!0,tt(p);continue}let v=at();if(l.noextglob!==!0&&/^\([^?]/.test(v)){ue("star",p);continue}if(c.type==="star"){if(l.noglobstar===!0){tt(p);continue}const m=c.prev,L=m.prev,W=m.type==="slash"||m.type==="bos",X=L&&(L.type==="star"||L.type==="globstar");if(l.bash===!0&&(!W||v[0]&&v[0]!=="/")){N({type:"star",value:p,output:""});continue}const I=f.braces>0&&(m.type==="comma"||m.type==="brace"),it=V.length&&(m.type==="pipe"||m.type==="paren");if(!W&&m.type!=="paren"&&!I&&!it){N({type:"star",value:p,output:""});continue}for(;v.slice(0,3)==="/**";){const ut=d[f.index+4];if(ut&&ut!=="/")break;v=v.slice(3),tt("/**",3)}if(m.type==="bos"&&et()){c.type="globstar",c.value+=p,c.output=Q(l),f.output=c.output,f.globstar=!0,tt(p);continue}if(m.type==="slash"&&m.prev.type!=="bos"&&!X&&et()){f.output=f.output.slice(0,-(m.output+c.output).length),m.output=`(?:${m.output}`,c.type="globstar",c.output=Q(l)+(l.strictSlashes?")":"|$)"),c.value+=p,f.globstar=!0,f.output+=m.output+c.output,tt(p);continue}if(m.type==="slash"&&m.prev.type!=="bos"&&v[0]==="/"){const ut=v[1]!==void 0?"|$":"";f.output=f.output.slice(0,-(m.output+c.output).length),m.output=`(?:${m.output}`,c.type="globstar",c.output=`${Q(l)}${Z}|${Z}${ut})`,c.value+=p,f.output+=m.output+c.output,f.globstar=!0,tt(p+z()),N({type:"slash",value:"/",output:""});continue}if(m.type==="bos"&&v[0]==="/"){c.type="globstar",c.value+=p,c.output=`(?:^|${Z}|${Q(l)}${Z})`,f.output=c.output,f.globstar=!0,tt(p+z()),N({type:"slash",value:"/",output:""});continue}if(I&&v[0]==="/"){c.type="globstar",c.value+=p,c.output=`(?:^|${Z}|${Q(l)}${Z})`,f.output+=c.output,f.globstar=!0,tt(p+z()),N({type:"slash",value:"/",output:""});continue}f.output=f.output.slice(0,-c.output.length),c.type="globstar",c.output=Q(l),c.value+=p,f.output+=c.output,f.globstar=!0,tt(p);continue}const G={type:"star",value:p,output:H};if(l.bash===!0){G.output=".*?",(c.type==="bos"||c.type==="slash")&&(G.output=J+G.output),N(G);continue}if(c&&(c.type==="bracket"||c.type==="paren")&&l.regex===!0){G.output=p,N(G);continue}(f.index===f.start||c.type==="slash"||c.type==="dot")&&(c.type==="dot"?(f.output+=gt,c.output+=gt):l.dot===!0?(f.output+=ot,c.output+=ot):(f.output+=J,c.output+=J),M()!=="*"&&(f.output+=st,c.output+=st)),N(G)}for(;f.brackets>0;){if(l.strictBrackets===!0)throw new SyntaxError(a("closing","]"));f.output=e.escapeLast(f.output,"["),ht("brackets")}for(;f.parens>0;){if(l.strictBrackets===!0)throw new SyntaxError(a("closing",")"));f.output=e.escapeLast(f.output,"("),ht("parens")}for(;f.braces>0;){if(l.strictBrackets===!0)throw new SyntaxError(a("closing","}"));f.output=e.escapeLast(f.output,"{"),ht("braces")}if(l.strictSlashes!==!0&&(c.type==="star"||c.type==="bracket")&&N({type:"maybe_slash",value:"",output:`${Z}?`}),f.backtrack===!0){f.output="";for(const v of f.tokens)f.output+=v.output!=null?v.output:v.value,v.suffix&&(f.output+=v.suffix)}return f};return O.fastpaths=(d,E)=>{const l={...E},A=typeof l.maxLength=="number"?Math.min(r,l.maxLength):r,w=d.length;if(w>A)throw new SyntaxError(`Input length: ${w}, exceeds maximum allowed length: ${A}`);d=i[d]||d;const{DOT_LITERAL:T,SLASH_LITERAL:S,ONE_CHAR:k,DOTS_SLASH:F,NO_DOT:D,NO_DOTS:U,NO_DOTS_SLASH:rt,STAR:Z,START_ANCHOR:st}=t.globChars(l.windows),j=l.dot?U:D,lt=l.dot?rt:D,gt=l.capture?"":"?:",ot={negated:!1,prefix:""};let P=l.bash===!0?".*?":Z;l.capture&&(P=`(${P})`);const nt=J=>J.noglobstar===!0?P:`(${gt}(?:(?!${st}${J.dot?F:T}).)*?)`,dt=J=>{switch(J){case"*":return`${j}${k}${P}`;case".*":return`${T}${k}${P}`;case"*.*":return`${j}${P}${T}${k}${P}`;case"*/*":return`${j}${P}${S}${k}${lt}${P}`;case"**":return j+nt(l);case"**/*":return`(?:${j}${nt(l)}${S})?${lt}${k}${P}`;case"**/*.*":return`(?:${j}${nt(l)}${S})?${lt}${P}${T}${k}${P}`;case"**/.*":return`(?:${j}${nt(l)}${S})?${T}${k}${P}`;default:{const C=/^(.*?)\.(\w+)$/.exec(J);if(!C)return;const H=dt(C[1]);return H?H+T+C[2]:void 0}}},Y=e.removePrefix(d,ot);let Q=dt(Y);return Q&&l.strictSlashes!==!0&&(Q+=`${S}?`),Q},ye=O,ye}var me,We;function Ws(){if(We)return me;We=1;const t=js(),e=zs(),r=fe(),o=pe(),n=i=>i&&typeof i=="object"&&!Array.isArray(i),s=(i,u,a=!1)=>{if(Array.isArray(i)){const R=i.map(O=>s(O,u,a));return O=>{for(const d of R){const E=d(O);if(E)return E}return!1}}const b=n(i)&&i.tokens&&i.input;if(i===""||typeof i!="string"&&!b)throw new TypeError("Expected pattern to be a non-empty string");const h=u||{},y=h.windows,x=b?s.compileRe(i,u):s.makeRe(i,u,!1,!0),g=x.state;delete x.state;let $=()=>!1;if(h.ignore){const R={...u,ignore:null,onMatch:null,onResult:null};$=s(h.ignore,R,a)}const _=(R,O=!1)=>{const{isMatch:d,match:E,output:l}=s.test(R,x,u,{glob:i,posix:y}),A={glob:i,state:g,regex:x,posix:y,input:R,output:l,match:E,isMatch:d};if(typeof h.onResult=="function"&&h.onResult(A),d===!1)return A.isMatch=!1,O?A:!1;t:if($(R)){if(typeof h.onIgnore=="function"&&h.onIgnore(A)===o.UNIGNORE){A.isMatch=!0;break t}return A.isMatch=!1,O?A:!1}return typeof h.onMatch=="function"&&h.onMatch(A),O?A:!0};return a&&(_.state=g),_};return s.test=(i,u,a,{glob:b,posix:h}={})=>{if(typeof i!="string")throw new TypeError("Expected input to be a string");if(i==="")return{isMatch:!1,output:""};const y=a||{},x=y.format||(h?r.toPosixSlashes:null);let g=i===b,$=g&&x?x(i):i;return g===!1&&($=x?x(i):i,g=$===b),(g===!1||y.capture===!0)&&(y.matchBase===!0||y.basename===!0?g=s.matchBase(i,u,a,h):g=u.exec($)),{isMatch:!!g,match:g,output:$}},s.matchBase=(i,u,a)=>(u instanceof RegExp?u:s.makeRe(u,a)).test(r.basename(i)),s.isMatch=(i,u,a)=>s(u,a)(i),s.parse=(i,u)=>Array.isArray(i)?i.map(a=>s.parse(a,u)):e(i,{...u,fastpaths:!1}),s.scan=(i,u)=>t(i,u),s.compileRe=(i,u,a=!1,b=!1)=>{if(a===!0)return i.output;const h=u||{},y=h.contains?"":"^",x=h.contains?"":"$";let g=`${y}(?:${i.output})${x}`;i&&i.negated===!0&&(g=`^(?!${g}).*$`);const $=s.toRegex(g,u);return b===!0&&($.state=i),$},s.makeRe=(i,u={},a=!1,b=!1)=>{if(!i||typeof i!="string")throw new TypeError("Expected a non-empty string");let h={negated:!1,fastpaths:!0};return u.fastpaths!==!1&&(i[0]==="."||i[0]==="*")&&(h.output=e.fastpaths(i,u)),h.output||(h=e(i,u)),s.compileRe(h,u,a,b)},s.toRegex=(i,u)=>{try{const a=u||{};return new RegExp(i,a.flags||(a.nocase?"i":""))}catch(a){if(u&&u.debug===!0)throw a;return/$^/}},s.constants=o,me=s,me}var be,qe;function qs(){if(qe)return be;qe=1;const t=Ws(),e=fe();function r(o,n,s=!1){return n&&(n.windows===null||n.windows===void 0)&&(n={...n,windows:e.isWindows()}),t(o,n,s)}return Object.assign(r,t),be=r,be}var Ks=qs();const yt=Ce(Ks),Xs=B(import.meta.url),Dt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,oe=t=>{if(typeof Dt<"u"&&Dt.versions&&Dt.versions.node){const[e,r]=Dt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Dt.getBuiltinModule(t)}return Xs(t)},Ke=oe("fs"),Qs={...Ke,default:Ke},{statSync:Zs,stat:Ys,realpathSync:Vs,realpath:Js,readdirSync:to,readdir:eo}=oe("fs"),{sep:gr,basename:ro,dirname:Re,resolve:dr,normalize:so,relative:oo,posix:mt,isAbsolute:no}=oe("path"),{fileURLToPath:io}=oe("url"),{createRequire:uo}=oe("module");var Xe=uo(import.meta.url);function lo(t){let e=so(t);return e.length>1&&e[e.length-1]===gr&&(e=e.substring(0,e.length-1)),e}const ao=/[\\/]/g;function yr(t,e){return t.replace(ao,e)}const co=/^[a-z]:[\\/]$/i;function po(t){return t==="/"||co.test(t)}function $e(t,e){const{resolvePaths:r,normalizePath:o,pathSeparator:n}=e,s=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=dr(t)),(o||s)&&(t=lo(t)),t===".")return"";const i=t[t.length-1]!==n;return yr(i?t+n:t,n)}function mr(t,e){return e+t}function fo(t,e){return function(r,o){return o.startsWith(t)?o.slice(t.length)+r:yr(oo(t,o),e.pathSeparator)+e.pathSeparator+r}}function ho(t){return t}function go(t,e,r){return e+t+r}function yo(t,e){const{relativePaths:r,includeBasePath:o}=e;return r&&t?fo(t,e):o?mr:ho}function mo(t){return function(e,r){r.push(e.substring(t.length)||".")}}function bo(t){return function(e,r,o){const n=e.substring(t.length)||".";o.every(s=>s(n,!0))&&r.push(n)}}const $o=(t,e)=>{e.push(t||".")},vo=(t,e,r)=>{const o=t||".";r.every(n=>n(o,!0))&&e.push(o)},Eo=()=>{};function xo(t,e){const{includeDirs:r,filters:o,relativePaths:n}=e;return r?n?o&&o.length?bo(t):mo(t):o&&o.length?vo:$o:Eo}const Ao=(t,e,r,o)=>{o.every(n=>n(t,!1))&&r.files++},So=(t,e,r,o)=>{o.every(n=>n(t,!1))&&e.push(t)},wo=(t,e,r,o)=>{r.files++},Ro=(t,e)=>{e.push(t)},To=()=>{};function _o(t){const{excludeFiles:e,filters:r,onlyCounts:o}=t;return e?To:r&&r.length?o?Ao:So:o?wo:Ro}const ko=t=>t,Co=()=>[""].slice(0,0);function Oo(t){return t.group?Co:ko}const No=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},Lo=()=>{};function Ho(t){return t.group?No:Lo}const Bo=function(t,e,r){const{queue:o,fs:n,options:{suppressErrors:s}}=e;o.enqueue(),n.realpath(t,(i,u)=>{if(i)return o.dequeue(s?null:i,e);n.stat(u,(a,b)=>{if(a)return o.dequeue(s?null:a,e);if(b.isDirectory()&&br(t,u,e))return o.dequeue(null,e);r(b,u),o.dequeue(null,e)})})},Mo=function(t,e,r){const{queue:o,fs:n,options:{suppressErrors:s}}=e;o.enqueue();try{const i=n.realpathSync(t),u=n.statSync(i);if(u.isDirectory()&&br(t,i,e))return;r(u,i)}catch(i){if(!s)throw i}};function Do(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Mo:Bo}function br(t,e,r){if(r.options.useRealPaths)return Io(e,r);let o=Re(t),n=1;for(;o!==r.root&&n<2;){const s=r.symlinks.get(o);s&&(s===e||s.startsWith(e)||e.startsWith(s))?n++:o=Re(o)}return r.symlinks.set(t,e),n>1}function Io(t,e){return e.visited.includes(t+e.options.pathSeparator)}const Po=t=>t.counts,Fo=t=>t.groups,Go=t=>t.paths,Uo=t=>t.paths.slice(0,t.options.maxFiles),jo=(t,e,r)=>(he(e,r,t.counts,t.options.suppressErrors),null),zo=(t,e,r)=>(he(e,r,t.paths,t.options.suppressErrors),null),Wo=(t,e,r)=>(he(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),qo=(t,e,r)=>(he(e,r,t.groups,t.options.suppressErrors),null);function he(t,e,r,o){e(t&&!o?t:null,r)}function Ko(t,e){const{onlyCounts:r,group:o,maxFiles:n}=t;return r?e?Po:jo:o?e?Fo:qo:n?e?Uo:Wo:e?Go:zo}const $r={withFileTypes:!0},Xo=(t,e,r,o,n)=>{if(t.queue.enqueue(),o<0)return t.queue.dequeue(null,t);const{fs:s}=t;t.visited.push(e),t.counts.directories++,s.readdir(e||".",$r,(i,u=[])=>{n(u,r,o),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},Qo=(t,e,r,o,n)=>{const{fs:s}=t;if(o<0)return;t.visited.push(e),t.counts.directories++;let i=[];try{i=s.readdirSync(e||".",$r)}catch(u){if(!t.options.suppressErrors)throw u}n(i,r,o)};function Zo(t){return t?Qo:Xo}var Yo=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},Vo=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},Jo=class{aborted=!1;abort(){this.aborted=!0}},vr=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,r,o){this.isSynchronous=!o,this.callbackInvoker=Ko(r,this.isSynchronous),this.root=$e(e,r),this.state={root:po(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new Vo,options:r,queue:new Yo((n,s)=>this.callbackInvoker(s,n,o)),symlinks:new Map,visited:[""].slice(0,0),controller:new Jo,fs:r.fs||Qs},this.joinPath=yo(this.root,r),this.pushDirectory=xo(this.root,r),this.pushFile=_o(r),this.getArray=Oo(r),this.groupFiles=Ho(r),this.resolveSymlink=Do(r,this.isSynchronous),this.walkDirectory=Zo(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(e,r,o)=>{const{paths:n,options:{filters:s,resolveSymlinks:i,excludeSymlinks:u,exclude:a,maxFiles:b,signal:h,useRealPaths:y,pathSeparator:x},controller:g}=this.state;if(g.aborted||h&&h.aborted||b&&n.length>b)return;const $=this.getArray(this.state.paths);for(let _=0;_<e.length;++_){const R=e[_];if(R.isFile()||R.isSymbolicLink()&&!i&&!u){const O=this.joinPath(R.name,r);this.pushFile(O,$,this.state.counts,s)}else if(R.isDirectory()){let O=go(R.name,r,this.state.options.pathSeparator);if(a&&a(R.name,O))continue;this.pushDirectory(O,n,s),this.walkDirectory(this.state,O,O,o-1,this.walk)}else if(this.resolveSymlink&&R.isSymbolicLink()){let O=mr(R.name,r);this.resolveSymlink(O,this.state,(d,E)=>{if(d.isDirectory()){if(E=$e(E,this.state.options),a&&a(R.name,y?E:O+x))return;this.walkDirectory(this.state,E,y?E:O+x,o-1,this.walk)}else{E=y?E:O;const l=ro(E),A=$e(Re(E),this.state.options);E=this.joinPath(l,A),this.pushFile(E,$,this.state.counts,s)}})}}this.groupFiles(this.state.groups,r,$)}};function tn(t,e){return new Promise((r,o)=>{Er(t,e,(n,s)=>{if(n)return o(n);r(s)})})}function Er(t,e,r){new vr(t,e,r).start()}function en(t,e){return new vr(t,e).start()}var Qe=class{constructor(e,r){this.root=e,this.options=r}withPromise(){return tn(this.root,this.options)}withCallback(e){Er(this.root,this.options,e)}sync(){return en(this.root,this.options)}};let xr=null;try{Xe.resolve("picomatch"),xr=Xe("picomatch")}catch{}var rn=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:gr,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new Qe(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new Qe(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){const r=this.globFunction||xr;if(!r)throw new Error("Please specify a glob function to use glob matching.");var o=this.globCache[t.join("\0")];return o||(o=r(t,...e),this.globCache[t.join("\0")]=o),this.options.filters.push(n=>o(n)),this}};const sn=Array.isArray,Ar=/\\/g,on=/^[A-Za-z]:$/,Sr=process.platform==="win32",nn=/^(\/?\.\.)+$/;function Ze(t,e={}){const r=t.length,o=Array(r),n=Array(r);let s,i;for(s=0;s<r;s++){const u=wr(t[s]);o[s]=u;const a=u.length,b=Array(a);for(i=0;i<a;i++)b[i]=yt(u[i],e);n[s]=b}return u=>{const a=u.split("/");if(a[0]===".."&&nn.test(u))return!0;for(s=0;s<r;s++){const b=o[s],h=n[s],y=a.length,x=Math.min(y,b.length);for(i=0;i<x;){const g=b[i];if(g.includes("/"))return!0;if(!h[i](a[i]))break;if(!e.noglobstar&&g==="**")return!0;i++}if(i===y)return!0}return!1}}const un=/^[A-Z]:\/$/i,ln=Sr?t=>un.test(t):t=>t==="/";function Ye(t,e,r){if(t===e||e.startsWith(`${t}/`)){if(r){const n=t.length+ +!ln(t);return(s,i)=>s.slice(n,i?-1:void 0)||"."}const o=e.slice(t.length+1);return o?(n,s)=>{if(n===".")return o;const i=`${o}/${n}`;return s?i.slice(0,-1):i}:(n,s)=>s&&n!=="."?n.slice(0,-1):n}return r?o=>mt.relative(t,o)||".":o=>mt.relative(t,`${e}/${o}`)||"."}function an(t,e){if(e.startsWith(`${t}/`)){const r=e.slice(t.length+1);return o=>`${r}/${o}`}return r=>{const o=mt.relative(t,`${e}/${r}`);return r[r.length-1]==="/"&&o!==""?`${o}/`:o||"."}}function Ve(t){return t.replace(on,e=>`${e}/`)}const cn={parts:!0};function wr(t){var e;const r=yt.scan(t,cn);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}const pn=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,fn=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,hn=t=>t.replace(pn,"\\$&"),gn=t=>t.replace(fn,"\\$&"),dn=Sr?gn:hn;function yn(t,e){const r=yt.scan(t);return r.isGlob||r.negated}function se(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function Rr(t){return typeof t=="string"?[t]:t??[]}const mn=/^(\/?\.\.)+/,bn=/\\(?=[()[\]{}!*+?@|])/g;function ve(t,e,r,o){var n;const s=e.cwd;let i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1));const u=i.lastIndexOf("/"),a=(u===-1?i:i.slice(u+1)).startsWith("!(");i[i.length-1]!=="*"&&!a&&e.expandDirectories&&(i+="/**");const b=dn(s);i=no(i.replace(bn,""))?mt.relative(b,i):mt.normalize(i);const h=(n=mn.exec(i))===null||n===void 0?void 0:n[0],y=wr(i);if(h){const g=(h.length+1)/3;let $=0;const _=b.split("/");for(;$<g&&y[$+g]===_[_.length+$-g];)i=i.slice(0,(g-$-1)*3)+i.slice((g-$)*3+y[$+g].length+1)||".",$++;const R=mt.join(s,h.slice($*3));R[0]!=="."&&r.root.length>R.length&&(r.root=Ve(R),r.depthOffset=-g+$)}if(!o&&r.depthOffset>=0){var x;(x=r.commonPath)!==null&&x!==void 0||(r.commonPath=y);const g=[],$=Math.min(r.commonPath.length,y.length);for(let _=0;_<$;_++){const R=y[_];if(R==="**"&&!y[_+1]){g.pop();break}if(_===y.length-1||R!==r.commonPath[_]||yn(R))break;g.push(R)}r.depthOffset=g.length,r.commonPath=g,r.root=Ve(g.length>0?mt.join(s,...g):s)}return i}function $n(t,e,r){const o=[],n=[],s=[];for(const i of t.ignore)i&&(i[0]!=="!"||i[1]==="("?n.push(ve(i,t,r,!0)):s.push(i.slice(1)));for(const i of e)i&&(i[0]!=="!"||i[1]==="("?o.push(ve(i,t,r,!1)):(i[1]!=="!"||i[2]==="(")&&n.push(ve(i.slice(1),t,r,!0)));return{match:o,ignore:n,unignore:s}}function vn(t,e){const r=t.cwd,o={root:r,depthOffset:0},n=$n(t,e,o);t.debug&&se("internal processing patterns:",n);const{absolute:s,caseSensitiveMatch:i,debug:u,dot:a,followSymbolicLinks:b,onlyDirectories:h}=t,y=o.root.replace(Ar,""),x={dot:a,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},g=n.unignore.length>0,$=g?yt(n.unignore,x):void 0,_=g?Ze(n.unignore,x):void 0,R=yt(n.match,{...x,ignore:n.ignore,onIgnore:$?k=>$(k.output)&&yt.constants.UNIGNORE:void 0}),O=yt(n.ignore,x),d=Ze(n.match,x),E=Ye(r,y,s),l=s?E:Ye(r,y,!0),A=n.match.length>0&&n.match.every(k=>k==="**"||k==="**/*"),w=n.ignore.length>0||g||!A?(k,F)=>{const D=l(F,!0);return D==="."||_&&_(D)?!1:!d(D)||O(D)}:void 0;let T;t.deep!==void 0&&(T=Math.round(t.deep-o.depthOffset));const S=new rn({filters:[u?(k,F)=>{const D=E(k,F),U=R(D);return U&&se(`matched ${D}`),U}:(k,F)=>{const D=E(k,F);return R(D)}],exclude:u&&w?(k,F)=>{const D=w(k,F);return se(`${D?"skipped":"crawling"} ${F}`),D}:w,fs:t.fs,pathSeparator:"/",relativePaths:!s,resolvePaths:s,includeBasePath:s,resolveSymlinks:b,excludeSymlinks:!b,excludeFiles:h,includeDirs:h||!t.onlyFiles,maxDepth:T,signal:t.signal}).crawl(y);return t.debug&&se("internal properties:",{...o,root:y}),[S,r!==y&&!s&&an(r,y)]}function En(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}const Je={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function xn(t){const e=Object.assign({},t);for(const r in Je)e[r]===void 0&&Object.assign(e,{[r]:Je[r]});return e.cwd=(e.cwd instanceof URL?io(e.cwd):dr(e.cwd||process.cwd())).replace(Ar,"/"),e.ignore=Rr(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||eo,readdirSync:e.fs.readdirSync||to,realpath:e.fs.realpath||Js,realpathSync:e.fs.realpathSync||Vs,stat:e.fs.stat||Ys,statSync:e.fs.statSync||Zs}),e.debug&&se("globbing with options:",e),e}function An(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");const o=sn(t)||typeof t=="string",n=Rr((r=o?t:t.patterns)!==null&&r!==void 0?r:"**/*"),s=xn(o?e:t);return n.length>0?vn(s,n):[]}async function cu(t,e){const[r,o]=An(t,e);return r?En(await r.withPromise(),o):[]}var Ee,tr;function Sn(){if(tr)return Ee;tr=1;/*!
2
+ * is-extglob <https://github.com/jonschlinkert/is-extglob>
3
+ *
4
+ * Copyright (c) 2014-2016, Jon Schlinkert.
5
+ * Licensed under the MIT License.
6
+ */return Ee=function(t){if(typeof t!="string"||t==="")return!1;for(var e;e=/(\\).|([@?!+*]\(.*\))/g.exec(t);){if(e[2])return!0;t=t.slice(e.index+e[0].length)}return!1},Ee}var xe,er;function Tr(){if(er)return xe;er=1;/*!
7
+ * is-glob <https://github.com/jonschlinkert/is-glob>
8
+ *
9
+ * Copyright (c) 2014-2017, Jon Schlinkert.
10
+ * Released under the MIT License.
11
+ */var t=Sn(),e={"{":"}","(":")","[":"]"},r=function(n){if(n[0]==="!")return!0;for(var s=0,i=-2,u=-2,a=-2,b=-2,h=-2;s<n.length;){if(n[s]==="*"||n[s+1]==="?"&&/[\].+)]/.test(n[s])||u!==-1&&n[s]==="["&&n[s+1]!=="]"&&(u<s&&(u=n.indexOf("]",s)),u>s&&(h===-1||h>u||(h=n.indexOf("\\",s),h===-1||h>u)))||a!==-1&&n[s]==="{"&&n[s+1]!=="}"&&(a=n.indexOf("}",s),a>s&&(h=n.indexOf("\\",s),h===-1||h>a))||b!==-1&&n[s]==="("&&n[s+1]==="?"&&/[:!=]/.test(n[s+2])&&n[s+3]!==")"&&(b=n.indexOf(")",s),b>s&&(h=n.indexOf("\\",s),h===-1||h>b))||i!==-1&&n[s]==="("&&n[s+1]!=="|"&&(i<s&&(i=n.indexOf("|",s)),i!==-1&&n[i+1]!==")"&&(b=n.indexOf(")",i),b>i&&(h=n.indexOf("\\",i),h===-1||h>b))))return!0;if(n[s]==="\\"){var y=n[s+1];s+=2;var x=e[y];if(x){var g=n.indexOf(x,s);g!==-1&&(s=g+1)}if(n[s]==="!")return!0}else s++}return!1},o=function(n){if(n[0]==="!")return!0;for(var s=0;s<n.length;){if(/[*?{}()[\]]/.test(n[s]))return!0;if(n[s]==="\\"){var i=n[s+1];s+=2;var u=e[i];if(u){var a=n.indexOf(u,s);a!==-1&&(s=a+1)}if(n[s]==="!")return!0}else s++}return!1};return xe=function(n,s){if(typeof n!="string"||n==="")return!1;if(t(n))return!0;var i=r;return s&&s.strict===!1&&(i=o),i(n)},xe}const wn=B(import.meta.url),It=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_r=t=>{if(typeof It<"u"&&It.versions&&It.versions.node){const[e,r]=It.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return It.getBuiltinModule(t)}return wn(t)},Rn=_r("path"),Tn=_r("os");var Ae,rr;function _n(){if(rr)return Ae;rr=1;var t=Tr(),e=Rn.posix.dirname,r=Tn.platform()==="win32",o="/",n=/\\/g,s=/\\([!*?|[\](){}])/g;Ae=function(a,b){var h=Object.assign({flipBackslashes:!0},b);h.flipBackslashes&&r&&a.indexOf(o)<0&&(a=a.replace(n,o)),i(a)&&(a+=o),a+="a";do a=e(a);while(u(a));return a.replace(s,"$1")};function i(a){var b=a.slice(-1),h;switch(b){case"}":h="{";break;case"]":h="[";break;default:return!1}var y=a.indexOf(h);return y<0?!1:a.slice(y+1,-1).includes(o)}function u(a){return/\([^()]+$/.test(a)||a[0]==="{"||a[0]==="["||/[^\\][{[]/.test(a)?!0:t(a)}return Ae}var kn=_n();Ce(kn);const Cn=B(import.meta.url),Pt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,On=t=>{if(typeof Pt<"u"&&Pt.versions&&Pt.versions.node){const[e,r]=Pt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Pt.getBuiltinModule(t)}return Cn(t)},{access:Nn}=On("node:fs/promises");async function pu(t,e=_e){pt(t),t=ct(t);try{return await Nn(t,e),!0}catch{return!1}}const Ln=B(import.meta.url),Ft=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Hn=t=>{if(typeof Ft<"u"&&Ft.versions&&Ft.versions.node){const[e,r]=Ft.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Ft.getBuiltinModule(t)}return Ln(t)},{accessSync:Bn}=Hn("node:fs");function Te(t,e=_e){pt(t),t=ct(t);try{return Bn(t,e),!0}catch{return!1}}var Mn=Tr();Ce(Mn);const Dn=B(import.meta.url),Gt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kr=t=>{if(typeof Gt<"u"&&Gt.versions&&Gt.versions.node){const[e,r]=Gt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Gt.getBuiltinModule(t)}return Dn(t)};kr("node:fs/promises");kr("node:fs");let In=class extends Error{constructor(e){super(`ENOENT: ${e}`)}get code(){return"ENOENT"}set code(e){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(e){throw new Error("Cannot overwrite name of NotFoundError")}},Pn=class extends Error{constructor(e){super(`EPERM: Operation not permitted, ${e}`)}get code(){return"EPERM"}set code(e){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(e){throw new Error("Cannot overwrite name of PermissionError")}};const Cr=(t,e)=>{const r=t?.code;return r==="ENOENT"?new In(`no such file or directory, open '${e}'`):r==="EACCES"||r==="EPERM"?new Pn(`unable to read the non-readable file: ${e}`):t},Fn=B(import.meta.url),Ut=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Or=t=>{if(typeof Ut<"u"&&Ut.versions&&Ut.versions.node){const[e,r]=Ut.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Ut.getBuiltinModule(t)}return Fn(t)},{readFile:Gn}=Or("node:fs/promises"),{unzip:Un,brotliDecompress:jn}=Or("node:zlib"),zn={brotli:jn,gzip:Un,none:(t,e)=>{e(null,t)}},gu=async(t,e)=>{pt(t),t=ct(t);const{buffer:r,compression:o,encoding:n,flag:s}=e??{};let i;try{i=await Gn(t,s?{flag:s}:{})}catch(u){throw Cr(u,t)}return await new Promise((u,a)=>{zn[o??"none"](i,(b,h)=>{b?a(b):u(r?h:h.toString(n??"utf8"))})})},Wn=B(import.meta.url),jt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Nr=t=>{if(typeof jt<"u"&&jt.versions&&jt.versions.node){const[e,r]=jt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return jt.getBuiltinModule(t)}return Wn(t)},{readFileSync:qn}=Nr("node:fs"),{unzipSync:Kn,brotliDecompressSync:Xn}=Nr("node:zlib"),Qn={brotli:Xn,gzip:Kn,none:t=>t},du=(t,e)=>{pt(t),t=ct(t);const{buffer:r,compression:o,encoding:n,flag:s}=e??{};let i;try{i=qn(t,s?{flag:s}:{})}catch(b){throw Cr(b,t)}const u=Qn[o??"none"],a=u(i);return r?a:a.toString(n??"utf8")},Zn=B(import.meta.url),zt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yn=t=>{if(typeof zt<"u"&&zt.versions&&zt.versions.node){const[e,r]=zt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return zt.getBuiltinModule(t)}return Zn(t)},{createRequire:Lr}=Yn("node:module"),Vn=globalThis.process??Object.create(null),sr={versions:{}},or=new Proxy(Vn,{get(t,e){if(e in t)return t[e];if(e in sr)return sr[e]}}),Jn=t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
12
+ `),ti=(t,e,r,o)=>{const n={column:0,line:-1,...t.start},s={...n,...t.end},i=n.line,u=n.column,a=s.line,b=s.column;let h=Math.max(i-(r+1),0),y=Math.min(e.length,a+o);i===-1&&(h=0),a===-1&&(y=e.length);const x=a-i,g={};if(x)for(let $=0;$<=x;$++){const _=$+i;if(!u)g[_]=!0;else if($===0){const R=e[_-1]?.length;g[_]=[u,(R??0)-u+1]}else if($===x)g[_]=[0,b];else{const R=e[_-$]?.length;g[_]=[0,R]}}else u===b?g[i]=u?[u,0]:!0:g[i]=[u,(b??0)-(u??0)];return{end:y,markerLines:g,start:h}},ei=or.platform==="win32"&&!or.env?.WT_SESSION?">":"❯",yu=(t,e,r)=>{const o={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...r,color:{gutter:$=>$,marker:$=>$,message:$=>$,...r?.color}},n=typeof e.start.column=="number";let s=(t.includes("\r")?Jn(t):t).split(`
13
+ `);typeof o.tabWidth=="number"&&t.includes(" ")&&(s=s.map($=>$.replaceAll(" "," ".repeat(o.tabWidth))));const{end:i,markerLines:u,start:a}=ti(e,s,o.linesAbove,o.linesBelow),b=String(i).length,{gutter:h,marker:y,message:x}=o.color;let g=s.slice(a,i).map(($,_)=>{const R=a+1+_,O=u[R],d=String(R).padStart(b),E=!u[R+1],l=` ${d}${o.showGutter?" |":""}`;if(O){let A="";if(Array.isArray(O)){const w=$.replaceAll(/[^\t]/g," ").slice(0,Math.max(O[0]-1,0)),T=O[1]||1;A=[`
14
+ `,o.prefix+h(l.replaceAll(/\d/g," "))," ",w,y("^").repeat(T)].join(""),E&&o.message&&(A+=` ${x(o.message)}`)}return[o.prefix+y(ei),h(l),$.length>0?` ${$}`:"",A].join("")}return`${o.prefix} ${h(l)}${$.length>0?` ${$}`:""}`}).join(`
15
+ `);return o.message&&!n&&(g=`${o.prefix+" ".repeat(b+1)+o.message}
16
+ ${g}`),g},nr=(t,e)=>{let r=0,o=e.length-2;for(;r<o;){const n=r+(o-r>>1);if(t<e[n])o=n-1;else if(t>=e[n+1])r=n+1;else{r=n;break}}return r},ri=/\n|\r(?!\n)/,si=t=>t.split(ri).reduce((e,r)=>(e.push(e.at(-1)+r.length+1),e),[0]),mu=(t,e,r)=>{if(!Array.isArray(t)&&typeof t!="string"||(typeof t=="string"||Array.isArray(t))&&t.length===0)return{column:0,line:0};if(typeof e!="number"||typeof t=="string"&&e>=t.length||Array.isArray(t)&&e+1>=t.at(-1))return{column:0,line:0};if(typeof t=="string"){const n=si(t),s=nr(e,n);return{column:e-n[s]+1,line:s+1}}const o=nr(e,t);return{column:e-t[o]+1,line:o+1}},oi=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&oi.set("AggregateError",AggregateError);const ni=Lr(import.meta.url),Wt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ii=t=>{if(typeof Wt<"u"&&Wt.versions&&Wt.versions.node){const[e,r]=Wt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Wt.getBuiltinModule(t)}return ni(t)};ii("node:util");const ui=Lr(import.meta.url),qt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Oe=t=>{if(typeof qt<"u"&&qt.versions&&qt.versions.node){const[e,r]=qt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return qt.getBuiltinModule(t)}return ui(t)};Oe("node:fs");Oe("node:path");Oe("node:url");const li=t=>{const e={force:!0,recursive:!0};return t?.maxRetries!==void 0&&(e.maxRetries=t.maxRetries),t?.retryDelay!==void 0&&(e.retryDelay=t.retryDelay),e},ai=B(import.meta.url),Kt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Hr=t=>{if(typeof Kt<"u"&&Kt.versions&&Kt.versions.node){const[e,r]=Kt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Kt.getBuiltinModule(t)}return ai(t)};Hr("node:fs");Hr("node:fs/promises");const ci=B(import.meta.url),Xt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,pi=t=>{if(typeof Xt<"u"&&Xt.versions&&Xt.versions.node){const[e,r]=Xt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Xt.getBuiltinModule(t)}return ci(t)};pi("node:fs");const fi=B(import.meta.url),Qt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,hi=t=>{if(typeof Qt<"u"&&Qt.versions&&Qt.versions.node){const[e,r]=Qt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Qt.getBuiltinModule(t)}return fi(t)};hi("node:fs/promises");const gi=B(import.meta.url),Zt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,di=t=>{if(typeof Zt<"u"&&Zt.versions&&Zt.versions.node){const[e,r]=Zt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Zt.getBuiltinModule(t)}return gi(t)},{rmSync:yi}=di("node:fs"),bu=(t,e={})=>{pt(t),yi(t,li(e))};B(import.meta.url);const mi=t=>{if(typeof t!="string"&&!(t instanceof ArrayBuffer)&&!ArrayBuffer.isView(t))throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.")},bi=B(import.meta.url),Yt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$i=t=>{if(typeof Yt<"u"&&Yt.versions&&Yt.versions.node){const[e,r]=Yt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Yt.getBuiltinModule(t)}return bi(t)},{randomBytes:vi}=$i("node:crypto"),Ei=t=>`${t}.${process.pid.toString(36)}.${vi(6).toString("hex")}.tmp`,xi=new TextEncoder,Ai=t=>{if(t instanceof Uint8Array)return t;if(typeof t=="string")return xi.encode(t);if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t)){const e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return new Uint8Array(e)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")},Si=B(import.meta.url),Vt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,wi=t=>{if(typeof Vt<"u"&&Vt.versions&&Vt.versions.node){const[e,r]=Vt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Vt.getBuiltinModule(t)}return Si(t)};wi("node:fs/promises");const Ri=B(import.meta.url),Jt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ti=t=>{if(typeof Jt<"u"&&Jt.versions&&Jt.versions.node){const[e,r]=Jt.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return Jt.getBuiltinModule(t)}return Ri(t)},{mkdirSync:_i,writeFileSync:ki,statSync:Ci,renameSync:ir,chownSync:Oi,chmodSync:Ni,unlinkSync:Li}=Ti("node:fs"),Hi=(t,e,r)=>{r={backup:!1,encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...r},pt(t),mi(e),t=ct(t);const o=Te(t,_e);if(o&&!r.overwrite)throw new ns(`file already exists, open '${t}'`);const n=Ei(t);try{!o&&r.recursive&&_i(ke(t),{recursive:!0});let s;if(ki(n,typeof e=="string"?Buffer.from(e,r.encoding??"utf8"):Ai(e),{flag:"wx"}),o&&r.backup&&(s=Ci(t),r.chown??={gid:s.gid,uid:s.uid},ir(t,`${t}.bak`)),r.chown)try{Oi(n,r.chown.uid,r.chown.gid)}catch{}Ni(n,s&&!r.mode?s.mode:r.mode??438),ir(n,t)}catch(s){throw new Error(`Failed to write file at: ${t} - ${s.message}`,{cause:s})}finally{Te(n)&&Li(n)}},Bi=/^(?:( )+|\t+)/,ne="space";function ur(t,e,r){return t&&e===ne&&r===1}function lr(t,e){const r=new Map;let o=0,n,s;for(const i of t.split(/\n/g)){if(!i)continue;const u=i.match(Bi);if(u===null)o=0,n="";else{const a=u[0].length,b=u[1]?ne:"tab";if(ur(e,b,a))continue;b!==n&&(o=0),n=b;let h=1,y=0;const x=a-o;if(o=a,x===0)h=0,y=1;else{const $=Math.abs(x);if(ur(e,b,$))continue;s=Mi(b,$)}const g=r.get(s);r.set(s,g===void 0?[1,0]:[g[0]+h,g[1]+y])}}return r}function Mi(t,e){return(t===ne?"s":"t")+String(e)}function Di(t){const e=t[0]==="s"?ne:"tab",r=Number(t.slice(1));return{type:e,amount:r}}function Ii(t){let e,r=0,o=0;for(const[n,[s,i]]of t)(s>r||s===r&&i>o)&&(r=s,o=i,e=n);return e}function Pi(t,e){return(t===ne?" ":" ").repeat(e)}function Fi(t){if(typeof t!="string")throw new TypeError("Expected a string");let e=lr(t,!0);e.size===0&&(e=lr(t,!1));const r=Ii(e);let o,n=0,s="";return r!==void 0&&({type:o,amount:n}=Di(r),s=Pi(o,n)),{amount:n,type:o,indent:s}}const Gi=B(import.meta.url),te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ui=t=>{if(typeof te<"u"&&te.versions&&te.versions.node){const[e,r]=te.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return te.getBuiltinModule(t)}return Gi(t)};Ui("node:fs/promises");const ji=B(import.meta.url),ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,zi=t=>{if(typeof ee<"u"&&ee.versions&&ee.versions.node){const[e,r]=ee.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return ee.getBuiltinModule(t)}return ji(t)},{readFileSync:Wi}=zi("node:fs"),$u=(t,e,r={})=>{const{detectIndent:o,indent:n,replacer:s,stringify:i=JSON.stringify,...u}={indent:" ",...r};let a=n,b=`
17
+ `;if(Te(t,Fr))try{const y=Wi(t,"utf8");if(o){const{indent:x}=Fi(y);a=x}b=y.endsWith(`
18
+ `)?`
19
+ `:""}catch(y){if(y.code!=="ENOENT")throw y}const h=i(e,s,a);Hi(t,`${h}${b}`,u)},qi=B(import.meta.url),re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ne=t=>{if(typeof re<"u"&&re.versions&&re.versions.node){const[e,r]=re.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return re.getBuiltinModule(t)}return qi(t)},Ki=Ne("fs"),Xi=Ne("os"),Qi=Ne("path");var Se={},ar;function Zi(){if(ar)return Se;ar=1;var t=Object.defineProperty,e=(h,y)=>t(h,"name",{value:y,configurable:!0}),r=Ki,o=Xi,n=Qi;const s=e(h=>{let y="";for(let x=0;x<h.length;x+=1){const g=h[x],$=g.toUpperCase();y+=g===$?g.toLowerCase():$}return y},"invertCase"),i=new Map,u=e((h,y)=>{const x=n.join(h,`.is-fs-case-sensitive-test-${process.pid}`);try{return y.writeFileSync(x,""),!y.existsSync(s(x))}finally{try{y.unlinkSync(x)}catch{}}},"checkDirectoryCaseWithWrite"),a=e((h,y,x)=>{try{return u(h,x)}catch(g){if(y===void 0)return u(o.tmpdir(),x);throw g}},"checkDirectoryCaseWithFallback"),b=e((h,y=r,x=!0)=>{const g=h??process.cwd();if(x&&i.has(g))return i.get(g);let $;const _=s(g);return _!==g&&y.existsSync(g)?$=!y.existsSync(_):$=a(g,h,y),x&&i.set(g,$),$},"isFsCaseSensitive");return Se.isFsCaseSensitive=b,Se}var Yi=Zi();const vu=Yi.isFsCaseSensitive;export{bt as A,$t as B,uu as F,ke as H,Ms as I,fr as J,ct as L,$u as O,Hi as T,yu as U,cu as W,ou as a,pu as b,su as c,mu as d,Ji as e,Te as f,In as g,Yr as j,vu as k,bu as l,Qr as m,tu as o,du as v,eu as y,gu as z};
@@ -0,0 +1,30 @@
1
+ import{createRequire as zt}from"node:module";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
+ const require = __cjs_mod__.createRequire(import.meta.url);
3
+ const Wt=zt(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ft=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,n]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ie.getBuiltinModule(t)}return Wt(t)},{createRequire:ve}=Ft("node:module"),qt=16,be=32,Gt=64,V=128,ge="positionals",Ht=ve(import.meta.url),se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Jt=t=>{if(typeof se<"u"&&se.versions&&se.versions.node){const[e,n]=se.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return se.getBuiltinModule(t)}return Ht(t)},{createRequire:ht}=Jt("node:module"),Kt=globalThis.process??Object.create(null),Pe={versions:{}},_e=new Proxy(Kt,{get(t,e){if(e in t)return t[e];if(e in Pe)return Pe[e]}}),Yt=t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
4
+ `),Qt=(t,e,n,o)=>{const s={column:0,line:-1,...t.start},i={...s,...t.end},c=s.line,a=s.column,u=i.line,r=i.column;let l=Math.max(c-(n+1),0),d=Math.min(e.length,u+o);c===-1&&(l=0),u===-1&&(d=e.length);const h=u-c,f={};if(h)for(let p=0;p<=h;p++){const g=p+c;if(!a)f[g]=!0;else if(p===0){const $=e[g-1]?.length;f[g]=[a,($??0)-a+1]}else if(p===h)f[g]=[0,r];else{const $=e[g-p]?.length;f[g]=[0,$]}}else a===r?f[c]=a?[a,0]:!0:f[c]=[a,(r??0)-(a??0)];return{end:d,markerLines:f,start:l}},Zt=_e.platform==="win32"&&!_e.env?.WT_SESSION?">":"❯",Xt=(t,e,n)=>{const o={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:p=>p,marker:p=>p,message:p=>p,...n?.color}},s=typeof e.start.column=="number";let i=(t.includes("\r")?Yt(t):t).split(`
5
+ `);typeof o.tabWidth=="number"&&t.includes(" ")&&(i=i.map(p=>p.replaceAll(" "," ".repeat(o.tabWidth))));const{end:c,markerLines:a,start:u}=Qt(e,i,o.linesAbove,o.linesBelow),r=String(c).length,{gutter:l,marker:d,message:h}=o.color;let f=i.slice(u,c).map((p,g)=>{const $=u+1+g,w=a[$],y=String($).padStart(r),b=!a[$+1],N=` ${y}${o.showGutter?" |":""}`;if(w){let E="";if(Array.isArray(w)){const I=p.replaceAll(/[^\t]/g," ").slice(0,Math.max(w[0]-1,0)),O=w[1]||1;E=[`
6
+ `,o.prefix+l(N.replaceAll(/\d/g," "))," ",I,d("^").repeat(O)].join(""),b&&o.message&&(E+=` ${h(o.message)}`)}return[o.prefix+d(Zt),l(N),p.length>0?` ${p}`:"",E].join("")}return`${o.prefix} ${l(N)}${p.length>0?` ${p}`:""}`}).join(`
7
+ `);return o.message&&!s&&(f=`${o.prefix+" ".repeat(r+1)+o.message}
8
+ ${f}`),f},en=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&en.set("AggregateError",AggregateError);const tn=ht(import.meta.url),re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,nn=t=>{if(typeof re<"u"&&re.versions&&re.versions.node){const[e,n]=re.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return re.getBuiltinModule(t)}return tn(t)};nn("node:util");const on=()=>_e.env?.DEBUG==="true",Y=(t,...e)=>{if(on()){const n=e.map(o=>typeof o=="function"?o():o);console.debug(`error:parse-stacktrace: ${t}`,...n)}},Q="<unknown>",sn=/^(?:node:internal\/|node:|internal\/)/,rn=t=>t!==void 0&&sn.test(t),an=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ln=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,cn=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,un=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,hn=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,pn=/in\s(.*)\s\(at\s(.+)\)\sat/,dn=/^(?:.*@)?(.*):(\d+):(\d+)$/,fn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,mn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,gn=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,De=/\(error: (.*)\)/,wn=/at\s/,yn=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,vn=/\S*(?:Error: |AggregateError:)/,pt=/^Anonymous function$/,$n=/^\s*in\s.*/,bn=/^.*?\s*at\s.*/,xn=/^.*?\s*@.*|\[native code\]/,dt=(t,e)=>{const n=t.includes("safari-extension"),o=t.includes("safari-web-extension");return n||o?[t.includes("@")?t.split("@")[0]:Q,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},ft=(t,e)=>{const n=cn.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},Nn=t=>{const e=pn.exec(t);if(e){Y(`parse nested node error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`);const o=e[2].split(":");return{column:o[2]?+o[2]:void 0,file:o[0],line:o[1]?+o[1]:void 0,methodName:e[1]??Q,raw:t,type:void 0}}const n=hn.exec(t);if(n){Y(`parse node error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const o={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(wn,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??Q,raw:t,type:t.startsWith("internal")?"internal":void 0};return ft(o,`${n[2]}:${n[3]}:${n[4]}`),o}},An=t=>{const e=an.exec(t);if(e){Y(`parse chrome error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),o=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let s,i;if(o){const r=ln.exec(t);if(r){const l=yn.exec(r[1]);l?(e[2]=l[4]??l[1],e[3]=l[5]??l[2],e[4]=l[3]):r[2]&&(e[2]=r[1]),r[2]&&(s={column:r[4]?+r[4]:void 0,file:r[2],line:r[3]?+r[3]:void 0,methodName:"eval",raw:t,type:"eval"})}else{const l=un.exec(t);l&&(i={column:l[4]?+l[4]:void 0,file:l[2],line:l[3]?+l[3]:void 0},s={column:l[6]?+l[6]:void 0,file:l[1],line:l[5]?+l[5]:void 0,methodName:"eval",raw:l[0],type:"eval"})}}const[c,a]=dt(e[1]?e[1].replace(pt,"<anonymous>"):Q,e[2]),u={column:e[4]?+e[4]:void 0,evalOrigin:s,file:a,line:e[3]?+e[3]:void 0,methodName:c,raw:t,type:o?"eval":n?"native":rn(a)?"internal":void 0};return i?(u.column=i.column,u.file=i.file,u.line=i.line):ft(u,`${a}:${e[3]}:${e[4]}`),u}},kn=(t,e)=>{const n=fn.exec(t);if(n){Y(`parse gecko error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const o=n[3]?.includes(" > eval"),s=o&&n[3]&&mn.exec(n[3]);let i;o&&s&&(n[3]=s[1],i={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:t,type:"eval"},n[4]=s[2]);const[c,a]=dt(n[1]?n[1].replace(pt,"<anonymous>"):Q,n[3]);let u;(e?.type==="safari"||!o&&e?.type==="firefox")&&e.column?u=e.column:!o&&n[5]&&(u=+n[5]);let r;return(e?.type==="safari"||!o&&e?.type==="firefox")&&e.line?r=e.line:n[4]&&(r=+n[4]),{column:u,evalOrigin:i,file:a,line:r,methodName:c,raw:t,type:o?"eval":a.includes("[native code]")?"native":void 0}}},En=(t,e)=>{const n=gn.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return Y(`parse firefox error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:e?.column??void 0,file:n[2],line:n[3]?+n[3]:e?.line??void 0,methodName:n[1]||Q,raw:t,type:void 0}},Cn=t=>{const e=dn.exec(t);if(e)return Y(`parse react android native error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:Q,raw:t,type:void 0}},mt=(t,{filter:e,frameLimit:n=50}={})=>{const o=t;let s=(typeof o.stacktrace=="string"?o.stacktrace:t.stack??"").split(`
9
+ `).map(i=>(De.test(i)?i.replace(De,"$1"):i).trim()).filter(i=>!vn.test(i)&&i!=="eval code");return e&&(s=s.filter(i=>e(i))),s=s.slice(0,n),s.reduce((i,c,a)=>{if(!c||c.length>1024)return i;let u;if($n.test(c))u=Nn(c);else if(bn.test(c))u=An(c);else if(xn.test(c)){let r;if(a===0){const l=t,d=l.columnNumber,h=l.lineNumber,f=l.line,p=l.column;d||h?r={column:d,line:h,type:"firefox"}:(f||p)&&(r={column:p,line:f,type:"safari"})}u=En(c,r)??kn(c,r)}else u=Cn(c);return u?i.push(u):Y(`parse error stack line: "${c}"`,"not parser found"),i},[])},On=ht(import.meta.url),te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Le=t=>{if(typeof te<"u"&&te.versions&&te.versions.node){const[e,n]=te.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return te.getBuiltinModule(t)}return On(t)},{existsSync:_n,readFileSync:In}=Le("node:fs"),{relative:Ln,resolve:Ue,sep:Sn}=Le("node:path"),{cwd:Tn}=te,{fileURLToPath:Mn}=Le("node:url"),Z=(t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),gt=t=>t.replaceAll("\\","/"),Pn=(t,e)=>{const n=t.replace("async file:","file:");return gt(Ln(e,n.startsWith("file:")?Mn(n):n))},Dn=(t,e,n)=>{if(e)return n.title(t.message);const o=t.message?`: ${t.message}`:"";return n.title(t.name+o)},wt=(t,{color:e,hideErrorTitle:n,indentation:o,prefix:s},i)=>`${Z(s,o,i)}${Dn(t,n,e)}
10
+ `,yt=(t,{color:e,indentation:n,prefix:o},s)=>{if(t.hint===void 0)return;const i=Z(o,n,s);let c="";if(Array.isArray(t.hint))for(const a of t.hint)c+=`${i+a}
11
+ `;else c+=i+t.hint;return e.hint(c)},vt=(t,e)=>{if(!e||t.file===void 0||t.line===void 0)return{trace:t};try{const n=e({column:t.column,file:t.file,line:t.line});return n?{source:n.source,trace:{...t,column:n.column??t.column,file:n.file??t.file,line:n.line??t.line}}:{trace:t}}catch{return{trace:t}}},Se=(t,e,n=0)=>{const{color:o,cwd:s,displayShortPath:i,indentation:c,prefix:a}=e,{trace:u}=vt(t,e.sourceMap),r=i?Pn(u.file,s):gt(u.file),{fileLine:l,method:d}=o;return`${Z(a,c,n)}at ${u.methodName?`${d(u.methodName)} `:""}${l(r)}:${l(u.line?.toString()??"")}`},Un=(t,e)=>{if(e.allowAllFilePaths)return!0;const n=Ue(e.cwd),o=Ue(n,t);return o===n||o.startsWith(n+Sn)},$t=(t,e,n)=>{const{color:o,indentation:s,linesAbove:i,linesBelow:c,prefix:a,showGutter:u,showLineNumbers:r,tabWidth:l}=e,{source:d,trace:h}=vt(t,e.sourceMap);if(h.file===void 0)return;let f;if(d===void 0){const p=h.file.replace("file://","");if(!Un(p,e)||!_n(p))return;f=In(p,"utf8")}else f=d;return Xt(f,{start:{column:h.column,line:h.line}},{color:o,linesAbove:i,linesBelow:c,prefix:Z(a,s,n),showGutter:u,showLineNumbers:r,tabWidth:l})},bt=(t,e,n)=>{if(t.errors.length===0)return;let o=`${Z(e.prefix,e.indentation,n)}Errors:
12
+
13
+ `,s=!0;for(const i of t.errors)s?s=!1:o+=`
14
+
15
+ `,o+=Nt(i,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
16
+ ${o}`},xt=(t,e,n,o=new Set)=>{o.add(t);let s=`${Z(e.prefix,e.indentation,n)}Caused by:
17
+
18
+ `;const i=t.cause;s+=wt(i,e,n);const c=mt(i).shift(),a=yt(i,e,n);if(a&&(s+=`${a}
19
+ `),c&&(s+=Se(c,e,n),!e.hideErrorCauseCodeView)){const u=$t(c,e,n);u!==void 0&&(s+=`
20
+ ${u}`)}if(i instanceof AggregateError){const u=bt(i,e,n);u!==void 0&&(s+=`
21
+ ${u}`)}return i.cause&&(s+=o.has(i)?`
22
+ ${Z(e.prefix,e.indentation,n+1)}Caused by: [Circular]`:`
23
+ ${xt(i,e,n+1,o)}`),`
24
+ ${s}`},jn=(t,e)=>(t.length>0?`
25
+ `:"")+t.map(n=>Se(n,e)).join(`
26
+ `),Nt=(t,e,n)=>{const o={allowAllFilePaths:!1,cwd:Tn(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...e,color:{fileLine:c=>c,gutter:c=>c,hint:c=>c,marker:c=>c,message:c=>c,method:c=>c,title:c=>c,...e.color}},s=mt(t,{filter:e.filterStacktrace,frameLimit:o.framesMaxLimit}),i=s.shift();return[e.hideMessage?void 0:wt(t,o,n),yt(t,o,n),i?Se(i,o,n):void 0,i&&!o.hideErrorCodeView?$t(i,o,n):void 0,t instanceof AggregateError?bt(t,o,n):void 0,t.cause===void 0?void 0:xt(t,o,n),s.length>0?jn(s,o):void 0].filter(Boolean).join(`
27
+ `)},Vn=(t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return Nt(t,e,0)};class oe extends Error{loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:o,message:s,name:i,stack:c,title:a}){super(s,{cause:e}),this.title=a,this.name=i,this.stack=c??this.stack,this.loc=o,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}}class k extends oe{code;context;constructor(e,n,o){super({message:e,name:"CerebroError"}),this.code=n,this.context=o}}const z=t=>"Deno"in t,W=t=>"Bun"in t,ye=()=>{if(z(globalThis)){const t=globalThis.Deno,e=t.execPath();let n=e;try{const{importMeta:o}=globalThis;o?.url&&(n=o.url)}catch{}return[e,n,...t.args]}return W(globalThis)?globalThis.Bun.process.argv:process.argv},Bn=()=>z(globalThis)?globalThis.Deno.cwd():W(globalThis)?globalThis.Bun.process.cwd():process.cwd(),he=()=>{if(z(globalThis)){const t=globalThis.Deno;return new Proxy(t.env.toObject(),{get:(e,n)=>typeof n=="string"?t.env.get(n):e[n],has:(e,n)=>typeof n=="string"?t.env.has(n):n in e,set:(e,n,o)=>typeof n=="string"?(o===void 0||t.env.set(n,o),!0):!1})}return W(globalThis)?globalThis.Bun.process.env:process.env},At=()=>z(globalThis)?[]:W(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,kt=()=>z(globalThis)?globalThis.Deno.execPath():W(globalThis)?globalThis.Bun.process.execPath:process.execPath,Rn=()=>{if(z(globalThis)){const t=globalThis.Deno.build?.os??"unknown";return t==="windows"?"win32":t}return W(globalThis)?globalThis.Bun.platform??"unknown":process.platform},zn=()=>{if(z(globalThis)){const t=globalThis.Deno.build?.arch??"unknown";return t==="x86_64"?"x64":t==="aarch64"?"arm64":t}return W(globalThis)?globalThis.Bun.process.arch:process.arch},R=(t=0)=>{if(z(globalThis))throw globalThis.Deno.exit(t),new Error("Deno exit failed");if(W(globalThis))throw globalThis.Bun.process.exit(t),new Error("Bun exit failed");process.exit(t)},je=(t,e)=>{if(z(globalThis))return()=>{};if(W(globalThis)){try{const o=globalThis.Bun;if(o.process?.on)return o.process.on(t,e),()=>{o.process?.removeListener&&o.process.removeListener(t,e)}}catch{}return()=>{}}const n=process;return n.on(t,e),()=>{n.removeListener(t,e)}},B=new Uint32Array(65536),Wn=(t,e)=>{const n=t.length,o=e.length,s=1<<n-1;let i=-1,c=0,a=n,u=n;for(;u--;)B[t.charCodeAt(u)]|=1<<u;for(u=0;u<o;u++){let r=B[e.charCodeAt(u)];const l=r|c;r|=(r&i)+i^i,c|=~(r|i),i&=r,c&s&&a++,i&s&&a--,c=c<<1|1,i=i<<1|~(l|c),c&=l}for(u=n;u--;)B[t.charCodeAt(u)]=0;return a},Fn=(t,e)=>{const n=e.length,o=t.length,s=[],i=[],c=Math.ceil(n/32),a=Math.ceil(o/32);for(let p=0;p<c;p++)i[p]=-1,s[p]=0;let u=0;for(;u<a-1;u++){let p=0,g=-1;const $=u*32,w=Math.min(32,o)+$;for(let y=$;y<w;y++)B[t.charCodeAt(y)]|=1<<y;for(let y=0;y<n;y++){const b=B[e.charCodeAt(y)],N=i[y/32|0]>>>y&1,E=s[y/32|0]>>>y&1,I=b|p,O=((b|E)&g)+g^g|b|E;let m=p|~(O|g),v=g&O;m>>>31^N&&(i[y/32|0]^=1<<y),v>>>31^E&&(s[y/32|0]^=1<<y),m=m<<1|N,v=v<<1|E,g=v|~(I|m),p=m&I}for(let y=$;y<w;y++)B[t.charCodeAt(y)]=0}let r=0,l=-1;const d=u*32,h=Math.min(32,o-d)+d;for(let p=d;p<h;p++)B[t.charCodeAt(p)]|=1<<p;let f=o;for(let p=0;p<n;p++){const g=B[e.charCodeAt(p)],$=i[p/32|0]>>>p&1,w=s[p/32|0]>>>p&1,y=g|r,b=((g|w)&l)+l^l|g|w;let N=r|~(b|l),E=l&b;f+=N>>>o-1&1,f-=E>>>o-1&1,N>>>31^$&&(i[p/32|0]^=1<<p),E>>>31^w&&(s[p/32|0]^=1<<p),N=N<<1|$,E=E<<1|w,l=E|~(y|N),r=N&y}for(let p=d;p<h;p++)B[t.charCodeAt(p)]=0;return f},qn=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return e.length===0?t.length:t.length<=32?Wn(t,e):Fn(t,e)},Gn=ve(import.meta.url),ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Hn=t=>{if(typeof ae<"u"&&ae.versions&&ae.versions.node){const[e,n]=ae.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ae.getBuiltinModule(t)}return Gn(t)},{createRequire:Jn}=Hn("node:module"),Et=String.raw,Ve=Et`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Kn=()=>new RegExp(Et`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${Ve}(?:\u200D${Ve})*`,"gu");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const gs=/^[ \t]*(?:\r\n|\r|\n)/,ws=/(?:\r\n|\r|\n)[ \t]*$/,ys=/^(?:[\r\n]|$)/,vs=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,$s=/^[ \t]*[\r\n][ \t\r\n]*$/,bs=/\r\n|\n|\r/g,xs=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,Ns=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,G=Kn(),Yn=/[-_./\s]+/g,we=/(\u001B\[[0-9;]*[a-z])/i,Be=new RegExp("\\p{Script=Arabic}","u"),Qn=new RegExp("\\p{Script=Bengali}","u"),X=new RegExp("\\p{Script=Cyrillic}","u"),Zn=new RegExp("\\p{Script=Devanagari}","u"),Xn=new RegExp("\\p{Script=Ethiopic}","u"),xe=new RegExp("\\p{Script=Greek}","u"),Re=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),eo=new RegExp("\\p{Script=Gujarati}","u"),to=new RegExp("\\p{Script=Gurmukhi}","u"),ze=new RegExp("\\p{Script=Hangul}","u"),We=new RegExp("\\p{Script=Hebrew}","u"),no=new RegExp("\\p{Script=Hiragana}","u"),Fe=new RegExp("\\p{Script=Han}","u"),oo=new RegExp("\\p{Script=Kannada}","u"),io=new RegExp("\\p{Script=Katakana}","u"),so=new RegExp("\\p{Script=Khmer}","u"),ro=new RegExp("\\p{Script=Lao}","u"),M=new RegExp("\\p{Script=Latin}","u"),ao=new RegExp("\\p{Script=Malayalam}","u"),lo=new RegExp("\\p{Script=Myanmar}","u"),co=new RegExp("\\p{Script=Oriya}","u"),uo=new RegExp("\\p{Script=Sinhala}","u"),ho=new RegExp("\\p{Script=Tamil}","u"),po=new RegExp("\\p{Script=Telugu}","u"),fo=new RegExp("\\p{Script=Thai}","u"),mo=new RegExp("\\p{Script=Tibetan}","u"),qe=/[\u02BB\u02BC\u0027]/u,go=t=>t.replace(G,"");let wo=class{capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const o=this.cache.keys().next().value;o!==void 0&&this.cache.delete(o)}this.cache.set(e,n)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}};const yo=Jn(import.meta.url),le=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,vo=t=>{if(typeof le<"u"&&le.versions&&le.versions.node){const[e,n]=le.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return le.getBuiltinModule(t)}return yo(t)},{stripVTControlCharacters:$o}=vo("node:util"),Ne=new wo(1e3),bo=/[.*+?^${}()|[\]\\]/g,xo=t=>{const e=t.join("");if(Ne.has(e)){const s=Ne.get(e);return s.lastIndex=0,s}const n=t.map(s=>s.replaceAll(bo,String.raw`\$&`)).join("|"),o=new RegExp(n,"g");return Ne.set(e,o),o},No=t=>{const e=[];let n=0,o;for(G.lastIndex=0;(o=G.exec(t))!==null;)o.index>n&&e.push(t.slice(n,o.index)),e.push(o[0]),n=G.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},Ao=/[ČŠŽĐ]/i,Ct=new Uint8Array(128),Ot=new Uint8Array(128),_t=new Uint8Array(128);for(let t=0;t<128;t++)Ct[t]=t>=65&&t<=90?1:0,Ot[t]=t>=97&&t<=122?1:0,_t[t]=t>=48&&t<=57?1:0;const Ae=t=>Ct[t],Ge=t=>Ot[t],ke=t=>_t[t],F=(t,e,n,o,s)=>{if(t.length===0)return[];let i=!1;const c=Object.values(e);for(const f of c)if(f(t[0])){i=!0;break}if(!i&&!n)return[t];const a=[...t],u=[];let r=a[0],l="other";const d=Object.entries(e);for(const f of d){const[p,g]=f;if(g(a[0])){l=p;break}}let h=n&&o?a[0]===a[0].toLocaleUpperCase(o):!1;for(let f=1;f<a.length;f++){const p=a[f];let g="other";for(const y of d){const[b,N]=y;if(N(p)){g=b;break}}const $=n&&o?p===p.toLocaleUpperCase(o):!1;let w=!1;s?w=s(l,g,h,$,p,f,a):(l!==g&&l!=="other"&&g!=="other"&&(w=!0),n&&g!=="other"&&!h&&$&&(w=!0)),w?(u.push(r),r=p):r+=p,l=g,n&&(h=$)}return r&&r.length>0&&u.push(r),u.length>0?u:[t]},ko=(t,e,n,o)=>{if(n.size===0)return e;for(const s of n)if(t.startsWith(s,e))return o.push(s),e+s.length;return e},It=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const o=[],s=t.length;for(let i=1;i<s;i++){const c=ko(t,n,e,o);if(c!==n){n=c,i=n-1;continue}const a=t.codePointAt(i-1),u=t.codePointAt(i),r=a&&a<128&&Ae(a),l=u&&u<128&&Ae(u),d=a&&a<128&&Ge(a),h=a&&a<128&&ke(a),f=u&&u<128&&ke(u);if(d&&l){o.push(t.slice(n,i)),n=i;continue}if(h&&!f||!h&&f){o.push(t.slice(n,i)),n=i;continue}if(f&&!h){let p=!1,g=!1;if(i+1<s){const $=t.codePointAt(i+1);p=$&&$<128&&Ae($),g=$&&$<128&&ke($)}if(!g&&p){o.push(t.slice(n,i),t.slice(i,i+1)),n=i+1;continue}}if(i+1<s){const p=t.codePointAt(i+1),g=p&&p<128&&Ge(p);if(r&&l&&g){const $=t.slice(n,i+1);e.has($)||(o.push(t.slice(n,i)),n=i)}}}return n<s&&o.push(t.slice(n)),o.filter(i=>i!=="")},Lt=(t,e,n)=>{if(t.length===0)return[];const o=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!o&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e),p=f,g=f?0:-1;for(let $=1;$<l;$++){const w=r[$],y=w===w.toLocaleUpperCase(e);if(y===f)h+=w;else if(y)h&&h.length>0&&(d.push(h),h=w),p=!0,g=$;else{if(p&&$-g>1){const b=r[$-1],N=h.slice(0,-1);N&&N.length>0&&d.push(N),h=b+w}else h+=w;p=!1,g=-1}f=y}return h&&h.length>0&&d.push(h),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!X.test(t)&&!M.test(t))return[t];const r=[...t],l=r.length,d=[];let h=r[0];const f=r[0];let p;X.test(f)?p=1:M.test(f)?p=2:p=0;let g=f===f.toLocaleUpperCase(e);for(let w=1;w<l;w++){const y=r[w];let b;X.test(y)?b=1:M.test(y)?b=2:b=0;const N=y===y.toLocaleUpperCase(e);p!==b&&(p===1||p===2)&&(b===1||b===2)||b===p&&!g&&N?(d.push(h),h=y):h+=y,p=b,g=N}h&&h.length>0&&d.push(h);const $=[];for(let w=0;w<d.length;w++)w<d.length-1&&d[w].length===1&&M.test(d[w])&&X.test(d[w+1][0])?($.push(d[w]+d[w+1]),w+=1):$.push(d[w]);return $}if(e.startsWith("el")){if(!xe.test(t)&&!M.test(t))return[t];const r=[];Re.lastIndex=0;let l;for(;(l=Re.exec(t))!==null;)r.push(l[0]);r.length===0&&r.push(t);const d=[];if(r.length===1){const h=r[0];if(!h||!xe.test(h[0])||h.length===1)return[h??t]}for(const h of r){if(!h)continue;if(!xe.test(h[0])||h.length===1){d.push(h);continue}const f=h.length;let p=h[0],g=h[0]===h[0].toLocaleUpperCase(e);for(let $=1;$<f;$++){const w=h[$],y=w===w.toLocaleUpperCase(e);!g&&y?(d.push(p),p=w):p+=w,g=y}p&&d.push(p)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const r=e.startsWith("ja"),l=r?{hiragana:h=>no.test(h),kanji:h=>Fe.test(h),katakana:h=>io.test(h),latin:h=>M.test(h)}:{hangul:h=>ze.test(h),latin:h=>M.test(h)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(r){const h=F(t,l,!1,e,(p,g)=>p==="hiragana"&&g==="katakana"||p==="katakana"&&g==="hiragana"||p==="hiragana"&&g==="latin"||p==="katakana"&&g==="latin"||p==="kanji"&&g==="latin"||p==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),f=[];for(const p of h){const g=p;g.length===1&&d.has(g)&&f.length>0?f[f.length-1]=f.at(-1)+g:f.push(g)}return f.length>0?f:[t]}return F(t,l,!1,e,(h,f)=>h==="hangul"&&f==="latin"||h==="latin"&&f==="hangul")}if(e.startsWith("sl")){const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let p=1;p<l;p++){const g=r[p],$=g===g.toLocaleUpperCase(e),w=Ao.test(g),y=p<l-1&&r[p+1]===r[p+1].toLocaleUpperCase(e);!f&&$||w&&y?(d.push(h),h=g,w&&y&&(d.push(h),h="")):h+=g,f=$}return h&&h.length>0&&d.push(h),d}if(e.startsWith("zh"))return F(t,{han:r=>Fe.test(r),latin:r=>M.test(r)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const r=l=>We.test(l)||Be.test(l);return F(t,{latin:l=>M.test(l),rtl:l=>r(l)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const r=l=>Zn.test(l)||Qn.test(l)||eo.test(l)||to.test(l)||oo.test(l)||ho.test(l)||po.test(l)||ao.test(l)||uo.test(l)||fo.test(l)||ro.test(l)||mo.test(l)||lo.test(l)||Xn.test(l)||so.test(l)||co.test(l);return F(t,{indic:l=>r(l),latin:l=>M.test(l)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return F(t,{cyrillic:r=>X.test(r),latin:r=>M.test(r)},!0,e);if(["ar","fa","he"].includes(e))return F(t,{latin:r=>M.test(r),rtl:r=>We.test(r)||Be.test(r)},!1,e);if(e.startsWith("ko"))return F(t,{hangul:r=>ze.test(r),latin:r=>M.test(r)},!1,e);if(e.startsWith("uz")){if(!X.test(t)&&!M.test(t))return[t];const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let p=1;p<l;p++){const g=r[p],$=g===g.toLocaleUpperCase(e);if(qe.test(g)||qe.test(r[p-1])){h+=g;continue}!f&&$?(d.push(h),h=g):h+=g,f=$}return h&&h.length>0&&d.push(h),d}const s=[...t],i=s.length,c=[];let a=s[0],u=s[0]===s[0].toLocaleUpperCase(e);for(const r of n)if(t.startsWith(r)){c.push(r),a=s[r.length],u=a===a.toLocaleUpperCase(e);break}for(let r=1;r<i;r++){const l=s[r],d=l===l.toLocaleUpperCase(e);let h=0;for(const f of n)if(t.startsWith(f,r)){c.push(a,f),h=f.length,a="";const p=f.at(-1);p&&(u=p===p.toLocaleUpperCase(e));break}if(h>0){r+=h-1;continue}!u&&d?(c.push(a),a=l):a+=l,u=d}return a&&c.push(a),c},Eo=(t,e,n)=>{const o=[],s=we.test(t)?t.split(we).filter(Boolean):[t];for(const i of s){const c=i;if(we.test(c))o.push(c);else{G.lastIndex=0;const a=G.test(c)?No(c).filter(Boolean):[c];for(const u of a)if(G.lastIndex=0,G.test(u))o.push(u);else if(e){const r=e.toLowerCase().split("-")[0];o.push(...Lt(u,r,n))}else o.push(...It(u,n))}}return o},Co=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:o=!1,knownAcronyms:s=[],locale:i,normalize:c=!1,separators:a,stripAnsi:u=!1,stripEmoji:r=!1}=e,l=new Set([...s].toSorted((w,y)=>y.length-w.length));let d=t;u&&(d=$o(d)),r&&(d=go(d));let h;Array.isArray(a)?h=xo(a):a instanceof RegExp?h=a:h=Yn;const f=[];let p=d;const g=h.flags.includes("g")?h:new RegExp(h.source,`${h.flags}g`);for(;p.length>0;){const w=g.exec(p);if(!w){p===".."?f.push(".."):p==="."?f.push("."):p.length>0&&f.push(p);break}const y=w.index,b=w[0],N=b.length,E=p.slice(0,y),I=p.slice(y+N);if(b.startsWith("../"))f.push(".."),p=p.slice(y+3);else if(b.startsWith("./"))f.push("."),p=p.slice(y+2);else if(y===0&&b==="..")f.push(".."),p=p.slice(2);else if(y===0&&b===".")f.push("."),p=p.slice(1);else{E.length>0&&f.push(E);let O=0;for(;(O=b.indexOf("../",O))!==-1;)f.push(".."),O+=3;for(O=0;(O=b.indexOf("./",O))!==-1;)(O===0||b[O-1]!==".")&&f.push("."),O+=2;let m=I;for(;m.startsWith("../");)f.push(".."),m=m.slice(3);for(;m.startsWith("./");)f.push("."),m=m.slice(2);if(m===".."){f.push("..");break}else if(m==="."){f.push(".");break}else p=m}g.lastIndex=0}if(f.length===0){const w=d.split(h).filter(Boolean);f.push(...w)}let $=[];for(const w of f)n||o?$.push(...Eo(w,i,l)):i?$.push(...Lt(w,i,l)):$.push(...It(w,l));return c&&($=$.map(w=>l.has(w)?w:i&&w===w.toLocaleUpperCase(i)?w[0]+w.slice(1).toLocaleLowerCase(i):w.toUpperCase()===w&&!l.has(w)?w.slice(0,1)+w.slice(1).toLowerCase():w)),$},Oo=ve(import.meta.url),ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_o=t=>{if(typeof ce<"u"&&ce.versions&&ce.versions.node){const[e,n]=ce.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ce.getBuiltinModule(t)}return Oo(t)},{writeFile:Io,stat:Lo,rm:So,readFile:He,readdir:To,mkdir:Mo,access:Po}=_o("node:fs/promises"),de=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];let H=class extends k{commandName;constructor(t,e=[]){const n=`Command "${t}" not found${e.length>0?`. Did you mean: ${e.join(", ")}?`:""}`;super(n,"COMMAND_NOT_FOUND",{commandName:t,suggestions:e}),this.name="CommandNotFoundError",this.commandName=t,e.length>0&&(this.hint=`Try one of these commands: ${e.join(", ")}`)}},St=class extends k{option1;option2;constructor(t,e){super(`Options "${t}" and "${e}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:t,option2:e}),this.name="ConflictingOptionsError",this.option1=t,this.option2=e,this.hint=`Remove either --${t} or --${e}`}},Do=class extends k{unknownOptions;constructor(t,e){const n=t.join(", "),o=`Found unknown ${t.length===1?"option":"options"}: ${n}`;super(o,"UNKNOWN_OPTION",{suggestions:e,unknownOptions:t}),this.name="UnknownOptionError",this.unknownOptions=t,e&&e.length>0&&(this.hint=`Did you mean: ${e.join(", ")}?`)}},Uo=class extends k{pluginName;constructor(t,e,n){super(`Plugin "${t}" error: ${e}`,"PLUGIN_ERROR",{originalError:n,pluginName:t}),this.name="PluginError",this.pluginName=t,n&&(this.cause=n)}},jo=class{logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(t){this.logger=t}hasPlugins(){return this.plugins.size>0}register(t){if(this.initialized)throw new Error(`Cannot register plugin "${t.name}" after initialization`);if(this.plugins.has(t.name))throw new Error(`Plugin "${t.name}" is already registered`);he().CEREBRO_OUTPUT_LEVEL===String(V)&&this.logger.debug(`registering plugin: ${t.name}`),this.plugins.set(t.name,t),this.cachedDependencyOrder=void 0}async init(t){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const e=this.getDependencyOrder();this.logger.debug(`initializing ${String(e.length)} plugin(s)...`);for(const n of e)if(typeof n.init=="function"){this.logger.debug(`initializing plugin: ${n.name}`);try{await n.init(t)}catch(o){const s=new Uo(n.name,`Failed to initialize: ${o instanceof Error?o.message:String(o)}`,o instanceof Error?o:void 0);throw this.logger.error(s.message),s}}this.initialized=!0}async executeLifecycle(t,e,n){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const o=this.getDependencyOrder();for(const s of o){const i=s[t];if(typeof i=="function"){this.logger.debug(`executing ${t} hook for plugin: ${s.name}`);try{await(t==="afterCommand"?i(e,n):i(e))}catch(c){throw this.logger.error(`Error in ${t} hook for plugin "${s.name}":`,c),c}}}}async executeErrorHandlers(t,e){if(!this.initialized||this.plugins.size===0)return;const n=this.getDependencyOrder();for(const o of n)if(typeof o.onError=="function"){this.logger.debug(`executing error handler for plugin: ${o.name}`);try{await o.onError(t,e)}catch(s){this.logger.error(`Error in error handler for plugin "${o.name}":`,s)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const t=[],e=new Set,n=new Set,o=s=>{if(e.has(s))return;if(n.has(s))throw new Error(`Circular dependency detected involving plugin "${s}"`);const i=this.plugins.get(s);if(!i)throw new Error(`Plugin "${s}" not found`);if(n.add(s),i.dependencies)for(const c of i.dependencies)o(c);n.delete(s),e.add(s),t.push(i)};for(const s of this.plugins.keys())o(s);return this.cachedDependencyOrder=t,t}validateDependencies(){for(const t of this.plugins.values())if(t.dependencies){for(const e of t.dependencies)if(!this.plugins.has(e))throw new Error(`Plugin "${t.name}" depends on "${e}" which is not registered`)}}};const pe=t=>t.type?.name==="Boolean",Vo=t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},Je=t=>(pe(t)||(t.typeLabel=t.typeLabel??Vo(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),Bo=new RegExp(/^-([^\d-])$/),Ro=new RegExp(/^--(\S+)/),zo=new RegExp(/^-([^\d-]{2,})$/),Wo=t=>Bo.test(t)||Ro.test(t)||zo.test(t),Fo=(t,e)=>{const n=e[0]&&Wo(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const o=new Error(`Command not recognised: ${String(n)}`);throw o.command=n,o.name="INVALID_COMMAND",o}return{argv:e,command:n}};class Te extends oe{optionName;value;constructor(e,n,o){super({hint:`Pass a valid ${o} value for '${e}'.`,message:`Invalid ${o} value '${n}' for option '${e}'`,name:"INVALID_VALUE",title:"Invalid Value"}),this.optionName=e,this.value=n,Object.setPrototypeOf(this,Te.prototype)}}let qo=class Tt extends oe{optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,Tt.prototype)}},Ke=class Mt extends oe{optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,Mt.prototype)}},Go=class Pt extends oe{value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,Pt.prototype)}};class S extends oe{constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,S.prototype)}}const Ye=(t,e,n)=>{const o=Number(t);if(e&&Number.isNaN(o)&&String(t).trim().toLowerCase()!=="nan")throw new Te(n??"",String(t),"Number");return o},Qe=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Ze=t=>t===Number||typeof t=="function"&&t.name==="Number",Xe=t=>t===String||typeof t=="function"&&t.name==="String",Ho=(t,e,n={})=>{const{optionName:o,strictTypes:s}=n;return Array.isArray(t)?Qe(e)?t.map(Boolean):Ze(e)?t.map(i=>Ye(i,s,o)):Xe(e)?t.map(String):t.map(i=>e(String(i))):t===null?null:Qe(e)?!!t:Ze(e)?Ye(t,s,o):Xe(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t))},_=(t,e,n,...o)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...o)},Jo=/-([a-z])/g,Ko=/^\d+$/,fe=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Yo=t=>t.codePointAt(0)===95,et=(t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],tt=t=>t==="__proto__"||t==="constructor"||t==="prototype",nt=(t,e,n,o=!1)=>{t[e]===void 0?t[e]=o?[n]:n:o&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},ot=(t,e,n,o,s)=>{let i=e.get(t)??n.get(t);if(!i&&o){const c=t.toLowerCase();i=o.get(c)??s?.get(c)}return i},Qo=(t,e,n,o)=>{const s=n.debug??!1;_(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),_(s,"Starting argument resolution","resolver"),_(s,"Tokens:","resolver",t),_(s,"Definitions:","resolver",e),_(s,"Processing tokens...","resolver");const i=new Map,c=new Map,a=n.caseInsensitive?new Map:void 0,u=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,l=n.camelCase?new Map:void 0;for(const m of e)if(i.set(m.name,m),m.alias&&c.set(m.alias,m),n.caseInsensitive&&a&&(a.set(m.name.toLowerCase(),m),m.alias&&u&&u.set(m.alias.toLowerCase(),m)),n.camelCase&&r&&l){const v=m.name.replaceAll(Jo,(x,L)=>L.toUpperCase());r.set(m.name,v),l.set(v,m.name)}const d=Object.create(null),h=Object.create(null),f=[],p=[],g=new Set;let $=!1;const w=e.find(m=>m.defaultOption),y=e.some(m=>m.group),b=e.find(m=>m.type===Number);for(let m=0;m<t.length;m++){const v=t[m];if(v.kind==="option-terminator"){d._unknown=o.slice(v.index),$=!0;break}if(v.kind==="option"&&v.name){let x=ot(v.name,i,c,a,u);!x&&v.value===void 0&&b&&Ko.test(v.name)&&(x=b,v.value=v.name,v.name=b.name);let L=!1;if(!x&&n.negation&&v.value===void 0&&v.name.startsWith("no-")){const C=v.name.slice(3),P=ot(C,i,c,a,u);P?.type&&fe(P.type)&&(x=P,L=!0)}const A=x?x.name:v.name,T=x?.multiple,D=x?.lazyMultiple;if(Object.hasOwn(h,A)&&h[A]!==void 0&&!T&&!D&&!n.partial)throw new qo(A);if(!x&&n.partial){const C=v.rawName??`--${v.name}${v.value!==void 0&&v.inlineValue?`=${v.value}`:""}`;f.push({index:v.index,value:C});continue}if(!x&&n.stopAtFirstUnknown){d._unknown=o.slice(v.index);break}if(!x&&!n.partial)throw new Ke(v.name);if(v.value===void 0){const C=t[m+1],P=C?.kind==="option"&&!("name"in C)&&C.value!==void 0,U=C&&x&&!(x.type&&fe(x.type))&&(C.kind==="positional"||P),Rt=x&&x.defaultOption&&!x.multiple&&!x.lazyMultiple;if(U&&(!x?.defaultOption||Rt))if(T){let j=m+1;const $e=[];for(;j<t.length&&(t[j].kind==="positional"||t[j].kind==="option"&&!("name"in t[j])&&t[j].value!==void 0);)$e.push(t[j].value),g.add(t[j].index),j++;h[A]=h[A]===void 0?$e:et(h[A],$e),m=j-1}else D?(nt(h,A,C.value,!0),g.add(C.index),m++):(h[A]=C.value,g.add(C.index),m++);else x?.type&&fe(x.type)?nt(h,A,!L,T):h[A]=T?[]:null}else{let{value:C}=v;if(x?.type&&fe(x.type))switch(C){case"":{if(n.partial){h._unknown??=[];const U=`${v.rawName??`--${v.name}`}${v.value?`=${v.value}`:""}`;h._unknown.push(U),p.push({index:v.index,value:U}),C=!0}else throw new Ke(v.name);break}case"false":{C=!1;break}case"true":{C=!0;break}default:C=!0}const P=[C];if(T){let U=m+1;for(;U<t.length&&t[U].kind==="positional";)P.push(t[U].value),g.add(t[U].index),U++;m=U-1}h[A]===void 0?h[A]=T||D?P:C:T||D?h[A]=et(h[A],P):h[A]=C}}else if(v.kind==="positional"&&n.stopAtFirstUnknown&&!g.has(v.index)&&!w){_(s,`Found unconsumed positional token at index ${String(v.index)}, stopping processing`,"resolver"),d._unknown=o.slice(v.index);break}}for(const[m,v]of Object.entries(h)){const x=i.get(m);x&&(x.multiple||x.lazyMultiple)&&!Array.isArray(v)&&(h[m]=[v])}const N=m=>m.kind==="option"&&!i.has(m.name??"")&&!c.has(m.name??"")&&(!n.caseInsensitive||!a?.has(m.name?.toLowerCase()??"")&&!u?.has(m.name?.toLowerCase()??""));let E=-1,I=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!$&&(E=t.findIndex(m=>N(m)),E!==-1&&(I=t[E].index)),w){const m=[],v=[];for(const x of t)x.kind==="positional"&&!g.has(x.index)&&x.index<I&&(m.push(x.value),v.push(x));if(m.length>0){const x=h[w.name],L=w.multiple??w.lazyMultiple;x===void 0?L?(v.forEach(A=>g.add(A.index)),h[w.name]=m):(g.add(v[0].index),h[w.name]=m[0]):L&&(v.forEach(A=>g.add(A.index)),h[w.name]=Array.isArray(x)?[...m,...x]:[...m,x])}}if(!n.partial){for(const m of t)if(m.kind==="positional"&&!g.has(m.index))throw new Go(o[m.index])}if(n.partial&&!n.stopAtFirstUnknown){const m=[...f];if(h._unknown)for(const v of p)m.push({index:v.index,value:v.value});for(const v of t)v.kind==="positional"&&!g.has(v.index)&&m.push({index:v.index,value:o[v.index]});m.length>0&&(m.sort((v,x)=>v.index-x.index),d._unknown=m.map(v=>v.value))}if(n.stopAtFirstUnknown&&!$){const m=t.findIndex(x=>x.kind==="positional"&&!g.has(x.index));let v=-1;if(E!==-1&&m!==-1?v=Math.min(E,m):E!==-1?v=E:m!==-1&&(v=m),v>=0){const x=t[v].index;d._unknown=o.slice(x)}}else f.length>0&&!n.partial&&(d._unknown=f.map(m=>m.value));for(const[m,v]of Object.entries(h)){const x=n.camelCase?r?.get(m)??m:m,L=i.get(m);L?.type?d[x]=Ho(v,L.type,{optionName:L.name,strictTypes:n.strictTypes}):d[x]=v===void 0?null:v}for(const m of e){const v=n.camelCase?r?.get(m.name)??m.name:m.name;!(v in d)&&m.defaultValue!==void 0&&(m.multiple??m.lazyMultiple?d[v]=Array.isArray(m.defaultValue)?[...m.defaultValue]:[m.defaultValue]:d[v]=m.defaultValue)}if(y){const m={},v={},x={};for(const A of e)if(A.group){const T=Array.isArray(A.group)?A.group:[A.group];for(const D of T)tt(D)||(m[D]??={})}for(const A of Object.keys(d))if(!Yo(A)){v[A]=d[A];let T=A;n.camelCase&&(T=l?.get(A)??A);const D=i.get(T);if(D?.group){const C=Array.isArray(D.group)?D.group:[D.group];for(const P of C)tt(P)||m[P]&&(m[P][A]=d[A])}else x[A]=d[A]}const L={_all:v};for(const[A,T]of Object.entries(m))L[A]=T;Object.keys(x).length>0&&(L._none=x),d._unknown&&(L._unknown=d._unknown),Object.keys(d).forEach(A=>delete d[A]),Object.assign(d,L)}const O=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));return _(s,"Final parsed result:","resolver",O),O},ne="-".codePointAt(0),K="=",Zo=K.codePointAt(0),Xo="--",ei="-",ti="--",Dt=t=>t.length>2&&t.startsWith(ti),ni=t=>Dt(t)&&!t.includes(K,3),oi=t=>Dt(t)&&t.includes(K,3),ii=t=>{if(t.length!==2||t.codePointAt(0)!==ne||t.codePointAt(1)===ne)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},si=t=>!(t.length<=2||t.codePointAt(0)!==ne||t.codePointAt(1)===ne),ri=t=>{const e=[];let n=0,o=[],s=0,i=-1,c=0;for(;s<o.length||n<t.length;){let a;if(s<o.length?(a=o[s],s++):(a=t[n],n++),c>0?c--:i++,a===Xo){e.push({index:i,kind:"option-terminator"});const u=[...o.slice(s),...t.slice(n)],r=u.map((l,d)=>({index:i+d+1,kind:"positional",value:l}));e.push(...r),i+=u.length;break}if(ii(a)){const u=a.charAt(1);e.push({index:i,kind:"option",name:u,rawName:a});continue}if(si(a)&&!a.includes(K)){const u=[];let r="",l=!1;for(let d=1;d<a.length;d++){const h=a.charAt(d);l?r+=h:h.codePointAt(0)===Zo?l=!0:u.push(`${ei}${h}`)}if(l)if(u.length>0){const d=u.pop();u.push(`${d}=${r}`)}else u.push(r);o=s<o.length?[...u,...o.slice(s)]:u,s=0,c=u.length;continue}if(ni(a)){const u=a.slice(2);e.push({index:i,kind:"option",name:u,rawName:a});continue}if(oi(a)){const u=a.indexOf(K),r=a.slice(2,u),l=a.slice(u+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}if(a.length>2&&a.codePointAt(0)===ne&&a.codePointAt(1)!==ne&&a.includes(K)){const u=a.indexOf(K),r=a.charAt(1),l=a.slice(u+1);e.push({index:i,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}e.push({index:i,kind:"positional",value:a})}return e},ai=/\d/,li=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",ci=t=>typeof t=="function",ui=(t,e,n)=>{const o=n?.debug??!1;_(o,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,i=new Set,c=new Set,a=new Set;let u=0;for(const r of t){if(_(o,"Checking definition:","validation",r),!r.name)throw _(o,"Validation failed: name is required","validation"),new S("Invalid option definition: name is required");if(typeof r.name!="string")throw new S("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new S("Invalid option definition: name cannot be empty");const l=e?r.name.toLowerCase():"";if(s.has(r.name)||e&&c.has(l))throw new S(`Invalid option definition: duplicate name '${r.name}'`);if(i.has(r.name)||e&&a.has(l))throw new S(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(s.add(r.name),e&&c.add(l),r.alias!==void 0){if(typeof r.alias!="string")throw new S("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new S("Invalid option definition: alias must be a single character");if(ai.test(r.alias))throw new S("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new S('Invalid option definition: alias cannot be "-"');const d=e?r.alias.toLowerCase():"";if(i.has(r.alias)||e&&a.has(d))throw new S(`Invalid option definition: duplicate alias '${r.alias}'`);if(s.has(r.alias)||e&&c.has(d))throw new S(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);i.add(r.alias),e&&a.add(d)}if(r.defaultOption&&(u++,r.type!==void 0&&li(r.type)))throw new S("Invalid option definition: defaultOption cannot be Boolean type");if(r.type!==void 0&&!(r.type===Boolean||r.type===Number||r.type===String||typeof r.type=="function"&&ci(r.type)))throw new S("Invalid option definition: invalid type")}if(u>1)throw _(o,"Validation failed: multiple defaultOptions not allowed","validation"),new S("Invalid option definition: multiple defaultOptions not allowed");_(o,"Validation completed successfully","validation")};function hi(t,e={}){const n=e.debug??!1;_(n,"Starting command-line-args parsing","index"),_(n,"Options:","index",e);const o={...e};o.stopAtFirstUnknown&&(o.partial=!0);const s=Array.isArray(t)?t:[t];_(n,"Normalized definitions:","index",s),ui(s,o.caseInsensitive,n?o:void 0);let{argv:i}=o;if(!i&&(i=process.argv.slice(2),process.execArgv.length>0)){const r=new Set(process.execArgv);i=i.filter(l=>!r.has(l))}_(n,"Using argv:","index",i);let c=i;o.caseInsensitive&&(c=i.map(r=>{if(r.startsWith("--")){const l=r.indexOf("="),d=(l===-1?r.slice(2):r.slice(2,l)).toLowerCase();return l===-1?`--${d}`:`--${d}${r.slice(l)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const l=r.slice(1).split("=",2),d=l[0],h=l[1];if(!d)return r;const f=d.toLowerCase();return h===void 0?`-${f}`:`-${f}=${h}`}return r}));const a=ri(c.map(String));_(n,"Tokenized arguments:","index",a);const u=Qo(a,s,o,i);return _(n,"Command-line-args parsing completed","index"),u}class pi{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let Ee=class extends k{commandName;constructor(t,e,n){super(`Failed to load command "${t}": ${e}`,"COMMAND_LOADER_ERROR",{commandName:t,reason:e}),this.name="CommandLoaderError",this.commandName=t,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",n!==void 0&&(this.cause=n)}};const di=/^-{1,2}(\w+)(=(.+))?$/,Ut=(t,e,n,o)=>{const s=di.exec(t);if(s===null)return{};const i=s[1];if(!i)return{};const c=n&&o?n.get(i)??o.get(i):e.find(a=>a.name===i||a.alias===i);return c!==void 0?{argName:c.name,argValue:s[3],option:c}:{}},it=(t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},fi=new Set(["0","1","false","true"]),mi=(t,e,n,o)=>{if(e.length===0||t.length===0)return{};const s=(i,c)=>{const{argName:a,argValue:u,option:r}=Ut(c,e,n,o),{lastOption:l}=i;return r&&pe(r)&&u&&a?i.partial[a]=it(u,r):i.lastName&&l&&pe(l)&&fi.has(c)&&(i.partial[i.lastName]=it(c,l)),{lastName:a,lastOption:r,partial:i.partial}};return t.reduce(s,{partial:{}}).partial},gi=new Set(["0","1","false","true"]),wi=(t,e,n,o)=>{if(e.length===0||t.length===0)return t;const s=(i,c)=>{const{argValue:a,option:u}=Ut(c,e,n,o),{lastOption:r}=i;if(r&&pe(r)&&gi.has(c)){const{args:l}=i;return{args:l.slice(0,-1)}}return u&&pe(u)&&a?{args:i.args}:{args:[...i.args,c],lastOption:u}};return t.reduce(s,{args:[]}).args},yi=t=>{const e=new Map;for(const n of t){const o=e.get(n.name);o?e.set(n.name,{...o,...n}):e.set(n.name,n)}return[...e.values()]},vi=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},$i=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return vi(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},bi=/_./g,xi=/^[A-Z]/,Ni=t=>t.toLowerCase().replaceAll(bi,e=>e[1]?.toUpperCase()??e).replace(xi,e=>e.toLowerCase()),Ai=t=>{if(!t||t.length===0)return{};const e={},n=he();for(const o of t){const s=n[o.name],i=$i(o,s),c=i===void 0?o.defaultValue:i,a=Ni(o.name);e[a]=c}return e},ki=t=>{const e=new Map,n=new Map;for(const o of t)if(e.set(o.name,o),o.alias){const s=Array.isArray(o.alias)?o.alias:[o.alias];for(const i of s)n.set(i,o)}return{optionMapByAlias:n,optionMapByName:e}},jt=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new Ee(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(o){throw new Ee(t.name,o instanceof Error?o.message:String(o),o)}const n=e.default;if(typeof n!="function")throw new Ee(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},Ei=(t,e,n,o)=>{const s=new pi(t.name,t),{_all:i,_unknown:c,positionals:a}=e,u=Object.keys(n).length>0?{...i,...n}:i;ge in u&&delete u[ge],s.argument=a?.[ge]??[],s.rawUnknown=[...c??[]];const r=Object.keys(o).length>0;return s.options=r?{...u,...o}:u,s.env=Ai(t.env),s},Ci=(t,e,n)=>{const o=t.options??[],s=o.length>0;let i=yi(s?[...o,...n]:n);if(i.length>0){for(const r of i)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(i=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:ge,type:t.argument.type,typeLabel:t.argument.typeLabel},...i]);let c,a;if(s){const{optionMapByAlias:r,optionMapByName:l}=ki(o);c=wi(e,o,l,r),a=mi(e,o,l,r)}else c=e,a={};const u=hi(i,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:i,booleanValues:a,parsedArgs:u}},ee=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await jt(t))(e);let Oi=class extends k{commandName;missingOptions;constructor(t,e){super(`Command "${t}" is missing required options: ${e.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:t,missingOptions:e}),this.name="CommandValidationError",this.commandName=t,this.missingOptions=e,this.hint=`Provide the following required options: ${e.join(", ")}`}},_i=class extends k{choices;option;value;constructor(t,e,n){super(`Invalid value "${e}" for option "${t}". Allowed values: ${n.join(", ")}`,"INVALID_CHOICE",{choices:n,option:t,value:e}),this.name="InvalidChoiceError",this.option=t,this.value=e,this.choices=n,this.hint=`Use one of: ${n.map(o=>`--${t} ${o}`).join(", ")}`}};const st=(t,e,n=!1)=>{const o=[];for(const s of t)if(!(!n&&!s.required)&&e[s.name]===void 0){if(s.type?.name==="Boolean"){e[s.name]=!1;continue}o.push(s)}return o},Ii=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:qn(t,e)<=t.length/3,q=(t,e)=>{const n=t.toLowerCase();return e.filter(o=>Ii(o.toLowerCase(),n))},Li=(t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(o=>{const s=o.startsWith("--");let i=`Found unknown ${s?"option":"argument"} "${o}"`;if(s){const c=q(o.replace("--",""),(e.options??[]).map(a=>a.name));if(c.length>0){const[a,...u]=c.map(r=>`--${r}`);i+=u.length>0?`, did you mean ${a??""} or ${u.join(", ")}?`:`, did you mean ${a??""}?`}}n.push(i)}),n.length>0)throw new Error(n.join(`
28
+ `))},Si=(t,e,n)=>{const o=n.__requiredOptions__,s=o?st(o,e,!0):st(t,e,!1);if(s.length>0)throw new Oi(n.name,s.map(i=>i.name));e._unknown&&e._unknown.length>0&&!n.argument&&Li(e,n)},Ti=(t,e,n)=>{const o=n.__conflictingOptions__??t.filter(s=>s.conflicts!==void 0);if(o.length>0){const s=o.find(i=>Array.isArray(i.conflicts)?i.conflicts.some(c=>e[c]!==void 0)&&e[i.name]!==void 0:e[i.conflicts]!==void 0&&e[i.name]!==void 0);if(s)throw new St(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},Mi=(t,e)=>{const n=e.options;if(n)for(const o of n){if(!o.choices||o.choices.length===0)continue;const s=t[o.name];if(s==null)continue;const i=Array.isArray(s)?s:[s];for(const c of i){const a=String(c);if(!o.choices.includes(a))throw new _i(o.name,a,o.choices)}}},Pi=t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const s of t.options){if(s.name){const i=e.get(s.name)??[];i.push(s),e.set(s.name,i)}if(typeof s.alias=="string"&&s.alias.length>0){const i=n.get(s.alias)??[];i.push(s),n.set(s.alias,i)}else if(Array.isArray(s.alias)){for(const i of s.alias)if(i.length>0){const c=n.get(i)??[];c.push(s),n.set(i,c)}}}const o=[];for(const[s,i]of e)i.length>1&&o.push(`Duplicate option name "${s}" in command "${t.name}": ${JSON.stringify(i)}`);for(const[s,i]of n)i.length>1&&o.push(`Duplicate option alias "-${s}" used by options ${i.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(o.length>0)throw new Error(o.join(`
29
+ `))},Di=(t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let o;for(let s=1;s<=e.length;s+=1){const i=e[s-1];if(i===void 0||i.startsWith("-"))break;n.push(i);const c=n.join(" ");t.has(c)&&(o={commandPath:[...n],depth:s})}return o?{argv:e.slice(o.depth),commandPath:o.commandPath}:{argv:e,commandPath:void 0}},J=t=>t.join(" "),rt=(t,e)=>e&&e.length>0?[...e,t]:[t],Ui=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),ji=(t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),Vi=(t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const o=[];let s="",i="";for(let c=0;c<n;c++){const a=t[c];if(we.test(a)){s?(o.push(s+i+a),s="",i=""):(o.length>0&&o.push(e),s=a);continue}s?(i&&(i+=e),i+=a):(o.length>0&&o.push(e),o.push(a))}return o.join("")},Vt=(t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return Vi(Co(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(o=>{const s=o,i=s.toLowerCase();return n?(n=!1,Ui(i)):ji(i)}),"")},Bi=/^no-/,Ri=t=>{t.options?.forEach(e=>{e.__camelCaseName__=Vt(e.name)})},zi=t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const o of t.options)e.add(o.name);const n=[];for(const o of t.options)if(o.name.startsWith("no-")){const s=o.name.replace(Bi,"");if(!e.has(s)){if(o.type!==Boolean)throw new Error(`Cannot add negated option "${o.name}" to command "${t.name}" because it is not a boolean.`);const i={...o,defaultValue:o.defaultValue===void 0?!0:!o.defaultValue,name:s};n.push(i),e.add(s)}}n.length>0&&t.options.push(...n)},Wi=(t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,o=new Map;for(const i of e.options)if(i.name.startsWith("no-")){const c=Vt(i.name);o.set(c,i)}const s=Object.keys(n).filter(i=>o.has(i));if(s.length!==0)for(const i of s){const c=i.charAt(2);if(!c)continue;const a=c.toLowerCase()+i.slice(3),u=o.get(i);u&&(u.__negated__=!0),n[a]=!n[i],Reflect.deleteProperty(n,i)}},Fi=(t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const s of e.options)s.__camelCaseName__&&s.__negated__===void 0&&s.implies!==void 0&&n.set(s.__camelCaseName__,s);if(n.size===0)return;const{options:o}=t;for(const s of Object.keys(o)){const i=n.get(s);if(i?.implies){const{implies:c}=i;for(const[a,u]of Object.entries(c))o[a]===void 0&&(o[a]=u)}}},qi=()=>!!process.versions.electron,Gi=()=>qi()&&!process.defaultApp,Hi=()=>Gi()?0:1,Ji=t=>t.slice(Hi()+1),Ki=" ",Yi=(t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,o)=>n===e[o]),Qi=t=>{if(typeof t=="string")return t.split(Ki);const e=ye();return Yi(t,e)?Ji(t):t},Zi=t=>{const e=i=>{t.error(`Uncaught exception: ${i.message||i}`),i.stack&&t.error(i.stack),R(1)},n=(i,c)=>{if(i instanceof Error)t.error(`Promise rejection: ${i.message||i}`),i.stack&&t.error(i.stack);else{let a;if(typeof i=="string")a=i;else try{a=JSON.stringify(i)}catch{a=String(i)}t.error(`Promise rejection: ${a}`)}R(1)},o=je("uncaughtException",e),s=je("unhandledRejection",n);return()=>{o(),s()}},at=100,Xi=/^[a-z][\w-]*$/i,Ie=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new k(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},lt=(t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new k(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},Ce=(t,e)=>{if(typeof t!="object"||t===null)throw new k(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},me=t=>{const e=Ie(t,"Command name");if(e.length>at)throw new k(`Command name is too long (maximum ${String(at)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new k(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!Xi.test(e))throw new k(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},es=new Set([`
30
+ `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),ts=(t,e={})=>{if(typeof t!="string")throw new TypeError("Argument must be a string");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,o=n.maxArgumentLength??1e6;if(Number.isFinite(o)&&o>0&&t.length>o)throw new Error(`Argument is too long (maximum ${String(o)} characters)`);if(n.checkDangerousChars){for(const s of t)if(es.has(s))throw new Error(`Argument contains dangerous character: ${s}`)}return n.trim?t.trim():t},ct=(t,e={})=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,o=n.maxArguments??1e5;if(Number.isFinite(o)&&o>0&&t.length>o)throw new Error(`Too many arguments (maximum ${String(o)})`);return t.map(s=>ts(s,n))},ns=/^-([^\d-])$/,os=/^--(\S+)/,is=/^-([^\d-]{2,})$/,Oe=t=>ns.test(t)||os.test(t)||is.test(t),ss={access:(t,e)=>Po(t,e),mkdir:(t,e)=>Mo(t,e),readdir:t=>To(t),readFile:(async(t,e)=>e===void 0?He(t):He(t,e)),rm:(t,e)=>So(t,e),stat:t=>Lo(t),writeFile:(t,e,n)=>Io(t,e,n)},rs=(t,e,n)=>{const o=e.indexOf("--"),s=o===-1?new Set:new Set(e.slice(o+1)),i=n.filter(u=>u.startsWith("--")&&u!=="--"&&!s.has(u));if(i.length===0)return;const c=(t.options??[]).map(u=>u.name),a=i.flatMap(u=>q(u.slice(2),c).map(r=>`--${r}`));throw new Do(i,a)};class Me{#t;#e;#u;#h;#f;#m;#A;#k;#E;#$;#C;#b;#O;#_=be;#p;#n;#o;#i;#s;#r;#g=!1;#I;#L=!1;#w;#y;#v;#l=[];#D(){return this.#w===void 0&&(this.#w=[...this.#o.keys()]),this.#w}#S(){return this.#y===void 0&&(this.#y=[...this.#n.keys()]),this.#y}#a(){return this.#v===void 0&&(this.#v=[...this.#D(),...this.#S()]),this.#v}#T(){return this.#l.length===0?de:[...de,...this.#l]}#M(){this.#w=void 0,this.#y=void 0,this.#v=void 0}#x(){if(this.#u===void 0){const e=Qi(this.#e.argv);this.#u=ct(e,{maxArguments:this.#b}),this.#U()}return this.#u}#N(){return this.#$??he()}#d(e){this.#_=e,this.#N().CEREBRO_OUTPUT_LEVEL=String(e)}#c(){const e=this.#N().CEREBRO_OUTPUT_LEVEL,n=e===void 0?Number.NaN:Number(e);return Number.isNaN(n)?this.#_:n}#U(){if(!this.#u)return;let e=!1;for(const n of this.#u){if(n==="--quiet"||n==="-q"){this.#d(qt),e=!0;break}if(n==="--verbose"||n==="-v"){this.#d(Gt),e=!0;break}if(n==="--debug"){this.#d(V),e=!0;break}}e||this.#d(Object.hasOwn(this.#N(),"DEBUG")?V:be)}#j(){this.#L||(this.#I=Zi(this.#t),this.#L=!0)}#V(){return{arch:zn(),argv:this.#x(),cwd:this.#h,env:this.#$??he(),exit:this.#E??(e=>R(e??0)),platform:Rn(),stdin:this.#C}}#P(e,n,o,s){this.#c()===V&&this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:i,booleanValues:c,parsedArgs:a}=Ci(e,n,this.#T()),u=Object.keys(c).length>0;let r=a;u&&(r={...a,_all:{...a._all,...c}}),Si(i,r,e);const l=Ei(e,a,c,o);l.runtime=this,l.argv=this.#x(),l.fs=this.#k??ss,l.process=this.#V(),l.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const h=e.options.filter(f=>f.name.startsWith("no-"));for(const f of h){const p=f.name.slice(3),g=`--${f.name}`,$=`--${p}`,w=n.includes(g),y=n.includes($);if(w&&y)throw new St(p,f.name)}}return d&&(Wi(l,e),Fi(l,e)),Ti(i,l.options,e),Mi(l.options,e),this.#O&&rs(e,n,l.rawUnknown),this.#c()===V&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(l.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(l.argument,null,2))),{arguments_:i,booleanValues:c,commandArgs:r,parsedArgs:a,toolbox:l}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new k("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const o=n.argv??ye(),s=n.cwd??Bn();if(this.#e={...n,argv:o,cwd:s},this.#e.argv&&!Array.isArray(this.#e.argv))throw new k("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new k("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new k("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new k("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});if(typeof this.#e.logger=="object"){const r=["debug","error","info","log","warn"],l=[],d=this.#e.logger;for(const h of r)typeof d[h]!="function"&&l.push(h);if(l.length>0)throw new k(`Logger object is missing required methods: ${l.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:l});this.#t=this.#e.logger}else this.#t={...console,debug:(...r)=>{this.#c()===V&&console.debug(...r)}};this.#m=this.#e.packageVersion,this.#A=this.#e.packageName,this.#h=this.#e.cwd,this.#s="help",this.#r={};const i=n.fs;if(i!==void 0&&(typeof i!="object"||i===null))throw new k("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const c=n.exit;if(c!==void 0&&typeof c!="function")throw new k("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const a=n.env;if(a!==void 0&&(typeof a!="object"||a===null))throw new k("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const u=n.stdin;if(u!==void 0&&typeof u!="string")throw new k("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#k=n.fs,this.#E=n.exit,this.#$=n.env,this.#C=n.stdin??"",this.#b=n.maxArguments,this.#O=n.strictOptions??!1,this.#d(be),this.#n=new Map,this.#o=new Map,this.#i=new Map}setCommandSection(e){return this.#r=e,this}getCommandSection(){return this.#r.header||(this.#r.header=`${this.#f}${this.#m?` v${this.#m}`:""}`),this.#r}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){Ce(e,"Command"),me(e.name);const n=typeof e.execute=="function",o=typeof e.loader=="function";if(n&&o)throw new k(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!o)throw new k(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?me(e.alias):lt(e.alias,"Command alias").forEach(r=>me(r))),e.argument&&Ce(e.argument,"Command argument"),e.options&&Ce(e.options,"Command options"),e.commandPath&&(lt(e.commandPath,"Command commandPath"),e.commandPath.forEach(r=>{me(r)}));const s=rt(e.name,e.commandPath),i=J(s);if(this.#o.has(i))throw new k(`Command with path "${i}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,a=this.#n.get(e.name),u=a!==void 0&&(a.commandPath===void 0||a.commandPath.length===0);if(!c&&u)throw new k(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const r of e.options)Je(r);if(Pi(e),zi(e),Ri(e),e.options&&(e.__conflictingOptions__=e.options.filter(r=>r.conflicts!==void 0),e.__requiredOptions__=e.options.filter(r=>r.required===!0)),c&&a!==void 0)this.#n.set(i,e);else{if(!c&&a!==void 0&&!u){const r=rt(a.name,a.commandPath);this.#n.set(J(r),a)}this.#n.set(e.name,e)}if(this.#o.set(i,s),this.#i.set(i,e),this.#M(),e.alias!==void 0){const r=typeof e.alias=="string"?[e.alias]:e.alias;for(const l of r){if(this.#c()===V&&this.#t.debug("adding alias",l),this.#n.has(l))throw new k(`Command alias "${l}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:l,commandName:e.name});this.#n.set(l,e)}}return this}addGlobalOption(e){const n=e,o=new Set(de.map(i=>i.name)),s=new Set(de.map(i=>i.alias).filter(Boolean));if(o.has(n.name))throw new k(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&s.has(n.alias))throw new k(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(i=>i.name)).has(n.name))throw new k(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",Je(n),this.#l.push(n),this}getGlobalOptions(){return this.#T()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new jo(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#p)}getCliName(){return this.#f}getPackageVersion(){return this.#m}getPackageName(){return this.#A}getCommands(){return this.#n}getCwd(){return this.#h}dispose(){this.#I?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:o=!0,...s}=e;if(!this.#n.has("help")){const{default:y}=await import("../packem_chunks/help-command.js");this.addCommand(new y(this.#n))}const i=this.#S(),c=this.#o;this.#j();const a=this.#x();let u,r=[...a];this.#c()===V&&(this.#t.debug(`process.execPath: ${kt()}`),this.#t.debug(`process.execArgv: ${At().join(" ")}`),this.#t.debug(`process.argv: ${ye().join(" ")}`));const l=Di(c,[...a]);if(l.commandPath)u=l.commandPath,r=l.argv;else{if(a.length>1&&a[0]&&a[1]&&!Oe(a[0])&&!Oe(a[1])){const b=[];let N=0;for(;N<a.length;){const I=a[N];if(!I||Oe(I))break;b.push(I),N+=1}const E=J(b);if(b[0]&&!i.includes(b[0])){const I=this.#a(),O=q(E,I);throw new H(E,O)}}let y;try{y=Fo([null,...i],[...a])}catch(b){if(b instanceof Error&&b.name==="INVALID_COMMAND"&&"command"in b){const N=b.command,E=this.#a(),I=q(N,E);throw new H(N,I)}throw b}y.command&&(u=[y.command],r=y.argv)}if(!u)if(this.#s)u=[this.#s];else{const y=this.#a();throw new H("",y)}const d=J(u),h=this.#o.get(d);let f;if(h){if(f=this.#i.get(d),!f||J(h)!==d){const y=this.#a(),b=q(d,y);throw new H(d,b)}}else{const y=u.at(-1);if(f=y?this.#n.get(y):void 0,!f){const b=this.#a(),N=q(d,b);throw new H(d,N)}}if(typeof f.execute!="function"&&typeof f.loader!="function")return this.#t.error(`Command "${f.name}" has no function to execute.`),o?R(1):void 0;const p=r;let g,$;try{({commandArgs:g,toolbox:$}=this.#P(f,p,s,d))}catch(y){if(this.#t.error(y),o)return R(1);throw y}const w=this.getPluginManager();try{!this.#g&&w.hasPlugins()&&(await w.init({cli:this,cwd:this.#h,logger:this.#t}),this.#g=!0),await w.executeLifecycle("execute",$),await w.executeLifecycle("beforeCommand",$);let y;const b=g.global;if(b?.help){const N=this.#n.get("help");if(!N)throw new k("Help command not found","COMMAND_NOT_FOUND");y=await ee(N,$)}else if(b?.version??b?.V){const N=this.#n.get("version");if(!N)throw new k("Version command not found","COMMAND_NOT_FOUND");y=await ee(N,$)}else y=await ee(f,$);return await w.executeLifecycle("afterCommand",$,y),o?R(0):void 0}catch(y){throw await w.executeErrorHandlers(y,$),y}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:o=[],...s}=n;Ie(e,"Command name");const i=e.split(" ").filter(Boolean),c=J(i),a=this.#o.get(c)?this.#i.get(c):this.#n.get(e);if(!a){const h=this.#a(),f=q(c||e,h);throw new H(e,f)}if(typeof a.execute!="function"&&typeof a.loader!="function")throw new k(`Command "${a.name}" has no function to execute`,"INVALID_COMMAND",{commandName:a.name});const u=[...ct(o,{maxArguments:this.#b})];this.#c()===V&&this.#t.debug(`running command '${e}' programmatically with args: ${u.join(", ")}`);const{commandArgs:r,toolbox:l}=this.#P(a,u,s,c||e),d=this.getPluginManager();try{!this.#g&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#h,logger:this.#t}),this.#g=!0),await d.executeLifecycle("execute",l),await d.executeLifecycle("beforeCommand",l);let h;const f=r.global;if(f?.help){const p=this.#n.get("help");if(!p)throw new k("Help command not found","COMMAND_NOT_FOUND");h=await ee(p,l)}else if(f?.version??f?.V){const p=this.#n.get("version");if(!p)throw new k("Version command not found","COMMAND_NOT_FOUND");h=await ee(p,l)}else h=await ee(a,l);return await d.executeLifecycle("afterCommand",l,h),h}catch(h){throw await d.executeErrorHandlers(h,l),h}}clone(e){const n={...this.#e,...e},o=new Me(this.#f,n);for(const[s,i]of this.#n)o.#n.set(s,i);for(const[s,i]of this.#o)o.#o.set(s,[...i]);for(const[s,i]of this.#i)o.#i.set(s,i);for(const s of this.#l)o.#l.push(s);return o.#s=this.#s,o.#r={...this.#r},o.#M(),o}async getAction(e){Ie(e,"Command name");const n=e.split(" ").filter(Boolean),o=J(n),s=this.#o.get(o)?this.#i.get(o):this.#n.get(e);if(!s){const i=this.#a(),c=q(o||e,i);throw new H(e,c)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return jt(s);throw new k(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}}const ks=(t,e)=>new Me(t,e),Es=()=>{try{const t=require("node:module");if(typeof t.enableCompileCache=="function"){t.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}},as=ve(import.meta.url),ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Bt=t=>{if(typeof ue<"u"&&ue.versions&&ue.versions.node){const[e,n]=ue.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ue.getBuiltinModule(t)}return as(t)},{execFileSync:ls}=Bt("node:child_process"),{totalmem:cs}=Bt("node:os"),us=/--max-old-space-size=(\d+)/,hs=/--max-semi-space-size=(\d+)/,ps=t=>Math.floor(cs()/1024/1024*t),ds=t=>t<=512?4:t<=1024?8:t<=2048?16:t<=4096?32:t<=8192?64:Math.floor(Math.log2(t))*8,ut=(t,e)=>{for(const n of e){const o=t.exec(n);if(o)return Number.parseInt(o[1],10)}},Cs=t=>{const n=[...At()],o=[...ye()],s=ut(us,n),i=ut(hs,n);if(s!==void 0&&i!==void 0)return;const c=s??ps(.75),a=i??ds(c),u=[];if(s===void 0&&u.push(`--max-old-space-size=${String(c)}`),i===void 0&&u.push(`--max-semi-space-size=${String(a)}`),u.length!==0)try{ls(kt(),[...u,...n,...o.slice(1)],{env:he(),stdio:"inherit"}),R(0)}catch(r){const l=r.status;R(typeof l=="number"?l:1)}},Os=(t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:(e,n)=>{const{logger:o,runtime:s}=n,{detailed:i=!1,exitOnError:c=!0,formatter:a,logErrors:u=!0,renderOptions:r={}}=t;if(u)if(a)o.error(a(e));else if(i){const l=s.getCwd(),d=Vn(e,{cwd:l,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...r});o.error(d)}else o.error(e);c&&R(1)},version:"1.0.0"});var fs="1.0.0-alpha.35";const _s={version:fs},Is={argument:{description:"Package to execute (optionally with @version)",name:"package",type:String},description:"Execute a remote package without permanent installation",examples:[["vis dlx create-vite my-app","Scaffold a new project"],["vis dlx typescript@5.5.4 tsc --version","Run specific version"],["vis dlx -p cowsay -p lolcatjs -c 'echo hi | cowsay | lolcatjs'","Multiple packages with shell"],["vis install && vis dlx --offline typescript tsc --version","Hardened: pre-install + offline (no registry fetch on dlx)"]],group:"Run & Execute",loader:()=>import("../packem_chunks/handler9.js"),name:"dlx",options:[{alias:"p",description:"Additional packages to install (repeatable)",multiple:!0,name:"package",type:String},{alias:"c",defaultValue:!1,description:"Execute within shell environment",name:"shell-mode",type:Boolean},{alias:"s",defaultValue:!1,description:"Suppress output except command results",name:"silent",type:Boolean},{defaultValue:!1,description:"Resolve from local store only — fail rather than fetch from the registry. Pair with `vis install` for hardened npx-style workflows.",name:"offline",type:Boolean}]};export{G as L,Cs as P,ks as V,Es as a,gs as b,_s as c,bs as d,Is as e,k as f,Os as h,$s as i,ys as n,xs as o,Ns as p,vs as r,ws as s,he as t};
@@ -0,0 +1 @@
1
+ const b=t=>{const e=new Set,n=[t];for(let r=0;r<n.length;r++){const o=n[r];if(e.has(o))continue;e.add(o);const{children:s}=o;if(s?.length)for(let u=0,c=s.length;u<c;u++)n.push(s[u])}return Array.from(e)},tt=t=>{let e="";const n=b(t);for(let r=0,o=n.length;r<o;r++){const s=n[r];if(!s.regex)continue;const u=s.regex.flags;if(e||(e=u),e!==u)throw new Error(`Inconsistent RegExp flags used: "${e}" and "${u}"`)}return e},Z=(t,e,n)=>{const r=n.get(t);if(r!==void 0)return r;const o=t.partial??e;let s="";if(t.regex&&(s+=o?"(?:$|":"",s+=t.regex.source),t.children?.length){const u=nt(t.children.map(c=>Z(c,e,n)).filter(Boolean));if(u?.length){const c=t.children.some(M=>!M.regex||!(M.partial??e)),a=u.length>1||o&&(!s.length||c);s+=a?o?"(?:$|":"(?:":"",s+=u.join("|"),s+=a?")":""}}return t.regex&&(s+=o?")":""),n.set(t,s),s},et=(t,e)=>{const n=new Map,r=b(t);for(let o=r.length-1;o>=0;o--){const s=Z(r[o],e,n);if(!(o>0))return s}return""},nt=t=>Array.from(new Set(t)),j=(t,e,n)=>j.compile(t,n).test(e);j.compile=(t,e)=>{const n=e?.partial??!1,r=et(t,n),o=tt(t);return new RegExp(`^(?:${r})$`,o)};const rt=(t,e)=>{const n=j.compile(t,e),r=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(r,o)},ot=t=>{const e=t.map(r=>r.source).join("|")||"$^",n=t[0]?.flags;return new RegExp(e,n)},q=t=>Array.isArray(t),k=t=>typeof t=="function",st=t=>t.length===0,ut=(()=>{const{toString:t}=Function.prototype,e=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&e.test(t.call(n))})(),it=t=>typeof t=="number",ct=t=>typeof t=="object"&&t!==null,lt=t=>t instanceof RegExp,at=(()=>{const t=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return e=>t.test(e.source)})(),ft=(()=>{const t=/^[a-zA-Z0-9_-]+$/;return e=>t.test(e.source)&&!e.flags.includes("i")})(),O=t=>typeof t=="string",h=t=>t===void 0,pt=t=>{const e=new Map;return n=>{const r=e.get(n);if(r!==void 0)return r;const o=t(n);return e.set(n,o),o}},W=(t,e,n={})=>{const r={cache:{},input:t,index:0,indexBacktrackMax:0,options:n,output:[]},o=d(e)(r),s=Math.max(r.index,r.indexBacktrackMax);if(o&&r.index===t.length)return r.output;throw new Error(`Failed to parse at index ${s}`)},i=(t,e)=>q(t)?$t(t,e):O(t)?_(t,e):ht(t,e),$t=(t,e)=>{const n={};for(const r of t){if(r.length!==1)throw new Error(`Invalid character: "${r}"`);const o=r.charCodeAt(0);n[o]=!0}return r=>{const o=r.input;let s=r.index,u=s;for(;u<o.length&&o.charCodeAt(u)in n;)u+=1;if(u>s){if(!h(e)&&!r.options.silent){const c=o.slice(s,u),a=k(e)?e(c,o,`${s}`):e;h(a)||r.output.push(a)}r.index=u}return!0}},ht=(t,e)=>{if(ft(t))return _(t.source,e);{const n=t.source,r=t.flags.replace(/y|$/,"y"),o=new RegExp(n,r);return at(t)&&k(e)&&!ut(e)?dt(o,e):gt(o,e)}},dt=(t,e)=>n=>{const r=n.index,o=n.input;t.lastIndex=r;const s=t.exec(o);if(s){const u=t.lastIndex;if(!n.options.silent){const c=e(...s,o,`${r}`);h(c)||n.output.push(c)}return n.index=u,!0}else return!1},gt=(t,e)=>n=>{const r=n.index,o=n.input;if(t.lastIndex=r,t.test(o)){const s=t.lastIndex;if(!h(e)&&!n.options.silent){const u=k(e)?e(o.slice(r,s),o,`${r}`):e;h(u)||n.output.push(u)}return n.index=s,!0}else return!1},_=(t,e)=>n=>{const r=n.index,o=n.input;if(o.startsWith(t,r)){if(!h(e)&&!n.options.silent){const s=k(e)?e(t,o,`${r}`):e;h(s)||n.output.push(s)}return n.index+=t.length,!0}else return!1},v=(t,e,n,r)=>{const o=d(t),s=e>1;return R(z(L(u=>{let c=0;for(;c<n;){const a=u.index;if(!o(u)||(c+=1,u.index===a))break}return c>=e},s),r))},F=(t,e)=>v(t,0,1,e),E=(t,e)=>v(t,0,1/0,e),xt=(t,e)=>v(t,1,1/0,e),m=(t,e)=>{const n=t.map(d);return R(z(L(r=>{for(let o=0,s=n.length;o<s;o++)if(!n[o](r))return!1;return!0}),e))},p=(t,e)=>{const n=t.map(d);return R(z(r=>{for(let o=0,s=n.length;o<s;o++)if(n[o](r))return!0;return!1},e))},L=(t,e=!0,n=!1)=>{const r=d(t);return e?o=>{const s=o.index,u=o.output.length,c=r(o);return!c&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!c||n)&&(o.index=s,o.output.length!==u&&(o.output.length=u)),c}:r},z=(t,e)=>{const n=d(t);return e?r=>{if(r.options.silent)return n(r);const o=r.output.length;if(n(r)){const s=r.output.splice(o,1/0),u=e(s);return h(u)||r.output.push(u),!0}else return!1}:n},R=(()=>{let t=0;return e=>{const n=d(e),r=t+=1;return o=>{var s;if(o.options.memoization===!1)return n(o);const u=o.index,c=(s=o.cache)[r]||(s[r]={indexMax:-1,queue:[]}),a=c.queue;if(u<=c.indexMax){const y=c.store||(c.store=new Map);if(a.length){for(let x=0,P=a.length;x<P;x+=2){const Q=a[x*2],N=a[x*2+1];y.set(Q,N)}a.length=0}const f=y.get(u);if(f===!1)return!1;if(it(f))return o.index=f,!0;if(f)return o.index=f.index,f.output?.length&&o.output.push(...f.output),!0}const M=o.output.length,K=n(o);if(c.indexMax=Math.max(c.indexMax,u),K){const y=o.index,f=o.output.length;if(f>M){const x=o.output.slice(M,f);a.push(u,{index:y,output:x})}else a.push(u,y);return!0}else return a.push(u,!1),!1}}})(),U=t=>{let e;return n=>(e||(e=d(t())),e(n))},d=pt(t=>{if(k(t))return st(t)?U(t):t;if(O(t)||lt(t))return i(t);if(q(t))return m(t);if(ct(t))return p(Object.values(t));throw new Error("Invalid rule")}),g=t=>t,mt=t=>typeof t=="string",wt=t=>{const e=new WeakMap,n=new WeakMap;return(r,o)=>{const s=o?.partial?n:e,u=s.get(r);if(u!==void 0)return u;const c=t(r,o);return s.set(r,c),c}},Mt=t=>{const e={},n={};return(r,o)=>{const s=o?.partial?n:e;return s[r]??(s[r]=t(r,o))}},yt=i(/\\./,g),kt=i(/./,g),At=i(/\*\*\*+/,"*"),Et=i(/([^/{[(!])\*\*/,(t,e)=>`${e}*`),jt=i(/(^|.)\*\*(?=[^*/)\]}])/,(t,e)=>`${e}*`),vt=E(p([yt,At,Et,jt,kt])),zt=t=>W(t,vt,{memoization:!1}).join(""),J="abcdefghijklmnopqrstuvwxyz",Rt=t=>{let e="";for(;t>0;){const n=(t-1)%26;e=J[n]+e,t=Math.floor((t-1)/26)}return e},B=t=>{let e=0;for(let n=0,r=t.length;n<r;n++)e=e*26+J.indexOf(t[n])+1;return e},I=(t,e)=>{if(e<t)return I(e,t);const n=[];for(;t<=e;)n.push(t++);return n},It=(t,e,n)=>I(t,e).map(r=>String(r).padStart(n,"0")),T=(t,e)=>I(B(t),B(e)).map(Rt),l=t=>({partial:!1,regex:new RegExp(t,"s"),children:[]}),A=t=>({children:t}),w=(()=>{const t=(e,n,r)=>{if(r.has(e))return;r.add(e);const{children:o}=e;if(!o.length)o.push(n);else for(let s=0,u=o.length;s<u;s++)t(o[s],n,r)};return e=>{if(!e.length)return A([]);for(let n=e.length-1;n>=1;n--){const r=new Set,o=e[n-1],s=e[n];t(o,s,r)}return e[0]}})(),$=()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),St=i(/\\./,l),Bt=i(/[$.*+?^(){}[\]\|]/,t=>l(`\\${t}`)),Ct=i(/[\\\/]/,$),bt=i(/[^$.*+?^(){}[\]\|\\\/]+/,l),Zt=i(/^(?:!!)*!(.*)$/,(t,e)=>l(`(?!^${S.compile(e).source}$).*?`)),qt=i(/^(!!)+/),Ot=p([Zt,qt]),Wt=i(/\/(\*\*\/)+/,()=>A([w([$(),l(".+?"),$()]),$()])),_t=i(/^(\*\*\/)+/,()=>A([l("^"),w([l(".*?"),$()])])),Ft=i(/\/(\*\*)$/,()=>A([w([$(),l(".*?")]),l("$")])),Lt=i(/\*\*/,()=>l(".*?")),V=p([Wt,_t,Ft,Lt]),Ut=i(/\*\/(?!\*\*\/|\*$)/,()=>w([l("[^\\\\/]*?"),$()])),Jt=i(/\*/,()=>l("[^\\\\/]*")),X=p([Ut,Jt]),Y=i("?",()=>l("[^\\\\/]")),Tt=i("[",g),Vt=i("]",g),Xt=i(/[!^]/,"^\\\\/"),Yt=i(/[a-z]-[a-z]|[0-9]-[0-9]/i,g),Dt=i(/\\./,g),Gt=i(/[$.*+?^(){}[\|]/,t=>`\\${t}`),Ht=i(/[\\\/]/,"\\\\/"),Kt=i(/[^$.*+?^(){}[\]\|\\\/]+/,g),Pt=p([Dt,Gt,Ht,Yt,Kt]),D=m([Tt,F(Xt),E(Pt),Vt],t=>l(t.join(""))),Qt=i("{","(?:"),Nt=i("}",")"),te=i(/(\d+)\.\.(\d+)/,(t,e,n)=>It(+e,+n,Math.min(e.length,n.length)).join("|")),ee=i(/([a-z]+)\.\.([a-z]+)/,(t,e,n)=>T(e,n).join("|")),ne=i(/([A-Z]+)\.\.([A-Z]+)/,(t,e,n)=>T(e.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),re=p([te,ee,ne]),G=m([Qt,re,Nt],t=>l(t.join(""))),oe=i("{"),se=i("}"),ue=i(","),ie=i(/\\./,l),ce=i(/[$.*+?^(){[\]\|]/,t=>l(`\\${t}`)),le=i(/[\\\/]/,$),ae=i(/[^$.*+?^(){}[\]\|\\\/,]+/,l),fe=U(()=>H),pe=i("",()=>l("(?:)")),$e=xt(p([V,X,Y,D,G,fe,ie,ce,le,ae]),w),C=p([$e,pe]),H=m([oe,F(m([C,E(m([ue,C]))])),se],A),he=E(p([Ot,V,X,Y,D,G,H,St,Bt,Ct,bt]),w),de=t=>W(t,he,{memoization:!1})[0],S=(t,e,n)=>S.compile(t,n).test(e);S.compile=(()=>{const t=Mt((n,r)=>rt(de(zt(n)),r)),e=wt((n,r)=>ot(n.map(o=>t(o,r))));return(n,r)=>mt(n)?t(n,r):e(n,r)})();export{S as o};
@@ -0,0 +1 @@
1
+ import{m as h,g as k,D as $,f as S}from"./provenance-DMuEftgc.js";import{Z as d,D as N}from"../packem_chunks/bin.js";import{W as R}from"./build-scripts-CCCi8U66.js";import{n as v}from"./license-t5KnNX6v.js";import{A as L,B as D,v as A}from"./index-BDmTbWX1.js";import{L as w}from"./dependency-scan-BDTH898x.js";const m={CRITICAL:0,HIGH:1,LOW:3,MODERATE:2,UNKNOWN:4},ne=(t,e)=>{const n=m[(t.vulnerability.severity??"UNKNOWN").toUpperCase()]??4,s=m[(e.vulnerability.severity??"UNKNOWN").toUpperCase()]??4;return n-s||t.packageName.localeCompare(e.packageName)||t.packageVersion.localeCompare(e.packageVersion)},P=(t,e)=>{const n=m[e.toUpperCase()]??2;return(m[t.toUpperCase()]??4)<=n},b=["firstSeen","installScripts","license","malware","publisherChange","score","unexpectedDeps","vulnerability"],g=6e4,W=(t,e,n)=>{for(const s of n)if(s===t||s===`${t}@${e}`||s.endsWith("*")&&t.startsWith(s.slice(0,-1)))return!0;return!1},x=async(t,e)=>{const n=e.security?.policies?.firstSeen;if(n?.minutes===void 0||n.minutes<=0)return[];const{minutes:s}=n,a=n.exclude??[],r=e.security?.acceptedRisks,c=s*g,i=Date.now();return(await h(t.packages,$,async o=>{if(W(o.name,o.version,a))return;const l=await k(o.name,{workspaceRoot:t.workspaceRoot});if(l===void 0)return;const p=l.time?.[o.version];if(p===void 0)return;const u=Date.parse(p);if(Number.isNaN(u))return;const f=i-u;if(f>=c)return;const y=Math.max(0,Math.floor(f/g));return{acceptedRisk:d(o.name,o.version,r,"firstSeen"),data:{ageMinutes:y,minimumMinutes:s,publishedAt:p},packageName:o.name,policy:"firstSeen",reason:`${o.name}@${o.version} was published ${String(y)} min ago — below the ${String(s)} min firstSeen cooldown.`,severity:"block",version:o.version}})).filter(o=>o!==void 0)},O=(t,e)=>{const n=e.security?.policies?.installScripts;if(!n)return[];const s=n.allow??{},a=n.strict===!0;if(!a&&Object.keys(s).length===0)return[];const r=R(t.workspaceRoot,s,{pinVersions:e.security?.pinVersions===!0});if(r.unapproved.length===0)return[];const c=e.security?.acceptedRisks,i=a?"block":"warn";return r.unapproved.map(o=>({acceptedRisk:d(o.name,o.version??"*",c,"installScripts"),data:{hooks:o.hooks},packageName:o.name,policy:"installScripts",reason:`${o.name}${o.version?`@${o.version}`:""} declares unapproved build script(s): ${o.hooks.join(", ")}`,severity:i,version:o.version??"*"}))},U=new Set(["AND","OR"]),E=t=>{const e=t.replaceAll("("," ").replaceAll(")"," ").split(/\s+/).map(a=>a.trim()).filter(a=>a.length>0),n=[];let s=!1;for(const a of e){const r=a.toUpperCase();if(s){s=!1;continue}if(r==="WITH"){s=!0;continue}if(U.has(r))continue;const c=a.endsWith("+"),i=c?a.slice(0,-1):a,o=v(i)??i;n.push(o),c&&n.push(`${o}-or-later`)}return n},F=t=>{if(typeof t.license=="string"){const e=t.license.trim();return e.length>0?e:void 0}if(t.license&&typeof t.license=="object"&&typeof t.license.type=="string"){const e=t.license.type.trim();if(e.length>0)return e}if(Array.isArray(t.licenses)&&t.licenses.length>0){const e=t.licenses.map(n=>n&&typeof n.type=="string"?n.type.trim():"").filter(n=>n.length>0);if(e.length>0)return e.length===1?e[0]:`(${e.join(" OR ")})`}},I=(t,e)=>{if(e.length===0)return;const n=new Set(e.map(s=>v(s)??s).map(s=>s.toLowerCase()));for(const s of t)if(n.has(s.toLowerCase()))return s},M=(t,e)=>{if(e.length===0)return;const n=new Set(e.map(s=>v(s)??s).map(s=>s.toLowerCase()));for(const s of t)if(!n.has(s.toLowerCase()))return s},V=(t,e)=>{const n=e.security?.policies?.license;if(!n)return[];const s=n.allow??[],a=n.deny??[];if(s.length===0&&a.length===0)return[];const r=e.security?.acceptedRisks,c=[];for(const i of t.packages){const o=t.manifestData?.get(`${i.name}@${i.version}`),l=o?F(o):void 0;if(!l){s.length>0&&c.push({acceptedRisk:d(i.name,i.version,r,"license"),data:{declaredLicense:null},packageName:i.name,policy:"license",reason:`${i.name}@${i.version} declares no license; allow-list mode requires one of: ${s.join(", ")}`,severity:"block",version:i.version});continue}const p=E(l),u=I(p,a);if(u){c.push({acceptedRisk:d(i.name,i.version,r,"license"),data:{declaredLicense:l,deniedLicense:u},packageName:i.name,policy:"license",reason:`${i.name}@${i.version} uses denied license '${u}' (declared: ${l})`,severity:"block",version:i.version});continue}const f=M(p,s);f&&c.push({acceptedRisk:d(i.name,i.version,r,"license"),data:{allowList:s,declaredLicense:l,unallowedLicense:f},packageName:i.name,policy:"license",reason:`${i.name}@${i.version} uses license '${f}' which is not on the allow-list (declared: ${l})`,severity:"block",version:i.version})}return c},j=6e4,_=(t,e,n)=>{for(const s of n)if(s===t||s===`${t}@${e}`||s.endsWith("*")&&t.startsWith(s.slice(0,-1)))return!0;return!1},H=async(t,e)=>{const n=e.security?.policies?.publisherChange;if(n?.mode!=="no-downgrade")return[];const s=n.exclude??[],a=typeof n.ignoreAfter=="number"?n.ignoreAfter*j:void 0,r=e.security?.acceptedRisks,c=Date.now();return(await h(t.packages,$,async i=>{if(_(i.name,i.version,s))return;const o=await k(i.name,{workspaceRoot:t.workspaceRoot});if(o===void 0)return;if(a!==void 0){const p=o.time?.[i.version],u=p===void 0?Number.NaN:Date.parse(p);if(!Number.isNaN(u)&&c-u>a)return}if(o.versions[i.version]?.dist?.attestations?.provenance!==void 0)return;const l=S(o,i.version);if(l!==void 0)return{acceptedRisk:d(i.name,i.version,r,"publisherChange"),data:{priorVersionWithProvenance:l},packageName:i.name,policy:"publisherChange",reason:`${i.name}@${i.version} dropped the provenance attestation that ${i.name}@${l} carried — publisher trust downgrade.`,severity:"block",version:i.version}})).filter(i=>i!==void 0)},T=t=>{for(const e of Object.values(w))for(const n of[e.file,...e.aliases??[]])if(t===n||t.endsWith(`/${n}`)||t.endsWith(`.${n}`))return e.type},K=(t,e,n)=>{const s=L(e)?e:D(t,e);let a;try{a=A(s)}catch{return}const r=T(s)??w[n]?.type;if(!r)return;const c=N(a,r);if(c.length===0)return;const i=new Set;for(const o of c)i.add(`${o.name}@${o.version}`);return i},z=(t,e)=>{for(const n of e)if(n===t||n.endsWith("*")&&t.startsWith(n.slice(0,-1)))return!0;return!1},Y=(t,e)=>{const n=e.security?.policies?.unexpectedDeps;if(!n)return[];const s=n.allow??[],a=n.baselineLockfile;if(s.length===0&&!a)return[];const r=a?K(t.workspaceRoot,a,t.packageManager):void 0,c=e.security?.acceptedRisks,i=[];for(const o of t.packages){const l=s.length===0||z(o.name,s),p=r?r.has(`${o.name}@${o.version}`):!0;if(l&&p)continue;const u=[],f={};l||(u.push(`not on allow-list (${s.length} entr${s.length===1?"y":"ies"})`),f.allowList=s),!p&&r&&(u.push(`not present in baseline lockfile (${a})`),f.baselineLockfile=a),i.push({acceptedRisk:d(o.name,o.version,c,"unexpectedDeps"),data:f,packageName:o.name,policy:"unexpectedDeps",reason:`${o.name}@${o.version} is unexpected: ${u.join("; ")}`,severity:"block",version:o.version})}return i},q=(t,e)=>{if(!t.osvFindings||t.osvFindings.size===0)return[];const n=e.security?.policies?.vulnerability?.failOn,s=e.security?.acceptedRisks,a=[];for(const r of t.packages){const c=t.osvFindings.get(r.name);if(!(!c||c.length===0))for(const i of c){const o=n?P(i.severity,n)?"block":"warn":"info";a.push({acceptedRisk:d(r.name,r.version,s,"vulnerability"),data:{advisoryId:i.id,aliases:i.aliases??[],cvssScore:i.cvssScore,fixedVersions:i.fixedVersions,severity:i.severity,summary:i.summary},packageName:r.name,policy:"vulnerability",reason:`${i.severity} ${i.id} affects ${r.name}@${r.version}: ${i.summary}`,severity:o,version:r.version})}}return a},C=[{evaluate:q,isConfigured:t=>t.security?.policies?.vulnerability!==void 0,name:"vulnerability",offlineSupported:!0,surfaces:["audit","doctor"]},{evaluate:V,isConfigured:t=>{const e=t.security?.policies?.license;return!!(e&&(e.allow&&e.allow.length>0||e.deny&&e.deny.length>0))},name:"license",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:O,isConfigured:t=>{const e=t.security?.policies?.installScripts;return!!(e&&(e.allow&&Object.keys(e.allow).length>0||e.strict===!0))},name:"installScripts",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:Y,isConfigured:t=>{const e=t.security?.policies?.unexpectedDeps;return!!(e&&(e.allow&&e.allow.length>0||typeof e.baselineLockfile=="string"))},name:"unexpectedDeps",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:x,isConfigured:t=>{const e=t.security?.policies?.firstSeen?.minutes;return typeof e=="number"&&e>0},name:"firstSeen",offlineSupported:!1,surfaces:["audit","doctor","install"]},{evaluate:H,isConfigured:t=>t.security?.policies?.publisherChange?.mode==="no-downgrade",name:"publisherChange",offlineSupported:!1,surfaces:["audit","doctor","install"]}],B=(t,e,n)=>C.filter(s=>s.surfaces.includes(t)?n!==void 0?n.has(s.name):s.isConfigured(e):!1),se=async(t,e,n)=>{const s=B(e,n.visConfig,n.enabledPolicies),a=[];for(const r of s){if(t.offline&&!r.offlineSupported){a.push({packageName:"*",policy:r.name,reason:`policy.${r.name} skipped: requires network (--offline)`,severity:"info",version:"*"});continue}try{const c=await r.evaluate(t,n.visConfig);a.push(...c)}catch(c){const i=c instanceof Error?c.message:String(c);a.push({packageName:"*",policy:r.name,reason:`policy.${r.name} failed: ${i}`,severity:"info",version:"*"})}}return a},G=(()=>{const t=new Map;for(const e of b)t.set(e.toLowerCase(),e);return t})(),ie=()=>C.map(t=>t.name),oe=(t,e)=>{if(t===void 0)return;const n=t.trim().toLowerCase();if(n===""||n==="none")return new Set;if(n==="all")return new Set(b);const s=new Set;for(const a of t.split(",").map(r=>r.trim()).filter(r=>r.length>0)){const r=a.replace(/^_+/,"").replaceAll(/_+([a-z])/g,(i,o)=>o.toUpperCase()),c=G.get(r.toLowerCase());c===void 0?e?.(a):s.add(c)}return s};export{ne as c,se as e,ie as g,oe as p,P as s};
@@ -0,0 +1 @@
1
+ const r=new Set(["0BSD","AGPL-3.0","AGPL-3.0-only","AGPL-3.0-or-later","Apache-1.1","Apache-2.0","Artistic-2.0","BlueOak-1.0.0","BSD-2-Clause","BSD-3-Clause","BSL-1.0","CC0-1.0","CC-BY-3.0","CC-BY-4.0","CDDL-1.0","CDDL-1.1","EPL-1.0","EPL-2.0","GPL-2.0","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0","GPL-3.0-only","GPL-3.0-or-later","ISC","LGPL-2.0","LGPL-2.1","LGPL-3.0","MIT","MIT-0","MPL-1.1","MPL-2.0","Python-2.0","Unlicense","WTFPL","Zlib"]),c={apache2:"Apache-2.0","apache 2.0":"Apache-2.0",bsd:"BSD-3-Clause","bsd-2":"BSD-2-Clause","bsd-3":"BSD-3-Clause",mit:"MIT",public:"Unlicense","public domain":"Unlicense"},l=(()=>{const e=new Map;for(const n of r)e.set(n.toLowerCase(),n);for(const[n,s]of Object.entries(c))e.set(n,s);return e})(),o=e=>{const n=e.trim();if(n.length!==0)return r.has(n)?n:l.get(n.toLowerCase())},a=e=>{let n;if(typeof e.license=="string")n=e.license;else if(e.license&&typeof e.license=="object"&&typeof e.license.type=="string")n=e.license.type;else if(Array.isArray(e.licenses)&&e.licenses.length>0){const t=e.licenses[0];t&&typeof t.type=="string"&&(n=t.type)}if(!n)return;const s=n.trim();if(s.length===0)return;if(/[()]|\b(?:and|or|with)\b/i.test(s))return[{expression:s}];const i=o(s);return i?[{license:{id:i}}]:[{license:{name:s}}]};export{a as e,o as n};
@@ -0,0 +1,2 @@
1
+ import{createRequire as A}from"node:module";import{z as L,L as N,m as c,c as W,b as C}from"./index-BDmTbWX1.js";import{aQ as Q}from"../packem_chunks/bin.js";import{N as U}from"../packem_chunks/config.js";import{withEnhancedPath as ot}from"@visulima/task-runner";const F=A(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=t=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[o,e]=d.versions.node.split(".").map(Number);if(o>22||o===22&&e>=3||o===20&&e>=16)return d.getBuiltinModule(t)}return F(t)},{Socket:G}=l("node:net"),{randomBytes:V}=l("node:crypto"),{readdir:q,rm:k,unlink:v,open:B,readFile:Y,stat:z,writeFile:J,rename:K}=l("node:fs/promises"),{spawn:X}=l("node:child_process"),{openSync:Z,closeSync:tt}=l("node:fs");async function $(t,o,e){const s=await L(t,{buffer:!0,encoding:void 0});let i=new TextDecoder().decode(s);const{beforeParse:r,color:n}={};return typeof r=="function"&&(i=r(i)),U(i,o,N(t),{color:n})}const et=3e4,E=100;class st extends Error{constructor(o,e){super(o),this.elapsedMs=e,this.name="ServiceReadinessError"}elapsedMs}const it=async t=>{const o=t.host??"127.0.0.1",{port:e}=t,s=t.timeoutMs??et,i=Date.now();for(;Date.now()-i<s;){if(await rt(o,e))return;await nt(E)}throw new st(`Timed out waiting for ${o}:${String(e)} to accept TCP connections (${String(s)}ms)`,Date.now()-i)},rt=(t,o)=>new Promise(e=>{const s=new G,i=r=>{s.removeAllListeners(),s.destroy(),e(r)};s.once("connect",()=>{i(!0)}),s.once("error",()=>{i(!1)}),s.setTimeout(E,()=>{i(!1)});try{s.connect(o,t)}catch{i(!1)}}),nt=t=>new Promise(o=>{setTimeout(o,t)}),at=async(t,o)=>{const e=t.readiness??(t.port===void 0?void 0:{tcp:{port:t.port}});e&&await it({host:e.tcp.host,port:e.tcp.port,timeoutMs:o?.timeoutMs??e.tcp.timeoutMs})},y=384,b=5e3,ct=50,ht=3e4,h=async t=>{const o=c(Q(t),"services");try{await W(o)}catch(e){throw e.code==="ENOTDIR"?new Error(`Service registry path ${o} exists but is not a directory. Remove it or move the conflicting file before running \`vis service\`.`,{cause:e}):e}return o},_=t=>t.replaceAll("/","_").replaceAll(":","__"),g=(t,o)=>c(t,`${_(o)}.json`),dt=(t,o)=>c(t,`${_(o)}.lock`),u=async(t,o)=>{const e=await h(t),s=g(e,o);if(await C(s))try{return await $(s)}catch{return}},ft=async t=>{const o=await h(t);let e;try{e=await q(o)}catch{return[]}const s=[];for(const i of e)if(i.endsWith(".json"))try{const r=await $(c(o,i));s.push(r)}catch{}return s},lt=async(t,o)=>{const e=await h(t),s=g(e,o.id),i=c(e,`.${V(8).toString("hex")}.tmp`);await J(i,`${JSON.stringify(o,void 0,2)}
2
+ `,{mode:y});try{await kt(i,s)}catch(r){throw await k(i,{force:!0}).catch(()=>{}),r}},ut=new Set(["EACCES","EBUSY","EPERM"]),pt=8,wt=20,kt=async(t,o)=>{let e=0;for(;;)try{await K(t,o);return}catch(s){const{code:i}=s;if(!(i!==void 0&&ut.has(i))||e>=pt)throw s;const r=wt*2**e;await new Promise(n=>{setTimeout(n,r)}),e+=1}},f=async(t,o,e)=>{const s=await h(t),i=e??await u(t,o);await k(g(s,o),{force:!0}),i&&await k(i.logFile,{force:!0}).catch(()=>{})},a=t=>{try{return process.kill(t,0),!0}catch{return!1}},Dt=async t=>{const o=await ft(t),e=[],s=[];for(const i of o){if(a(i.pid)){s.push(i);continue}const r=await u(t,i.id);if(r&&r.pid!==i.pid){s.push(r);continue}await f(t,i.id,i).catch(()=>{}),e.push(i.id)}return{pruned:e,surviving:s}},mt=t=>new Promise(o=>{setTimeout(o,t)}),yt=async t=>{try{const o=await B(t,"wx",y);try{await o.writeFile(String(process.pid))}finally{await o.close().catch(()=>{})}return!0}catch(o){if(o.code==="EEXIST")return!1;throw o}},_t=async t=>{let o;try{const e=await Y(t,"utf8"),s=Number.parseInt(e.trim(),10);o=Number.isFinite(s)?s:void 0}catch{return!0}if(o!==void 0&&!a(o))return!0;try{const e=await z(t);return Date.now()-e.mtimeMs>ht}catch{return!0}},M=async(t,o,e)=>{const s=await h(t),i=dt(s,o),r=Date.now();for(;!await yt(i);){if(await _t(i)){await v(i).catch(()=>{});continue}if(Date.now()-r>=b)throw new Error(`Could not acquire service lock for ${o} within ${String(b)}ms — another \`vis service\` invocation appears to be holding it.`);await mt(ct)}try{return await e()}finally{await v(i).catch(()=>{})}};function m(t,o={},e){for(const s in t){const i=t[s],r=e?`${e}:${s}`:s;typeof i=="object"&&i!==null?m(i,o,r):typeof i=="function"&&(o[r]=i)}return o}const R=(()=>{if(console.createTask)return console.createTask;const t={run:o=>o()};return()=>t})();function T(t,o,e,s){for(let i=e;i<t.length;i+=1)try{const r=s?s.run(()=>t[i](...o)):t[i](...o);if(r&&typeof r.then=="function")return Promise.resolve(r).then(()=>T(t,o,i+1,s))}catch(r){return Promise.reject(r)}}function gt(t,o,e){if(t.length>0)return T(t,o,0,R(e))}function vt(t,o,e){if(t.length>0){const s=R(e);return Promise.all(t.map(i=>s.run(()=>i(...o))))}}function w(t,o){for(const e of[...t])e(o)}var bt=class{_hooks;_before;_after;_deprecatedHooks;_deprecatedMessages;constructor(){this._hooks={},this._before=void 0,this._after=void 0,this._deprecatedMessages=void 0,this._deprecatedHooks={},this.hook=this.hook.bind(this),this.callHook=this.callHook.bind(this),this.callHookWith=this.callHookWith.bind(this)}hook(t,o,e={}){if(!t||typeof o!="function")return()=>{};const s=t;let i;for(;this._deprecatedHooks[t];)i=this._deprecatedHooks[t],t=i.to;if(i&&!e.allowDeprecated){let r=i.message;r||(r=`${s} hook has been deprecated`+(i.to?`, please use ${i.to}`:"")),this._deprecatedMessages||(this._deprecatedMessages=new Set),this._deprecatedMessages.has(r)||(console.warn(r),this._deprecatedMessages.add(r))}if(!o.name)try{Object.defineProperty(o,"name",{get:()=>"_"+t.replace(/\W+/g,"_")+"_hook_cb",configurable:!0})}catch{}return this._hooks[t]=this._hooks[t]||[],this._hooks[t].push(o),()=>{o&&(this.removeHook(t,o),o=void 0)}}hookOnce(t,o){let e,s=(...i)=>(typeof e=="function"&&e(),e=void 0,s=void 0,o(...i));return e=this.hook(t,s),e}removeHook(t,o){const e=this._hooks[t];if(e){const s=e.indexOf(o);s!==-1&&e.splice(s,1),e.length===0&&(this._hooks[t]=void 0)}}clearHook(t){this._hooks[t]=void 0}deprecateHook(t,o){this._deprecatedHooks[t]=typeof o=="string"?{to:o}:o;const e=this._hooks[t]||[];this._hooks[t]=void 0;for(const s of e)this.hook(t,s)}deprecateHooks(t){for(const o in t)this.deprecateHook(o,t[o])}addHooks(t){const o=m(t),e=Object.keys(o).map(s=>this.hook(s,o[s]));return()=>{for(const s of e)s();e.length=0}}removeHooks(t){const o=m(t);for(const e in o)this.removeHook(e,o[e])}removeAllHooks(){this._hooks={}}callHook(t,...o){return this.callHookWith(gt,t,o)}callHookParallel(t,...o){return this.callHookWith(vt,t,o)}callHookWith(t,o,e){const s=this._before||this._after?{name:o,args:e,context:{}}:void 0;this._before&&w(this._before,s);const i=t(this._hooks[o]?[...this._hooks[o]]:[],e,o);return i instanceof Promise?i.finally(()=>{this._after&&s&&w(this._after,s)}):(this._after&&s&&w(this._after,s),i)}beforeEach(t){return this._before=this._before||[],this._before.push(t),()=>{if(this._before!==void 0){const o=this._before.indexOf(t);o!==-1&&this._before.splice(o,1)}}}afterEach(t){return this._after=this._after||[],this._after.push(t),()=>{if(this._after!==void 0){const o=this._after.indexOf(t);o!==-1&&this._after.splice(o,1)}}}};function St(){return new bt}const xt=()=>St(),Ot=async(t,o)=>{if(!(!o||o.length===0))for(const e of o){if(e.hooks)for(const[s,i]of Object.entries(e.hooks)){const r=Array.isArray(i)?i:[i];for(const n of r)t.hook(s,n)}e.setup&&await e.setup(t)}};class jt{#e;#o;#s=new Map;constructor(o,e){this.#e=o,this.#o=e}startTasks(o){for(const e of o)this.#s.set(e.id,e),this.#t("task:before",e)}endTasks(o){for(const e of o)this.#s.delete(e.task.id),this.#t("task:after",e.task,e),e.status==="failure"?this.#t("task:failure",e.task,e):Ht(e.status)&&this.#t("task:cacheHit",e.task,e)}printCacheMiss(o,e){this.#t("task:cacheMiss",o,e)}onTaskStdout(o,e){this.#t("task:stdout",o,e)}onTaskStderr(o,e){this.#t("task:stderr",o,e)}#t(o,...e){Promise.resolve(this.#e.callHook(o,...e)).catch(s=>{if(this.#o)try{this.#o(o,s)}catch{}})}}const Ht=t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache",S=process.platform==="win32",$t=async t=>{const{command:o,cwd:e,env:s,logFile:i}=t,r=Z(i,"a",y);let n;const p=S?"cmd":"/bin/sh",x=S?["/d","/s","/c",o]:["-c",o];try{n=X(p,x,{cwd:e,detached:!0,env:ot({...process.env,...s},e),stdio:["ignore",r,r],windowsHide:!0})}finally{tt(r)}if(n.pid===void 0&&await new Promise((O,j)=>{n.once("spawn",()=>{O()}),n.once("error",I=>{j(I)})}),n.pid===void 0)throw new Error(`Failed to spawn detached process for command: ${o}`);return n.unref(),{pid:n.pid}},P=5e3,It=async t=>M(t.workspaceRoot,t.id,async()=>{const o=await u(t.workspaceRoot,t.id);if(o&&a(o.pid))throw new Error(`Service ${t.id} is already running (pid ${String(o.pid)})`);o&&await f(t.workspaceRoot,t.id,o);const e=await h(t.workspaceRoot),s=_(t.id),i=c(e,`${s}.log`),{pid:r}=await $t({command:t.command,cwd:t.cwd,env:t.env,logFile:i}),n={command:t.command,config:t.config,cwd:t.cwd,env:t.config.env??{},id:t.id,logFile:i,pid:r,slug:s,startedAt:new Date().toISOString(),visVersion:process.env.VIS_VERSION??"0.0.0"};if(await lt(t.workspaceRoot,n),t.skipReadiness!==!0)try{await at(t.config,{timeoutMs:t.readinessTimeoutMs})}catch(p){throw await D(r,t.config.killGracePeriodMs??P).catch(()=>{}),await f(t.workspaceRoot,t.id,n).catch(()=>{}),p}return{entry:n}}),At=async t=>M(t.workspaceRoot,t.id,async()=>{const o=await u(t.workspaceRoot,t.id);if(!o)return{stopped:!1};if(!a(o.pid))return await f(t.workspaceRoot,t.id,o),{stopped:!1};const e=t.graceMs??o.config.killGracePeriodMs??P;return await D(o.pid,e),await f(t.workspaceRoot,t.id,o),{stopped:!0}}),D=async(t,o)=>{H(t,"SIGTERM");const e=Date.now();for(;Date.now()-e<o;){if(!a(t))return;await new Promise(s=>{setTimeout(s,100)})}a(t)&&H(t,"SIGKILL")},H=(t,o)=>{try{process.platform==="win32"?process.kill(t,o):process.kill(-t,o)}catch(e){if(e.code==="ESRCH")return;throw e}};export{jt as H,st as S,It as a,at as b,ft as c,xt as d,Ot as e,f,a as i,Dt as p,u as r,At as s};