@visulima/vis 4.3.1 → 6.0.0

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 (168) hide show
  1. package/CHANGELOG.md +598 -0
  2. package/LICENSE.md +151 -88
  3. package/README.md +2 -2
  4. package/dist/bin.js +1 -1
  5. package/dist/binx.js +1 -1
  6. package/dist/config/index.d.ts +42 -19
  7. package/dist/packem_chunks/CONFIG_FILES.js +4 -4
  8. package/dist/packem_chunks/bloom-status.js +1 -1
  9. package/dist/packem_chunks/bloom-sync.js +1 -1
  10. package/dist/packem_chunks/catalog.js +61 -51
  11. package/dist/packem_chunks/cli-exec.js +1 -1
  12. package/dist/packem_chunks/cli-main.js +202 -176
  13. package/dist/packem_chunks/dart-plan.js +1 -1
  14. package/dist/packem_chunks/dart-projects.js +1 -1
  15. package/dist/packem_chunks/dispatch.js +1 -1
  16. package/dist/packem_chunks/doctor-probe.js +1 -1
  17. package/dist/packem_chunks/fix.js +1 -1
  18. package/dist/packem_chunks/handler.js +1 -1
  19. package/dist/packem_chunks/handler10.js +4 -4
  20. package/dist/packem_chunks/handler11.js +1 -1
  21. package/dist/packem_chunks/handler12.js +1 -1
  22. package/dist/packem_chunks/handler13.js +1 -1
  23. package/dist/packem_chunks/handler14.js +1 -1
  24. package/dist/packem_chunks/handler15.js +1 -1
  25. package/dist/packem_chunks/handler16.js +1 -1
  26. package/dist/packem_chunks/handler17.js +1 -1
  27. package/dist/packem_chunks/handler18.js +1 -1
  28. package/dist/packem_chunks/handler19.js +1 -1
  29. package/dist/packem_chunks/handler2.js +1 -1
  30. package/dist/packem_chunks/handler20.js +2 -2
  31. package/dist/packem_chunks/handler21.js +1 -1
  32. package/dist/packem_chunks/handler22.js +2 -2
  33. package/dist/packem_chunks/handler23.js +1 -1
  34. package/dist/packem_chunks/handler24.js +1 -1
  35. package/dist/packem_chunks/handler26.js +5 -5
  36. package/dist/packem_chunks/handler27.js +1 -1
  37. package/dist/packem_chunks/handler28.js +1 -1
  38. package/dist/packem_chunks/handler29.js +1 -1
  39. package/dist/packem_chunks/handler3.js +1 -1
  40. package/dist/packem_chunks/handler30.js +1 -1
  41. package/dist/packem_chunks/handler39.js +6 -6
  42. package/dist/packem_chunks/handler5.js +1 -1
  43. package/dist/packem_chunks/handler50.js +2 -2
  44. package/dist/packem_chunks/handler51.js +1 -1
  45. package/dist/packem_chunks/handler53.js +1 -1
  46. package/dist/packem_chunks/handler54.js +1 -1
  47. package/dist/packem_chunks/handler55.js +1 -1
  48. package/dist/packem_chunks/handler58.js +1 -1
  49. package/dist/packem_chunks/handler59.js +1 -1
  50. package/dist/packem_chunks/handler6.js +1 -1
  51. package/dist/packem_chunks/handler60.js +7 -7
  52. package/dist/packem_chunks/handler61.js +2 -2
  53. package/dist/packem_chunks/handler62.js +10 -10
  54. package/dist/packem_chunks/handler63.js +1 -1
  55. package/dist/packem_chunks/handler64.js +6 -3
  56. package/dist/packem_chunks/handler65.js +8 -6
  57. package/dist/packem_chunks/handler66.js +2 -2
  58. package/dist/packem_chunks/handler67.js +31 -20
  59. package/dist/packem_chunks/handler68.js +1 -1
  60. package/dist/packem_chunks/handler69.js +22 -153
  61. package/dist/packem_chunks/handler7.js +1 -1
  62. package/dist/packem_chunks/handler70.js +9 -9
  63. package/dist/packem_chunks/handler71.js +153 -22
  64. package/dist/packem_chunks/handler72.js +1 -1
  65. package/dist/packem_chunks/handler73.js +1 -1
  66. package/dist/packem_chunks/handler74.js +1 -1
  67. package/dist/packem_chunks/handler75.js +35 -35
  68. package/dist/packem_chunks/handler76.js +1 -1
  69. package/dist/packem_chunks/handler77.js +3 -3
  70. package/dist/packem_chunks/handler78.js +69 -67
  71. package/dist/packem_chunks/handler8.js +1 -1
  72. package/dist/packem_chunks/handler9.js +1 -1
  73. package/dist/packem_chunks/heal-accept.js +1 -1
  74. package/dist/packem_chunks/heal.js +1 -1
  75. package/dist/packem_chunks/help-command.js +40 -7
  76. package/dist/packem_chunks/index2.js +32 -32
  77. package/dist/packem_chunks/index6.js +1 -1
  78. package/dist/packem_chunks/keys-refresh.js +1 -1
  79. package/dist/packem_chunks/lean.js +3 -4
  80. package/dist/packem_chunks/list.js +1 -1
  81. package/dist/packem_chunks/loader.js +1 -1
  82. package/dist/packem_chunks/orchestrator.js +1 -1
  83. package/dist/packem_chunks/prompts.js +1 -1
  84. package/dist/packem_chunks/status.js +1 -1
  85. package/dist/packem_chunks/sync.js +1 -1
  86. package/dist/packem_chunks/sync2.js +1 -1
  87. package/dist/packem_chunks/tar.js +1 -1
  88. package/dist/packem_chunks/tripwire.js +1 -1
  89. package/dist/packem_chunks/ts-loader.js +5 -5
  90. package/dist/packem_chunks/verify-lockfile.js +1 -1
  91. package/dist/packem_shared/{affected-selection-D4giBK2X.js → affected-selection-DDxwjwM4.js} +1 -1
  92. package/dist/packem_shared/affected-shas-BuaWvmsG.js +1 -0
  93. package/dist/packem_shared/{ai-fix-BC6aIRJT.js → ai-fix-C2BhFFhi.js} +5 -5
  94. package/dist/packem_shared/{augment-B9kSZuvW.js → augment-CxUPE8KX.js} +1 -1
  95. package/dist/packem_shared/{bin-C1XKj-O-.js → bin-Be7_QhQK.js} +1 -1
  96. package/dist/packem_shared/{build-scripts-CEDx_nJp.js → build-scripts-DxyVSkgM.js} +1 -1
  97. package/dist/packem_shared/command-runtime-BXvH5EC0.js +1 -0
  98. package/dist/packem_shared/{dart-pubspec-BK_cK2EP.js → dart-pubspec-DvmyleIr.js} +2 -2
  99. package/dist/packem_shared/{dependency-scan-B8jroa1D.js → dependency-scan-DKK3ZEZI.js} +1 -1
  100. package/dist/packem_shared/{docker-DXqV-07f.js → docker-BTuwdXaC.js} +1 -1
  101. package/dist/packem_shared/{ecosystem-gate-ddru_hOg.js → ecosystem-gate-BpQNUJzN.js} +1 -1
  102. package/dist/packem_shared/env-consistency-CUBJHENL.js +1 -0
  103. package/dist/packem_shared/{failure-log-D2x5BT8S.js → failure-log-kp0n2rbD.js} +1 -1
  104. package/dist/packem_shared/{formatBytes-BHAzNIrn-CrusHOew.js → formatBytes-BHAzNIrn-DRcKvqnb.js} +1 -1
  105. package/dist/packem_shared/git-source-DExWbfN0.js +2 -0
  106. package/dist/packem_shared/{index-BzhrR_iC.js → index-BdMIfGVZ.js} +15 -15
  107. package/dist/packem_shared/index-C9ENZqH9.js +39 -0
  108. package/dist/packem_shared/{index-Chje3u9v.js → index-DQfNpt2u.js} +1 -1
  109. package/dist/packem_shared/{index-DQ2GJzmy.js → index-DsSWb5XH.js} +1 -1
  110. package/dist/packem_shared/{index.server-sXNQYpsl.js → index.server-D8BLnYZO.js} +2 -2
  111. package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-C-_5cgwu.js → isAccessibleSync-DYKTrrvc-BwaMhQs0.js} +1 -1
  112. package/dist/packem_shared/{lifecycle-D6PMPor-.js → lifecycle-BAhkhE2L.js} +1 -1
  113. package/dist/packem_shared/{lockfile-CiUtEbnt.js → lockfile-DHmlPGk1.js} +1 -1
  114. package/dist/packem_shared/{manifests-Du4yKlf_.js → manifests-Dd4Hoztt.js} +1 -1
  115. package/dist/packem_shared/{min-release-age-JViyQuBM.js → min-release-age-BJnOQaoF.js} +1 -1
  116. package/dist/packem_shared/{missing-package-json-Cu5YVAot.js → missing-package-json-DfzrGwe1.js} +1 -1
  117. package/dist/packem_shared/{multi-eco-lockfiles-B2X3yhyo.js → multi-eco-lockfiles-BIa6xvJc.js} +1 -1
  118. package/dist/packem_shared/{native-config-sync-TdTWjVgI.js → native-config-sync-Dr9XvxOf.js} +1 -1
  119. package/dist/packem_shared/osv-bloom-t40ra5U5.js +2 -0
  120. package/dist/packem_shared/{package-version-Dxirp-UO.js → package-version-CFuNUWDG.js} +2 -2
  121. package/dist/packem_shared/{packument-BQv4je9m.js → packument-C9nRiBJf.js} +1 -1
  122. package/dist/packem_shared/pm-runner-ImwtpnWY.js +1 -0
  123. package/dist/packem_shared/{project-name-filter-D6tXD8gd.js → project-name-filter-C2rkW-Vn.js} +1 -1
  124. package/dist/packem_shared/{provenance-DNyVMxNv.js → provenance-DF-ypZj3.js} +1 -1
  125. package/dist/packem_shared/{readJsonSync-CbryXYxN-EWl7_7KX.js → readJsonSync-CbryXYxN-Bm5i10UW.js} +1 -1
  126. package/dist/packem_shared/{registry-keys-DwB3ZXS_.js → registry-keys-BLuHOyZu.js} +1 -1
  127. package/dist/packem_shared/{resolve-explicit-BPsdmuty.js → resolve-explicit-BDaQRR6o.js} +1 -1
  128. package/dist/packem_shared/resolve-runtime-Cr19Pk6L.js +1 -0
  129. package/dist/packem_shared/{run-file-UBukWaha.js → run-file-XbRCF6Mp.js} +1 -1
  130. package/dist/packem_shared/{runtime-check-1U8HrQd9.js → runtime-check-Bh5q9IrT.js} +1 -1
  131. package/dist/packem_shared/{s1ngularity-QD2LD1sO.js → s1ngularity-UCZN7skW.js} +1 -1
  132. package/dist/packem_shared/{scan-progress-CkumcBG-.js → scan-progress-DcYI76zE.js} +1 -1
  133. package/dist/packem_shared/{selectors-edwcgNl3.js → selectors-DCiEU0iv.js} +2 -2
  134. package/dist/packem_shared/{signatures-t8LbOaqr.js → signatures-CicxPHN4.js} +1 -1
  135. package/dist/packem_shared/target-merge-BClIXg2k.js +14 -0
  136. package/dist/packem_shared/{target-options-DsHFmRZH.js → target-options-PgWIuJnb.js} +1 -1
  137. package/dist/packem_shared/task-env-Dl08aklA.js +2 -0
  138. package/dist/packem_shared/toolchain-DvUxlbDz.js +5 -0
  139. package/dist/packem_shared/{typosquats-8u0drCqQ.js → typosquats-DxPzyK7u.js} +1 -1
  140. package/dist/packem_shared/{verify-B_MblU_Q.js → verify-CadR9PUk.js} +1 -1
  141. package/dist/packem_shared/{vis-update-app-BCIccZfA.js → vis-update-app-DrFWQyPn.js} +1 -1
  142. package/dist/packem_shared/{vis-user-error-75VtCwMv.js → vis-user-error-k7CLTpA4.js} +15 -15
  143. package/dist/packem_shared/{watch-CcTketln.js → watch-Dr_6yz3o.js} +1 -1
  144. package/dist/packem_shared/watch-loop-BId9vT7Q.js +11 -0
  145. package/dist/packem_shared/{writeFileSync-DJoHk3Ks-BPRoepNw.js → writeFileSync-DJoHk3Ks-Dhem3Uof.js} +1 -1
  146. package/dist/release/core/version-actions/index.d.ts +1 -1
  147. package/dist/release/presets.d.ts +1 -55
  148. package/dist/release/presets.js +1 -1
  149. package/dist/release/types.d.ts +1 -18
  150. package/dist/runtime/preload.js +1 -1
  151. package/index.d.ts +204 -204
  152. package/index.js +52 -52
  153. package/package.json +10 -10
  154. package/schemas/project.schema.json +44 -1
  155. package/schemas/vis-config.schema.json +128 -35
  156. package/schemas/vis-release-config.schema.json +1 -12
  157. package/skills/vis/SKILL.md +24 -12
  158. package/dist/packem_shared/Table-BB8xHTU5-BLPS917D.js +0 -11
  159. package/dist/packem_shared/affected-shas-B2V84O0g.js +0 -1
  160. package/dist/packem_shared/command-runtime-p4IXiIf6.js +0 -1
  161. package/dist/packem_shared/giget-D8Kwb0kD.js +0 -2
  162. package/dist/packem_shared/index-BisalDCf.js +0 -39
  163. package/dist/packem_shared/osv-bloom-BCAX5ARR.js +0 -2
  164. package/dist/packem_shared/pm-runner-CMSml1Bj.js +0 -1
  165. package/dist/packem_shared/resolve-runtime-CNiHcVtx.js +0 -1
  166. package/dist/packem_shared/target-merge-DVJl-7Qz.js +0 -4
  167. package/dist/packem_shared/toolchain-BRdpaAC4.js +0 -5
  168. package/dist/packem_shared/watch-loop-qRn0IHPG.js +0 -11
