@visulima/vis 1.0.0-alpha.2 → 1.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/CHANGELOG.md +840 -14
  2. package/LICENSE.md +7667 -0
  3. package/README.md +322 -19
  4. package/dist/bin.js +1 -146
  5. package/dist/config/index.d.ts +2795 -0
  6. package/dist/config/index.js +1 -0
  7. package/dist/generate/index.d.ts +157 -0
  8. package/dist/generate/index.js +1 -0
  9. package/dist/packem_chunks/bin.js +1295 -0
  10. package/dist/packem_chunks/config.js +19 -0
  11. package/dist/packem_chunks/doctor-probe.js +2 -0
  12. package/dist/packem_chunks/fix.js +11 -0
  13. package/dist/packem_chunks/handler.js +1 -0
  14. package/dist/packem_chunks/handler10.js +1 -0
  15. package/dist/packem_chunks/handler11.js +5 -0
  16. package/dist/packem_chunks/handler12.js +1 -0
  17. package/dist/packem_chunks/handler13.js +27 -0
  18. package/dist/packem_chunks/handler14.js +5 -0
  19. package/dist/packem_chunks/handler15.js +1 -0
  20. package/dist/packem_chunks/handler16.js +1 -0
  21. package/dist/packem_chunks/handler17.js +1 -0
  22. package/dist/packem_chunks/handler18.js +1 -0
  23. package/dist/packem_chunks/handler19.js +1 -0
  24. package/dist/packem_chunks/handler2.js +2 -0
  25. package/dist/packem_chunks/handler20.js +5 -0
  26. package/dist/packem_chunks/handler21.js +2 -0
  27. package/dist/packem_chunks/handler22.js +2 -0
  28. package/dist/packem_chunks/handler23.js +18 -0
  29. package/dist/packem_chunks/handler24.js +1 -0
  30. package/dist/packem_chunks/handler25.js +1 -0
  31. package/dist/packem_chunks/handler26.js +5 -0
  32. package/dist/packem_chunks/handler27.js +1 -0
  33. package/dist/packem_chunks/handler28.js +3 -0
  34. package/dist/packem_chunks/handler29.js +1 -0
  35. package/dist/packem_chunks/handler3.js +4 -0
  36. package/dist/packem_chunks/handler30.js +7 -0
  37. package/dist/packem_chunks/handler31.js +33 -0
  38. package/dist/packem_chunks/handler32.js +3 -0
  39. package/dist/packem_chunks/handler33.js +1 -0
  40. package/dist/packem_chunks/handler34.js +26 -0
  41. package/dist/packem_chunks/handler35.js +3 -0
  42. package/dist/packem_chunks/handler36.js +7 -0
  43. package/dist/packem_chunks/handler37.js +22 -0
  44. package/dist/packem_chunks/handler38.js +428 -0
  45. package/dist/packem_chunks/handler39.js +6 -0
  46. package/dist/packem_chunks/handler4.js +8 -0
  47. package/dist/packem_chunks/handler40.js +24 -0
  48. package/dist/packem_chunks/handler41.js +10 -0
  49. package/dist/packem_chunks/handler42.js +153 -0
  50. package/dist/packem_chunks/handler43.js +25 -0
  51. package/dist/packem_chunks/handler44.js +24 -0
  52. package/dist/packem_chunks/handler45.js +213 -0
  53. package/dist/packem_chunks/handler46.js +3 -0
  54. package/dist/packem_chunks/handler47.js +27 -0
  55. package/dist/packem_chunks/handler48.js +167 -0
  56. package/dist/packem_chunks/handler49.js +34 -0
  57. package/dist/packem_chunks/handler5.js +1 -0
  58. package/dist/packem_chunks/handler6.js +1 -0
  59. package/dist/packem_chunks/handler7.js +1 -0
  60. package/dist/packem_chunks/handler8.js +1 -0
  61. package/dist/packem_chunks/handler9.js +2 -0
  62. package/dist/packem_chunks/heal-accept.js +10 -0
  63. package/dist/packem_chunks/heal.js +14 -0
  64. package/dist/packem_chunks/help-command.js +18 -0
  65. package/dist/packem_chunks/index.js +7 -0
  66. package/dist/packem_chunks/keys-refresh.js +4 -0
  67. package/dist/packem_chunks/list.js +3 -0
  68. package/dist/packem_chunks/loader.js +1 -0
  69. package/dist/packem_chunks/prune.js +3 -0
  70. package/dist/packem_chunks/run.js +1 -0
  71. package/dist/packem_chunks/status.js +2 -0
  72. package/dist/packem_chunks/sync.js +2 -0
  73. package/dist/packem_chunks/sync2.js +2 -0
  74. package/dist/packem_chunks/tar.js +3 -0
  75. package/dist/packem_chunks/tripwire.js +2 -0
  76. package/dist/packem_shared/advisories-DsynpacV.js +1 -0
  77. package/dist/packem_shared/ai-analysis-uYuTIIXi.js +68 -0
  78. package/dist/packem_shared/ai-cache-DuwHYx2O.js +1 -0
  79. package/dist/packem_shared/ai-fix-DzrA-dVz.js +43 -0
  80. package/dist/packem_shared/applyDefaults-BOVDw1jD.js +1 -0
  81. package/dist/packem_shared/build-scripts-DsWMSWDs.js +1 -0
  82. package/dist/packem_shared/cache-directory-DQak1Vjc.js +1 -0
  83. package/dist/packem_shared/cyclonedx-CiHXuG8M.js +4 -0
  84. package/dist/packem_shared/definePlugin-CWm4Dv_t.js +1 -0
  85. package/dist/packem_shared/dependency-scan-DC3nAFHS.js +1 -0
  86. package/dist/packem_shared/docker-B-CIN_nj.js +60 -0
  87. package/dist/packem_shared/failure-log-C3LEMmkq.js +2 -0
  88. package/dist/packem_shared/flakiness-Dq6K4ymq.js +1 -0
  89. package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
  90. package/dist/packem_shared/glob-MHJQjR39-CQ2GC0b_.js +1 -0
  91. package/dist/packem_shared/index-DH-5hsrC.js +1 -0
  92. package/dist/packem_shared/lifecycle-Dv3nAtoD.js +2 -0
  93. package/dist/packem_shared/lockfile-C5DYMHVq.js +1 -0
  94. package/dist/packem_shared/manifests-B0fMp872.js +1 -0
  95. package/dist/packem_shared/min-release-age-BFozFonQ.js +34 -0
  96. package/dist/packem_shared/native-config-sync-Dvi1g2nQ.js +21 -0
  97. package/dist/packem_shared/otelPlugin-CJR2T_lk.js +1 -0
  98. package/dist/packem_shared/registry-keys-CewRFW0e.js +1 -0
  99. package/dist/packem_shared/resolve-explicit-CC4Kifk5.js +5 -0
  100. package/dist/packem_shared/run-summary-utils-BaBGP3bo.js +1 -0
  101. package/dist/packem_shared/runtime-check-BusAwPb2.js +1 -0
  102. package/dist/packem_shared/scan-progress-CMynp3eA.js +2 -0
  103. package/dist/packem_shared/selectors-B2ISH581.js +3 -0
  104. package/dist/packem_shared/signatures-5ZdjJ2Pu.js +2 -0
  105. package/dist/packem_shared/symbols-CQmER5MT.js +1 -0
  106. package/dist/packem_shared/toolchain-Cc3cwyLP.js +5 -0
  107. package/dist/packem_shared/typosquats-BCeR-sLf.js +1 -0
  108. package/dist/packem_shared/use-measured-height-DjYgUOKk.js +1 -0
  109. package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
  110. package/dist/packem_shared/verify-07kUNTuP.js +1 -0
  111. package/dist/packem_shared/vis-update-app-CFrlJ3mW.js +1 -0
  112. package/dist/packem_shared/xxh3-DrAUNq4n.js +1 -0
  113. package/index.d.ts +358 -0
  114. package/index.js +609 -0
  115. package/package.json +57 -22
  116. package/schemas/project.schema.json +872 -0
  117. package/schemas/vis-config.schema.json +4306 -0
  118. package/skills/vis/SKILL.md +96 -0
  119. package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
  120. package/templates/buildkite-ci/template.yml +20 -0
  121. package/dist/ai-analysis.d.ts +0 -40
  122. package/dist/ai-cache.d.ts +0 -21
  123. package/dist/bin.d.ts +0 -1
  124. package/dist/catalog.d.ts +0 -110
  125. package/dist/commands/affected.d.ts +0 -3
  126. package/dist/commands/ai.d.ts +0 -3
  127. package/dist/commands/analyze.d.ts +0 -3
  128. package/dist/commands/check.d.ts +0 -3
  129. package/dist/commands/graph.d.ts +0 -3
  130. package/dist/commands/hook/constants.d.ts +0 -8
  131. package/dist/commands/hook/index.d.ts +0 -3
  132. package/dist/commands/hook/install.d.ts +0 -7
  133. package/dist/commands/hook/migrate.d.ts +0 -27
  134. package/dist/commands/hook/uninstall.d.ts +0 -3
  135. package/dist/commands/migrate/constants.d.ts +0 -12
  136. package/dist/commands/migrate/deps.d.ts +0 -32
  137. package/dist/commands/migrate/index.d.ts +0 -3
  138. package/dist/commands/migrate/json.d.ts +0 -20
  139. package/dist/commands/migrate/lint-staged.d.ts +0 -62
  140. package/dist/commands/migrate/types.d.ts +0 -20
  141. package/dist/commands/run.d.ts +0 -3
  142. package/dist/commands/staged.d.ts +0 -3
  143. package/dist/commands/update.d.ts +0 -3
  144. package/dist/config.d.ts +0 -40
  145. package/dist/config.js +0 -1
  146. package/dist/package-manager.d.ts +0 -23
  147. package/dist/workspace.d.ts +0 -58
