@visulima/vis 6.1.2 → 6.1.4

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 (199) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE.md +0 -29
  3. package/dashboard/dist/index.html +10 -10
  4. package/dist/bin.js +1 -1
  5. package/dist/binx.js +1 -1
  6. package/dist/config/index.d.ts +16 -10
  7. package/dist/generate/index.d.ts +25 -0
  8. package/dist/packem_chunks/CONFIG_FILES.js +6 -7
  9. package/dist/packem_chunks/bloom-status.js +1 -1
  10. package/dist/packem_chunks/bloom-sync.js +1 -1
  11. package/dist/packem_chunks/catalog2.js +7 -7
  12. package/dist/packem_chunks/cli-exec.js +1 -1
  13. package/dist/packem_chunks/cli-main.js +129 -129
  14. package/dist/packem_chunks/dispatch.js +1 -1
  15. package/dist/packem_chunks/fix.js +1 -1
  16. package/dist/packem_chunks/handler.js +1 -1
  17. package/dist/packem_chunks/handler10.js +5 -5
  18. package/dist/packem_chunks/handler11.js +1 -1
  19. package/dist/packem_chunks/handler12.js +1 -1
  20. package/dist/packem_chunks/handler13.js +1 -1
  21. package/dist/packem_chunks/handler14.js +1 -1
  22. package/dist/packem_chunks/handler15.js +1 -1
  23. package/dist/packem_chunks/handler16.js +1 -1
  24. package/dist/packem_chunks/handler17.js +1 -1
  25. package/dist/packem_chunks/handler18.js +1 -1
  26. package/dist/packem_chunks/handler19.js +1 -1
  27. package/dist/packem_chunks/handler2.js +1 -1
  28. package/dist/packem_chunks/handler20.js +1 -1
  29. package/dist/packem_chunks/handler21.js +1 -1
  30. package/dist/packem_chunks/handler22.js +1 -1
  31. package/dist/packem_chunks/handler23.js +1 -1
  32. package/dist/packem_chunks/handler24.js +1 -1
  33. package/dist/packem_chunks/handler25.js +1 -1
  34. package/dist/packem_chunks/handler26.js +1 -1
  35. package/dist/packem_chunks/handler27.js +1 -1
  36. package/dist/packem_chunks/handler28.js +1 -1
  37. package/dist/packem_chunks/handler29.js +1 -1
  38. package/dist/packem_chunks/handler3.js +2 -2
  39. package/dist/packem_chunks/handler30.js +1 -1
  40. package/dist/packem_chunks/handler32.js +1 -1
  41. package/dist/packem_chunks/handler4.js +1 -1
  42. package/dist/packem_chunks/handler40.js +1 -1
  43. package/dist/packem_chunks/handler46.js +1 -1
  44. package/dist/packem_chunks/handler5.js +1 -1
  45. package/dist/packem_chunks/handler50.js +2 -2
  46. package/dist/packem_chunks/handler51.js +1 -1
  47. package/dist/packem_chunks/handler52.js +1 -1
  48. package/dist/packem_chunks/handler53.js +1 -1
  49. package/dist/packem_chunks/handler54.js +2 -2
  50. package/dist/packem_chunks/handler55.js +1 -1
  51. package/dist/packem_chunks/handler56.js +1 -1
  52. package/dist/packem_chunks/handler58.js +1 -1
  53. package/dist/packem_chunks/handler59.js +1 -1
  54. package/dist/packem_chunks/handler6.js +1 -1
  55. package/dist/packem_chunks/handler60.js +4 -4
  56. package/dist/packem_chunks/handler61.js +2 -2
  57. package/dist/packem_chunks/handler62.js +1 -1
  58. package/dist/packem_chunks/handler63.js +2 -61
  59. package/dist/packem_chunks/handler64.js +61 -6
  60. package/dist/packem_chunks/handler65.js +6 -8
  61. package/dist/packem_chunks/handler66.js +8 -2
  62. package/dist/packem_chunks/handler67.js +2 -28
  63. package/dist/packem_chunks/handler68.js +28 -12
  64. package/dist/packem_chunks/handler69.js +12 -25
  65. package/dist/packem_chunks/handler7.js +1 -1
  66. package/dist/packem_chunks/handler70.js +25 -22
  67. package/dist/packem_chunks/handler71.js +22 -10
  68. package/dist/packem_chunks/handler72.js +10 -133
  69. package/dist/packem_chunks/handler73.js +133 -23
  70. package/dist/packem_chunks/handler74.js +23 -323
  71. package/dist/packem_chunks/handler75.js +274 -659
  72. package/dist/packem_chunks/handler76.js +13 -13
  73. package/dist/packem_chunks/handler77.js +12 -12
  74. package/dist/packem_chunks/handler78.js +1 -1
  75. package/dist/packem_chunks/handler79.js +69 -67
  76. package/dist/packem_chunks/handler8.js +1 -1
  77. package/dist/packem_chunks/handler9.js +1 -1
  78. package/dist/packem_chunks/heal-accept.js +1 -1
  79. package/dist/packem_chunks/heal.js +1 -1
  80. package/dist/packem_chunks/help-command.js +1 -1
  81. package/dist/packem_chunks/html.js +707 -0
  82. package/dist/packem_chunks/index4.js +1 -1
  83. package/dist/packem_chunks/index6.js +57 -51
  84. package/dist/packem_chunks/index7.js +2 -2
  85. package/dist/packem_chunks/keys-refresh.js +1 -1
  86. package/dist/packem_chunks/lean.js +1 -1
  87. package/dist/packem_chunks/list.js +1 -1
  88. package/dist/packem_chunks/loader.js +1 -1
  89. package/dist/packem_chunks/prune.js +1 -1
  90. package/dist/packem_chunks/run.js +1 -1
  91. package/dist/packem_chunks/status.js +1 -1
  92. package/dist/packem_chunks/sync.js +1 -1
  93. package/dist/packem_chunks/sync2.js +1 -1
  94. package/dist/packem_chunks/tripwire.js +1 -1
  95. package/dist/packem_chunks/ts-loader.js +1 -1
  96. package/dist/packem_chunks/verify-lockfile.js +1 -1
  97. package/dist/packem_shared/{ReleaseClient-CWD9BC5w.js → ReleaseClient-CRuCHDsT.js} +1 -1
  98. package/dist/packem_shared/advisories-DHGJ6XhP.js +1 -0
  99. package/dist/packem_shared/affected-selection-DCT4CLex.js +1 -0
  100. package/dist/packem_shared/{affected-shas-B_kfSKss.js → affected-shas-CycHU3nr.js} +1 -1
  101. package/dist/packem_shared/{ai-analysis-BCJ1kuDM.js → ai-analysis-CO4rT3Nd.js} +1 -1
  102. package/dist/packem_shared/ai-cache-Dkb6me20.js +1 -0
  103. package/dist/packem_shared/{ai-fix-DIMErSws.js → ai-fix-C0OBhGDq.js} +1 -1
  104. package/dist/packem_shared/{augment-B9kSZuvW.js → augment-BSeqaai8.js} +1 -1
  105. package/dist/packem_shared/{bin-BcLTer1k.js → bin-DwACrJUJ.js} +1 -1
  106. package/dist/packem_shared/build-scripts-BeMIA-_q.js +1 -0
  107. package/dist/packem_shared/{command-runtime-HSsYGCQd.js → command-runtime-DG49t2MT.js} +1 -1
  108. package/dist/packem_shared/{dependency-scan-D_v3KM59.js → dependency-scan-D8e370_h.js} +1 -1
  109. package/dist/packem_shared/detect-C-9o_BPB.js +1 -0
  110. package/dist/packem_shared/{docker-DXqV-07f.js → docker-vRDm2lHX.js} +1 -1
  111. package/dist/packem_shared/{ecosystem-gate-CwsTc7YW.js → ecosystem-gate-DpO43yAS.js} +1 -1
  112. package/dist/packem_shared/env-BymuoTL8.js +4 -0
  113. package/dist/packem_shared/env-consistency-BDfAa56d.js +1 -0
  114. package/dist/packem_shared/{failure-log-DIsKBKaI.js → failure-log-BslhfaEO.js} +1 -1
  115. package/dist/packem_shared/glob-Cyk1H9ZL-6yDyaJwk.js +1 -0
  116. package/dist/packem_shared/{index-BzhrR_iC.js → index-0dnGN3GP.js} +1 -1
  117. package/dist/packem_shared/index-CIdjkZgt.js +1 -0
  118. package/dist/packem_shared/{index-9Ot7jTd4.js → index-Cwxbl_pY.js} +1 -1
  119. package/dist/packem_shared/index-Doab17tq.js +1 -0
  120. package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-C-_5cgwu.js → isAccessibleSync-DYKTrrvc-CBsMZhj-.js} +1 -1
  121. package/dist/packem_shared/{lifecycle-CQjeMPY0.js → lifecycle-Gy7mqMGg.js} +2 -2
  122. package/dist/packem_shared/{lockfile-CiUtEbnt.js → lockfile-DEWjBrlY.js} +1 -1
  123. package/dist/packem_shared/manifests-kE5OweNT.js +1 -0
  124. package/dist/packem_shared/{min-release-age-JViyQuBM.js → min-release-age-yvuPbJ8G.js} +1 -1
  125. package/dist/packem_shared/missing-package-json-CEEPXqYi.js +1 -0
  126. package/dist/packem_shared/{multi-eco-lockfiles-fgkpeHJv.js → multi-eco-lockfiles-D5tM7pkg.js} +1 -1
  127. package/dist/packem_shared/{native-config-sync-TdTWjVgI.js → native-config-sync-DDGt3vvd.js} +1 -1
  128. package/dist/packem_shared/{npmrc-CHsOyMvA.js → npmrc-CIvOb61L.js} +1 -1
  129. package/dist/packem_shared/{osv-Do9PMOea.js → osv-4kFhXIoW.js} +1 -1
  130. package/dist/packem_shared/osv-bloom-DU6avR2k.js +2 -0
  131. package/dist/packem_shared/package-version-x7sPg2TM.js +4 -0
  132. package/dist/packem_shared/packument-Dg8cIDYR.js +1 -0
  133. package/dist/packem_shared/{pm-runner-RM72mDZg.js → pm-runner-Dboj-wZG.js} +1 -1
  134. package/dist/packem_shared/{project-name-filter-ZQaLgytG.js → project-name-filter-B3tKt-Pf.js} +1 -1
  135. package/dist/packem_shared/{provenance-SX1MxPUZ.js → provenance-BG5mu0H_.js} +1 -1
  136. package/dist/packem_shared/publish-DkgvB2Lk.js +34 -0
  137. package/dist/packem_shared/registry-CndByNx9.js +85 -0
  138. package/dist/packem_shared/registry-keys-CE-RZlp_.js +1 -0
  139. package/dist/packem_shared/{removeSync-g1D5kONg-LbjATA8v.js → removeSync-g1D5kONg-jOsRSIIv.js} +1 -1
  140. package/dist/packem_shared/{renderToString-DR0zDUjh-DXppT6AM.js → renderToString-DR0zDUjh-DeiCwydO.js} +1 -1
  141. package/dist/packem_shared/{resolve-explicit-D9kdTNvl.js → resolve-explicit-Cge6eKPt.js} +1 -1
  142. package/dist/packem_shared/{resolve-runtime-DNukUjIr.js → resolve-runtime-D8rxuo3J.js} +1 -1
  143. package/dist/packem_shared/run-CKL4VGzQ.js +10 -0
  144. package/dist/packem_shared/{run-file-UBukWaha.js → run-file-D1mlOnd8.js} +1 -1
  145. package/dist/packem_shared/{run-summary-utils-CMeURYtS.js → run-summary-utils-DbyeUM6f.js} +1 -1
  146. package/dist/packem_shared/runtime-check-Dw0q3X67.js +1 -0
  147. package/dist/packem_shared/s1ngularity-BOl0c716.js +1 -0
  148. package/dist/packem_shared/{scaffold-files-DJlz36Mu.js → scaffold-files-B8zMyMvq.js} +1 -1
  149. package/dist/packem_shared/{scan-progress-DymX71_5.js → scan-progress-CY3XIDOY.js} +1 -1
  150. package/dist/packem_shared/selectors-BB0yaWyK.js +3 -0
  151. package/dist/packem_shared/{signatures-CeL0bOEo.js → signatures-r1SeDHLL.js} +1 -1
  152. package/dist/packem_shared/spinner-B_rRdoro.js +1 -0
  153. package/dist/packem_shared/{table-oA7p7-yP.js → table-bu4cV-it.js} +1 -1
  154. package/dist/packem_shared/{tabs-BiSifphV.js → tabs-A2EUpTHt.js} +1 -1
  155. package/dist/packem_shared/target-merge-ya19LiWB.js +1 -0
  156. package/dist/packem_shared/{target-options-DsHFmRZH.js → target-options-rIthWS4M.js} +1 -1
  157. package/dist/packem_shared/{task-env-C2lmxvzA.js → task-env-Cl4jNMCR.js} +1 -1
  158. package/dist/packem_shared/toolchain-Bt93i37e.js +5 -0
  159. package/dist/packem_shared/typosquats-BbebOgKM.js +1 -0
  160. package/dist/packem_shared/{use-measured-height-BHm-HiSF.js → use-measured-height-CwhybDI9.js} +1 -1
  161. package/dist/packem_shared/{verify-B_MblU_Q.js → verify-3WE9U_Bv.js} +1 -1
  162. package/dist/packem_shared/{vis-update-app-6QOYxnNx.js → vis-update-app-PjJWvxqF.js} +1 -1
  163. package/dist/packem_shared/{vis-user-error-3YS7sPYy.js → vis-user-error-BivZDkQD.js} +2 -2
  164. package/dist/packem_shared/{watch-CcTketln.js → watch-C-9-PD2m.js} +1 -1
  165. package/dist/packem_shared/{watch-loop-CGi66Fs0.js → watch-loop-dWYGUQwi.js} +1 -1
  166. package/dist/release/index.js +1 -1
  167. package/dist/release/plugin-sdk.d.ts +32 -0
  168. package/dist/release/presets.d.ts +38 -0
  169. package/dist/runtime/preload.js +1 -1
  170. package/index.js +26 -26
  171. package/package.json +19 -15
  172. package/schemas/vis-config.schema.json +12 -0
  173. package/dist/packem_shared/advisories-DO-P0V1_.js +0 -1
  174. package/dist/packem_shared/affected-selection-CeeZo7Uy.js +0 -1
  175. package/dist/packem_shared/ai-cache-iSIyY3So.js +0 -1
  176. package/dist/packem_shared/build-scripts-CEDx_nJp.js +0 -1
  177. package/dist/packem_shared/detect-CbMRSXkM.js +0 -1
  178. package/dist/packem_shared/env-BSXG3QKH.js +0 -4
  179. package/dist/packem_shared/env-consistency-B4rU4MQb.js +0 -1
  180. package/dist/packem_shared/glob-Cyk1H9ZL-CL9optrn.js +0 -1
  181. package/dist/packem_shared/index-BS6A9QR_.js +0 -1
  182. package/dist/packem_shared/manifests-Du4yKlf_.js +0 -1
  183. package/dist/packem_shared/missing-package-json-1BIoWQq0.js +0 -1
  184. package/dist/packem_shared/osv-bloom-BCAX5ARR.js +0 -2
  185. package/dist/packem_shared/package-version-Bq6Cne_7.js +0 -4
  186. package/dist/packem_shared/packument-CbTmbHU4.js +0 -1
  187. package/dist/packem_shared/publish-Dc0XGH3K.js +0 -34
  188. package/dist/packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js +0 -1
  189. package/dist/packem_shared/registry-Dg9XI6RT.js +0 -81
  190. package/dist/packem_shared/registry-keys-z038Ecb4.js +0 -1
  191. package/dist/packem_shared/run-DLvd3RIZ.js +0 -10
  192. package/dist/packem_shared/runtime-check-D3cRDuoi.js +0 -1
  193. package/dist/packem_shared/s1ngularity-BuU9Cxpy.js +0 -1
  194. package/dist/packem_shared/selectors-edwcgNl3.js +0 -3
  195. package/dist/packem_shared/spinner-CPoBymcv.js +0 -1
  196. package/dist/packem_shared/target-merge-DVJl-7Qz.js +0 -4
  197. package/dist/packem_shared/toolchain-CP79HNVy.js +0 -5
  198. package/dist/packem_shared/typosquats-BFKus_aM.js +0 -1
  199. package/dist/packem_shared/writeFileSync-DJoHk3Ks-BPRoepNw.js +0 -1