@@ -1,4 +1,4 @@
1
- import{createRequire as f}from"node:module";import{d as p,c as I}from"../packem_shared/pm-runner-CMSml1Bj.js";let _;const w=e=>(_??=f(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return w(e)},{createInterface:y}=g("node:readline"),s="sigstore",v=()=>!!process.stdout.isTTY&&process.env.CI!=="true",$=e=>new Promise(t=>{const r=y({input:process.stdin,output:process.stderr});r.question(`${e} (Y/n) `,a=>{r.close();const n=a.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),h=e=>{const t=p(e),r=I(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[s],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:r})},C=()=>{try{return import.meta.resolve(s),!0}catch{return!1}},R=e=>{let t="pnpm";try{t=p(e).name}catch{}switch(t){case"bun":return`bun add -d ${s}`;case"npm":return`npm install -D ${s}`;case"yarn":return`yarn add -D ${s}`;default:return`pnpm add -D ${s}`}},D=()=>import("sigstore"),E=async(e={})=>{const t=e.interactive??v(),r=e.prompt??$,a=e.runInstall??h,n=e.importImpl??D,l=e.workspaceRoot??process.cwd(),i=R(l);try{return await n()}catch(d){const{code:u,message:m}=d;if(!(u==="ERR_MODULE_NOT_FOUND"||u==="MODULE_NOT_FOUND")||!m.includes(s))throw d}if(!t)throw new Error(`${s} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
1
+ import{createRequire as f}from"node:module";import{d as p,c as I}from"../packem_shared/pm-runner-ImwtpnWY.js";let _;const w=e=>(_??=f(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return w(e)},{createInterface:y}=g("node:readline"),s="sigstore",v=()=>!!process.stdout.isTTY&&process.env.CI!=="true",$=e=>new Promise(t=>{const r=y({input:process.stdin,output:process.stderr});r.question(`${e} (Y/n) `,a=>{r.close();const n=a.trim().toLowerCase();t(n===""||n==="y"||n==="yes")})}),h=e=>{const t=p(e),r=I(t,{exact:!1,filter:[],global:!1,optional:!1,packages:[s],peer:!1,saveDev:!0,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:r})},C=()=>{try{return import.meta.resolve(s),!0}catch{return!1}},R=e=>{let t="pnpm";try{t=p(e).name}catch{}switch(t){case"bun":return`bun add -d ${s}`;case"npm":return`npm install -D ${s}`;case"yarn":return`yarn add -D ${s}`;default:return`pnpm add -D ${s}`}},D=()=>import("sigstore"),E=async(e={})=>{const t=e.interactive??v(),r=e.prompt??$,a=e.runInstall??h,n=e.importImpl??D,l=e.workspaceRoot??process.cwd(),i=R(l);try{return await n()}catch(d){const{code:u,message:m}=d;if(!(u==="ERR_MODULE_NOT_FOUND"||u==="MODULE_NOT_FOUND")||!m.includes(s))throw d}if(!t)throw new Error(`${s} is not installed. \`vis attest\` needs it for keyless signing/verification. Install it in your repo first:
2
2
  ${i}`);if(!await r(`${s} isn't installed. Install it now?`))throw new Error(`${s} install declined. Re-run \`vis attest\` after installing manually:
3
3
  ${i}`);const c=await a(l);if(c.exitCode!==0)throw new Error(`Install of ${s} failed (exit ${String(c.exitCode)}). Install manually and retry:
4
4
  ${i}`);return await n()};export{R as installCommandFor,C as isSigstoreInstalled,E as loadOptionalSigstore};
@@ -1,4 +1,4 @@
1
- import{createRequire as ta}from"node:module";import{a as J}from"../packem_shared/index-B4AjSxHU.js";import{DEFAULT_CHANGES_DIR as oe,DEFAULT_DEPENDENCY_BUMP_RULES as ga,DEFAULT_CONFIG as ua}from"./DEFAULT_CLEAN_KEEP.js";import{VisReleaseError as E}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{l as ma,m as fa,p as ha,b as wa}from"./index2.js";import{L as ya}from"../packem_shared/index-BisalDCf.js";import{BUMP_LEVELS as be,maxBump as we,normaliseGroup as $e,bumpRank as ce}from"../release/types.js";import{isValidPackageName as va,escapeMarkdown as ka,assertValidPackageName as Pa}from"./security.js";import le from"./index.js";import{d as ba,c as $a}from"./index3.js";import{createShellRunner as re}from"./shell-runner.js";let ra;const ia=e=>(ra??=ta(import.meta.url))(e),ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pe=e=>{if(typeof ne<"u"&&ne.versions&&ne.versions.node){const[a,s]=ne.versions.node.split(".").map(Number);if(a>22||a===22&&s>=3||a===20&&s>=16)return ne.getBuiltinModule(e)}return ia(e)},{readdir:oa,readFile:ca,writeFile:la,unlink:da}=Pe("node:fs/promises"),{resolve:W,sep:x,join:pa,dirname:ge}=Pe("node:path"),{realpathSync:Ce}=Pe("node:fs"),Ca=/^exit[\s-]prerelease\s*:\s*(.+)$/i,Ra=/^(.+)@(\d+\.\d+\.\d+(?:[-+].*)?)$/,Re=(e,a,s)=>{if(!va(e))throw new E({code:"BUMP_FILE_INVALID",file:s,message:`Invalid replay condition "${a}": ${JSON.stringify(e)} is not a valid package name.`,packageName:e||void 0});return e},Aa=(e,a)=>{if(typeof e!="string"||e.trim()==="")throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Invalid replay condition: ${JSON.stringify(e)}. Expected "name@1.2.0" or "exit-prerelease:name".`});const s=e.trim(),n=Ca.exec(s);if(n)return{kind:"exit-prerelease",package:Re((n[1]??"").trim(),s,a)};const t=Ra.exec(s);if(t)return{kind:"version",package:Re((t[1]??"").trim(),s,a),version:t[2]??""};throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Invalid replay condition "${s}". Expected "name@1.2.0" or "exit-prerelease:name".`})},Na=(e,a)=>{if(!Array.isArray(e))throw new E({code:"BUMP_FILE_INVALID",file:a,message:'`replay` must be a list of conditions (e.g. ["name@1.2.0", "exit-prerelease:name"]).'});return e.map(s=>Aa(s,a))},ye=e=>!("bumps"in e.payload)&&Array.isArray(e.payload.replay)&&e.payload.replay.length>0,Ae=e=>/^\d+\.\d+\.\d+-/.test(e),Ea=(e,a)=>e.package!==a.name?!1:e.kind==="version"?a.newVersion===e.version:Ae(a.oldVersion)&&!Ae(a.newVersion),Ia=(e,a)=>{const s=new Map,n=[],t=[];for(const r of e){if(!ye(r))continue;const l=r.payload.replay;let c=!0;for(const i of l){const o=a.find(d=>Ea(i,d));if(o){const d=s.get(o.name)??[];d.some(u=>u.id===r.id)||d.push(r),s.set(o.name,d)}else c=!1}c?n.push(r):t.push(r)}return{consumed:n,injectionsByPackage:s,retained:t}},Ma=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/,Da=e=>{const a=Ma.exec(e);return a?{body:(a[2]??"").trim(),frontmatter:a[1]??""}:null},ja=/^(?:@[a-z0-9-]+\/)?[\w.-]+(?:\/[\w.-]+)*(?::[\w.-]+)?$/i,_a=214,Sa=e=>e.length===0||e.length>_a||e.startsWith(".")||e.startsWith("_")||e.startsWith("-")?!1:ja.test(e),ve=e=>typeof e=="string"&&be.includes(e),Va=/^ {0,3}(#{1,3})\s+\S/,Fa=/^ {0,3}(?:```|~~~)/,Ta=e=>{let a,s=0,n=!1;for(const t of e.split(/\r?\n/)){if(Fa.test(t)){n=!n;continue}if(n)continue;const r=Va.exec(t);if(!r)continue;const l=(r[1]??"").length,c=4-l;c>s&&(s=c,a=l===1?"major":l===2?"minor":"patch")}return a},La=/^\s*(pr|commit|author)\s*:\s*(.+?)\s*$/i,Oa=e=>{const a=e.split(/\r?\n/),s={};let n=0;for(const r of a){if(r.trim()===""){n+=1;continue}const l=La.exec(r);if(!l)break;const[,c="",i=""]=l;switch(c.toLowerCase()){case"author":{s.author=i.startsWith("@")?i:`@${i}`;break}case"commit":{s.commit=i;break}case"pr":{const d=Number.parseInt(i,10);!Number.isNaN(d)&&d>0&&(s.pr=d);break}}n+=1}const t=a.slice(n).join(`
1
+ import{createRequire as ta}from"node:module";import{a as J}from"../packem_shared/index-B4AjSxHU.js";import{DEFAULT_CHANGES_DIR as oe,DEFAULT_DEPENDENCY_BUMP_RULES as ga,DEFAULT_CONFIG as ua}from"./DEFAULT_CLEAN_KEEP.js";import{VisReleaseError as E}from"../packem_shared/VisReleaseError-DZtgcKf8.js";import{l as ma,m as fa,p as ha,b as wa}from"./index2.js";import{y as ya}from"../packem_shared/index-C9ENZqH9.js";import{BUMP_LEVELS as be,maxBump as we,normaliseGroup as $e,bumpRank as ce}from"../release/types.js";import{isValidPackageName as va,escapeMarkdown as ka,assertValidPackageName as Pa}from"./security.js";import le from"./index.js";import{d as ba,c as $a}from"./index3.js";import{createShellRunner as re}from"./shell-runner.js";let ra;const ia=e=>(ra??=ta(import.meta.url))(e),ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pe=e=>{if(typeof ne<"u"&&ne.versions&&ne.versions.node){const[a,s]=ne.versions.node.split(".").map(Number);if(a>22||a===22&&s>=3||a===20&&s>=16)return ne.getBuiltinModule(e)}return ia(e)},{readdir:oa,readFile:ca,writeFile:la,unlink:da}=Pe("node:fs/promises"),{resolve:W,sep:x,join:pa,dirname:ge}=Pe("node:path"),{realpathSync:Ce}=Pe("node:fs"),Ca=/^exit[\s-]prerelease\s*:\s*(.+)$/i,Ra=/^(.+)@(\d+\.\d+\.\d+(?:[-+].*)?)$/,Re=(e,a,s)=>{if(!va(e))throw new E({code:"BUMP_FILE_INVALID",file:s,message:`Invalid replay condition "${a}": ${JSON.stringify(e)} is not a valid package name.`,packageName:e||void 0});return e},Aa=(e,a)=>{if(typeof e!="string"||e.trim()==="")throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Invalid replay condition: ${JSON.stringify(e)}. Expected "name@1.2.0" or "exit-prerelease:name".`});const s=e.trim(),n=Ca.exec(s);if(n)return{kind:"exit-prerelease",package:Re((n[1]??"").trim(),s,a)};const t=Ra.exec(s);if(t)return{kind:"version",package:Re((t[1]??"").trim(),s,a),version:t[2]??""};throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Invalid replay condition "${s}". Expected "name@1.2.0" or "exit-prerelease:name".`})},Na=(e,a)=>{if(!Array.isArray(e))throw new E({code:"BUMP_FILE_INVALID",file:a,message:'`replay` must be a list of conditions (e.g. ["name@1.2.0", "exit-prerelease:name"]).'});return e.map(s=>Aa(s,a))},ye=e=>!("bumps"in e.payload)&&Array.isArray(e.payload.replay)&&e.payload.replay.length>0,Ae=e=>/^\d+\.\d+\.\d+-/.test(e),Ea=(e,a)=>e.package!==a.name?!1:e.kind==="version"?a.newVersion===e.version:Ae(a.oldVersion)&&!Ae(a.newVersion),Ia=(e,a)=>{const s=new Map,n=[],t=[];for(const r of e){if(!ye(r))continue;const l=r.payload.replay;let c=!0;for(const i of l){const o=a.find(d=>Ea(i,d));if(o){const d=s.get(o.name)??[];d.some(u=>u.id===r.id)||d.push(r),s.set(o.name,d)}else c=!1}c?n.push(r):t.push(r)}return{consumed:n,injectionsByPackage:s,retained:t}},Ma=/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/,Da=e=>{const a=Ma.exec(e);return a?{body:(a[2]??"").trim(),frontmatter:a[1]??""}:null},ja=/^(?:@[a-z0-9-]+\/)?[\w.-]+(?:\/[\w.-]+)*(?::[\w.-]+)?$/i,_a=214,Sa=e=>e.length===0||e.length>_a||e.startsWith(".")||e.startsWith("_")||e.startsWith("-")?!1:ja.test(e),ve=e=>typeof e=="string"&&be.includes(e),Va=/^ {0,3}(#{1,3})\s+\S/,Fa=/^ {0,3}(?:```|~~~)/,Ta=e=>{let a,s=0,n=!1;for(const t of e.split(/\r?\n/)){if(Fa.test(t)){n=!n;continue}if(n)continue;const r=Va.exec(t);if(!r)continue;const l=(r[1]??"").length,c=4-l;c>s&&(s=c,a=l===1?"major":l===2?"minor":"patch")}return a},La=/^\s*(pr|commit|author)\s*:\s*(.+?)\s*$/i,Oa=e=>{const a=e.split(/\r?\n/),s={};let n=0;for(const r of a){if(r.trim()===""){n+=1;continue}const l=La.exec(r);if(!l)break;const[,c="",i=""]=l;switch(c.toLowerCase()){case"author":{s.author=i.startsWith("@")?i:`@${i}`;break}case"commit":{s.commit=i;break}case"pr":{const d=Number.parseInt(i,10);!Number.isNaN(d)&&d>0&&(s.pr=d);break}}n+=1}const t=a.slice(n).join(`
2
2
  `).trim();return{meta:Object.keys(s).length>0?s:void 0,remainder:t}},Ne=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&("bump"in e||"replay"in e),Ba=(e,a,s)=>{const n=a.replay!==void 0;if(n&&a.bump!==void 0)throw new E({code:"BUMP_FILE_INVALID",file:s,message:`"${e}" sets both \`bump\` and \`replay\`. Replay files are changelog-only and never bump — remove \`bump\`, or drop \`replay\` to make this a normal change file.`,packageName:e});const t=a.bump===void 0&&n?"none":a.bump;if(!ve(t))throw new E({code:"BUMP_FILE_INVALID",file:s,message:`Invalid bump level for "${e}": ${JSON.stringify(a.bump)}. Expected one of: ${be.join(", ")}`,packageName:e});const r={bump:t,package:e};if(n&&(r.replay=Na(a.replay,s)),a.releaseAs!==void 0){if(typeof a.releaseAs!="string"||!/^\d+\.\d+\.\d+(?:[-+].*)?$/.test(a.releaseAs))throw new E({code:"BUMP_FILE_INVALID",file:s,message:`Invalid releaseAs for "${e}": ${JSON.stringify(a.releaseAs)}. Expected a semver string like "2.0.0" or "2.0.0-rc.1".`,packageName:e});r.releaseAs=a.releaseAs}if(a.cascade!==void 0){if(typeof a.cascade!="object"||a.cascade===null||Array.isArray(a.cascade))throw new E({code:"BUMP_FILE_INVALID",file:s,message:`Cascade block for "${e}" must be an object mapping package globs to bump levels.`,packageName:e});const l={};for(const[c,i]of Object.entries(a.cascade)){if(!ve(i))throw new E({code:"BUMP_FILE_INVALID",file:s,message:`Invalid cascade bump level for "${c}": ${JSON.stringify(i)}.`,packageName:e});l[c]=i}r.cascade=l}return r},ue=e=>e.replaceAll(/^.*[/\\]/g,"").replace(/\.md$/i,""),Ga=(e,a)=>{const s=Da(e);if(!s)throw new E({code:"BUMP_FILE_INVALID",file:a,message:"Change file is missing YAML frontmatter (expected `---` delimiters)."});let n;try{n=ya(s.frontmatter,{strict:!0})}catch(i){throw new E({cause:i,code:"BUMP_FILE_INVALID",file:a,message:`YAML parse failed: ${i.message}`})}if(n==null)return{body:s.body.trim(),id:ue(a),path:a,payload:{bumps:{}}};if(typeof n!="object"||Array.isArray(n))throw new E({code:"BUMP_FILE_INVALID",file:a,message:"Frontmatter must be a YAML object mapping package names to bump levels."});const t=Object.entries(n);if(t.length===0)return{body:s.body.trim(),id:ue(a),path:a,payload:{bumps:{}}};for(const[i]of t)if(!Sa(i))throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Invalid package name: ${JSON.stringify(i)}.`,packageName:i});let r;if(t.length===1&&Ne(t[0][1])){const[i,o]=t[0];r=Ba(i,o,a)}else{const i={},o=[];for(const[d,u]of t){if(Ne(u))throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Mixed simple + nested entries are not allowed. Package "${d}" uses the nested shape but the file has multiple top-level entries.`,packageName:d});if(u==null||u===""){o.push(d);continue}if(!ve(u))throw new E({code:"BUMP_FILE_INVALID",file:a,message:`Invalid bump level for "${d}": ${JSON.stringify(u)}. Expected one of: ${be.join(", ")}`,packageName:d});i[d]=u}if(o.length>0){const d=Ta(s.body);if(!d)throw new E({code:"BUMP_FILE_INVALID",file:a,message:`No bump level for ${o.map(u=>`"${u}"`).join(", ")}: the entry is empty and the body has no markdown heading to infer one from. Add an explicit level (e.g. \`${o[0]}: minor\`) or a heading (\`# major\`, \`## minor\`, \`### patch\`).`,packageName:o[0]});for(const u of o)i[u]=d}r={bumps:i}}const{meta:l,remainder:c}=Oa(s.body);return{body:c,id:ue(a),meta:l,path:a,payload:r}},Bs=(e,a)=>{let s;if("bumps"in e){const n=Object.entries(e.bumps).map(([t,r])=>`${me(t)}: ${r}`);s=n.length>0?n.join(`
3
3
  `):"{}"}else{const n=[`${me(e.package)}:`,` bump: ${e.bump}`];if(e.releaseAs&&n.push(` releaseAs: ${e.releaseAs}`),e.cascade){n.push(" cascade:");for(const[t,r]of Object.entries(e.cascade))n.push(` ${me(t)}: ${r}`)}if(e.replay&&e.replay.length>0){n.push(" replay:");for(const t of e.replay){const r=t.kind==="version"?`${t.package}@${t.version}`:`exit-prerelease:${t.package}`;n.push(` - "${r}"`)}}s=n.join(`
4
4
  `)}return`---
@@ -1,4 +1,4 @@
1
- import{createRequire as p}from"node:module";import{F as i}from"../packem_shared/index.server-sXNQYpsl.js";let m;const d=r=>(m??=p(import.meta.url))(r),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[e,t]=c.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return c.getBuiltinModule(r)}return d(r)},{createInterface:a}=w("node:readline"),l=(r,e)=>new Promise(t=>{r.question(e,n=>{t(n.trim())})}),y=async(r,e=!0)=>{const t=a({input:process.stdin,output:process.stdout});try{const s=await l(t,`${r} ${i(e?"[Y/n]":"[y/N]")} `);return s===""?e:/^y(?:es)?$/i.test(s)}finally{t.close()}},$=async(r,e="")=>{const t=a({input:process.stdin,output:process.stdout});try{const n=e?` ${i(`(${e})`)}`:"",s=await l(t,`${r}${n} `);return s===""?e:s}finally{t.close()}},_=async(r,e)=>{if(e.length===0)throw new Error("selectPrompt called with no options.");const t=a({input:process.stdin,output:process.stdout});try{process.stdout.write(`${r}
1
+ import{createRequire as p}from"node:module";import{F as i}from"../packem_shared/index.server-D8BLnYZO.js";let m;const d=r=>(m??=p(import.meta.url))(r),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[e,t]=c.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return c.getBuiltinModule(r)}return d(r)},{createInterface:a}=w("node:readline"),l=(r,e)=>new Promise(t=>{r.question(e,n=>{t(n.trim())})}),y=async(r,e=!0)=>{const t=a({input:process.stdin,output:process.stdout});try{const s=await l(t,`${r} ${i(e?"[Y/n]":"[y/N]")} `);return s===""?e:/^y(?:es)?$/i.test(s)}finally{t.close()}},$=async(r,e="")=>{const t=a({input:process.stdin,output:process.stdout});try{const n=e?` ${i(`(${e})`)}`:"",s=await l(t,`${r}${n} `);return s===""?e:s}finally{t.close()}},_=async(r,e)=>{if(e.length===0)throw new Error("selectPrompt called with no options.");const t=a({input:process.stdin,output:process.stdout});try{process.stdout.write(`${r}
2
2
  `);for(const[n,s]of e.entries())process.stdout.write(` ${n+1}) ${s.label}
3
3
  `);for(;;){const n=await l(t,i(` [1-${e.length}] `)),s=Number.parseInt(n,10);if(!Number.isNaN(s)&&s>=1&&s<=e.length)return e[s-1].value;process.stdout.write(i(` Please enter a number between 1 and ${e.length}.
4
4
  `))}}finally{t.close()}},b=async(r,e)=>{if(e.length===0)throw new Error("multiSelectPrompt called with no options.");const t=a({input:process.stdin,output:process.stdout});try{process.stdout.write(`${r}
@@ -1,2 +1,2 @@
1
- import{b as d,F as i,J as l}from"../packem_shared/index.server-sXNQYpsl.js";import{p as a}from"./cli-main.js";import{r as y,g}from"./catalog.js";const h=n=>{if(n===0)return"0 B";const r=["B","KB","MB","GB"],o=Math.min(Math.floor(Math.log(n)/Math.log(1024)),r.length-1),s=n/1024**o;return`${s.toFixed(s<10&&o>0?1:0)} ${r[o]}`},v=n=>{if(!n)return"never";const r=Date.parse(n);if(Number.isNaN(r))return n;const o=Date.now()-r;if(o<0)return n;const s=Math.floor(o/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const t=Math.floor(s/60);return t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`},$=async({logger:n,options:r,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const s=r.db??y(o),t=await g(o,s);if(r.format==="json"){process.stdout.write(`${JSON.stringify({dbPath:s,ecosystems:t.ecosystems.map(e=>({advisoryCount:e.advisoryCount,lastSyncIso:e.lastSyncIso,manifestEtag:e.manifestEtag??null,name:e.name})),exists:t.exists,schemaVersion:t.schemaVersion,sizeBytes:t.sizeBytes},void 0,2)}
1
+ import{b as d,F as i,J as l}from"../packem_shared/index.server-D8BLnYZO.js";import{p as a}from"./cli-main.js";import{r as y,g}from"./catalog.js";const h=n=>{if(n===0)return"0 B";const r=["B","KB","MB","GB"],o=Math.min(Math.floor(Math.log(n)/Math.log(1024)),r.length-1),s=n/1024**o;return`${s.toFixed(s<10&&o>0?1:0)} ${r[o]}`},v=n=>{if(!n)return"never";const r=Date.parse(n);if(Number.isNaN(r))return n;const o=Date.now()-r;if(o<0)return n;const s=Math.floor(o/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;const t=Math.floor(s/60);return t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`},$=async({logger:n,options:r,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const s=r.db??y(o),t=await g(o,s);if(r.format==="json"){process.stdout.write(`${JSON.stringify({dbPath:s,ecosystems:t.ecosystems.map(e=>({advisoryCount:e.advisoryCount,lastSyncIso:e.lastSyncIso,manifestEtag:e.manifestEtag??null,name:e.name})),exists:t.exists,schemaVersion:t.schemaVersion,sizeBytes:t.sizeBytes},void 0,2)}
2
2
  `);return}if(a.info(`DB: ${s}`),!t.exists){a.warn(`No advisory DB yet. Run ${d("vis advisories sync")} to populate.`);return}if(a.info(`Schema: v${t.schemaVersion} Size: ${h(t.sizeBytes)}`),t.ecosystems.length===0){a.warn("DB exists but contains no ecosystems. Run `vis advisories sync`.");return}a.info(""),a.info("Ecosystem Advisories Last sync ETag"),a.info(i("────────── ────────── ───────────────── ──────"));for(const e of t.ecosystems){const c=e.name.padEnd(10),u=e.advisoryCount.toLocaleString().padStart(10),m=`${e.lastSyncIso||"never"} (${v(e.lastSyncIso)})`.padEnd(19),f=e.manifestEtag??i("—");a.info(`${l(c)} ${u} ${m} ${f}`)}},E=$;export{E as advisoriesStatusExecute};
@@ -1,3 +1,3 @@
1
- import{F as v}from"../packem_shared/index.server-sXNQYpsl.js";import{p as c}from"./cli-main.js";import{s as S}from"../packem_shared/scan-progress-CkumcBG-.js";import{D as $,s as b,A as D}from"./catalog.js";import{c as w}from"../packem_shared/multi-eco-lockfiles-B2X3yhyo.js";const E=o=>o?.security?.audit?.advisories??{},A=o=>o?o.split(",").map(t=>t.trim()).filter(t=>t.length>0).map(t=>w(t)):["npm"],C=async({logger:o,options:t,visConfig:p,workspaceRoot:d})=>{if(!d)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const l=t.format==="json",u=E(p),m=t.source??u.source??$,f=A(t.ecosystem),y=f.map(s=>({id:s,label:`Sync ${s} advisories`})),n=S(y,{live:!l}),i=[];try{for(const s of f){n.start(s);const e=Date.now();try{const r=await b({allowedHosts:u.allowedHosts,dbPath:t.db,ecosystem:s,force:!!t.force,source:m,workspaceRoot:d});i.push({ecosystem:s,result:r}),r.upToDate?n.finish(s,"ok",`up to date · ${h(Date.now()-e)}`):n.finish(s,"ok",`${r.advisoriesIngested.toLocaleString()} advisories · ${h(r.durationMs)}`)}catch(r){const a=r instanceof Error?r.message:String(r);i.push({ecosystem:s,error:a}),n.finish(s,"error",a)}}}finally{n.stop()}const g=i.find(s=>s.result?.rebuiltFromSchema!==void 0)?.result?.rebuiltFromSchema;if(g!==void 0){const s=`advisory database is schema v${String(g)}; rebuilt to v${String(D)}`;l?process.stderr.write(`${s}
1
+ import{F as v}from"../packem_shared/index.server-D8BLnYZO.js";import{p as c}from"./cli-main.js";import{s as S}from"../packem_shared/scan-progress-DcYI76zE.js";import{D as $,s as b,A as D}from"./catalog.js";import{c as w}from"../packem_shared/multi-eco-lockfiles-BIa6xvJc.js";const E=o=>o?.security?.audit?.advisories??{},A=o=>o?o.split(",").map(t=>t.trim()).filter(t=>t.length>0).map(t=>w(t)):["npm"],C=async({logger:o,options:t,visConfig:p,workspaceRoot:d})=>{if(!d)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const l=t.format==="json",u=E(p),m=t.source??u.source??$,f=A(t.ecosystem),y=f.map(s=>({id:s,label:`Sync ${s} advisories`})),n=S(y,{live:!l}),i=[];try{for(const s of f){n.start(s);const e=Date.now();try{const r=await b({allowedHosts:u.allowedHosts,dbPath:t.db,ecosystem:s,force:!!t.force,source:m,workspaceRoot:d});i.push({ecosystem:s,result:r}),r.upToDate?n.finish(s,"ok",`up to date · ${h(Date.now()-e)}`):n.finish(s,"ok",`${r.advisoriesIngested.toLocaleString()} advisories · ${h(r.durationMs)}`)}catch(r){const a=r instanceof Error?r.message:String(r);i.push({ecosystem:s,error:a}),n.finish(s,"error",a)}}}finally{n.stop()}const g=i.find(s=>s.result?.rebuiltFromSchema!==void 0)?.result?.rebuiltFromSchema;if(g!==void 0){const s=`advisory database is schema v${String(g)}; rebuilt to v${String(D)}`;l?process.stderr.write(`${s}
2
2
  `):c.info(s)}if(l){const s={ecosystems:i.map(e=>({advisoriesIngested:e.result?.advisoriesIngested??0,dbPath:e.result?.dbPath??null,durationMs:e.result?.durationMs??0,ecosystem:e.ecosystem,error:e.error??null,upToDate:e.result?.upToDate??!1})),source:m};process.stdout.write(`${JSON.stringify(s,void 0,2)}
3
3
  `)}else{const s=i.filter(a=>a.error),e=i.filter(a=>a.result),r=e[0];r?.result?.dbPath&&c.info(v(`DB: ${r.result.dbPath}`)),s.length===0?c.success(`Synced ${e.length} ecosystem${e.length===1?"":"s"}.`):c.error(`${s.length} ecosystem${s.length===1?"":"s"} failed to sync.`)}i.some(s=>s.error)&&(process.exitCode=1)},h=o=>o>=1e3?`${(o/1e3).toFixed(1)}s`:`${Math.round(o)}ms`,M=C;export{M as advisoriesSyncExecute,A as parseEcosystems};
@@ -1,2 +1,2 @@
1
- import{p as n}from"./cli-main.js";import{d as u}from"../packem_shared/pm-runner-CMSml1Bj.js";import{s as p}from"../packem_shared/native-config-sync-TdTWjVgI.js";import{s as g}from"../packem_shared/min-release-age-JViyQuBM.js";const y=new Set(["bun","npm","pnpm","yarn"]),S=({options:c,visConfig:a,workspaceRoot:l})=>{const i=l??process.cwd(),e=u(i);if(!y.has(e.name)){n.warn(`Package manager '${e.name}' has no native security config to sync.`);return}if(!a?.security){n.warn("vis.config has no `security` block — nothing to sync.");return}const t=a.security.policies??{},r=Object.fromEntries(Object.entries(t.installScripts?.allow??{}).filter(([,o])=>o)),f=t.firstSeen?.minutes,m=t.firstSeen?.exclude??[],s=[];if(Object.keys(r).length>0&&!c.skipAllowBuilds&&s.push(...p(e.name,i,r)),c.skipMinReleaseAge||s.push(...g(e.name,i,f,m)),s.length===0){n.success("Nothing to sync — vis.config and native PM config are aligned.");return}n.info(`Syncing vis.config security settings to ${e.name} native config…
1
+ import{p as n}from"./cli-main.js";import{d as u}from"../packem_shared/pm-runner-ImwtpnWY.js";import{s as p}from"../packem_shared/native-config-sync-Dr9XvxOf.js";import{s as g}from"../packem_shared/min-release-age-BJnOQaoF.js";const y=new Set(["bun","npm","pnpm","yarn"]),S=({options:c,visConfig:a,workspaceRoot:l})=>{const i=l??process.cwd(),e=u(i);if(!y.has(e.name)){n.warn(`Package manager '${e.name}' has no native security config to sync.`);return}if(!a?.security){n.warn("vis.config has no `security` block — nothing to sync.");return}const t=a.security.policies??{},r=Object.fromEntries(Object.entries(t.installScripts?.allow??{}).filter(([,o])=>o)),f=t.firstSeen?.minutes,m=t.firstSeen?.exclude??[],s=[];if(Object.keys(r).length>0&&!c.skipAllowBuilds&&s.push(...p(e.name,i,r)),c.skipMinReleaseAge||s.push(...g(e.name,i,f,m)),s.length===0){n.success("Nothing to sync — vis.config and native PM config are aligned.");return}n.info(`Syncing vis.config security settings to ${e.name} native config…
2
2
  `);for(const o of s)n.success(` ${o}`)};export{S as default};
@@ -1,3 +1,3 @@
1
- import{createRequire as lr}from"node:module";import{_ as fr}from"../packem_shared/giget-D8Kwb0kD.js";let dr;const ur=t=>(dr??=lr(import.meta.url))(t),Ft=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=t=>{if(typeof Ft<"u"&&Ft.versions&&Ft.versions.node){const[e,i]=Ft.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return Ft.getBuiltinModule(t)}return ur(t)},d=D("node:fs"),cr=D("node:fs/promises"),As=D("node:stream"),c=D("node:path"),{posix:Rt,basename:mr,win32:pr,join:Ns}=c,Is=D("events"),{EventEmitter:vr}=Is,p=D("fs"),{EventEmitter:zi}=D("node:events"),{StringDecoder:yr}=D("node:string_decoder"),re=D("path"),{parse:br,dirname:gr}=re,vi=D("assert"),{Buffer:bt}=D("buffer"),Xi=D("zlib"),qi={...Xi,default:Xi},Er=D("zlib"),wr=D("node:assert"),{randomBytes:Bs}=D("node:crypto");var an=fr({Header:()=>ot,Pack:()=>ae,PackJob:()=>Li,PackSync:()=>je,Parser:()=>At,Pax:()=>he,ReadEntry:()=>Gs,Unpack:()=>Me,UnpackSync:()=>Pi,WriteEntry:()=>Yi,WriteEntrySync:()=>Vs,WriteEntryTar:()=>Ks,c:()=>bs,create:()=>bs,extract:()=>Ds,filesFilter:()=>Wi,list:()=>Bt,r:()=>yt,replace:()=>yt,t:()=>Bt,types:()=>Hs,x:()=>Ds}),Rr=Object.defineProperty,_r=(t,e)=>{for(var i in e)Rr(t,i,{get:e[i],enumerable:!0})},Qi=process||{stdout:null,stderr:null},Sr=t=>!!t&&typeof t=="object"&&(t instanceof wt||t instanceof As||Or(t)||kr(t)),Or=t=>!!t&&typeof t=="object"&&t instanceof zi&&typeof t.pipe=="function"&&t.pipe!==As.Writable.prototype.pipe,kr=t=>!!t&&typeof t=="object"&&t instanceof zi&&typeof t.write=="function"&&typeof t.end=="function",G=Symbol("EOF"),$=Symbol("maybeEmitEnd"),q=Symbol("emittedEnd"),oe=Symbol("emittingEnd"),Mt=Symbol("emittedError"),le=Symbol("closed"),Ji=Symbol("read"),de=Symbol("flush"),ts=Symbol("flushChunk"),B=Symbol("encoding"),_t=Symbol("decoder"),R=Symbol("flowing"),Ct=Symbol("paused"),Tt=Symbol("resume"),_=Symbol("buffer"),x=Symbol("pipes"),S=Symbol("bufferLength"),Ze=Symbol("bufferPush"),ue=Symbol("bufferShift"),L=Symbol("objectMode"),E=Symbol("destroyed"),We=Symbol("error"),Ge=Symbol("emitData"),es=Symbol("emitEnd"),$e=Symbol("emitEnd2"),z=Symbol("async"),Ye=Symbol("abort"),fe=Symbol("aborted"),Pt=Symbol("signal"),lt=Symbol("dataListeners"),A=Symbol("discarded"),zt=t=>Promise.resolve().then(t),Tr=t=>t(),Lr=t=>t==="end"||t==="finish"||t==="prefinish",xr=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,Dr=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Fs=class{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[Tt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ar=class extends Fs{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=s=>this.dest.emit("error",s),t.on("error",this.proxyErrors)}},Nr=t=>!!t.objectMode,Ir=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",wt=class extends zi{[R]=!1;[Ct]=!1;[x]=[];[_]=[];[L];[B];[z];[_t];[G]=!1;[q]=!1;[oe]=!1;[le]=!1;[Mt]=null;[S]=0;[E]=!1;[Pt];[fe]=!1;[lt]=0;[A]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");Nr(e)?(this[L]=!0,this[B]=null):Ir(e)?(this[B]=e.encoding,this[L]=!1):(this[L]=!1,this[B]=null),this[z]=!!e.async,this[_t]=this[B]?new yr(this[B]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[_]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[x]});let{signal:i}=e;i&&(this[Pt]=i,i.aborted?this[Ye]():i.addEventListener("abort",()=>this[Ye]()))}get bufferLength(){return this[S]}get encoding(){return this[B]}set encoding(t){throw Error("Encoding must be set at instantiation time")}setEncoding(t){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[L]}set objectMode(t){throw Error("objectMode must be set at instantiation time")}get async(){return this[z]}set async(t){this[z]=this[z]||!!t}[Ye](){this[fe]=!0,this.emit("abort",this[Pt]?.reason),this.destroy(this[Pt]?.reason)}get aborted(){return this[fe]}set aborted(t){}write(t,e,i){if(this[fe])return!1;if(this[G])throw Error("write after end");if(this[E])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(i=e,e="utf8"),e||="utf8";let s=this[z]?zt:Tr;if(!this[L]&&!Buffer.isBuffer(t)){if(Dr(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(xr(t))t=Buffer.from(t);else if(typeof t!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[L]?(this[R]&&this[S]!==0&&this[de](!0),this[R]?this.emit("data",t):this[Ze](t),this[S]!==0&&this.emit("readable"),i&&s(i),this[R]):t.length?(typeof t=="string"&&!(e===this[B]&&!this[_t]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[B]&&(t=this[_t].write(t)),this[R]&&this[S]!==0&&this[de](!0),this[R]?this.emit("data",t):this[Ze](t),this[S]!==0&&this.emit("readable"),i&&s(i),this[R]):(this[S]!==0&&this.emit("readable"),i&&s(i),this[R])}read(t){if(this[E])return null;if(this[A]=!1,this[S]===0||t===0||t&&t>this[S])return this[$](),null;this[L]&&(t=null),this[_].length>1&&!this[L]&&(this[_]=[this[B]?this[_].join(""):Buffer.concat(this[_],this[S])]);let e=this[Ji](t||null,this[_][0]);return this[$](),e}[Ji](t,e){if(this[L])this[ue]();else{let i=e;t===i.length||t===null?this[ue]():typeof i=="string"?(this[_][0]=i.slice(t),e=i.slice(0,t),this[S]-=t):(this[_][0]=i.subarray(t),e=i.subarray(0,t),this[S]-=t)}return this.emit("data",e),!this[_].length&&!this[G]&&this.emit("drain"),e}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e="utf8"),t!==void 0&&this.write(t,e),i&&this.once("end",i),this[G]=!0,this.writable=!1,(this[R]||!this[Ct])&&this[$](),this}[Tt](){this[E]||(!this[lt]&&!this[x].length&&(this[A]=!0),this[Ct]=!1,this[R]=!0,this.emit("resume"),this[_].length?this[de]():this[G]?this[$]():this.emit("drain"))}resume(){return this[Tt]()}pause(){this[R]=!1,this[Ct]=!0,this[A]=!1}get destroyed(){return this[E]}get flowing(){return this[R]}get paused(){return this[Ct]}[Ze](t){this[L]?this[S]+=1:this[S]+=t.length,this[_].push(t)}[ue](){return this[L]?--this[S]:this[S]-=this[_][0].length,this[_].shift()}[de](t=!1){do;while(this[ts](this[ue]())&&this[_].length);!t&&!this[_].length&&!this[G]&&this.emit("drain")}[ts](t){return this.emit("data",t),this[R]}pipe(t,e){if(this[E])return t;this[A]=!1;let i=this[q];return e||={},t===Qi.stdout||t===Qi.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[x].push(e.proxyErrors?new Ar(this,t,e):new Fs(this,t,e)),this[z]?zt(()=>this[Tt]()):this[Tt]()),t}unpipe(t){let e=this[x].find(i=>i.dest===t);e&&(this[x].length===1?(this[R]&&this[lt]===0&&(this[R]=!1),this[x]=[]):this[x].splice(this[x].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let i=super.on(t,e);if(t==="data")this[A]=!1,this[lt]++,!this[x].length&&!this[R]&&this[Tt]();else if(t==="readable"&&this[S]!==0)super.emit("readable");else if(Lr(t)&&this[q])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Mt]){let s=e;this[z]?zt(()=>s.call(this,this[Mt])):s.call(this,this[Mt])}return i}removeListener(t,e){return this.off(t,e)}off(t,e){let i=super.off(t,e);return t==="data"&&(this[lt]=this.listeners("data").length,this[lt]===0&&!this[A]&&!this[x].length&&(this[R]=!1)),i}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[lt]=0,!this[A]&&!this[x].length&&(this[R]=!1)),e}get emittedEnd(){return this[q]}[$](){!this[oe]&&!this[q]&&!this[E]&&this[_].length===0&&this[G]&&(this[oe]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[le]&&this.emit("close"),this[oe]=!1)}emit(t,...e){let i=e[0];if(t!=="error"&&t!=="close"&&t!==E&&this[E])return!1;if(t==="data")return!this[L]&&!i?!1:this[z]?(zt(()=>this[Ge](i)),!0):this[Ge](i);if(t==="end")return this[es]();if(t==="close"){if(this[le]=!0,!this[q]&&!this[E])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(t==="error"){this[Mt]=i,super.emit(We,i);let r=!this[Pt]||this.listeners("error").length?super.emit("error",i):!1;return this[$](),r}else if(t==="resume"){let r=super.emit("resume");return this[$](),r}else if(t==="finish"||t==="prefinish"){let r=super.emit(t);return this.removeAllListeners(t),r}let s=super.emit(t,...e);return this[$](),s}[Ge](t){for(let i of this[x])i.dest.write(t)===!1&&this.pause();let e=!this[A]&&super.emit("data",t);return this[$](),e}[es](){return this[q]?!1:(this[q]=!0,this.readable=!1,this[z]?(zt(()=>this[$e]()),!0):this[$e]())}[$e](){if(this[_t]){let e=this[_t].end();if(e){for(let i of this[x])i.dest.write(e);this[A]||super.emit("data",e)}}for(let e of this[x])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[L]||(t.dataLength=0);let e=this.promise();return this.on("data",i=>{t.push(i),this[L]||(t.dataLength+=i.length)}),await e,t}async concat(){if(this[L])throw Error("cannot concat in objectMode");let t=await this.collect();return this[B]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(E,()=>e(Error("stream destroyed"))),this.on("error",i=>e(i)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[A]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[G])return e();let s,r,h=l=>{this.off("data",n),this.off("end",a),this.off(E,o),e(),r(l)},n=l=>{this.off("error",h),this.off("end",a),this.off(E,o),this.pause(),s({value:l,done:!!this[G]})},a=()=>{this.off("error",h),this.off("data",n),this.off(E,o),e(),s({done:!0,value:void 0})},o=()=>h(Error("stream destroyed"));return new Promise((l,u)=>{r=u,s=l,this.once(E,o),this.once("error",h),this.once("end",a),this.once("data",n)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[A]=!1;let t=!1,e=()=>(this.pause(),this.off(We,e),this.off(E,e),this.off("end",e),t=!0,{done:!0,value:void 0});return this.once("end",e),this.once(We,e),this.once(E,e),{next:()=>{if(t)return e();let i=this.read();return i===null?e():{done:!1,value:i}},throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[E])return t?this.emit("error",t):this.emit(E),this;this[E]=!0,this[A]=!0,this[_].length=0,this[S]=0;let e=this;return typeof e.close=="function"&&!this[le]&&e.close(),t?this.emit("error",t):this.emit(E),this}static get isStream(){return Sr}},Br=p.writev,nt=Symbol("_autoClose"),P=Symbol("_close"),Ut=Symbol("_ended"),m=Symbol("_fd"),Ve=Symbol("_finished"),X=Symbol("_flags"),Ke=Symbol("_flush"),yi=Symbol("_handleChunk"),bi=Symbol("_makeBuf"),qt=Symbol("_mode"),ce=Symbol("_needDrain"),Nt=Symbol("_onerror"),It=Symbol("_onopen"),Xe=Symbol("_onread"),Lt=Symbol("_onwrite"),at=Symbol("_open"),C=Symbol("_path"),et=Symbol("_pos"),U=Symbol("_queue"),xt=Symbol("_read"),qe=Symbol("_readSize"),K=Symbol("_reading"),jt=Symbol("_remain"),Qe=Symbol("_size"),_e=Symbol("_write"),dt=Symbol("_writing"),Se=Symbol("_defaultFlag"),gt=Symbol("_errored"),Ui=class extends wt{[gt]=!1;[m];[C];[qe];[K]=!1;[Qe];[jt];[nt];constructor(t,e){if(e||={},super(e),this.readable=!0,this.writable=!1,typeof t!="string")throw TypeError("path must be a string");this[gt]=!1,this[m]=typeof e.fd=="number"?e.fd:void 0,this[C]=t,this[qe]=e.readSize||16*1024*1024,this[K]=!1,this[Qe]=typeof e.size=="number"?e.size:1/0,this[jt]=this[Qe],this[nt]=typeof e.autoClose!="boolean"||e.autoClose,typeof this[m]=="number"?this[xt]():this[at]()}get fd(){return this[m]}get path(){return this[C]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[at](){p.open(this[C],"r",(t,e)=>this[It](t,e))}[It](t,e){t?this[Nt](t):(this[m]=e,this.emit("open",e),this[xt]())}[bi](){return Buffer.allocUnsafe(Math.min(this[qe],this[jt]))}[xt](){if(!this[K]){this[K]=!0;let t=this[bi]();if(t.length===0)return process.nextTick(()=>this[Xe](null,0,t));p.read(this[m],t,0,t.length,null,(e,i,s)=>this[Xe](e,i,s))}}[Xe](t,e,i){this[K]=!1,t?this[Nt](t):this[yi](e,i)&&this[xt]()}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.close(t,e=>e?this.emit("error",e):this.emit("close"))}}[Nt](t){this[K]=!0,this[P](),this.emit("error",t)}[yi](t,e){let i=!1;return this[jt]-=t,t>0&&(i=super.write(t<e.length?e.subarray(0,t):e)),(t===0||this[jt]<=0)&&(i=!1,this[P](),super.end()),i}emit(t,...e){switch(t){case"prefinish":case"finish":return!1;case"drain":return typeof this[m]=="number"&&this[xt](),!1;case"error":return this[gt]?!1:(this[gt]=!0,super.emit(t,...e));default:return super.emit(t,...e)}}},Fr=class extends Ui{[at](){let t=!0;try{this[It](null,p.openSync(this[C],"r")),t=!1}finally{t&&this[P]()}}[xt](){let t=!0;try{if(!this[K]){this[K]=!0;do{let e=this[bi](),i=e.length===0?0:p.readSync(this[m],e,0,e.length,null);if(!this[yi](i,e))break}while(!0);this[K]=!1}t=!1}finally{t&&this[P]()}}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.closeSync(t),this.emit("close")}}},Ce=class extends Is{readable=!1;writable=!0;[gt]=!1;[dt]=!1;[Ut]=!1;[U]=[];[ce]=!1;[C];[qt];[nt];[m];[Se];[X];[Ve]=!1;[et];constructor(t,e){e||={},super(e),this[C]=t,this[m]=typeof e.fd=="number"?e.fd:void 0,this[qt]=e.mode===void 0?438:e.mode,this[et]=typeof e.start=="number"?e.start:void 0,this[nt]=typeof e.autoClose!="boolean"||e.autoClose;let i=this[et]===void 0?"w":"r+";this[Se]=e.flags===void 0,this[X]=e.flags===void 0?i:e.flags,this[m]===void 0&&this[at]()}emit(t,...e){if(t==="error"){if(this[gt])return!1;this[gt]=!0}return super.emit(t,...e)}get fd(){return this[m]}get path(){return this[C]}[Nt](t){this[P](),this[dt]=!0,this.emit("error",t)}[at](){p.open(this[C],this[X],this[qt],(t,e)=>this[It](t,e))}[It](t,e){this[Se]&&this[X]==="r+"&&t&&t.code==="ENOENT"?(this[X]="w",this[at]()):t?this[Nt](t):(this[m]=e,this.emit("open",e),this[dt]||this[Ke]())}end(t,e){return t&&this.write(t,e),this[Ut]=!0,!this[dt]&&!this[U].length&&typeof this[m]=="number"&&this[Lt](null,0),this}write(t,e){return typeof t=="string"&&(t=Buffer.from(t,e)),this[Ut]?(this.emit("error",Error("write() after end()")),!1):this[m]===void 0||this[dt]||this[U].length?(this[U].push(t),this[ce]=!0,!1):(this[dt]=!0,this[_e](t),!0)}[_e](t){p.write(this[m],t,0,t.length,this[et],(e,i)=>this[Lt](e,i))}[Lt](t,e){t?this[Nt](t):(this[et]!==void 0&&typeof e=="number"&&(this[et]+=e),this[U].length?this[Ke]():(this[dt]=!1,this[Ut]&&!this[Ve]?(this[Ve]=!0,this[P](),this.emit("finish")):this[ce]&&(this[ce]=!1,this.emit("drain"))))}[Ke](){if(this[U].length===0)this[Ut]&&this[Lt](null,0);else if(this[U].length===1)this[_e](this[U].pop());else{let t=this[U];this[U]=[],Br(this[m],t,this[et],(e,i)=>this[Lt](e,i))}}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.close(t,e=>e?this.emit("error",e):this.emit("close"))}}},Ms=class extends Ce{[at](){let t;if(this[Se]&&this[X]==="r+")try{t=p.openSync(this[C],this[X],this[qt])}catch(e){if(e?.code==="ENOENT")return this[X]="w",this[at]();throw e}else t=p.openSync(this[C],this[X],this[qt]);this[It](null,t)}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.closeSync(t),this.emit("close")}}[_e](t){let e=!0;try{this[Lt](null,p.writeSync(this[m],t,0,t.length,this[et])),e=!1}finally{if(e)try{this[P]()}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"]]),Cr=t=>!!t.sync&&!!t.file,Pr=t=>!t.sync&&!!t.file,zr=t=>!!t.sync&&!t.file,Ur=t=>!t.sync&&!t.file,jr=t=>!!t.file,Hr=t=>Mr.get(t)||t,ji=(t={})=>{if(!t)return{};let e={};for(let[i,s]of Object.entries(t)){let r=Hr(i);e[r]=s}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e},ne=(t,e,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 o=ji(h);if(r?.(o,n),Cr(o)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return t(o,n)}else if(Pr(o)){let l=e(o,n);return a?l.then(()=>a(),a):l}else if(zr(o)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return i(o,n)}else if(Ur(o)){if(typeof a=="function")throw TypeError("callback only supported with file option");return s(o,n)}throw Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:s,validate:r}),Zr=Er.constants||{ZLIB_VERNUM:4736},W=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},Zr)),Wr=bt.concat,is=Object.getOwnPropertyDescriptor(bt,"concat"),Gr=t=>t,Je=is?.writable===!0||is?.set!==void 0?t=>{bt.concat=t?Gr:Wr}:t=>{},Et=Symbol("_superWrite"),me=class extends Error{code;errno;constructor(t,e){super("zlib: "+t.message,{cause:t}),this.code=t.code,this.errno=t.errno,this.code||="ZLIB_ERROR",this.message="zlib: "+t.message,Error.captureStackTrace(this,e??this.constructor)}get name(){return"ZlibError"}},ti=Symbol("flushFlag"),Hi=class extends wt{#t=!1;#i=!1;#s;#h;#r;#e;#n;get sawError(){return this.#t}get handle(){return this.#e}get flushFlag(){return this.#s}constructor(t,e){if(!t||typeof t!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(t),this.#s=t.flush??0,this.#h=t.finishFlush??0,this.#r=t.fullFlushFlag??0,typeof qi[e]!="function")throw TypeError("Compression method not supported: "+e);try{this.#e=new qi[e](t)}catch(i){throw new me(i,this.constructor)}this.#n=i=>{this.#t||(this.#t=!0,this.close(),this.emit("error",i))},this.#e?.on("error",i=>this.#n(new me(i))),this.once("end",()=>this.close)}close(){this.#e&&(this.#e.close(),this.#e=void 0,this.emit("close"))}reset(){if(!this.#t)return vi(this.#e,"zlib binding closed"),this.#e.reset?.()}flush(t){this.ended||(typeof t!="number"&&(t=this.#r),this.write(Object.assign(bt.alloc(0),{[ti]:t})))}end(t,e,i){return typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&(e?this.write(t,e):this.write(t)),this.flush(this.#h),this.#i=!0,super.end(i)}get ended(){return this.#i}[Et](t){return super.write(t)}write(t,e,i){if(typeof e=="function"&&(i=e,e="utf8"),typeof t=="string"&&(t=bt.from(t,e)),this.#t)return;vi(this.#e,"zlib binding closed");let s=this.#e._handle,r=s.close;s.close=()=>{};let h=this.#e.close;this.#e.close=()=>{},Je(!0);let n;try{let o=typeof t[ti]=="number"?t[ti]:this.#s;n=this.#e._processChunk(t,o),Je(!1)}catch(o){Je(!1),this.#n(new me(o,this.write))}finally{this.#e&&(this.#e._handle=s,s.close=r,this.#e.close=h,this.#e.removeAllListeners("error"))}this.#e&&this.#e.on("error",o=>this.#n(new me(o,this.write)));let a;if(n)if(Array.isArray(n)&&n.length>0){let o=n[0];a=this[Et](bt.from(o));for(let l=1;l<n.length;l++)a=this[Et](n[l])}else a=this[Et](bt.from(n));return i&&i(),a}},Cs=class extends Hi{#t;#i;constructor(t,e){t||={},t.flush=t.flush||W.Z_NO_FLUSH,t.finishFlush=t.finishFlush||W.Z_FINISH,t.fullFlushFlag=W.Z_FULL_FLUSH,super(t,e),this.#t=t.level,this.#i=t.strategy}params(t,e){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.#t!==t||this.#i!==e){this.flush(W.Z_SYNC_FLUSH),vi(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(t,e)}finally{this.handle.flush=i}this.handle&&(this.#t=t,this.#i=e)}}}},$r=class extends Cs{#t;constructor(t){super(t,"Gzip"),this.#t=t&&!!t.portable}[Et](t){return this.#t?(this.#t=!1,t[9]=255,super[Et](t)):super[Et](t)}},Yr=class extends Cs{constructor(t){super(t,"Unzip")}},Ps=class extends Hi{constructor(t,e){t||={},t.flush=t.flush||W.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||W.BROTLI_OPERATION_FINISH,t.fullFlushFlag=W.BROTLI_OPERATION_FLUSH,super(t,e)}},Vr=class extends Ps{constructor(t){super(t,"BrotliCompress")}},Kr=class extends Ps{constructor(t){super(t,"BrotliDecompress")}},zs=class extends Hi{constructor(t,e){t||={},t.flush=t.flush||W.ZSTD_e_continue,t.finishFlush=t.finishFlush||W.ZSTD_e_end,t.fullFlushFlag=W.ZSTD_e_flush,super(t,e)}},Xr=class extends zs{constructor(t){super(t,"ZstdCompress")}},qr=class extends zs{constructor(t){super(t,"ZstdDecompress")}},Qr=(t,e)=>{if(Number.isSafeInteger(t))t<0?th(t,e):Jr(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Jr=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=t&255,t=Math.floor(t/256)},th=(t,e)=>{e[0]=255;var i=!1;t*=-1;for(var s=e.length;s>1;s--){var r=t&255;t=Math.floor(t/256),i?e[s-1]=Us(r):r===0?e[s-1]=0:(i=!0,e[s-1]=js(r))}},eh=t=>{let e=t[0],i=e===128?sh(t.subarray(1,t.length)):e===255?ih(t):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},ih=t=>{for(var e=t.length,i=0,s=!1,r=e-1;r>-1;r--){var h=Number(t[r]),n;s?n=Us(h):h===0?n=h:(s=!0,n=js(h)),n!==0&&(i-=n*256**(e-r-1))}return i},sh=t=>{for(var e=t.length,i=0,s=e-1;s>-1;s--){var r=Number(t[s]);r!==0&&(i+=r*256**(e-s-1))}return i},Us=t=>(255^t)&255,js=t=>(255^t)+1&255,Hs={};_r(Hs,{code:()=>Zi,isCode:()=>Oe,isName:()=>rh,name:()=>Pe,normalFsTypes:()=>Zs});var Oe=t=>Pe.has(t),rh=t=>Zi.has(t),Zs=new Set(["0","","1","2","3","4","5","6","7","D"]),Pe=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"]]),Zi=new Map(Array.from(Pe).map(t=>[t[1],t[0]])),hh=t=>t===void 0||t<0?void 0:t,ot=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#t="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,e=0,i,s){Buffer.isBuffer(t)?this.decode(t,e||0,i,s):t&&this.#i(t)}decode(t,e,i,s){if(e||=0,!t||!(t.length>=e+512))throw Error("need 512 bytes for header");let r=ut(t,e+156,1),h=Zs.has(r),n=h?i:void 0,a=h?s:void 0;if(this.path=n?.path??ut(t,e,100),this.mode=n?.mode??a?.mode??it(t,e+100,8),this.uid=n?.uid??a?.uid??it(t,e+108,8),this.gid=n?.gid??a?.gid??it(t,e+116,8),this.size=hh(n?.size??a?.size??it(t,e+124,12)),this.mtime=n?.mtime??a?.mtime??ei(t,e+136,12),this.cksum=it(t,e+148,12),a&&this.#i(a,!0),n&&this.#i(n),Oe(r)&&(this.#t=r||"0"),this.#t==="0"&&this.path.slice(-1)==="/"&&(this.#t="5"),this.#t==="5"&&(this.size=0),this.linkpath=ut(t,e+157,100),t.subarray(e+257,e+265).toString()==="ustar\x0000")if(this.uname=n?.uname??a?.uname??ut(t,e+265,32),this.gname=n?.gname??a?.gname??ut(t,e+297,32),this.devmaj=n?.devmaj??a?.devmaj??it(t,e+329,8)??0,this.devmin=n?.devmin??a?.devmin??it(t,e+337,8)??0,t[e+475]!==0){let l=ut(t,e+345,155);this.path=l+"/"+this.path}else{let l=ut(t,e+345,130);l&&(this.path=l+"/"+this.path),this.atime=i?.atime??s?.atime??ei(t,e+476,12),this.ctime=i?.ctime??s?.ctime??ei(t,e+488,12)}let o=256;for(let l=e;l<e+148;l++)o+=t[l];for(let l=e+156;l<e+512;l++)o+=t[l];this.cksumValid=o===this.cksum,this.cksum===void 0&&o===256&&(this.nullBlock=!0)}#i(t,e=!1){Object.assign(this,Object.fromEntries(Object.entries(t).filter(([i,s])=>!(s==null||i==="size"&&Number(s)<0||i==="path"&&e||i==="linkpath"&&e||i==="global"))))}encode(t,e=0){if(t||=this.block=Buffer.alloc(512),this.#t==="Unsupported"&&(this.#t="0"),!(t.length>=e+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=ft(t,e,100,r)||this.needPax,this.needPax=st(t,e+100,8,this.mode)||this.needPax,this.needPax=st(t,e+108,8,this.uid)||this.needPax,this.needPax=st(t,e+116,8,this.gid)||this.needPax,this.needPax=st(t,e+124,12,this.size)||this.needPax,this.needPax=ii(t,e+136,12,this.mtime)||this.needPax,t[e+156]=Number(this.#t.codePointAt(0)),this.needPax=ft(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=ft(t,e+265,32,this.uname)||this.needPax,this.needPax=ft(t,e+297,32,this.gname)||this.needPax,this.needPax=st(t,e+329,8,this.devmaj)||this.needPax,this.needPax=st(t,e+337,8,this.devmin)||this.needPax,this.needPax=ft(t,e+345,i,h)||this.needPax,t[e+475]===0?(this.needPax=ft(t,e+345,130,h)||this.needPax,this.needPax=ii(t,e+476,12,this.atime)||this.needPax,this.needPax=ii(t,e+488,12,this.ctime)||this.needPax):this.needPax=ft(t,e+345,155,h)||this.needPax;let n=256;for(let a=e;a<e+148;a++)n+=t[a];for(let a=e+156;a<e+512;a++)n+=t[a];return this.cksum=n,st(t,e+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#t==="Unsupported"?this.#t:Pe.get(this.#t)}get typeKey(){return this.#t}set type(t){let e=String(Zi.get(t));if(Oe(e)||e==="Unsupported")this.#t=e;else if(Oe(t))this.#t=t;else throw TypeError("invalid entry type: "+t)}},nh=(t,e)=>{let i=t,s="",r,h=Rt.parse(t).root||".";if(Buffer.byteLength(i)<100)r=[i,s,!1];else{s=Rt.dirname(i),i=Rt.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(s)<=e?r=[i,s,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(s)<=e?r=[i.slice(0,99),s,!0]:(i=Rt.join(Rt.basename(s),i),s=Rt.dirname(s));while(s!==h&&r===void 0);r||=[t.slice(0,99),"",!0]}return r},ut=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),ei=(t,e,i)=>ah(it(t,e,i)),ah=t=>t===void 0?void 0:new Date(t*1e3),it=(t,e,i)=>Number(t[e])&128?eh(t.subarray(e,e+i)):lh(t,e,i),oh=t=>isNaN(t)?void 0:t,lh=(t,e,i)=>oh(parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),dh={12:8589934591,8:2097151},st=(t,e,i,s)=>s===void 0?!1:s>dh[i]||s<0?(Qr(s,t.subarray(e,e+i)),!0):(uh(t,e,i,s),!1),uh=(t,e,i,s)=>t.write(fh(s,i),e,i,"ascii"),fh=(t,e)=>ch(Math.floor(t).toString(8),e),ch=(t,e)=>(t.length===e-1?t:Array(e-t.length-1).join("0")+t+" ")+"\0",ii=(t,e,i,s)=>s!==void 0&&st(t,e,i,s.getTime()/1e3),mh=Array(156).join("\0"),ft=(t,e,i,s)=>s===void 0?!1:(t.write(s+mh,e,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),he=class Ws{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,i=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=i,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(e),s=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(s);for(let h=0;h<512;h++)r[h]=0;new ot({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(e,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(e){if(this[e]===void 0)return"";let i=this[e],s=i instanceof Date?i.getTime()/1e3:i,r=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+s+`
1
+ import{createRequire as lr}from"node:module";import{_ as fr}from"../packem_shared/git-source-DExWbfN0.js";let dr;const ur=t=>(dr??=lr(import.meta.url))(t),Ft=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=t=>{if(typeof Ft<"u"&&Ft.versions&&Ft.versions.node){const[e,i]=Ft.versions.node.split(".").map(Number);if(e>22||e===22&&i>=3||e===20&&i>=16)return Ft.getBuiltinModule(t)}return ur(t)},d=D("node:fs"),cr=D("node:fs/promises"),As=D("node:stream"),c=D("node:path"),{posix:Rt,basename:mr,win32:pr,join:Ns}=c,Is=D("events"),{EventEmitter:vr}=Is,p=D("fs"),{EventEmitter:zi}=D("node:events"),{StringDecoder:yr}=D("node:string_decoder"),re=D("path"),{parse:br,dirname:gr}=re,vi=D("assert"),{Buffer:bt}=D("buffer"),Xi=D("zlib"),qi={...Xi,default:Xi},Er=D("zlib"),wr=D("node:assert"),{randomBytes:Bs}=D("node:crypto");var an=fr({Header:()=>ot,Pack:()=>ae,PackJob:()=>Li,PackSync:()=>je,Parser:()=>At,Pax:()=>he,ReadEntry:()=>Gs,Unpack:()=>Me,UnpackSync:()=>Pi,WriteEntry:()=>Yi,WriteEntrySync:()=>Vs,WriteEntryTar:()=>Ks,c:()=>bs,create:()=>bs,extract:()=>Ds,filesFilter:()=>Wi,list:()=>Bt,r:()=>yt,replace:()=>yt,t:()=>Bt,types:()=>Hs,x:()=>Ds}),Rr=Object.defineProperty,_r=(t,e)=>{for(var i in e)Rr(t,i,{get:e[i],enumerable:!0})},Qi=process||{stdout:null,stderr:null},Sr=t=>!!t&&typeof t=="object"&&(t instanceof wt||t instanceof As||Or(t)||kr(t)),Or=t=>!!t&&typeof t=="object"&&t instanceof zi&&typeof t.pipe=="function"&&t.pipe!==As.Writable.prototype.pipe,kr=t=>!!t&&typeof t=="object"&&t instanceof zi&&typeof t.write=="function"&&typeof t.end=="function",G=Symbol("EOF"),$=Symbol("maybeEmitEnd"),q=Symbol("emittedEnd"),oe=Symbol("emittingEnd"),Mt=Symbol("emittedError"),le=Symbol("closed"),Ji=Symbol("read"),de=Symbol("flush"),ts=Symbol("flushChunk"),B=Symbol("encoding"),_t=Symbol("decoder"),R=Symbol("flowing"),Ct=Symbol("paused"),Tt=Symbol("resume"),_=Symbol("buffer"),x=Symbol("pipes"),S=Symbol("bufferLength"),Ze=Symbol("bufferPush"),ue=Symbol("bufferShift"),L=Symbol("objectMode"),E=Symbol("destroyed"),We=Symbol("error"),Ge=Symbol("emitData"),es=Symbol("emitEnd"),$e=Symbol("emitEnd2"),z=Symbol("async"),Ye=Symbol("abort"),fe=Symbol("aborted"),Pt=Symbol("signal"),lt=Symbol("dataListeners"),A=Symbol("discarded"),zt=t=>Promise.resolve().then(t),Tr=t=>t(),Lr=t=>t==="end"||t==="finish"||t==="prefinish",xr=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,Dr=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Fs=class{src;dest;opts;ondrain;constructor(t,e,i){this.src=t,this.dest=e,this.opts=i,this.ondrain=()=>t[Tt](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ar=class extends Fs{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(t,e,i){super(t,e,i),this.proxyErrors=s=>this.dest.emit("error",s),t.on("error",this.proxyErrors)}},Nr=t=>!!t.objectMode,Ir=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",wt=class extends zi{[R]=!1;[Ct]=!1;[x]=[];[_]=[];[L];[B];[z];[_t];[G]=!1;[q]=!1;[oe]=!1;[le]=!1;[Mt]=null;[S]=0;[E]=!1;[Pt];[fe]=!1;[lt]=0;[A]=!1;writable=!0;readable=!0;constructor(...t){let e=t[0]||{};if(super(),e.objectMode&&typeof e.encoding=="string")throw TypeError("Encoding and objectMode may not be used together");Nr(e)?(this[L]=!0,this[B]=null):Ir(e)?(this[B]=e.encoding,this[L]=!1):(this[L]=!1,this[B]=null),this[z]=!!e.async,this[_t]=this[B]?new yr(this[B]):null,e&&e.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[_]}),e&&e.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[x]});let{signal:i}=e;i&&(this[Pt]=i,i.aborted?this[Ye]():i.addEventListener("abort",()=>this[Ye]()))}get bufferLength(){return this[S]}get encoding(){return this[B]}set encoding(t){throw Error("Encoding must be set at instantiation time")}setEncoding(t){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[L]}set objectMode(t){throw Error("objectMode must be set at instantiation time")}get async(){return this[z]}set async(t){this[z]=this[z]||!!t}[Ye](){this[fe]=!0,this.emit("abort",this[Pt]?.reason),this.destroy(this[Pt]?.reason)}get aborted(){return this[fe]}set aborted(t){}write(t,e,i){if(this[fe])return!1;if(this[G])throw Error("write after end");if(this[E])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof e=="function"&&(i=e,e="utf8"),e||="utf8";let s=this[z]?zt:Tr;if(!this[L]&&!Buffer.isBuffer(t)){if(Dr(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(xr(t))t=Buffer.from(t);else if(typeof t!="string")throw Error("Non-contiguous data written to non-objectMode stream")}return this[L]?(this[R]&&this[S]!==0&&this[de](!0),this[R]?this.emit("data",t):this[Ze](t),this[S]!==0&&this.emit("readable"),i&&s(i),this[R]):t.length?(typeof t=="string"&&!(e===this[B]&&!this[_t]?.lastNeed)&&(t=Buffer.from(t,e)),Buffer.isBuffer(t)&&this[B]&&(t=this[_t].write(t)),this[R]&&this[S]!==0&&this[de](!0),this[R]?this.emit("data",t):this[Ze](t),this[S]!==0&&this.emit("readable"),i&&s(i),this[R]):(this[S]!==0&&this.emit("readable"),i&&s(i),this[R])}read(t){if(this[E])return null;if(this[A]=!1,this[S]===0||t===0||t&&t>this[S])return this[$](),null;this[L]&&(t=null),this[_].length>1&&!this[L]&&(this[_]=[this[B]?this[_].join(""):Buffer.concat(this[_],this[S])]);let e=this[Ji](t||null,this[_][0]);return this[$](),e}[Ji](t,e){if(this[L])this[ue]();else{let i=e;t===i.length||t===null?this[ue]():typeof i=="string"?(this[_][0]=i.slice(t),e=i.slice(0,t),this[S]-=t):(this[_][0]=i.subarray(t),e=i.subarray(0,t),this[S]-=t)}return this.emit("data",e),!this[_].length&&!this[G]&&this.emit("drain"),e}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e="utf8"),t!==void 0&&this.write(t,e),i&&this.once("end",i),this[G]=!0,this.writable=!1,(this[R]||!this[Ct])&&this[$](),this}[Tt](){this[E]||(!this[lt]&&!this[x].length&&(this[A]=!0),this[Ct]=!1,this[R]=!0,this.emit("resume"),this[_].length?this[de]():this[G]?this[$]():this.emit("drain"))}resume(){return this[Tt]()}pause(){this[R]=!1,this[Ct]=!0,this[A]=!1}get destroyed(){return this[E]}get flowing(){return this[R]}get paused(){return this[Ct]}[Ze](t){this[L]?this[S]+=1:this[S]+=t.length,this[_].push(t)}[ue](){return this[L]?--this[S]:this[S]-=this[_][0].length,this[_].shift()}[de](t=!1){do;while(this[ts](this[ue]())&&this[_].length);!t&&!this[_].length&&!this[G]&&this.emit("drain")}[ts](t){return this.emit("data",t),this[R]}pipe(t,e){if(this[E])return t;this[A]=!1;let i=this[q];return e||={},t===Qi.stdout||t===Qi.stderr?e.end=!1:e.end=e.end!==!1,e.proxyErrors=!!e.proxyErrors,i?e.end&&t.end():(this[x].push(e.proxyErrors?new Ar(this,t,e):new Fs(this,t,e)),this[z]?zt(()=>this[Tt]()):this[Tt]()),t}unpipe(t){let e=this[x].find(i=>i.dest===t);e&&(this[x].length===1?(this[R]&&this[lt]===0&&(this[R]=!1),this[x]=[]):this[x].splice(this[x].indexOf(e),1),e.unpipe())}addListener(t,e){return this.on(t,e)}on(t,e){let i=super.on(t,e);if(t==="data")this[A]=!1,this[lt]++,!this[x].length&&!this[R]&&this[Tt]();else if(t==="readable"&&this[S]!==0)super.emit("readable");else if(Lr(t)&&this[q])super.emit(t),this.removeAllListeners(t);else if(t==="error"&&this[Mt]){let s=e;this[z]?zt(()=>s.call(this,this[Mt])):s.call(this,this[Mt])}return i}removeListener(t,e){return this.off(t,e)}off(t,e){let i=super.off(t,e);return t==="data"&&(this[lt]=this.listeners("data").length,this[lt]===0&&!this[A]&&!this[x].length&&(this[R]=!1)),i}removeAllListeners(t){let e=super.removeAllListeners(t);return(t==="data"||t===void 0)&&(this[lt]=0,!this[A]&&!this[x].length&&(this[R]=!1)),e}get emittedEnd(){return this[q]}[$](){!this[oe]&&!this[q]&&!this[E]&&this[_].length===0&&this[G]&&(this[oe]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[le]&&this.emit("close"),this[oe]=!1)}emit(t,...e){let i=e[0];if(t!=="error"&&t!=="close"&&t!==E&&this[E])return!1;if(t==="data")return!this[L]&&!i?!1:this[z]?(zt(()=>this[Ge](i)),!0):this[Ge](i);if(t==="end")return this[es]();if(t==="close"){if(this[le]=!0,!this[q]&&!this[E])return!1;let r=super.emit("close");return this.removeAllListeners("close"),r}else if(t==="error"){this[Mt]=i,super.emit(We,i);let r=!this[Pt]||this.listeners("error").length?super.emit("error",i):!1;return this[$](),r}else if(t==="resume"){let r=super.emit("resume");return this[$](),r}else if(t==="finish"||t==="prefinish"){let r=super.emit(t);return this.removeAllListeners(t),r}let s=super.emit(t,...e);return this[$](),s}[Ge](t){for(let i of this[x])i.dest.write(t)===!1&&this.pause();let e=!this[A]&&super.emit("data",t);return this[$](),e}[es](){return this[q]?!1:(this[q]=!0,this.readable=!1,this[z]?(zt(()=>this[$e]()),!0):this[$e]())}[$e](){if(this[_t]){let e=this[_t].end();if(e){for(let i of this[x])i.dest.write(e);this[A]||super.emit("data",e)}}for(let e of this[x])e.end();let t=super.emit("end");return this.removeAllListeners("end"),t}async collect(){let t=Object.assign([],{dataLength:0});this[L]||(t.dataLength=0);let e=this.promise();return this.on("data",i=>{t.push(i),this[L]||(t.dataLength+=i.length)}),await e,t}async concat(){if(this[L])throw Error("cannot concat in objectMode");let t=await this.collect();return this[B]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise((t,e)=>{this.on(E,()=>e(Error("stream destroyed"))),this.on("error",i=>e(i)),this.on("end",()=>t())})}[Symbol.asyncIterator](){this[A]=!1;let t=!1,e=async()=>(this.pause(),t=!0,{value:void 0,done:!0});return{next:()=>{if(t)return e();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[G])return e();let s,r,h=l=>{this.off("data",n),this.off("end",a),this.off(E,o),e(),r(l)},n=l=>{this.off("error",h),this.off("end",a),this.off(E,o),this.pause(),s({value:l,done:!!this[G]})},a=()=>{this.off("error",h),this.off("data",n),this.off(E,o),e(),s({done:!0,value:void 0})},o=()=>h(Error("stream destroyed"));return new Promise((l,u)=>{r=u,s=l,this.once(E,o),this.once("error",h),this.once("end",a),this.once("data",n)})},throw:e,return:e,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[A]=!1;let t=!1,e=()=>(this.pause(),this.off(We,e),this.off(E,e),this.off("end",e),t=!0,{done:!0,value:void 0});return this.once("end",e),this.once(We,e),this.once(E,e),{next:()=>{if(t)return e();let i=this.read();return i===null?e():{done:!1,value:i}},throw:e,return:e,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(t){if(this[E])return t?this.emit("error",t):this.emit(E),this;this[E]=!0,this[A]=!0,this[_].length=0,this[S]=0;let e=this;return typeof e.close=="function"&&!this[le]&&e.close(),t?this.emit("error",t):this.emit(E),this}static get isStream(){return Sr}},Br=p.writev,nt=Symbol("_autoClose"),P=Symbol("_close"),Ut=Symbol("_ended"),m=Symbol("_fd"),Ve=Symbol("_finished"),X=Symbol("_flags"),Ke=Symbol("_flush"),yi=Symbol("_handleChunk"),bi=Symbol("_makeBuf"),qt=Symbol("_mode"),ce=Symbol("_needDrain"),Nt=Symbol("_onerror"),It=Symbol("_onopen"),Xe=Symbol("_onread"),Lt=Symbol("_onwrite"),at=Symbol("_open"),C=Symbol("_path"),et=Symbol("_pos"),U=Symbol("_queue"),xt=Symbol("_read"),qe=Symbol("_readSize"),K=Symbol("_reading"),jt=Symbol("_remain"),Qe=Symbol("_size"),_e=Symbol("_write"),dt=Symbol("_writing"),Se=Symbol("_defaultFlag"),gt=Symbol("_errored"),Ui=class extends wt{[gt]=!1;[m];[C];[qe];[K]=!1;[Qe];[jt];[nt];constructor(t,e){if(e||={},super(e),this.readable=!0,this.writable=!1,typeof t!="string")throw TypeError("path must be a string");this[gt]=!1,this[m]=typeof e.fd=="number"?e.fd:void 0,this[C]=t,this[qe]=e.readSize||16*1024*1024,this[K]=!1,this[Qe]=typeof e.size=="number"?e.size:1/0,this[jt]=this[Qe],this[nt]=typeof e.autoClose!="boolean"||e.autoClose,typeof this[m]=="number"?this[xt]():this[at]()}get fd(){return this[m]}get path(){return this[C]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[at](){p.open(this[C],"r",(t,e)=>this[It](t,e))}[It](t,e){t?this[Nt](t):(this[m]=e,this.emit("open",e),this[xt]())}[bi](){return Buffer.allocUnsafe(Math.min(this[qe],this[jt]))}[xt](){if(!this[K]){this[K]=!0;let t=this[bi]();if(t.length===0)return process.nextTick(()=>this[Xe](null,0,t));p.read(this[m],t,0,t.length,null,(e,i,s)=>this[Xe](e,i,s))}}[Xe](t,e,i){this[K]=!1,t?this[Nt](t):this[yi](e,i)&&this[xt]()}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.close(t,e=>e?this.emit("error",e):this.emit("close"))}}[Nt](t){this[K]=!0,this[P](),this.emit("error",t)}[yi](t,e){let i=!1;return this[jt]-=t,t>0&&(i=super.write(t<e.length?e.subarray(0,t):e)),(t===0||this[jt]<=0)&&(i=!1,this[P](),super.end()),i}emit(t,...e){switch(t){case"prefinish":case"finish":return!1;case"drain":return typeof this[m]=="number"&&this[xt](),!1;case"error":return this[gt]?!1:(this[gt]=!0,super.emit(t,...e));default:return super.emit(t,...e)}}},Fr=class extends Ui{[at](){let t=!0;try{this[It](null,p.openSync(this[C],"r")),t=!1}finally{t&&this[P]()}}[xt](){let t=!0;try{if(!this[K]){this[K]=!0;do{let e=this[bi](),i=e.length===0?0:p.readSync(this[m],e,0,e.length,null);if(!this[yi](i,e))break}while(!0);this[K]=!1}t=!1}finally{t&&this[P]()}}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.closeSync(t),this.emit("close")}}},Ce=class extends Is{readable=!1;writable=!0;[gt]=!1;[dt]=!1;[Ut]=!1;[U]=[];[ce]=!1;[C];[qt];[nt];[m];[Se];[X];[Ve]=!1;[et];constructor(t,e){e||={},super(e),this[C]=t,this[m]=typeof e.fd=="number"?e.fd:void 0,this[qt]=e.mode===void 0?438:e.mode,this[et]=typeof e.start=="number"?e.start:void 0,this[nt]=typeof e.autoClose!="boolean"||e.autoClose;let i=this[et]===void 0?"w":"r+";this[Se]=e.flags===void 0,this[X]=e.flags===void 0?i:e.flags,this[m]===void 0&&this[at]()}emit(t,...e){if(t==="error"){if(this[gt])return!1;this[gt]=!0}return super.emit(t,...e)}get fd(){return this[m]}get path(){return this[C]}[Nt](t){this[P](),this[dt]=!0,this.emit("error",t)}[at](){p.open(this[C],this[X],this[qt],(t,e)=>this[It](t,e))}[It](t,e){this[Se]&&this[X]==="r+"&&t&&t.code==="ENOENT"?(this[X]="w",this[at]()):t?this[Nt](t):(this[m]=e,this.emit("open",e),this[dt]||this[Ke]())}end(t,e){return t&&this.write(t,e),this[Ut]=!0,!this[dt]&&!this[U].length&&typeof this[m]=="number"&&this[Lt](null,0),this}write(t,e){return typeof t=="string"&&(t=Buffer.from(t,e)),this[Ut]?(this.emit("error",Error("write() after end()")),!1):this[m]===void 0||this[dt]||this[U].length?(this[U].push(t),this[ce]=!0,!1):(this[dt]=!0,this[_e](t),!0)}[_e](t){p.write(this[m],t,0,t.length,this[et],(e,i)=>this[Lt](e,i))}[Lt](t,e){t?this[Nt](t):(this[et]!==void 0&&typeof e=="number"&&(this[et]+=e),this[U].length?this[Ke]():(this[dt]=!1,this[Ut]&&!this[Ve]?(this[Ve]=!0,this[P](),this.emit("finish")):this[ce]&&(this[ce]=!1,this.emit("drain"))))}[Ke](){if(this[U].length===0)this[Ut]&&this[Lt](null,0);else if(this[U].length===1)this[_e](this[U].pop());else{let t=this[U];this[U]=[],Br(this[m],t,this[et],(e,i)=>this[Lt](e,i))}}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.close(t,e=>e?this.emit("error",e):this.emit("close"))}}},Ms=class extends Ce{[at](){let t;if(this[Se]&&this[X]==="r+")try{t=p.openSync(this[C],this[X],this[qt])}catch(e){if(e?.code==="ENOENT")return this[X]="w",this[at]();throw e}else t=p.openSync(this[C],this[X],this[qt]);this[It](null,t)}[P](){if(this[nt]&&typeof this[m]=="number"){let t=this[m];this[m]=void 0,p.closeSync(t),this.emit("close")}}[_e](t){let e=!0;try{this[Lt](null,p.writeSync(this[m],t,0,t.length,this[et])),e=!1}finally{if(e)try{this[P]()}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"]]),Cr=t=>!!t.sync&&!!t.file,Pr=t=>!t.sync&&!!t.file,zr=t=>!!t.sync&&!t.file,Ur=t=>!t.sync&&!t.file,jr=t=>!!t.file,Hr=t=>Mr.get(t)||t,ji=(t={})=>{if(!t)return{};let e={};for(let[i,s]of Object.entries(t)){let r=Hr(i);e[r]=s}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e},ne=(t,e,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 o=ji(h);if(r?.(o,n),Cr(o)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return t(o,n)}else if(Pr(o)){let l=e(o,n);return a?l.then(()=>a(),a):l}else if(zr(o)){if(typeof a=="function")throw TypeError("callback not supported for sync tar functions");return i(o,n)}else if(Ur(o)){if(typeof a=="function")throw TypeError("callback only supported with file option");return s(o,n)}throw Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:s,validate:r}),Zr=Er.constants||{ZLIB_VERNUM:4736},W=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},Zr)),Wr=bt.concat,is=Object.getOwnPropertyDescriptor(bt,"concat"),Gr=t=>t,Je=is?.writable===!0||is?.set!==void 0?t=>{bt.concat=t?Gr:Wr}:t=>{},Et=Symbol("_superWrite"),me=class extends Error{code;errno;constructor(t,e){super("zlib: "+t.message,{cause:t}),this.code=t.code,this.errno=t.errno,this.code||="ZLIB_ERROR",this.message="zlib: "+t.message,Error.captureStackTrace(this,e??this.constructor)}get name(){return"ZlibError"}},ti=Symbol("flushFlag"),Hi=class extends wt{#t=!1;#i=!1;#s;#h;#r;#e;#n;get sawError(){return this.#t}get handle(){return this.#e}get flushFlag(){return this.#s}constructor(t,e){if(!t||typeof t!="object")throw TypeError("invalid options for ZlibBase constructor");if(super(t),this.#s=t.flush??0,this.#h=t.finishFlush??0,this.#r=t.fullFlushFlag??0,typeof qi[e]!="function")throw TypeError("Compression method not supported: "+e);try{this.#e=new qi[e](t)}catch(i){throw new me(i,this.constructor)}this.#n=i=>{this.#t||(this.#t=!0,this.close(),this.emit("error",i))},this.#e?.on("error",i=>this.#n(new me(i))),this.once("end",()=>this.close)}close(){this.#e&&(this.#e.close(),this.#e=void 0,this.emit("close"))}reset(){if(!this.#t)return vi(this.#e,"zlib binding closed"),this.#e.reset?.()}flush(t){this.ended||(typeof t!="number"&&(t=this.#r),this.write(Object.assign(bt.alloc(0),{[ti]:t})))}end(t,e,i){return typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&(e?this.write(t,e):this.write(t)),this.flush(this.#h),this.#i=!0,super.end(i)}get ended(){return this.#i}[Et](t){return super.write(t)}write(t,e,i){if(typeof e=="function"&&(i=e,e="utf8"),typeof t=="string"&&(t=bt.from(t,e)),this.#t)return;vi(this.#e,"zlib binding closed");let s=this.#e._handle,r=s.close;s.close=()=>{};let h=this.#e.close;this.#e.close=()=>{},Je(!0);let n;try{let o=typeof t[ti]=="number"?t[ti]:this.#s;n=this.#e._processChunk(t,o),Je(!1)}catch(o){Je(!1),this.#n(new me(o,this.write))}finally{this.#e&&(this.#e._handle=s,s.close=r,this.#e.close=h,this.#e.removeAllListeners("error"))}this.#e&&this.#e.on("error",o=>this.#n(new me(o,this.write)));let a;if(n)if(Array.isArray(n)&&n.length>0){let o=n[0];a=this[Et](bt.from(o));for(let l=1;l<n.length;l++)a=this[Et](n[l])}else a=this[Et](bt.from(n));return i&&i(),a}},Cs=class extends Hi{#t;#i;constructor(t,e){t||={},t.flush=t.flush||W.Z_NO_FLUSH,t.finishFlush=t.finishFlush||W.Z_FINISH,t.fullFlushFlag=W.Z_FULL_FLUSH,super(t,e),this.#t=t.level,this.#i=t.strategy}params(t,e){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.#t!==t||this.#i!==e){this.flush(W.Z_SYNC_FLUSH),vi(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(t,e)}finally{this.handle.flush=i}this.handle&&(this.#t=t,this.#i=e)}}}},$r=class extends Cs{#t;constructor(t){super(t,"Gzip"),this.#t=t&&!!t.portable}[Et](t){return this.#t?(this.#t=!1,t[9]=255,super[Et](t)):super[Et](t)}},Yr=class extends Cs{constructor(t){super(t,"Unzip")}},Ps=class extends Hi{constructor(t,e){t||={},t.flush=t.flush||W.BROTLI_OPERATION_PROCESS,t.finishFlush=t.finishFlush||W.BROTLI_OPERATION_FINISH,t.fullFlushFlag=W.BROTLI_OPERATION_FLUSH,super(t,e)}},Vr=class extends Ps{constructor(t){super(t,"BrotliCompress")}},Kr=class extends Ps{constructor(t){super(t,"BrotliDecompress")}},zs=class extends Hi{constructor(t,e){t||={},t.flush=t.flush||W.ZSTD_e_continue,t.finishFlush=t.finishFlush||W.ZSTD_e_end,t.fullFlushFlag=W.ZSTD_e_flush,super(t,e)}},Xr=class extends zs{constructor(t){super(t,"ZstdCompress")}},qr=class extends zs{constructor(t){super(t,"ZstdDecompress")}},Qr=(t,e)=>{if(Number.isSafeInteger(t))t<0?th(t,e):Jr(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Jr=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=t&255,t=Math.floor(t/256)},th=(t,e)=>{e[0]=255;var i=!1;t*=-1;for(var s=e.length;s>1;s--){var r=t&255;t=Math.floor(t/256),i?e[s-1]=Us(r):r===0?e[s-1]=0:(i=!0,e[s-1]=js(r))}},eh=t=>{let e=t[0],i=e===128?sh(t.subarray(1,t.length)):e===255?ih(t):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},ih=t=>{for(var e=t.length,i=0,s=!1,r=e-1;r>-1;r--){var h=Number(t[r]),n;s?n=Us(h):h===0?n=h:(s=!0,n=js(h)),n!==0&&(i-=n*256**(e-r-1))}return i},sh=t=>{for(var e=t.length,i=0,s=e-1;s>-1;s--){var r=Number(t[s]);r!==0&&(i+=r*256**(e-s-1))}return i},Us=t=>(255^t)&255,js=t=>(255^t)+1&255,Hs={};_r(Hs,{code:()=>Zi,isCode:()=>Oe,isName:()=>rh,name:()=>Pe,normalFsTypes:()=>Zs});var Oe=t=>Pe.has(t),rh=t=>Zi.has(t),Zs=new Set(["0","","1","2","3","4","5","6","7","D"]),Pe=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"]]),Zi=new Map(Array.from(Pe).map(t=>[t[1],t[0]])),hh=t=>t===void 0||t<0?void 0:t,ot=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#t="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,e=0,i,s){Buffer.isBuffer(t)?this.decode(t,e||0,i,s):t&&this.#i(t)}decode(t,e,i,s){if(e||=0,!t||!(t.length>=e+512))throw Error("need 512 bytes for header");let r=ut(t,e+156,1),h=Zs.has(r),n=h?i:void 0,a=h?s:void 0;if(this.path=n?.path??ut(t,e,100),this.mode=n?.mode??a?.mode??it(t,e+100,8),this.uid=n?.uid??a?.uid??it(t,e+108,8),this.gid=n?.gid??a?.gid??it(t,e+116,8),this.size=hh(n?.size??a?.size??it(t,e+124,12)),this.mtime=n?.mtime??a?.mtime??ei(t,e+136,12),this.cksum=it(t,e+148,12),a&&this.#i(a,!0),n&&this.#i(n),Oe(r)&&(this.#t=r||"0"),this.#t==="0"&&this.path.slice(-1)==="/"&&(this.#t="5"),this.#t==="5"&&(this.size=0),this.linkpath=ut(t,e+157,100),t.subarray(e+257,e+265).toString()==="ustar\x0000")if(this.uname=n?.uname??a?.uname??ut(t,e+265,32),this.gname=n?.gname??a?.gname??ut(t,e+297,32),this.devmaj=n?.devmaj??a?.devmaj??it(t,e+329,8)??0,this.devmin=n?.devmin??a?.devmin??it(t,e+337,8)??0,t[e+475]!==0){let l=ut(t,e+345,155);this.path=l+"/"+this.path}else{let l=ut(t,e+345,130);l&&(this.path=l+"/"+this.path),this.atime=i?.atime??s?.atime??ei(t,e+476,12),this.ctime=i?.ctime??s?.ctime??ei(t,e+488,12)}let o=256;for(let l=e;l<e+148;l++)o+=t[l];for(let l=e+156;l<e+512;l++)o+=t[l];this.cksumValid=o===this.cksum,this.cksum===void 0&&o===256&&(this.nullBlock=!0)}#i(t,e=!1){Object.assign(this,Object.fromEntries(Object.entries(t).filter(([i,s])=>!(s==null||i==="size"&&Number(s)<0||i==="path"&&e||i==="linkpath"&&e||i==="global"))))}encode(t,e=0){if(t||=this.block=Buffer.alloc(512),this.#t==="Unsupported"&&(this.#t="0"),!(t.length>=e+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=ft(t,e,100,r)||this.needPax,this.needPax=st(t,e+100,8,this.mode)||this.needPax,this.needPax=st(t,e+108,8,this.uid)||this.needPax,this.needPax=st(t,e+116,8,this.gid)||this.needPax,this.needPax=st(t,e+124,12,this.size)||this.needPax,this.needPax=ii(t,e+136,12,this.mtime)||this.needPax,t[e+156]=Number(this.#t.codePointAt(0)),this.needPax=ft(t,e+157,100,this.linkpath)||this.needPax,t.write("ustar\x0000",e+257,8),this.needPax=ft(t,e+265,32,this.uname)||this.needPax,this.needPax=ft(t,e+297,32,this.gname)||this.needPax,this.needPax=st(t,e+329,8,this.devmaj)||this.needPax,this.needPax=st(t,e+337,8,this.devmin)||this.needPax,this.needPax=ft(t,e+345,i,h)||this.needPax,t[e+475]===0?(this.needPax=ft(t,e+345,130,h)||this.needPax,this.needPax=ii(t,e+476,12,this.atime)||this.needPax,this.needPax=ii(t,e+488,12,this.ctime)||this.needPax):this.needPax=ft(t,e+345,155,h)||this.needPax;let n=256;for(let a=e;a<e+148;a++)n+=t[a];for(let a=e+156;a<e+512;a++)n+=t[a];return this.cksum=n,st(t,e+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#t==="Unsupported"?this.#t:Pe.get(this.#t)}get typeKey(){return this.#t}set type(t){let e=String(Zi.get(t));if(Oe(e)||e==="Unsupported")this.#t=e;else if(Oe(t))this.#t=t;else throw TypeError("invalid entry type: "+t)}},nh=(t,e)=>{let i=t,s="",r,h=Rt.parse(t).root||".";if(Buffer.byteLength(i)<100)r=[i,s,!1];else{s=Rt.dirname(i),i=Rt.basename(i);do Buffer.byteLength(i)<=100&&Buffer.byteLength(s)<=e?r=[i,s,!1]:Buffer.byteLength(i)>100&&Buffer.byteLength(s)<=e?r=[i.slice(0,99),s,!0]:(i=Rt.join(Rt.basename(s),i),s=Rt.dirname(s));while(s!==h&&r===void 0);r||=[t.slice(0,99),"",!0]}return r},ut=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),ei=(t,e,i)=>ah(it(t,e,i)),ah=t=>t===void 0?void 0:new Date(t*1e3),it=(t,e,i)=>Number(t[e])&128?eh(t.subarray(e,e+i)):lh(t,e,i),oh=t=>isNaN(t)?void 0:t,lh=(t,e,i)=>oh(parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),dh={12:8589934591,8:2097151},st=(t,e,i,s)=>s===void 0?!1:s>dh[i]||s<0?(Qr(s,t.subarray(e,e+i)),!0):(uh(t,e,i,s),!1),uh=(t,e,i,s)=>t.write(fh(s,i),e,i,"ascii"),fh=(t,e)=>ch(Math.floor(t).toString(8),e),ch=(t,e)=>(t.length===e-1?t:Array(e-t.length-1).join("0")+t+" ")+"\0",ii=(t,e,i,s)=>s!==void 0&&st(t,e,i,s.getTime()/1e3),mh=Array(156).join("\0"),ft=(t,e,i,s)=>s===void 0?!1:(t.write(s+mh,e,i,"utf8"),s.length!==Buffer.byteLength(s)||s.length>i),he=class Ws{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,i=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=i,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(e),s=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(s);for(let h=0;h<512;h++)r[h]=0;new ot({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(e,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(e){if(this[e]===void 0)return"";let i=this[e],s=i instanceof Date?i.getTime()/1e3:i,r=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+s+`
2
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(e,i,s=!1){return new Ws(ph(vh(e),i),s)}},ph=(t,e)=>e?Object.assign({},e,t):t,vh=t=>t.replace(/\n$/,"").split(`
3
3
  `).reduce(yh,Object.create(null)),yh=(t,e)=>{let i=parseInt(e,10);if(i!==Buffer.byteLength(e)+1)return t;e=e.slice((i+" ").length);let s=e.split("="),r=s.shift();if(!r)return t;let h=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),n=s.join("=").replace(/\0.*/,"");switch(h){case"path":case"linkpath":case"type":case"charset":case"comment":case"gname":case"uname":t[h]=n;break;case"ctime":case"atime":case"mtime":t[h]=new Date(Number(n)*1e3);break;case"size":let a=+n;a>=0&&(t[h]=a);break;case"gid":case"uid":case"dev":case"ino":case"nlink":case"mode":t[h]=+n;break}return t},f=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32"?t=>String(t).replaceAll(/\\/g,"/"):t=>String(t),Gs=class extends wt{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(t,e,i){switch(super({}),this.pause(),this.extended=e,this.globalExtended=i,this.header=t,this.remain=t.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=t.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(!t.path)throw Error("no path provided for tar.ReadEntry");this.path=f(t.path),this.mode=t.mode,this.mode&&(this.mode&=4095),this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=this.remain,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath?f(t.linkpath):void 0,this.uname=t.uname,this.gname=t.gname,e&&this.#t(e),i&&this.#t(i,!0)}write(t){let e=t.length;if(e>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-e),this.blockRemain=Math.max(0,s-e),this.ignore?!0:i>=e?super.write(t):super.write(t.subarray(0,i))}#t(t,e=!1){t.path&&=f(t.path),t.linkpath&&=f(t.linkpath),Object.assign(this,Object.fromEntries(Object.entries(t).filter(([i,s])=>!(s==null||i==="path"&&e))))}},ze=(t,e,i,s={})=>{t.file&&(s.file=t.file),t.cwd&&(s.cwd=t.cwd),s.code=i instanceof Error&&i.code||e,s.tarCode=e,!t.strict&&s.recoverable!==!1?(i instanceof Error&&(s=Object.assign(i,s),i=i.message),t.emit("warn",e,i,s)):i instanceof Error?t.emit("error",Object.assign(i,s)):t.emit("error",Object.assign(Error(`${e}: ${i}`),s))},bh=1024*1024,gi=Buffer.from([31,139]),Ei=Buffer.from([40,181,47,253]),gh=Math.max(gi.length,Ei.length),N=Symbol("state"),ct=Symbol("writeEntry"),Y=Symbol("readEntry"),si=Symbol("nextEntry"),ss=Symbol("processEntry"),j=Symbol("extendedHeader"),Ht=Symbol("globalExtendedHeader"),Q=Symbol("meta"),rs=Symbol("emitMeta"),v=Symbol("buffer"),V=Symbol("queue"),J=Symbol("ended"),ri=Symbol("emittedEnd"),mt=Symbol("emit"),g=Symbol("unzip"),pe=Symbol("consumeChunk"),ve=Symbol("consumeChunkSub"),hi=Symbol("consumeBody"),hs=Symbol("consumeMeta"),ns=Symbol("consumeHeader"),Zt=Symbol("consuming"),ni=Symbol("bufferConcat"),ye=Symbol("maybeEnd"),St=Symbol("writing"),H=Symbol("aborted"),be=Symbol("onDone"),pt=Symbol("sawValidEntry"),ge=Symbol("sawNullBlock"),Ee=Symbol("sawEOF"),as=Symbol("closeStream"),Eh=1e3,Wt=Symbol("compressedBytesRead"),ai=Symbol("decompressedBytesRead"),os=Symbol("checkDecompressionRatio"),wh=()=>!0,At=class extends vr{file;strict;maxMetaEntrySize;filter;brotli;zstd;maxDecompressionRatio;writable=!0;readable=!1;[V]=[];[v];[Y];[ct];[N]="begin";[Q]="";[j];[Ht];[J]=!1;[g];[H]=!1;[pt];[ge]=!1;[Ee]=!1;[St]=!1;[Zt]=!1;[ri]=!1;[Wt]=0;[ai]=0;constructor(t={}){super(),this.file=t.file||"",this.on(be,()=>{(this[N]==="begin"||this[pt]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),t.ondone?this.on(be,t.ondone):this.on(be,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!t.strict,this.maxDecompressionRatio=typeof t.maxDecompressionRatio=="number"?t.maxDecompressionRatio:Eh,this.maxMetaEntrySize=t.maxMetaEntrySize||bh,this.filter=typeof t.filter=="function"?t.filter:wh;let e=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!(t.gzip||t.zstd)&&t.brotli!==void 0?t.brotli:e?void 0:!1;let i=t.file&&(t.file.endsWith(".tar.zst")||t.file.endsWith(".tzst"));this.zstd=!(t.gzip||t.brotli)&&t.zstd!==void 0?t.zstd:i?!0:void 0,this.on("end",()=>this[as]()),typeof t.onwarn=="function"&&this.on("warn",t.onwarn),typeof t.onReadEntry=="function"&&this.on("entry",t.onReadEntry)}warn(t,e,i={}){ze(this,t,e,i)}[ns](t,e){this[pt]===void 0&&(this[pt]=!1);let i;try{i=new ot(t,e,this[j],this[Ht])}catch(s){return this.warn("TAR_ENTRY_INVALID",s)}if(i.nullBlock)this[ge]?(this[Ee]=!0,this[N]==="begin"&&(this[N]="header"),this[mt]("eof")):(this[ge]=!0,this[mt]("nullBlock"));else if(this[ge]=!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[ct]=new Gs(i,this[j],this[Ht]);this[pt]||(r.remain?r.on("end",()=>{r.invalid||(this[pt]=!0)}):this[pt]=!0),r.meta?r.size>this.maxMetaEntrySize?(r.ignore=!0,this[mt]("ignoredEntry",r),this[N]="ignore",r.resume()):r.size>0&&(this[Q]="",r.on("data",h=>this[Q]+=h),this[N]="meta"):(this[j]=void 0,r.ignore=r.ignore||!this.filter(r.path,r),r.ignore?(this[mt]("ignoredEntry",r),this[N]=r.remain?"ignore":"header",r.resume()):(r.remain?this[N]="body":(this[N]="header",r.end()),this[Y]?this[V].push(r):(this[V].push(r),this[si]())))}}}[as](){queueMicrotask(()=>this.emit("close"))}[ss](t){let e=!0;if(!t)this[Y]=void 0,e=!1;else if(Array.isArray(t)){let[i,...s]=t;this.emit(i,...s)}else this[Y]=t,this.emit("entry",t),t.emittedEnd||(t.on("end",()=>this[si]()),e=!1);return e}[si](){do;while(this[ss](this[V].shift()));if(this[V].length===0){let t=this[Y];!t||t.flowing||t.size===t.remain?this[St]||this.emit("drain"):t.once("drain",()=>this.emit("drain"))}}[hi](t,e){let i=this[ct];if(!i)throw Error("attempt to consume body without entry??");let s=i.blockRemain??0,r=s>=t.length&&e===0?t:t.subarray(e,e+s);return i.write(r),i.blockRemain||(this[N]="header",this[ct]=void 0,i.end()),r.length}[hs](t,e){let i=this[ct],s=this[hi](t,e);return!this[ct]&&i&&this[rs](i),s}[mt](t,e,i){this[V].length===0&&!this[Y]?this.emit(t,e,i):this[V].push([t,e,i])}[rs](t){switch(this[mt]("meta",this[Q]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[j]=he.parse(this[Q],this[j],!1);break;case"GlobalExtendedHeader":this[Ht]=he.parse(this[Q],this[Ht],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let e=this[j]??Object.create(null);this[j]=e,e.path=this[Q].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let e=this[j]||Object.create(null);this[j]=e,e.linkpath=this[Q].replace(/\0.*/,"");break}default:throw Error("unknown meta: "+t.type)}}abort(t){if(!this[H]){if(this[g]){let e=this[g];e.write=()=>!0,e.end=()=>e,e.emit=()=>!1,e.destroy?.()}this[H]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}}[os](t){this[ai]+=t.length;let e=this[ai]/this[Wt];return e>this.maxDecompressionRatio?(this.abort(Error(`max decompression ratio exceeded: ${e.toFixed(2)} > ${this.maxDecompressionRatio}`)),!1):!0}write(t,e,i){if(typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8")),this[H])return i?.(),!1;if((this[g]===void 0||this.brotli===void 0&&this[g]===!1)&&t){if(this[v]&&(t=Buffer.concat([this[v],t]),this[v]=void 0),t.length<gh)return this[v]=t,i?.(),!0;for(let n=0;this[g]===void 0&&n<gi.length;n++)t[n]!==gi[n]&&(this[g]=!1);let r=!1;if(this[g]===!1&&this.zstd!==!1){r=!0;for(let n=0;n<Ei.length;n++)if(t[n]!==Ei[n]){r=!1;break}}let h=this.brotli===void 0&&!r;if(this[g]===!1&&h)if(t.length<512)if(this[J])this.brotli=!0;else return this[v]=t,i?.(),!0;else try{new ot(t.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[g]===void 0||this[g]===!1&&(this.brotli||r)){let n=this[J];this[J]=!1,this[g]=this[g]===void 0?new Yr({}):r?new qr({}):new Kr({}),this[g].on("data",o=>{this[os](o)&&this[pe](o)}),this[g].on("error",o=>{this[H]||this.abort(o)}),this[g].on("end",()=>{this[J]=!0,this[pe]()}),this[St]=!0,this[Wt]+=t.length;let a=!!this[g][n?"end":"write"](t);return this[St]=!1,i?.(),a}}this[St]=!0,this[g]?(this[Wt]+=t.length,this[g].write(t)):this[pe](t),this[St]=!1;let s=this[V].length>0?!1:!this[Y]||this[Y].flowing;return!s&&this[V].length===0&&this[Y]?.once("drain",()=>this.emit("drain")),i?.(),s}[ni](t){t&&!this[H]&&(this[v]=this[v]?Buffer.concat([this[v],t]):t)}[ye](){if(this[J]&&!this[ri]&&!this[H]&&!this[Zt]){this[ri]=!0;let t=this[ct];if(t?.blockRemain){let e=this[v]?this[v].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${e} available)`,{entry:t}),this[v]&&t.write(this[v]),t.end()}this[mt](be)}}[pe](t){if(this[Zt]&&t)this[ni](t);else if(!t&&!this[v])this[ye]();else if(t){if(this[Zt]=!0,this[v]){this[ni](t);let e=this[v];this[v]=void 0,this[ve](e)}else this[ve](t);for(;this[v]&&this[v]?.length>=512&&!this[H]&&!this[Ee];){let e=this[v];this[v]=void 0,this[ve](e)}this[Zt]=!1}(!this[v]||this[J])&&this[ye]()}[ve](t){let e=0,i=t.length;for(;e+512<=i&&!this[H]&&!this[Ee];)switch(this[N]){case"begin":case"header":this[ns](t,e),e+=512;break;case"ignore":case"body":e+=this[hi](t,e);break;case"meta":e+=this[hs](t,e);break;default:throw Error("invalid state: "+this[N])}e<i&&(this[v]=this[v]?Buffer.concat([t.subarray(e),this[v]]):t.subarray(e))}end(t,e,i){return typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,e)),i&&this.once("finish",i),this[H]||(this[g]?(t&&(this[Wt]+=t.length,this[g].write(t)),this[g].end()):(this[J]=!0,(this.brotli===void 0||this.zstd===void 0)&&(t||=Buffer.alloc(0)),t&&this.write(t),this[ye]())),this}},Qt=t=>{let e=t.length-1,i=-1;for(;e>-1&&t.charAt(e)==="/";)i=e,e--;return i===-1?t:t.slice(0,i)},Rh=t=>{let e=t.onReadEntry;t.onReadEntry=e?i=>{e(i),i.resume()}:i=>i.resume()},Wi=(t,e)=>{let i=new Map(e.map(h=>[Qt(h),!0])),s=t.filter,r=(h,n="",a=0)=>{if(a>=100)return i.set(h,!1),!1;let o=n||br(h).root||".",l;if(h===o)l=!1;else{let u=i.get(h);l=u===void 0?r(gr(h),o,a+1):u}return i.set(h,l),l};t.filter=s?(h,n)=>s(h,n)&&r(Qt(h)):h=>r(Qt(h))},Bt=ne(t=>{let e=new At(t),i=t.file,s;try{s=d.openSync(i,"r");let r=d.fstatSync(s),h=t.maxReadSize||16*1024*1024;if(r.size<h){let n=Buffer.allocUnsafe(r.size),a=d.readSync(s,n,0,r.size,0);e.end(a===n.byteLength?n:n.subarray(0,a))}else{let n=0,a=Buffer.allocUnsafe(h);for(;n<r.size;){let o=d.readSync(s,a,0,h,n);if(o===0)break;n+=o,e.write(a.subarray(0,o))}e.end()}}finally{if(typeof s=="number")try{d.closeSync(s)}catch{}}},(t,e)=>{let i=new At(t),s=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((h,n)=>{i.on("error",n),i.on("end",h),d.stat(r,(a,o)=>{if(a)n(a);else{let l=new Ui(r,{readSize:s,size:o.size});l.on("error",n),l.pipe(i)}})})},t=>new At(t),t=>new At(t),(t,e)=>{e?.length&&Wi(t,e),t.noResume||Rh(t)}),$s=(t,e,i)=>(t&=4095,i&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t),{isAbsolute:_h,parse:ls}=pr,Gi=t=>{let e="",i=ls(t);for(;_h(t)||i.root;){let s=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":i.root;t=t.slice(s.length),e+=s,i=ls(t)}return[e,t]},Ue=["|","<",">","?",":"],$i=Ue.map(t=>String.fromCodePoint(61440+Number(t.codePointAt(0)))),Sh=new Map(Ue.map((t,e)=>[t,$i[e]])),Oh=new Map($i.map((t,e)=>[t,Ue[e]])),ds=t=>Ue.reduce((e,i)=>e.split(i).join(Sh.get(i)),t),kh=t=>$i.reduce((e,i)=>e.split(i).join(Oh.get(i)),t),Ys=(t,e)=>e?(t=f(t).replace(/^\.(\/|$)/,""),Qt(e)+"/"+t):f(t),Th=16*1024*1024,us=Symbol("process"),fs=Symbol("file"),cs=Symbol("directory"),wi=Symbol("symlink"),ms=Symbol("hardlink"),Gt=Symbol("header"),ke=Symbol("read"),Ri=Symbol("lstat"),Te=Symbol("onlstat"),_i=Symbol("onread"),Si=Symbol("onreadlink"),Oi=Symbol("openfile"),ki=Symbol("onopenfile"),rt=Symbol("close"),Be=Symbol("mode"),Ti=Symbol("awaitDrain"),oi=Symbol("ondrain"),Z=Symbol("prefix"),Yi=class extends wt{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;#t=!1;constructor(t,e={}){let i=ji(e);super(),this.path=f(t),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=f(i.cwd||process.cwd()),this.strict=!!i.strict,this.noPax=!!i.noPax,this.noMtime=!!i.noMtime,this.mtime=i.mtime,this.prefix=i.prefix?f(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=kh(this.path.replaceAll(/\\/g,"/")),t=t.replaceAll(/\\/g,"/")),this.absolute=f(i.absolute||re.resolve(this.cwd,t)),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[Te](r):this[Ri]()}warn(t,e,i={}){return ze(this,t,e,i)}emit(t,...e){return t==="error"&&(this.#t=!0),super.emit(t,...e)}[Ri](){p.lstat(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[Te](e)})}[Te](t){this.statCache.set(this.absolute,t),this.stat=t,t.isFile()||(t.size=0),this.type=Lh(t),this.emit("stat",t),this[us]()}[us](){switch(this.type){case"File":return this[fs]();case"Directory":return this[cs]();case"SymbolicLink":return this[wi]();default:return this.end()}}[Be](t){return $s(t,this.type==="Directory",this.portable)}[Z](t){return Ys(t,this.prefix)}[Gt](){if(!this.stat)throw Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new ot({path:this[Z](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Z](this.linkpath):this.linkpath,mode:this[Be](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 he({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[Z](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Z](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 t=this.header?.block;if(!t)throw Error("failed to encode header");super.write(t)}[cs](){if(!this.stat)throw Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Gt](),this.end()}[wi](){p.readlink(this.absolute,(t,e)=>{if(t)return this.emit("error",t);this[Si](e)})}[Si](t){this.linkpath=f(t),this[Gt](),this.end()}[ms](t){if(!this.stat)throw Error("cannot create link entry without stat");this.type="Link",this.linkpath=f(re.relative(this.cwd,t)),this.stat.size=0,this[Gt](),this.end()}[fs](){if(!this.stat)throw Error("cannot create file entry without stat");if(this.stat.nlink>1){let t=`${this.stat.dev}:${this.stat.ino}`,e=this.linkCache.get(t);if(e?.indexOf(this.cwd)===0)return this[ms](e);this.linkCache.set(t,this.absolute)}if(this[Gt](),this.stat.size===0)return this.end();this[Oi]()}[Oi](){p.open(this.absolute,"r",(t,e)=>{if(t)return this.emit("error",t);this[ki](e)})}[ki](t){if(this.fd=t,this.#t)return this[rt]();if(!this.stat)throw Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let e=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(e),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[ke]()}[ke](){let{fd:t,buf:e,offset:i,length:s,pos:r}=this;if(t===void 0||e===void 0)throw Error("cannot read file without first opening");p.read(t,e,i,s,r,(h,n)=>{if(h)return this[rt](()=>this.emit("error",h));this[_i](n)})}[rt](t=()=>{}){this.fd!==void 0&&p.close(this.fd,t)}[_i](t){if(t<=0&&this.remain>0){let i=Object.assign(Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[rt](()=>this.emit("error",i))}if(t>this.remain){let i=Object.assign(Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[rt](()=>this.emit("error",i))}if(!this.buf)throw Error("should have created buffer prior to reading");if(t===this.remain)for(let i=t;i<this.length&&t<this.blockRemain;i++)this.buf[i+this.offset]=0,t++,this.remain++;let e=this.offset===0&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);this.write(e)?this[oi]():this[Ti](()=>this[oi]())}[Ti](t){this.once("drain",t)}write(t,e,i){if(typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8")),this.blockRemain<t.length){let s=Object.assign(Error("writing more data than expected"),{path:this.absolute});return this.emit("error",s)}return this.remain-=t.length,this.blockRemain-=t.length,this.pos+=t.length,this.offset+=t.length,super.write(t,null,i)}[oi](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[rt](t=>t?this.emit("error",t):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[ke]()}},Vs=class extends Yi{sync=!0;[Ri](){this[Te](p.lstatSync(this.absolute))}[wi](){this[Si](p.readlinkSync(this.absolute))}[Oi](){this[ki](p.openSync(this.absolute,"r"))}[ke](){let t=!0;try{let{fd:e,buf:i,offset:s,length:r,pos:h}=this;if(e===void 0||i===void 0)throw Error("fd and buf must be set in READ method");let n=p.readSync(e,i,s,r,h);this[_i](n),t=!1}finally{if(t)try{this[rt](()=>{})}catch{}}}[Ti](t){t()}[rt](t=()=>{}){this.fd!==void 0&&p.closeSync(this.fd),t()}},Ks=class extends wt{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(t,e,i={}){return ze(this,t,e,i)}constructor(t,e={}){let i=ji(e);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=t;let{type:s}=t;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=f(t.path),this.mode=t.mode===void 0?void 0:this[Be](t.mode),this.uid=this.portable?void 0:t.uid,this.gid=this.portable?void 0:t.gid,this.uname=this.portable?void 0:t.uname,this.gname=this.portable?void 0:t.gname,this.size=t.size,this.mtime=this.noMtime?void 0:i.mtime||t.mtime,this.atime=this.portable?void 0:t.atime,this.ctime=this.portable?void 0:t.ctime,this.linkpath=t.linkpath===void 0?void 0:f(t.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=t.size,this.blockRemain=t.startBlockSize,this.onWriteEntry?.(this),this.header=new ot({path:this[Z](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Z](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 he({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[Z](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Z](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),t.pipe(this)}[Z](t){return Ys(t,this.prefix)}[Be](t){return $s(t,this.type==="Directory",this.portable)}write(t,e,i){typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,typeof e=="string"?e:"utf8"));let s=t.length;if(s>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=s,super.write(t,i)}end(t,e,i){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof t=="function"&&(i=t,e=void 0,t=void 0),typeof e=="function"&&(i=e,e=void 0),typeof t=="string"&&(t=Buffer.from(t,e??"utf8")),i&&this.once("finish",i),t?super.end(t,i):super.end(i),this}},Lh=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported",xh=class Dt{tail;head;length=0;static create(e=[]){return new Dt(e)}constructor(e=[]){for(let i of e)this.push(i)}*[Symbol.iterator](){for(let e=this.head;e;e=e.next)yield e.value}removeNode(e){if(e.list!==this)throw Error("removing node which does not belong to this list");let i=e.next,s=e.prev;return i&&(i.prev=s),s&&(s.next=i),e===this.head&&(this.head=i),e===this.tail&&(this.tail=s),this.length--,e.next=void 0,e.prev=void 0,e.list=void 0,i}unshiftNode(e){if(e===this.head)return;e.list&&e.list.removeNode(e);let i=this.head;e.list=this,e.next=i,i&&(i.prev=e),this.head=e,this.tail||=e,this.length++}pushNode(e){if(e===this.tail)return;e.list&&e.list.removeNode(e);let i=this.tail;e.list=this,e.prev=i,i&&(i.next=e),this.tail=e,this.head||=e,this.length++}push(...e){for(let i=0,s=e.length;i<s;i++)Ah(this,e[i]);return this.length}unshift(...e){for(var i=0,s=e.length;i<s;i++)Nh(this,e[i]);return this.length}pop(){if(!this.tail)return;let e=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--,e}shift(){if(!this.head)return;let e=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--,e}forEach(e,i){i||=this;for(let s=this.head,r=0;s;r++)e.call(i,s.value,r,this),s=s.next}forEachReverse(e,i){i||=this;for(let s=this.tail,r=this.length-1;s;r--)e.call(i,s.value,r,this),s=s.prev}get(e){let i=0,s=this.head;for(;s&&i<e;i++)s=s.next;if(i===e&&s)return s.value}getReverse(e){let i=0,s=this.tail;for(;s&&i<e;i++)s=s.prev;if(i===e&&s)return s.value}map(e,i){i||=this;let s=new Dt;for(let r=this.head;r;)s.push(e.call(i,r.value,this)),r=r.next;return s}mapReverse(e,i){i||=this;var s=new Dt;for(let r=this.tail;r;)s.push(e.call(i,r.value,this)),r=r.prev;return s}reduce(e,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=e(s,r.value,h),r=r.next;return s}reduceReverse(e,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=e(s,r.value,h),r=r.prev;return s}toArray(){let e=Array(this.length);for(let i=0,s=this.head;s;i++)e[i]=s.value,s=s.next;return e}toArrayReverse(){let e=Array(this.length);for(let i=0,s=this.tail;s;i++)e[i]=s.value,s=s.prev;return e}slice(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let s=new Dt;if(i<e||i<0)return s;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.head,h=0;for(h=0;r&&h<e;h++)r=r.next;for(;r&&h<i;h++,r=r.next)s.push(r.value);return s}sliceReverse(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let s=new Dt;if(i<e||i<0)return s;e<0&&(e=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>e;r--,h=h.prev)s.push(h.value);return s}splice(e,i=0,...s){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);let r=this.head;for(let n=0;r&&n<e;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=Dh(this,r,n);return h}reverse(){let e=this.head,i=this.tail;for(let s=e;s;s=s.prev){let r=s.prev;s.prev=s.next,s.next=r}return this.head=i,this.tail=e,this}};function Dh(t,e,i){let s=new Vi(i,e,e?e.next:t.head,t);return s.next===void 0&&(t.tail=s),s.prev===void 0&&(t.head=s),t.length++,s}function Ah(t,e){t.tail=new Vi(e,t.tail,void 0,t),t.head||=t.tail,t.length++}function Nh(t,e){t.head=new Vi(e,void 0,t.head,t),t.tail||=t.head,t.length++}var Vi=class{list;next;prev;value;constructor(t,e,i,s){this.list=s,this.value=t,e?(e.next=this,this.prev=e):this.prev=void 0,i?(i.prev=this,this.next=i):this.next=void 0}},Li=class{path;absolute;entry;stat;readdir;pending=!1;pendingLink=!1;ignore=!1;piped=!1;constructor(t,e){this.path=t||"./",this.absolute=e}},ps=Buffer.alloc(1024),Le=Symbol("onStat"),$t=Symbol("ended"),F=Symbol("queue"),Yt=Symbol("pendingLinks"),tt=Symbol("current"),vt=Symbol("process"),Vt=Symbol("processing"),we=Symbol("processJob"),M=Symbol("jobs"),li=Symbol("jobDone"),xe=Symbol("addFSEntry"),vs=Symbol("addTarEntry"),xi=Symbol("stat"),Di=Symbol("readdir"),De=Symbol("onreaddir"),Ae=Symbol("pipe"),ys=Symbol("entry"),di=Symbol("entryOpt"),Ne=Symbol("writeEntryClass"),Xs=Symbol("write"),ui=Symbol("ondrain"),ae=class extends wt{sync=!1;opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Ne];onWriteEntry;[F];[Yt]=new Map;[M]=0;[Vt]=!1;[$t]=!1;constructor(t={}){if(super(),this.opt=t,this.file=t.file||"",this.cwd=t.cwd||process.cwd(),this.maxReadSize=t.maxReadSize,this.preservePaths=!!t.preservePaths,this.strict=!!t.strict,this.noPax=!!t.noPax,this.prefix=f(t.prefix||""),this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.readdirCache=t.readdirCache||new Map,this.onWriteEntry=t.onWriteEntry,this[Ne]=Yi,typeof t.onwarn=="function"&&this.on("warn",t.onwarn),this.portable=!!t.portable,t.gzip||t.brotli||t.zstd){if(+!!t.gzip+ +!!t.brotli+ +!!t.zstd>1)throw TypeError("gzip, brotli, zstd are mutually exclusive");if(t.gzip&&(typeof t.gzip!="object"&&(t.gzip={}),this.portable&&(t.gzip.portable=!0),this.zip=new $r(t.gzip)),t.brotli&&(typeof t.brotli!="object"&&(t.brotli={}),this.zip=new Vr(t.brotli)),t.zstd&&(typeof t.zstd!="object"&&(t.zstd={}),this.zip=new Xr(t.zstd)),!this.zip)throw Error("impossible");let e=this.zip;e.on("data",i=>super.write(i)),e.on("end",()=>super.end()),e.on("drain",()=>this[ui]()),this.on("resume",()=>e.resume())}else this.on("drain",this[ui]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,t.mtime&&(this.mtime=t.mtime),this.filter=typeof t.filter=="function"?t.filter:()=>!0,this[F]=new xh,this[M]=0,this.jobs=Number(t.jobs)||4,this[Vt]=!1,this[$t]=!1}[Xs](t){return super.write(t)}add(t){return this.write(t),this}end(t,e,i){return typeof t=="function"&&(i=t,t=void 0),typeof e=="function"&&(i=e,e=void 0),t&&this.add(t),this[$t]=!0,this[vt](),i&&i(),this}write(t){if(this[$t])throw Error("write after end");return typeof t=="string"?this[xe](t):this[vs](t),this.flowing}[vs](t){let e=f(re.resolve(this.cwd,t.path));if(!this.filter(t.path,t))t.resume();else{let i=new Li(t.path,e);i.entry=new Ks(t,this[di](i)),i.entry.on("end",()=>this[li](i)),this[M]+=1,this[F].push(i)}this[vt]()}[xe](t){let e=f(re.resolve(this.cwd,t));this[F].push(new Li(t,e)),this[vt]()}[xi](t){t.pending=!0,this[M]+=1,p[this.follow?"stat":"lstat"](t.absolute,(e,i)=>{t.pending=!1,--this[M],e?this.emit("error",e):this[Le](t,i)})}[Le](t,e){if(this.statCache.set(t.absolute,e),t.stat=e,!this.filter(t.path,e))t.ignore=!0;else if(e.isFile()&&e.nlink>1&&!this.linkCache.get(`${e.dev}:${e.ino}`)&&!this.sync)if(t===this[tt])this[we](t);else{let i=`${e.dev}:${e.ino}`,s=this[Yt].get(i);s?s.push(t):this[Yt].set(i,[t]),t.pendingLink=!0,t.pending=!0}this[vt]()}[Di](t){t.pending=!0,this[M]+=1,p.readdir(t.absolute,(e,i)=>{if(t.pending=!1,--this[M],e)return this.emit("error",e);this[De](t,i)})}[De](t,e){this.readdirCache.set(t.absolute,e),t.readdir=e,this[vt]()}[vt](){if(!this[Vt]){this[Vt]=!0;for(let t=this[F].head;t&&this[M]<this.jobs;t=t.next)if(this[we](t.value),t.value.ignore){let e=t.next;this[F].removeNode(t),t.next=e}this[Vt]=!1,this[$t]&&this[F].length===0&&this[M]===0&&(this.zip?this.zip.end(ps):(super.write(ps),super.end()))}}get[tt](){return this[F]&&this[F].head&&this[F].head.value}[li](t){this[F].shift(),--this[M];let{stat:e}=t;if(e&&e.isFile()&&e.nlink>1){let i=`${e.dev}:${e.ino}`,s=this[Yt].get(i);if(s){this[Yt].delete(i);for(let r of s)r.pending=!1,this[we](r)}}this[vt]()}[we](t){if(t.pending&&t.pendingLink&&t===this[tt]&&(t.pending=!1,t.pendingLink=!1),!t.pending){if(t.entry){t===this[tt]&&!t.piped&&this[Ae](t);return}if(!t.stat){let e=this.statCache.get(t.absolute);e?this[Le](t,e):this[xi](t)}if(t.stat&&!t.ignore){if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){let e=this.readdirCache.get(t.absolute);if(e?this[De](t,e):this[Di](t),!t.readdir)return}if(t.entry=this[ys](t),!t.entry){t.ignore=!0;return}t===this[tt]&&!t.piped&&this[Ae](t)}}}[di](t){return{onwarn:(e,i,s)=>this.warn(e,i,s),noPax:this.noPax,cwd:this.cwd,absolute:t.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](t){this[M]+=1;try{return new this[Ne](t.path,this[di](t)).on("end",()=>this[li](t)).on("error",e=>this.emit("error",e))}catch(e){this.emit("error",e)}}[ui](){this[tt]&&this[tt].entry&&this[tt].entry.resume()}[Ae](t){t.piped=!0,t.readdir&&t.readdir.forEach(s=>{let r=t.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[xe](h+s)});let e=t.entry,i=this.zip;if(!e)throw Error("cannot pipe without source");i?e.on("data",s=>{i.write(s)||e.pause()}):e.on("data",s=>{super.write(s)||e.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(t,e,i={}){ze(this,t,e,i)}},je=class extends ae{sync=!0;constructor(t){super(t),this[Ne]=Vs}pause(){}resume(){}[xi](t){let e=this.follow?"statSync":"lstatSync";this[Le](t,p[e](t.absolute))}[Di](t){this[De](t,p.readdirSync(t.absolute))}[Ae](t){let e=t.entry,i=this.zip;if(t.readdir&&t.readdir.forEach(s=>{let r=t.path,h=r==="./"?"":r.replace(/\/*$/,"/");this[xe](h+s)}),!e)throw Error("Cannot pipe without source");i?e.on("data",s=>{i.write(s)}):e.on("data",s=>{super[Xs](s)})}},Ih=(t,e)=>{let i=new je(t),s=new Ms(t.file,{mode:t.mode||438});i.pipe(s),qs(i,e)},Bh=(t,e)=>{let i=new ae(t),s=new Ce(t.file,{mode:t.mode||438});i.pipe(s);let r=new Promise((h,n)=>{s.on("error",n),s.on("close",h),i.on("error",n)});return Qs(i,e).catch(h=>i.emit("error",h)),r},qs=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?Bt({file:c.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:s=>t.add(s)}):t.add(i)}),t.end()},Qs=async(t,e)=>{for(let i of e)i.charAt(0)==="@"?await Bt({file:c.resolve(String(t.cwd),i.slice(1)),noResume:!0,onReadEntry:s=>{t.add(s)}}):t.add(i);t.end()},bs=ne(Ih,Bh,(t,e)=>{let i=new je(t);return qs(i,e),i},(t,e)=>{let i=new ae(t);return Qs(i,e).catch(s=>i.emit("error",s)),i},(t,e)=>{if(!e?.length)throw TypeError("no paths specified to add to archive")}),Js=(process.env.__FAKE_PLATFORM__||process.platform)==="win32",{O_CREAT:tr,O_NOFOLLOW:gs,O_TRUNC:er,O_WRONLY:ir}=p.constants,sr=Number(process.env.__FAKE_FS_O_FILENAME__)||p.constants.UV_FS_O_FILEMAP||0,Fh=Js&&!!sr,Mh=512*1024,Ch=sr|er|tr|ir,Es=!Js&&typeof gs=="number"?gs|er|tr|ir:null,rr=Es===null?Fh?t=>t<Mh?Ch:"w":()=>"w":()=>Es,Ai=(t,e,i)=>{try{return d.lchownSync(t,e,i)}catch(s){if(s?.code!=="ENOENT")throw s}},Fe=(t,e,i,s)=>{d.lchown(t,e,i,r=>{s(r&&r?.code!=="ENOENT"?r:null)})},Ph=(t,e,i,s,r)=>{e.isDirectory()?hr(c.resolve(t,e.name),i,s,h=>{if(h)return r(h);Fe(c.resolve(t,e.name),i,s,r)}):Fe(c.resolve(t,e.name),i,s,r)},hr=(t,e,i,s)=>{d.readdir(t,{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 Fe(t,e,i,s);let n=h.length,a=null,o=l=>{if(!a){if(l)return s(a=l);if(--n===0)return Fe(t,e,i,s)}};for(let l of h)Ph(t,l,e,i,o)})},zh=(t,e,i,s)=>{e.isDirectory()&&nr(c.resolve(t,e.name),i,s),Ai(c.resolve(t,e.name),i,s)},nr=(t,e,i)=>{let s;try{s=d.readdirSync(t,{withFileTypes:!0})}catch(r){let h=r;if(h?.code==="ENOENT")return;if(h?.code==="ENOTDIR"||h?.code==="ENOTSUP")return Ai(t,e,i);throw h}for(let r of s)zh(t,r,e,i);return Ai(t,e,i)},ar=class extends Error{path;code;syscall="chdir";constructor(t,e){super(`${e}: Cannot cd into '${t}'`),this.path=t,this.code=e}get name(){return"CwdError"}},He=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,e){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=t,this.path=e}get name(){return"SymlinkError"}},Uh=(t,e)=>{d.stat(t,(i,s)=>{(i||!s.isDirectory())&&(i=new ar(t,i?.code||"ENOTDIR")),e(i)})},jh=(t,e,i)=>{t=f(t);let s=e.umask??18,r=e.mode|448,h=(r&s)!==0,n=e.uid,a=e.gid,o=typeof n=="number"&&typeof a=="number"&&(n!==e.processUid||a!==e.processGid),l=e.preserve,u=e.unlink,y=f(e.cwd),b=(k,w)=>{k?i(k):w&&o?hr(w,n,a,T=>b(T)):h?d.chmod(t,r,i):i()};if(t===y)return Uh(t,b);if(l)return cr.mkdir(t,{mode:r,recursive:!0}).then(k=>b(null,k??void 0),b);Ni(y,f(c.relative(y,t)).split("/"),r,u,y,void 0,b)},Ni=(t,e,i,s,r,h,n)=>{if(e.length===0)return n(null,h);let a=e.shift(),o=f(c.resolve(t+"/"+a));d.mkdir(o,i,or(o,e,i,s,r,h,n))},or=(t,e,i,s,r,h,n)=>a=>{a?d.lstat(t,(o,l)=>{if(o)o.path=o.path&&f(o.path),n(o);else if(l.isDirectory())Ni(t,e,i,s,r,h,n);else if(s)d.unlink(t,u=>{if(u)return n(u);d.mkdir(t,i,or(t,e,i,s,r,h,n))});else{if(l.isSymbolicLink())return n(new He(t,t+"/"+e.join("/")));n(a)}}):(h||=t,Ni(t,e,i,s,r,h,n))},Hh=t=>{let e=!1,i;try{e=d.statSync(t).isDirectory()}catch(s){i=s?.code}finally{if(!e)throw new ar(t,i??"ENOTDIR")}},Zh=(t,e)=>{t=f(t);let i=e.umask??18,s=e.mode|448,r=(s&i)!==0,h=e.uid,n=e.gid,a=typeof h=="number"&&typeof n=="number"&&(h!==e.processUid||n!==e.processGid),o=e.preserve,l=e.unlink,u=f(e.cwd),y=w=>{w&&a&&nr(w,h,n),r&&d.chmodSync(t,s)};if(t===u)return Hh(u),y();if(o)return y(d.mkdirSync(t,{mode:s,recursive:!0})??void 0);let b=f(c.relative(u,t)).split("/"),k;for(let w=b.shift(),T=u;w&&(T+="/"+w);w=b.shift()){T=f(c.resolve(T));try{d.mkdirSync(T,s),k||=T}catch{let Ki=d.lstatSync(T);if(Ki.isDirectory())continue;if(l){d.unlinkSync(T),d.mkdirSync(T,s),k||=T;continue}else if(Ki.isSymbolicLink())return new He(T,T+"/"+b.join("/"))}}return y(k)},fi=Object.create(null),ws=1e4,Ot=new Set,Wh=t=>{Ot.has(t)?Ot.delete(t):fi[t]=t.normalize("NFD").toLocaleLowerCase("en").toLocaleUpperCase("en"),Ot.add(t);let e=fi[t],i=Ot.size-ws;if(i>ws/10){for(let s of Ot)if(Ot.delete(s),delete fi[s],--i<=0)break}return e},Gh=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",$h=t=>t.split("/").slice(0,-1).reduce((e,i)=>{let s=e.at(-1);return s!==void 0&&(i=Ns(s,i)),e.push(i||"/"),e},[]),Yh=class{#t=new Map;#i=new Map;#s=new Set;reserve(t,e){t=Gh?["win32 parallelization disabled"]:t.map(s=>Qt(Ns(Wh(s))));let i=new Set(t.map(s=>$h(s)).reduce((s,r)=>s.concat(r)));this.#i.set(e,{dirs:i,paths:t});for(let s of t){let r=this.#t.get(s);r?r.push(e):this.#t.set(s,[e])}for(let s of i){let r=this.#t.get(s);if(!r)this.#t.set(s,[new Set([e])]);else{let h=r.at(-1);h instanceof Set?h.add(e):r.push(new Set([e]))}}return this.#r(e)}#h(t){let e=this.#i.get(t);if(!e)throw Error("function does not have any path reservations");return{paths:e.paths.map(i=>this.#t.get(i)),dirs:[...e.dirs].map(i=>this.#t.get(i))}}check(t){let{paths:e,dirs:i}=this.#h(t);return e.every(s=>s&&s[0]===t)&&i.every(s=>s&&s[0]instanceof Set&&s[0].has(t))}#r(t){return this.#s.has(t)||!this.check(t)?!1:(this.#s.add(t),t(()=>this.#e(t)),!0)}#e(t){if(!this.#s.has(t))return!1;let e=this.#i.get(t);if(!e)throw Error("invalid reservation");let{paths:i,dirs:s}=e,r=new Set;for(let h of i){let n=this.#t.get(h);if(!n||n?.[0]!==t)continue;let a=n[1];if(!a){this.#t.delete(h);continue}if(n.shift(),typeof a=="function")r.add(a);else for(let o of a)r.add(o)}for(let h of s){let n=this.#t.get(h),a=n?.[0];if(!(!n||!(a instanceof Set)))if(a.size===1&&n.length===1){this.#t.delete(h);continue}else if(a.size===1){n.shift();let o=n[0];typeof o=="function"&&r.add(o)}else a.delete(t)}return this.#s.delete(t),r.forEach(h=>this.#r(h)),!0}},Vh=()=>process.umask(),Rs=Symbol("onEntry"),Ii=Symbol("checkFs"),_s=Symbol("checkFs2"),Bi=Symbol("isReusable"),I=Symbol("makeFs"),Fi=Symbol("file"),Mi=Symbol("directory"),Ie=Symbol("link"),Ss=Symbol("symlink"),Os=Symbol("hardlink"),Xt=Symbol("ensureNoSymlink"),ks=Symbol("unsupported"),Ts=Symbol("checkPath"),ci=Symbol("stripAbsolutePath"),ht=Symbol("mkdir"),O=Symbol("onError"),Re=Symbol("pending"),Ls=Symbol("pend"),kt=Symbol("unpend"),mi=Symbol("ended"),pi=Symbol("maybeClose"),Ci=Symbol("skip"),Jt=Symbol("doChown"),te=Symbol("uid"),ee=Symbol("gid"),ie=Symbol("checkedCwd"),se=(process.env.TESTING_TAR_FAKE_PLATFORM||process.platform)==="win32",Kh=1024,Xh=(t,e)=>{if(!se)return d.unlink(t,e);let i=t+".DELETE."+Bs(16).toString("hex");d.rename(t,i,s=>{if(s)return e(s);d.unlink(i,e)})},qh=t=>{if(!se)return d.unlinkSync(t);let e=t+".DELETE."+Bs(16).toString("hex");d.renameSync(t,e),d.unlinkSync(e)},xs=(t,e,i)=>t!==void 0&&t===t>>>0?t:e!==void 0&&e===e>>>0?e:i,Me=class extends At{[mi]=!1;[ie]=!1;[Re]=0;reservations=new Yh;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(t={}){if(t.ondone=()=>{this[mi]=!0,this[pi]()},super(t),this.transform=t.transform,this.chmod=!!t.chmod,typeof t.uid=="number"||typeof t.gid=="number"){if(typeof t.uid!="number"||typeof t.gid!="number")throw TypeError("cannot set owner without number uid and gid");if(t.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=t.uid,this.gid=t.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;this.preserveOwner=t.preserveOwner===void 0&&typeof t.uid!="number"?process.getuid?.()===0:!!t.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 t.maxDepth=="number"?t.maxDepth:Kh,this.forceChown=t.forceChown===!0,this.win32=!!t.win32||se,this.newer=!!t.newer,this.keep=!!t.keep,this.noMtime=!!t.noMtime,this.preservePaths=!!t.preservePaths,this.unlink=!!t.unlink,this.cwd=f(c.resolve(t.cwd||process.cwd())),this.strip=Number(t.strip)||0,this.processUmask=this.chmod?typeof t.processUmask=="number"?t.processUmask:Vh():0,this.umask=typeof t.umask=="number"?t.umask:this.processUmask,this.dmode=t.dmode||511&~this.umask,this.fmode=t.fmode||438&~this.umask,this.on("entry",e=>this[Rs](e))}warn(t,e,i={}){return(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT")&&(i.recoverable=!1),super.warn(t,e,i)}[pi](){this[mi]&&this[Re]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[ci](t,e){let i=t[e],{type:s}=t;if(!i||this.preservePaths)return!0;let[r,h]=Gi(i),n=h.replaceAll(/\\/g,"/").split("/");if(n.includes("..")||se&&/^[a-z]:\.\.$/i.test(n[0]??"")){if(e==="path"||s==="Link")return this.warn("TAR_ENTRY_ERROR",`${e} contains '..'`,{entry:t,[e]:i}),!1;let a=c.posix.dirname(t.path),o=c.posix.normalize(c.posix.join(a,n.join("/")));if(o.startsWith("../")||o==="..")return this.warn("TAR_ENTRY_ERROR",`${e} escapes extraction directory`,{entry:t,[e]:i}),!1}return r&&(t[e]=String(h),this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute ${e}`,{entry:t,[e]:i})),!0}[Ts](t){let e=f(t.path),i=e.split("/");if(this.strip){if(i.length<this.strip)return!1;if(t.type==="Link"){let s=f(String(t.linkpath)).split("/");if(s.length>=this.strip)t.linkpath=s.slice(this.strip).join("/");else return!1}i.splice(0,this.strip),t.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:e,depth:i.length,maxDepth:this.maxDepth}),!1;if(!this[ci](t,"path")||!this[ci](t,"linkpath"))return!1;if(t.absolute=c.isAbsolute(t.path)?f(c.resolve(t.path)):f(c.resolve(this.cwd,t.path)),!this.preservePaths&&typeof t.absolute=="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:f(t.path),resolvedPath:t.absolute,cwd:this.cwd}),!1;if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir")return!1;if(this.win32){let{root:s}=c.win32.parse(String(t.absolute));t.absolute=s+ds(String(t.absolute).slice(s.length));let{root:r}=c.win32.parse(t.path);t.path=r+ds(t.path.slice(r.length))}return!0}[Rs](t){if(!this[Ts](t))return t.resume();switch(wr.equal(typeof t.absolute,"string"),t.type){case"Directory":case"GNUDumpDir":t.mode&&(t.mode|=448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Ii](t);default:return this[ks](t)}}[O](t,e){t.name==="CwdError"?this.emit("error",t):(this.warn("TAR_ENTRY_ERROR",t,{entry:e}),this[kt](),e.resume())}[ht](t,e,i){jh(f(t),{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:e},i)}[Jt](t){return this.forceChown||this.preserveOwner&&(typeof t.uid=="number"&&t.uid!==this.processUid||typeof t.gid=="number"&&t.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[te](t){return xs(this.uid,t.uid,this.processUid)}[ee](t){return xs(this.gid,t.gid,this.processGid)}[Fi](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.fmode,s=new Ce(String(t.absolute),{flags:rr(t.size),mode:i,autoClose:!1});s.on("error",a=>{s.fd&&d.close(s.fd,()=>{}),s.write=()=>!0,this[O](a,t),e()});let r=1,h=a=>{if(a){s.fd&&d.close(s.fd,()=>{}),this[O](a,t),e();return}--r===0&&s.fd!==void 0&&d.close(s.fd,o=>{o?this[O](o,t):this[kt](),e()})};s.on("finish",()=>{let a=String(t.absolute),o=s.fd;if(typeof o=="number"&&t.mtime&&!this.noMtime){r++;let l=t.atime||new Date,u=t.mtime;d.futimes(o,l,u,y=>y?d.utimes(a,l,u,b=>h(b&&y)):h())}if(typeof o=="number"&&this[Jt](t)){r++;let l=this[te](t),u=this[ee](t);typeof l=="number"&&typeof u=="number"&&d.fchown(o,l,u,y=>y?d.chown(a,l,u,b=>h(b&&y)):h())}h()});let n=this.transform&&this.transform(t)||t;n!==t&&(n.on("error",a=>{this[O](a,t),e()}),t.pipe(n)),n.pipe(s)}[Mi](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.dmode;this[ht](String(t.absolute),i,s=>{if(s){this[O](s,t),e();return}let r=1,h=()=>{--r===0&&(e(),this[kt](),t.resume())};t.mtime&&!this.noMtime&&(r++,d.utimes(String(t.absolute),t.atime||new Date,t.mtime,h)),this[Jt](t)&&(r++,d.chown(String(t.absolute),Number(this[te](t)),Number(this[ee](t)),h)),h()})}[ks](t){t.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t}),t.resume()}[Ss](t,e){let i=f(c.relative(this.cwd,c.resolve(c.dirname(String(t.absolute)),String(t.linkpath)))).split("/");this[Xt](t,this.cwd,i,()=>this[Ie](t,String(t.linkpath),"symlink",e),s=>{this[O](s,t),e()})}[Os](t,e){let i=f(c.resolve(this.cwd,String(t.linkpath))),s=f(String(t.linkpath)).split("/");this[Xt](t,this.cwd,s,()=>this[Ie](t,i,"link",e),r=>{this[O](r,t),e()})}[Xt](t,e,i,s,r){let h=i.shift();if(this.preservePaths||h===void 0)return s();let n=c.resolve(e,h);d.lstat(n,(a,o)=>{if(a)return s();if(o?.isSymbolicLink())return r(new He(n,c.resolve(n,i.join("/"))));this[Xt](t,n,i,s,r)})}[Ls](){this[Re]++}[kt](){this[Re]--,this[pi]()}[Ci](t){this[kt](),t.resume()}[Bi](t,e){return t.type==="File"&&!this.unlink&&e.isFile()&&e.nlink<=1&&!se}[Ii](t){this[Ls]();let e=[t.path];t.linkpath&&e.push(t.linkpath),this.reservations.reserve(e,i=>this[_s](t,i))}[_s](t,e){let i=n=>{e(n)},s=()=>{this[ht](this.cwd,this.dmode,n=>{if(n){this[O](n,t),i();return}this[ie]=!0,r()})},r=()=>{if(t.absolute!==this.cwd){let n=f(c.dirname(String(t.absolute)));if(n!==this.cwd)return this[ht](n,this.dmode,a=>{if(a){this[O](a,t),i();return}h()})}h()},h=()=>{d.lstat(String(t.absolute),(n,a)=>{if(a&&(this.keep||this.newer&&a.mtime>(t.mtime??a.mtime))){this[Ci](t),i();return}if(n||this[Bi](t,a))return this[I](null,t,i);if(a.isDirectory()){if(t.type==="Directory"){let o=this.chmod&&t.mode&&(a.mode&4095)!==t.mode,l=u=>this[I](u??null,t,i);return o?d.chmod(String(t.absolute),Number(t.mode),l):l()}if(t.absolute!==this.cwd)return d.rmdir(String(t.absolute),o=>this[I](o??null,t,i))}if(t.absolute===this.cwd)return this[I](null,t,i);Xh(String(t.absolute),o=>this[I](o??null,t,i))})};this[ie]?r():s()}[I](t,e,i){if(t){this[O](t,e),i();return}switch(e.type){case"File":case"OldFile":case"ContiguousFile":return this[Fi](e,i);case"Link":return this[Os](e,i);case"SymbolicLink":return this[Ss](e,i);case"Directory":case"GNUDumpDir":return this[Mi](e,i)}}[Ie](t,e,i,s){d[i](e,String(t.absolute),r=>{r?this[O](r,t):(this[kt](),t.resume()),s()})}},Kt=t=>{try{return[null,t()]}catch(e){return[e,null]}},Pi=class extends Me{sync=!0;[I](t,e){return super[I](t,e,()=>{})}[Ii](t){if(!this[ie]){let r=this[ht](this.cwd,this.dmode);if(r)return this[O](r,t);this[ie]=!0}if(t.absolute!==this.cwd){let r=f(c.dirname(String(t.absolute)));if(r!==this.cwd){let h=this[ht](r,this.dmode);if(h)return this[O](h,t)}}let[e,i]=Kt(()=>d.lstatSync(String(t.absolute)));if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime)))return this[Ci](t);if(e||this[Bi](t,i))return this[I](null,t);if(i.isDirectory()){if(t.type==="Directory"){let[h]=this.chmod&&t.mode&&(i.mode&4095)!==t.mode?Kt(()=>{d.chmodSync(String(t.absolute),Number(t.mode))}):[];return this[I](h,t)}let[r]=Kt(()=>d.rmdirSync(String(t.absolute)));this[I](r,t)}let[s]=t.absolute===this.cwd?[]:Kt(()=>qh(String(t.absolute)));this[I](s,t)}[Fi](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.fmode,s=n=>{let a;try{d.closeSync(r)}catch(o){a=o}(n||a)&&this[O](n||a,t),e()},r;try{r=d.openSync(String(t.absolute),rr(t.size),i)}catch(n){return s(n)}let h=this.transform&&this.transform(t)||t;h!==t&&(h.on("error",n=>this[O](n,t)),t.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(t.mtime&&!this.noMtime){let a=t.atime||new Date,o=t.mtime;try{d.futimesSync(r,a,o)}catch(l){try{d.utimesSync(String(t.absolute),a,o)}catch{n=l}}}if(this[Jt](t)){let a=this[te](t),o=this[ee](t);try{d.fchownSync(r,Number(a),Number(o))}catch(l){try{d.chownSync(String(t.absolute),Number(a),Number(o))}catch{n||=l}}}s(n)})}[Mi](t,e){let i=typeof t.mode=="number"?t.mode&4095:this.dmode,s=this[ht](String(t.absolute),i);if(s){this[O](s,t),e();return}if(t.mtime&&!this.noMtime)try{d.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch{}if(this[Jt](t))try{d.chownSync(String(t.absolute),Number(this[te](t)),Number(this[ee](t)))}catch{}e(),t.resume()}[ht](t,e){try{return Zh(f(t),{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:e})}catch(i){return i}}[Xt](t,e,i,s,r){if(this.preservePaths||i.length===0)return s();let h=e;for(let n of i){h=c.resolve(h,n);let[a,o]=Kt(()=>d.lstatSync(h));if(a)return s();if(o.isSymbolicLink())return r(new He(h,c.resolve(e,i.join("/"))))}s()}[Ie](t,e,i,s){let r=`${i}Sync`;try{d[r](e,String(t.absolute)),s(),t.resume()}catch(h){return this[O](h,t)}}},Ds=ne(t=>{let e=new Pi(t),i=t.file,s=d.statSync(i);new Fr(i,{readSize:t.maxReadSize||16*1024*1024,size:s.size}).pipe(e)},(t,e)=>{let i=new Me(t),s=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((h,n)=>{i.on("error",n),i.on("close",h),d.stat(r,(a,o)=>{if(a)n(a);else{let l=new Ui(r,{readSize:s,size:o.size});l.on("error",n),l.pipe(i)}})})},t=>new Pi(t),t=>new Me(t),(t,e)=>{e?.length&&Wi(t,e)}),Qh=(t,e)=>{let i=new je(t),s=!0,r,h;try{try{r=d.openSync(t.file,"r+")}catch(o){if(o?.code==="ENOENT")r=d.openSync(t.file,"w+");else throw o}let n=d.fstatSync(r),a=Buffer.alloc(512);t:for(h=0;h<n.size;h+=512){for(let u=0,y=0;u<512;u+=y){if(y=d.readSync(r,a,u,a.length-u,h+u),h===0&&a[0]===31&&a[1]===139)throw Error("cannot append to compressed archives");if(!y)break t}let o=new ot(a);if(!o.cksumValid)break;let l=512*Math.ceil((o.size||0)/512);if(h+l+512>n.size)break;h+=l,t.mtimeCache&&o.mtime&&t.mtimeCache.set(String(o.path),o.mtime)}s=!1,Jh(t,i,h,r,e)}finally{if(s)try{d.closeSync(r)}catch{}}},Jh=(t,e,i,s,r)=>{let h=new Ms(t.file,{fd:s,start:i});e.pipe(h),en(e,r)},tn=(t,e)=>{e=Array.from(e);let i=new ae(t),s=(r,h,n)=>{let a=(b,k)=>{b?d.close(r,w=>n(b)):n(null,k)},o=0;if(h===0)return a(null,0);let l=0,u=Buffer.alloc(512),y=(b,k)=>{if(b||k===void 0)return a(b);if(l+=k,l<512&&k)return d.read(r,u,l,u.length-l,o+l,y);if(o===0&&u[0]===31&&u[1]===139)return a(Error("cannot append to compressed archives"));if(l<512)return a(null,o);let w=new ot(u);if(!w.cksumValid)return a(null,o);let T=512*Math.ceil((w.size??0)/512);if(o+T+512>h||(o+=T+512,o>=h))return a(null,o);t.mtimeCache&&w.mtime&&t.mtimeCache.set(String(w.path),w.mtime),l=0,d.read(r,u,0,512,o,y)};d.read(r,u,0,512,o,y)};return new Promise((r,h)=>{i.on("error",h);let n="r+",a=(o,l)=>{if(o&&o.code==="ENOENT"&&n==="r+")return n="w+",d.open(t.file,n,a);if(o||!l)return h(o);d.fstat(l,(u,y)=>{if(u)return d.close(l,()=>h(u));s(l,y.size,(b,k)=>{if(b)return h(b);let w=new Ce(t.file,{fd:l,start:k});i.pipe(w),w.on("error",h),w.on("close",r),sn(i,e)})})};d.open(t.file,n,a)})},en=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?Bt({file:c.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:s=>t.add(s)}):t.add(i)}),t.end()},sn=async(t,e)=>{for(let i of e)i.charAt(0)==="@"?await Bt({file:c.resolve(String(t.cwd),i.slice(1)),noResume:!0,onReadEntry:s=>t.add(s)}):t.add(i);t.end()},yt=ne(Qh,tn,()=>{throw TypeError("file is required")},()=>{throw TypeError("file is required")},(t,e)=>{if(!jr(t))throw TypeError("file is required");if(t.gzip||t.brotli||t.zstd||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw TypeError("cannot append to compressed archives");if(!e?.length)throw TypeError("no paths specified to add/replace")});ne(yt.syncFile,yt.asyncFile,yt.syncNoFile,yt.asyncNoFile,(t,e=[])=>{yt.validate?.(t,e),rn(t)});var rn=t=>{let e=t.filter;t.mtimeCache||=new Map,t.filter=e?(i,s)=>e(i,s)&&!((t.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0)):(i,s)=>!((t.mtimeCache?.get(i)??s.mtime??0)>(s.mtime??0))};export{an as index_min_exports};
@@ -1,2 +1,2 @@
1
- import{createRequire as g}from"node:module";import{e as p}from"../packem_shared/index-BzhrR_iC.js";import{p as e}from"./cli-main.js";import{d as _}from"../packem_shared/pm-runner-CMSml1Bj.js";import{y as u}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{p as m}from"../packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js";import{U as $}from"../packem_shared/writeFileSync-DJoHk3Ks-BPRoepNw.js";let y;const w=r=>(y??=g(import.meta.url))(r),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=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 w(r)},{spawnSync:h}=v("node:child_process"),t="@lavamoat/preinstall-always-fail",d=r=>{const n=p(r,"package.json");if(!u(n))return"no-package-json";try{const s=m(n);if(s.devDependencies?.[t]||s.dependencies?.[t])return"installed"}catch{}return"missing"},k=r=>{const n=p(r,"package.json");if(!u(n))return!1;try{const s=m(n);let i=!1;const l=a=>!a||!(t in a)?a:(i=!0,Object.fromEntries(Object.entries(a).filter(([o])=>o!==t)));return s.devDependencies=l(s.devDependencies),s.dependencies=l(s.dependencies),i&&$(n,`${JSON.stringify(s,null,2)}
1
+ import{createRequire as g}from"node:module";import{e as p}from"../packem_shared/index-BdMIfGVZ.js";import{p as e}from"./cli-main.js";import{d as _}from"../packem_shared/pm-runner-ImwtpnWY.js";import{y as u}from"../packem_shared/isAccessibleSync-DYKTrrvc-BwaMhQs0.js";import{p as m}from"../packem_shared/readJsonSync-CbryXYxN-Bm5i10UW.js";import{U as $}from"../packem_shared/writeFileSync-DJoHk3Ks-Dhem3Uof.js";let y;const w=r=>(y??=g(import.meta.url))(r),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=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 w(r)},{spawnSync:h}=v("node:child_process"),t="@lavamoat/preinstall-always-fail",d=r=>{const n=p(r,"package.json");if(!u(n))return"no-package-json";try{const s=m(n);if(s.devDependencies?.[t]||s.dependencies?.[t])return"installed"}catch{}return"missing"},k=r=>{const n=p(r,"package.json");if(!u(n))return!1;try{const s=m(n);let i=!1;const l=a=>!a||!(t in a)?a:(i=!0,Object.fromEntries(Object.entries(a).filter(([o])=>o!==t)));return s.devDependencies=l(s.devDependencies),s.dependencies=l(s.dependencies),i&&$(n,`${JSON.stringify(s,null,2)}
2
2
  `),i}catch{return!1}},I=({options:r,workspaceRoot:n})=>{const s=n??process.cwd();if(r.status){switch(d(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){k(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(d(s)==="installed"){e.info(`${t} is already installed.`);return}const i=_(s),a={bun:["add","-d",t],npm:["install","--save-dev",t],pnpm:["add","-D","-w",t],yarn:["add","-D",t]}[i.name];if(!a){e.error(`Cannot install tripwire — unsupported package manager '${i.name}'.`),process.exitCode=1;return}e.info(`Installing ${t} via ${i.name}…`);const o=h(i.name,a,{cwd:s,stdio:"inherit"});if(o.error){e.error(`Failed to install tripwire: ${o.error.message}`),process.exitCode=1;return}if(o.signal!==null){e.error(`${i.name} was terminated by signal ${o.signal}`),process.exitCode=1;return}if(o.status!==0){e.error(`${i.name} exited with code ${String(o.status)}`),process.exitCode=o.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.")};export{I as default};