@@ -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,2 @@
1
+ var y=Object.defineProperty;var d=(r,n)=>y(r,"name",{value:n,configurable:!0});import{createRequire as w}from"node:module";import{M as u,i as f,n as m,B as k}from"./config.js";import{p as e,A as j}from"./bin.js";const v=w(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=d(r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[n,s]=c.versions.node.split(".").map(Number);if(n>22||n===22&&s>=3||n===20&&s>=16)return c.getBuiltinModule(r)}return v(r)},"__cjs_getBuiltinModule"),{spawnSync:$}=h("node:child_process");var _=Object.defineProperty,l=d((r,n)=>_(r,"name",{value:n,configurable:!0}),"c");const t="@lavamoat/preinstall-always-fail",p=l(r=>{const n=u(r,"package.json");if(!f(n))return"no-package-json";try{const s=m(n);if(s.devDependencies?.[t]||s.dependencies?.[t])return"installed"}catch{}return"missing"},"tripwireStatus"),b=l(r=>{const n=u(r,"package.json");if(!f(n))return!1;try{const s=m(n);let a=!1;const o=l(i=>!i||!(t in i)?i:(a=!0,Object.fromEntries(Object.entries(i).filter(([g])=>g!==t))),"stripFrom");return s.devDependencies=o(s.devDependencies),s.dependencies=o(s.dependencies),a&&k(n,`${JSON.stringify(s,null,2)}
2
+ `),a}catch{return!1}},"removeFromPackageJson"),P=l(({options:r,workspaceRoot:n})=>{const s=n??process.cwd();if(r.status){switch(p(s)){case"installed":{e.success(`Preinstall tripwire is installed (${t}).`),e.info("Removing 'ignore-scripts=true' will cause future installs to fail loudly.");break}case"missing":{e.warn("Preinstall tripwire is not installed."),e.info(`Run 'vis security tripwire' to add ${t} as a devDependency.`);break}default:e.error("No package.json found at the workspace root."),process.exitCode=1}return}if(r.remove){b(s)?e.success(`Removed ${t} from package.json. Run your PM's install to clean node_modules.`):e.info(`${t} was not present in package.json.`);return}if(p(s)==="installed"){e.info(`${t} is already installed.`);return}const a=j(s),o={bun:["add","-d",t],npm:["install","--save-dev",t],pnpm:["add","-D","-w",t],yarn:["add","-D",t]}[a.name];if(!o){e.error(`Cannot install tripwire — unsupported package manager '${a.name}'.`),process.exitCode=1;return}e.info(`Installing ${t} via ${a.name}…`);const i=$(a.name,o,{cwd:s,stdio:"inherit"});if(i.error){e.error(`Failed to install tripwire: ${i.error.message}`),process.exitCode=1;return}if(i.signal!==null){e.error(`${a.name} was terminated by signal ${i.signal}`),process.exitCode=1;return}if(i.status!==0){e.error(`${a.name} exited with code ${String(i.status)}`),process.exitCode=i.status??1;return}e.success(`Installed ${t} as a devDependency.`),e.notice(""),e.notice("How the tripwire works:"),e.notice(` ${t} declares a preinstall script that always fails.`),e.notice(" When 'ignore-scripts=true' is set (.npmrc / bunfig.toml / .yarnrc.yml),"),e.notice(" the script is skipped and installs succeed normally. If someone deletes"),e.notice(" that setting, the next install fails — loudly — instead of silently"),e.notice(" running every dependency's lifecycle scripts.")},"execute");export{P as default};
@@ -0,0 +1 @@
1
+ var I=Object.defineProperty;var d=(s,e)=>I(s,"name",{value:e,configurable:!0});import{createRequire as $}from"node:module";import{K as j}from"../packem_chunks/config.js";import{advisoriesStatus as E,NATIVE_BINDING_VERSION as A,advisoriesIngest as q,advisoriesQuery as B}from"#native";const T=$(import.meta.url),v=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=d(s=>{if(typeof v<"u"&&v.versions&&v.versions.node){const[e,t]=v.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return v.getBuiltinModule(s)}return T(s)},"__cjs_getBuiltinModule"),{randomUUID:O}=l("node:crypto"),{createWriteStream:P,existsSync:k}=l("node:fs"),{mkdir:U,unlink:x,stat:C}=l("node:fs/promises"),{join:w,dirname:L}=l("node:path"),{Readable:M}=l("node:stream"),{pipeline:W}=l("node:stream/promises");var F=Object.defineProperty,r=d((s,e)=>F(s,"name",{value:e,configurable:!0}),"s");const b=4;if(A!==b)throw new Error(`vis native binding ABI mismatch in advisories: expected ${b}, got ${A}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const es="https://osv-vulnerabilities.storage.googleapis.com",V=new Set(["osv-vulnerabilities.storage.googleapis.com"]);class H extends Error{static{d(this,"AdvisoryDbNotFoundError")}static{r(this,"AdvisoryDbNotFoundError")}cause="DB_NOT_FOUND";constructor(e){super(`No local advisory DB at ${e}. Run 'vis advisories sync' first.`),this.name="AdvisoryDbNotFoundError"}}class p extends Error{static{d(this,"AdvisorySourceNotAllowedError")}static{r(this,"AdvisorySourceNotAllowedError")}cause="SOURCE_NOT_ALLOWED";constructor(e){super(`Advisory source host '${e}' is not in the built-in allowlist. Add it to \`security.audit.advisories.allowedHosts\` if intentional.`),this.name="AdvisorySourceNotAllowedError"}}class N extends Error{static{d(this,"AdvisorySyncNetworkError")}static{r(this,"AdvisorySyncNetworkError")}cause="SYNC_NETWORK";constructor(e,t){super(`Advisory sync failed for ${e}: ${t}. Check connectivity, proxy env vars, or --source.`),this.name="AdvisorySyncNetworkError"}}const g=r(s=>{const e=j("vis",{create:!0,cwd:s})??w(s,"node_modules",".cache","vis");return w(e,"advisories","db.sqlite")},"resolveAdvisoryDbPath"),z=r((s,e)=>{let t;try{t=new URL(s)}catch{throw new p(s)}if(t.protocol!=="https:")throw new p(`${t.protocol}//${t.host}`);if(!new Set([...V,...e??[]]).has(t.host))throw new p(t.host);return t},"validateAdvisorySource"),ts=r(async s=>{const e=s.dbPath??g(s.workspaceRoot);await U(L(e),{recursive:!0});const t=z(s.source,s.allowedHosts),u=new URL(`${s.ecosystem}/all.zip`,Q(t.toString())),y=await K(e,s.ecosystem);let i=null;if(!s.force){const n=await S(u,{method:"HEAD"});if(n.ok&&(i=n.headers.get("etag"),i&&y&&i===y))return{advisoriesIngested:0,dbPath:e,durationMs:0,upToDate:!0}}const a=`${e}.${s.ecosystem}.${process.pid}.${O()}.zip.tmp`,o=await S(u,{method:"GET"});if(!o.ok||!o.body)throw new N(u.toString(),o.status);i||(i=o.headers.get("etag"));const m=o.headers.get("content-length"),c=m?Number.parseInt(m,10):null;let h=0;const _=P(a),f=M.fromWeb(o.body);s.onProgress&&c&&f.on("data",n=>{h+=n.byteLength,s.onProgress?.(h,c,"download")}),await W(f,_);try{const n=await q({dbPath:e,ecosystem:s.ecosystem,manifestEtag:i??void 0,zipPath:a},(D,R)=>s.onProgress?.(D,R,"ingest"));return{advisoriesIngested:n.advisoriesIngested,dbPath:e,durationMs:n.durationMs,upToDate:!1}}finally{await x(a).catch(()=>{})}},"syncAdvisories"),rs=r((s,e)=>{if(s.length===0)return new Map;const t=e.dbPath??g(e.workspaceRoot),u=e.ecosystem??"npm";if(!k(t))throw new H(t);const y=s.map(o=>({ecosystem:u,name:o.name,version:o.version})),i=B(t,y),a=new Map;for(const[o,m]of s.entries()){const c=i[o];!c||c.vulnerabilities.length===0||a.set(m.name,c.vulnerabilities.map(h=>G(h)))}return a},"queryAdvisories"),os=r(async(s,e)=>{const t=e??g(s);return E(t)},"getAdvisoryStatus"),K=r(async(s,e)=>{try{await C(s)}catch{return null}return E(s).ecosystems.find(t=>t.name===e)?.manifestEtag??null},"readStoredEtag"),G=r(s=>({aliases:s.aliases.length>0?s.aliases:void 0,cvssScore:s.cvssScore??void 0,fixedVersions:s.fixedVersions,id:s.id,severity:Y(s.severity),summary:s.summary}),"toSecurityVulnerability"),Y=r(s=>{const e=s.toUpperCase();return e==="CRITICAL"||e==="HIGH"||e==="MODERATE"||e==="LOW"?e:"UNKNOWN"},"normalizeSeverity"),Q=r(s=>s.endsWith("/")?s:`${s}/`,"ensureTrailingSlash"),S=r(async(s,e)=>{try{return await fetch(s,e)}catch(t){throw new N(s.toString(),t instanceof Error?t.message:String(t))}},"safeFetch");export{H as A,es as D,os as g,rs as q,g as r,ts as s};
@@ -0,0 +1,68 @@
1
+ var H=Object.defineProperty;var k=(e,r)=>H(e,"name",{value:r,configurable:!0});import{createRequire as B}from"node:module";import{renderToString as z}from"@visulima/tui";import{Box as U}from"@visulima/tui/components/box";import{Table as W}from"@visulima/tui/components/table";import{Text as y}from"@visulima/tui/components/text";import v from"react";import{k as K,T as G,R as Y,j as X}from"./ai-cache-DuwHYx2O.js";const F=B(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=k(e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[r,a]=w.versions.node.split(".").map(Number);if(r>22||r===22&&a>=3||r===20&&a>=16)return w.getBuiltinModule(e)}return F(e)},"__cjs_getBuiltinModule"),{spawn:D,execFileSync:O}=$("node:child_process"),{existsSync:T}=$("node:fs"),{platform:J,homedir:R}=$("node:os"),{join:g}=$("node:path"),Q=/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/,Z=5e3,ee=1e4,re=3e5,te=4096,E=J()==="win32",M=["amp","claude","codex","copilot","crush","cursor","droid","gemini","kimi","opencode","qwen"];var ae=Object.defineProperty,ne=k((e,r)=>ae(e,"name",{value:r,configurable:!0}),"A$1"),ie=Object.defineProperty,m=ne((e,r)=>ie(e,"name",{value:r,configurable:!0}),"o"),oe=Object.defineProperty,se=m((e,r)=>oe(e,"name",{value:r,configurable:!0}),"a$6");const ce={alternateCommands:[],buildArgs:se((e,r,a)=>["-x",e,"--dangerously-allow-all"],"buildArgs"),command:"amp",defaultModel:"",envVariable:"AMP_PATH"};var le=Object.defineProperty,ue=m((e,r)=>le(e,"name",{value:r,configurable:!0}),"t$8");const de={alternateCommands:[],buildArgs:ue((e,r,a)=>["--dangerously-skip-permissions","--model",r,"--output-format","text","-p",e],"buildArgs"),command:"claude",defaultModel:"claude-sonnet-4-20250514",envVariable:"CLAUDE_PATH"};var me=Object.defineProperty,pe=m((e,r)=>me(e,"name",{value:r,configurable:!0}),"a$4");const ge={alternateCommands:["openai-codex"],buildArgs:pe((e,r,a)=>[e,"--approval-mode","full-auto","--quiet","--model",r,"--max-tokens",String(a)],"buildArgs"),command:"codex",defaultModel:"o3",envVariable:"CODEX_PATH"};var fe=Object.defineProperty,he=m((e,r)=>fe(e,"name",{value:r,configurable:!0}),"l");const ve={alternateCommands:[],buildArgs:he((e,r,a)=>{const t=["-p",e,"--allow-all-tools"];return r&&t.push("--model",r),t},"buildArgs"),command:"copilot",defaultModel:"",envVariable:"COPILOT_PATH"};var ye=Object.defineProperty,be=m((e,r)=>ye(e,"name",{value:r,configurable:!0}),"n$2");const ke={alternateCommands:[],buildArgs:be((e,r,a)=>{const t=["run","--yolo"];return r&&t.push("-m",r),t.push(e),t},"buildArgs"),command:"crush",defaultModel:"",envVariable:"CRUSH_PATH"};var we=Object.defineProperty,Ae=m((e,r)=>we(e,"name",{value:r,configurable:!0}),"t$5");const $e={alternateCommands:["cursor"],buildArgs:Ae((e,r,a)=>{const t=["-p","--force","--output-format","text"];return r&&t.push("--model",r),t.push(e),t},"buildArgs"),command:"agent",defaultModel:"",envVariable:"CURSOR_PATH"};var Se=Object.defineProperty,Pe=m((e,r)=>Se(e,"name",{value:r,configurable:!0}),"i");const Te={alternateCommands:[],buildArgs:Pe((e,r,a)=>{const t=[e,"--skip-permissions-unsafe","-o","text"];return r&&t.push("-m",r),t},"buildArgs"),command:"droid",defaultModel:"",envVariable:"DROID_PATH"};var Ce=Object.defineProperty,je=m((e,r)=>Ce(e,"name",{value:r,configurable:!0}),"o$1");const Oe={alternateCommands:["gemini-cli"],buildArgs:je((e,r,a)=>["--sandbox","--model",r,"--max-output-tokens",String(a),"-p",e],"buildArgs"),command:"gemini",defaultModel:"gemini-2.5-pro",envVariable:"GEMINI_PATH"};var Re=Object.defineProperty,Ee=m((e,r)=>Re(e,"name",{value:r,configurable:!0}),"o");const Me={alternateCommands:[],buildArgs:Ee((e,r,a)=>{const t=["--quiet","-p",e];return r&&t.push("-m",r),t},"buildArgs"),command:"kimi",defaultModel:"",envVariable:"KIMI_PATH"};var xe=Object.defineProperty,_e=m((e,r)=>xe(e,"name",{value:r,configurable:!0}),"r");const Ie={alternateCommands:[],buildArgs:_e((e,r,a)=>{const t=["run",e];return r&&t.push("-m",r),t},"buildArgs"),command:"opencode",defaultModel:"anthropic/claude-sonnet-4",envVariable:"OPENCODE_PATH"};var Ne=Object.defineProperty,Le=m((e,r)=>Ne(e,"name",{value:r,configurable:!0}),"n");const qe={alternateCommands:["qwen-code"],buildArgs:Le((e,r,a)=>["-p",e,"--yolo","-o","text"],"buildArgs"),command:"qwen",defaultModel:"",envVariable:"QWEN_PATH"};var Ve=Object.defineProperty,f=m((e,r)=>Ve(e,"name",{value:r,configurable:!0}),"s");const x={amp:ce,claude:de,codex:ge,copilot:ve,crush:ke,cursor:$e,droid:Te,gemini:Oe,kimi:Me,opencode:Ie,qwen:qe},C=f(e=>e.startsWith("~")?g(R(),e.slice(1)):e,"resolveHome"),He=f(e=>{try{const r=O(E?"where":"which",[e],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:Z}).trim().split(`
2
+ `)[0]?.trim();return r&&r.length>0?r:void 0}catch{return}},"whichCommand"),Be=f(e=>{const r=R();if(E){const a=process.env.APPDATA??"",t=process.env.LOCALAPPDATA??"",n=process.env.ProgramFiles??"";return[g(a,"npm",`${e}.cmd`),g(a,"npm",e),g(t,"Programs",e,`${e}.exe`),g(n,e,`${e}.exe`),g(r,".npm-global","bin",`${e}.cmd`)]}return[`/opt/homebrew/bin/${e}`,`/usr/local/bin/${e}`,g(r,".npm-global","bin",e),g(r,".local","bin",e),g(r,".cargo","bin",e)]},"getKnownPaths"),S=f(e=>{try{const r=O(e,["--version"],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:ee}),a=Q.exec(r);return a?a[1]:void 0}catch{return}},"detectVersion"),_=f(e=>{const r=x[e],a={available:!1,name:e},t=process.env[r.envVariable];if(t&&T(C(t))){const i=C(t);return{...a,available:!0,detectionMethod:"envvar",path:i,version:S(i)}}const n=[r.command,...r.alternateCommands];for(const i of n){const o=He(i);if(o)return{...a,available:!0,detectionMethod:"which",path:o,version:S(o)}}for(const i of n)for(const o of Be(i))if(T(o))return{...a,available:!0,detectionMethod:"known-path",path:o,version:S(o)};return a},"detectProvider"),Fe=f(()=>M.map(e=>_(e)),"detectAllProviders"),De=f(()=>Fe().filter(e=>e.available),"detectAvailableProviders"),Je=f((e,r,a={})=>{const t=x[e],n=a.model??t.defaultModel,i=a.maxTokens??te;return t.buildArgs(r,n,i)},"buildCliArgs"),ze=f(async(e,r,a={})=>{if(!e.available||!e.path)throw new Error(`AI provider "${e.name}" is not available.`);const t=Je(e.name,r,a),n=a.timeoutMs??re;return new Promise((i,o)=>{const p={env:{...process.env,FORCE_COLOR:"0",NO_COLOR:"1"},stdio:["pipe","pipe","pipe"]},s=D(e.path,t,p);s.stdin.end();let c="",d="",u=!1;const b=setTimeout(()=>{u=!0,s.kill("SIGTERM"),o(new Error(`${e.name} CLI timed out after ${String(n)}ms`))},n);s.stdout.on("data",h=>{c+=h.toString("utf8")}),s.stderr.on("data",h=>{d+=h.toString("utf8")}),s.on("close",h=>{clearTimeout(b),!u&&(h===0?i({provider:e.name,stderr:d,stdout:c}):o(new Error(`${e.name} CLI exited with code ${String(h)}: ${d||c}`)))}),s.on("error",h=>{clearTimeout(b),u||o(new Error(`Failed to spawn ${e.name} CLI: ${h.message}`))})})},"runProvider");var Ue=Object.defineProperty,I=k((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"i");const We=12e4,Ke=2,Ge=1e3,Ye=I(e=>new Promise(r=>{setTimeout(r,e)}),"sleep"),N=I(async(e,r,a=Ke)=>{let t;for(let n=0;n<=a;n+=1)try{return(await ze(e,r,{timeoutMs:We})).stdout}catch(i){if(t=i instanceof Error?i:new Error(String(i)),t.message.includes("timed out"))throw t;if(n<a){const o=Ge*2**n;await Ye(o)}}throw t??new Error("AI request failed after retries")},"runWithRetry");var Xe=Object.defineProperty,l=k((e,r)=>Xe(e,"name",{value:r,configurable:!0}),"c");const Qe={amp:30,claude:80,codex:60,copilot:50,crush:35,cursor:40,droid:20,gemini:100,kimi:25,opencode:35,qwen:30},Ze=l(e=>{if(e?.provider){if(!M.includes(e.provider))return;const t=_(e.provider);return t.available?t:void 0}const r=De();if(r.length===0)return;const a={...Qe,...e?.priority};return r.toSorted((t,n)=>(a[n.name]??0)-(a[t.name]??0))[0]},"resolveProvider"),er=new Set(["defer","review","skip","update"]),rr=new Set(["critical","high","low","medium"]),tr=new Set(["high","low","medium"]),ar=50,P=30,nr=l(e=>e.map(r=>{const a=r.vulnerabilities&&r.vulnerabilities.length>0?` [VULNERABILITIES: ${r.vulnerabilities.map(n=>`${n.severity} ${n.id}`).join(", ")}]`:"";let t="";if(r.socketReport){const n=Math.round(r.socketReport.score.overall*100),i=[`score:${String(n)}%`];if(r.socketReport.alerts.length>0){const o={};for(const s of r.socketReport.alerts)o[s.severity]=(o[s.severity]??0)+1;const p=Object.entries(o).map(([s,c])=>`${String(c)} ${s}`).join(", ");i.push(`alerts: ${p}`)}i.push(`supply-chain:${String(Math.round(r.socketReport.score.supplyChain*100))}%`),i.push(`quality:${String(Math.round(r.socketReport.score.quality*100))}%`),t=` [SOCKET.DEV: ${i.join(", ")}]`}return`- ${r.packageName}: ${r.currentRange} → ${r.newRange} (${r.updateType})${a}${t}`}).join(`
3
+ `),"buildPackageList"),A=`Respond ONLY with valid JSON in this exact structure:
4
+ {
5
+ "summary": "Brief overall summary",
6
+ "recommendations": [
7
+ {
8
+ "package": "package-name",
9
+ "action": "update|skip|review|defer",
10
+ "reason": "explanation",
11
+ "riskLevel": "low|medium|high|critical",
12
+ "breakingChanges": ["change1"],
13
+ "effort": "low|medium|high"
14
+ }
15
+ ],
16
+ "warnings": ["warning1"]
17
+ }`,ir={compatibility:l(e=>`Analyze the compatibility of these package updates:
18
+
19
+ ${e}
20
+
21
+ For each package:
22
+ 1. Check peer dependency compatibility
23
+ 2. Identify potential conflicts with other packages in the list
24
+ 3. Assess API compatibility between current and target versions
25
+ 4. Check for deprecated features being removed
26
+ 5. Evaluate Node.js version requirements
27
+
28
+ ${A}`,"compatibility"),impact:l(e=>`Analyze the impact of updating these npm packages:
29
+
30
+ ${e}
31
+
32
+ For each package, provide:
33
+ 1. Risk level (low/medium/high/critical)
34
+ 2. Recommended action (update/skip/review/defer)
35
+ 3. Reason for recommendation
36
+ 4. Known breaking changes (if any)
37
+ 5. Estimated migration effort (low/medium/high)
38
+
39
+ ${A}`,"impact"),recommend:l(e=>`Provide smart recommendations for updating these packages:
40
+
41
+ ${e}
42
+
43
+ Consider:
44
+ 1. Update priority based on security, features, and stability
45
+ 2. Grouping related packages for atomic updates
46
+ 3. Best practices for the specific package ecosystem
47
+ 4. Risk vs. benefit analysis
48
+ 5. Suggested update order
49
+ 6. If Socket.dev scores are provided, prioritize packages with low supply chain or quality scores
50
+
51
+ ${A}`,"recommend"),security:l(e=>`Analyze the security implications of these package updates:
52
+
53
+ ${e}
54
+
55
+ For each package:
56
+ 1. Check if the update fixes known vulnerabilities (use the vulnerability data above)
57
+ 2. Assess if the new version introduces security risks
58
+ 3. Evaluate if this is a security-sensitive package (auth, crypto, session, etc.)
59
+ 4. Recommend urgency of the update based on vulnerability severity
60
+ 5. Flag any packages where skipping the update poses security risk
61
+ 6. If Socket.dev scores are provided, factor in supply chain and quality scores — low scores indicate higher risk
62
+
63
+ ${A}`,"security")},or=new Set(["compatibility","impact","recommend","security"]),$r=l(e=>or.has(e)?e:"impact","validateAnalysisType"),L=l((e,r="impact")=>{const a=nr(e);return ir[r](a)},"buildAnalysisPrompt"),sr=/```(?:json)?\s*([\s\S]*?)```/,cr=/\{[\s\S]*\}/,lr=l(e=>{try{return JSON.parse(e)}catch{}const r=sr.exec(e);if(r?.[1])try{return JSON.parse(r[1])}catch{}const a=cr.exec(e);if(a?.[0])try{return JSON.parse(a[0])}catch{}},"extractJson"),ur=l(e=>({action:er.has(e.action)?e.action:"review",breakingChanges:Array.isArray(e.breakingChanges)?e.breakingChanges:[],effort:tr.has(e.effort)?e.effort:"medium",package:typeof e.package=="string"?e.package:"",reason:typeof e.reason=="string"?e.reason:"",riskLevel:rr.has(e.riskLevel)?e.riskLevel:"medium"}),"normalizeRecommendation"),q=l((e,r,a)=>{const t=lr(e);if(!t||typeof t!="object")return{analysisType:a,provider:r,recommendations:[],summary:"Failed to parse AI response.",warnings:["AI response was not valid JSON."]};const n=t,i=Array.isArray(n.recommendations)?n.recommendations:[];return{analysisType:a,provider:r,recommendations:i.map(o=>ur(o)),summary:typeof n.summary=="string"?n.summary:"",warnings:Array.isArray(n.warnings)?n.warnings:[]}},"parseAiResponse"),dr={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"]},mr=new Set(["bcrypt","cors","crypto-js","express-session","helmet","jose","jsonwebtoken","node-forge","oauth","passport"]),j=l((e,r)=>{const a=e.map(t=>{const n=t.vulnerabilities&&t.vulnerabilities.length>0,i=mr.has(t.packageName),o=dr[t.packageName]??[];let p="low",s="update",c="low",d="Patch/minor update, safe to apply.";return t.updateType==="major"?(p="high",s=o.length>0?"review":"update",c="medium",d=o.length>0?`Major update with known breaking changes: ${o[0]}`:"Major version update, review changelog before applying."):t.updateType==="minor"&&(p="medium",d="Minor update, generally safe."),n&&(p="high",s="update",d="Security update — current version has known vulnerabilities."),i&&t.updateType==="major"&&(s="review",d="Security-sensitive package with major update, careful review needed.",c="high"),{action:s,breakingChanges:o,effort:c,package:t.packageName,reason:d,riskLevel:p}});return{analysisType:r,provider:"rule-engine",recommendations:a,summary:`Rule-based ${r} analysis for ${String(e.length)} packages.`,warnings:["No AI provider available — using built-in rule engine."]}},"ruleBasedAnalysis"),pr=l(async(e,r,a)=>{const t=L(r,a),n=await N(e,t);return q(n,e.name,a)},"analyzeChunk"),gr=l((e,r,a)=>{const t=[],n=[],i=[];for(const o of e)t.push(...o.recommendations),n.push(...o.warnings),o.summary&&i.push(o.summary);return{analysisType:a,provider:r,recommendations:t,summary:i.length===1?i[0]??"":`Analyzed ${String(t.length)} packages in ${String(e.length)} batches.`,warnings:[...new Set(n)]}},"mergeResults"),V={compatibility:"Compatibility",impact:"Impact",recommend:"Recommendations",security:"Security"},Sr=l(e=>{const r=`${V[e.analysisType]??e.analysisType} Analysis (${e.provider})`,a=e.recommendations.flatMap(n=>{const i=[{action:n.action,effort:n.effort,package:n.package,reason:n.reason,risk:n.riskLevel}];return n.breakingChanges.length>0&&i.push({action:"",effort:"",package:"",reason:`Breaking: ${n.breakingChanges.join("; ")}`,risk:""}),i}),t=process.stdout.columns||80;return z(v.createElement(U,{borderStyle:"round",flexDirection:"column",paddingLeft:1,paddingRight:1},v.createElement(y,{bold:!0},r),v.createElement(y,null,""),v.createElement(y,null,e.summary),v.createElement(y,null,""),v.createElement(W,{borderStyle:"none",data:a}),...e.warnings.length>0?[v.createElement(y,null,""),...e.warnings.map((n,i)=>v.createElement(y,{dimColor:!0,key:String(i)},` ${n}`))]:[]),{columns:t})},"formatAiAnalysis");l(e=>JSON.stringify(e,void 0,2),"formatAiAnalysisJson");const Pr=l(async(e,r,a,t="impact")=>{const n=Ze(a);if(!n)return r.info(`No AI CLI tool found, using rule-based analysis.
64
+ `),j(e,t);const i=K(n.name,t,e),o=G(i);if(o)return r.info(`Using cached ${t} analysis from ${o.provider}.
65
+ `),o;const p=V[t]??t;r.info(`Running ${p.toLowerCase()} analysis with ${n.name}...
66
+ `);try{let s;if(e.length>ar){r.info(`Splitting ${String(e.length)} packages into batches of ${String(P)}...
67
+ `);const c=[];for(let u=0;u<e.length;u+=P)c.push(e.slice(u,u+P));const d=[];for(let u=0;u<c.length;u+=1){r.info(` Batch ${String(u+1)}/${String(c.length)}...`);const b=c[u];b&&d.push(await pr(n,b,t))}s=gr(d,n.name,t)}else{const c=await N(n,L(e,t));s=q(c,n.name,t)}return Y(i,s,X(t,a?.cacheTtl)),s}catch(s){const c=s instanceof Error?s.message:String(s);return r.warn(`AI analysis failed (${c}), falling back to rule engine.
68
+ `),j(e,t)}},"runAiAnalysis");export{$r as H,ze as O,Qe as R,Sr as Z,Fe as _,Ze as b,Pr as e,N as r,lr as w};
@@ -0,0 +1 @@
1
+ var S=Object.defineProperty;var g=(t,e)=>S(t,"name",{value:e,configurable:!0});import{createRequire as _}from"node:module";import{X as v}from"./xxh3-DrAUNq4n.js";import{M as c,b as w,i as d,n as j}from"../packem_chunks/config.js";import{n as A}from"../packem_chunks/bin.js";const M=_(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=g(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 M(t)},"__cjs_getBuiltinModule"),{rmSync:f,writeFileSync:h,readdirSync:p,statSync:D}=b("node:fs");var B=Object.defineProperty,n=g((t,e)=>B(t,"name",{value:e,configurable:!0}),"r");const a=n(()=>c(A(),"ai"),"getCacheDirectory"),J=3600*1e3,N=1800*1e3,C=n(()=>{w(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};h(c(s,`${t}.json`),JSON.stringify(o,void 0,2),"utf8")},"setCachedAnalysis"),V=n((t,e)=>e!==void 0&&e>0?e:t==="security"?N:J,"getTtlForAnalysisType"),F=n(()=>{const t=a();if(!d(t))return{entries:0,newestEntry:void 0,oldestEntry:void 0,totalSizeBytes:0};const e=p(t).filter(i=>i.endsWith(".json"));let r=0,s,o;for(const i of e){const y=c(t,i),m=D(y);r+=m.size;const{mtimeMs:l}=m;(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"),K=n(t=>v(Buffer.from(JSON.stringify(t))),"buildHashCacheKey"),P=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};h(c(s,`${t}.json`),JSON.stringify(o,void 0,2),"utf8")},"setCachedJson"),x=n(()=>{const t=a();if(!d(t))return 0;const e=p(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,F as J,K as M,P as N,W as O,z as R,q as T,V as j,k};
@@ -0,0 +1,43 @@
1
+ var O=Object.defineProperty;var f=(t,e)=>O(t,"name",{value:e,configurable:!0});import{createRequire as F}from"node:module";import{readLastRunSummary as T}from"@visulima/task-runner";import{a as k}from"./failure-log-C3LEMmkq.js";import{r as j,f as y,a as D,d as _}from"./run-summary-utils-BaBGP3bo.js";import{Y as N}from"../packem_chunks/bin.js";import{O as $,C as b,M as A,z as E}from"../packem_chunks/config.js";import{w as B,b as H,r as W}from"./ai-analysis-uYuTIIXi.js";import{M as q,N as Y,O as L}from"./ai-cache-DuwHYx2O.js";const C=F(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=f(t=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,a]=l.versions.node.split(".").map(Number);if(e>22||e===22&&a>=3||e===20&&a>=16)return l.getBuiltinModule(t)}return C(t)},"__cjs_getBuiltinModule"),{readFile:M,writeFile:R}=I("node:fs/promises");var z=Object.defineProperty,m=f((t,e)=>z(t,"name",{value:e,configurable:!0}),"u");const J=32*1024,K=m((t,e)=>{if(t.length<=e)return t;const a=t.slice(-e),o=t.length-a.length;return`[…${String(o)} bytes truncated from head…]
2
+ ${a}`},"truncateHead"),U=m(async(t,e)=>e===void 0?T(t,{dataDirectory:N(t)}):j(t,e),"loadSummary"),xt=m(async(t,e,a={})=>{const o=a.terminalOutputLimit??J,[n,r]=await Promise.all([k(t,e),U(t,a.runId)]),i=r?y(r,e):void 0;if(!n&&!i)return;let s,c;if(r&&i){const d=await D(t,r.id),g=d?y(d,e):void 0;s=_(i.hashDetails,g?.hashDetails),c=d?.id}const h=n?.terminalOutput??"";return{command:n?.command??void 0,cwd:n?.cwd??void 0,dependencies:i?.dependencies??[],duration:i?.duration,exitCode:n?.exitCode??i?.exitCode,hash:i?.hash??n?.hash,hashDetails:i?.hashDetails,hashDiff:s,previousRunId:c,project:i?.target.project,runId:r?.id??n?.runId,status:n?.status??(i?G(i):void 0),target:i?.target.target,taskId:e,terminalOutput:K(h,o),terminalOutputCaptured:!!n,timestamp:n?.timestamp??i?.endTime??i?.startTime}},"aggregateFailureContext"),G=m(t=>{if(t.exitCode!==void 0&&t.exitCode!==0)return"failure";switch(t.cacheStatus){case"HIT":return"local-cache";case"REMOTE_HIT":return"remote-cache";case"SKIPPED":return"skipped";default:return t.exitCode===0?"success":void 0}},"mapCacheStatusToTaskStatus");var V=Object.defineProperty,u=f((t,e)=>V(t,"name",{value:e,configurable:!0}),"a");const Q=3600*1e3,S=80,X=new Set(["high","low","medium"]),Z=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((t,e)=>{const a=[];if(e.added.length>0&&a.push(` added: ${e.added.join(", ")}`),e.changed.length>0&&a.push(` changed: ${e.changed.join(", ")}`),e.removed.length>0&&a.push(` removed: ${e.removed.join(", ")}`),a.length!==0)return`- ${t}:
34
+ ${a.join(`
35
+ `)}`},"formatBucket"),tt=u(t=>{if(!t.hashDiff)return"No hash-diff available — there is no previous run to compare against.";const e=[];t.hashDiff.commandChanged&&e.push("- command line changed since previous run");const a=v("file inputs",t.hashDiff.nodes),o=v("implicit deps",t.hashDiff.implicitDeps),n=v("runtime/env",t.hashDiff.runtime);return a&&e.push(a),o&&e.push(o),n&&e.push(n),e.length===0?"No detectable changes between this run and the previous run.":e.join(`
36
+ `)},"buildHashDiffSummary"),et=u(t=>{const e=[`Task: ${t.taskId}`];return t.project&&e.push(`Project: ${t.project}`),t.target&&e.push(`Target: ${t.target}`),t.command&&e.push(`Command: ${t.command}`),t.cwd&&e.push(`CWD: ${t.cwd}`),t.exitCode!==void 0&&e.push(`Exit code: ${String(t.exitCode)}`),t.hash&&e.push(`Task hash: ${t.hash}`),e.push("","Hash-diff since previous run:",tt(t),""),t.terminalOutputCaptured?e.push("Terminal output:","```",t.terminalOutput,"```"):e.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.'),e.join(`
37
+ `)},"buildUserPrompt"),at=u(t=>`${Z()}
38
+
39
+ ${et(t)}`,"buildFixPrompt"),it=u((t,e)=>{const a=Array.isArray(t.patches)?t.patches:[],o=[];for(const r of a)typeof r.file!="string"||r.file.length===0||typeof r.oldString!="string"||r.oldString.length===0||typeof r.newString=="string"&&o.push({file:r.file,newString:r.newString,oldString:r.oldString,reason:typeof r.reason=="string"&&r.reason.length>0?r.reason:void 0});const n=typeof t.cannotFix=="string"&&t.cannotFix.length>0?t.cannotFix:void 0;return{cannotFix:n,confidence:X.has(t.confidence)?t.confidence:"low",explanation:typeof t.explanation=="string"?t.explanation:"",patches:n?[]:o,provider:e}},"normalizeFixProposal"),rt=u((t,e)=>{const a=B(t);return!a||typeof a!="object"?{cannotFix:"AI response was not valid JSON.",confidence:"low",explanation:"Failed to parse AI response.",patches:[],provider:e}:it(a,e)},"parseFixResponse"),nt=u((t,e)=>q({cwd:e.cwd??null,flow:"ai-fix",hash:e.hash??null,provider:t,taskId:e.taskId,terminalOutput:e.terminalOutput,terminalOutputCaptured:e.terminalOutputCaptured}),"buildFixCacheKey"),wt=u(async(t,e,a={})=>{const o=H(a.config);if(!o){e.warn(`No AI provider available — install one of: claude, gemini, copilot, codex.
40
+ `);return}const n=a.cache!==!1,r=nt(o.name,t);if(n){const i=Y(r);if(i)return e.info(`Using cached fix proposal from ${i.provider}.
41
+ `),i}e.info(`Generating fix proposal with ${o.name}...
42
+ `);try{const i=await W(o,at(t)),s=rt(i,o.name);return n&&s.patches.length>0&&!s.cannotFix&&L(r,s,Q),s}catch(i){const s=i instanceof Error?i.message:String(i);e.warn(`AI fix proposal failed (${s}).
43
+ `);return}},"runFixAnalysis"),st=u((t,e,a)=>$(a)?b(a):b(A(e??t,a)),"resolvePatchPath"),ot=u((t,e)=>{const a=E(t,e);return a===""?!0:!a.startsWith("..")&&!$(a)},"isInsideWorkspace"),ct=u((t,e,a)=>{const o=t.indexOf(e),n=Math.max(0,o-S),r=Math.min(t.length,o+e.length+S),i=t.slice(n,r);return{previewAfter:`${t.slice(n,o)}${a}${t.slice(o+e.length,r)}`,previewBefore:i}},"buildPreview"),yt=u(async(t,e,a,o={})=>{const n=o.dryRun===!0,r=new Map,i=[];for(const s of a.patches){const c=st(t,e,s.file);if(!ot(t,c)){i.push({absolutePath:c,patch:s,status:"outside-workspace"});continue}let h=r.get(c);if(h===void 0){try{h=await M(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}r.set(c,h)}const d=h.indexOf(s.oldString);if(d===-1){i.push({absolutePath:c,patch:s,status:"no-match"});continue}if(h.indexOf(s.oldString,d+s.oldString.length)!==-1){i.push({absolutePath:c,patch:s,status:"ambiguous-match"});continue}const{previewAfter:g,previewBefore:P}=ct(h,s.oldString,s.newString),x=`${h.slice(0,d)}${s.newString}${h.slice(d+s.oldString.length)}`;if(!n)try{await R(c,x,"utf8")}catch(p){r.delete(c),i.push({absolutePath:c,error:p.message,patch:s,status:"error"});continue}r.set(c,x),i.push({absolutePath:c,patch:s,previewAfter:g,previewBefore:P,status:"applied"})}return i},"applyFixProposal");export{xt as a,wt as b,yt as c,st as r};
@@ -0,0 +1 @@
1
+ import{createRequire as e}from"node:module";import{h as l,H as _,l as d,V as p,y as u,c,a as g,j as m,G as T,e as E,r as C}from"../packem_chunks/config.js";import"jiti";import{otelPlugin as I}from"./otelPlugin-CJR2T_lk.js";import{definePlugin as j}from"./definePlugin-CWm4Dv_t.js";const n=e(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;export{l as CONFIG_FILES,_ as DEFAULT_MIN_RELEASE_AGE_MINUTES,d as SECURITY_DEFAULTS,p as TASK_CONFIG_FILES,u as applyDefaults,c as defineConfig,j as definePlugin,g as defineTaskConfig,m as findVisConfigFile,T as findVisTaskConfigFile,E as loadVisConfig,C as loadVisTaskConfig,I as otelPlugin};
@@ -0,0 +1 @@
1
+ var k=Object.defineProperty;var b=(e,t)=>k(e,"name",{value:t,configurable:!0});import{createRequire as M}from"node:module";import{M as h,i as _,n as w}from"../packem_chunks/config.js";const $=M(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=b(e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[t,s]=y.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return y.getBuiltinModule(e)}return $(e)},"__cjs_getBuiltinModule"),{readdirSync:j,statSync:O}=B("node:fs");var x=Object.defineProperty,v=b((e,t)=>x(e,"name",{value:t,configurable:!0}),"g");const P=["preinstall","install","postinstall","prepare"],q=v(e=>{const t=h(e,"node_modules");if(!_(t))return[];const s=new Map,i=v((p,f="")=>{let u;try{u=j(p)}catch{return}for(const r of u){const o=h(p,r);if(r.startsWith("@")){i(o,`${r}/`);continue}if(r===".pnpm"&&f===""){let l;try{l=j(o)}catch{continue}for(const a of l){const c=h(o,a,"node_modules");_(c)&&i(c)}continue}if(r.startsWith("."))continue;const m=f+r,n=h(o,"package.json");try{if(!O(o).isDirectory()||!_(n))continue;const l=w(n),a=l.scripts??{},c=P.filter(g=>a[g]);!a.preinstall&&!a.install&&!a.postinstall&&_(h(o,"binding.gyp"))&&c.push("install (binding.gyp)"),c.length>0&&!s.has(m)&&s.set(m,{directory:o,hooks:c,name:m,version:typeof l.version=="string"?l.version:void 0});const d=h(o,"node_modules");_(d)&&i(d)}catch{}}},"scanDir");return i(t),[...s.values()]},"collectBuildScriptPackages"),W=v(e=>{const t=e.startsWith("@"),s=e.indexOf("@",t?1:0);return s===-1?{name:e}:{name:e.slice(0,s),version:e.slice(s+1)}},"splitAllowKey"),D=v((e,t,s)=>{for(const[i,p]of Object.entries(t)){if(!p)continue;if(i.endsWith("@*")){if(i.slice(0,-2)===e.name)return!0;continue}if(i.endsWith("*")){if(e.name.startsWith(i.slice(0,-1)))return!0;continue}const{name:f,version:u}=W(i);if(f===e.name&&(!s||u===void 0||e.version===u))return!0}return!1},"isPatternAllowed"),T=v((e,t,s={})=>{const i=s.pinVersions===!0,p=q(e),f=[],u=[],r=new Map(p.map(n=>[n.name,n]));for(const n of p)D(n,t,i)?u.push(n):f.push(n);const o=[],m=[];for(const[n,l]of Object.entries(t)){if(!l)continue;if(n.endsWith("@*")){const g=n.slice(0,-2);r.has(g)||o.push(n);continue}if(n.endsWith("*")){const g=n.slice(0,-1);[...r.keys()].some(S=>S.startsWith(g))||o.push(n);continue}const{name:a,version:c}=W(n),d=r.get(a);if(!d){o.push(n);continue}i&&c!==void 0&&c!=="*"&&d.version&&d.version!==c&&m.push({from:n,to:`${a}@${d.version}`})}return{excess:o,installed:u,unapproved:f,versionDrift:m}},"scanBuildScriptStatus"),K=v((e,t)=>T(e,t).unapproved.map(s=>`${s.name} (${s.hooks.join(", ")})`),"scanUnapprovedBuildScripts");export{K as O,T as x};
@@ -0,0 +1 @@
1
+ var h=Object.defineProperty;var l=(e,r)=>h(e,"name",{value:r,configurable:!0});import{createRequire as f}from"node:module";import{O as p,C as a,z as m}from"../packem_chunks/config.js";import{getMainWorktreeRoot as C}from"@visulima/task-runner";import{D as u}from"../packem_chunks/bin.js";const d=f(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 d(e)},"__cjs_getBuiltinModule"),{execFileSync:_}=g("node:child_process");var v=Object.defineProperty,s=l((e,r)=>v(e,"name",{value:r,configurable:!0}),"i");const R=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"),y=s((e,r)=>r===!1?e:C(e)??e,"resolveSharedCacheRoot"),O=s((e,r,t,n)=>{const o=r??t??process.env.VIS_CACHE_DIRECTORY;if(o&&o.length>0)return R(e,r,t);const c=y(e,n);return a(c,u)},"resolveSharedCacheDirectory"),E=/[^\w.-]+/g,S=/^-+|-+$/g,D=s(e=>e.trim().replaceAll(E,"-").replaceAll(S,"").slice(0,64),"sanitizeBranchSegment"),b=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"),z=s((e,r,t)=>{if(t!==!0)return e;const n=b(r);if(!n)return e;const o=D(n);return o.length===0?e:a(e,"branches",o)},"applyBranchScope"),H=s((e,r)=>{const t=m(r,e);return t.length===0?!1:t!==".."&&!t.startsWith("../")&&!p(t)},"isCacheDirectoryInsideWorkspace");export{O as E,H as _,z as a};
@@ -0,0 +1,4 @@
1
+ var ge=Object.defineProperty;var A=(e,n)=>ge(e,"name",{value:n,configurable:!0});import{createRequire as ye}from"node:module";import{n as ie,M as R,$ as ve}from"../packem_chunks/config.js";import{r as $e}from"./docker-B-CIN_nj.js";import{F as Se}from"./lockfile-C5DYMHVq.js";import{aY as je}from"../packem_chunks/bin.js";const _e=ye(import.meta.url),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ae=A(e=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[n,t]=W.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return W.getBuiltinModule(e)}return _e(e)},"__cjs_getBuiltinModule"),{randomUUID:be}=ae("node:crypto"),{readdirSync:Oe}=ae("node:fs");var ke=Object.defineProperty,pe=A((e,n)=>ke(e,"name",{value:n,configurable:!0}),"r$1");const Y=pe(e=>e.replaceAll(/[^\w.~-]/g,n=>`%${(n.codePointAt(0)??0).toString(16).toUpperCase().padStart(2,"0")}`),"encodeSegment"),N=pe((e,n)=>{const t=e.toLowerCase();if(t.startsWith("@")){const o=t.indexOf("/");if(o>0){const r=t.slice(0,o),p=t.slice(o+1);return`pkg:npm/${Y(r)}/${Y(p)}@${Y(n)}`}}return`pkg:npm/${Y(t)}@${Y(n)}`},"toNpmPurl");var Le=Object.defineProperty,j=A((e,n)=>Le(e,"name",{value:n,configurable:!0}),"a$1");const m={ARRAY:"array",BOOLEAN:"boolean",DATE:"date",FUNCTION:"function",JSTOXML_OBJECT:"jstoxml-object",NULL:"null",NUMBER:"number",OBJECT:"object",STRING:"string"},Ce=[m.STRING,m.NUMBER,m.BOOLEAN],Pe='<?xml version="1.0" encoding="UTF-8"?>',se=["_selfCloseTag","_attrs"],Te=j((e="",n=0)=>e.repeat(n),"getIndentStr"),Z=j(e=>Array.isArray(e)&&m.ARRAY||typeof e===m.OBJECT&&e!==null&&e._name&&m.JSTOXML_OBJECT||e instanceof Date&&m.DATE||e===null&&m.NULL||typeof e,"getType"),le=j(e=>e.startsWith("<![CDATA["),"isCDATA"),ue=j((e="",n={},t)=>{let o=e;if(typeof e===m.STRING){if(le(e))return e;const r=new RegExp(`(${Object.keys(n).join("|")})(?!(\\w|#)*;)`,"g");o=String(e).replace(r,(p,g)=>n[g]||"")}return typeof t=="function"?t(o):o},"mapStr"),Ae=j((e={},n,t,o)=>(Array.isArray(e)?e:Object.entries(e).map(([r,p])=>({[r]:p}))).reduce((r,p)=>{const g=Object.keys(p)[0],y=p[g];if(typeof t===m.FUNCTION&&t(g,y))return r;const b=n?ue(y,n):y,$=!o&&b===!0?"":`="${b}"`;return r.push(`${g}${$}`),r},[]),"getAttributeKeyVals"),De=j((e={},n,t,o)=>{const r=Ae(e,n,t,o);return r.length===0?"":` ${r.join(" ")}`},"formatAttributes"),xe=j((e={})=>Object.keys(e).map(n=>({_name:n,_content:e[n]})),"objToArray"),Be=j(e=>Ce.includes(Z(e)),"isPrimitive"),we=j(e=>!e.match("<"),"isSimpleXML"),Me=j(({header:e,isOutputStart:n})=>e&&n?typeof e===m.BOOLEAN?Pe:e:"","getHeaderString"),re={"<":"&lt;",">":"&gt;","&":"&amp;",'"':"&quot;"},F=j((e={},n={})=>{const{depth:t=0,indent:o,_isFirstItem:r,_isOutputStart:p=!0,header:g,attributeReplacements:y={},attributeFilter:b,attributeExplicitTrue:$=!1,contentReplacements:X={},contentMap:E,selfCloseTags:I=!0}=n,q=typeof y=="boolean"&&!y?{}:{...re,...y},H=typeof X=="boolean"&&!X?{}:{...re,...X},B=typeof o=="string",L=Te(o,t),V=Z(e),U=Me({header:g,indent:o,depth:t,isOutputStart:p}),w=p&&!U&&r&&t===0,M=B&&!w?`
2
+ `:"";let v="";switch(V){case m.JSTOXML_OBJECT:{const{_name:f,_content:l}=e;if(l===null&&typeof E!="function"){v=`${M}${L}${f}`;break}if(Array.isArray(l)&&l.every(Be))return l.map(k=>F({_name:f,_content:k},{...n,depth:t,_isOutputStart:!1})).join("");if(se.includes(f))break;const _=F(l,{...n,depth:t+1,_isOutputStart:w}),D=Z(_),O=we(_),S=le(_),x=`${M}${L}`;if(f==="_comment"){v+=`${x}<!-- ${l} -->`;break}const K=D==="undefined"||_==="",c=I,s=e._selfCloseTag,i=typeof s===m.BOOLEAN?K&&s:K&&c,a=i?"/":"",u=De(e._attrs,q,b,$),d=`<${f}${u}${a}>`,C=B&&!O&&!S?`
3
+ ${L}`:"",P=i?"":`${_}${C}</${f}>`;v+=`${x}${d}${P}`;break}case m.OBJECT:{const f=Object.keys(e);v=f.map((l,_)=>{const D={...n,_isFirstItem:_===0,_isLastItem:_+1===f.length,_isOutputStart:w},O={_name:l};if(Z(e[l])===m.OBJECT&&(se.forEach(S=>{const x=e[l][S];typeof x<"u"&&(O[S]=x,delete e[l][S])}),typeof e[l]._content<"u"&&Object.keys(e[l]).length>1)){const S=Object.assign({},e[l]);delete S._content,O._content=[...xe(S),e[l]._content]}return typeof O._content>"u"&&(O._content=e[l]),F(O,D)},n).join("");break}case m.FUNCTION:{const f=e(n);v=F(f,n);break}case m.ARRAY:{v=e.map((f,l)=>{const _={...n,_isFirstItem:l===0,_isLastItem:l+1===e.length,_isOutputStart:w};return F(f,_)}).join("");break}default:{v=ue(e,H,E);break}}return`${U}${v}`},"toXML");var Ne=Object.defineProperty,J=A((e,n)=>Ne(e,"name",{value:n,configurable:!0}),"r");const te=J(e=>{try{return ie(e)}catch{return}},"readJsonSafe"),Re=J(e=>{if(e.length===0||e.includes("..")||e.startsWith(".")||e.includes("\0")||e.includes("\\"))return!1;if(e.startsWith("@")){const n=e.indexOf("/");return n>1&&!e.includes("/",n+1)}return!e.includes("/")},"isSafePackageName"),Ee=J(e=>e.length>0&&!e.includes("/")&&!e.includes("\\")&&!e.includes("..")&&!e.includes("\0"),"isSafeVersion"),Ie=J((e,n,t)=>{const o=`${n.replaceAll("/","+")}@${t}`,r=R(e,"node_modules",".pnpm"),p=te(R(r,o,"node_modules",n,"package.json"));if(p)return p;let g;try{g=Oe(r)}catch{return}const y=`${o}_`;for(const b of g){if(!b.startsWith(y))continue;const $=te(R(r,b,"node_modules",n,"package.json"));if($)return $}},"readPnpmVirtualStore"),Ue=J((e,n,t)=>{const o=te(R(e,"node_modules",n,"package.json"));return o?.version===t?o:void 0},"readHoistedCopy"),Ge=J((e,n,t)=>{if(!(!Re(n)||!Ee(t)))return Ie(e,n,t)??Ue(e,n,t)},"readInstalledPackageMetadata");var Fe=Object.defineProperty,me=A((e,n)=>Fe(e,"name",{value:n,configurable:!0}),"i");const fe=new Set(["0BSD","AGPL-3.0","AGPL-3.0-only","AGPL-3.0-or-later","Apache-1.1","Apache-2.0","Artistic-2.0","BlueOak-1.0.0","BSD-2-Clause","BSD-3-Clause","BSL-1.0","CC0-1.0","CC-BY-3.0","CC-BY-4.0","CDDL-1.0","CDDL-1.1","EPL-1.0","EPL-2.0","GPL-2.0","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0","GPL-3.0-only","GPL-3.0-or-later","ISC","LGPL-2.0","LGPL-2.1","LGPL-3.0","MIT","MIT-0","MPL-1.1","MPL-2.0","Python-2.0","Unlicense","WTFPL","Zlib"]),Je={apache2:"Apache-2.0","apache 2.0":"Apache-2.0",bsd:"BSD-3-Clause","bsd-2":"BSD-2-Clause","bsd-3":"BSD-3-Clause",mit:"MIT",public:"Unlicense","public domain":"Unlicense"},Xe=(()=>{const e=new Map;for(const n of fe)e.set(n.toLowerCase(),n);for(const[n,t]of Object.entries(Je))e.set(n,t);return e})(),qe=me(e=>{const n=e.trim();if(n.length!==0)return fe.has(n)?n:Xe.get(n.toLowerCase())},"normalizeSpdxId"),ze=me(e=>{let n;if(typeof e.license=="string")n=e.license;else if(e.license&&typeof e.license=="object"&&typeof e.license.type=="string")n=e.license.type;else if(Array.isArray(e.licenses)&&e.licenses.length>0){const r=e.licenses[0];r&&typeof r.type=="string"&&(n=r.type)}if(!n)return;const t=n.trim();if(t.length===0)return;if(/[()]|\b(?:and|or|with)\b/i.test(t))return[{expression:t}];const o=qe(t);return o?[{license:{id:o}}]:[{license:{name:t}}]},"extractLicenseChoice");var We=Object.defineProperty,de=A((e,n)=>We(e,"name",{value:n,configurable:!0}),"t");const Ye={sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"},He={sha256:64,sha384:96,sha512:128},Ve=de(e=>{const n={name:e.name,version:e.version},{integrity:t}=e;return t&&t.hex.length===He[t.algorithm]&&(n.hash={alg:Ye[t.algorithm],content:t.hex}),e.dependencies&&(n.dependencies=e.dependencies),e.peerDependencies&&(n.peerDependencies=e.peerDependencies),e.optionalDependencies&&(n.optionalDependencies=e.optionalDependencies),n},"toResolvedPackage"),Ke=[{file:"pnpm-lock.yaml",type:"pnpm"},{file:"package-lock.json",type:"npm"},{file:"yarn.lock",type:"yarn"},{file:"bun.lock",type:"bun"}],Ze=de(e=>{for(const{file:n,type:t}of Ke){let o;try{o=ve(R(e,n))}catch{continue}const r=new Map;for(const p of Se(o,t))r.set(`${p.name}@${p.version}`,Ve(p));return{packages:r,type:t}}},"readLockfilePackages");var Qe=Object.defineProperty,he=A((e,n)=>Qe(e,"name",{value:n,configurable:!0}),"s");const en=he(e=>{const n=e.indexOf(":");return n<=0?e:e.slice(0,n)==="npm"?e.slice(n+1):e},"stripProtocolPrefix"),ee=he((e,n,t)=>{const o=t.get(e);if(!o||o.size===0)return;if(o.has(n))return n;const r=en(n);if(r!==n&&o.has(r))return r;const p=[...o];return je.maxSatisfying(p,r,{includePrerelease:!0})||p[0]},"resolveSpecifier");var nn=Object.defineProperty,h=A((e,n)=>nn(e,"name",{value:n,configurable:!0}),"p");const tn="1.7",on="CycloneDX",sn="http://cyclonedx.org/schema/bom-1.7.schema.json",rn="@visulima/vis",ce=h(e=>{try{return ie(e)}catch{return}},"readPackageJson"),cn=h(e=>{if(e){if(typeof e=="string")return e;if(typeof e=="object"&&e.name)return e.email?`${e.name} <${e.email}>`:e.name}},"toAuthorString"),an=h(e=>{if(e)return typeof e=="string"?e:e.url},"toRepositoryUrl"),pn=h(e=>{if(e)return typeof e=="string"?e:e.url},"toBugsUrl"),ln=h(e=>{const n=[];e.homepage&&n.push({type:"website",url:e.homepage});const t=an(e.repository);t&&n.push({type:"vcs",url:t});const o=pn(e.bugs);return o&&n.push({type:"issue-tracker",url:o}),n.length>0?n:void 0},"buildExternalReferences"),un=h(e=>e==="application"||e==="service"||e==="tool"?"application":"library","toCycloneDxComponentType"),ne=h((e,n)=>{if(!n)return;n.description&&(e.description=n.description);const t=cn(n.author);t&&(e.author=t);const o=ze(n);o&&(e.licenses=o);const r=ln(n);r&&(e.externalReferences=r)},"decoratePackageComponent"),$n=h(e=>{const{focus:n,generatorVersion:t,includeDev:o=!1,now:r=new Date,projectGraph:p,serialNumber:g,workspace:y,workspaceRoot:b}=e,$=n&&n.length>0?[...$e(n,p)].sort():Object.keys(y.projects).sort(),X=new Set($),E=new Map;for(const c of $){const s=y.projects[c];s&&E.set(c,ce(R(b,s.root,"package.json")))}const I=[],q=new Map;for(const c of $){const s=y.projects[c];if(!s)continue;const i=E.get(c),a=i?.version??"0.0.0",u=N(c,a);q.set(c,u);const d={"bom-ref":u,name:c,purl:u,type:un(s.projectType),version:a};ne(d,i),I.push(d)}const H=Ze(b),B=new Map,L=new Map;if(H)for(const c of H.packages.values()){B.set(`${c.name}@${c.version}`,c);let s=L.get(c.name);s||(s=new Set,L.set(c.name,s)),s.add(c.version)}const V=[],U=[],w=new Map;for(const c of $){const s=E.get(c);if(!s)continue;const i=[s.dependencies,s.peerDependencies];o&&i.push(s.devDependencies);const a=new Set,u=h((d,C)=>{if(C)for(const[P,k]of Object.entries(C)){if(X.has(P)){const G=q.get(P);G&&a.add(G);continue}const T=ee(P,k,L);T&&(a.add(N(P,T)),d.push(`${P}@${T}`))}},"seedRef");for(const d of i)u(V,d);u(U,s.optionalDependencies),w.set(c,a)}const M=new Map,v=new Map,f=h((c,s)=>{const i=[...c];for(;i.length>0;){const a=i.pop(),u=M.get(a);if(u==="required"||u==="optional"&&s==="optional")continue;M.set(a,s);const d=B.get(a);if(!d)continue;const C=v.get(a)??new Set,P=[d.dependencies,d.peerDependencies];for(const k of P)if(k)for(const[T,G]of Object.entries(k))for(const z of G){const Q=ee(T,z,L);Q&&(C.add(N(T,Q)),i.push(`${T}@${Q}`))}if(d.optionalDependencies)for(const[k,T]of Object.entries(d.optionalDependencies))for(const G of T){const z=ee(k,G,L);z&&(C.add(N(k,z)),U.push(`${k}@${z}`))}C.size>0&&v.set(a,C)}},"walk");f(V,"required"),f(U,"optional");const l=[],_=[...M.keys()].sort();for(const c of _){const s=B.get(c);if(!s)continue;const i=N(s.name,s.version),a={"bom-ref":i,name:s.name,purl:i,scope:M.get(c)??"required",type:"library",version:s.version};s.hash&&(a.hashes=[s.hash]),ne(a,Ge(b,s.name,s.version)),l.push(a)}const D=[];for(const[c,s]of w){const i=q.get(c);if(!i)continue;const a=[...s].sort();D.push(a.length>0?{dependsOn:a,ref:i}:{ref:i})}for(const c of _){const s=B.get(c);if(!s)continue;const i=N(s.name,s.version),a=v.get(c),u=a?[...a].sort():[];D.push(u.length>0?{dependsOn:u,ref:i}:{ref:i})}D.sort((c,s)=>c.ref.localeCompare(s.ref));const O=ce(R(b,"package.json")),S=(()=>{if(n?.length===1){const u=I.find(d=>d.name===n[0]);if(u)return{"bom-ref":u["bom-ref"],name:u.name,purl:u.purl,type:u.type,version:u.version}}const c=O?.name??"workspace",s=O?.version??"0.0.0",i=N(c,s),a={"bom-ref":i,name:c,purl:i,type:"application",version:s};return ne(a,O),a})(),x=S["bom-ref"],K=x?I.filter(c=>c["bom-ref"]!==x):I;return{$schema:sn,bomFormat:on,components:[...K,...l],dependencies:D,metadata:{component:S,lifecycles:[{phase:"build"}],timestamp:r.toISOString(),tools:{components:[{name:rn,type:"application",...t?{version:t}:{}}]}},serialNumber:g??`urn:uuid:${be()}`,specVersion:tn,version:1}},"buildCycloneDxBom"),On=h(e=>{const n={version:e.version??1,xmlns:"http://cyclonedx.org/schema/bom/1.7"};e.serialNumber&&(n.serialNumber=e.serialNumber);const t=[];return e.metadata&&t.push(mn(e.metadata)),e.components&&e.components.length>0&&t.push({_content:e.components.map(o=>oe(o)),_name:"components"}),e.dependencies&&e.dependencies.length>0&&t.push({_content:e.dependencies.map(o=>dn(o)),_name:"dependencies"}),`${F({_attrs:n,_content:t,_name:"bom"},{header:!0,indent:" ",selfCloseTags:!0})}
4
+ `},"serializeBomToXml"),mn=h(e=>{const n=[];return e.timestamp&&n.push({timestamp:e.timestamp}),e.lifecycles&&e.lifecycles.length>0&&n.push({_content:e.lifecycles.map(t=>{const o=[];return t.phase&&o.push({phase:t.phase}),t.name&&o.push({name:t.name}),t.description&&o.push({description:t.description}),{_content:o,_name:"lifecycle"}}),_name:"lifecycles"}),e.tools?.components&&n.push({_content:[{_content:e.tools.components.map(t=>oe(t)),_name:"components"}],_name:"tools"}),e.component&&n.push(oe(e.component)),{_content:n,_name:"metadata"}},"metadataToXmlElement"),oe=h(e=>{const n={type:e.type};e["bom-ref"]&&(n["bom-ref"]=e["bom-ref"]);const t=[];e.group&&t.push({group:e.group}),t.push({name:e.name}),e.version&&t.push({version:e.version}),e.description&&t.push({description:e.description}),e.author&&t.push({author:e.author}),e.hashes&&e.hashes.length>0&&t.push({_content:e.hashes.map(r=>({_attrs:{alg:r.alg},_content:r.content,_name:"hash"})),_name:"hashes"});const o=fn(e.licenses);return o&&t.push(o),e.purl&&t.push({purl:e.purl}),e.scope&&t.push({scope:e.scope}),e.externalReferences&&e.externalReferences.length>0&&t.push({_content:e.externalReferences.map(r=>({_attrs:{type:r.type},_content:[{url:r.url}],_name:"reference"})),_name:"externalReferences"}),{_attrs:n,_content:t,_name:"component"}},"componentToXmlElement"),fn=h(e=>{if(!e||e.length===0)return;const n=[];for(const t of e){if("expression"in t){n.push({expression:t.expression});continue}const o=[];"id"in t.license&&t.license.id?o.push({id:t.license.id}):"name"in t.license&&t.license.name&&o.push({name:t.license.name}),n.push({_content:o,_name:"license"})}return{_content:n,_name:"licenses"}},"licensesToXmlElement"),dn=h(e=>e.dependsOn&&e.dependsOn.length>0?{_attrs:{ref:e.ref},_content:e.dependsOn.map(n=>({_attrs:{ref:n},_name:"dependency"})),_name:"dependency"}:{_attrs:{ref:e.ref},_name:"dependency"},"dependencyToXmlElement");export{$n as b,qe as n,On as s,N as t};
@@ -0,0 +1 @@
1
+ var i=Object.defineProperty;var r=(e,n)=>i(e,"name",{value:n,configurable:!0});var a=Object.defineProperty,l=r((e,n)=>a(e,"name",{value:n,configurable:!0}),"n");const u=l(e=>e,"definePlugin");export{u as definePlugin};
@@ -0,0 +1 @@
1
+ var g=Object.defineProperty;var m=(t,r)=>g(t,"name",{value:r,configurable:!0});import{$ as d,M as l}from"../packem_chunks/config.js";import{F as h}from"./lockfile-C5DYMHVq.js";import{h as v,k as D}from"../packem_chunks/bin.js";var w=Object.defineProperty,u=m((t,r)=>w(t,"name",{value:r,configurable:!0}),"g");const y={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"}},k=u(t=>{try{return JSON.parse(d(t))}catch{return}},"readPackageJsonShape"),b=u(t=>{const r=[],o=k(l(t,"package.json"));o&&r.push(o);const a=v(t);let s;if(a?s=a:o?.workspaces&&(Array.isArray(o.workspaces)?s=o.workspaces:o.workspaces.packages&&(s=o.workspaces.packages)),!s)return r;const c=D(t,s);for(const n of c){const e=k(l(t,n,"package.json"));e&&r.push(e)}return r},"collectWorkspacePackageJsons"),P=u((t,r)=>{const o=new Set,a=[],s=new Map;for(const n of r){const e=s.get(n.name);e?e.push(n):s.set(n.name,[n])}const c=u(n=>{if(n)for(const e of Object.keys(n))o.has(e)||(o.add(e),a.push(e))},"enqueueRoots");for(const n of b(t))c(n.dependencies),c(n.peerDependencies),c(n.optionalDependencies);for(;a.length>0;){const n=a.shift(),e=s.get(n);if(e){for(const p of e)for(const i of[p.dependencies,p.peerDependencies,p.optionalDependencies])if(i)for(const f of Object.keys(i))o.has(f)||(o.add(f),a.push(f))}}return o},"computeProdReachable"),A=u((t,r,o={})=>{const a=y[r];if(!a)return[];let s;try{s=d(l(t,a.file))}catch{return[]}const c=h(s,a.type);if(c.length===0)return[];const n=o.includeDev??!0?void 0:P(t,c),e=new Set,p=[];for(const i of c){if(n&&!n.has(i.name))continue;const f=`${i.name}@${i.version}`;e.has(f)||(e.add(f),p.push({isDev:!1,name:i.name,version:i.version}))}return p},"lockedPackages"),J=u((t,r)=>{const o=y[r];if(!o)return[];let a;try{a=d(l(t,o.file))}catch{return[]}const s=h(a,o.type);if(s.length===0)return[];const c=new Map;for(const e of s)c.has(e.name)||c.set(e.name,new Set),c.get(e.name).add(e.version);const n=[];for(const[e,p]of c)p.size<=1||n.push({name:e,versions:[...p]});return n.sort((e,p)=>e.name.localeCompare(p.name))},"findDuplicateDependencies");export{y as L,J as f,A as l};