@@ -1 +1 @@
1
- import{createRequire as v}from"node:module";import{e as m}from"../packem_shared/index-BzhrR_iC.js";import{cleanWorkspace as E}from"#native";import{l as S}from"../packem_shared/missing-package-json-1BIoWQq0.js";import{p as c}from"./cli-main.js";import{e as p}from"../packem_shared/utils-DQFHJn72.js";import{y as P}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";let g;const _=e=>(g??=v(import.meta.url))(e),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,t]=u.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return u.getBuiltinModule(e)}return _(e)},{readdirSync:h,lstatSync:$,rmSync:b}=R("node:fs"),j=e=>{const r=[],t=[e];for(;t.length>0;){const o=t.pop();let i;try{i=h(o)}catch{continue}for(const l of i){const s=m(o,l);try{const n=$(s);if(n.isSymbolicLink()||!n.isDirectory())continue}catch{continue}l==="node_modules"?r.push(s):l!==".git"&&l!==".hg"&&t.push(s)}}return r},w=["pnpm-lock.yaml","package-lock.json","npm-shrinkwrap.json","yarn.lock","bun.lock","bun.lockb"],D=(e,r,t)=>{let o=0,i=!1;for(const l of w){const s=m(e,l);if(P(s)){t.info(` ${s}`),o++;continue}}return{hadError:i,removed:o}},L=new Set([".cache",".turbo","dist","node_modules"]),k=e=>{for(const r of h(e,{withFileTypes:!0})){const t=m(e,r.name);if(!r.isDirectory())return t;if(!L.has(r.name)){const o=k(t);if(o!==void 0)return o}}},y=(e,r,t)=>{let o=0,i=!1;for(const{packageDir:l}of S(e)){const s=m(e,l);let n;try{n=k(s)}catch(a){c.error(`${s}: ${p(a)}`),i=!0;continue}if(n!==void 0){c.warn(`Skipping ${s}: not empty (contains ${n})`);continue}if(r){t.info(` ${s}`),o++;continue}try{b(s,{force:!0,recursive:!0}),c.success(`Removed empty package ${s}`),o++}catch(a){c.error(`${s}: ${p(a)}`),i=!0}}return{hadError:i,removed:o}},x=async({logger:e,options:r,workspaceRoot:t})=>{const o=t??process.cwd(),i=r.lockfile||!1,l=r.emptyPackages||!1;if(r.dryRun||!1){const f=j(o);if(f.length>0){c.info("Would remove:");for(const d of f)e.info(` ${d}`)}else c.info("No node_modules directories found.");i&&D(o,!0,e),l&&(c.info("Would remove empty packages:"),y(o,!0,e));return}const n=E(o,i);for(const f of n.removed)c.success(`Removed ${f}`);for(const f of n.lockfilesRemoved)c.success(`Removed ${f}`);for(const f of n.errors)c.error(f);n.removed.length===0&&n.lockfilesRemoved.length===0?c.info("No node_modules directories found."):c.info(`Cleaned ${n.removed.length} node_modules director${n.removed.length===1?"y":"ies"}`);let a=!1;if(l){const{hadError:f,removed:d}=y(o,!1,e);a=f,d>0&&c.info(`Cleaned ${d} empty package director${d===1?"y":"ies"}`)}(n.errors.length>0||a)&&(process.exitCode=1)};export{x as default};
1
+ import{createRequire as v}from"node:module";import{e as m}from"../packem_shared/index-0dnGN3GP.js";import{cleanWorkspace as E}from"#native";import{l as S}from"../packem_shared/missing-package-json-CEEPXqYi.js";import{p as c}from"./cli-main.js";import{e as p}from"../packem_shared/utils-DQFHJn72.js";import{y as P}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";let g;const _=e=>(g??=v(import.meta.url))(e),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,t]=u.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return u.getBuiltinModule(e)}return _(e)},{readdirSync:h,lstatSync:$,rmSync:b}=R("node:fs"),j=e=>{const r=[],t=[e];for(;t.length>0;){const o=t.pop();let i;try{i=h(o)}catch{continue}for(const l of i){const s=m(o,l);try{const n=$(s);if(n.isSymbolicLink()||!n.isDirectory())continue}catch{continue}l==="node_modules"?r.push(s):l!==".git"&&l!==".hg"&&t.push(s)}}return r},w=["pnpm-lock.yaml","package-lock.json","npm-shrinkwrap.json","yarn.lock","bun.lock","bun.lockb"],D=(e,r,t)=>{let o=0,i=!1;for(const l of w){const s=m(e,l);if(P(s)){t.info(` ${s}`),o++;continue}}return{hadError:i,removed:o}},L=new Set([".cache",".turbo","dist","node_modules"]),k=e=>{for(const r of h(e,{withFileTypes:!0})){const t=m(e,r.name);if(!r.isDirectory())return t;if(!L.has(r.name)){const o=k(t);if(o!==void 0)return o}}},y=(e,r,t)=>{let o=0,i=!1;for(const{packageDir:l}of S(e)){const s=m(e,l);let n;try{n=k(s)}catch(a){c.error(`${s}: ${p(a)}`),i=!0;continue}if(n!==void 0){c.warn(`Skipping ${s}: not empty (contains ${n})`);continue}if(r){t.info(` ${s}`),o++;continue}try{b(s,{force:!0,recursive:!0}),c.success(`Removed empty package ${s}`),o++}catch(a){c.error(`${s}: ${p(a)}`),i=!0}}return{hadError:i,removed:o}},x=async({logger:e,options:r,workspaceRoot:t})=>{const o=t??process.cwd(),i=r.lockfile||!1,l=r.emptyPackages||!1;if(r.dryRun||!1){const f=j(o);if(f.length>0){c.info("Would remove:");for(const d of f)e.info(` ${d}`)}else c.info("No node_modules directories found.");i&&D(o,!0,e),l&&(c.info("Would remove empty packages:"),y(o,!0,e));return}const n=E(o,i);for(const f of n.removed)c.success(`Removed ${f}`);for(const f of n.lockfilesRemoved)c.success(`Removed ${f}`);for(const f of n.errors)c.error(f);n.removed.length===0&&n.lockfilesRemoved.length===0?c.info("No node_modules directories found."):c.info(`Cleaned ${n.removed.length} node_modules director${n.removed.length===1?"y":"ies"}`);let a=!1;if(l){const{hadError:f,removed:d}=y(o,!1,e);a=f,d>0&&c.info(`Cleaned ${d} empty package director${d===1?"y":"ies"}`)}(n.errors.length>0||a)&&(process.exitCode=1)};export{x as default};
@@ -1 +1 @@
1
- import{a as l,e as d}from"../packem_shared/pm-runner-RM72mDZg.js";import{r as m,a as p}from"../packem_shared/command-runtime-HSsYGCQd.js";const i=async({logger:s,options:a,visConfig:e,workspaceRoot:n})=>{const c=n??process.cwd(),r=m({options:a,visConfig:e},c),t=l(c,{backend:p(r),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),o=d(t,a.check||!1,c,s);o!==0&&(process.exitCode=o)};export{i as default};
1
+ import{a as l,e as d}from"../packem_shared/pm-runner-Dboj-wZG.js";import{r as m,a as p}from"../packem_shared/command-runtime-DG49t2MT.js";const i=async({logger:s,options:a,visConfig:e,workspaceRoot:n})=>{const c=n??process.cwd(),r=m({options:a,visConfig:e},c),t=l(c,{backend:p(r),configBackend:e?.install?.backend,configCorepack:e?.install?.corepack}),o=d(t,a.check||!1,c,s);o!==0&&(process.exitCode=o)};export{i as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as L}from"node:module";import{U as G,a as H}from"../packem_shared/index-BzhrR_iC.js";import{d as U,f as F,p as S,v as P,a as D}from"./heal.js";import{d as j,c as V}from"../packem_shared/pm-runner-RM72mDZg.js";import{p as s}from"./cli-main.js";let N;const O=t=>(N??=L(import.meta.url))(t),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,o]=I.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return I.getBuiltinModule(t)}return O(t)},{readFile:x}=B("node:fs/promises"),{createInterface:K}=B("node:readline"),M=()=>!!process.stdout.isTTY&&process.env.CI!=="true",q=t=>new Promise(e=>{const o=K({input:process.stdin,output:process.stderr});o.question(`${t} (Y/n) `,a=>{o.close();const i=a.trim().toLowerCase();e(i===""||i==="y"||i==="yes")})}),Y=(t,e)=>{const o=j(e),a=V(o,{exact:!1,filter:[],global:!1,optional:!1,packages:[t],peer:!1,saveDev:!1,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:a})},$=t=>`pnpm add ${t}`,J=t=>t==="@gitbeaker/rest"?import("@gitbeaker/rest"):import("@octokit/rest"),A=async(t,e={})=>{const o=e.interactive??M(),a=e.prompt??q,i=e.runInstall??Y,c=e.importImpl??J,d=e.workspaceRoot??process.cwd();try{return await c(t)}catch(u){const{code:m}=u;if(m!=="ERR_MODULE_NOT_FOUND"&&m!=="MODULE_NOT_FOUND")throw u}if(!o)throw new Error(`${t} is not installed. \`vis ai heal accept\` needs it to talk to the host. Install it in your repo first:
1
+ import{createRequire as L}from"node:module";import{U as G,a as H}from"../packem_shared/index-0dnGN3GP.js";import{d as U,f as F,p as S,v as P,a as D}from"./heal.js";import{d as j,c as V}from"../packem_shared/pm-runner-Dboj-wZG.js";import{p as s}from"./cli-main.js";let N;const O=t=>(N??=L(import.meta.url))(t),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,o]=I.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return I.getBuiltinModule(t)}return O(t)},{readFile:x}=B("node:fs/promises"),{createInterface:K}=B("node:readline"),M=()=>!!process.stdout.isTTY&&process.env.CI!=="true",q=t=>new Promise(e=>{const o=K({input:process.stdin,output:process.stderr});o.question(`${t} (Y/n) `,a=>{o.close();const i=a.trim().toLowerCase();e(i===""||i==="y"||i==="yes")})}),Y=(t,e)=>{const o=j(e),a=V(o,{exact:!1,filter:[],global:!1,optional:!1,packages:[t],peer:!1,saveDev:!1,workspace:!1,workspaceRoot:!1},e,console);return Promise.resolve({exitCode:a})},$=t=>`pnpm add ${t}`,J=t=>t==="@gitbeaker/rest"?import("@gitbeaker/rest"):import("@octokit/rest"),A=async(t,e={})=>{const o=e.interactive??M(),a=e.prompt??q,i=e.runInstall??Y,c=e.importImpl??J,d=e.workspaceRoot??process.cwd();try{return await c(t)}catch(u){const{code:m}=u;if(m!=="ERR_MODULE_NOT_FOUND"&&m!=="MODULE_NOT_FOUND")throw u}if(!o)throw new Error(`${t} is not installed. \`vis ai heal accept\` needs it to talk to the host. Install it in your repo first:
2
2
  ${$(t)}`);if(!await a(`${t} isn't installed. Install it now?`))throw new Error(`${t} install declined. Re-run \`vis ai heal accept\` after installing manually:
3
3
  ${$(t)}`);const n=await i(t,d);if(n.exitCode!==0)throw new Error(`Install of ${t} failed (exit ${String(n.exitCode)}). Install manually and retry:
4
4
  ${$(t)}`);return await c(t)},W=t=>{const e=t.indexOf("/");if(e<=0||e===t.length-1)throw new Error(`Expected GITHUB_REPOSITORY in "owner/repo" form, got: ${t}`);return{owner:t.slice(0,e),repo:t.slice(e+1)}},z=async(t,e)=>{if(e.githubClient)return e.githubClient;const i=(await(e.loadSdk??A)("@octokit/rest")).Octokit;if(!i)throw new TypeError("Loaded `@octokit/rest` but no `Octokit` export was found. Reinstall the package or pin to a supported major.");return new i({auth:t})},X=async(t,e,o)=>{if(o.gitlabClient)return o.gitlabClient;const c=(await(o.loadSdk??A)("@gitbeaker/rest")).Gitlab;if(!c)throw new TypeError("Loaded `@gitbeaker/rest` but no `Gitlab` export was found. Reinstall the package or pin to a supported major.");return new c({host:e,token:t})},Q=t=>t.replace(/\/api\/v\d+\/?$/,""),Z=async t=>{const{branch:e,ciContext:o,files:a,message:i,workspaceRoot:c}=t,d=t.readFile??(_=>x(_,"utf8"));if(!o.repo)throw new Error("Cannot commit on GitHub: GITHUB_REPOSITORY (owner/repo) is not set.");if(!o.token)throw new Error("Cannot commit on GitHub: GITHUB_TOKEN is not set. Grant the workflow `contents: write` and pass the token through.");const{owner:r,repo:n}=W(o.repo),u=await z(o.token,t),f=(await u.rest.git.getRef({owner:r,ref:`heads/${e}`,repo:n})).data.object.sha,g=(await u.rest.git.getCommit({commit_sha:f,owner:r,repo:n})).data.tree.sha,h=await Promise.all(a.map(async _=>{const T=G(c,_),w=await d(T),R=await u.rest.git.createBlob({content:Buffer.from(w,"utf8").toString("base64"),encoding:"base64",owner:r,repo:n});return{mode:"100644",path:_,sha:R.data.sha,type:"blob"}})),C=await u.rest.git.createTree({base_tree:g,owner:r,repo:n,tree:h}),b=await u.rest.git.createCommit({message:i,owner:r,parents:[f],repo:n,tree:C.data.sha});return await u.rest.git.updateRef({owner:r,ref:`heads/${e}`,repo:n,sha:b.data.sha}),{sha:b.data.sha,url:b.data.html_url}},tt=async t=>{const{branch:e,ciContext:o,files:a,message:i,workspaceRoot:c}=t,d=t.readFile??(p=>x(p,"utf8"));if(!o.repo)throw new Error("Cannot commit on GitLab: CI_PROJECT_ID / CI_PROJECT_PATH is not set.");if(!o.token)throw new Error("Cannot commit on GitLab: no token. CI_JOB_TOKEN cannot push commits — set GITLAB_TOKEN to a PAT/project-token with `api` scope.");if(!o.apiBaseUrl)throw new Error("Cannot commit on GitLab: CI_API_V4_URL is not set.");const r=Q(o.apiBaseUrl),n=await X(o.token,r,t),u=await Promise.all(a.map(async p=>{const g=G(c,p);return{action:"update",content:await d(g),filePath:p}})),m=await n.Commits.create(o.repo,e,i,u),f=m.id??m.sha;if(!f)throw new Error("GitLab Commits.create returned no commit ID — cannot reference the new commit.");return{sha:f,url:m.web_url??m.webUrl}},et=async t=>{if(t.files.length===0)throw new Error("Cannot commit: no files to include.");if(t.ciContext.provider==="github-actions")return await Z(t);if(t.ciContext.provider==="gitlab-ci")return await tt(t);throw new Error(`Cannot commit: unsupported CI provider \`${t.ciContext.provider}\`. Run \`vis ai heal accept\` from a recognised CI environment.`)},y="/vis heal accept",ot=async t=>{if(!t)return;let e;try{e=await x(t,"utf8")}catch{return}const o=JSON.parse(e),a=o.comment?.body??"",i=o.comment?.user?.login??"",c=o.pull_request?.head?.repo?.full_name,d=o.pull_request?.base?.repo?.full_name??o.repository?.full_name,r=c!==void 0&&d!==void 0&&c!==d;return{actor:i,body:a,headRef:o.pull_request?.head?.ref,isFork:r}},rt=t=>{const e=t.VIS_HEAL_TRIGGER_BODY,o=t.VIS_HEAL_TRIGGER_ACTOR;if(!(!e||!o))return{actor:o,body:e,headRef:t.VIS_HEAL_HEAD_REF,isFork:!1}},it=t=>{const e=t.BUILDKITE_UNBLOCKER_EMAIL??t.BUILDKITE_UNBLOCKER;if(e)return{actor:e,body:y,headRef:t.BUILDKITE_BRANCH,isFork:!1}},at=async(t,e)=>{if(t.provider==="github-actions")return await ot(e.GITHUB_EVENT_PATH);if(t.provider==="gitlab-ci")return rt(e);if(t.provider==="buildkite")return it(e)},nt=(t,e)=>{const o=e.BUILDKITE_REPO;if(!o)return;const a=/(?:^|@|\/\/)github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?\/?$/i.exec(o);if(a&&e.GITHUB_TOKEN)return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t.prNumber,provider:"github-actions",repo:`${a[1]}/${a[2]}`,sha:t.sha,token:e.GITHUB_TOKEN};const i=/\/\/([^/]*gitlab[^/]*)\/([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(o),c=i?null:/@([^/:]*gitlab[^/:]*):([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(o),d=i??c;if(d&&e.GITLAB_TOKEN){const r=d[1];return{apiBaseUrl:e.CI_API_V4_URL??`https://${r}/api/v4`,buildId:void 0,buildNumber:void 0,prNumber:t.prNumber,provider:"gitlab-ci",repo:`${d[2]}/${d[3]}`,sha:t.sha,token:e.GITLAB_TOKEN}}},st=async t=>{const e=t.fetchImpl??globalThis.fetch,a=`${(t.apiBaseUrl??"https://api.github.com").replace(/\/+$/,"")}/repos/${t.repo}/pulls/${String(t.prNumber)}`;try{const i=await e(a,{headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${t.token}`,"X-GitHub-Api-Version":"2022-11-28"}});return i.ok?(await i.json()).head?.ref:void 0}catch{return}},ct=(t,e,o,a)=>{const i=e.map(c=>`- \`${c}\``).join(`
@@ -1,4 +1,4 @@
1
- import{createRequire as E}from"node:module";import{b as U,j as x,F as g,X as A,J as L}from"../packem_shared/index.server-Ca_EEVfw.js";import{a as O}from"../packem_shared/index-BzhrR_iC.js";import{readLastRunSummary as G}from"@visulima/task-runner";import{a as j,r as F,b as D,c as K}from"../packem_shared/ai-fix-DIMErSws.js";import{p}from"./cli-main.js";import{r as H}from"../packem_shared/run-summary-utils-CMeURYtS.js";let B;const P=e=>(B??=E(import.meta.url))(e),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,o]=m.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return m.getBuiltinModule(e)}return P(e)},{spawn:h}=I("node:child_process"),{readFile:M}=I("node:fs/promises"),V=e=>{if(!e)return;const t=/^refs\/pull\/(\d+)\//.exec(e);return t?Number.parseInt(t[1],10):void 0},J=async e=>{if(!e)return{prNumber:void 0,sha:void 0};try{const t=await M(e,"utf8"),o=JSON.parse(t),r=o.pull_request?.number??o.issue?.number??o.number,s=o.pull_request?.head?.sha;return{prNumber:r,sha:s}}catch{return{prNumber:void 0,sha:void 0}}},q=async e=>{const t=V(e.GITHUB_REF),{prNumber:o,sha:r}=t===void 0?await J(e.GITHUB_EVENT_PATH):{prNumber:t,sha:void 0};return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t??o,provider:"github-actions",repo:e.GITHUB_REPOSITORY,sha:r??e.GITHUB_SHA,token:e.GITHUB_TOKEN}},z=e=>{const t=e.CI_MERGE_REQUEST_IID,o=t!==void 0&&t!==""?Number.parseInt(t,10):void 0,r=e.CI_API_V4_URL,s=e.GITLAB_TOKEN??e.CI_TOKEN;return{apiBaseUrl:r,buildId:void 0,buildNumber:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"gitlab-ci",repo:e.CI_PROJECT_ID??e.CI_PROJECT_PATH,sha:e.CI_COMMIT_SHA,token:s}},X=e=>{const t=e.BUILDKITE_PULL_REQUEST,o=t!==void 0&&t!==""&&t!=="false"?Number.parseInt(t,10):void 0,r=e.BUILDKITE_BUILD_NUMBER,s=r!==void 0&&r!==""?Number.parseInt(r,10):void 0,n=e.BUILDKITE_ORGANIZATION_SLUG,i=e.BUILDKITE_PIPELINE_SLUG,a=n!==void 0&&n!==""&&i!==void 0&&i!==""?`${n}/${i}`:void 0;return{apiBaseUrl:(e.BUILDKITE_API_BASE_URL??"https://api.buildkite.com").replace(/\/+$/,""),buildId:e.BUILDKITE_BUILD_ID,buildNumber:Number.isFinite(s)?s:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"buildkite",repo:a,sha:e.BUILDKITE_COMMIT,token:e.BUILDKITE_API_TOKEN}},Y=async(e=process.env)=>e.GITHUB_ACTIONS==="true"?await q(e):e.GITLAB_CI==="true"?z(e):e.BUILDKITE==="true"?X(e):{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:void 0,provider:"unknown",repo:void 0,sha:void 0,token:void 0},Q=(e,t,o,r)=>new Promise(s=>{const n=["pr","comment",String(t),"--body-file","-"];r&&n.push("--repo",r);const i=h(e,n,{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(o)}),Z=async(e,t,o,r,s)=>{const n=`https://api.github.com/repos/${t}/issues/${String(o)}/comments`;try{const i=await e(n,{body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${s}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"},method:"POST"});if(!i.ok){const a=await i.text().catch(()=>"");return{error:`GitHub REST returned ${String(i.status)}: ${a.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(i){return{error:i instanceof Error?i.message:String(i),ok:!1}}},W=async(e,t,o,r,s,n)=>{const i=encodeURIComponent(o),a=`${t.replace(/\/+$/,"")}/projects/${i}/merge_requests/${String(r)}/notes`;try{const d=await e(a,{body:JSON.stringify({body:s}),headers:{"Content-Type":"application/json","PRIVATE-TOKEN":n},method:"POST"});if(!d.ok){const c=await d.text().catch(()=>"");return{error:`GitLab REST returned ${String(d.status)}: ${c.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(d){return{error:d instanceof Error?d.message:String(d),ok:!1}}},tt=(e,t,o,r)=>new Promise(s=>{const i=h(e,["annotate","--style",o,"--context",r],{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(t)}),et=async(e,t,o,r,s,n,i,a)=>{const[d,c]=o.split("/",2);if(!d||!c)return{error:`Buildkite repo identifier \`${o}\` is not in {org}/{pipeline} form.`,ok:!1};const f=`${t}/v2/organizations/${encodeURIComponent(d)}/pipelines/${encodeURIComponent(c)}/builds/${String(r)}/annotations`;try{const u=await e(f,{body:JSON.stringify({body:s,context:i,style:n}),headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"},method:"POST"});if(!u.ok){const l=await u.text().catch(()=>"");return{error:`Buildkite REST returned ${String(u.status)}: ${l.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(u){return{error:u instanceof Error?u.message:String(u),ok:!1}}},ot=async(e,t,o,r)=>{const s=t.buildId?`vis-ai-heal-${t.buildId}`:"vis-ai-heal",n="info",i=await tt(o,e,n,s);if(i.exitCode===0)return{method:"buildkite-cli",posted:!0};if(!t.apiBaseUrl||!t.repo||t.buildNumber===void 0||!t.token){const d=[];return t.repo||d.push("BUILDKITE_ORGANIZATION_SLUG / BUILDKITE_PIPELINE_SLUG"),t.buildNumber===void 0&&d.push("BUILDKITE_BUILD_NUMBER"),t.token||d.push("BUILDKITE_API_TOKEN (with `write_build_annotations` scope)"),{error:`buildkite-agent annotate exited ${String(i.exitCode)} (${i.stderr.trim().slice(0,200)}); cannot fall back to REST without ${d.join(", ")}`,method:"buildkite-cli",posted:!1}}const a=await et(r,t.apiBaseUrl,t.repo,t.buildNumber,e,n,s,t.token);return a.ok?{method:"rest",posted:!0}:{error:`buildkite-agent annotate exited ${String(i.exitCode)}; REST fallback also failed: ${a.error??"unknown"}`,method:"rest",posted:!1}},rt=async(e,t,o,r)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};const s=await Q(o,t.prNumber,e,t.repo);if(s.exitCode===0)return{method:"gh-cli",posted:!0};if(!t.repo||!t.token)return{error:`gh exited ${String(s.exitCode)} (${s.stderr.trim().slice(0,200)}); cannot fall back to REST without GITHUB_REPOSITORY + GITHUB_TOKEN`,method:"gh-cli",posted:!1};const n=await Z(r,t.repo,t.prNumber,e,t.token);return n.ok?{method:"rest",posted:!0}:{error:`gh exited ${String(s.exitCode)}; REST fallback also failed: ${n.error??"unknown"}`,method:"rest",posted:!1}},it=async(e,t,o)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};if(!t.apiBaseUrl||!t.repo)return{error:"GitLab CI context is missing CI_API_V4_URL or CI_PROJECT_ID; cannot post note.",method:"rest",posted:!1};if(!t.token)return{error:"GitLab CI context has no token. CI_JOB_TOKEN cannot post MR notes — set GITLAB_TOKEN to a personal/project access token with `api` scope.",method:"rest",posted:!1};const r=await W(o,t.apiBaseUrl,t.repo,t.prNumber,e,t.token);return r.ok?{method:"rest",posted:!0}:{error:r.error,method:"rest",posted:!1}},nt=async e=>{const{body:t,buildkiteAgentBin:o="buildkite-agent",context:r,fetchImpl:s=globalThis.fetch,ghBin:n="gh"}=e;return r.provider==="github-actions"?await rt(t,r,n,s):r.provider==="gitlab-ci"?await it(t,r,s):r.provider==="buildkite"?await ot(t,r,o,s):{method:"skipped",posted:!1}},b=e=>{let t=0,o=0;for(const r of e)r.status==="applied"?t+=1:o+=1;return{applied:t,failed:o}},k=(e,t,o)=>{const r=K(e,t,o),s=O(e,r);return s===""||s.startsWith("..")?r:s},st=(e,t,o,r)=>new Promise(s=>{const n=process.argv[1];if(!n){s({exitCode:-1,stderr:"Cannot locate vis bin (process.argv[1] missing).",stdout:""});return}const i=[n,"run",o,"--projects",t,"--no-cache","--summarize","--fail-fast"],a=h(process.execPath,i,{cwd:e,env:{...process.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]});let d="",c="";const f=setTimeout(()=>{a.kill("SIGTERM"),setTimeout(()=>a.kill("SIGKILL"),2e3).unref()},r);a.stdout?.setEncoding("utf8"),a.stdout?.on("data",u=>{d+=u}),a.stderr?.setEncoding("utf8"),a.stderr?.on("data",u=>{c+=u}),a.once("error",u=>{clearTimeout(f),s({exitCode:-1,stderr:u.message,stdout:d})}),a.once("close",u=>{clearTimeout(f),s({exitCode:u??-1,stderr:c,stdout:d})})}),at=6e4,T=e=>{let t=0;const o=e.match(/`{3,}/g);if(o)for(const r of o)t=Math.max(t,r.length);return"`".repeat(Math.max(3,t+1))},_=(e,t,o)=>{if(e.patches.length===0)return"_No patches proposed._";const r=[];for(const[s,n]of e.patches.entries()){const i=k(t,o,n.file),a=[`**[${String(s+1)}] \`${i}\`**`];n.reason&&a.push(`_${n.reason}_`);const d=T(`${n.oldString}
1
+ import{createRequire as E}from"node:module";import{b as U,j as x,F as g,X as A,J as L}from"../packem_shared/index.server-Ca_EEVfw.js";import{a as O}from"../packem_shared/index-0dnGN3GP.js";import{readLastRunSummary as G}from"@visulima/task-runner";import{a as j,r as F,b as D,c as K}from"../packem_shared/ai-fix-C0OBhGDq.js";import{p}from"./cli-main.js";import{r as H}from"../packem_shared/run-summary-utils-DbyeUM6f.js";let B;const P=e=>(B??=E(import.meta.url))(e),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[t,o]=m.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return m.getBuiltinModule(e)}return P(e)},{spawn:h}=I("node:child_process"),{readFile:M}=I("node:fs/promises"),V=e=>{if(!e)return;const t=/^refs\/pull\/(\d+)\//.exec(e);return t?Number.parseInt(t[1],10):void 0},J=async e=>{if(!e)return{prNumber:void 0,sha:void 0};try{const t=await M(e,"utf8"),o=JSON.parse(t),r=o.pull_request?.number??o.issue?.number??o.number,s=o.pull_request?.head?.sha;return{prNumber:r,sha:s}}catch{return{prNumber:void 0,sha:void 0}}},q=async e=>{const t=V(e.GITHUB_REF),{prNumber:o,sha:r}=t===void 0?await J(e.GITHUB_EVENT_PATH):{prNumber:t,sha:void 0};return{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:t??o,provider:"github-actions",repo:e.GITHUB_REPOSITORY,sha:r??e.GITHUB_SHA,token:e.GITHUB_TOKEN}},z=e=>{const t=e.CI_MERGE_REQUEST_IID,o=t!==void 0&&t!==""?Number.parseInt(t,10):void 0,r=e.CI_API_V4_URL,s=e.GITLAB_TOKEN??e.CI_TOKEN;return{apiBaseUrl:r,buildId:void 0,buildNumber:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"gitlab-ci",repo:e.CI_PROJECT_ID??e.CI_PROJECT_PATH,sha:e.CI_COMMIT_SHA,token:s}},X=e=>{const t=e.BUILDKITE_PULL_REQUEST,o=t!==void 0&&t!==""&&t!=="false"?Number.parseInt(t,10):void 0,r=e.BUILDKITE_BUILD_NUMBER,s=r!==void 0&&r!==""?Number.parseInt(r,10):void 0,n=e.BUILDKITE_ORGANIZATION_SLUG,i=e.BUILDKITE_PIPELINE_SLUG,a=n!==void 0&&n!==""&&i!==void 0&&i!==""?`${n}/${i}`:void 0;return{apiBaseUrl:(e.BUILDKITE_API_BASE_URL??"https://api.buildkite.com").replace(/\/+$/,""),buildId:e.BUILDKITE_BUILD_ID,buildNumber:Number.isFinite(s)?s:void 0,prNumber:Number.isFinite(o)?o:void 0,provider:"buildkite",repo:a,sha:e.BUILDKITE_COMMIT,token:e.BUILDKITE_API_TOKEN}},Y=async(e=process.env)=>e.GITHUB_ACTIONS==="true"?await q(e):e.GITLAB_CI==="true"?z(e):e.BUILDKITE==="true"?X(e):{apiBaseUrl:void 0,buildId:void 0,buildNumber:void 0,prNumber:void 0,provider:"unknown",repo:void 0,sha:void 0,token:void 0},Q=(e,t,o,r)=>new Promise(s=>{const n=["pr","comment",String(t),"--body-file","-"];r&&n.push("--repo",r);const i=h(e,n,{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(o)}),Z=async(e,t,o,r,s)=>{const n=`https://api.github.com/repos/${t}/issues/${String(o)}/comments`;try{const i=await e(n,{body:JSON.stringify({body:r}),headers:{Accept:"application/vnd.github+json",Authorization:`Bearer ${s}`,"Content-Type":"application/json","X-GitHub-Api-Version":"2022-11-28"},method:"POST"});if(!i.ok){const a=await i.text().catch(()=>"");return{error:`GitHub REST returned ${String(i.status)}: ${a.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(i){return{error:i instanceof Error?i.message:String(i),ok:!1}}},W=async(e,t,o,r,s,n)=>{const i=encodeURIComponent(o),a=`${t.replace(/\/+$/,"")}/projects/${i}/merge_requests/${String(r)}/notes`;try{const d=await e(a,{body:JSON.stringify({body:s}),headers:{"Content-Type":"application/json","PRIVATE-TOKEN":n},method:"POST"});if(!d.ok){const c=await d.text().catch(()=>"");return{error:`GitLab REST returned ${String(d.status)}: ${c.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(d){return{error:d instanceof Error?d.message:String(d),ok:!1}}},tt=(e,t,o,r)=>new Promise(s=>{const i=h(e,["annotate","--style",o,"--context",r],{stdio:["pipe","ignore","pipe"]});let a="";i.stderr?.setEncoding("utf8"),i.stderr?.on("data",d=>{a+=d}),i.once("error",()=>{s({exitCode:127,stderr:a})}),i.once("close",d=>{s({exitCode:d??-1,stderr:a})}),i.stdin?.on("error",()=>{}),i.stdin?.end(t)}),et=async(e,t,o,r,s,n,i,a)=>{const[d,c]=o.split("/",2);if(!d||!c)return{error:`Buildkite repo identifier \`${o}\` is not in {org}/{pipeline} form.`,ok:!1};const f=`${t}/v2/organizations/${encodeURIComponent(d)}/pipelines/${encodeURIComponent(c)}/builds/${String(r)}/annotations`;try{const u=await e(f,{body:JSON.stringify({body:s,context:i,style:n}),headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"},method:"POST"});if(!u.ok){const l=await u.text().catch(()=>"");return{error:`Buildkite REST returned ${String(u.status)}: ${l.slice(0,500)}`,ok:!1}}return{ok:!0}}catch(u){return{error:u instanceof Error?u.message:String(u),ok:!1}}},ot=async(e,t,o,r)=>{const s=t.buildId?`vis-ai-heal-${t.buildId}`:"vis-ai-heal",n="info",i=await tt(o,e,n,s);if(i.exitCode===0)return{method:"buildkite-cli",posted:!0};if(!t.apiBaseUrl||!t.repo||t.buildNumber===void 0||!t.token){const d=[];return t.repo||d.push("BUILDKITE_ORGANIZATION_SLUG / BUILDKITE_PIPELINE_SLUG"),t.buildNumber===void 0&&d.push("BUILDKITE_BUILD_NUMBER"),t.token||d.push("BUILDKITE_API_TOKEN (with `write_build_annotations` scope)"),{error:`buildkite-agent annotate exited ${String(i.exitCode)} (${i.stderr.trim().slice(0,200)}); cannot fall back to REST without ${d.join(", ")}`,method:"buildkite-cli",posted:!1}}const a=await et(r,t.apiBaseUrl,t.repo,t.buildNumber,e,n,s,t.token);return a.ok?{method:"rest",posted:!0}:{error:`buildkite-agent annotate exited ${String(i.exitCode)}; REST fallback also failed: ${a.error??"unknown"}`,method:"rest",posted:!1}},rt=async(e,t,o,r)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};const s=await Q(o,t.prNumber,e,t.repo);if(s.exitCode===0)return{method:"gh-cli",posted:!0};if(!t.repo||!t.token)return{error:`gh exited ${String(s.exitCode)} (${s.stderr.trim().slice(0,200)}); cannot fall back to REST without GITHUB_REPOSITORY + GITHUB_TOKEN`,method:"gh-cli",posted:!1};const n=await Z(r,t.repo,t.prNumber,e,t.token);return n.ok?{method:"rest",posted:!0}:{error:`gh exited ${String(s.exitCode)}; REST fallback also failed: ${n.error??"unknown"}`,method:"rest",posted:!1}},it=async(e,t,o)=>{if(t.prNumber===void 0)return{method:"skipped",posted:!1};if(!t.apiBaseUrl||!t.repo)return{error:"GitLab CI context is missing CI_API_V4_URL or CI_PROJECT_ID; cannot post note.",method:"rest",posted:!1};if(!t.token)return{error:"GitLab CI context has no token. CI_JOB_TOKEN cannot post MR notes — set GITLAB_TOKEN to a personal/project access token with `api` scope.",method:"rest",posted:!1};const r=await W(o,t.apiBaseUrl,t.repo,t.prNumber,e,t.token);return r.ok?{method:"rest",posted:!0}:{error:r.error,method:"rest",posted:!1}},nt=async e=>{const{body:t,buildkiteAgentBin:o="buildkite-agent",context:r,fetchImpl:s=globalThis.fetch,ghBin:n="gh"}=e;return r.provider==="github-actions"?await rt(t,r,n,s):r.provider==="gitlab-ci"?await it(t,r,s):r.provider==="buildkite"?await ot(t,r,o,s):{method:"skipped",posted:!1}},b=e=>{let t=0,o=0;for(const r of e)r.status==="applied"?t+=1:o+=1;return{applied:t,failed:o}},k=(e,t,o)=>{const r=K(e,t,o),s=O(e,r);return s===""||s.startsWith("..")?r:s},st=(e,t,o,r)=>new Promise(s=>{const n=process.argv[1];if(!n){s({exitCode:-1,stderr:"Cannot locate vis bin (process.argv[1] missing).",stdout:""});return}const i=[n,"run",o,"--projects",t,"--no-cache","--summarize","--fail-fast"],a=h(process.execPath,i,{cwd:e,env:{...process.env,NO_COLOR:"1"},stdio:["ignore","pipe","pipe"]});let d="",c="";const f=setTimeout(()=>{a.kill("SIGTERM"),setTimeout(()=>a.kill("SIGKILL"),2e3).unref()},r);a.stdout?.setEncoding("utf8"),a.stdout?.on("data",u=>{d+=u}),a.stderr?.setEncoding("utf8"),a.stderr?.on("data",u=>{c+=u}),a.once("error",u=>{clearTimeout(f),s({exitCode:-1,stderr:u.message,stdout:d})}),a.once("close",u=>{clearTimeout(f),s({exitCode:u??-1,stderr:c,stdout:d})})}),at=6e4,T=e=>{let t=0;const o=e.match(/`{3,}/g);if(o)for(const r of o)t=Math.max(t,r.length);return"`".repeat(Math.max(3,t+1))},_=(e,t,o)=>{if(e.patches.length===0)return"_No patches proposed._";const r=[];for(const[s,n]of e.patches.entries()){const i=k(t,o,n.file),a=[`**[${String(s+1)}] \`${i}\`**`];n.reason&&a.push(`_${n.reason}_`);const d=T(`${n.oldString}
2
2
  ${n.newString}`);a.push(`${d}diff`);for(const c of n.oldString.split(`
3
3
  `))a.push(`- ${c}`);for(const c of n.newString.split(`
4
4
  `))a.push(`+ ${c}`);a.push(d),r.push(a.join(`
@@ -1,4 +1,4 @@
1
- import{createRequire as At}from"node:module";import{Y as It,w as Wt,e as kt,j,P as b,q as x,J as N,b as L}from"../packem_shared/index.server-Ca_EEVfw.js";import{u as ut,c as B,e as Mt}from"../packem_shared/vis-user-error-3YS7sPYy.js";import{N as R,a as _}from"../packem_shared/Table-Bo1JKNCN-CGGet8ES.js";import{t as Ct}from"../packem_shared/package-version-Bq6Cne_7.js";let Ot;const xt=t=>(Ot??=At(import.meta.url))(t),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Et=t=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[e,n]=E.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return E.getBuiltinModule(t)}return xt(t)},{createRequire:Bt}=Et("node:module"),jt=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,z=t=>{let[,e]=jt.exec(t)??[];const n=e?e.length:0;if(n===3){const s=e.charAt(0),o=e.charAt(1),i=e.charAt(2);e=s+s+o+o+i+i}else if(n!==6)return globalThis.process?.env?.NODE_ENV!=="production"&&console.warn(`[@visulima/colorize] Invalid hex color "${t}"; expected a 3- or 6-digit hex string (e.g. "#96C" or "#E0115F"). Falling back to black.`),[0,0,0];const r=Number.parseInt(e,16);return[r>>16&255,r>>8&255,r&255]},dt=(t,e,n)=>t===e&&e===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(n/51),H=t=>{let e,n,r;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=n=r=((t-232)*10+8)/255;else{t-=16;const i=t%36;e=Math.floor(t/36)/5,n=Math.floor(i/6)/5,r=i%6/5}const s=Math.max(e,n,r)*2;if(s===0)return 30;const o=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(e));return s===2?o+60:o},Z=(t,e,n)=>H(dt(t,e,n));function Rt({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}const S=(t,e,n)=>e>t?e:Math.min(t,n),m=39,f=49,X=10,tt={close:"",open:""},ht=t=>{const e=t>0?(l,d)=>({close:`\x1B[${String(d)}m`,open:`\x1B[${String(l)}m`}):()=>tt,n=l=>(d,p,g)=>l(dt(Number(d),Number(p),Number(g))),r=l=>d=>{const[p,g,w]=z(d);return l(p,g,w)};let s=l=>e(`38;5;${String(l)}`,m),o=l=>e(`48;5;${String(l)}`,f),i=(l,d,p)=>e(`38;2;${String(l)};${String(d)};${String(p)}`,m),a=(l,d,p)=>e(`48;2;${String(l)};${String(d)};${String(p)}`,f);t===1?(s=l=>e(H(Number(l)),m),o=l=>e(H(Number(l))+X,f),i=(l,d,p)=>e(Z(Number(l),Number(d),Number(p)),m),a=(l,d,p)=>e(Z(Number(l),Number(d),Number(p))+X,f)):t===2&&(i=n(s),a=n(o));const u={bold:e(1,22),dim:e(2,22),hidden:e(8,28),inverse:e(7,27),italic:e(3,23),overline:e(53,55),reset:e(0,0),strike:e(9,29),strikethrough:e(9,29),underline:e(4,24),underlineCurly:e("4:3",24),underlineDashed:e("4:5",24),underlineDotted:e("4:4",24),underlineDouble:e("4:2",24),visible:tt},c={bgBlack:e(40,f),bgBlackBright:e(100,f),bgBlue:e(44,f),bgBlueBright:e(104,f),bgCyan:e(46,f),bgCyanBright:e(106,f),bgGray:e(100,f),bgGreen:e(42,f),bgGreenBright:e(102,f),bgGrey:e(100,f),bgMagenta:e(45,f),bgMagentaBright:e(105,f),bgRed:e(41,f),bgRedBright:e(101,f),bgWhite:e(47,f),bgWhiteBright:e(107,f),bgYellow:e(43,f),bgYellowBright:e(103,f),black:e(30,m),blackBright:e(90,m),blue:e(34,m),blueBright:e(94,m),cyan:e(36,m),cyanBright:e(96,m),gray:e(90,m),green:e(32,m),greenBright:e(92,m),grey:e(90,m),magenta:e(35,m),magentaBright:e(95,m),red:e(31,m),redBright:e(91,m),white:e(37,m),whiteBright:e(97,m),yellow:e(33,m),yellowBright:e(93,m)},h={bg:l=>o(S(l,0,255)),bgHex:r(a),bgRgb:(l,d,p)=>a(S(l,0,255),S(d,0,255),S(p,0,255)),fg:l=>s(S(l,0,255)),hex:r(i),rgb:(l,d,p)=>i(S(l,0,255),S(d,0,255),S(p,0,255))};return{baseColors:c,baseStyles:u,styleMethods:h}},pt=It();Wt();ht(pt);const _t=(t,e,n)=>{if(e==="")return t;let r=t.indexOf(e);if(r<0)return t;const s=e.length;let o=0,i="";for(;~r;)i+=t.slice(o,r)+n,o=r+s,r=t.indexOf(e,o);return i+t.slice(o)},Pt=(t,e,n)=>{if(t==null||t==="")return"";let r;if(t.raw===void 0?r=String(t):r=String.raw(t,...e),r.includes("\x1B"))for(let s=n;s;s=s.props)r=_t(r,s.close,s.open);return r.includes(`
1
+ import{createRequire as At}from"node:module";import{Y as It,w as Wt,e as kt,j,P as b,q as x,J as N,b as L}from"../packem_shared/index.server-Ca_EEVfw.js";import{u as ut,c as B,e as Mt}from"../packem_shared/vis-user-error-BivZDkQD.js";import{N as R,a as _}from"../packem_shared/Table-Bo1JKNCN-CGGet8ES.js";import{t as Ct}from"../packem_shared/package-version-x7sPg2TM.js";let Ot;const xt=t=>(Ot??=At(import.meta.url))(t),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Et=t=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[e,n]=E.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return E.getBuiltinModule(t)}return xt(t)},{createRequire:Bt}=Et("node:module"),jt=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,z=t=>{let[,e]=jt.exec(t)??[];const n=e?e.length:0;if(n===3){const s=e.charAt(0),o=e.charAt(1),i=e.charAt(2);e=s+s+o+o+i+i}else if(n!==6)return globalThis.process?.env?.NODE_ENV!=="production"&&console.warn(`[@visulima/colorize] Invalid hex color "${t}"; expected a 3- or 6-digit hex string (e.g. "#96C" or "#E0115F"). Falling back to black.`),[0,0,0];const r=Number.parseInt(e,16);return[r>>16&255,r>>8&255,r&255]},dt=(t,e,n)=>t===e&&e===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(n/51),H=t=>{let e,n,r;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=n=r=((t-232)*10+8)/255;else{t-=16;const i=t%36;e=Math.floor(t/36)/5,n=Math.floor(i/6)/5,r=i%6/5}const s=Math.max(e,n,r)*2;if(s===0)return 30;const o=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(e));return s===2?o+60:o},Z=(t,e,n)=>H(dt(t,e,n));function Rt({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}const S=(t,e,n)=>e>t?e:Math.min(t,n),m=39,f=49,X=10,tt={close:"",open:""},ht=t=>{const e=t>0?(l,d)=>({close:`\x1B[${String(d)}m`,open:`\x1B[${String(l)}m`}):()=>tt,n=l=>(d,p,g)=>l(dt(Number(d),Number(p),Number(g))),r=l=>d=>{const[p,g,w]=z(d);return l(p,g,w)};let s=l=>e(`38;5;${String(l)}`,m),o=l=>e(`48;5;${String(l)}`,f),i=(l,d,p)=>e(`38;2;${String(l)};${String(d)};${String(p)}`,m),a=(l,d,p)=>e(`48;2;${String(l)};${String(d)};${String(p)}`,f);t===1?(s=l=>e(H(Number(l)),m),o=l=>e(H(Number(l))+X,f),i=(l,d,p)=>e(Z(Number(l),Number(d),Number(p)),m),a=(l,d,p)=>e(Z(Number(l),Number(d),Number(p))+X,f)):t===2&&(i=n(s),a=n(o));const u={bold:e(1,22),dim:e(2,22),hidden:e(8,28),inverse:e(7,27),italic:e(3,23),overline:e(53,55),reset:e(0,0),strike:e(9,29),strikethrough:e(9,29),underline:e(4,24),underlineCurly:e("4:3",24),underlineDashed:e("4:5",24),underlineDotted:e("4:4",24),underlineDouble:e("4:2",24),visible:tt},c={bgBlack:e(40,f),bgBlackBright:e(100,f),bgBlue:e(44,f),bgBlueBright:e(104,f),bgCyan:e(46,f),bgCyanBright:e(106,f),bgGray:e(100,f),bgGreen:e(42,f),bgGreenBright:e(102,f),bgGrey:e(100,f),bgMagenta:e(45,f),bgMagentaBright:e(105,f),bgRed:e(41,f),bgRedBright:e(101,f),bgWhite:e(47,f),bgWhiteBright:e(107,f),bgYellow:e(43,f),bgYellowBright:e(103,f),black:e(30,m),blackBright:e(90,m),blue:e(34,m),blueBright:e(94,m),cyan:e(36,m),cyanBright:e(96,m),gray:e(90,m),green:e(32,m),greenBright:e(92,m),grey:e(90,m),magenta:e(35,m),magentaBright:e(95,m),red:e(31,m),redBright:e(91,m),white:e(37,m),whiteBright:e(97,m),yellow:e(33,m),yellowBright:e(93,m)},h={bg:l=>o(S(l,0,255)),bgHex:r(a),bgRgb:(l,d,p)=>a(S(l,0,255),S(d,0,255),S(p,0,255)),fg:l=>s(S(l,0,255)),hex:r(i),rgb:(l,d,p)=>i(S(l,0,255),S(d,0,255),S(p,0,255))};return{baseColors:c,baseStyles:u,styleMethods:h}},pt=It();Wt();ht(pt);const _t=(t,e,n)=>{if(e==="")return t;let r=t.indexOf(e);if(r<0)return t;const s=e.length;let o=0,i="";for(;~r;)i+=t.slice(o,r)+n,o=r+s,r=t.indexOf(e,o);return i+t.slice(o)},Pt=(t,e,n)=>{if(t==null||t==="")return"";let r;if(t.raw===void 0?r=String(t):r=String.raw(t,...e),r.includes("\x1B"))for(let s=n;s;s=s.props)r=_t(r,s.close,s.open);return r.includes(`
2
2
  `)&&(r=r.replace(/(\r*\n)/g,`${n.closeStack}$1${n.openStack}`)),n.openStack+r+n.closeStack},Tt=function(t){const e=t?.level??pt,{baseColors:n,baseStyles:r,styleMethods:s}=ht(e),o={};let i=null;const a=({props:c},{close:h,open:l})=>{const d=(c?.openStack??"")+l,p=h+(c?.closeStack??""),g=(w,...y)=>Pt(w,y,g.props);return Object.setPrototypeOf(g,i),g.props={close:h,closeStack:p,open:l,openStack:d,props:c},g.open=d,g.close=p,g},u=c=>String(c);u.strip=c=>c.replaceAll(Rt(),"");for(const c in n)o[c]={get(){const h=a(this,n[c]);return Object.defineProperty(this,c,{value:h}),h}};for(const c in r)o[c]={get(){const h=a(this,r[c]);return Object.defineProperty(this,c,{value:h}),h}};for(const c in s)o[c]={get(){return(...h)=>a(this,s[c](...h))}};return o.ansi256=o.fg,o.bgAnsi256=o.bg,i=Object.defineProperties({},o),Object.setPrototypeOf(u,i),u},Lt=t=>(e,...n)=>{if(!Array.isArray(e)||!Array.isArray(e.raw))throw new TypeError("A tagged template literal must be provided");const r=[e.raw[0]];for(let s=1;s<e.raw.length;s+=1)r.push(String(n[s-1]).replaceAll(/[{}\\]/g,String.raw`\$&`),String(e.raw[s]));return t(r.join(""))},Ft=new Map([["0","\0"],["\\","\\"],["a","\x07"],["b","\b"],["e","\x1B"],["f","\f"],["n",`
3
3
  `],["r","\r"],["t"," "],["v","\v"]]),mt=t=>{const e=t.startsWith("u"),n=t[1]==="{";return e&&!n&&t.length===5||t.startsWith("x")&&t.length===3?String.fromCodePoint(Number.parseInt(t.slice(1),16)):e&&n?String.fromCodePoint(Number.parseInt(t.slice(2,-1),16)):Ft.get(t)??t},Dt=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|\{(~)?(#?[\w:]+(?:\([^)]*\))?(?:\.#?[\w:]+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n))|(\})|((?:.|[\r\n\f])+?)/gi,et=/(?:^|\.)(?:(\w+)(?:\(([^)]*)\))?|#(?=[:a-f\d]{2,})([a-f\d]{6})?(?::([a-f\d]{6}))?)/gi,Vt=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,qt=/\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.)|([^\\])/gi,Ut=/\s*,\s*/,Gt=(t,e)=>{const n=[],r=e.trim().split(Ut);let s;for(const o of r){const i=Number(o);if(!Number.isNaN(i))n.push(i);else if(s=Vt.exec(o))n.push(s[2].replaceAll(qt,(a,u,c)=>u?mt(u):c));else throw new Error(`Invalid template style argument: ${o} (in style '${t}')`)}return n},zt=t=>{et.lastIndex=0;const e=[];let n;for(;(n=et.exec(t))!==null;){const r=n[1];n[2]?e.push([r,...Gt(r,n[2])]):n[3]||n[4]?(n[3]&&e.push(["rgb",...z(n[3])]),n[4]&&e.push(["bgRgb",...z(n[4])])):e.push([r])}return e},nt=(t,e)=>{const n={};for(const s of e)for(const o of s.styles)n[o[0]]=s.inverse?void 0:o.slice(1);let r=t;for(const[s,o]of Object.entries(n))if(Array.isArray(o)){if(!(s in r))throw new Error(`Unknown style: ${s}`);r=o.length>0?r[s](...o):r[s]}return r},Ht=t=>e=>{const n=[],r=[];let s=[];if(e.replaceAll(Dt,(o,i,a,u,c,h)=>{if(i)s.push(mt(i));else if(u){const l=s.join("");s=[],r.push(n.length===0?l:nt(t,n)(l)),n.push({inverse:a,styles:zt(u)})}else if(c){if(n.length===0)throw new Error("Found extraneous } in template literal");r.push(nt(t,n)(s.join(""))),s=[],n.pop()}else s.push(h)}),r.push(s.join("")),n.length>0)throw new Error(`template literal is missing ${String(n.length)} closing bracket${n.length===1?"":"s"} (\`}\`)`);return r.join("")},Yt=new Tt,Jt=Ht(Yt),Kt=Lt(Jt);let Qt;const Zt=t=>(Qt??=Bt(import.meta.url))(t),O=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:A,F=t=>{if(typeof O<"u"&&O.versions&&O.versions.node){const[e,n]=O.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return O.getBuiltinModule(t)}return Zt(t)},A=O,{execFileSync:Xt}=F("node:child_process"),W=F("node:fs"),te=F("node:tty"),ee=F("node:os"),ne=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],re=12288,oe=65510,ie=[12288,12288,65281,65376,65504,65510],se=8361,ae=65518,le=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],ce=32,ue=10630,de=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],he=4352,pe=262141,ft=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],k=(t,e)=>{let n=0,r=Math.floor(t.length/2)-1;for(;n<=r;){const s=Math.floor((n+r)/2),o=s*2;if(e<t[o])r=s-1;else if(e>t[o+1])n=s+1;else return!0}return!1},rt=19968,[me,fe]=ge(ft);function ge(t){let e=t[0],n=t[1];for(let r=0;r<t.length;r+=2){const s=t[r],o=t[r+1];if(rt>=s&&rt<=o)return[s,o];o-s>n-e&&(e=s,n=o)}return[e,n]}const we=t=>t<161||t>1114109?!1:k(ne,t),be=t=>t<re||t>oe?!1:k(ie,t),ye=t=>t<se||t>ae?!1:k(le,t),$e=t=>t<ce||t>ue?!1:k(de,t),Ne=t=>t>=me&&t<=fe?!0:t<he||t>pe?!1:k(ft,t);function ve(t){return we(t)?"ambiguous":be(t)?"fullwidth":ye(t)?"halfwidth":$e(t)?"narrow":Ne(t)?"wide":"neutral"}function Se(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function gt(t){return Se(t),ve(t)}const ot=new Map,Ae=t=>[t.ambiguousIsNarrow?1:0,t.control,t.fullWidth,t.regular,t.wide].join("|"),Oe=t=>{const e=Ae(t.width);let n=ot.get(e);return n||(n=new Map,ot.set(e,n)),n},M=new RegExp(ut.source,"y"),U=new RegExp(Mt.source,"uy"),C=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,wt=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",xe=(t,e)=>{const n=Oe(e),r=Math.floor(t/65536),s=t%65536;let o=n.get(r);if(o||(o=new Map,n.set(r,o)),o.has(s))return o.get(s);let i;switch(wt(t)){case"control":{i=e.width.control;break}case"latin":{i=e.width.regular;break}case"wide":{i=e.width.wide;break}case"zero":{i=0;break}default:switch(gt(t)){case"ambiguous":{i=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{i=e.width.fullWidth;break}case"wide":{i=e.width.wide;break}default:i=e.width.regular}}return o.set(s,i),i},Ee=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,Y=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const n={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?Y(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},r=Math.max(0,n.truncation.limit-n.truncation.ellipsisWidth),{length:s}=t,o=s>1e4;let i=0,a=0,u=s,c=!1;const h=t.includes("\x1B")||t.includes("›");for(;i<s;){if(h&&(t[i]==="\x1B"||t[i]==="›")){if(t.startsWith("\x1B]8;;",i)){const y="\x1B]8;;\x07",v=y.length,D=t.indexOf("\x07",i+5);if(D!==-1){const V=t.indexOf(y,D+1);if(V!==-1){const vt=V+v,St=t.slice(D+1,V).replace(ut,""),Q=Y(St,{ambiguousIsNarrow:n.width.ambiguousIsNarrow,ansiWidth:n.width.ansi,controlWidth:n.width.control,countAnsiEscapeCodes:!1,ellipsis:n.truncation.ellipsis,ellipsisWidth:n.truncation.ellipsisWidth,emojiWidth:n.width.emoji,fullWidth:n.width.fullWidth,halfWidth:n.width.halfWidth,limit:Math.max(0,r-a),regularWidth:n.width.regular,tabWidth:n.width.tab,wideWidth:n.width.wide}),q=Q.width;if(Q.truncated)c=!0,u=Math.min(u,i);else if(a+q>r&&(u=Math.min(u,i),c=!0,a+q>n.truncation.limit))break;if(a+=q,i=vt,c&&a>=n.truncation.limit)break;continue}}}if(M.lastIndex=i,M.test(t)){const y=M.lastIndex-i,v=n.truncation.countAnsiEscapeCodes?y:n.width.ansi;if(a+v>r&&(u=Math.min(u,i),a+v>n.truncation.limit)){c=!0;break}a+=v,i=M.lastIndex;continue}}const p=t.codePointAt(i);if(p===8203||p===65279||p>=8288&&p<=8292){i+=1;continue}if(p===9){if(a+n.width.tab>r&&(u=Math.min(u,i),a+n.width.tab>n.truncation.limit)){c=!0;break}a+=n.width.tab,i+=1;continue}if(C.lastIndex=i,C.test(t)){const y=(C.lastIndex-i)*n.width.regular;if(a+y>r){const v=n.width.regular>0?Math.floor((r-a)/n.width.regular):0;if(u=Math.min(u,i+v),a+y>n.truncation.limit){c=!0;break}}a+=y,i=C.lastIndex;continue}if((p<=31||p>=127&&p<=159)&&(B.lastIndex=i,B.test(t))){const y=(B.lastIndex-i)*n.width.control;if(a+y>r){const v=n.width.control>0?Math.floor((r-a)/n.width.control):0;if(u=Math.min(u,i+v),a+y>n.truncation.limit){c=!0;break}}a+=y,i=B.lastIndex;continue}if(U.lastIndex=i,U.test(t)){if(a+n.width.emoji>r&&(u=Math.min(u,i),a+n.width.emoji>n.truncation.limit)){c=!0;break}a+=n.width.emoji,i=U.lastIndex;continue}const g=t.codePointAt(i)??0;if(Ee(g)){i+=g>65535?2:1;continue}let w;if(o)w=xe(g,n);else switch(wt(g)){case"control":{w=n.width.control;break}case"latin":{w=n.width.regular;break}case"wide":{w=n.width.wide;break}case"zero":{w=0;break}default:switch(gt(g)){case"ambiguous":{w=n.width.ambiguousIsNarrow?n.width.regular:n.width.wide;break}case"fullwidth":{w=n.width.fullWidth;break}case"wide":{w=n.width.wide;break}default:w=n.width.regular}}if(a+w>r&&(u=Math.min(u,i),a+w>n.truncation.limit)){c=!0;break}a+=w,i+=g>65535?2:1}let l=a,d=!1;return c&&n.truncation.limit>=n.truncation.ellipsisWidth&&(l=n.truncation.limit,d=!0),{ellipsed:d,index:c?u:s,truncated:c,width:l}},Ie=(t,e={})=>Y(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,bt=80,yt=24,J=(t,e,{shell:n,env:r}={})=>Xt(t,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:n,env:r}).trim(),P=(t,e)=>({columns:Number.parseInt(t,10),rows:Number.parseInt(e,10)}),$t=(t,e)=>{const{columns:n,rows:r}=P(t,e);if(!(Number.isNaN(n)||Number.isNaN(r))&&!(n===bt&&r===yt))return{columns:n,rows:r}},We=()=>{if(A.platform!=="linux")return!0;try{const t=W.readFileSync("/proc/self/stat","utf8"),e=t.lastIndexOf(") ");if(e===-1)return!1;const n=t.slice(e+2).trim().split(/\s+/),r=Number.parseInt(n[2],10),s=Number.parseInt(n[5],10);return Number.isNaN(r)||Number.isNaN(s)||s<=0?!1:r===s}catch{return!1}};function ke(){const{env:t,stdout:e,stderr:n}=A;if(e?.columns&&e?.rows)return P(e.columns,e.rows);if(n?.columns&&n?.rows)return P(n.columns,n.rows);if(t.COLUMNS&&t.LINES)return P(t.COLUMNS,t.LINES);const r={columns:bt,rows:yt};return A.platform==="win32"?G()??r:A.platform==="darwin"?it()??G()??r:it()??G()??Be()??r}const it=()=>{try{const t=A.platform==="darwin"?W.constants.O_EVTONLY|W.constants.O_NONBLOCK:W.constants.O_NONBLOCK,{columns:e,rows:n}=te.WriteStream(W.openSync("/dev/tty",t));return{columns:e,rows:n}}catch{}},G=()=>{try{const t=J("tput",["cols"],{env:{TERM:"dumb",...A.env}}),e=J("tput",["lines"],{env:{TERM:"dumb",...A.env}});if(t&&e)return $t(t,e)}catch{}},Be=()=>{try{if(!We())return;const t=J("resize",["-u"]).match(/\d+/g);if(t.length===2)return $t(t[0],t[1])}catch{}},I=new Map,Me=500,$=t=>{if(!t||t==="")return"";const e=I.get(t);if(e!==void 0)return e;let n;try{n=Kt(Object.assign([],{raw:[t]}))}catch{n=t}if(I.size>=Me){const r=I.keys().next().value;r!==void 0&&I.delete(r)}return I.set(t,n),n},T=()=>{const t=Ct().CEREBRO_TERMINAL_WIDTH;if(t===void 0)return;const e=Number.parseInt(t,10);if(!(Number.isNaN(e)||e<=0))return e};class Nt{lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(ee.EOL)}header(e){this.add(j(e)),this.lines.push("")}}const Ce=t=>t!==void 0&&t>0?t:ke().columns,je=(t,e,n,r)=>{if(t.length===0||t.some(c=>c.length!==2))return;let s=0;for(const c of t){const h=c[0];if(h===void 0)continue;const l=Ie(h);l>s&&(s=l)}if(s===0)return;const o=n+r,i=s+o,a=20+o;if(i+a>e)return;const u=e-i;return[i,u]};class Re extends Nt{constructor(e){if(super(),e.header&&this.header($(e.header)),e.content){if(e.raw)if(Array.isArray(e.content)&&e.content.every(n=>typeof n=="string"))e.content.forEach(n=>{Array.isArray(n)?n.forEach(r=>{this.add($(r))}):this.add($(n))});else if(typeof e.content=="string")this.add($(e.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(e.content));this.add("")}}getContentLines(e){if(typeof e=="string"){const n=R({showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:T(),truncateOverflow:!1,wordWrap:!0});return n.addRow([$(e)]),n.toString()}if(Array.isArray(e)&&e.every(n=>typeof n=="string"||Array.isArray(n)&&n.every(r=>typeof r=="string"))){const n=Ce(T()),r=a=>Array.isArray(a)?a.map(u=>$(u)):[$(a)],s=e.map(a=>r(a)),o=je(s,n,4,1),i=R({columnWidths:o,showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:n,truncateOverflow:!1,wordWrap:!0});return s.forEach(a=>{o!==void 0&&a.length===2?i.addRow([{content:a[0],wordWrap:!1},a[1]]):i.addRow(a)}),i.toString()}if(typeof e=="object"){const n=e;if(!n.options||!n.data)throw new Error(`Must have an "options" or "data" property
4
4
  ${JSON.stringify(e)}`);const r=R({showHeader:!1,style:{border:_,paddingLeft:4,paddingRight:1},terminalWidth:T(),truncateOverflow:!1,wordWrap:!0});return n.data.forEach(s=>{Array.isArray(s)?r.addRow(s.map(o=>$(o))):r.addRow([$(s)])}),r.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object: