@visulima/vis 1.0.0-alpha.10 → 1.0.0-alpha.12

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 (107) hide show
  1. package/CHANGELOG.md +185 -42
  2. package/LICENSE.md +586 -0
  3. package/README.md +26 -4
  4. package/dist/config/index.d.ts +1739 -0
  5. package/dist/config/index.js +1 -0
  6. package/dist/generate/index.d.ts +1 -1
  7. package/dist/packem_chunks/applyDefaults.js +2 -0
  8. package/dist/packem_chunks/bin.js +232 -60
  9. package/dist/packem_chunks/doctor-probe.js +2 -0
  10. package/dist/packem_chunks/fix.js +11 -53
  11. package/dist/packem_chunks/handler.js +1 -1
  12. package/dist/packem_chunks/handler10.js +2 -1
  13. package/dist/packem_chunks/handler11.js +1 -1
  14. package/dist/packem_chunks/handler12.js +5 -2
  15. package/dist/packem_chunks/handler13.js +1 -1
  16. package/dist/packem_chunks/handler14.js +18 -5
  17. package/dist/packem_chunks/handler15.js +20 -1
  18. package/dist/packem_chunks/handler16.js +1 -20
  19. package/dist/packem_chunks/handler17.js +1 -1
  20. package/dist/packem_chunks/handler18.js +1 -1
  21. package/dist/packem_chunks/handler19.js +1 -1
  22. package/dist/packem_chunks/handler2.js +2 -1
  23. package/dist/packem_chunks/handler20.js +5 -1
  24. package/dist/packem_chunks/handler21.js +1 -1
  25. package/dist/packem_chunks/handler22.js +1 -5
  26. package/dist/packem_chunks/handler23.js +5 -1
  27. package/dist/packem_chunks/handler24.js +1 -1
  28. package/dist/packem_chunks/handler25.js +3 -5
  29. package/dist/packem_chunks/handler26.js +1 -1
  30. package/dist/packem_chunks/handler27.js +1 -3
  31. package/dist/packem_chunks/handler28.js +7 -1
  32. package/dist/packem_chunks/handler29.js +22 -6
  33. package/dist/packem_chunks/handler3.js +4 -2
  34. package/dist/packem_chunks/handler30.js +3 -23
  35. package/dist/packem_chunks/handler31.js +1 -3
  36. package/dist/packem_chunks/handler32.js +2 -2
  37. package/dist/packem_chunks/handler33.js +24 -23
  38. package/dist/packem_chunks/handler34.js +2 -2
  39. package/dist/packem_chunks/handler35.js +3 -19
  40. package/dist/packem_chunks/handler36.js +22 -428
  41. package/dist/packem_chunks/handler37.js +428 -22
  42. package/dist/packem_chunks/handler38.js +20 -20
  43. package/dist/packem_chunks/handler39.js +21 -21
  44. package/dist/packem_chunks/handler4.js +2 -4
  45. package/dist/packem_chunks/handler40.js +22 -3
  46. package/dist/packem_chunks/handler41.js +6 -10
  47. package/dist/packem_chunks/handler42.js +5 -153
  48. package/dist/packem_chunks/handler43.js +10 -42
  49. package/dist/packem_chunks/handler44.js +153 -3
  50. package/dist/packem_chunks/handler45.js +25 -27
  51. package/dist/packem_chunks/handler46.js +3 -0
  52. package/dist/packem_chunks/handler47.js +27 -0
  53. package/dist/packem_chunks/handler48.js +42 -0
  54. package/dist/packem_chunks/handler5.js +8 -2
  55. package/dist/packem_chunks/handler6.js +1 -13
  56. package/dist/packem_chunks/handler7.js +1 -8
  57. package/dist/packem_chunks/handler8.js +1 -1
  58. package/dist/packem_chunks/handler9.js +1 -1
  59. package/dist/packem_chunks/heal-accept.js +10 -0
  60. package/dist/packem_chunks/heal.js +14 -0
  61. package/dist/packem_chunks/index.js +3 -3
  62. package/dist/packem_chunks/tar.js +3 -0
  63. package/dist/packem_shared/ai-analysis-hm8d2W7z.js +67 -0
  64. package/dist/packem_shared/{ai-cache-Bynt6Y9x.js → ai-cache-DoiF80AR.js} +1 -1
  65. package/dist/packem_shared/ai-fix-nn4zOE95.js +43 -0
  66. package/dist/packem_shared/cache-directory-CwHlJhgx.js +1 -0
  67. package/dist/packem_shared/dependency-scan-COr5n63B.js +2 -0
  68. package/dist/packem_shared/{docker-BcfqH4Av.js → docker-D6OGr5_S.js} +1 -1
  69. package/dist/packem_shared/{failure-log-DqYen0LC.js → failure-log-iUVLf6ts.js} +1 -1
  70. package/dist/packem_shared/flakiness-D9wf0t56.js +1 -0
  71. package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
  72. package/dist/packem_shared/index-DH-5hsrC.js +1 -0
  73. package/dist/packem_shared/otel-DxDUPJJH.js +6 -0
  74. package/dist/packem_shared/otelPlugin-CQq6poq8.js +1 -0
  75. package/dist/packem_shared/registry-CkubDdiY.js +2 -0
  76. package/dist/packem_shared/run-summary-utils-BfBvjzhY.js +1 -0
  77. package/dist/packem_shared/{runtime-check-CGHal8SO.js → runtime-check-BXZ43CBW.js} +1 -1
  78. package/dist/packem_shared/{selectors-CfH9ZY08.js → selectors-BylODRiM.js} +1 -1
  79. package/dist/packem_shared/toolchain-BgBOUHII.js +5 -0
  80. package/dist/packem_shared/typosquats-CcZl99B1.js +1 -0
  81. package/dist/packem_shared/verify-Baj5mFJ7.js +1 -0
  82. package/dist/packem_shared/vis-update-app-D1jl0UZZ.js +1 -0
  83. package/index.js +54 -53
  84. package/package.json +34 -26
  85. package/schemas/project.schema.json +739 -299
  86. package/schemas/vis-config.schema.json +3383 -278
  87. package/skills/vis/SKILL.md +96 -0
  88. package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
  89. package/templates/buildkite-ci/template.yml +20 -0
  90. package/dist/errors/index.d.ts +0 -26
  91. package/dist/errors/index.js +0 -1
  92. package/dist/packem_chunks/config.js +0 -2
  93. package/dist/packem_shared/VisConfigCycleError-CAYNC7d-.js +0 -1
  94. package/dist/packem_shared/VisConfigError-B5LP1zRf.js +0 -1
  95. package/dist/packem_shared/VisConfigLoadError-CeqBSd2Z.js +0 -2
  96. package/dist/packem_shared/VisConfigNotFoundError-DZ9KC527.js +0 -5
  97. package/dist/packem_shared/VisUpdateApp-D-L4_-Iu.js +0 -1
  98. package/dist/packem_shared/_commonjsHelpers-D6W6KoPK.js +0 -1
  99. package/dist/packem_shared/ai-analysis-CGuy7dfE.js +0 -67
  100. package/dist/packem_shared/cache-directory-D72ZEag2.js +0 -1
  101. package/dist/packem_shared/catalog-BVPerCwG.js +0 -12
  102. package/dist/packem_shared/dependency-scan-Du0tBu64.js +0 -2
  103. package/dist/packem_shared/flakiness-DSIHZGBT.js +0 -1
  104. package/dist/packem_shared/run-summary-utils-C24Aaf9E.js +0 -1
  105. package/dist/packem_shared/target-merge-DNa-6eWu.js +0 -1
  106. package/dist/packem_shared/toolchain-DQfTQY8E.js +0 -5
  107. package/dist/packem_shared/typosquats-DOR8izpX.js +0 -1
@@ -0,0 +1,3 @@
1
+ var lr=Object.defineProperty;var f=(e,t)=>lr(e,"name",{value:t,configurable:!0});import{createRequire as dr}from"node:module";import{p as fr}from"../packem_shared/giget-CcEy_Elm.js";const ur=dr(import.meta.url),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=f(e=>{if(typeof Me<"u"&&Me.versions&&Me.versions.node){const[t,i]=Me.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return Me.getBuiltinModule(e)}return ur(e)},"__cjs_getBuiltinModule"),d=N("node:fs"),cr=N("node:fs/promises"),As=N("node:stream"),p=N("node:path"),{posix:ve,basename:mr,join:Ds,win32:pr}=p,Ns=N("events"),{EventEmitter:yr}=Ns,b=N("fs"),{EventEmitter:Pi}=N("node:events"),{StringDecoder:br}=N("node:string_decoder"),rt=N("path"),{parse:Er,dirname:gr}=rt,pi=N("assert"),{Buffer:we}=N("buffer"),Xi=N("zlib"),qi={...Xi,default:Xi},wr=N("zlib"),Rr=N("node:assert"),{randomBytes:Is}=N("node:crypto");var _r=Object.defineProperty,o=f((e,t)=>_r(e,"name",{value:t,configurable:!0}),"o"),rn=fr({Header:o(()=>le,"Header"),Pack:o(()=>ot,"Pack"),PackJob:o(()=>ki,"PackJob"),PackSync:o(()=>Ut,"PackSync"),Parser:o(()=>Ie,"Parser"),Pax:o(()=>ht,"Pax"),ReadEntry:o(()=>Zi,"ReadEntry"),Unpack:o(()=>Ft,"Unpack"),UnpackSync:o(()=>Mi,"UnpackSync"),WriteEntry:o(()=>Yi,"WriteEntry"),WriteEntrySync:o(()=>Gs,"WriteEntrySync"),WriteEntryTar:o(()=>$s,"WriteEntryTar"),c:o(()=>bs,"c"),create:o(()=>bs,"create"),extract:o(()=>xs,"extract"),filesFilter:o(()=>Wi,"filesFilter"),list:o(()=>Ce,"list"),r:o(()=>ge,"r"),replace:o(()=>ge,"replace"),t:o(()=>Ce,"t"),types:o(()=>js,"types"),x:o(()=>xs,"x")}),Sr=Object.defineProperty,vr=o((e,t)=>{for(var i in t)Sr(e,i,{get:t[i],enumerable:!0})},"ue"),Ji=process||{stdout:null,stderr:null},Or=o(e=>!!e&&typeof e=="object"&&(e instanceof Se||e instanceof As||Tr(e)||kr(e)),"fe"),Tr=o(e=>!!e&&typeof e=="object"&&e instanceof Pi&&typeof e.pipe=="function"&&e.pipe!==As.Writable.prototype.pipe,"pe"),kr=o(e=>!!e&&typeof e=="object"&&e instanceof Pi&&typeof e.write=="function"&&typeof e.end=="function","me"),$=Symbol("EOF"),Y=Symbol("maybeEmitEnd"),J=Symbol("emittedEnd"),at=Symbol("emittingEnd"),Pe=Symbol("emittedError"),lt=Symbol("closed"),Qi=Symbol("read"),dt=Symbol("flush"),es=Symbol("flushChunk"),C=Symbol("encoding"),Oe=Symbol("decoder"),v=Symbol("flowing"),ze=Symbol("paused"),xe=Symbol("resume"),O=Symbol("buffer"),D=Symbol("pipes"),T=Symbol("bufferLength"),Ht=Symbol("bufferPush"),ut=Symbol("bufferShift"),A=Symbol("objectMode"),R=Symbol("destroyed"),Zt=Symbol("error"),Wt=Symbol("emitData"),ts=Symbol("emitEnd"),Gt=Symbol("emitEnd2"),j=Symbol("async"),$t=Symbol("abort"),ft=Symbol("aborted"),Ue=Symbol("signal"),de=Symbol("dataListeners"),I=Symbol("discarded"),je=o(e=>Promise.resolve().then(e),"Pe"),Lr=o(e=>e(),"Fe"),xr=o(e=>e==="end"||e==="finish"||e==="prefinish","Ie"),Ar=o(e=>e instanceof ArrayBuffer||!!e&&typeof e=="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,"Le"),Dr=o(e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),"Re"),Bs=class{static{f(this,"As")}static{o(this,"ze")}src;dest;opts;ondrain;constructor(e,t,i){this.src=e,this.dest=t,this.opts=i,this.ondrain=()=>e[xe](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Nr=class extends Bs{static{f(this,"Sr")}static{o(this,"Be")}unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,i){super(e,t,i),this.proxyErrors=s=>this.dest.emit("error",s),e.on("error",this.proxyErrors)}},Ir=o(e=>!!e.objectMode,"Ve"),Br=o(e=>!e.objectMode&&!!e.encoding&&e.encoding!=="buffer","He"),Se=class extends Pi{static{f(this,"Rt")}static{o(this,"Ue")}[v]=!1;[ze]=!1;[D]=[];[O]=[];[A];[C];[j];[Oe];[$]=!1;[J]=!1;[at]=!1;[lt]=!1;[Pe]=null;[T]=0;[R]=!1;[Ue];[ft]=!1;[de]=0;[I]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");Ir(t)?(this[A]=!0,this[C]=null):Br(t)?(this[C]=t.encoding,this[A]=!1):(this[A]=!1,this[C]=null),this[j]=!!t.async,this[Oe]=this[C]?new br(this[C]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:o(()=>this[O],"get")}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:o(()=>this[D],"get")});let{signal:i}=t;i&&(this[Ue]=i,i.aborted?this[$t]():i.addEventListener("abort",()=>this[$t]()))}get bufferLength(){return this[T]}get encoding(){return this[C]}set encoding(e){throw Error("Encoding must be set at instantiation time")}setEncoding(e){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[A]}set objectMode(e){throw Error("objectMode must be set at instantiation time")}get async(){return this[j]}set async(e){this[j]=this[j]||!!e}[$t](){this[ft]=!0,this.emit("abort",this[Ue]?.reason),this.destroy(this[Ue]?.reason)}get aborted(){return this[ft]}set aborted(e){}write(e,t,i){if(this[ft])return!1;if(this[$])throw Error("write after end");if(this[R])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof t=="function"&&(i=t,t="utf8"),t||="utf8";let s=this[j]?je:Lr;if(!this[A]&&!Buffer.isBuffer(e)){if(Dr(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Ar(e))e=Buffer.from(e);else if(typeof e!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[A]?(this[v]&&this[T]!==0&&this[dt](!0),this[v]?this.emit("data",e):this[Ht](e),this[T]!==0&&this.emit("readable"),i&&s(i),this[v]):e.length?(typeof e=="string"&&!(t===this[C]&&!this[Oe]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[C]&&(e=this[Oe].write(e)),this[v]&&this[T]!==0&&this[dt](!0),this[v]?this.emit("data",e):this[Ht](e),this[T]!==0&&this.emit("readable"),i&&s(i),this[v]):(this[T]!==0&&this.emit("readable"),i&&s(i),this[v])}read(e){if(this[R])return null;if(this[I]=!1,this[T]===0||e===0||e&&e>this[T])return this[Y](),null;this[A]&&(e=null),this[O].length>1&&!this[A]&&(this[O]=[this[C]?this[O].join(""):Buffer.concat(this[O],this[T])]);let t=this[Qi](e||null,this[O][0]);return this[Y](),t}[Qi](e,t){if(this[A])this[ut]();else{let i=t;e===i.length||e===null?this[ut]():typeof i=="string"?(this[O][0]=i.slice(e),t=i.slice(0,e),this[T]-=e):(this[O][0]=i.subarray(e),t=i.subarray(0,e),this[T]-=e)}return this.emit("data",t),!this[O].length&&!this[$]&&this.emit("drain"),t}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t="utf8"),e!==void 0&&this.write(e,t),i&&this.once("end",i),this[$]=!0,this.writable=!1,(this[v]||!this[ze])&&this[Y](),this}[xe](){this[R]||(!this[de]&&!this[D].length&&(this[I]=!0),this[ze]=!1,this[v]=!0,this.emit("resume"),this[O].length?this[dt]():this[$]?this[Y]():this.emit("drain"))}resume(){return this[xe]()}pause(){this[v]=!1,this[ze]=!0,this[I]=!1}get destroyed(){return this[R]}get flowing(){return this[v]}get paused(){return this[ze]}[Ht](e){this[A]?this[T]+=1:this[T]+=e.length,this[O].push(e)}[ut](){return this[A]?--this[T]:this[T]-=this[O][0].length,this[O].shift()}[dt](e=!1){do;while(this[es](this[ut]())&&this[O].length);!e&&!this[O].length&&!this[$]&&this.emit("drain")}[es](e){return this.emit("data",e),this[v]}pipe(e,t){if(this[R])return e;this[I]=!1;let i=this[J];return t||={},e===Ji.stdout||e===Ji.stderr?t.end=!1:t.end=t.end!==!1,t.proxyErrors=!!t.proxyErrors,i?t.end&&e.end():(this[D].push(t.proxyErrors?new Nr(this,e,t):new Bs(this,e,t)),this[j]?je(()=>this[xe]()):this[xe]()),e}unpipe(e){let t=this[D].find(i=>i.dest===e);t&&(this[D].length===1?(this[v]&&this[de]===0&&(this[v]=!1),this[D]=[]):this[D].splice(this[D].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let i=super.on(e,t);if(e==="data")this[I]=!1,this[de]++,!this[D].length&&!this[v]&&this[xe]();else if(e==="readable"&&this[T]!==0)super.emit("readable");else if(xr(e)&&this[J])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Pe]){let s=t;this[j]?je(()=>s.call(this,this[Pe])):s.call(this,this[Pe])}return i}removeListener(e,t){return this.off(e,t)}off(e,t){let i=super.off(e,t);return e==="data"&&(this[de]=this.listeners("data").length,this[de]===0&&!this[I]&&!this[D].length&&(this[v]=!1)),i}removeAllListeners(e){let t=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[de]=0,!this[I]&&!this[D].length&&(this[v]=!1)),t}get emittedEnd(){return this[J]}[Y](){!this[at]&&!this[J]&&!this[R]&&this[O].length===0&&this[$]&&(this[at]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[lt]&&this.emit("close"),this[at]=!1)}emit(e,...t){let i=t[0];if(e!=="error"&&e!=="close"&&e!==R&&this[R])return!1;if(e==="data")return!this[A]&&!i?!1:this[j]?(je(()=>this[Wt](i)),!0):this[Wt](i);if(e==="end")return this[ts]();if(e==="close"){if(this[lt]=!0,!this[J]&&!this[R])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(e==="error"){this[Pe]=i,super.emit(Zt,i);let r=!this[Ue]||this.listeners("error").length?super.emit("error",i):!1;return this[Y](),r}else if(e==="resume"){let r=super.emit("resume");return this[Y](),r}else if(e==="finish"||e==="prefinish"){let r=super.emit(e);return this.removeAllListeners(e),r}let s=super.emit(e,...t);return this[Y](),s}[Wt](e){for(let i of this[D])i.dest.write(e)===!1&&this.pause();let t=this[I]?!1:super.emit("data",e);return this[Y](),t}[ts](){return this[J]?!1:(this[J]=!0,this.readable=!1,this[j]?(je(()=>this[Gt]()),!0):this[Gt]())}[Gt](){if(this[Oe]){let t=this[Oe].end();if(t){for(let i of this[D])i.dest.write(t);this[I]||super.emit("data",t)}}for(let t of this[D])t.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[A]||(e.dataLength=0);let t=this.promise();return this.on("data",i=>{e.push(i),this[A]||(e.dataLength+=i.length)}),await t,e}async concat(){if(this[A])throw Error("cannot concat in objectMode");let e=await this.collect();return this[C]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(R,()=>t(Error("stream destroyed"))),this.on("error",i=>t(i)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[I]=!1;let e=!1,t=o(async()=>(this.pause(),e=!0,{value:void 0,done:!0}),"t");return{next:o(()=>{if(e)return t();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[$])return t();let s,r,h=o(u=>{this.off("data",n),this.off("end",a),this.off(R,l),t(),r(u)},"a"),n=o(u=>{this.off("error",h),this.off("end",a),this.off(R,l),this.pause(),s({value:u,done:!!this[$]})},"o"),a=o(()=>{this.off("error",h),this.off("data",n),this.off(R,l),t(),s({done:!0,value:void 0})},"s"),l=o(()=>h(Error("stream destroyed")),"c");return new Promise((u,m)=>{r=m,s=u,this.once(R,l),this.once("error",h),this.once("end",a),this.once("data",n)})},"next"),throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[I]=!1;let e=!1,t=o(()=>(this.pause(),this.off(Zt,t),this.off(R,t),this.off("end",t),e=!0,{done:!0,value:void 0}),"t");return this.once("end",t),this.once(Zt,t),this.once(R,t),{next:o(()=>{if(e)return t();let i=this.read();return i===null?t():{done:!1,value:i}},"next"),throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[R])return e?this.emit("error",e):this.emit(R),this;this[R]=!0,this[I]=!0,this[O].length=0,this[T]=0;let t=this;return typeof t.close=="function"&&!this[lt]&&t.close(),e?this.emit("error",e):this.emit(R),this}static get isStream(){return Or}},Fr=b.writev,oe=Symbol("_autoClose"),U=Symbol("_close"),He=Symbol("_ended"),y=Symbol("_fd"),Yt=Symbol("_finished"),q=Symbol("_flags"),Vt=Symbol("_flush"),yi=Symbol("_handleChunk"),bi=Symbol("_makeBuf"),qe=Symbol("_mode"),ct=Symbol("_needDrain"),Be=Symbol("_onerror"),Fe=Symbol("_onopen"),Kt=Symbol("_onread"),Ae=Symbol("_onwrite"),ae=Symbol("_open"),z=Symbol("_path"),ie=Symbol("_pos"),H=Symbol("_queue"),De=Symbol("_read"),Xt=Symbol("_readSize"),X=Symbol("_reading"),Ze=Symbol("_remain"),qt=Symbol("_size"),_t=Symbol("_write"),ue=Symbol("_writing"),St=Symbol("_defaultFlag"),Re=Symbol("_errored"),zi=class extends Se{static{f(this,"Ce")}static{o(this,"dt")}[Re]=!1;[y];[z];[Xt];[X]=!1;[qt];[Ze];[oe];constructor(e,t){if(t||={},super(t),this.readable=!0,this.writable=!1,typeof e!="string")throw TypeError("path must be a string");this[Re]=!1,this[y]=typeof t.fd=="number"?t.fd:void 0,this[z]=e,this[Xt]=t.readSize||16*1024*1024,this[X]=!1,this[qt]=typeof t.size=="number"?t.size:1/0,this[Ze]=this[qt],this[oe]=typeof t.autoClose=="boolean"?t.autoClose:!0,typeof this[y]=="number"?this[De]():this[ae]()}get fd(){return this[y]}get path(){return this[z]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[ae](){b.open(this[z],"r",(e,t)=>this[Fe](e,t))}[Fe](e,t){e?this[Be](e):(this[y]=t,this.emit("open",t),this[De]())}[bi](){return Buffer.allocUnsafe(Math.min(this[Xt],this[Ze]))}[De](){if(!this[X]){this[X]=!0;let e=this[bi]();if(e.length===0)return process.nextTick(()=>this[Kt](null,0,e));b.read(this[y],e,0,e.length,null,(t,i,s)=>this[Kt](t,i,s))}}[Kt](e,t,i){this[X]=!1,e?this[Be](e):this[yi](t,i)&&this[De]()}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.close(e,t=>t?this.emit("error",t):this.emit("close"))}}[Be](e){this[X]=!0,this[U](),this.emit("error",e)}[yi](e,t){let i=!1;return this[Ze]-=e,e>0&&(i=super.write(e<t.length?t.subarray(0,e):t)),(e===0||this[Ze]<=0)&&(i=!1,this[U](),super.end()),i}emit(e,...t){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[y]=="number"&&this[De](),!1;case"error":return this[Re]?!1:(this[Re]=!0,super.emit(e,...t));default:return super.emit(e,...t)}}},Cr=class extends zi{static{f(this,"kr")}static{o(this,"ft")}[ae](){let e=!0;try{this[Fe](null,b.openSync(this[z],"r")),e=!1}finally{e&&this[U]()}}[De](){let e=!0;try{if(!this[X]){this[X]=!0;do{let t=this[bi](),i=t.length===0?0:b.readSync(this[y],t,0,t.length,null);if(!this[yi](i,t))break}while(!0);this[X]=!1}e=!1}finally{e&&this[U]()}}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.closeSync(e),this.emit("close")}}},Ct=class extends Ns{static{f(this,"Ii")}static{o(this,"pt")}readable=!1;writable=!0;[Re]=!1;[ue]=!1;[He]=!1;[H]=[];[ct]=!1;[z];[qe];[oe];[y];[St];[q];[Yt]=!1;[ie];constructor(e,t){t||={},super(t),this[z]=e,this[y]=typeof t.fd=="number"?t.fd:void 0,this[qe]=t.mode===void 0?438:t.mode,this[ie]=typeof t.start=="number"?t.start:void 0,this[oe]=typeof t.autoClose=="boolean"?t.autoClose:!0;let i=this[ie]===void 0?"w":"r+";this[St]=t.flags===void 0,this[q]=t.flags===void 0?i:t.flags,this[y]===void 0&&this[ae]()}emit(e,...t){if(e==="error"){if(this[Re])return!1;this[Re]=!0}return super.emit(e,...t)}get fd(){return this[y]}get path(){return this[z]}[Be](e){this[U](),this[ue]=!0,this.emit("error",e)}[ae](){b.open(this[z],this[q],this[qe],(e,t)=>this[Fe](e,t))}[Fe](e,t){this[St]&&this[q]==="r+"&&e&&e.code==="ENOENT"?(this[q]="w",this[ae]()):e?this[Be](e):(this[y]=t,this.emit("open",t),this[ue]||this[Vt]())}end(e,t){return e&&this.write(e,t),this[He]=!0,!this[ue]&&!this[H].length&&typeof this[y]=="number"&&this[Ae](null,0),this}write(e,t){return typeof e=="string"&&(e=Buffer.from(e,t)),this[He]?(this.emit("error",Error("write() after end()")),!1):this[y]===void 0||this[ue]||this[H].length?(this[H].push(e),this[ct]=!0,!1):(this[ue]=!0,this[_t](e),!0)}[_t](e){b.write(this[y],e,0,e.length,this[ie],(t,i)=>this[Ae](t,i))}[Ae](e,t){e?this[Be](e):(this[ie]!==void 0&&typeof t=="number"&&(this[ie]+=t),this[H].length?this[Vt]():(this[ue]=!1,this[He]&&!this[Yt]?(this[Yt]=!0,this[U](),this.emit("finish")):this[ct]&&(this[ct]=!1,this.emit("drain"))))}[Vt](){if(this[H].length===0)this[He]&&this[Ae](null,0);else if(this[H].length===1)this[_t](this[H].pop());else{let e=this[H];this[H]=[],Fr(this[y],e,this[ie],(t,i)=>this[Ae](t,i))}}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.close(e,t=>t?this.emit("error",t):this.emit("close"))}}},Fs=class extends Ct{static{f(this,"Ds")}static{o(this,"mt")}[ae](){let e;if(this[St]&&this[q]==="r+")try{e=b.openSync(this[z],this[q],this[qe])}catch(t){if(t?.code==="ENOENT")return this[q]="w",this[ae]();throw t}else e=b.openSync(this[z],this[q],this[qe]);this[Fe](null,e)}[U](){if(this[oe]&&typeof this[y]=="number"){let e=this[y];this[y]=void 0,b.closeSync(e),this.emit("close")}}[_t](e){let t=!0;try{this[Ae](null,b.writeSync(this[y],e,0,e.length,this[ie])),t=!1}finally{if(t)try{this[U]()}catch{}}}},Mr=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Pr=o(e=>!!e.sync&&!!e.file,"gt"),zr=o(e=>!e.sync&&!!e.file,"_t"),Ur=o(e=>!!e.sync&&!e.file,"vt"),jr=o(e=>!e.sync&&!e.file,"yt"),Hr=o(e=>!!e.file,"bt"),Zr=o(e=>Mr.get(e)||e,"xt"),Ui=o((e={})=>{if(!e)return{};let t={};for(let[i,s]of Object.entries(e)){let r=Zr(i);t[r]=s}return t.chmod===void 0&&t.noChmod===!1&&(t.chmod=!0),delete t.noChmod,t},"St"),nt=o((e,t,i,s,r)=>Object.assign((h=[],n,a)=>{Array.isArray(h)&&(n=h,h={}),typeof n=="function"&&(a=n,n=void 0),n=n?Array.from(n):[];let l=Ui(h);if(r?.(l,n),Pr(l)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return e(l,n)}else if(zr(l)){let u=t(l,n);return a?u.then(()=>a(),a):u}else if(Ur(l)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return i(l,n)}else if(jr(l)){if(typeof a=="function")throw TypeError("callback only supported with file option");return s(l,n)}throw Error("impossible options??")},{syncFile:e,asyncFile:t,syncNoFile:i,asyncNoFile:s,validate:r}),"Ct"),Wr=wr.constants||{ZLIB_VERNUM:4736},G=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Wr)),Gr=we.concat,is=Object.getOwnPropertyDescriptor(we,"concat"),$r=o(e=>e,"Dt"),Jt=is?.writable===!0||is?.set!==void 0?e=>{we.concat=e?$r:Gr}:e=>{},_e=Symbol("_superWrite"),mt=class extends Error{static{f(this,"di")}static{o(this,"At")}code;errno;constructor(e,t){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||="ZLIB_ERROR",this.message="zlib: "+e.message,Error.captureStackTrace(this,t??this.constructor)}get name(){return"ZlibError"}},Qt=Symbol("flushFlag"),ji=class extends Se{static{f(this,"Pe")}static{o(this,"Mt")}#e=!1;#i=!1;#s;#h;#r;#t;#n;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#s}constructor(e,t){if(!e||typeof e!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(e),this.#s=e.flush??0,this.#h=e.finishFlush??0,this.#r=e.fullFlushFlag??0,typeof qi[t]!="function")throw TypeError("Compression method not supported: "+t);try{this.#t=new qi[t](e)}catch(i){throw new mt(i,this.constructor)}this.#n=i=>{this.#e||(this.#e=!0,this.close(),this.emit("error",i))},this.#t?.on("error",i=>this.#n(new mt(i))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return pi(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#r),this.write(Object.assign(we.alloc(0),{[Qt]:e})))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&(t?this.write(e,t):this.write(e)),this.flush(this.#h),this.#i=!0,super.end(i)}get ended(){return this.#i}[_e](e){return super.write(e)}write(e,t,i){if(typeof t=="function"&&(i=t,t="utf8"),typeof e=="string"&&(e=we.from(e,t)),this.#e)return;pi(this.#t,"zlib binding closed");let s=this.#t._handle,r=s.close;s.close=()=>{};let h=this.#t.close;this.#t.close=()=>{},Jt(!0);let n;try{let l=typeof e[Qt]=="number"?e[Qt]:this.#s;n=this.#t._processChunk(e,l),Jt(!1)}catch(l){Jt(!1),this.#n(new mt(l,this.write))}finally{this.#t&&(this.#t._handle=s,s.close=r,this.#t.close=h,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",l=>this.#n(new mt(l,this.write)));let a;if(n)if(Array.isArray(n)&&n.length>0){let l=n[0];a=this[_e](we.from(l));for(let u=1;u<n.length;u++)a=this[_e](n[u])}else a=this[_e](we.from(n));return i&&i(),a}},Cs=class extends ji{static{f(this,"xs")}static{o(this,"Nt")}#e;#i;constructor(e,t){e||={},e.flush=e.flush||G.Z_NO_FLUSH,e.finishFlush=e.finishFlush||G.Z_FINISH,e.fullFlushFlag=G.Z_FULL_FLUSH,super(e,t),this.#e=e.level,this.#i=e.strategy}params(e,t){if(!this.sawError){if(!this.handle)throw Error("cannot switch params when binding is closed");if(!this.handle.params)throw Error("not supported in this implementation");if(this.#e!==e||this.#i!==t){this.flush(G.Z_SYNC_FLUSH),pi(this.handle,"zlib binding closed");let i=this.handle.flush;this.handle.flush=(s,r)=>{typeof s=="function"&&(r=s,s=this.flushFlag),this.flush(s),r?.()};try{this.handle.params(e,t)}finally{this.handle.flush=i}this.handle&&(this.#e=e,this.#i=t)}}}},Yr=class extends Cs{static{f(this,"Pr")}static{o(this,"Pt")}#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[_e](e){return this.#e?(this.#e=!1,e[9]=255,super[_e](e)):super[_e](e)}},Vr=class extends Cs{static{f(this,"zr")}static{o(this,"Ft")}constructor(e){super(e,"Unzip")}},Ms=class extends ji{static{f(this,"Ns")}static{o(this,"It")}constructor(e,t){e||={},e.flush=e.flush||G.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||G.BROTLI_OPERATION_FINISH,e.fullFlushFlag=G.BROTLI_OPERATION_FLUSH,super(e,t)}},Kr=class extends Ms{static{f(this,"Ur")}static{o(this,"Lt")}constructor(e){super(e,"BrotliCompress")}},Xr=class extends Ms{static{f(this,"jr")}static{o(this,"Rt")}constructor(e){super(e,"BrotliDecompress")}},Ps=class extends ji{static{f(this,"Is")}static{o(this,"zt")}constructor(e,t){e||={},e.flush=e.flush||G.ZSTD_e_continue,e.finishFlush=e.finishFlush||G.ZSTD_e_end,e.fullFlushFlag=G.ZSTD_e_flush,super(e,t)}},qr=class extends Ps{static{f(this,"Hr")}static{o(this,"Bt")}constructor(e){super(e,"ZstdCompress")}},Jr=class extends Ps{static{f(this,"Zr")}static{o(this,"Vt")}constructor(e){super(e,"ZstdDecompress")}},Qr=o((e,t)=>{if(Number.isSafeInteger(e))e<0?th(e,t):eh(e,t);else throw Error("cannot encode number outside of javascript safe integer range");return t},"Ht"),eh=o((e,t)=>{t[0]=128;for(var i=t.length;i>1;i--)t[i-1]=e&255,e=Math.floor(e/256)},"Ut"),th=o((e,t)=>{t[0]=255;var i=!1;e*=-1;for(var s=t.length;s>1;s--){var r=e&255;e=Math.floor(e/256),i?t[s-1]=zs(r):r===0?t[s-1]=0:(i=!0,t[s-1]=Us(r))}},"Wt"),ih=o(e=>{let t=e[0],i=t===128?rh(e.subarray(1,e.length)):t===255?sh(e):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},"Gt"),sh=o(e=>{for(var t=e.length,i=0,s=!1,r=t-1;r>-1;r--){var h=Number(e[r]),n;s?n=zs(h):h===0?n=h:(s=!0,n=Us(h)),n!==0&&(i-=n*256**(t-r-1))}return i},"Kt"),rh=o(e=>{for(var t=e.length,i=0,s=t-1;s>-1;s--){var r=Number(e[s]);r!==0&&(i+=r*256**(t-s-1))}return i},"qt"),zs=o(e=>(255^e)&255,"Jt"),Us=o(e=>(255^e)+1&255,"Yt"),js={};vr(js,{code:o(()=>Hi,"code"),isCode:o(()=>vt,"isCode"),isName:o(()=>hh,"isName"),name:o(()=>Mt,"name")});var vt=o(e=>Mt.has(e),"Zt"),hh=o(e=>Hi.has(e),"Qt"),Mt=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Hi=new Map(Array.from(Mt).map(e=>[e[1],e[0]])),le=class{static{f(this,"ot")}static{o(this,"I")}cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,t=0,i,s){Buffer.isBuffer(e)?this.decode(e,t||0,i,s):e&&this.#i(e)}decode(e,t,i,s){if(t||=0,!e||!(e.length>=t+512))throw Error("need 512 bytes for header");this.path=i?.path??fe(e,t,100),this.mode=i?.mode??s?.mode??se(e,t+100,8),this.uid=i?.uid??s?.uid??se(e,t+108,8),this.gid=i?.gid??s?.gid??se(e,t+116,8),this.size=i?.size??s?.size??se(e,t+124,12),this.mtime=i?.mtime??s?.mtime??ei(e,t+136,12),this.cksum=se(e,t+148,12),s&&this.#i(s,!0),i&&this.#i(i);let r=fe(e,t+156,1);if(vt(r)&&(this.#e=r||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=fe(e,t+157,100),e.subarray(t+257,t+265).toString()==="ustar\x0000")if(this.uname=i?.uname??s?.uname??fe(e,t+265,32),this.gname=i?.gname??s?.gname??fe(e,t+297,32),this.devmaj=i?.devmaj??s?.devmaj??se(e,t+329,8)??0,this.devmin=i?.devmin??s?.devmin??se(e,t+337,8)??0,e[t+475]!==0)this.path=fe(e,t+345,155)+"/"+this.path;else{let n=fe(e,t+345,130);n&&(this.path=n+"/"+this.path),this.atime=i?.atime??s?.atime??ei(e,t+476,12),this.ctime=i?.ctime??s?.ctime??ei(e,t+488,12)}let h=256;for(let n=t;n<t+148;n++)h+=e[n];for(let n=t+156;n<t+512;n++)h+=e[n];this.cksumValid=h===this.cksum,this.cksum===void 0&&h===256&&(this.nullBlock=!0)}#i(e,t=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,s])=>!(s==null||i==="path"&&t||i==="linkpath"&&t||i==="global"))))}encode(e,t=0){if(e||=this.block=Buffer.alloc(512),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=t+512))throw Error("need 512 bytes for header");let i=this.ctime||this.atime?130:155,s=nh(this.path||"",i),r=s[0],h=s[1];this.needPax=!!s[2],this.needPax=ce(e,t,100,r)||this.needPax,this.needPax=re(e,t+100,8,this.mode)||this.needPax,this.needPax=re(e,t+108,8,this.uid)||this.needPax,this.needPax=re(e,t+116,8,this.gid)||this.needPax,this.needPax=re(e,t+124,12,this.size)||this.needPax,this.needPax=ti(e,t+136,12,this.mtime)||this.needPax,e[t+156]=Number(this.#e.codePointAt(0)),this.needPax=ce(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=ce(e,t+265,32,this.uname)||this.needPax,this.needPax=ce(e,t+297,32,this.gname)||this.needPax,this.needPax=re(e,t+329,8,this.devmaj)||this.needPax,this.needPax=re(e,t+337,8,this.devmin)||this.needPax,this.needPax=ce(e,t+345,i,h)||this.needPax,e[t+475]===0?(this.needPax=ce(e,t+345,130,h)||this.needPax,this.needPax=ti(e,t+476,12,this.atime)||this.needPax,this.needPax=ti(e,t+488,12,this.ctime)||this.needPax):this.needPax=ce(e,t+345,155,h)||this.needPax;let n=256;for(let a=t;a<t+148;a++)n+=e[a];for(let a=t+156;a<t+512;a++)n+=e[a];return this.cksum=n,re(e,t+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:Mt.get(this.#e)}get typeKey(){return this.#e}set type(e){let t=String(Hi.get(e));if(vt(t)||t==="Unsupported")this.#e=t;else if(vt(e))this.#e=e;else throw TypeError("invalid entry type: "+e)}},nh=o((e,t)=>{let i=e,s="",r,h=ve.parse(e).root||".";if(Buffer.byteLength(i)<100)r=[i,s,!1];else{s=ve.dirname(i),i=ve.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(s)<=t?r=[i,s,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(s)<=t?r=[i.slice(0,99),s,!0]:(i=ve.join(ve.basename(s),i),s=ve.dirname(s));while(s!==h&&r===void 0);r||=[e.slice(0,99),"",!0]}return r},"tn"),fe=o((e,t,i)=>e.subarray(t,t+i).toString("utf8").replace(/\0.*/,""),"nn"),ei=o((e,t,i)=>oh(se(e,t,i)),"rn"),oh=o(e=>e===void 0?void 0:new Date(e*1e3),"an"),se=o((e,t,i)=>Number(e[t])&128?ih(e.subarray(t,t+i)):lh(e,t,i),"L"),ah=o(e=>isNaN(e)?void 0:e,"on"),lh=o((e,t,i)=>ah(parseInt(e.subarray(t,t+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),"sn"),dh={12:8589934591,8:2097151},re=o((e,t,i,s)=>s===void 0?!1:s>dh[i]||s<0?(Qr(s,e.subarray(t,t+i)),!0):(uh(e,t,i,s),!1),"R"),uh=o((e,t,i,s)=>e.write(fh(s,i),t,i,"ascii"),"ln"),fh=o((e,t)=>ch(Math.floor(e).toString(8),t),"un"),ch=o((e,t)=>(e.length===t-1?e:Array(t-e.length-1).join("0")+e+" ")+"\0","dn"),ti=o((e,t,i,s)=>s===void 0?!1:re(e,t,i,s.getTime()/1e3),"fn"),mh=Array(156).join("\0"),ce=o((e,t,i,s)=>s===void 0?!1:(e.write(s+mh,t,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),"mn"),ht=class Hs{static{f(this,"Ms")}static{o(this,"e")}atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,i=!1){this.atime=t.atime,this.charset=t.charset,this.comment=t.comment,this.ctime=t.ctime,this.dev=t.dev,this.gid=t.gid,this.global=i,this.gname=t.gname,this.ino=t.ino,this.linkpath=t.linkpath,this.mtime=t.mtime,this.nlink=t.nlink,this.path=t.path,this.size=t.size,this.uid=t.uid,this.uname=t.uname}encode(){let t=this.encodeBody();if(t==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(t),s=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(s);for(let h=0;h<512;h++)r[h]=0;new le({path:("PaxHeader/"+mr(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(t,512,i,"utf8");for(let h=i+512;h<r.length;h++)r[h]=0;return r}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===void 0)return"";let i=this[t],s=i instanceof Date?i.getTime()/1e3:i,r=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+s+`
2
+ `,h=Buffer.byteLength(r),n=Math.floor(Math.log(h)/Math.log(10))+1;return h+n>=10**n&&(n+=1),n+h+r}static parse(t,i,s=!1){return new Hs(ph(yh(t),i),s)}},ph=o((e,t)=>t?Object.assign({},t,e):e,"gn"),yh=o(e=>e.replace(/\n$/,"").split(`
3
+ `).reduce(bh,Object.create(null)),"_n"),bh=o((e,t)=>{let i=parseInt(t,10);if(i!==Buffer.byteLength(t)+1)return e;t=t.slice((i+" ").length);let s=t.split("="),r=s.shift();if(!r)return e;let h=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),n=s.join("=");return e[h]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(h)?new Date(Number(n)*1e3):/^[0-9]+$/.test(n)?+n:n,e},"vn"),c=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32"?e=>e&&e.replaceAll(/\\/g,"/"):e=>e,Zi=class extends Se{static{f(this,"Ue")}static{o(this,"yn")}extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,t,i){switch(super({}),this.pause(),this.extended=t,this.globalExtended=i,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw Error("no path provided for tar.ReadEntry");this.path=c(e.path),this.mode=e.mode,this.mode&&(this.mode&=4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?c(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,t&&this.#e(t),i&&this.#e(i,!0)}write(e){let t=e.length;if(t>this.blockRemain)throw Error("writing more to entry than is appropriate");let i=this.remain,s=this.blockRemain;return this.remain=Math.max(0,i-t),this.blockRemain=Math.max(0,s-t),this.ignore?!0:i>=t?super.write(e):super.write(e.subarray(0,i))}#e(e,t=!1){e.path&&=c(e.path),e.linkpath&&=c(e.linkpath),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([i,s])=>!(s==null||i==="path"&&t))))}},Pt=o((e,t,i,s={})=>{e.file&&(s.file=e.file),e.cwd&&(s.cwd=e.cwd),s.code=i instanceof Error&&i.code||t,s.tarCode=t,!e.strict&&s.recoverable!==!1?(i instanceof Error&&(s=Object.assign(i,s),i=i.message),e.emit("warn",t,i,s)):i instanceof Error?e.emit("error",Object.assign(i,s)):e.emit("error",Object.assign(Error(`${t}: ${i}`),s))},"bn"),Eh=1024*1024,Ei=Buffer.from([31,139]),gi=Buffer.from([40,181,47,253]),gh=Math.max(Ei.length,gi.length),B=Symbol("state"),me=Symbol("writeEntry"),V=Symbol("readEntry"),ii=Symbol("nextEntry"),ss=Symbol("processEntry"),Z=Symbol("extendedHeader"),We=Symbol("globalExtendedHeader"),Q=Symbol("meta"),rs=Symbol("emitMeta"),E=Symbol("buffer"),K=Symbol("queue"),ee=Symbol("ended"),si=Symbol("emittedEnd"),pe=Symbol("emit"),S=Symbol("unzip"),pt=Symbol("consumeChunk"),yt=Symbol("consumeChunkSub"),ri=Symbol("consumeBody"),hs=Symbol("consumeMeta"),ns=Symbol("consumeHeader"),Ge=Symbol("consuming"),hi=Symbol("bufferConcat"),bt=Symbol("maybeEnd"),Te=Symbol("writing"),te=Symbol("aborted"),Et=Symbol("onDone"),ye=Symbol("sawValidEntry"),gt=Symbol("sawNullBlock"),wt=Symbol("sawEOF"),os=Symbol("closeStream"),wh=o(()=>!0,"qn"),Ie=class extends yr{static{f(this,"xt")}static{o(this,"Jn")}file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[K]=[];[E];[V];[me];[B]="begin";[Q]="";[Z];[We];[ee]=!1;[S];[te]=!1;[ye];[gt]=!1;[wt]=!1;[Te]=!1;[Ge]=!1;[si]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(Et,()=>{(this[B]==="begin"||this[ye]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(Et,e.ondone):this.on(Et,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||Eh,this.filter=typeof e.filter=="function"?e.filter:wh;let t=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:t?void 0:!1;let i=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:i?!0:void 0,this.on("end",()=>this[os]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,t,i={}){Pt(this,e,t,i)}[ns](e,t){this[ye]===void 0&&(this[ye]=!1);let i;try{i=new le(e,t,this[Z],this[We])}catch(s){return this.warn("TAR_ENTRY_INVALID",s)}if(i.nullBlock)this[gt]?(this[wt]=!0,this[B]==="begin"&&(this[B]="header"),this[pe]("eof")):(this[gt]=!0,this[pe]("nullBlock"));else if(this[gt]=!1,!i.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i});else if(!i.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:i});else{let s=i.type;if(/^(Symbolic)?Link$/.test(s)&&!i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i});else if(!/^(Symbolic)?Link$/.test(s)&&!/^(Global)?ExtendedHeader$/.test(s)&&i.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i});else{let r=this[me]=new Zi(i,this[Z],this[We]);this[ye]||(r.remain?r.on("end",()=>{r.invalid||(this[ye]=!0)}):this[ye]=!0),r.meta?r.size>this.maxMetaEntrySize?(r.ignore=!0,this[pe]("ignoredEntry",r),this[B]="ignore",r.resume()):r.size>0&&(this[Q]="",r.on("data",h=>this[Q]+=h),this[B]="meta"):(this[Z]=void 0,r.ignore=r.ignore||!this.filter(r.path,r),r.ignore?(this[pe]("ignoredEntry",r),this[B]=r.remain?"ignore":"header",r.resume()):(r.remain?this[B]="body":(this[B]="header",r.end()),this[V]?this[K].push(r):(this[K].push(r),this[ii]())))}}}[os](){queueMicrotask(()=>this.emit("close"))}[ss](e){let t=!0;if(!e)this[V]=void 0,t=!1;else if(Array.isArray(e)){let[i,...s]=e;this.emit(i,...s)}else this[V]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[ii]()),t=!1);return t}[ii](){do;while(this[ss](this[K].shift()));if(this[K].length===0){let e=this[V];!e||e.flowing||e.size===e.remain?this[Te]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[ri](e,t){let i=this[me];if(!i)throw Error("attempt to consume body without entry??");let s=i.blockRemain??0,r=s>=e.length&&t===0?e:e.subarray(t,t+s);return i.write(r),i.blockRemain||(this[B]="header",this[me]=void 0,i.end()),r.length}[hs](e,t){let i=this[me],s=this[ri](e,t);return!this[me]&&i&&this[rs](i),s}[pe](e,t,i){this[K].length===0&&!this[V]?this.emit(e,t,i):this[K].push([e,t,i])}[rs](e){switch(this[pe]("meta",this[Q]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Z]=ht.parse(this[Q],this[Z],!1);break;case"GlobalExtendedHeader":this[We]=ht.parse(this[Q],this[We],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let t=this[Z]??Object.create(null);this[Z]=t,t.path=this[Q].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let t=this[Z]||Object.create(null);this[Z]=t,t.linkpath=this[Q].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+e.type)}}abort(e){this[te]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this[te])return i?.(),!1;if((this[S]===void 0||this.brotli===void 0&&this[S]===!1)&&e){if(this[E]&&(e=Buffer.concat([this[E],e]),this[E]=void 0),e.length<gh)return this[E]=e,i?.(),!0;for(let n=0;this[S]===void 0&&n<Ei.length;n++)e[n]!==Ei[n]&&(this[S]=!1);let r=!1;if(this[S]===!1&&this.zstd!==!1){r=!0;for(let n=0;n<gi.length;n++)if(e[n]!==gi[n]){r=!1;break}}let h=this.brotli===void 0&&!r;if(this[S]===!1&&h)if(e.length<512)if(this[ee])this.brotli=!0;else return this[E]=e,i?.(),!0;else try{new le(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[S]===void 0||this[S]===!1&&(this.brotli||r)){let n=this[ee];this[ee]=!1,this[S]=this[S]===void 0?new Vr({}):r?new Jr({}):new Xr({}),this[S].on("data",l=>this[pt](l)),this[S].on("error",l=>this.abort(l)),this[S].on("end",()=>{this[ee]=!0,this[pt]()}),this[Te]=!0;let a=!!this[S][n?"end":"write"](e);return this[Te]=!1,i?.(),a}}this[Te]=!0,this[S]?this[S].write(e):this[pt](e),this[Te]=!1;let s=this[K].length>0?!1:this[V]?this[V].flowing:!0;return!s&&this[K].length===0&&this[V]?.once("drain",()=>this.emit("drain")),i?.(),s}[hi](e){e&&!this[te]&&(this[E]=this[E]?Buffer.concat([this[E],e]):e)}[bt](){if(this[ee]&&!this[si]&&!this[te]&&!this[Ge]){this[si]=!0;let e=this[me];if(e&&e.blockRemain){let t=this[E]?this[E].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${t} available)`,{entry:e}),this[E]&&e.write(this[E]),e.end()}this[pe](Et)}}[pt](e){if(this[Ge]&&e)this[hi](e);else if(!e&&!this[E])this[bt]();else if(e){if(this[Ge]=!0,this[E]){this[hi](e);let t=this[E];this[E]=void 0,this[yt](t)}else this[yt](e);for(;this[E]&&this[E]?.length>=512&&!this[te]&&!this[wt];){let t=this[E];this[E]=void 0,this[yt](t)}this[Ge]=!1}(!this[E]||this[ee])&&this[bt]()}[yt](e){let t=0,i=e.length;for(;t+512<=i&&!this[te]&&!this[wt];)switch(this[B]){case"begin":case"header":this[ns](e,t),t+=512;break;case"ignore":case"body":t+=this[ri](e,t);break;case"meta":t+=this[hs](e,t);break;default:throw Error("invalid state: "+this[B])}t<i&&(this[E]=this[E]?Buffer.concat([e.subarray(t),this[E]]):e.subarray(t))}end(e,t,i){return typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t)),i&&this.once("finish",i),this[te]||(this[S]?(e&&this[S].write(e),this[S].end()):(this[ee]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e||=Buffer.alloc(0)),e&&this.write(e),this[bt]())),this}},Je=o(e=>{let t=e.length-1,i=-1;for(;t>-1&&e.charAt(t)==="/";)i=t,t--;return i===-1?e:e.slice(0,i)},"Yn"),Rh=o(e=>{let t=e.onReadEntry;e.onReadEntry=t?i=>{t(i),i.resume()}:i=>i.resume()},"Xn"),Wi=o((e,t)=>{let i=new Map(t.map(h=>[Je(h),!0])),s=e.filter,r=o((h,n="")=>{let a=n||Er(h).root||".",l;if(h===a)l=!1;else{let u=i.get(h);l=u===void 0?r(gr(h),a):u}return i.set(h,l),l},"i");e.filter=s?(h,n)=>s(h,n)&&r(Je(h)):h=>r(Je(h))},"Zn"),Ce=nt(e=>{let t=new Ie(e),i=e.file,s;try{s=d.openSync(i,"r");let r=d.fstatSync(s),h=e.maxReadSize||16*1024*1024;if(r.size<h){let n=Buffer.allocUnsafe(r.size),a=d.readSync(s,n,0,r.size,0);t.end(a===n.byteLength?n:n.subarray(0,a))}else{let n=0,a=Buffer.allocUnsafe(h);for(;n<r.size;){let l=d.readSync(s,a,0,h,n);if(l===0)break;n+=l,t.write(a.subarray(0,l))}t.end()}}finally{if(typeof s=="number")try{d.closeSync(s)}catch{}}},(e,t)=>{let i=new Ie(e),s=e.maxReadSize||16*1024*1024,r=e.file;return new Promise((h,n)=>{i.on("error",n),i.on("end",h),d.stat(r,(a,l)=>{if(a)n(a);else{let u=new zi(r,{readSize:s,size:l.size});u.on("error",n),u.pipe(i)}})})},e=>new Ie(e),e=>new Ie(e),(e,t)=>{t?.length&&Wi(e,t),e.noResume||Rh(e)}),Zs=o((e,t,i)=>(e&=4095,i&&(e=(e|384)&-19),t&&(e&256&&(e|=64),e&32&&(e|=8),e&4&&(e|=1)),e),"$n"),{isAbsolute:_h,parse:as}=pr,Gi=o(e=>{let t="",i=as(e);for(;_h(e)||i.root;){let s=e.charAt(0)==="/"&&e.slice(0,4)!=="//?/"?"/":i.root;e=e.slice(s.length),t+=s,i=as(e)}return[t,e]},"nr"),zt=["|","<",">","?",":"],$i=zt.map(e=>String.fromCodePoint(61440+Number(e.codePointAt(0)))),Sh=new Map(zt.map((e,t)=>[e,$i[t]])),vh=new Map($i.map((e,t)=>[e,zt[t]])),ls=o(e=>zt.reduce((t,i)=>t.split(i).join(Sh.get(i)),e),"sr"),Oh=o(e=>$i.reduce((t,i)=>t.split(i).join(vh.get(i)),e),"cr"),Ws=o((e,t)=>t?(e=c(e).replace(/^\.(\/|$)/,""),Je(t)+"/"+e):c(e),"lr"),Th=16*1024*1024,ds=Symbol("process"),us=Symbol("file"),fs=Symbol("directory"),wi=Symbol("symlink"),cs=Symbol("hardlink"),$e=Symbol("header"),Ot=Symbol("read"),Ri=Symbol("lstat"),Tt=Symbol("onlstat"),_i=Symbol("onread"),Si=Symbol("onreadlink"),vi=Symbol("openfile"),Oi=Symbol("onopenfile"),he=Symbol("close"),It=Symbol("mode"),Ti=Symbol("awaitDrain"),ni=Symbol("ondrain"),W=Symbol("prefix"),Yi=class extends Se{static{f(this,"We")}static{o(this,"Dr")}path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,t={}){let i=Ui(t);super(),this.path=c(e),this.portable=!!i.portable,this.maxReadSize=i.maxReadSize||Th,this.linkCache=i.linkCache||new Map,this.statCache=i.statCache||new Map,this.preservePaths=!!i.preservePaths,this.cwd=c(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?c(i.prefix):void 0,this.onWriteEntry=i.onWriteEntry,typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let s=!1;if(!this.preservePaths){let[h,n]=Gi(this.path);h&&typeof n=="string"&&(this.path=n,s=h)}this.win32=!!i.win32||process.platform==="win32",this.win32&&(this.path=Oh(this.path.replaceAll(/\\/g,"/")),e=e.replaceAll(/\\/g,"/")),this.absolute=c(i.absolute||rt.resolve(this.cwd,e)),this.path===""&&(this.path="./"),s&&this.warn("TAR_ENTRY_INFO",`stripping ${s} from absolute path`,{entry:this,path:s+this.path});let r=this.statCache.get(this.absolute);r?this[Tt](r):this[Ri]()}warn(e,t,i={}){return Pt(this,e,t,i)}emit(e,...t){return e==="error"&&(this.#e=!0),super.emit(e,...t)}[Ri](){b.lstat(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Tt](t)})}[Tt](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=kh(e),this.emit("stat",e),this[ds]()}[ds](){switch(this.type){case"File":return this[us]();case"Directory":return this[fs]();case"SymbolicLink":return this[wi]();default:return this.end()}}[It](e){return Zs(e,this.type==="Directory",this.portable)}[W](e){return Ws(e,this.prefix)}[$e](){if(!this.stat)throw Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new le({path:this[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](this.linkpath):this.linkpath,mode:this[It](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new ht({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw Error("failed to encode header");super.write(e)}[fs](){if(!this.stat)throw Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[$e](),this.end()}[wi](){b.readlink(this.absolute,(e,t)=>{if(e)return this.emit("error",e);this[Si](t)})}[Si](e){this.linkpath=c(e),this[$e](),this.end()}[cs](e){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=c(rt.relative(this.cwd,e)),this.stat.size=0,this[$e](),this.end()}[us](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,t=this.linkCache.get(e);if(t?.indexOf(this.cwd)===0)return this[cs](t);this.linkCache.set(e,this.absolute)}if(this[$e](),this.stat.size===0)return this.end();this[vi]()}[vi](){b.open(this.absolute,"r",(e,t)=>{if(e)return this.emit("error",e);this[Oi](t)})}[Oi](e){if(this.fd=e,this.#e)return this[he]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let t=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(t),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[Ot]()}[Ot](){let{fd:e,buf:t,offset:i,length:s,pos:r}=this;if(e===void 0||t===void 0)throw Error("cannot read file without first opening");b.read(e,t,i,s,r,(h,n)=>{if(h)return this[he](()=>this.emit("error",h));this[_i](n)})}[he](e=()=>{}){this.fd!==void 0&&b.close(this.fd,e)}[_i](e){if(e<=0&&this.remain>0){let i=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[he](()=>this.emit("error",i))}if(e>this.remain){let i=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[he](()=>this.emit("error",i))}if(!this.buf)throw Error("should have created buffer prior to reading");if(e===this.remain)for(let i=e;i<this.length&&e<this.blockRemain;i++)this.buf[i+this.offset]=0,e++,this.remain++;let t=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(t)?this[ni]():this[Ti](()=>this[ni]())}[Ti](e){this.once("drain",e)}write(e,t,i){if(typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8")),this.blockRemain<e.length){let s=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",s)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,i)}[ni](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[he](e=>e?this.emit("error",e):this.end());if(!this.buf)throw Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[Ot]()}},Gs=class extends Yi{static{f(this,"Us")}static{o(this,"Or")}sync=!0;[Ri](){this[Tt](b.lstatSync(this.absolute))}[wi](){this[Si](b.readlinkSync(this.absolute))}[vi](){this[Oi](b.openSync(this.absolute,"r"))}[Ot](){let e=!0;try{let{fd:t,buf:i,offset:s,length:r,pos:h}=this;if(t===void 0||i===void 0)throw Error("fd and buf must be set in READ method");let n=b.readSync(t,i,s,r,h);this[_i](n),e=!1}finally{if(e)try{this[he](()=>{})}catch{}}}[Ti](e){e()}[he](e=()=>{}){this.fd!==void 0&&b.closeSync(this.fd),e()}},$s=class extends Se{static{f(this,"js")}static{o(this,"kr")}blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,t,i={}){return Pt(this,e,t,i)}constructor(e,t={}){let i=Ui(t);super(),this.preservePaths=!!i.preservePaths,this.portable=!!i.portable,this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.onWriteEntry=i.onWriteEntry,this.readEntry=e;let{type:s}=e;if(s==="Unsupported")throw Error("writing entry that should be ignored");this.type=s,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=i.prefix,this.path=c(e.path),this.mode=e.mode===void 0?void 0:this[It](e.mode),this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:i.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath===void 0?void 0:c(e.linkpath),typeof i.onwarn=="function"&&this.on("warn",i.onwarn);let r=!1;if(!this.preservePaths){let[n,a]=Gi(this.path);n&&typeof a=="string"&&(this.path=a,r=n)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new le({path:this[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path}),this.header.encode()&&!this.noPax&&super.write(new ht({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[W](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[W](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let h=this.header?.block;if(!h)throw Error("failed to encode header");super.write(h),e.pipe(this)}[W](e){return Ws(e,this.prefix)}[It](e){return Zs(e,this.type==="Directory",this.portable)}write(e,t,i){typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof t=="string"?t:"utf8"));let s=e.length;if(s>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(e,i)}end(e,t,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(i=e,t=void 0,e=void 0),typeof t=="function"&&(i=t,t=void 0),typeof e=="string"&&(e=Buffer.from(e,t??"utf8")),i&&this.once("finish",i),e?super.end(e,i):super.end(i),this}},kh=o(e=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported","Ar"),Lh=class Ne{static{f(this,"Dt")}static{o(this,"e")}tail;head;length=0;static create(t=[]){return new Ne(t)}constructor(t=[]){for(let i of t)this.push(i)}*[Symbol.iterator](){for(let t=this.head;t;t=t.next)yield t.value}removeNode(t){if(t.list!==this)throw Error("removing node which does not belong to this list");let i=t.next,s=t.prev;return i&&(i.prev=s),s&&(s.next=i),t===this.head&&(this.head=i),t===this.tail&&(this.tail=s),this.length--,t.next=void 0,t.prev=void 0,t.list=void 0,i}unshiftNode(t){if(t===this.head)return;t.list&&t.list.removeNode(t);let i=this.head;t.list=this,t.next=i,i&&(i.prev=t),this.head=t,this.tail||=t,this.length++}pushNode(t){if(t===this.tail)return;t.list&&t.list.removeNode(t);let i=this.tail;t.list=this,t.prev=i,i&&(i.next=t),this.tail=t,this.head||=t,this.length++}push(...t){for(let i=0,s=t.length;i<s;i++)Vs(this,t[i]);return this.length}unshift(...t){for(var i=0,s=t.length;i<s;i++)Ks(this,t[i]);return this.length}pop(){if(!this.tail)return;let t=this.tail.value,i=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,i.list=void 0,this.length--,t}shift(){if(!this.head)return;let t=this.head.value,i=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,i.list=void 0,this.length--,t}forEach(t,i){i||=this;for(let s=this.head,r=0;s;r++)t.call(i,s.value,r,this),s=s.next}forEachReverse(t,i){i||=this;for(let s=this.tail,r=this.length-1;s;r--)t.call(i,s.value,r,this),s=s.prev}get(t){let i=0,s=this.head;for(;s&&i<t;i++)s=s.next;if(i===t&&s)return s.value}getReverse(t){let i=0,s=this.tail;for(;s&&i<t;i++)s=s.prev;if(i===t&&s)return s.value}map(t,i){i||=this;let s=new Ne;for(let r=this.head;r;)s.push(t.call(i,r.value,this)),r=r.next;return s}mapReverse(t,i){i||=this;var s=new Ne;for(let r=this.tail;r;)s.push(t.call(i,r.value,this)),r=r.prev;return s}reduce(t,i){let s,r=this.head;if(arguments.length>1)s=i;else if(this.head)r=this.head.next,s=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var h=0;r;h++)s=t(s,r.value,h),r=r.next;return s}reduceReverse(t,i){let s,r=this.tail;if(arguments.length>1)s=i;else if(this.tail)r=this.tail.prev,s=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(let h=this.length-1;r;h--)s=t(s,r.value,h),r=r.prev;return s}toArray(){let t=Array(this.length);for(let i=0,s=this.head;s;i++)t[i]=s.value,s=s.next;return t}toArrayReverse(){let t=Array(this.length);for(let i=0,s=this.tail;s;i++)t[i]=s.value,s=s.prev;return t}slice(t=0,i=this.length){i<0&&(i+=this.length),t<0&&(t+=this.length);let s=new Ne;if(i<t||i<0)return s;t<0&&(t=0),i>this.length&&(i=this.length);let r=this.head,h=0;for(h=0;r&&h<t;h++)r=r.next;for(;r&&h<i;h++,r=r.next)s.push(r.value);return s}sliceReverse(t=0,i=this.length){i<0&&(i+=this.length),t<0&&(t+=this.length);let s=new Ne;if(i<t||i<0)return s;t<0&&(t=0),i>this.length&&(i=this.length);let r=this.length,h=this.tail;for(;h&&r>i;r--)h=h.prev;for(;h&&r>t;r--,h=h.prev)s.push(h.value);return s}splice(t,i=0,...s){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);let r=this.head;for(let n=0;r&&n<t;n++)r=r.next;let h=[];for(let n=0;r&&n<i;n++)h.push(r.value),r=this.removeNode(r);r?r!==this.tail&&(r=r.prev):r=this.tail;for(let n of s)r=Ys(this,r,n);return h}reverse(){let t=this.head,i=this.tail;for(let s=t;s;s=s.prev){let r=s.prev;s.prev=s.next,s.next=r}return this.head=i,this.tail=t,this}};function Ys(e,t,i){let s=new Vi(i,t,t?t.next:e.head,e);return s.next===void 0&&(e.tail=s),s.prev===void 0&&(e.head=s),e.length++,s}f(Ys,"wh");o(Ys,"Mr");function Vs(e,t){e.tail=new Vi(t,e.tail,void 0,e),e.head||=e.tail,e.length++}f(Vs,"Rh");o(Vs,"Nr");function Ks(e,t){e.head=new Vi(t,void 0,e.head,e),e.tail||=e.head,e.length++}f(Ks,"_h");o(Ks,"Pr");var Vi=class{static{f(this,"Ge")}static{o(this,"Fr")}list;next;prev;value;constructor(e,t,i,s){this.list=s,this.value=e,t?(t.next=this,this.prev=t):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}},ki=class{static{f(this,"ve")}static{o(this,"Ir")}path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,t){this.path=e||"./",this.absolute=t}},ms=Buffer.alloc(1024),kt=Symbol("onStat"),Ye=Symbol("ended"),M=Symbol("queue"),be=Symbol("current"),Ee=Symbol("process"),Ve=Symbol("processing"),oi=Symbol("processJob"),P=Symbol("jobs"),ai=Symbol("jobDone"),Lt=Symbol("addFSEntry"),ps=Symbol("addTarEntry"),Li=Symbol("stat"),xi=Symbol("readdir"),xt=Symbol("onreaddir"),At=Symbol("pipe"),ys=Symbol("entry"),li=Symbol("entryOpt"),Dt=Symbol("writeEntryClass"),Xs=Symbol("write"),di=Symbol("ondrain"),ot=class extends Se{static{f(this,"si")}static{o(this,"ni")}sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Dt];onWriteEntry;[M];[P]=0;[Ve]=!1;[Ye]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=c(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[Dt]=Yi,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new Yr(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new Kr(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new qr(e.zstd)),!this.zip)throw Error("impossible");let t=this.zip;t.on("data",i=>super.write(i)),t.on("end",()=>super.end()),t.on("drain",()=>this[di]()),this.on("resume",()=>t.resume())}else this.on("drain",this[di]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[M]=new Lh,this[P]=0,this.jobs=Number(e.jobs)||4,this[Ve]=!1,this[Ye]=!1}[Xs](e){return super.write(e)}add(e){return this.write(e),this}end(e,t,i){return typeof e=="function"&&(i=e,e=void 0),typeof t=="function"&&(i=t,t=void 0),e&&this.add(e),this[Ye]=!0,this[Ee](),i&&i(),this}write(e){if(this[Ye])throw Error("write after end");return e instanceof Zi?this[ps](e):this[Lt](e),this.flowing}[ps](e){let t=c(rt.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let i=new ki(e.path,t);i.entry=new $s(e,this[li](i)),i.entry.on("end",()=>this[ai](i)),this[P]+=1,this[M].push(i)}this[Ee]()}[Lt](e){let t=c(rt.resolve(this.cwd,e));this[M].push(new ki(e,t)),this[Ee]()}[Li](e){e.pending=!0,this[P]+=1,b[this.follow?"stat":"lstat"](e.absolute,(t,i)=>{e.pending=!1,--this[P],t?this.emit("error",t):this[kt](e,i)})}[kt](e,t){this.statCache.set(e.absolute,t),e.stat=t,this.filter(e.path,t)?t.isFile()&&t.nlink>1&&e===this[be]&&!this.linkCache.get(`${t.dev}:${t.ino}`)&&!this.sync&&this[oi](e):e.ignore=!0,this[Ee]()}[xi](e){e.pending=!0,this[P]+=1,b.readdir(e.absolute,(t,i)=>{if(e.pending=!1,--this[P],t)return this.emit("error",t);this[xt](e,i)})}[xt](e,t){this.readdirCache.set(e.absolute,t),e.readdir=t,this[Ee]()}[Ee](){if(!this[Ve]){this[Ve]=!0;for(let e=this[M].head;e&&this[P]<this.jobs;e=e.next)if(this[oi](e.value),e.value.ignore){let t=e.next;this[M].removeNode(e),e.next=t}this[Ve]=!1,this[Ye]&&this[M].length===0&&this[P]===0&&(this.zip?this.zip.end(ms):(super.write(ms),super.end()))}}get[be](){return this[M]&&this[M].head&&this[M].head.value}[ai](e){this[M].shift(),--this[P],this[Ee]()}[oi](e){if(!e.pending){if(e.entry){e===this[be]&&!e.piped&&this[At](e);return}if(!e.stat){let t=this.statCache.get(e.absolute);t?this[kt](e,t):this[Li](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let t=this.readdirCache.get(e.absolute);if(t?this[xt](e,t):this[xi](e),!e.readdir)return}if(e.entry=this[ys](e),!e.entry){e.ignore=!0;return}e===this[be]&&!e.piped&&this[At](e)}}}[li](e){return{onwarn:o((t,i,s)=>this.warn(t,i,s),"onwarn"),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[ys](e){this[P]+=1;try{return new this[Dt](e.path,this[li](e)).on("end",()=>this[ai](e)).on("error",t=>this.emit("error",t))}catch(t){this.emit("error",t)}}[di](){this[be]&&this[be].entry&&this[be].entry.resume()}[At](e){e.piped=!0,e.readdir&&e.readdir.forEach(s=>{let r=e.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[Lt](h+s)});let t=e.entry,i=this.zip;if(!t)throw Error("cannot pipe without source");i?t.on("data",s=>{i.write(s)||t.pause()}):t.on("data",s=>{super.write(s)||t.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,t,i={}){Pt(this,e,t,i)}},Ut=class extends ot{static{f(this,"Mi")}static{o(this,"ri")}sync=!0;constructor(e){super(e),this[Dt]=Gs}pause(){}resume(){}[Li](e){let t=this.follow?"statSync":"lstatSync";this[kt](e,b[t](e.absolute))}[xi](e){this[xt](e,b.readdirSync(e.absolute))}[At](e){let t=e.entry,i=this.zip;if(e.readdir&&e.readdir.forEach(s=>{let r=e.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[Lt](h+s)}),!t)throw Error("Cannot pipe without source");i?t.on("data",s=>{i.write(s)}):t.on("data",s=>{super[Xs](s)})}},xh=o((e,t)=>{let i=new Ut(e),s=new Fs(e.file,{mode:e.mode||438});i.pipe(s),qs(i,t)},"ii"),Ah=o((e,t)=>{let i=new ot(e),s=new Ct(e.file,{mode:e.mode||438});i.pipe(s);let r=new Promise((h,n)=>{s.on("error",n),s.on("close",h),i.on("error",n)});return Js(i,t).catch(h=>i.emit("error",h)),r},"ai"),qs=o((e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Ce({file:p.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:o(s=>e.add(s),"onReadEntry")}):e.add(i)}),e.end()},"oi"),Js=o(async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Ce({file:p.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:o(s=>{e.add(s)},"onReadEntry")}):e.add(i);e.end()},"si"),bs=nt(xh,Ah,(e,t)=>{let i=new Ut(e);return qs(i,t),i},(e,t)=>{let i=new ot(e);return Js(i,t).catch(s=>i.emit("error",s)),i},(e,t)=>{if(!t?.length)throw TypeError("no paths specified to add to archive")}),Qs=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",{O_CREAT:er,O_NOFOLLOW:Es,O_TRUNC:tr,O_WRONLY:ir}=b.constants,sr=Number(process.env.__FAKE_FS_O_FILENAME__)||b.constants.UV_FS_O_FILEMAP||0,Dh=Qs&&!!sr,Nh=512*1024,Ih=sr|tr|er|ir,gs=!Qs&&typeof Es=="number"?Es|tr|er|ir:null,rr=gs===null?Dh?e=>e<Nh?Ih:"w":()=>"w":()=>gs,Ai=o((e,t,i)=>{try{return d.lchownSync(e,t,i)}catch(s){if(s?.code!=="ENOENT")throw s}},"bi"),Bt=o((e,t,i,s)=>{d.lchown(e,t,i,r=>{s(r&&r?.code!=="ENOENT"?r:null)})},"xi"),Bh=o((e,t,i,s,r)=>{t.isDirectory()?hr(p.resolve(e,t.name),i,s,h=>{if(h)return r(h);Bt(p.resolve(e,t.name),i,s,r)}):Bt(p.resolve(e,t.name),i,s,r)},"Si"),hr=o((e,t,i,s)=>{d.readdir(e,{withFileTypes:!0},(r,h)=>{if(r){if(r.code==="ENOENT")return s();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return s(r)}if(r||!h.length)return Bt(e,t,i,s);let n=h.length,a=null,l=o(u=>{if(!a){if(u)return s(a=u);if(--n===0)return Bt(e,t,i,s)}},"c");for(let u of h)Bh(e,u,t,i,l)})},"Ci"),Fh=o((e,t,i,s)=>{t.isDirectory()&&nr(p.resolve(e,t.name),i,s),Ai(p.resolve(e,t.name),i,s)},"wi"),nr=o((e,t,i)=>{let s;try{s=d.readdirSync(e,{withFileTypes:!0})}catch(r){let h=r;if(h?.code==="ENOENT")return;if(h?.code==="ENOTDIR"||h?.code==="ENOTSUP")return Ai(e,t,i);throw h}for(let r of s)Fh(e,r,t,i);return Ai(e,t,i)},"Ti"),or=class extends Error{static{f(this,"Js")}static{o(this,"Ei")}path;code;syscall="chdir";constructor(e,t){super(`${t}: Cannot cd into '${e}'`),this.path=e,this.code=t}get name(){return"CwdError"}},jt=class extends Error{static{f(this,"Pi")}static{o(this,"Di")}path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,t){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=t}get name(){return"SymlinkError"}},Ch=o((e,t)=>{d.stat(e,(i,s)=>{(i||!s.isDirectory())&&(i=new or(e,i?.code||"ENOTDIR")),t(i)})},"Oi"),Mh=o((e,t,i)=>{e=c(e);let s=t.umask??18,r=t.mode|448,h=(r&s)!==0,n=t.uid,a=t.gid,l=typeof n=="number"&&typeof a=="number"&&(n!==t.processUid||a!==t.processGid),u=t.preserve,m=t.unlink,g=c(t.cwd),w=o((L,_)=>{L?i(L):_&&l?hr(_,n,a,x=>w(x)):h?d.chmod(e,r,i):i()},"m");if(e===g)return Ch(e,w);if(u)return cr.mkdir(e,{mode:r,recursive:!0}).then(L=>w(null,L??void 0),w);Di(g,c(p.relative(g,e)).split("/"),r,m,g,void 0,w)},"ki"),Di=o((e,t,i,s,r,h,n)=>{if(t.length===0)return n(null,h);let a=t.shift(),l=c(p.resolve(e+"/"+a));d.mkdir(l,i,ar(l,t,i,s,r,h,n))},"Ai"),ar=o((e,t,i,s,r,h,n)=>a=>{a?d.lstat(e,(l,u)=>{if(l)l.path=l.path&&c(l.path),n(l);else if(u.isDirectory())Di(e,t,i,s,r,h,n);else if(s)d.unlink(e,m=>{if(m)return n(m);d.mkdir(e,i,ar(e,t,i,s,r,h,n))});else{if(u.isSymbolicLink())return n(new jt(e,e+"/"+t.join("/")));n(a)}}):(h||=e,Di(e,t,i,s,r,h,n))},"ji"),Ph=o(e=>{let t=!1,i;try{t=d.statSync(e).isDirectory()}catch(s){i=s?.code}finally{if(!t)throw new or(e,i??"ENOTDIR")}},"Mi"),zh=o((e,t)=>{e=c(e);let i=t.umask??18,s=t.mode|448,r=(s&i)!==0,h=t.uid,n=t.gid,a=typeof h=="number"&&typeof n=="number"&&(h!==t.processUid||n!==t.processGid),l=t.preserve,u=t.unlink,m=c(t.cwd),g=o(_=>{_&&a&&nr(_,h,n),r&&d.chmodSync(e,s)},"ee");if(e===m)return Ph(m),g();if(l)return g(d.mkdirSync(e,{mode:s,recursive:!0})??void 0);let w=c(p.relative(m,e)).split("/"),L;for(let _=w.shift(),x=m;_&&(x+="/"+_);_=w.shift()){x=c(p.resolve(x));try{d.mkdirSync(x,s),L||=x}catch{let Ki=d.lstatSync(x);if(Ki.isDirectory())continue;if(u){d.unlinkSync(x),d.mkdirSync(x,s),L||=x;continue}else if(Ki.isSymbolicLink())return new jt(x,x+"/"+w.join("/"))}}return g(L)},"Ni"),ui=Object.create(null),ws=1e4,ke=new Set,Uh=o(e=>{ke.has(e)?ke.delete(e):ui[e]=e.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),ke.add(e);let t=ui[e],i=ke.size-ws;if(i>ws/10){for(let s of ke)if(ke.delete(s),delete ui[s],--i<=0)break}return t},"Li"),jh=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",Hh=o(e=>e.split("/").slice(0,-1).reduce((t,i)=>{let s=t.at(-1);return s!==void 0&&(i=Ds(s,i)),t.push(i||"/"),t},[]),"zi"),Zh=class{static{f(this,"Mh")}static{o(this,"Bi")}#e=new Map;#i=new Map;#s=new Set;reserve(e,t){e=jh?["win32 parallelization disabled"]:e.map(s=>Je(Ds(Uh(s))));let i=new Set(e.map(s=>Hh(s)).reduce((s,r)=>s.concat(r)));this.#i.set(t,{dirs:i,paths:e});for(let s of e){let r=this.#e.get(s);r?r.push(t):this.#e.set(s,[t])}for(let s of i){let r=this.#e.get(s);if(!r)this.#e.set(s,[new Set([t])]);else{let h=r.at(-1);h instanceof Set?h.add(t):r.push(new Set([t]))}}return this.#r(t)}#h(e){let t=this.#i.get(e);if(!t)throw Error("function does not have any path reservations");return{paths:t.paths.map(i=>this.#e.get(i)),dirs:[...t.dirs].map(i=>this.#e.get(i))}}check(e){let{paths:t,dirs:i}=this.#h(e);return t.every(s=>s&&s[0]===e)&&i.every(s=>s&&s[0]instanceof Set&&s[0].has(e))}#r(e){return this.#s.has(e)||!this.check(e)?!1:(this.#s.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#s.has(e))return!1;let t=this.#i.get(e);if(!t)throw Error("invalid reservation");let{paths:i,dirs:s}=t,r=new Set;for(let h of i){let n=this.#e.get(h);if(!n||n?.[0]!==e)continue;let a=n[1];if(!a){this.#e.delete(h);continue}if(n.shift(),typeof a=="function")r.add(a);else for(let l of a)r.add(l)}for(let h of s){let n=this.#e.get(h),a=n?.[0];if(!(!n||!(a instanceof Set)))if(a.size===1&&n.length===1){this.#e.delete(h);continue}else if(a.size===1){n.shift();let l=n[0];typeof l=="function"&&r.add(l)}else a.delete(e)}return this.#s.delete(e),r.forEach(h=>this.#r(h)),!0}},Wh=o(()=>process.umask(),"Vi"),Rs=Symbol("onEntry"),Ni=Symbol("checkFs"),_s=Symbol("checkFs2"),Ii=Symbol("isReusable"),F=Symbol("makeFs"),Bi=Symbol("file"),Fi=Symbol("directory"),Nt=Symbol("link"),Ss=Symbol("symlink"),vs=Symbol("hardlink"),Xe=Symbol("ensureNoSymlink"),Os=Symbol("unsupported"),Ts=Symbol("checkPath"),fi=Symbol("stripAbsolutePath"),ne=Symbol("mkdir"),k=Symbol("onError"),Rt=Symbol("pending"),ks=Symbol("pend"),Le=Symbol("unpend"),ci=Symbol("ended"),mi=Symbol("maybeClose"),Ci=Symbol("skip"),Qe=Symbol("doChown"),et=Symbol("uid"),tt=Symbol("gid"),it=Symbol("checkedCwd"),st=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",Gh=1024,$h=o((e,t)=>{if(!st)return d.unlink(e,t);let i=e+".DELETE."+Is(16).toString("hex");d.rename(e,i,s=>{if(s)return t(s);d.unlink(i,t)})},"ma"),Yh=o(e=>{if(!st)return d.unlinkSync(e);let t=e+".DELETE."+Is(16).toString("hex");d.renameSync(e,t),d.unlinkSync(t)},"ha"),Ls=o((e,t,i)=>e!==void 0&&e===e>>>0?e:t!==void 0&&t===t>>>0?t:i,"ga"),Ft=class extends Ie{static{f(this,"Ni")}static{o(this,"_a")}[ci]=!1;[it]=!1;[Rt]=0;reservations=new Zh;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[ci]=!0,this[mi]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=e.preserveOwner===void 0&&typeof e.uid!="number"?!!(process.getuid&&process.getuid()===0):!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:Gh,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||st,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=c(p.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:Wh():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",t=>this[Rs](t))}warn(e,t,i={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(i.recoverable=!1),super.warn(e,t,i)}[mi](){this[ci]&&this[Rt]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[fi](e,t){let i=e[t],{type:s}=e;if(!i||this.preservePaths)return!0;let[r,h]=Gi(i),n=h.replaceAll(/\\/g,"/").split("/");if(n.includes("..")||st&&/^[a-z]:\.\.$/i.test(n[0]??"")){if(t==="path"||s==="Link")return this.warn("TAR_ENTRY_ERROR",`${t} contains '..'`,{entry:e,[t]:i}),!1;let a=p.posix.dirname(e.path),l=p.posix.normalize(p.posix.join(a,n.join("/")));if(l.startsWith("../")||l==="..")return this.warn("TAR_ENTRY_ERROR",`${t} escapes extraction directory`,{entry:e,[t]:i}),!1}return r&&(e[t]=String(h),this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute ${t}`,{entry:e,[t]:i})),!0}[Ts](e){let t=c(e.path),i=t.split("/");if(this.strip){if(i.length<this.strip)return!1;if(e.type==="Link"){let s=c(String(e.linkpath)).split("/");if(s.length>=this.strip)e.linkpath=s.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),e.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:t,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[fi](e,"path")||!this[fi](e,"linkpath"))return!1;if(e.absolute=p.isAbsolute(e.path)?c(p.resolve(e.path)):c(p.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:c(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:s}=p.win32.parse(String(e.absolute));e.absolute=s+ls(String(e.absolute).slice(s.length));let{root:r}=p.win32.parse(e.path);e.path=r+ls(e.path.slice(r.length))}return!0}[Rs](e){if(!this[Ts](e))return e.resume();switch(Rr.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode|=448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Ni](e);default:return this[Os](e)}}[k](e,t){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[Le](),t.resume())}[ne](e,t,i){Mh(c(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t},i)}[Qe](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[et](e){return Ls(this.uid,e.uid,this.processUid)}[tt](e){return Ls(this.gid,e.gid,this.processGid)}[Bi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=new Ct(String(e.absolute),{flags:rr(e.size),mode:i,autoClose:!1});s.on("error",a=>{s.fd&&d.close(s.fd,()=>{}),s.write=()=>!0,this[k](a,e),t()});let r=1,h=o(a=>{if(a){s.fd&&d.close(s.fd,()=>{}),this[k](a,e),t();return}--r===0&&s.fd!==void 0&&d.close(s.fd,l=>{l?this[k](l,e):this[Le](),t()})},"o");s.on("finish",()=>{let a=String(e.absolute),l=s.fd;if(typeof l=="number"&&e.mtime&&!this.noMtime){r++;let u=e.atime||new Date,m=e.mtime;d.futimes(l,u,m,g=>g?d.utimes(a,u,m,w=>h(w&&g)):h())}if(typeof l=="number"&&this[Qe](e)){r++;let u=this[et](e),m=this[tt](e);typeof u=="number"&&typeof m=="number"&&d.fchown(l,u,m,g=>g?d.chown(a,u,m,w=>h(w&&g)):h())}h()});let n=this.transform&&this.transform(e)||e;n!==e&&(n.on("error",a=>{this[k](a,e),t()}),e.pipe(n)),n.pipe(s)}[Fi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode;this[ne](String(e.absolute),i,s=>{if(s){this[k](s,e),t();return}let r=1,h=o(()=>{--r===0&&(t(),this[Le](),e.resume())},"a");e.mtime&&!this.noMtime&&(r++,d.utimes(String(e.absolute),e.atime||new Date,e.mtime,h)),this[Qe](e)&&(r++,d.chown(String(e.absolute),Number(this[et](e)),Number(this[tt](e)),h)),h()})}[Os](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[Ss](e,t){let i=c(p.relative(this.cwd,p.resolve(p.dirname(String(e.absolute)),String(e.linkpath)))).split("/");this[Xe](e,this.cwd,i,()=>this[Nt](e,String(e.linkpath),"symlink",t),s=>{this[k](s,e),t()})}[vs](e,t){let i=c(p.resolve(this.cwd,String(e.linkpath))),s=c(String(e.linkpath)).split("/");this[Xe](e,this.cwd,s,()=>this[Nt](e,i,"link",t),r=>{this[k](r,e),t()})}[Xe](e,t,i,s,r){let h=i.shift();if(this.preservePaths||h===void 0)return s();let n=p.resolve(t,h);d.lstat(n,(a,l)=>{if(a)return s();if(l?.isSymbolicLink())return r(new jt(n,p.resolve(n,i.join("/"))));this[Xe](e,n,i,s,r)})}[ks](){this[Rt]++}[Le](){this[Rt]--,this[mi]()}[Ci](e){this[Le](),e.resume()}[Ii](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&!st}[Ni](e){this[ks]();let t=[e.path];e.linkpath&&t.push(e.linkpath),this.reservations.reserve(t,i=>this[_s](e,i))}[_s](e,t){let i=o(n=>{t(n)},"r"),s=o(()=>{this[ne](this.cwd,this.dmode,n=>{if(n){this[k](n,e),i();return}this[it]=!0,r()})},"a"),r=o(()=>{if(e.absolute!==this.cwd){let n=c(p.dirname(String(e.absolute)));if(n!==this.cwd)return this[ne](n,this.dmode,a=>{if(a){this[k](a,e),i();return}h()})}h()},"o"),h=o(()=>{d.lstat(String(e.absolute),(n,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(e.mtime??a.mtime))){this[Ci](e),i();return}if(n||this[Ii](e,a))return this[F](null,e,i);if(a.isDirectory()){if(e.type==="Directory"){let l=this.chmod&&e.mode&&(a.mode&4095)!==e.mode,u=o(m=>this[F](m??null,e,i),"a");return l?d.chmod(String(e.absolute),Number(e.mode),u):u()}if(e.absolute!==this.cwd)return d.rmdir(String(e.absolute),l=>this[F](l??null,e,i))}if(e.absolute===this.cwd)return this[F](null,e,i);$h(String(e.absolute),l=>this[F](l??null,e,i))})},"s");this[it]?r():s()}[F](e,t,i){if(e){this[k](e,t),i();return}switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[Bi](t,i);case"Link":return this[vs](t,i);case"SymbolicLink":return this[Ss](t,i);case"Directory":case"GNUDumpDir":return this[Fi](t,i)}}[Nt](e,t,i,s){d[i](t,String(e.absolute),r=>{r?this[k](r,e):(this[Le](),e.resume()),s()})}},Ke=o(e=>{try{return[null,e()]}catch(t){return[t,null]}},"va"),Mi=class extends Ft{static{f(this,"Be")}static{o(this,"ya")}sync=!0;[F](e,t){return super[F](e,t,()=>{})}[Ni](e){if(!this[it]){let r=this[ne](this.cwd,this.dmode);if(r)return this[k](r,e);this[it]=!0}if(e.absolute!==this.cwd){let r=c(p.dirname(String(e.absolute)));if(r!==this.cwd){let h=this[ne](r,this.dmode);if(h)return this[k](h,e)}}let[t,i]=Ke(()=>d.lstatSync(String(e.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(e.mtime??i.mtime)))return this[Ci](e);if(t||this[Ii](e,i))return this[F](null,e);if(i.isDirectory()){if(e.type==="Directory"){let[h]=this.chmod&&e.mode&&(i.mode&4095)!==e.mode?Ke(()=>{d.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[F](h,e)}let[r]=Ke(()=>d.rmdirSync(String(e.absolute)));this[F](r,e)}let[s]=e.absolute===this.cwd?[]:Ke(()=>Yh(String(e.absolute)));this[F](s,e)}[Bi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.fmode,s=o(n=>{let a;try{d.closeSync(r)}catch(l){a=l}(n||a)&&this[k](n||a,e),t()},"i"),r;try{r=d.openSync(String(e.absolute),rr(e.size),i)}catch(n){return s(n)}let h=this.transform&&this.transform(e)||e;h!==e&&(h.on("error",n=>this[k](n,e)),e.pipe(h)),h.on("data",n=>{try{d.writeSync(r,n,0,n.length)}catch(a){s(a)}}),h.on("end",()=>{let n=null;if(e.mtime&&!this.noMtime){let a=e.atime||new Date,l=e.mtime;try{d.futimesSync(r,a,l)}catch(u){try{d.utimesSync(String(e.absolute),a,l)}catch{n=u}}}if(this[Qe](e)){let a=this[et](e),l=this[tt](e);try{d.fchownSync(r,Number(a),Number(l))}catch(u){try{d.chownSync(String(e.absolute),Number(a),Number(l))}catch{n||=u}}}s(n)})}[Fi](e,t){let i=typeof e.mode=="number"?e.mode&4095:this.dmode,s=this[ne](String(e.absolute),i);if(s){this[k](s,e),t();return}if(e.mtime&&!this.noMtime)try{d.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Qe](e))try{d.chownSync(String(e.absolute),Number(this[et](e)),Number(this[tt](e)))}catch{}t(),e.resume()}[ne](e,t){try{return zh(c(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:t})}catch(i){return i}}[Xe](e,t,i,s,r){if(this.preservePaths||i.length===0)return s();let h=t;for(let n of i){h=p.resolve(h,n);let[a,l]=Ke(()=>d.lstatSync(h));if(a)return s();if(l.isSymbolicLink())return r(new jt(h,p.resolve(t,i.join("/"))))}s()}[Nt](e,t,i,s){let r=`${i}Sync`;try{d[r](t,String(e.absolute)),s(),e.resume()}catch(h){return this[k](h,e)}}},xs=nt(e=>{let t=new Mi(e),i=e.file,s=d.statSync(i);new Cr(i,{readSize:e.maxReadSize||16*1024*1024,size:s.size}).pipe(t)},(e,t)=>{let i=new Ft(e),s=e.maxReadSize||16*1024*1024,r=e.file;return new Promise((h,n)=>{i.on("error",n),i.on("close",h),d.stat(r,(a,l)=>{if(a)n(a);else{let u=new zi(r,{readSize:s,size:l.size});u.on("error",n),u.pipe(i)}})})},e=>new Mi(e),e=>new Ft(e),(e,t)=>{t?.length&&Wi(e,t)}),Vh=o((e,t)=>{let i=new Ut(e),s=!0,r,h;try{try{r=d.openSync(e.file,"r+")}catch(l){if(l?.code==="ENOENT")r=d.openSync(e.file,"w+");else throw l}let n=d.fstatSync(r),a=Buffer.alloc(512);e:for(h=0;h<n.size;h+=512){for(let m=0,g=0;m<512;m+=g){if(g=d.readSync(r,a,m,a.length-m,h+m),h===0&&a[0]===31&&a[1]===139)throw Error("cannot append to compressed archives");if(!g)break e}let l=new le(a);if(!l.cksumValid)break;let u=512*Math.ceil((l.size||0)/512);if(h+u+512>n.size)break;h+=u,e.mtimeCache&&l.mtime&&e.mtimeCache.set(String(l.path),l.mtime)}s=!1,Kh(e,i,h,r,t)}finally{if(s)try{d.closeSync(r)}catch{}}},"xa"),Kh=o((e,t,i,s,r)=>{let h=new Fs(e.file,{fd:s,start:i});t.pipe(h),qh(t,r)},"Sa"),Xh=o((e,t)=>{t=Array.from(t);let i=new ot(e),s=o((r,h,n)=>{let a=o((w,L)=>{w?d.close(r,_=>n(w)):n(null,L)},"a"),l=0;if(h===0)return a(null,0);let u=0,m=Buffer.alloc(512),g=o((w,L)=>{if(w||L===void 0)return a(w);if(u+=L,u<512&&L)return d.read(r,m,u,m.length-u,l+u,g);if(l===0&&m[0]===31&&m[1]===139)return a(Error("cannot append to compressed archives"));if(u<512)return a(null,l);let _=new le(m);if(!_.cksumValid)return a(null,l);let x=512*Math.ceil((_.size??0)/512);if(l+x+512>h||(l+=x+512,l>=h))return a(null,l);e.mtimeCache&&_.mtime&&e.mtimeCache.set(String(_.path),_.mtime),u=0,d.read(r,m,0,512,l,g)},"l");d.read(r,m,0,512,l,g)},"i");return new Promise((r,h)=>{i.on("error",h);let n="r+",a=o((l,u)=>{if(l&&l.code==="ENOENT"&&n==="r+")return n="w+",d.open(e.file,n,a);if(l||!u)return h(l);d.fstat(u,(m,g)=>{if(m)return d.close(u,()=>h(m));s(u,g.size,(w,L)=>{if(w)return h(w);let _=new Ct(e.file,{fd:u,start:L});i.pipe(_),_.on("error",h),_.on("close",r),Jh(i,t)})})},"c");d.open(e.file,n,a)})},"Ca"),qh=o((e,t)=>{t.forEach(i=>{i.charAt(0)==="@"?Ce({file:p.resolve(e.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:o(s=>e.add(s),"onReadEntry")}):e.add(i)}),e.end()},"wa"),Jh=o(async(e,t)=>{for(let i of t)i.charAt(0)==="@"?await Ce({file:p.resolve(String(e.cwd),i.slice(1)),noResume:!0,onReadEntry:o(s=>e.add(s),"onReadEntry")}):e.add(i);e.end()},"Ta"),ge=nt(Vh,Xh,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(e,t)=>{if(!Hr(e))throw TypeError("file is required");if(e.gzip||e.brotli||e.zstd||e.file.endsWith(".br")||e.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!t?.length)throw TypeError("no paths specified to add/replace")});nt(ge.syncFile,ge.asyncFile,ge.syncNoFile,ge.asyncNoFile,(e,t=[])=>{ge.validate?.(e,t),Qh(e)});var Qh=o(e=>{let t=e.filter;e.mtimeCache||=new Map,e.filter=t?(i,s)=>t(i,s)&&!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(i,s)=>!((e.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0))},"Da");export{rn as t};
@@ -0,0 +1,67 @@
1
+ var R=Object.defineProperty;var y=(e,r)=>R(e,"name",{value:r,configurable:!0});import{runProvider as E,PROVIDER_NAMES as T,detectProvider as j,detectAvailableProviders as N}from"@visulima/find-ai-runner";import{renderToString as C,Box as I,Text as g,Table as L}from"@visulima/tui";import d from"react";import{k as x,T as M,R as P,j as O}from"./ai-cache-DoiF80AR.js";var q=Object.defineProperty,w=y((e,r)=>q(e,"name",{value:r,configurable:!0}),"i");const B=12e4,J=2,z=1e3,F=w(e=>new Promise(r=>{setTimeout(r,e)}),"sleep"),b=w(async(e,r,i=J)=>{let t;for(let a=0;a<=i;a+=1)try{return(await E(e,r,{timeoutMs:B})).stdout}catch(n){if(t=n instanceof Error?n:new Error(String(n)),t.message.includes("timed out"))throw t;if(a<i){const s=z*2**a;await F(s)}}throw t??new Error("AI request failed after retries")},"runWithRetry");var V=Object.defineProperty,c=y((e,r)=>V(e,"name",{value:r,configurable:!0}),"c");const _={amp:30,claude:80,codex:60,copilot:50,crush:35,cursor:40,droid:20,gemini:100,kimi:25,opencode:35,qwen:30},D=c(e=>{if(e?.provider){if(!T.includes(e.provider))return;const t=j(e.provider);return t.available?t:void 0}const r=N();if(r.length===0)return;const i={..._,...e?.priority};return r.toSorted((t,a)=>(i[a.name]??0)-(i[t.name]??0))[0]},"resolveProvider"),U=new Set(["defer","review","skip","update"]),W=new Set(["critical","high","low","medium"]),Y=new Set(["high","low","medium"]),K=50,f=30,G=c(e=>e.map(r=>{const i=r.vulnerabilities&&r.vulnerabilities.length>0?` [VULNERABILITIES: ${r.vulnerabilities.map(a=>`${a.severity} ${a.id}`).join(", ")}]`:"";let t="";if(r.socketReport){const a=Math.round(r.socketReport.score.overall*100),n=[`score:${String(a)}%`];if(r.socketReport.alerts.length>0){const s={};for(const o of r.socketReport.alerts)s[o.severity]=(s[o.severity]??0)+1;const u=Object.entries(s).map(([o,l])=>`${String(l)} ${o}`).join(", ");n.push(`alerts: ${u}`)}n.push(`supply-chain:${String(Math.round(r.socketReport.score.supplyChain*100))}%`),n.push(`quality:${String(Math.round(r.socketReport.score.quality*100))}%`),t=` [SOCKET.DEV: ${n.join(", ")}]`}return`- ${r.packageName}: ${r.currentRange} → ${r.newRange} (${r.updateType})${i}${t}`}).join(`
2
+ `),"buildPackageList"),h=`Respond ONLY with valid JSON in this exact structure:
3
+ {
4
+ "summary": "Brief overall summary",
5
+ "recommendations": [
6
+ {
7
+ "package": "package-name",
8
+ "action": "update|skip|review|defer",
9
+ "reason": "explanation",
10
+ "riskLevel": "low|medium|high|critical",
11
+ "breakingChanges": ["change1"],
12
+ "effort": "low|medium|high"
13
+ }
14
+ ],
15
+ "warnings": ["warning1"]
16
+ }`,X={compatibility:c(e=>`Analyze the compatibility of these package updates:
17
+
18
+ ${e}
19
+
20
+ For each package:
21
+ 1. Check peer dependency compatibility
22
+ 2. Identify potential conflicts with other packages in the list
23
+ 3. Assess API compatibility between current and target versions
24
+ 4. Check for deprecated features being removed
25
+ 5. Evaluate Node.js version requirements
26
+
27
+ ${h}`,"compatibility"),impact:c(e=>`Analyze the impact of updating these npm packages:
28
+
29
+ ${e}
30
+
31
+ For each package, provide:
32
+ 1. Risk level (low/medium/high/critical)
33
+ 2. Recommended action (update/skip/review/defer)
34
+ 3. Reason for recommendation
35
+ 4. Known breaking changes (if any)
36
+ 5. Estimated migration effort (low/medium/high)
37
+
38
+ ${h}`,"impact"),recommend:c(e=>`Provide smart recommendations for updating these packages:
39
+
40
+ ${e}
41
+
42
+ Consider:
43
+ 1. Update priority based on security, features, and stability
44
+ 2. Grouping related packages for atomic updates
45
+ 3. Best practices for the specific package ecosystem
46
+ 4. Risk vs. benefit analysis
47
+ 5. Suggested update order
48
+ 6. If Socket.dev scores are provided, prioritize packages with low supply chain or quality scores
49
+
50
+ ${h}`,"recommend"),security:c(e=>`Analyze the security implications of these package updates:
51
+
52
+ ${e}
53
+
54
+ For each package:
55
+ 1. Check if the update fixes known vulnerabilities (use the vulnerability data above)
56
+ 2. Assess if the new version introduces security risks
57
+ 3. Evaluate if this is a security-sensitive package (auth, crypto, session, etc.)
58
+ 4. Recommend urgency of the update based on vulnerability severity
59
+ 5. Flag any packages where skipping the update poses security risk
60
+ 6. If Socket.dev scores are provided, factor in supply chain and quality scores — low scores indicate higher risk
61
+
62
+ ${h}`,"security")},H=new Set(["compatibility","impact","recommend","security"]),ue=c(e=>H.has(e)?e:"impact","validateAnalysisType"),S=c((e,r="impact")=>{const i=G(e);return X[r](i)},"buildAnalysisPrompt"),Z=/```(?:json)?\s*([\s\S]*?)```/,Q=/\{[\s\S]*\}/,ee=c(e=>{try{return JSON.parse(e)}catch{}const r=Z.exec(e);if(r?.[1])try{return JSON.parse(r[1])}catch{}const i=Q.exec(e);if(i?.[0])try{return JSON.parse(i[0])}catch{}},"extractJson"),re=c(e=>({action:U.has(e.action)?e.action:"review",breakingChanges:Array.isArray(e.breakingChanges)?e.breakingChanges:[],effort:Y.has(e.effort)?e.effort:"medium",package:typeof e.package=="string"?e.package:"",reason:typeof e.reason=="string"?e.reason:"",riskLevel:W.has(e.riskLevel)?e.riskLevel:"medium"}),"normalizeRecommendation"),$=c((e,r,i)=>{const t=ee(e);if(!t||typeof t!="object")return{analysisType:i,provider:r,recommendations:[],summary:"Failed to parse AI response.",warnings:["AI response was not valid JSON."]};const a=t,n=Array.isArray(a.recommendations)?a.recommendations:[];return{analysisType:i,provider:r,recommendations:n.map(s=>re(s)),summary:typeof a.summary=="string"?a.summary:"",warnings:Array.isArray(a.warnings)?a.warnings:[]}},"parseAiResponse"),te={eslint:["ESLint 9.0: Flat config required","ESLint 8.0+: New rule formats"],next:["Next.js 13+: App router changes","Next.js 14+: Server components default"],react:["React 17 to 18: Concurrent features","React 18+: Strict mode changes"],typescript:["TypeScript 5.0: New decorators","TypeScript 4.7+: ESM changes"],vite:["Vite 5: Node.js 18+ required"],vue:["Vue 3: Composition API","Vue 3: Breaking template changes"],webpack:["Webpack 5: Node.js polyfills removed"]},ae=new Set(["bcrypt","cors","crypto-js","express-session","helmet","jose","jsonwebtoken","node-forge","oauth","passport"]),v=c((e,r)=>{const i=e.map(t=>{const a=t.vulnerabilities&&t.vulnerabilities.length>0,n=ae.has(t.packageName),s=te[t.packageName]??[];let u="low",o="update",l="low",m="Patch/minor update, safe to apply.";return t.updateType==="major"?(u="high",o=s.length>0?"review":"update",l="medium",m=s.length>0?`Major update with known breaking changes: ${s[0]}`:"Major version update, review changelog before applying."):t.updateType==="minor"&&(u="medium",m="Minor update, generally safe."),a&&(u="high",o="update",m="Security update — current version has known vulnerabilities."),n&&t.updateType==="major"&&(o="review",m="Security-sensitive package with major update, careful review needed.",l="high"),{action:o,breakingChanges:s,effort:l,package:t.packageName,reason:m,riskLevel:u}});return{analysisType:r,provider:"rule-engine",recommendations:i,summary:`Rule-based ${r} analysis for ${String(e.length)} packages.`,warnings:["No AI provider available — using built-in rule engine."]}},"ruleBasedAnalysis"),ie=c(async(e,r,i)=>{const t=S(r,i),a=await b(e,t);return $(a,e.name,i)},"analyzeChunk"),ne=c((e,r,i)=>{const t=[],a=[],n=[];for(const s of e)t.push(...s.recommendations),a.push(...s.warnings),s.summary&&n.push(s.summary);return{analysisType:i,provider:r,recommendations:t,summary:n.length===1?n[0]??"":`Analyzed ${String(t.length)} packages in ${String(e.length)} batches.`,warnings:[...new Set(a)]}},"mergeResults"),A={compatibility:"Compatibility",impact:"Impact",recommend:"Recommendations",security:"Security"},me=c(e=>{const r=`${A[e.analysisType]??e.analysisType} Analysis (${e.provider})`,i=e.recommendations.flatMap(a=>{const n=[{action:a.action,effort:a.effort,package:a.package,reason:a.reason,risk:a.riskLevel}];return a.breakingChanges.length>0&&n.push({action:"",effort:"",package:"",reason:`Breaking: ${a.breakingChanges.join("; ")}`,risk:""}),n}),t=process.stdout.columns||80;return C(d.createElement(I,{borderStyle:"round",flexDirection:"column",paddingLeft:1,paddingRight:1},d.createElement(g,{bold:!0},r),d.createElement(g,null,""),d.createElement(g,null,e.summary),d.createElement(g,null,""),d.createElement(L,{borderStyle:"none",data:i}),...e.warnings.length>0?[d.createElement(g,null,""),...e.warnings.map((a,n)=>d.createElement(g,{dimColor:!0,key:String(n)},` ${a}`))]:[]),{columns:t})},"formatAiAnalysis");c(e=>JSON.stringify(e,void 0,2),"formatAiAnalysisJson");const de=c(async(e,r,i,t="impact")=>{const a=D(i);if(!a)return r.info(`No AI CLI tool found, using rule-based analysis.
63
+ `),v(e,t);const n=x(a.name,t,e),s=M(n);if(s)return r.info(`Using cached ${t} analysis from ${s.provider}.
64
+ `),s;const u=A[t]??t;r.info(`Running ${u.toLowerCase()} analysis with ${a.name}...
65
+ `);try{let o;if(e.length>K){r.info(`Splitting ${String(e.length)} packages into batches of ${String(f)}...
66
+ `);const l=[];for(let p=0;p<e.length;p+=f)l.push(e.slice(p,p+f));const m=[];for(let p=0;p<l.length;p+=1){r.info(` Batch ${String(p+1)}/${String(l.length)}...`);const k=l[p];k&&m.push(await ie(a,k,t))}o=ne(m,a.name,t)}else{const l=await b(a,S(e,t));o=$(l,a.name,t)}return P(n,o,O(t,i?.cacheTtl)),o}catch(o){const l=o instanceof Error?o.message:String(o);return r.warn(`AI analysis failed (${l}), falling back to rule engine.
67
+ `),v(e,t)}},"runAiAnalysis");export{ue as H,_ as R,me as Z,D as b,de as e,b as r,ee as w};
@@ -1 +1 @@
1
- var _=Object.defineProperty;var m=(t,e)=>_(t,"name",{value:e,configurable:!0});import{createRequire as b}from"node:module";import{X as v}from"./xxh3-DrAUNq4n.js";import{ensureDirSync as J,isAccessibleSync as d,readJsonSync as j}from"@visulima/fs";import{join as c}from"@visulima/path";const w=b(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=m(t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,r]=u.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return u.getBuiltinModule(t)}return w(t)},"__cjs_getBuiltinModule"),{rmSync:f,writeFileSync:p,readdirSync:S,statSync:A}=h("node:fs"),{homedir:D}=h("node:os");var M=Object.defineProperty,n=m((t,e)=>M(t,"name",{value:e,configurable:!0}),"r");const a=n(()=>c(D(),".vis","cache","ai"),"getCacheDirectory"),B=3600*1e3,N=1800*1e3,C=n(()=>{J(a())},"ensureCacheDirectory"),k=n((t,e,r)=>{const s=r.map(i=>({currentRange:i.currentRange,name:i.packageName,targetVersion:i.targetVersion})).toSorted((i,y)=>i.name.localeCompare(y.name)),o=JSON.stringify({analysisType:e,packages:s,provider:t});return v(Buffer.from(o))},"buildCacheKey"),q=n(t=>{const e=c(a(),`${t}.json`);if(d(e))try{const r=j(e);if(Date.now()-r.createdAt>r.ttlMs){f(e,{force:!0});return}return r.result}catch{f(e,{force:!0});return}},"getCachedAnalysis"),z=n((t,e,r)=>{C();const s=a(),o={createdAt:Date.now(),result:e,ttlMs:r};p(c(s,`${t}.json`),JSON.stringify(o,void 0,2),"utf8")},"setCachedAnalysis"),F=n((t,e)=>e!==void 0&&e>0?e:t==="security"?N:B,"getTtlForAnalysisType"),K=n(()=>{const t=a();if(!d(t))return{entries:0,newestEntry:void 0,oldestEntry:void 0,totalSizeBytes:0};const e=S(t).filter(i=>i.endsWith(".json"));let r=0,s,o;for(const i of e){const y=c(t,i),g=A(y);r+=g.size;const{mtimeMs:l}=g;(s===void 0||l<s)&&(s=l),(o===void 0||l>o)&&(o=l)}return{entries:e.length,newestEntry:o,oldestEntry:s,totalSizeBytes:r}},"getCacheStats"),P=n(t=>v(Buffer.from(JSON.stringify(t))),"buildHashCacheKey"),V=n(t=>{const e=c(a(),`${t}.json`);if(d(e))try{const r=j(e);if(Date.now()-r.createdAt>r.ttlMs){f(e,{force:!0});return}return r.result}catch{f(e,{force:!0});return}},"getCachedJson"),W=n((t,e,r)=>{C();const s=a(),o={createdAt:Date.now(),result:e,ttlMs:r};p(c(s,`${t}.json`),JSON.stringify(o,void 0,2),"utf8")},"setCachedJson"),x=n(()=>{const t=a();if(!d(t))return 0;const e=S(t).filter(r=>r.endsWith(".json"));for(const r of e)f(c(t,r),{force:!0});return e.length},"clearCache");export{x as B,k as D,K as J,P as M,V as N,W as O,q as R,z as j,F as k};
1
+ var _=Object.defineProperty;var m=(t,e)=>_(t,"name",{value:e,configurable:!0});import{createRequire as b}from"node:module";import{X as v}from"./xxh3-DrAUNq4n.js";import{ensureDirSync as M,isAccessibleSync as d,readJsonSync as j}from"@visulima/fs";import{join as c}from"@visulima/path";const A=b(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=m(t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,r]=u.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return u.getBuiltinModule(t)}return A(t)},"__cjs_getBuiltinModule"),{rmSync:f,writeFileSync:p,readdirSync:S,statSync:D}=h("node:fs"),{homedir:J}=h("node:os");var w=Object.defineProperty,n=m((t,e)=>w(t,"name",{value:e,configurable:!0}),"r");const a=n(()=>c(J(),".vis","cache","ai"),"getCacheDirectory"),B=3600*1e3,N=1800*1e3,C=n(()=>{M(a())},"ensureCacheDirectory"),k=n((t,e,r)=>{const s=r.map(i=>({currentRange:i.currentRange,name:i.packageName,targetVersion:i.targetVersion})).toSorted((i,y)=>i.name.localeCompare(y.name)),o=JSON.stringify({analysisType:e,packages:s,provider:t});return v(Buffer.from(o))},"buildCacheKey"),q=n(t=>{const e=c(a(),`${t}.json`);if(d(e))try{const r=j(e);if(Date.now()-r.createdAt>r.ttlMs){f(e,{force:!0});return}return r.result}catch{f(e,{force:!0});return}},"getCachedAnalysis"),z=n((t,e,r)=>{C();const s=a(),o={createdAt:Date.now(),result:e,ttlMs:r};p(c(s,`${t}.json`),JSON.stringify(o,void 0,2),"utf8")},"setCachedAnalysis"),F=n((t,e)=>e!==void 0&&e>0?e:t==="security"?N:B,"getTtlForAnalysisType"),K=n(()=>{const t=a();if(!d(t))return{entries:0,newestEntry:void 0,oldestEntry:void 0,totalSizeBytes:0};const e=S(t).filter(i=>i.endsWith(".json"));let r=0,s,o;for(const i of e){const y=c(t,i),g=D(y);r+=g.size;const{mtimeMs:l}=g;(s===void 0||l<s)&&(s=l),(o===void 0||l>o)&&(o=l)}return{entries:e.length,newestEntry:o,oldestEntry:s,totalSizeBytes:r}},"getCacheStats"),P=n(t=>v(Buffer.from(JSON.stringify(t))),"buildHashCacheKey"),V=n(t=>{const e=c(a(),`${t}.json`);if(d(e))try{const r=j(e);if(Date.now()-r.createdAt>r.ttlMs){f(e,{force:!0});return}return r.result}catch{f(e,{force:!0});return}},"getCachedJson"),W=n((t,e,r)=>{C();const s=a(),o={createdAt:Date.now(),result:e,ttlMs:r};p(c(s,`${t}.json`),JSON.stringify(o,void 0,2),"utf8")},"setCachedJson"),x=n(()=>{const t=a();if(!d(t))return 0;const e=S(t).filter(r=>r.endsWith(".json"));for(const r of e)f(c(t,r),{force:!0});return e.length},"clearCache");export{x as B,K as J,P as M,V as N,W as O,z as R,q as T,F as j,k};
@@ -0,0 +1,43 @@
1
+ var F=Object.defineProperty;var f=(e,t)=>F(e,"name",{value:t,configurable:!0});import{createRequire as I}from"node:module";import{readLastRunSummary as j}from"@visulima/task-runner";import{a as C}from"./failure-log-iUVLf6ts.js";import{r as k,f as y,a as D,d as _}from"./run-summary-utils-BfBvjzhY.js";import{isAbsolute as P,resolve as b,join as R,relative as E}from"@visulima/path";import{w as M,b as B,r as H}from"./ai-analysis-hm8d2W7z.js";import{M as q,N as W,O as L}from"./ai-cache-DoiF80AR.js";const O=I(import.meta.url),d=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=f(e=>{if(typeof d<"u"&&d.versions&&d.versions.node){const[t,a]=d.versions.node.split(".").map(Number);if(t>22||t===22&&a>=3||t===20&&a>=16)return d.getBuiltinModule(e)}return O(e)},"__cjs_getBuiltinModule"),{readFile:N,writeFile:A}=T("node:fs/promises");var Y=Object.defineProperty,m=f((e,t)=>Y(e,"name",{value:t,configurable:!0}),"u");const J=32*1024,K=m((e,t)=>{if(e.length<=t)return e;const a=e.slice(-t),o=e.length-a.length;return`[…${String(o)} bytes truncated from head…]
2
+ ${a}`},"truncateHead"),U=m(async(e,t)=>t===void 0?j(e):k(e,t),"loadSummary"),ge=m(async(e,t,a={})=>{const o=a.terminalOutputLimit??J,[r,n]=await Promise.all([C(e,t),U(e,a.runId)]),i=n?y(n,t):void 0;if(!r&&!i)return;let s,c;if(n&&i){const h=await D(e,n.id),g=h?y(h,t):void 0;s=_(i.hashDetails,g?.hashDetails),c=h?.id}const l=r?.terminalOutput??"";return{command:r?.command??void 0,cwd:r?.cwd??void 0,dependencies:i?.dependencies??[],duration:i?.duration,exitCode:r?.exitCode??i?.exitCode,hash:i?.hash??r?.hash,hashDetails:i?.hashDetails,hashDiff:s,previousRunId:c,project:i?.target.project,runId:n?.id??r?.runId,status:r?.status??(i?z(i):void 0),target:i?.target.target,taskId:t,terminalOutput:K(l,o),terminalOutputCaptured:!!r,timestamp:r?.timestamp??i?.endTime??i?.startTime}},"aggregateFailureContext"),z=m(e=>{if(e.exitCode!==void 0&&e.exitCode!==0)return"failure";switch(e.cacheStatus){case"HIT":return"local-cache";case"REMOTE_HIT":return"remote-cache";case"SKIPPED":return"skipped";default:return e.exitCode===0?"success":void 0}},"mapCacheStatusToTaskStatus");var G=Object.defineProperty,u=f((e,t)=>G(e,"name",{value:t,configurable:!0}),"a");const Q=3600*1e3,S=80,V=new Set(["high","low","medium"]),X=u(()=>`You are an expert software engineer helping fix a failing build/test/lint task.
3
+
4
+ You will be given:
5
+ - The terminal output (stdout/stderr) from the failed task.
6
+ - Optional metadata: command, working directory, project, task hash, and a diff describing what changed in the task's hash inputs since the previous run that did not fail.
7
+
8
+ Your job:
9
+ 1. Identify the root cause from the terminal output.
10
+ 2. Propose a minimal set of source-file patches that fix the cause.
11
+ 3. If you cannot determine a safe fix, set "cannotFix" with a clear, actionable explanation.
12
+
13
+ Constraints:
14
+ - Patches MUST be exact string replacements. The "oldString" must appear verbatim in the named file. Paths are relative to the working directory.
15
+ - Each "oldString" must be unique within its file. Include surrounding context so the match is unambiguous.
16
+ - Do NOT include unrelated cleanup, formatting changes, or speculative refactors.
17
+ - If the failure is environmental (missing tool, network) or requires running commands, prefer "cannotFix" over a guess.
18
+ - Keep "explanation" short (1-3 sentences). Reserve "reason" on each patch for why that specific edit fixes the cause.
19
+
20
+ Respond ONLY with valid JSON in this exact structure:
21
+ {
22
+ "explanation": "Brief root-cause analysis and what the fix does.",
23
+ "confidence": "low|medium|high",
24
+ "patches": [
25
+ {
26
+ "file": "path/relative/to/cwd.ts",
27
+ "oldString": "exact text to find",
28
+ "newString": "exact replacement text",
29
+ "reason": "why this change fixes it"
30
+ }
31
+ ],
32
+ "cannotFix": "optional — set when no safe patch can be proposed"
33
+ }`,"buildSystemPrompt"),v=u((e,t)=>{const a=[];if(t.added.length>0&&a.push(` added: ${t.added.join(", ")}`),t.changed.length>0&&a.push(` changed: ${t.changed.join(", ")}`),t.removed.length>0&&a.push(` removed: ${t.removed.join(", ")}`),a.length!==0)return`- ${e}:
34
+ ${a.join(`
35
+ `)}`},"formatBucket"),Z=u(e=>{if(!e.hashDiff)return"No hash-diff available — there is no previous run to compare against.";const t=[];e.hashDiff.commandChanged&&t.push("- command line changed since previous run");const a=v("file inputs",e.hashDiff.nodes),o=v("implicit deps",e.hashDiff.implicitDeps),r=v("runtime/env",e.hashDiff.runtime);return a&&t.push(a),o&&t.push(o),r&&t.push(r),t.length===0?"No detectable changes between this run and the previous run.":t.join(`
36
+ `)},"buildHashDiffSummary"),ee=u(e=>{const t=[`Task: ${e.taskId}`];return e.project&&t.push(`Project: ${e.project}`),e.target&&t.push(`Target: ${e.target}`),e.command&&t.push(`Command: ${e.command}`),e.cwd&&t.push(`CWD: ${e.cwd}`),e.exitCode!==void 0&&t.push(`Exit code: ${String(e.exitCode)}`),e.hash&&t.push(`Task hash: ${e.hash}`),t.push("","Hash-diff since previous run:",Z(e),""),e.terminalOutputCaptured?t.push("Terminal output:","```",e.terminalOutput,"```"):t.push("Terminal output: <no failure log was captured for this task>",'Set "cannotFix" and tell the user to re-run with `vis run` so logs can be captured.'),t.join(`
37
+ `)},"buildUserPrompt"),te=u(e=>`${X()}
38
+
39
+ ${ee(e)}`,"buildFixPrompt"),ae=u((e,t)=>{const a=Array.isArray(e.patches)?e.patches:[],o=[];for(const n of a)typeof n.file!="string"||n.file.length===0||typeof n.oldString!="string"||n.oldString.length===0||typeof n.newString=="string"&&o.push({file:n.file,newString:n.newString,oldString:n.oldString,reason:typeof n.reason=="string"&&n.reason.length>0?n.reason:void 0});const r=typeof e.cannotFix=="string"&&e.cannotFix.length>0?e.cannotFix:void 0;return{cannotFix:r,confidence:V.has(e.confidence)?e.confidence:"low",explanation:typeof e.explanation=="string"?e.explanation:"",patches:r?[]:o,provider:t}},"normalizeFixProposal"),ie=u((e,t)=>{const a=M(e);return!a||typeof a!="object"?{cannotFix:"AI response was not valid JSON.",confidence:"low",explanation:"Failed to parse AI response.",patches:[],provider:t}:ae(a,t)},"parseFixResponse"),ne=u((e,t)=>q({cwd:t.cwd??null,flow:"ai-fix",hash:t.hash??null,provider:e,taskId:t.taskId,terminalOutput:t.terminalOutput,terminalOutputCaptured:t.terminalOutputCaptured}),"buildFixCacheKey"),ve=u(async(e,t,a={})=>{const o=B(a.config);if(!o){t.warn(`No AI provider available — install one of: claude, gemini, copilot, codex.
40
+ `);return}const r=a.cache!==!1,n=ne(o.name,e);if(r){const i=W(n);if(i)return t.info(`Using cached fix proposal from ${i.provider}.
41
+ `),i}t.info(`Generating fix proposal with ${o.name}...
42
+ `);try{const i=await H(o,te(e)),s=ie(i,o.name);return r&&s.patches.length>0&&!s.cannotFix&&L(n,s,Q),s}catch(i){const s=i instanceof Error?i.message:String(i);t.warn(`AI fix proposal failed (${s}).
43
+ `);return}},"runFixAnalysis"),re=u((e,t,a)=>P(a)?b(a):b(R(t??e,a)),"resolvePatchPath"),se=u((e,t)=>{const a=E(e,t);return a===""?!0:!a.startsWith("..")&&!P(a)},"isInsideWorkspace"),oe=u((e,t,a)=>{const o=e.indexOf(t),r=Math.max(0,o-S),n=Math.min(e.length,o+t.length+S),i=e.slice(r,n);return{previewAfter:`${e.slice(r,o)}${a}${e.slice(o+t.length,n)}`,previewBefore:i}},"buildPreview"),xe=u(async(e,t,a,o={})=>{const r=o.dryRun===!0,n=new Map,i=[];for(const s of a.patches){const c=re(e,t,s.file);if(!se(e,c)){i.push({absolutePath:c,patch:s,status:"outside-workspace"});continue}let l=n.get(c);if(l===void 0){try{l=await N(c,"utf8")}catch(p){const w=p.code;i.push({absolutePath:c,error:w==="ENOENT"?void 0:p.message,patch:s,status:w==="ENOENT"?"missing-file":"error"});continue}n.set(c,l)}const h=l.indexOf(s.oldString);if(h===-1){i.push({absolutePath:c,patch:s,status:"no-match"});continue}if(l.indexOf(s.oldString,h+s.oldString.length)!==-1){i.push({absolutePath:c,patch:s,status:"ambiguous-match"});continue}const{previewAfter:g,previewBefore:$}=oe(l,s.oldString,s.newString),x=`${l.slice(0,h)}${s.newString}${l.slice(h+s.oldString.length)}`;if(!r)try{await A(c,x,"utf8")}catch(p){n.delete(c),i.push({absolutePath:c,error:p.message,patch:s,status:"error"});continue}n.set(c,x),i.push({absolutePath:c,patch:s,previewAfter:g,previewBefore:$,status:"applied"})}return i},"applyFixProposal");export{ge as a,ve as b,xe as c,re as r};
@@ -0,0 +1 @@
1
+ var h=Object.defineProperty;var l=(e,r)=>h(e,"name",{value:r,configurable:!0});import{createRequire as d}from"node:module";import{isAbsolute as p,resolve as a,relative as m}from"@visulima/path";import{DEFAULT_CACHE_DIRECTORY_NAME as u,getMainWorktreeRoot as v}from"@visulima/task-runner";const f=d(import.meta.url),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=l(e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[r,t]=i.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return i.getBuiltinModule(e)}return f(e)},"__cjs_getBuiltinModule"),{execFileSync:_}=g("node:child_process");var C=Object.defineProperty,s=l((e,r)=>C(e,"name",{value:r,configurable:!0}),"s");const y=s((e,r,t)=>{const n=s(c=>p(c)?c:a(e,c),"normalize");if(r&&r.length>0)return n(r);if(t&&t.length>0)return n(t);const o=process.env.VIS_CACHE_DIRECTORY;return o&&o.length>0?n(o):a(e,u)},"resolveCacheDirectory"),E=s((e,r)=>r===!1?e:v(e)??e,"resolveSharedCacheRoot"),I=s((e,r,t,n)=>{const o=r??t??process.env.VIS_CACHE_DIRECTORY;if(o&&o.length>0)return y(e,r,t);const c=E(e,n);return a(c,u)},"resolveSharedCacheDirectory"),R=/[^\w.-]+/g,b=/^-+|-+$/g,A=s(e=>e.trim().replaceAll(R,"-").replaceAll(b,"").slice(0,64),"sanitizeBranchSegment"),S=s(e=>{try{const r=_("git",["rev-parse","--abbrev-ref","HEAD"],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return!r||r==="HEAD"?void 0:r}catch{return}},"detectGitBranch"),H=s((e,r,t)=>{if(t!==!0)return e;const n=S(r);if(!n)return e;const o=A(n);return o.length===0?e:a(e,"branches",o)},"applyBranchScope"),M=s((e,r)=>{const t=m(r,e);return t.length===0?!1:t!==".."&&!t.startsWith("../")&&!p(t)},"isCacheDirectoryInsideWorkspace");export{I as E,H as a,M as m};
@@ -0,0 +1,2 @@
1
+ var $=Object.defineProperty;var b=(t,e)=>$(t,"name",{value:e,configurable:!0});import{yellow as O,dim as w,green as R,red as A}from"@visulima/colorize";import{Box as h,Text as d,Spinner as E,render as M}from"@visulima/tui";import{ah as g,s as Y}from"../packem_chunks/bin.js";import k from"react";import{jsx as i,jsxs as v}from"react/jsx-runtime";import{D as S,W as B,T as F,C as G}from"./symbols-CQmER5MT.js";import{readFileSync as D}from"@visulima/fs";import{parseLockFileContent as P}from"@visulima/package";import{join as T}from"@visulima/path";var I=Object.defineProperty,L=b((t,e)=>I(t,"name",{value:e,configurable:!0}),"l$1");const C=L(({rows:t})=>i(h,{flexDirection:"column",children:t.map(e=>{let r;switch(e.status){case"error":{r=i(d,{color:"red",children:G});break}case"ok":{r=i(d,{color:"green",children:F});break}case"running":{r=i(d,{color:"white",children:i(E,{type:"dots"})});break}case"warn":{r=i(d,{color:"yellow",children:B});break}default:{r=i(d,{dimColor:!0,children:S});break}}return v(h,{children:[i(h,{width:3,children:r}),i(h,{flexGrow:1,children:i(d,{children:e.label})}),e.summary?i(h,{children:v(d,{dimColor:!0,children:[S," ",e.summary]})}):null]},e.id)})}),"ScanProgressApp");var N=Object.defineProperty,l=b((t,e)=>N(t,"name",{value:e,configurable:!0}),"e");const W={error:A(g.failure),ok:R(g.success),pending:w(g.dash),skip:w(g.dash),warn:O(g.warning)},z=l((t,e,r)=>{const m=r?`${t} ${w(`— ${r}`)}`:t;return` ${W[e]} ${m}
2
+ `},"formatStaticRow"),re=l((t,e={})=>{const r=e.stream??process.stderr,m=typeof r.isTTY=="boolean"&&r.isTTY&&!Y,u=e.live??m,n=new Map;for(const o of t)n.set(o.id,{id:o.id,label:o.label,status:"pending"});if(!u||t.length===0)return{finish:l((o,c,y)=>{const f=n.get(o);f&&(n.set(o,{...f,status:c,summary:y}),r.write(z(f.label,c,y)))},"finish"),start:l(o=>{const c=n.get(o);c&&n.set(o,{...c,status:"running"})},"start"),stop:l(()=>{},"stop")};const p=l(()=>t.map(o=>n.get(o.id)),"buildRows");let s=M(k.createElement(C,{rows:p()}),{interactive:!0,patchConsole:!1});const a=l(()=>{s?.rerender(k.createElement(C,{rows:p()}))},"rerender");return{finish:l((o,c,y)=>{const f=n.get(o);f&&(n.set(o,{...f,status:c,summary:y}),a())},"finish"),start:l(o=>{const c=n.get(o);c&&(n.set(o,{...c,status:"running"}),a())},"start"),stop:l(()=>{s&&(a(),s.unmount(),s=void 0)},"stop")}},"startScanProgress");var H=Object.defineProperty,j=b((t,e)=>H(t,"name",{value:e,configurable:!0}),"l");const x={bun:{file:"bun.lock",type:"bun"},npm:{file:"package-lock.json",type:"npm"},pnpm:{file:"pnpm-lock.yaml",type:"pnpm"},yarn:{file:"yarn.lock",type:"yarn"}},te=j((t,e)=>{const r=x[e];if(!r)return[];let m;try{m=D(T(t,r.file))}catch{return[]}const u=P(m,r.type);if(u.length===0)return[];const n=new Set,p=[];for(const s of u){const a=`${s.name}@${s.version}`;n.has(a)||(n.add(a),p.push({isDev:!1,name:s.name,version:s.version}))}return p},"lockedPackages"),ne=j((t,e)=>{const r=x[e];if(!r)return[];let m;try{m=D(T(t,r.file))}catch{return[]}const u=P(m,r.type);if(u.length===0)return[];const n=new Map;for(const s of u)n.has(s.name)||n.set(s.name,new Set),n.get(s.name).add(s.version);const p=[];for(const[s,a]of n)a.size<=1||p.push({name:s,versions:[...a]});return p.sort((s,a)=>s.name.localeCompare(a.name))},"findDuplicateDependencies");export{ne as f,te as l,re as s};
@@ -1,2 +1,2 @@
1
- var E=Object.defineProperty;var k=(e,o)=>E(e,"name",{value:o,configurable:!0});import{createRequire as D}from"node:module";import{ensureDirSync as R,writeFileSync as C,isAccessibleSync as O,readJsonSync as A}from"@visulima/fs";import{dirname as _,join as c,relative as M}from"@visulima/path";const N=D(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=k(e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[o,r]=m.versions.node.split(".").map(Number);if(o>22||o===22&&r>=3||o===20&&r>=16)return m.getBuiltinModule(e)}return N(e)},"__cjs_getBuiltinModule"),{cpSync:S,lstatSync:x,readdirSync:F,rmSync:v}=T("node:fs");var P=Object.defineProperty,l=k((e,o)=>P(e,"name",{value:o,configurable:!0}),"f");const $=l((e,o)=>{const r=new Set,t=[e],a=new Set([e]);for(;t.length>0;){const n=t.shift(),f=o.dependencies[n]??[];for(const i of f)a.has(i.target)||(a.add(i.target),r.add(i.target),t.push(i.target))}return r},"collectTransitiveProjectDeps"),g="vis-docker-manifest.json",I=["package.json","project.json"],q=["package.json","pnpm-workspace.yaml","pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock","bun.lockb",".npmrc","vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],L=l((e,o)=>{const r=new Set(e);for(const t of e){const a=$(t,o);for(const n of a)r.add(n)}return r},"resolveFocusProjects"),y=l(e=>{R(e)},"ensureDir"),h=l((e,o)=>{try{return y(_(o)),S(e,o),!0}catch(r){if(r.code==="ENOENT")return!1;throw r}},"copyFileIfExists"),b=l((e,o)=>{let r;try{r=x(e)}catch{return}if(!r.isSymbolicLink()){if(r.isFile()){y(_(o)),S(e,o);return}y(o);for(const t of F(e,{withFileTypes:!0}))t.name==="node_modules"||t.name===".git"||t.isSymbolicLink()||b(c(e,t.name),c(o,t.name))}},"copyTreeExcludingNodeModules"),U=l(e=>{const{focus:o,includeSources:r=!1,outDir:t,projectGraph:a,workspace:n,workspaceRoot:f}=e,i=o.filter(s=>n.projects[s]===void 0);if(i.length>0)throw new Error(`Unknown focus project(s): ${i.join(", ")}. Check project names in your workspace.`);const j=L(o,a),u=c(t,"workspace"),d=c(t,"sources");v(u,{force:!0,recursive:!0}),v(d,{force:!0,recursive:!0}),y(u);for(const s of q)h(c(f,s),c(u,s));for(const s of j){const p=n.projects[s];if(p?.root)for(const w of I)h(c(f,p.root,w),c(u,p.root,w))}if(r){y(d);for(const s of o){const p=n.projects[s];p?.root&&b(c(f,p.root),c(d,p.root))}}return C(c(t,g),`${JSON.stringify({focus:o,projects:[...j].sort()},null,2)}
1
+ var E=Object.defineProperty;var k=(e,o)=>E(e,"name",{value:o,configurable:!0});import{createRequire as D}from"node:module";import{ensureDirSync as R,writeFileSync as C,isAccessibleSync as O,readJsonSync as A}from"@visulima/fs";import{dirname as _,join as c,relative as M}from"@visulima/path";const T=D(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=k(e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[o,r]=m.versions.node.split(".").map(Number);if(o>22||o===22&&r>=3||o===20&&r>=16)return m.getBuiltinModule(e)}return T(e)},"__cjs_getBuiltinModule"),{cpSync:S,lstatSync:F,readdirSync:N,rmSync:v}=x("node:fs");var P=Object.defineProperty,l=k((e,o)=>P(e,"name",{value:o,configurable:!0}),"p");const $=l((e,o)=>{const r=new Set,t=[e],a=new Set([e]);for(;t.length>0;){const n=t.shift(),f=o.dependencies[n]??[];for(const i of f)a.has(i.target)||(a.add(i.target),r.add(i.target),t.push(i.target))}return r},"collectTransitiveProjectDeps"),g="vis-docker-manifest.json",I=["package.json","project.json"],q=["package.json","pnpm-workspace.yaml","pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock","bun.lockb",".npmrc","vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],L=l((e,o)=>{const r=new Set(e);for(const t of e){const a=$(t,o);for(const n of a)r.add(n)}return r},"resolveFocusProjects"),y=l(e=>{R(e)},"ensureDir"),h=l((e,o)=>{try{return y(_(o)),S(e,o),!0}catch(r){if(r.code==="ENOENT")return!1;throw r}},"copyFileIfExists"),b=l((e,o)=>{let r;try{r=F(e)}catch{return}if(!r.isSymbolicLink()){if(r.isFile()){y(_(o)),S(e,o);return}y(o);for(const t of N(e,{withFileTypes:!0}))t.name==="node_modules"||t.name===".git"||t.isSymbolicLink()||b(c(e,t.name),c(o,t.name))}},"copyTreeExcludingNodeModules"),U=l(e=>{const{focus:o,includeSources:r=!1,outDir:t,projectGraph:a,workspace:n,workspaceRoot:f}=e,i=o.filter(s=>n.projects[s]===void 0);if(i.length>0)throw new Error(`Unknown focus project(s): ${i.join(", ")}. Check project names in your workspace.`);const j=L(o,a),u=c(t,"workspace"),d=c(t,"sources");v(u,{force:!0,recursive:!0}),v(d,{force:!0,recursive:!0}),y(u);for(const s of q)h(c(f,s),c(u,s));for(const s of j){const p=n.projects[s];if(p?.root)for(const w of I)h(c(f,p.root,w),c(u,p.root,w))}if(r){y(d);for(const s of o){const p=n.projects[s];p?.root&&b(c(f,p.root),c(d,p.root))}}return C(c(t,g),`${JSON.stringify({focus:o,projects:[...j].sort()},null,2)}
2
2
  `),{projects:[...j]}},"scaffoldDockerContext"),W=l(e=>{const{contextRoot:o,workspace:r,workspaceRoot:t}=e,a=c(o,g);if(!O(a))throw new Error(`No ${g} at ${o}. Run \`vis docker scaffold\` first.`);const n=A(a);if(!Array.isArray(n.projects))throw new TypeError(`Invalid ${g}: "projects" must be an array.`);const f=new Set(n.projects),i=[];for(const[j,u]of Object.entries(r.projects)){if(f.has(j)||!u.root)continue;const d=c(t,u.root),s=M(t,d);s===""||s==="."||s.startsWith("..")||(v(d,{force:!0,recursive:!0}),i.push(s))}return{removed:i}},"pruneDockerContext");export{W as p,L as r,U as s};
@@ -1,2 +1,2 @@
1
1
  var h=Object.defineProperty;var a=(t,e)=>h(t,"name",{value:e,configurable:!0});import{createRequire as m}from"node:module";import{join as l}from"@visulima/path";const y=m(import.meta.url),s=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=a(t=>{if(typeof s<"u"&&s.versions&&s.versions.node){const[e,r]=s.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return s.getBuiltinModule(t)}return y(t)},"__cjs_getBuiltinModule"),{mkdirSync:F,writeFileSync:L,readdirSync:_}=u("node:fs"),{readFile:j}=u("node:fs/promises");var v=Object.defineProperty,i=a((t,e)=>v(t,"name",{value:e,configurable:!0}),"i");const S="last-failures",c=i(t=>l(t,".task-runner",S),"getFailureLogDirectory"),d=i((t,e)=>l(c(t),`${encodeURIComponent(e)}.json`),"getFailureLogPath");class I{static{a(this,"FailureLogLifeCycle")}static{i(this,"FailureLogLifeCycle")}#e;#t;constructor(e,r){this.#e=e,this.#t=r}printTaskTerminalOutput(e,r,o){if(r!=="failure")return;const n=c(this.#e);try{F(n,{recursive:!0})}catch{return}const f=e.overrides.command,g=e.projectRoot,p={command:f,cwd:g,exitCode:void 0,hash:e.hash,runId:this.#t,status:r,taskId:e.id,terminalOutput:o,timestamp:new Date().toISOString()};try{L(d(this.#e,e.id),`${JSON.stringify(p,void 0,2)}
2
- `,"utf8")}catch{}}}const R=i(async(t,e)=>{const r=d(t,e);try{const o=await j(r,"utf8");return JSON.parse(o)}catch{return}},"loadFailureLog"),T=i(t=>{const e=c(t);let r;try{r=_(e)}catch{return[]}const o=[];for(const n of r)if(n.endsWith(".json"))try{o.push(decodeURIComponent(n.slice(0,-5)))}catch{}return o},"listFailureLogs");export{I as F,T as a,R as l};
2
+ `,"utf8")}catch{}}}const R=i(async(t,e)=>{const r=d(t,e);try{const o=await j(r,"utf8");return JSON.parse(o)}catch{return}},"loadFailureLog"),T=i(t=>{const e=c(t);let r;try{r=_(e)}catch{return[]}const o=[];for(const n of r)if(n.endsWith(".json"))try{o.push(decodeURIComponent(n.slice(0,-5)))}catch{}return o},"listFailureLogs");export{I as F,R as a,T as l};
@@ -0,0 +1 @@
1
+ var k=Object.defineProperty;var f=(a,s)=>k(a,"name",{value:s,configurable:!0});import{createRequire as b}from"node:module";import{isAccessibleSync as S,readJsonSync as T}from"@visulima/fs";import{join as p}from"@visulima/path";const R=b(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,j=f(a=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[s,n]=l.versions.node.split(".").map(Number);if(s>22||s===22&&n>=3||s===20&&n>=16)return l.getBuiltinModule(a)}return R(a)},"__cjs_getBuiltinModule"),{readdirSync:y}=j("node:fs");var v=Object.defineProperty,d=f((a,s)=>v(a,"name",{value:s,configurable:!0}),"i");const $=d((a,s)=>{let n=0,o=0,r=0;for(const[,t]of a)switch(t.status){case"failure":{r+=1;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{o+=1;break}case"success":{n+=1;break}}const i=[];n>0&&i.push(`${String(n)} succeeded`),o>0&&i.push(`${String(o)} cached`),r>0&&i.push(`${String(r)} failed`);const c=(s/1e3).toFixed(1);return i.push(`${c}s`),i.join(" · ")},"formatTimingSummary"),g=d(a=>{const s=p(a,".task-runner","runs");if(!S(s))return[];const n=y(s).filter(r=>r.endsWith(".json")),o=[];for(const r of n)try{o.push(T(p(s,r)))}catch{}return o},"loadRunSummaries"),P=d((a,s,n)=>{const o=n??g(a);if(o.length<2)return;let r=0,i=0;for(const e of o)typeof e.duration=="number"&&e.duration>0&&(r+=e.duration,i+=1);if(i<2)return;const c=r/i-s,t=Math.abs(c/1e3).toFixed(1);return Math.abs(c)<500?"(about average)":c>0?`(${t}s faster than avg)`:`(${t}s slower than avg)`},"compareDuration");var F=Object.defineProperty,m=f((a,s)=>F(a,"name",{value:s,configurable:!0}),"l");const E=m((a,s={},n)=>{const o=n??g(a);if(o.length===0)return[];const r=new Map;for(const t of o)if(!(s.since&&(t.startTime===void 0||t.startTime<s.since))&&Array.isArray(t.tasks))for(const e of t.tasks){if(e.cacheStatus==="HIT"||e.cacheStatus==="REMOTE_HIT"||e.cacheStatus==="SKIPPED")continue;const u=r.get(e.taskId)??{failures:0,project:e.target.project,successes:0,target:e.target.target,totalRuns:0};u.totalRuns+=1,e.exitCode!==void 0&&e.exitCode!==0?(u.failures+=1,u.lastFailure=e.startTime??t.startTime):u.successes+=1,r.set(e.taskId,u)}const i=s.minRuns??2,c=[];for(const[t,e]of r)e.totalRuns<i||e.failures!==0&&c.push({failures:e.failures,flakinessRate:e.failures/e.totalRuns,lastFailure:e.lastFailure,project:e.project,successes:e.successes,target:e.target,taskId:t,totalRuns:e.totalRuns});return c.sort((t,e)=>e.flakinessRate-t.flakinessRate),c},"analyzeFlakiness"),q=m(a=>{if(a.length===0)return["No flaky tasks detected."];const s=["Task","Runs","Failures","Rate","Last Failure"],n=a.map(t=>[t.taskId,String(t.totalRuns),String(t.failures),`${(t.flakinessRate*100).toFixed(1)}%`,t.lastFailure??"—"]),o=s.map((t,e)=>{let u=0;for(const h of n)u=Math.max(u,(h[e]??"").length);return Math.max(t.length,u)}),r=m((t,e)=>t.padEnd(e),"pad"),i=o.map(t=>"─".repeat(t)).join("──"),c=[s.map((t,e)=>r(t,o[e])).join(" "),i];for(const t of n)c.push(t.map((e,u)=>r(e,o[u])).join(" "));return c},"formatFlakinessTable");export{E as a,q as b,P as c,$ as f,g as l};
@@ -0,0 +1,2 @@
1
+ var De=Object.defineProperty;var f=(r,e)=>De(r,"name",{value:e,configurable:!0});import{createRequire as Fe}from"node:module";const Ne=Fe(import.meta.url),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=f(r=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[e,t]=z.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return z.getBuiltinModule(r)}return Ne(r)},"__cjs_getBuiltinModule"),{createRequire:Me}=k("node:module"),{existsSync:x,createWriteStream:se,readdirSync:Ge,renameSync:He}=k("node:fs"),{readFile:ie,mkdir:H,rm:M,writeFile:Be,mkdtemp:Le}=k("node:fs/promises"),{PassThrough:ae,Readable:q,pipeline:Re}=k("node:stream"),{spawn:ce,spawnSync:Ue}=k("node:child_process"),{delimiter:J,resolve:We,dirname:Xe,normalize:qe,join:Y}=k("node:path"),{cwd:Je}=z,Ye=k("node:readline"),{pipeline:Ze}=k("node:stream/promises"),{homedir:Ve,tmpdir:le}=k("node:os"),{promisify:Ke}=k("node:util");var Qe=Object.defineProperty,et=f((r,e)=>Qe(r,"name",{value:e,configurable:!0}),"a$1"),Z=Object.defineProperty,tt=et((r,e)=>{let t={};for(var n in r)Z(t,n,{get:r[n],enumerable:!0});return e||Z(t,Symbol.toStringTag,{value:"Module"}),t},"__exportAll"),rt=Object.defineProperty,p=f((r,e)=>rt(r,"name",{value:e,configurable:!0}),"a");const nt=/^[A-Za-z]:\//;function F(r=""){return r&&r.replace(/\\/g,"/").replace(nt,e=>e.toUpperCase())}f(F,"P");p(F,"p");const ot=/^[/\\]{2}/,st=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,ue=/^[A-Za-z]:$/,V=/^\/([A-Za-z]:)?$/,pe=p(function(r){if(r.length===0)return".";r=F(r);let e=r.match(ot),t=D(r),n=r[r.length-1]==="/";return r=R(r,!t),r.length===0?t?"/":n?"./":".":(n&&(r+="/"),ue.test(r)&&(r+="/"),e?t?`//${r}`:`//./${r}`:t&&!D(r)?`/${r}`:r)},"g"),K=p(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 pe(e)},"_");function de(){return typeof process.cwd=="function"?process.cwd().replace(/\\/g,"/"):"/"}f(de,"st");p(de,"v");const $=p(function(...r){r=r.map(n=>F(n));let e="",t=!1;for(let n=r.length-1;n>=-1&&!t;n--){let o=n>=0?r[n]:de();!o||o.length===0||(e=`${o}/${e}`,t=D(o))}return e=R(e,!t),t&&!D(e)?`/${e}`:e.length>0?e:"."},"y");function R(r,e){let t="",n=0,o=-1,i=0,c=null;for(let s=0;s<=r.length;++s){if(s<r.length)c=r[s];else{if(c==="/")break;c="/"}if(c==="/"){if(!(o===s-1||i===1))if(i===2){if(t.length<2||n!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let a=t.lastIndexOf("/");a===-1?(t="",n=0):(t=t.slice(0,a),n=t.length-1-t.lastIndexOf("/")),o=s,i=0;continue}else if(t.length>0){t="",n=0,o=s,i=0;continue}}e&&(t+=t.length>0?"/..":"..",n=2)}else t.length>0?t+=`/${r.slice(o+1,s)}`:t=r.slice(o+1,s),n=s-o-1;o=s,i=0}else c==="."&&i!==-1?++i:i=-1}return t}f(R,"W");p(R,"b");const D=p(function(r){return st.test(r)},"x"),he=p(function(r,e){let t=$(r).replace(V,"$1").split("/"),n=$(e).replace(V,"$1").split("/");if(n[0][1]===":"&&t[0][1]===":"&&t[0]!==n[0])return n.join("/");let o=[...t];for(let i of o){if(n[0]!==i)break;t.shift(),n.shift()}return[...t.map(()=>".."),...n].join("/")},"S"),fe=p(function(r){let e=F(r).replace(/\/$/,"").split("/").slice(0,-1);return e.length===1&&ue.test(e[0])&&(e[0]+="/"),e.join("/")||(D(r)?"/":".")},"C"),me=p(function(r,e){let t=F(r).split("/"),n="";for(let o=t.length-1;o>=0;o--){let i=t[o];if(i){n=i;break}}return e&&n.endsWith(e)?n.slice(0,-e.length):n},"ne");var _=p((r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),"w"),O=Me(import.meta.url);const it=/^path$/i,Q={key:"PATH",value:""};function ge(r){for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e)||!it.test(e))continue;let t=r[e];return t?{key:e,value:t}:Q}return Q}f(ge,"pt");p(ge,"D");function we(r,e){let t=e.value.split(J),n=[],o=r,i;do n.push(We(o,"node_modules",".bin")),i=o,o=Xe(o);while(o!==i);let c=n.concat(t).join(J);return{key:e.key,value:c}}f(we,"ut");p(we,"O");function ve(r,e){let t={...process.env,...e},n=we(r,ge(t));return t[n.key]=n.value,t}f(ve,"ft");p(ve,"k");const at=p(r=>{let e=r.length,t=new ae,n=p(()=>{--e===0&&t.emit("end")},"r");for(let o of r)o.pipe(t,{end:!1}),o.on("end",n);return t},"A");var ct=_(((r,e)=>{e.exports=i,i.sync=c;var t=O("fs");function n(s,a){var l=a.pathExt===void 0?process.env.PATHEXT:a.pathExt;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var u=0;u<l.length;u++){var h=l[u].toLowerCase();if(h&&s.substr(-h.length).toLowerCase()===h)return!0}return!1}f(n,"n"),p(n,"r");function o(s,a,l){return!s.isSymbolicLink()&&!s.isFile()?!1:n(a,l)}f(o,"s"),p(o,"i");function i(s,a,l){t.stat(s,function(u,h){l(u,u?!1:o(h,s,a))})}f(i,"i"),p(i,"a");function c(s,a){return o(t.statSync(s),s,a)}f(c,"c"),p(c,"o")})),lt=_(((r,e)=>{e.exports=n,n.sync=o;var t=O("fs");function n(s,a,l){t.stat(s,function(u,h){l(u,u?!1:i(h,a))})}f(n,"n"),p(n,"r");function o(s,a){return i(t.statSync(s),a)}f(o,"s"),p(o,"i");function i(s,a){return s.isFile()&&c(s,a)}f(i,"i"),p(i,"a");function c(s,a){var l=s.mode,u=s.uid,h=s.gid,d=a.uid===void 0?process.getuid&&process.getuid():a.uid,m=a.gid===void 0?process.getgid&&process.getgid():a.gid,g=64,v=8,E=1,S=g|v;return l&E||l&v&&h===m||l&g&&u===d||l&S&&d===0}f(c,"c"),p(c,"o")})),ut=_(((r,e)=>{O("fs");var t=process.platform==="win32"||global.TESTING_WINDOWS?ct():lt();e.exports=n,n.sync=o;function n(i,c,s){if(typeof c=="function"&&(s=c,c={}),!s){if(typeof Promise!="function")throw TypeError("callback not provided");return new Promise(function(a,l){n(i,c||{},function(u,h){u?l(u):a(h)})})}t(i,c||{},function(a,l){a&&(a.code==="EACCES"||c&&c.ignoreErrors)&&(a=null,l=!1),s(a,l)})}f(n,"n"),p(n,"r");function o(i,c){try{return t.sync(i,c||{})}catch(s){if(c&&c.ignoreErrors||s.code==="EACCES")return!1;throw s}}f(o,"s"),p(o,"i")})),pt=_(((r,e)=>{let t=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",n=O("path"),o=t?";":":",i=ut(),c=p(l=>Object.assign(Error(`not found: ${l}`),{code:"ENOENT"}),"o"),s=p((l,u)=>{let h=u.colon||o,d=l.match(/\//)||t&&l.match(/\\/)?[""]:[...t?[process.cwd()]:[],...(u.path||process.env.PATH||"").split(h)],m=t?u.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",g=t?m.split(h):[""];return t&&l.indexOf(".")!==-1&&g[0]!==""&&g.unshift(""),{pathEnv:d,pathExt:g,pathExtExe:m}},"s"),a=p((l,u,h)=>{typeof u=="function"&&(h=u,u={}),u||={};let{pathEnv:d,pathExt:m,pathExtExe:g}=s(l,u),v=[],E=p(b=>new Promise((A,T)=>{if(b===d.length)return u.all&&v.length?A(v):T(c(l));let y=d[b],G=/^".*"$/.test(y)?y.slice(1,-1):y,P=n.join(G,l);A(S(!G&&/^\.[\\\/]/.test(l)?l.slice(0,2)+P:P,b,0))}),"d"),S=p((b,A,T)=>new Promise((y,G)=>{if(T===m.length)return y(E(A+1));let P=m[T];i(b+P,{pathExt:g},(ze,Ie)=>{if(!ze&&Ie)if(u.all)v.push(b+P);else return y(b+P);return y(S(b,A,T+1))})}),"f");return h?E(0).then(b=>h(null,b),h):E(0)},"c");e.exports=a,a.sync=(l,u)=>{u||={};let{pathEnv:h,pathExt:d,pathExtExe:m}=s(l,u),g=[];for(let v=0;v<h.length;v++){let E=h[v],S=/^".*"$/.test(E)?E.slice(1,-1):E,b=n.join(S,l),A=!S&&/^\.[\\\/]/.test(l)?l.slice(0,2)+b:b;for(let T=0;T<d.length;T++){let y=A+d[T];try{if(i.sync(y,{pathExt:m}))if(u.all)g.push(y);else return y}catch{}}}if(u.all&&g.length)return g;if(u.nothrow)return null;throw c(l)}})),dt=_(((r,e)=>{let t=p((n={})=>{let o=n.env||process.env;return(n.platform||process.platform)==="win32"?Object.keys(o).reverse().find(i=>i.toUpperCase()==="PATH")||"Path":"PATH"},"n");e.exports=t,e.exports.default=t})),ht=_(((r,e)=>{let t=O("path"),n=pt(),o=dt();function i(s,a){let l=s.options.env||process.env,u=process.cwd(),h=s.options.cwd!=null,d=h&&process.chdir!==void 0&&!process.chdir.disabled;if(d)try{process.chdir(s.options.cwd)}catch{}let m;try{m=n.sync(s.command,{path:l[o({env:l})],pathExt:a?t.delimiter:void 0})}catch{}finally{d&&process.chdir(u)}return m&&=t.resolve(h?s.options.cwd:"",m),m}f(i,"i"),p(i,"a");function c(s){return i(s)||i(s,!0)}f(c,"c"),p(c,"o"),e.exports=c})),ft=_(((r,e)=>{let t=/([()\][%!^"`<>&|;, *?])/g;function n(i){return i=i.replace(t,"^$1"),i}f(n,"n"),p(n,"r");function o(i,c){return i=`${i}`,i=i.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),i=i.replace(/(?=(\\+?)?)\1$/,"$1$1"),i=`"${i}"`,i=i.replace(t,"^$1"),c&&(i=i.replace(t,"^$1")),i}f(o,"s"),p(o,"i"),e.exports.command=n,e.exports.argument=o})),mt=_(((r,e)=>{e.exports=/^#!(.*)/})),gt=_(((r,e)=>{let t=mt();e.exports=(n="")=>{let o=n.match(t);if(!o)return null;let[i,c]=o[0].replace(/#! ?/,"").split(" "),s=i.split("/").pop();return s==="env"?c:c?`${s} ${c}`:s}})),wt=_(((r,e)=>{let t=O("fs"),n=gt();function o(i){let c=Buffer.alloc(150),s;try{s=t.openSync(i,"r"),t.readSync(s,c,0,150,0),t.closeSync(s)}catch{}return n(c.toString())}f(o,"s"),p(o,"i"),e.exports=o})),vt=_(((r,e)=>{let t=O("path"),n=ht(),o=ft(),i=wt(),c=process.platform==="win32",s=/\.(?:com|exe)$/i,a=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(d){d.file=n(d);let m=d.file&&i(d.file);return m?(d.args.unshift(d.file),d.command=m,n(d)):d.file}f(l,"p"),p(l,"l");function u(d){if(!c)return d;let m=l(d),g=!s.test(m);if(d.options.forceShell||g){let v=a.test(m);d.command=t.normalize(d.command),d.command=o.command(d.command),d.args=d.args.map(E=>o.argument(E,v)),d.args=["/d","/s","/c",`"${[d.command].concat(d.args).join(" ")}"`],d.command=process.env.comspec||"cmd.exe",d.options.windowsVerbatimArguments=!0}return d}f(u,"u"),p(u,"u");function h(d,m,g){m&&!Array.isArray(m)&&(g=m,m=null),m=m?m.slice(0):[],g=Object.assign({},g);let v={command:d,args:m,options:g,file:void 0,original:{command:d,args:m}};return g.shell?v:u(v)}f(h,"d"),p(h,"d"),e.exports=h})),$t=_(((r,e)=>{let t=process.platform==="win32";function n(s,a){return Object.assign(Error(`${a} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${a} ${s.command}`,path:s.command,spawnargs:s.args})}f(n,"n"),p(n,"r");function o(s,a){if(!t)return;let l=s.emit;s.emit=function(u,h){if(u==="exit"){let d=i(h,a);if(d)return l.call(s,"error",d)}return l.apply(s,arguments)}}f(o,"s"),p(o,"i");function i(s,a){return t&&s===1&&!a.file?n(a.original,"spawn"):null}f(i,"i"),p(i,"a");function c(s,a){return t&&s===1&&!a.file?n(a.original,"spawnSync"):null}f(c,"c"),p(c,"o"),e.exports={hookChildProcess:o,verifyENOENT:i,verifyENOENTSync:c,notFoundError:n}})),bt=_(((r,e)=>{let t=O("child_process"),n=vt(),o=$t();function i(s,a,l){let u=n(s,a,l),h=t.spawn(u.command,u.args,u.options);return o.hookChildProcess(h,u),h}f(i,"i"),p(i,"a");function c(s,a,l){let u=n(s,a,l),h=t.spawnSync(u.command,u.args,u.options);return h.error=h.error||o.verifyENOENTSync(h.status,u),h}f(c,"c"),p(c,"o"),e.exports=i,e.exports.spawn=i,e.exports.sync=c,e.exports._parse=n,e.exports._enoent=o}))(),ee=class extends Error{static{f(this,"L")}static{p(this,"U")}result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(r,e){super(`Process exited with non-zero status (${r.exitCode})`),this.result=r,this.output=e}};const _t={timeout:void 0,persist:!1},Et={windowsHide:!0};function $e(r,e){return{command:qe(r),args:e??[]}}f($e,"Pt");p($e,"K");function be(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}f(be,"Tt");p(be,"q");async function B(r){let e="";for await(let t of r)e+=t.toString();return e}f(B,"H");p(B,"J");var yt=class{static{f(this,"At")}static{p(this,"Y")}_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(r,e,t){this._options={..._t,...t},this._command=r,this._args=e??[],this._processClosed=new Promise(n=>{this._resolveClose=n})}kill(r){return this._process?.kill(r)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(r,e,t){return xt(r,e,{...t,stdin:this})}async*[Symbol.asyncIterator](){let r=this._process;if(!r)return;let e=[];this._streamErr&&e.push(this._streamErr),this._streamOut&&e.push(this._streamOut);let t=at(e),n=Ye.createInterface({input:t});for await(let o of n)yield o.toString();if(await this._processClosed,r.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ee(this)}async _waitForOutput(){let r=this._process;if(!r)throw Error("No process was started");let[e,t]=await Promise.all([this._streamOut?B(this._streamOut):"",this._streamErr?B(this._streamErr):""]);if(await this._processClosed,this._options?.stdin&&await this._options.stdin,r.removeAllListeners(),this._thrownError)throw this._thrownError;let n={stderr:t,stdout:e,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ee(this,n);return n}then(r,e){return this._waitForOutput().then(r,e)}_streamOut;_streamErr;spawn(){let r=Je(),e=this._options,t={...Et,...e.nodeOptions},n=[];this._resetState(),e.timeout!==void 0&&n.push(AbortSignal.timeout(e.timeout)),e.signal!==void 0&&n.push(e.signal),e.persist===!0&&(t.detached=!0),n.length>0&&(t.signal=be(n)),t.env=ve(r,t.env);let{command:o,args:i}=$e(this._command,this._args),c=(0,bt._parse)(o,i,t),s=ce(c.command,c.args,c.options);if(s.stderr&&(this._streamErr=s.stderr),s.stdout&&(this._streamOut=s.stdout),this._process=s,s.once("error",this._onError),s.once("close",this._onClose),e.stdin!==void 0&&s.stdin&&e.stdin.process){let{stdout:a}=e.stdin.process;a&&a.pipe(s.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(r=>{this._resolveClose=r}),this._thrownError=void 0}_onError=p(r=>{if(r.name==="AbortError"&&(!(r.cause instanceof Error)||r.cause.name!=="TimeoutError")){this._aborted=!0;return}this._thrownError=r},"_onError");_onClose=p(()=>{this._resolveClose&&this._resolveClose()},"_onClose")};const U=p((r,e,t)=>{let n=new yt(r,e,t);return n.spawn(),n},"X"),xt=U;var kt=tt({detectPackageManager:p(()=>W,"detectPackageManager"),installDependencies:p(()=>Te,"installDependencies"),packageManagers:p(()=>j,"packageManagers")});async function _e(r,e,t={}){let n=pe(r).split("/");for(;n.length>0;){let o=await e(n.join("/")||"/");if(o||!t.includeParentDirs)return o;n.pop()}}f(_e,"Mt");p(_e,"se");function Ee(r){let e;return()=>(e===void 0&&(e=r().then(t=>(e=t,e))),e)}f(Ee,"zt");p(Ee,"ce");const Tt=Ee(async()=>{if(globalThis.process?.versions?.webcontainer)return!1;try{let{exitCode:r}=await U("corepack",["--version"]);return r===0}catch{return!1}});async function ye(r,e,t={}){let n=r!=="npm"&&r!=="bun"&&r!=="deno"&&t.corepack!==!1&&await Tt()?["corepack",[r,...e]]:[r,e],{exitCode:o,stdout:i,stderr:c}=await U(n[0],n[1],{nodeOptions:{cwd:$(t.cwd||process.cwd()),env:t.env,stdio:t.silent?"pipe":"inherit"}});if(o!==0)throw Error(`\`${n.flat().join(" ")}\` failed.${t.silent?["",i,c].join(`
2
+ `):""}`)}f(ye,"Lt");p(ye,"le");async function xe(r={}){let e=r.cwd||process.cwd(),t={...process.env,...r.env},n=(typeof r.packageManager=="string"?j.find(o=>o.name===r.packageManager):r.packageManager)||await W(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}}f(xe,"Ht");p(xe,"ue");function ke(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 i=(e||"").replace(/\W+/g,"");return{name:i,version:n,buildMeta:o,warnings:[`Abnormal characters found in \`packageManager\` field, sanitizing from \`${e}\` to \`${i}\``]}}f(ke,"Dt");p(ke,"de");const j=[{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 W(r,e={}){let t=await _e($(r||"."),async n=>{if(!e.ignorePackageJSON){let o=K(n,"package.json");if(x(o)){let i=JSON.parse(await ie(o,"utf8"));if(i?.packageManager){let{name:c,version:s="0.0.0",buildMeta:a,warnings:l}=ke(i.packageManager);if(c){let u=s.split(".")[0],h=j.find(d=>d.name===c&&d.majorVersion===u)||j.find(d=>d.name===c);return{name:c,command:c,version:s,majorVersion:u,buildMeta:a,warnings:l,files:h?.files,lockFile:h?.lockFile}}}}if(x(K(n,"deno.json")))return j.find(i=>i.name==="deno")}if(!e.ignoreLockFile){for(let o of j)if([o.lockFile,o.files].flat().filter(Boolean).some(i=>x($(n,i))))return{...o}}},{includeParentDirs:e.includeParentDirs??!0});if(!t&&!e.ignoreArgv){let n=process.argv[1];if(n){for(let o of j)if(RegExp(`[/\\\\]\\.?${o.command}`).test(n))return o}}return t}f(W,"Z$1");p(W,"$");async function Te(r={}){let e=await xe(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 ye(e.packageManager.command,t,{cwd:e.cwd,silent:e.silent,corepack:e.corepack}),{exec:{command:e.packageManager.command,args:t}}}f(Te,"It");p(Te,"fe");const Ct=Object.defineProperty({__proto__:null,a:$,i:he,n:me,r:fe,t:kt},Symbol.toStringTag,{value:"Module"});var Ot=Object.defineProperty,w=f((r,e)=>Ot(r,"name",{value:e,configurable:!0}),"o");async function Ce(r,e,t={}){const n=e+".json",o=JSON.parse(await ie(n,"utf8").catch(()=>"{}")),i=(await I(r,{method:"HEAD",headers:t.headers}).catch(()=>{}))?.headers.get("etag");if(o.etag===i&&x(e))return;typeof i=="string"&&(o.etag=i);const c=await I(r,{headers:t.headers});if(c.status>=400)throw new Error(`Failed to download ${r}: ${c.status} ${c.statusText}`);const s=se(e);await Ke(Re)(c.body,s),await Be(n,JSON.stringify(o),"utf8")}f(Ce,"q");w(Ce,"download");const St=/^(?<repo>[-\w.]+\/[-\w.]+)(?<subdir>[^#]+)?(?<ref>#[-\w./@]+)?/,At=/^(?<repo>[-\w.]+(?:\/[-\w.]+)+?)(?:::(?<subdir>[^#]*))?(?<ref>#[-\w./@]+)?$/;function N(r,e){const t=e?.expandRepo||r.includes("::"),n=r.match(t?At:St)?.groups||{},o=t?n.subdir?"/"+n.subdir:"/":n.subdir||"/";return{repo:n.repo||"",subdir:o,ref:n.ref?n.ref.slice(1):"main"}}f(N,"x");w(N,"parseGitURI");function C(...r){process.env.DEBUG&&console.debug("[giget]",...r)}f(C,"$");w(C,"debug");async function I(r,e={}){e.headers?.["sec-fetch-mode"]&&(e.mode=e.headers["sec-fetch-mode"]);const t=await fetch(r,{...e,headers:X(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}f(I,"v");w(I,"sendFetch");function Oe(){const r=process.env.XDG_CACHE_HOME?$(process.env.XDG_CACHE_HOME,"giget"):$(Ve(),".cache/giget");if(process.platform==="win32"){const e=$(le(),"giget");if(!x(e)&&x(r))try{He(r,e)}catch{}return e}return r}f(Oe,"ee");w(Oe,"cacheDirectory");function X(r={}){const e={};for(const[t,n]of Object.entries(r))n&&(e[t.toLowerCase()]=n);return e}f(X,"F");w(X,"normalizeHeaders");function Se(){return process.env.SHELL?process.env.SHELL:process.platform==="win32"?"cmd.exe":"/bin/bash"}f(Se,"te");w(Se,"currentShell");function jt(r){r=$(r);const e=Se();console.info(`(experimental) Opening shell in ${he(process.cwd(),r)}...`),Ue(e,[],{cwd:r,shell:!0,stdio:"inherit"})}f(jt,"re");w(jt,"startShell");const Pt=w((r,e)=>{const t=Ae(r);return{name:t.name,version:t.subdir?`${t.version||"default"}-${t.subdir.replaceAll("/","-")}`:t.version,tar:w(({auth:n}={})=>je(t,n??e.auth),"tar")}},"git");function Ae(r,e={}){const t=e.cwd??process.cwd();let n=r.replace(/#.*$/,""),o;if(/^[./]/.test(r))n=$(t,n);else if(/^https?:\/\//.test(n)){const u=/^(https?:\/\/[^/]+)\/([\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(u){const[,h,d,m]=u;n=`${h}/${d}`,m&&(o=m)}}else if(n.includes("@")){const u=/^(.*?:[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(u){const[,h,d]=u;n=h,d&&(o=d)}}else{const u={"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&&u[h]?n=n.replace(h,u[h]):h||(n=`${(process.env.GIGET_GIT_HOST||"https://github.com/").replace(/\/$/,"")}/${n}`);const d=/^(https?:\/\/[^/]+\/~?[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(d){const[,m,g]=d;n=m,g&&(o=g)}}const i=n.replace(/^https?:\/\//,"").replace(/^.+@/,"").replace(/(\.git)?(#.*)?$/,"").replace(/^\W+/,"").replaceAll(/[:/]/g,"-"),[c,s]=/#(.+)$/.exec(r)?.at(1)?.split(":")??[],a=c||void 0,l=s||o;return{uri:n,name:i,...a&&{version:a},...l&&{subdir:l}}}f(Ae,"ie");w(Ae,"parseGitCloneURI");async function je(r,e){const t=await Le(Y(le(),"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},i=Pe(),c=w(a=>L(a,o,i),"gitExec"),s=w(a=>L(a,{...o,cwd:t},i),"gitExecIn");try{const a=["clone","--progress","--depth","1"];r.subdir&&a.push("--filter=blob:none","--sparse","--no-checkout"),r.version&&a.push("--branch",r.version),a.push("--",r.uri,t);try{i.update("Cloning..."),await c(a),i.update("Cloned.")}catch(g){if(!r.version)throw g;C("Shallow clone failed, falling back to full clone:",g),i.update("Shallow clone failed, cloning..."),await M(t,{recursive:!0,force:!0}),await H(t,{recursive:!0}),await s(["init"]),await s(["remote","add","origin",r.uri]),await s(["fetch","origin"]),await s(["checkout",r.version]),i.update("Fetched.")}r.subdir&&(i.update(`Sparse checkout ${r.subdir}...`),await s(["sparse-checkout","set",r.subdir]),await s(["checkout"])),i.update("Packing...");const l=r.subdir?Y(t,r.subdir):t,{create:u}=await import("../packem_chunks/tar.js").then(g=>g.t);i.done();const h=u({gzip:!0,cwd:l,filter:w(g=>!g.startsWith(".git/")&&g!==".git"&&!g.startsWith("./.git/")&&g!=="./.git","filter")},["."]).pipe(new ae);let d=!1;const m=w(()=>{d||(d=!0,M(t,{recursive:!0,force:!0}))},"cleanup");return h.on("end",m),h.on("error",m),h.on("close",m),h}catch(a){throw i.done(),await M(t,{recursive:!0,force:!0}),a}}f(je,"se");w(je,"_cloneAndTar");const te=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function L(r,e,t){return new Promise((n,o)=>{const i=ce("git",r,{...e,stdio:["ignore","pipe","pipe"]});i.stdout.resume();let c="";i.stderr?.on("data",s=>{const a=s.toString();for(const l of a.split(/[\r\n]/)){const u=l.trim();u&&(c=u)}t&&t.update(c)}),i.on("close",s=>{s===0?n(c):o(new Error(`git ${r[0]} exited with code ${s}. Is git installed?`))}),i.on("error",s=>{s.code==="ENOENT"?o(new Error("git is not installed or not found in PATH")):o(s)})})}f(L,"G");w(L,"_gitSpawn");function Pe(){if(!process.stderr.isTTY)return{update(o){},done(){}};let r="",e=0;const t=w(()=>{const o=te[e%te.length];e++,process.stderr.write(`\x1B[2K\r\x1B[2m${o} ${r}\x1B[0m`)},"render"),n=setInterval(t,80);return{update(o){r=o,t()},done(){clearInterval(n),process.stderr.write("\x1B[2K\r")}}}f(Pe,"ne");w(Pe,"_createStatus");const re=w(async(r,e)=>{if(r.endsWith(".json"))return await ne(r,e);const t=new URL(r);let n=me(t.pathname);try{const o=await I(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 ne(r,e);const i=o.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];i&&(n=i.split(".")[0])}catch(o){C(`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}}},"http"),ne=w(async(r,e)=>{const t=await(await I(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},"_httpJSON"),oe=w((r,e)=>{const t=N(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}`}},"github"),zt=w((r,e)=>{const t=N(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`}},"gitlab"),It=w((r,e)=>{const t=N(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`}},"bitbucket"),Dt=w((r,e)=>{const t=N(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`}},"sourcehut"),Ft={http:re,https:re,git:Pt,github:oe,gh:oe,gitlab:zt,bitbucket:It,sourcehut:Dt},Nt="https://raw.githubusercontent.com/unjs/giget/main/templates",Mt=w((r=Nt,e={})=>(async t=>{const n=Date.now(),o=`${r}/${t}.json`,i=await I(o,{headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}});if(i.status>=400)throw new Error(`Failed to download ${t} template info from ${o}: ${i.status} ${i.statusText}`);const c=await i.json();if(!c.tar||!c.name)throw new Error(`Invalid template info from ${o}. name or tar fields are missing!`);return C(`Fetched ${t} template info from ${o} in ${Date.now()-n}ms`),c}),"registryProvider"),Gt=/^([\w+-.]+):/;async function Ht(r,e={}){e.registry=process.env.GIGET_REGISTRY??e.registry,e.auth=process.env.GIGET_AUTH??e.auth;const t=e.registry===!1?void 0:Mt(e.registry,{auth:e.auth});let n=e.provider||(t?"registry":"github"),o=r;const i=r.match(Gt);i&&(n=i[1],o=r.slice(i[0].length),(n==="http"||n==="https")&&(o=r)),n.endsWith("+git")&&(o=`${n.slice(0,-4)}:${o}`,n="git");const c=e.providers?.[n]||Ft[n]||t;if(!c)throw new Error(`Unsupported provider: ${n}`);const s=await Promise.resolve().then(()=>c(o,{auth:e.auth})).catch(m=>{throw new Error(`Failed to download template from ${n}: ${m.message}`)});if(!s)throw new Error(`Failed to resolve template from ${n}`);s.name=(s.name||"template").replace(/[^\da-z-]/gi,"-"),s.defaultDir=(s.defaultDir||s.name).replace(/[^\da-z-]/gi,"-");const a=$($(Oe(),n,s.name),(s.version||s.name)+".tar.gz");if(e.preferOffline&&x(a)&&(e.offline=!0),!e.offline){await H(fe(a),{recursive:!0});const m=Date.now();if(typeof s.tar=="function"){const g=s.tar;await(async()=>{const v=await g({auth:e.auth});await Ze(v instanceof q?v:q.fromWeb(v),se(a))})().catch(v=>{if(!x(a))throw v;C("Download error. Using cached version:",v),e.offline=!0})}else await Ce(s.tar,a,{headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0,...X(s.headers)}}).catch(g=>{if(!x(a))throw g;C("Download error. Using cached version:",g),e.offline=!0});C(`Downloaded to ${a} in ${Date.now()-m}ms`)}if(!x(a))throw new Error(`Tarball not found: ${a} (offline: ${e.offline})`);const l=$($(e.cwd||"."),e.dir||s.defaultDir);if(e.forceClean&&await M(l,{recursive:!0,force:!0}),!e.force&&x(l)&&Ge(l).length>0)throw new Error(`Destination ${l} already exists.`);await H(l,{recursive:!0});const u=Date.now(),h=s.subdir?.replace(/^\//,"")||"",{extract:d}=await import("../packem_chunks/tar.js").then(m=>m.t);if(await d({file:a,cwd:l,onReadEntry(m){m.path=m.path.split("/").splice(1).join("/"),h&&(m.path.startsWith(h+"/")?m.path=m.path.slice(h.length):m.path="")}}),C(`Extracted to ${l} in ${Date.now()-u}ms`),e.install){C("Installing dependencies...");const{installDependencies:m}=await Promise.resolve().then(()=>Ct).then(g=>g.t);await m({cwd:l,silent:e.silent,...typeof e.install=="object"?e.install:{}})}return{...s,source:o,dir:l}}f(Ht,"fe");w(Ht,"downloadTemplate");export{Ht as f,tt as p};
@@ -0,0 +1 @@
1
+ var ce=Object.defineProperty;var f=(e,t)=>ce(e,"name",{value:t,configurable:!0});var le=Object.defineProperty,M=f((e,t)=>le(e,"name",{value:t,configurable:!0}),"i$6");const U=M(e=>{const t=new Set,n=[e];for(let r=0;r<n.length;r++){const o=n[r];if(t.has(o))continue;t.add(o);const{children:a}=o;if(a?.length)for(let i=0,u=a.length;i<u;i++)n.push(a[i])}return Array.from(t)},"getNodes"),pe=M(e=>{let t="";const n=U(e);for(let r=0,o=n.length;r<o;r++){const a=n[r];if(!a.regex)continue;const i=a.regex.flags;if(t||(t=i),t!==i)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${i}"`)}return t},"getNodeFlags"),T=M((e,t,n)=>{const r=n.get(e);if(r!==void 0)return r;const o=e.partial??t;let a="";if(e.regex&&(a+=o?"(?:$|":"",a+=e.regex.source),e.children?.length){const i=$e(e.children.map(u=>T(u,t,n)).filter(Boolean));if(i?.length){const u=e.children.some(w=>!w.regex||!(w.partial??t)),p=i.length>1||o&&(!a.length||u);a+=p?o?"(?:$|":"(?:":"",a+=i.join("|"),a+=p?")":""}}return e.regex&&(a+=o?")":""),n.set(e,a),a},"getNodeSourceWithCache"),fe=M((e,t)=>{const n=new Map,r=U(e);for(let o=r.length-1;o>=0;o--){const a=T(r[o],t,n);if(!(o>0))return a}return""},"getNodeSource"),$e=M(e=>Array.from(new Set(e)),"uniq");var ge=Object.defineProperty,de=f((e,t)=>ge(e,"name",{value:t,configurable:!0}),"a$6");const B=de((e,t,n)=>B.compile(e,n).test(t),"graphmatch");B.compile=(e,t)=>{const n=t?.partial??!1,r=fe(e,n),o=pe(e);return new RegExp(`^(?:${r})$`,o)};var he=Object.defineProperty,xe=f((e,t)=>he(e,"name",{value:t,configurable:!0}),"r$2");const me=xe((e,t)=>{const n=B.compile(e,t),r=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(r,o)},"compile");var ve=Object.defineProperty,be=f((e,t)=>ve(e,"name",{value:t,configurable:!0}),"n$1");const ye=be(e=>{const t=e.map(r=>r.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"merge");var je=Object.defineProperty,h=f((e,t)=>je(e,"name",{value:t,configurable:!0}),"e$1");const X=h(e=>Array.isArray(e),"isArray"),z=h(e=>typeof e=="function","isFunction"),we=h(e=>e.length===0,"isFunctionNullary"),ke=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Me=h(e=>typeof e=="number","isNumber"),ze=h(e=>typeof e=="object"&&e!==null,"isObject"),Oe=h(e=>e instanceof RegExp,"isRegExp"),Pe=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Ae=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),Y=h(e=>typeof e=="string","isString"),m=h(e=>e===void 0,"isUndefined"),Ee=h(e=>{const t=new Map;return n=>{const r=t.get(n);if(r!==void 0)return r;const o=e(n);return t.set(n,o),o}},"memoize");var Re=Object.defineProperty,c=f((e,t)=>Re(e,"name",{value:t,configurable:!0}),"s");const D=c((e,t,n={})=>{const r={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},o=g(t)(r),a=Math.max(r.index,r.indexBacktrackMax);if(o&&r.index===e.length)return r.output;throw new Error(`Failed to parse at index ${a}`)},"parse");c((e,t,n={})=>{const r={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]};return g(t)(r)&&r.index===e.length},"validate");const s=c((e,t)=>X(e)?Ie(e,t):Y(e)?G(e,t):Se(e,t),"match"),Ie=c((e,t)=>{const n={};for(const r of e){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 a=r.index,i=a;for(;i<o.length&&o.charCodeAt(i)in n;)i+=1;if(i>a){if(!m(t)&&!r.options.silent){const u=o.slice(a,i),p=z(t)?t(u,o,`${a}`):t;m(p)||r.output.push(p)}r.index=i}return!0}},"chars"),Se=c((e,t)=>{if(Ae(e))return G(e.source,t);{const n=e.source,r=e.flags.replace(/y|$/,"y"),o=new RegExp(n,r);return Pe(e)&&z(t)&&!ke(t)?Be(o,t):Ce(o,t)}},"regex"),Be=c((e,t)=>n=>{const r=n.index,o=n.input;e.lastIndex=r;const a=e.exec(o);if(a){const i=e.lastIndex;if(!n.options.silent){const u=t(...a,o,`${r}`);m(u)||n.output.push(u)}return n.index=i,!0}else return!1},"regexCapturing"),Ce=c((e,t)=>n=>{const r=n.index,o=n.input;if(e.lastIndex=r,e.test(o)){const a=e.lastIndex;if(!m(t)&&!n.options.silent){const i=z(t)?t(o.slice(r,a),o,`${r}`):t;m(i)||n.output.push(i)}return n.index=a,!0}else return!1},"regexNonCapturing"),G=c((e,t)=>n=>{const r=n.index,o=n.input;if(o.startsWith(e,r)){if(!m(t)&&!n.options.silent){const a=z(t)?t(e,o,`${r}`):t;m(a)||n.output.push(a)}return n.index+=e.length,!0}else return!1},"string"),E=c((e,t,n,r)=>{const o=g(e),a=t>1;return F(R(N(i=>{let u=0;for(;u<n;){const p=i.index;if(!o(i)||(u+=1,i.index===p))break}return u>=t},a),r))},"repeat"),C=c((e,t)=>E(e,0,1,t),"optional"),O=c((e,t)=>E(e,0,1/0,t),"star"),H=c((e,t)=>E(e,1,1/0,t),"plus"),v=c((e,t)=>{const n=e.map(g);return F(R(N(r=>{for(let o=0,a=n.length;o<a;o++)if(!n[o](r))return!1;return!0}),t))},"and"),$=c((e,t)=>{const n=e.map(g);return F(R(r=>{for(let o=0,a=n.length;o<a;o++)if(n[o](r))return!0;return!1},t))},"or"),Ne=c((e,t)=>{const n={};for(const r in e){if(r.length!==1&&r!=="default")throw new Error(`Invalid jump character: "${r}"`);n[r]=g(e[r])}return R(r=>{const o=r.input[r.index],a=n[o]||n.default;return a?a(r):!1},t)},"jump"),J=c((e,t)=>{const n=g(e);return N(r=>n(r)===t,!0,!0)},"lookahead"),Fe=c(e=>J(e,!1),"negative"),Ze=c(e=>J(e,!0),"positive"),N=c((e,t=!0,n=!1)=>{const r=g(e);return t?o=>{const a=o.index,i=o.output.length,u=r(o);return!u&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!u||n)&&(o.index=a,o.output.length!==i&&(o.output.length=i)),u}:r},"backtrackable"),R=c((e,t)=>{const n=g(e);return t?r=>{if(r.options.silent)return n(r);const o=r.output.length;if(n(r)){const a=r.output.splice(o,1/0),i=t(a);return m(i)||r.output.push(i),!0}else return!1}:n},"handleable"),F=(()=>{let e=0;return t=>{const n=g(t),r=e+=1;return o=>{var a;if(o.options.memoization===!1)return n(o);const i=o.index,u=(a=o.cache)[r]||(a[r]={indexMax:-1,queue:[]}),p=u.queue;if(i<=u.indexMax){const k=u.store||(u.store=new Map);if(p.length){for(let y=0,ie=p.length;y<ie;y+=2){const se=p[y*2],ue=p[y*2+1];k.set(se,ue)}p.length=0}const d=k.get(i);if(d===!1)return!1;if(Me(d))return o.index=d,!0;if(d)return o.index=d.index,d.output?.length&&o.output.push(...d.output),!0}const w=o.output.length,ae=n(o);if(u.indexMax=Math.max(u.indexMax,i),ae){const k=o.index,d=o.output.length;if(d>w){const y=o.output.slice(w,d);p.push(i,{index:k,output:y})}else p.push(i,k);return!0}else return p.push(i,!1),!1}}})();c(e=>e({match:s,repeat:E,optional:C,star:O,plus:H,and:v,or:$,jump:Ne,negative:Fe,positive:Ze,lazy:Z}),"grammar");const Z=c(e=>{let t;return n=>(t||(t=g(e())),t(n))},"lazy"),g=Ee(e=>{if(z(e))return we(e)?Z(e):e;if(Y(e)||Oe(e))return s(e);if(X(e))return v(e);if(ze(e))return $(Object.values(e));throw new Error("Invalid rule")});var qe=Object.defineProperty,I=f((e,t)=>qe(e,"name",{value:t,configurable:!0}),"a$3");const b=I(e=>e,"identity"),_e=I(e=>typeof e=="string","isString"),We=I(e=>{const t=new WeakMap,n=new WeakMap;return(r,o)=>{const a=o?.partial?n:t,i=a.get(r);if(i!==void 0)return i;const u=e(r,o);return a.set(r,u),u}},"memoizeByObject"),Le=I(e=>{const t={},n={};return(r,o)=>{const a=o?.partial?n:t;return a[r]??(a[r]=e(r,o))}},"memoizeByPrimitive"),Ue=s(/\\./,b),Te=s(/./,b),Xe=s(/\*\*\*+/,"*"),Ye=s(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),De=s(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),Ge=O($([Ue,Xe,Ye,De,Te]));var He=Object.defineProperty,Je=f((e,t)=>He(e,"name",{value:t,configurable:!0}),"o$3");const Ke=Je(e=>D(e,Ge,{memoization:!1}).join(""),"normalize");var Qe=Object.defineProperty,P=f((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"a$1");const K="abcdefghijklmnopqrstuvwxyz",Ve=P(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=K[n]+t,e=Math.floor((e-1)/26)}return t},"int2alpha"),W=P(e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t=t*26+K.indexOf(e[n])+1;return t},"alpha2int"),q=P((e,t)=>{if(t<e)return q(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"makeRangeInt"),et=P((e,t,n)=>q(e,t).map(r=>String(r).padStart(n,"0")),"makeRangePaddedInt"),Q=P((e,t)=>q(W(e),W(t)).map(Ve),"makeRangeAlpha");var tt=Object.defineProperty,S=f((e,t)=>tt(e,"name",{value:t,configurable:!0}),"l");const l=S(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"regex"),A=S(e=>({children:e}),"alternation"),j=(()=>{const e=S((t,n,r)=>{if(r.has(t))return;r.add(t);const{children:o}=t;if(!o.length)o.push(n);else for(let a=0,i=o.length;a<i;a++)e(o[a],n,r)},"pushToLeaves");return t=>{if(!t.length)return A([]);for(let n=t.length-1;n>=1;n--){const r=new Set,o=t[n-1],a=t[n];e(o,a,r)}return t[0]}})(),x=S(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"slash"),nt=s(/\\./,l),rt=s(/[$.*+?^(){}[\]\|]/,e=>l(`\\${e}`)),ot=s(/[\\\/]/,x),at=s(/[^$.*+?^(){}[\]\|\\\/]+/,l),it=s(/^(?:!!)*!(.*)$/,(e,t)=>l(`(?!^${_.compile(t).source}$).*?`)),st=s(/^(!!)+/),ut=$([it,st]),ct=s(/\/(\*\*\/)+/,()=>A([j([x(),l(".+?"),x()]),x()])),lt=s(/^(\*\*\/)+/,()=>A([l("^"),j([l(".*?"),x()])])),pt=s(/\/(\*\*)$/,()=>A([j([x(),l(".*?")]),l("$")])),ft=s(/\*\*/,()=>l(".*?")),V=$([ct,lt,pt,ft]),$t=s(/\*\/(?!\*\*\/|\*$)/,()=>j([l("[^\\\\/]*?"),x()])),gt=s(/\*/,()=>l("[^\\\\/]*")),ee=$([$t,gt]),te=s("?",()=>l("[^\\\\/]")),dt=s("[",b),ht=s("]",b),xt=s(/[!^]/,"^\\\\/"),mt=s(/[a-z]-[a-z]|[0-9]-[0-9]/i,b),vt=s(/\\./,b),bt=s(/[$.*+?^(){}[\|]/,e=>`\\${e}`),yt=s(/[\\\/]/,"\\\\/"),jt=s(/[^$.*+?^(){}[\]\|\\\/]+/,b),wt=$([vt,bt,yt,mt,jt]),ne=v([dt,C(xt),O(wt),ht],e=>l(e.join(""))),kt=s("{","(?:"),Mt=s("}",")"),zt=s(/(\d+)\.\.(\d+)/,(e,t,n)=>et(+t,+n,Math.min(t.length,n.length)).join("|")),Ot=s(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>Q(t,n).join("|")),Pt=s(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>Q(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),At=$([zt,Ot,Pt]),re=v([kt,At,Mt],e=>l(e.join(""))),Et=s("{"),Rt=s("}"),It=s(","),St=s(/\\./,l),Bt=s(/[$.*+?^(){[\]\|]/,e=>l(`\\${e}`)),Ct=s(/[\\\/]/,x),Nt=s(/[^$.*+?^(){}[\]\|\\\/,]+/,l),Ft=Z(()=>oe),Zt=s("",()=>l("(?:)")),qt=H($([V,ee,te,ne,re,Ft,St,Bt,Ct,Nt]),j),L=$([qt,Zt]),oe=v([Et,C(v([L,O(v([It,L]))])),Rt],A),_t=O($([ut,V,ee,te,ne,re,oe,nt,rt,ot,at]),j);var Wt=Object.defineProperty,Lt=f((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"m");const Ut=Lt(e=>D(e,_t,{memoization:!1})[0],"_parse");var Tt=Object.defineProperty,Xt=f((e,t)=>Tt(e,"name",{value:t,configurable:!0}),"i");const _=Xt((e,t,n)=>_.compile(e,n).test(t),"zeptomatch");_.compile=(()=>{const e=Le((n,r)=>me(Ut(Ke(n)),r)),t=We((n,r)=>ye(n.map(o=>e(o,r))));return(n,r)=>_e(n)?e(n,r):t(n,r)})();export{_ as o};
@@ -0,0 +1,6 @@
1
+ var h=Object.defineProperty;var c=(r,e)=>h(r,"name",{value:e,configurable:!0});import{SpanStatusCode as d}from"@opentelemetry/api";import{definePlugin as p}from"../packem_chunks/applyDefaults.js";var m=Object.defineProperty,b=c((r,e)=>m(r,"name",{value:e,configurable:!0}),"s");class f extends Error{static{c(this,"VisConfigError")}static{b(this,"VisConfigError")}chain;constructor(e,s,t){super(e,t),this.name=this.constructor.name,this.chain=s}}var k=Object.defineProperty,E=c((r,e)=>k(r,"name",{value:e,configurable:!0}),"e");class I extends f{static{c(this,"VisConfigCycleError")}static{E(this,"VisConfigCycleError")}constructor(e,s){const t=[...s,`${e} (re-enters)`].join(" → ");super(`Config cycle: ${t}`,s)}}var $=Object.defineProperty,C=c((r,e)=>$(r,"name",{value:e,configurable:!0}),"t$1");class _ extends f{static{c(this,"VisConfigLoadError")}static{C(this,"VisConfigLoadError")}constructor(e,s,t){const i=t instanceof Error?t.message:String(t),a=s.length>0?`
2
+ Chain: ${s.join(" → ")}`:"";super(`Failed to load ${e}: ${i}${a}`,s,{cause:t})}}var R=Object.defineProperty,g=c((r,e)=>R(r,"name",{value:e,configurable:!0}),"t");const S=g(r=>r.join(" → "),"formatChain");class A extends f{static{c(this,"VisConfigNotFoundError")}static{g(this,"VisConfigNotFoundError")}constructor(e,s,t){const i=s.length>0?s[s.length-1]:"<unknown>",a=t.length>0?`
3
+ Tried:
4
+ ${t.join(`
5
+ `)}`:"";super(`Cannot resolve "${e}" extended from ${i}.${a}
6
+ Chain: ${S(s)}`,s)}}var j=Object.defineProperty,v=c((r,e)=>j(r,"name",{value:e,configurable:!0}),"i$1");const l="@inherit",y=["aliases","dependsOn","inputs","outputs"],O=v((r,e)=>{if(e===void 0)return r===void 0?void 0:[...r];if(!e.includes(l))return[...e];const s=[];for(const t of e){if(t===l){r!==void 0&&s.push(...r);continue}s.push(t)}return s},"mergeArrayWithInherit"),T=v((r,e)=>{const s={...r,...e};for(const t of y){const i=r?.[t],a=e?.[t],o=O(i,a);o===void 0?delete s[t]:s[t]=o}return s},"mergeTargetWithInherit");var P=Object.defineProperty,u=c((r,e)=>P(r,"name",{value:e,configurable:!0}),"i");const N=u(r=>{const{renameSpan:e,tracer:s}=r;let t;const i=new Map;return p({hooks:{"run:after":u(a=>{if(!t)return;const o=[...a.values()].filter(n=>n.status==="failure").length;t.setAttribute("vis.run.tasks_total",a.size),t.setAttribute("vis.run.tasks_failed",o),o>0?t.setStatus({code:d.ERROR,message:`${String(o)} task(s) failed`}):t.setStatus({code:d.OK}),t.end(),t=void 0;for(const n of i.values())n.end();i.clear()},"run:after"),"run:before":u(a=>{t&&(t.setStatus({code:d.ERROR,message:"run:before fired while previous run was still active"}),t.end());for(const o of i.values())o.end();i.clear(),t=s.startSpan("vis.run",{attributes:{"vis.run.task_count":a.tasks.length,"vis.workspace_root":a.workspaceRoot}})},"run:before"),"task:after":u((a,o)=>{const n=i.get(a.id);n&&(n.setAttribute("vis.task.exit_code",o.code??0),n.setAttribute("vis.task.cache_status",o.status),n.end(),i.delete(a.id))},"task:after"),"task:before":u(a=>{const o=i.get(a.id);o&&(o.setStatus({code:d.ERROR,message:"retried — superseded by new attempt"}),o.end());const n=s.startSpan(e?e(a):a.id,{attributes:{"vis.task.id":a.id,"vis.task.project":a.target.project,"vis.task.target":a.target.target}});i.set(a.id,n)},"task:before"),"task:failure":u((a,o)=>{const n=i.get(a.id);n&&n.setStatus({code:d.ERROR,message:`Task failed with exit code ${String(o.code??-1)}`})},"task:failure")},name:"otel"})},"otelPlugin");export{I as V,_ as a,A as b,T as m,N as o};
@@ -0,0 +1 @@
1
+ import"@opentelemetry/api";import"../packem_chunks/applyDefaults.js";import{o as m}from"./otel-DxDUPJJH.js";export{m as otelPlugin};