@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,7 +1,7 @@
1
- import{a as nt,e as st,z as O}from"../packem_shared/index-BzhrR_iC.js";import{l as At}from"./ts-loader.js";import{L as Et}from"../packem_shared/index-BisalDCf.js";import{p as bt}from"./cli-main.js";import{t as xt,L as Ct,T as S,R as L,B as W,U as E,O as N,K as Q,Z as V,W as jt,u as K,v as kt,F as D,w as J,x as Y,H as Lt,y as Wt,M as Ut,C as St,P as Tt,z as Ot,A as Pt,Y as _t,E as It,J as Rt,G as zt,V as Nt,$ as vt,I as Ft,N as Mt,Q as Bt}from"../packem_shared/env-BSXG3QKH.js";import{J as I,L as qt}from"../packem_shared/registry-Dg9XI6RT.js";const Gt=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Qt=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),Vt=t=>{if(typeof t!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof t}`);return t.replaceAll(Qt,"")},v=new I(1e3),Kt=/[.*+?^${}()|[\]\\]/g,Dt=t=>{const e=t.join("");if(v.has(e)){const r=v.get(e);return r.lastIndex=0,r}const s=t.map(r=>r.replaceAll(Kt,String.raw`\$&`)).join("|"),n=new RegExp(s,"g");return v.set(e,n),n},Jt=t=>{const e=[];let s=0,n;for(L.lastIndex=0;(n=L.exec(t))!==null;)n.index>s&&e.push(t.slice(s,n.index)),e.push(n[0]),s=L.lastIndex;return s<t.length&&e.push(t.slice(s)),e.filter(Boolean)},Yt=/[ČŠŽĐ]/i,rt=new Uint8Array(128),ot=new Uint8Array(128),it=new Uint8Array(128);for(let t=0;t<128;t++)rt[t]=t>=65&&t<=90?1:0,ot[t]=t>=97&&t<=122?1:0,it[t]=t>=48&&t<=57?1:0;const F=t=>rt[t],Z=t=>ot[t],M=t=>it[t],j=(t,e,s,n,r)=>{if(t.length===0)return[];let o=!1;const a=Object.values(e);for(const u of a)if(u(t[0])){o=!0;break}if(!o&&!s)return[t];const l=[...t],h=[];let i=l[0],p="other";const d=Object.entries(e);for(const u of d){const[f,g]=u;if(g(l[0])){p=f;break}}let c=s&&n?l[0]===l[0].toLocaleUpperCase(n):!1;for(let u=1;u<l.length;u++){const f=l[u];let g="other";for(const w of d){const[$,A]=w;if(A(f)){g=$;break}}const y=s&&n?f===f.toLocaleUpperCase(n):!1;let m=!1;r?m=r(p,g,c,y,f,u,l):(p!==g&&p!=="other"&&g!=="other"&&(m=!0),s&&g!=="other"&&!c&&y&&(m=!0)),m?(h.push(i),i=f):i+=f,p=g,s&&(c=y)}return i&&i.length>0&&h.push(i),h.length>0?h:[t]},Zt=(t,e,s,n)=>{if(s.size===0)return e;for(const r of s)if(t.startsWith(r,e))return n.push(r),e+r.length;return e},lt=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let s=0;const n=[],r=t.length;for(let o=1;o<r;o++){const a=Zt(t,s,e,n);if(a!==s){s=a,o=s-1;continue}const l=t.codePointAt(o-1),h=t.codePointAt(o),i=l&&l<128&&F(l),p=h&&h<128&&F(h),d=l&&l<128&&Z(l),c=l&&l<128&&M(l),u=h&&h<128&&M(h);if(d&&p){n.push(t.slice(s,o)),s=o;continue}if(c&&!u||!c&&u){n.push(t.slice(s,o)),s=o;continue}if(u&&!c){let f=!1,g=!1;if(o+1<r){const y=t.codePointAt(o+1);f=y&&y<128&&F(y),g=y&&y<128&&M(y)}if(!g&&f){n.push(t.slice(s,o),t.slice(o,o+1)),s=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),g=f&&f<128&&Z(f);if(i&&p&&g){const y=t.slice(s,o+1);e.has(y)||(n.push(t.slice(s,o)),s=o)}}}return s<r&&n.push(t.slice(s)),n.filter(o=>o!=="")},at=(t,e,s)=>{if(t.length===0)return[];const n=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!n&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e),f=u,g=u?0:-1;for(let y=1;y<p;y++){const m=i[y],w=m===m.toLocaleUpperCase(e);if(w===u)c+=m;else if(w)c&&c.length>0&&(d.push(c),c=m),f=!0,g=y;else{if(f&&y-g>1){const $=i[y-1],A=c.slice(0,-1);A&&A.length>0&&d.push(A),c=$+m}else c+=m;f=!1,g=-1}u=w}return c&&c.length>0&&d.push(c),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0];const u=i[0];let f;W.test(u)?f=1:E.test(u)?f=2:f=0;let g=u===u.toLocaleUpperCase(e);for(let m=1;m<p;m++){const w=i[m];let $;W.test(w)?$=1:E.test(w)?$=2:$=0;const A=w===w.toLocaleUpperCase(e);f!==$&&(f===1||f===2)&&($===1||$===2)||$===f&&!g&&A?(d.push(c),c=w):c+=w,f=$,g=A}c&&c.length>0&&d.push(c);const y=[];for(let m=0;m<d.length;m++)m<d.length-1&&d[m].length===1&&E.test(d[m])&&W.test(d[m+1][0])?(y.push(d[m]+d[m+1]),m+=1):y.push(d[m]);return y}if(e.startsWith("el")){if(!N.test(t)&&!E.test(t))return[t];const i=[];Q.lastIndex=0;let p;for(;(p=Q.exec(t))!==null;)i.push(p[0]);i.length===0&&i.push(t);const d=[];if(i.length===1){const c=i[0];if(!c||!N.test(c[0])||c.length===1)return[c??t]}for(const c of i){if(!c)continue;if(!N.test(c[0])||c.length===1){d.push(c);continue}const u=c.length;let f=c[0],g=c[0]===c[0].toLocaleUpperCase(e);for(let y=1;y<u;y++){const m=c[y],w=m===m.toLocaleUpperCase(e);!g&&w?(d.push(f),f=m):f+=m,g=w}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const i=e.startsWith("ja"),p=i?{hiragana:c=>kt.test(c),kanji:c=>K.test(c),katakana:c=>jt.test(c),latin:c=>E.test(c)}:{hangul:c=>D.test(c),latin:c=>E.test(c)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(i){const c=j(t,p,!1,e,(f,g)=>f==="hiragana"&&g==="katakana"||f==="katakana"&&g==="hiragana"||f==="hiragana"&&g==="latin"||f==="katakana"&&g==="latin"||f==="kanji"&&g==="latin"||f==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const f of c){const g=f;g.length===1&&d.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[t]}return j(t,p,!1,e,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(e.startsWith("sl")){const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e),m=Yt.test(g),w=f<p-1&&i[f+1]===i[f+1].toLocaleUpperCase(e);!u&&y||m&&w?(d.push(c),c=g,m&&w&&(d.push(c),c="")):c+=g,u=y}return c&&c.length>0&&d.push(c),d}if(e.startsWith("zh"))return j(t,{han:i=>K.test(i),latin:i=>E.test(i)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const i=p=>J.test(p)||Y.test(p);return j(t,{latin:p=>E.test(p),rtl:p=>i(p)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const i=p=>Lt.test(p)||Wt.test(p)||Ut.test(p)||St.test(p)||Tt.test(p)||Ot.test(p)||Pt.test(p)||_t.test(p)||It.test(p)||Rt.test(p)||zt.test(p)||Nt.test(p)||vt.test(p)||Ft.test(p)||Mt.test(p)||Bt.test(p);return j(t,{indic:p=>i(p),latin:p=>E.test(p)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return j(t,{cyrillic:i=>W.test(i),latin:i=>E.test(i)},!0,e);if(["ar","fa","he"].includes(e))return j(t,{latin:i=>E.test(i),rtl:i=>J.test(i)||Y.test(i)},!1,e);if(e.startsWith("ko"))return j(t,{hangul:i=>D.test(i),latin:i=>E.test(i)},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e);if(V.test(g)||V.test(i[f-1])){c+=g;continue}!u&&y?(d.push(c),c=g):c+=g,u=y}return c&&c.length>0&&d.push(c),d}const r=[...t],o=r.length,a=[];let l=r[0],h=r[0]===r[0].toLocaleUpperCase(e);for(const i of s)if(t.startsWith(i)){a.push(i),l=r[i.length],h=l===l.toLocaleUpperCase(e);break}for(let i=1;i<o;i++){const p=r[i],d=p===p.toLocaleUpperCase(e);let c=0;for(const u of s)if(t.startsWith(u,i)){a.push(l,u),c=u.length,l="";const f=u.at(-1);f&&(h=f===f.toLocaleUpperCase(e));break}if(c>0){i+=c-1;continue}!h&&d?(a.push(l),l=p):l+=p,h=d}return l&&a.push(l),a},Ht=(t,e,s)=>{const n=[],r=S.test(t)?t.split(S).filter(Boolean):[t];for(const o of r){const a=o;if(S.test(a))n.push(a);else{L.lastIndex=0;const l=L.test(a)?Jt(a).filter(Boolean):[a];for(const h of l)if(L.lastIndex=0,L.test(h))n.push(h);else if(e){const i=e.toLowerCase().split("-")[0];n.push(...at(h,i,s))}else n.push(...lt(h,s))}}return n},R=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:s=!1,handleEmoji:n=!1,knownAcronyms:r=[],locale:o,normalize:a=!1,separators:l,stripAnsi:h=!1,stripEmoji:i=!1}=e,p=new Set([...r].toSorted((m,w)=>w.length-m.length));let d=t;h&&(d=Vt(d)),i&&(d=xt(d));let c;Array.isArray(l)?c=Dt(l):l instanceof RegExp?c=l:c=Ct;const u=[];let f=d;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;f.length>0;){const m=g.exec(f);if(!m){f===".."?u.push(".."):f==="."?u.push("."):f.length>0&&u.push(f);break}const w=m.index,$=m[0],A=$.length,T=f.slice(0,w),$t=f.slice(w+A);if($.startsWith("../"))u.push(".."),f=f.slice(w+3);else if($.startsWith("./"))u.push("."),f=f.slice(w+2);else if(w===0&&$==="..")u.push(".."),f=f.slice(2);else if(w===0&&$===".")u.push("."),f=f.slice(1);else{T.length>0&&u.push(T);let x=0;for(;(x=$.indexOf("../",x))!==-1;)u.push(".."),x+=3;for(x=0;(x=$.indexOf("./",x))!==-1;)(x===0||$[x-1]!==".")&&u.push("."),x+=2;let C=$t;for(;C.startsWith("../");)u.push(".."),C=C.slice(3);for(;C.startsWith("./");)u.push("."),C=C.slice(2);if(C===".."){u.push("..");break}else if(C==="."){u.push(".");break}else f=C}g.lastIndex=0}if(u.length===0){const m=d.split(c).filter(Boolean);u.push(...m)}let y=[];for(const m of u)s||n?y.push(...Ht(m,o,p)):o?y.push(...at(m,o,p)):y.push(...lt(m,p));return a&&(y=y.map(m=>p.has(m)?m:o&&m===m.toLocaleUpperCase(o)?m[0]+m.slice(1).toLocaleLowerCase(o):m.toUpperCase()===m&&!p.has(m)?m.slice(0,1)+m.slice(1).toLowerCase():m)),y},q=(t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),Xt=(t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}::${e?.stripAnsi?"true":"false"}::${e?.stripEmoji?"true":"false"}::${e?.handleAnsi?"true":"false"}::${e?.handleEmoji?"true":"false"}`,z=(t,e)=>{const{length:s}=t;if(s===0)return"";if(s===1)return t[0];const n=[];let r="",o="";for(let a=0;a<s;a++){const l=t[a];if(S.test(l)){r?(n.push(r+o+l),r="",o=""):(n.length>0&&n.push(e),r=l);continue}r?(o&&(o+=e),o+=l):(n.length>0&&n.push(e),n.push(l))}return n.join("")},te=/(?<![a-zß])SS(?![a-z])/g,ee=t=>t.replaceAll(te,"ß"),ne=(t,e)=>{if(typeof t!="string"||!t)return"";let s=!0;return z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(r=>{const o=r,a=o.toLowerCase();return s?(s=!1,Gt(a)):q(a,e)}),"")},se=new I(1e3),G=(t,e)=>{if(typeof t!="string")return"";const s=e?.cache??!1,n=e?.cacheStore??se;let r;if(s&&(r=Xt(t,e)),s&&r&&n.has(r))return n.get(r);const o=R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(l=>{if(e?.handleAnsi&&S.test(l))return l;if(e?.toUpperCase)return e.locale?l.toLocaleUpperCase(e.locale):l.toUpperCase();const h=e?.locale?.startsWith("de")?ee(l):l;return e?.locale?h.toLocaleLowerCase(e.locale):h.toLowerCase()}),a=z(o,e?.joiner??"-");return s&&r&&n.set(r,a),a},re=new I(1e3),oe=(t,e)=>G(t,{cacheStore:re,...e,joiner:"_",toUpperCase:!0}),ie=(t,e)=>typeof t!="string"||!t?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n.toLowerCase(),{locale:e?.locale})),""),le=new I(1e3),ae=(t,e)=>G(t,{cacheStore:le,...e,joiner:"_"}),ce=(t,e)=>typeof t!="string"?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n,{locale:e?.locale})),"-"),b=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),H={camel_case:t=>ne(b(t)),kebab_case:t=>G(b(t)),lower_case:t=>b(t).toLowerCase(),pascal_case:t=>ie(b(t)),path_join:(t,...e)=>{const s=[b(t),...e.map(n=>b(n))];return st(...s)},path_relative:(t,e)=>nt(b(e),b(t)),snake_case:t=>ae(b(t)),upper_case:t=>b(t).toUpperCase(),upper_kebab_case:t=>ce(b(t)),upper_snake_case:t=>oe(b(t))},ct=(t,e,s=[])=>{const n=H[t];if(!n)throw new Error(`Unknown filter "${t}". Known filters: ${Object.keys(H).sort().join(", ")}.`);return n(e,...s)},ft=t=>{const e=[];let s=0,n=0,r,o=-1;for(const a of t){if(o+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a===","&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},fe=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},ue=/\[([^\]]+)\]/g,pe=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r===""?{args:[],name:n}:{args:ft(r).map(a=>{const l=a.trim();return fe(l)??l}),name:n}},he=t=>{const e=t.split("|").map(r=>r.trim()),s=e[0]??"";if(!s)throw new Error(`Empty variable name in expression "${t}"`);return{filters:e.slice(1).map(r=>pe(r)),name:s}},de=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),me=(t,e)=>{const s=t.replaceAll(ue,(n,r)=>{const{filters:o,name:a}=he(r);if(!Object.hasOwn(e,a))throw new Error(`Variable "${a}" used in filename "${t}" but not defined`);let l=e[a];for(const h of o)l=ct(h.name,l,h.args);return de(l)});return ut(s)},ut=t=>t.split("/").map(e=>e.endsWith(".tera")||e.endsWith(".twig")?e.slice(0,-5):e).join("/"),ge=t=>t.endsWith(".raw")?t.slice(0,-4):t,ye=t=>{const e=t.split("/");return(e.at(-1)??"").startsWith("_")?!0:e.slice(0,-1).includes("partials")},k="---",we=(t,e)=>{if(!t.startsWith(`${k}
1
+ import{a as nt,e as st,z as O}from"../packem_shared/index-0dnGN3GP.js";import{l as At}from"./ts-loader.js";import{L as Et}from"../packem_shared/index-BisalDCf.js";import{p as bt}from"./cli-main.js";import{w as xt,L as Ct,T as U,R as L,B as W,x as E,O as N,K as Q,Z as V,W as jt,y as K,z as kt,F as D,A as J,C as Y,H as Lt,E as Wt,M as St,G as Ut,P as Tt,I as Ot,J as _t,Y as Pt,N as It,Q as Rt,S as zt,V as Nt,$ as Mt,X as vt,_ as Ft,a0 as Bt}from"../packem_shared/env-BymuoTL8.js";import{M as I,L as qt}from"../packem_shared/registry-CndByNx9.js";const Gt=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Qt=new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))","g"),Vt=t=>{if(typeof t!="string")throw new TypeError(`The "value" argument must be of type string. Received ${typeof t}`);return t.replaceAll(Qt,"")},M=new I(1e3),Kt=/[.*+?^${}()|[\]\\]/g,Dt=t=>{const e=t.join("");if(M.has(e)){const r=M.get(e);return r.lastIndex=0,r}const s=t.map(r=>r.replaceAll(Kt,String.raw`\$&`)).join("|"),n=new RegExp(s,"g");return M.set(e,n),n},Jt=t=>{const e=[];let s=0,n;for(L.lastIndex=0;(n=L.exec(t))!==null;)n.index>s&&e.push(t.slice(s,n.index)),e.push(n[0]),s=L.lastIndex;return s<t.length&&e.push(t.slice(s)),e.filter(Boolean)},Yt=/[ČŠŽĐ]/i,rt=new Uint8Array(128),ot=new Uint8Array(128),it=new Uint8Array(128);for(let t=0;t<128;t++)rt[t]=t>=65&&t<=90?1:0,ot[t]=t>=97&&t<=122?1:0,it[t]=t>=48&&t<=57?1:0;const v=t=>rt[t],X=t=>ot[t],F=t=>it[t],j=(t,e,s,n,r)=>{if(t.length===0)return[];let o=!1;const a=Object.values(e);for(const u of a)if(u(t[0])){o=!0;break}if(!o&&!s)return[t];const l=[...t],h=[];let i=l[0],p="other";const d=Object.entries(e);for(const u of d){const[f,g]=u;if(g(l[0])){p=f;break}}let c=s&&n?l[0]===l[0].toLocaleUpperCase(n):!1;for(let u=1;u<l.length;u++){const f=l[u];let g="other";for(const w of d){const[$,A]=w;if(A(f)){g=$;break}}const y=s&&n?f===f.toLocaleUpperCase(n):!1;let m=!1;r?m=r(p,g,c,y,f,u,l):(p!==g&&p!=="other"&&g!=="other"&&(m=!0),s&&g!=="other"&&!c&&y&&(m=!0)),m?(h.push(i),i=f):i+=f,p=g,s&&(c=y)}return i&&i.length>0&&h.push(i),h.length>0?h:[t]},Xt=(t,e,s,n)=>{if(s.size===0)return e;for(const r of s)if(t.startsWith(r,e))return n.push(r),e+r.length;return e},lt=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let s=0;const n=[],r=t.length;for(let o=1;o<r;o++){const a=Xt(t,s,e,n);if(a!==s){s=a,o=s-1;continue}const l=t.codePointAt(o-1),h=t.codePointAt(o),i=l&&l<128&&v(l),p=h&&h<128&&v(h),d=l&&l<128&&X(l),c=l&&l<128&&F(l),u=h&&h<128&&F(h);if(d&&p){n.push(t.slice(s,o)),s=o;continue}if(c&&!u||!c&&u){n.push(t.slice(s,o)),s=o;continue}if(u&&!c){let f=!1,g=!1;if(o+1<r){const y=t.codePointAt(o+1);f=y&&y<128&&v(y),g=y&&y<128&&F(y)}if(!g&&f){n.push(t.slice(s,o),t.slice(o,o+1)),s=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),g=f&&f<128&&X(f);if(i&&p&&g){const y=t.slice(s,o+1);e.has(y)||(n.push(t.slice(s,o)),s=o)}}}return s<r&&n.push(t.slice(s)),n.filter(o=>o!=="")},at=(t,e,s)=>{if(t.length===0)return[];const n=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!n&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e),f=u,g=u?0:-1;for(let y=1;y<p;y++){const m=i[y],w=m===m.toLocaleUpperCase(e);if(w===u)c+=m;else if(w)c&&c.length>0&&(d.push(c),c=m),f=!0,g=y;else{if(f&&y-g>1){const $=i[y-1],A=c.slice(0,-1);A&&A.length>0&&d.push(A),c=$+m}else c+=m;f=!1,g=-1}u=w}return c&&c.length>0&&d.push(c),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0];const u=i[0];let f;W.test(u)?f=1:E.test(u)?f=2:f=0;let g=u===u.toLocaleUpperCase(e);for(let m=1;m<p;m++){const w=i[m];let $;W.test(w)?$=1:E.test(w)?$=2:$=0;const A=w===w.toLocaleUpperCase(e);f!==$&&(f===1||f===2)&&($===1||$===2)||$===f&&!g&&A?(d.push(c),c=w):c+=w,f=$,g=A}c&&c.length>0&&d.push(c);const y=[];for(let m=0;m<d.length;m++)m<d.length-1&&d[m].length===1&&E.test(d[m])&&W.test(d[m+1][0])?(y.push(d[m]+d[m+1]),m+=1):y.push(d[m]);return y}if(e.startsWith("el")){if(!N.test(t)&&!E.test(t))return[t];const i=[];Q.lastIndex=0;let p;for(;(p=Q.exec(t))!==null;)i.push(p[0]);i.length===0&&i.push(t);const d=[];if(i.length===1){const c=i[0];if(!c||!N.test(c[0])||c.length===1)return[c??t]}for(const c of i){if(!c)continue;if(!N.test(c[0])||c.length===1){d.push(c);continue}const u=c.length;let f=c[0],g=c[0]===c[0].toLocaleUpperCase(e);for(let y=1;y<u;y++){const m=c[y],w=m===m.toLocaleUpperCase(e);!g&&w?(d.push(f),f=m):f+=m,g=w}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const i=e.startsWith("ja"),p=i?{hiragana:c=>kt.test(c),kanji:c=>K.test(c),katakana:c=>jt.test(c),latin:c=>E.test(c)}:{hangul:c=>D.test(c),latin:c=>E.test(c)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(i){const c=j(t,p,!1,e,(f,g)=>f==="hiragana"&&g==="katakana"||f==="katakana"&&g==="hiragana"||f==="hiragana"&&g==="latin"||f==="katakana"&&g==="latin"||f==="kanji"&&g==="latin"||f==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),u=[];for(const f of c){const g=f;g.length===1&&d.has(g)&&u.length>0?u[u.length-1]=u.at(-1)+g:u.push(g)}return u.length>0?u:[t]}return j(t,p,!1,e,(c,u)=>c==="hangul"&&u==="latin"||c==="latin"&&u==="hangul")}if(e.startsWith("sl")){const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e),m=Yt.test(g),w=f<p-1&&i[f+1]===i[f+1].toLocaleUpperCase(e);!u&&y||m&&w?(d.push(c),c=g,m&&w&&(d.push(c),c="")):c+=g,u=y}return c&&c.length>0&&d.push(c),d}if(e.startsWith("zh"))return j(t,{han:i=>K.test(i),latin:i=>E.test(i)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const i=p=>J.test(p)||Y.test(p);return j(t,{latin:p=>E.test(p),rtl:p=>i(p)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const i=p=>Lt.test(p)||Wt.test(p)||St.test(p)||Ut.test(p)||Tt.test(p)||Ot.test(p)||_t.test(p)||Pt.test(p)||It.test(p)||Rt.test(p)||zt.test(p)||Nt.test(p)||Mt.test(p)||vt.test(p)||Ft.test(p)||Bt.test(p);return j(t,{indic:p=>i(p),latin:p=>E.test(p)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return j(t,{cyrillic:i=>W.test(i),latin:i=>E.test(i)},!0,e);if(["ar","fa","he"].includes(e))return j(t,{latin:i=>E.test(i),rtl:i=>J.test(i)||Y.test(i)},!1,e);if(e.startsWith("ko"))return j(t,{hangul:i=>D.test(i),latin:i=>E.test(i)},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!E.test(t))return[t];const i=[...t],p=i.length,d=[];let c=i[0],u=i[0]===i[0].toLocaleUpperCase(e);for(let f=1;f<p;f++){const g=i[f],y=g===g.toLocaleUpperCase(e);if(V.test(g)||V.test(i[f-1])){c+=g;continue}!u&&y?(d.push(c),c=g):c+=g,u=y}return c&&c.length>0&&d.push(c),d}const r=[...t],o=r.length,a=[];let l=r[0],h=r[0]===r[0].toLocaleUpperCase(e);for(const i of s)if(t.startsWith(i)){a.push(i),l=r[i.length],h=l===l.toLocaleUpperCase(e);break}for(let i=1;i<o;i++){const p=r[i],d=p===p.toLocaleUpperCase(e);let c=0;for(const u of s)if(t.startsWith(u,i)){a.push(l,u),c=u.length,l="";const f=u.at(-1);f&&(h=f===f.toLocaleUpperCase(e));break}if(c>0){i+=c-1;continue}!h&&d?(a.push(l),l=p):l+=p,h=d}return l&&a.push(l),a},Zt=(t,e,s)=>{const n=[],r=U.test(t)?t.split(U).filter(Boolean):[t];for(const o of r){const a=o;if(U.test(a))n.push(a);else{L.lastIndex=0;const l=L.test(a)?Jt(a).filter(Boolean):[a];for(const h of l)if(L.lastIndex=0,L.test(h))n.push(h);else if(e){const i=e.toLowerCase().split("-")[0];n.push(...at(h,i,s))}else n.push(...lt(h,s))}}return n},R=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:s=!1,handleEmoji:n=!1,knownAcronyms:r=[],locale:o,normalize:a=!1,separators:l,stripAnsi:h=!1,stripEmoji:i=!1}=e,p=new Set([...r].toSorted((m,w)=>w.length-m.length));let d=t;h&&(d=Vt(d)),i&&(d=xt(d));let c;Array.isArray(l)?c=Dt(l):l instanceof RegExp?c=l:c=Ct;const u=[];let f=d;const g=c.flags.includes("g")?c:new RegExp(c.source,`${c.flags}g`);for(;f.length>0;){const m=g.exec(f);if(!m){f===".."?u.push(".."):f==="."?u.push("."):f.length>0&&u.push(f);break}const w=m.index,$=m[0],A=$.length,T=f.slice(0,w),$t=f.slice(w+A);if($.startsWith("../"))u.push(".."),f=f.slice(w+3);else if($.startsWith("./"))u.push("."),f=f.slice(w+2);else if(w===0&&$==="..")u.push(".."),f=f.slice(2);else if(w===0&&$===".")u.push("."),f=f.slice(1);else{T.length>0&&u.push(T);let x=0;for(;(x=$.indexOf("../",x))!==-1;)u.push(".."),x+=3;for(x=0;(x=$.indexOf("./",x))!==-1;)(x===0||$[x-1]!==".")&&u.push("."),x+=2;let C=$t;for(;C.startsWith("../");)u.push(".."),C=C.slice(3);for(;C.startsWith("./");)u.push("."),C=C.slice(2);if(C===".."){u.push("..");break}else if(C==="."){u.push(".");break}else f=C}g.lastIndex=0}if(u.length===0){const m=d.split(c).filter(Boolean);u.push(...m)}let y=[];for(const m of u)s||n?y.push(...Zt(m,o,p)):o?y.push(...at(m,o,p)):y.push(...lt(m,p));return a&&(y=y.map(m=>p.has(m)?m:o&&m===m.toLocaleUpperCase(o)?m[0]+m.slice(1).toLocaleLowerCase(o):m.toUpperCase()===m&&!p.has(m)?m.slice(0,1)+m.slice(1).toLowerCase():m)),y},q=(t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),Ht=(t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}::${e?.stripAnsi?"true":"false"}::${e?.stripEmoji?"true":"false"}::${e?.handleAnsi?"true":"false"}::${e?.handleEmoji?"true":"false"}`,z=(t,e)=>{const{length:s}=t;if(s===0)return"";if(s===1)return t[0];const n=[];let r="",o="";for(let a=0;a<s;a++){const l=t[a];if(U.test(l)){r?(n.push(r+o+l),r="",o=""):(n.length>0&&n.push(e),r=l);continue}r?(o&&(o+=e),o+=l):(n.length>0&&n.push(e),n.push(l))}return n.join("")},te=/(?<![a-zß])SS(?![a-z])/g,ee=t=>t.replaceAll(te,"ß"),ne=(t,e)=>{if(typeof t!="string"||!t)return"";let s=!0;return z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(r=>{const o=r,a=o.toLowerCase();return s?(s=!1,Gt(a)):q(a,e)}),"")},se=new I(1e3),G=(t,e)=>{if(typeof t!="string")return"";const s=e?.cache??!1,n=e?.cacheStore??se;let r;if(s&&(r=Ht(t,e)),s&&r&&n.has(r))return n.get(r);const o=R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(l=>{if(e?.handleAnsi&&U.test(l))return l;if(e?.toUpperCase)return e.locale?l.toLocaleUpperCase(e.locale):l.toUpperCase();const h=e?.locale?.startsWith("de")?ee(l):l;return e?.locale?h.toLocaleLowerCase(e.locale):h.toLowerCase()}),a=z(o,e?.joiner??"-");return s&&r&&n.set(r,a),a},re=new I(1e3),oe=(t,e)=>G(t,{cacheStore:re,...e,joiner:"_",toUpperCase:!0}),ie=(t,e)=>typeof t!="string"||!t?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n.toLowerCase(),{locale:e?.locale})),""),le=new I(1e3),ae=(t,e)=>G(t,{cacheStore:le,...e,joiner:"_"}),ce=(t,e)=>typeof t!="string"?"":z(R(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(n=>q(n,{locale:e?.locale})),"-"),b=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),Z={camel_case:t=>ne(b(t)),kebab_case:t=>G(b(t)),lower_case:t=>b(t).toLowerCase(),pascal_case:t=>ie(b(t)),path_join:(t,...e)=>{const s=[b(t),...e.map(n=>b(n))];return st(...s)},path_relative:(t,e)=>nt(b(e),b(t)),snake_case:t=>ae(b(t)),upper_case:t=>b(t).toUpperCase(),upper_kebab_case:t=>ce(b(t)),upper_snake_case:t=>oe(b(t))},ct=(t,e,s=[])=>{const n=Z[t];if(!n)throw new Error(`Unknown filter "${t}". Known filters: ${Object.keys(Z).sort().join(", ")}.`);return n(e,...s)},ft=t=>{const e=[];let s=0,n=0,r,o=-1;for(const a of t){if(o+=1,r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a===","&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},fe=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},ue=/\[([^\]]+)\]/g,pe=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r===""?{args:[],name:n}:{args:ft(r).map(a=>{const l=a.trim();return fe(l)??l}),name:n}},he=t=>{const e=t.split("|").map(r=>r.trim()),s=e[0]??"";if(!s)throw new Error(`Empty variable name in expression "${t}"`);return{filters:e.slice(1).map(r=>pe(r)),name:s}},de=t=>t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"||typeof t=="bigint"?String(t):JSON.stringify(t),me=(t,e)=>{const s=t.replaceAll(ue,(n,r)=>{const{filters:o,name:a}=he(r);if(!Object.hasOwn(e,a))throw new Error(`Variable "${a}" used in filename "${t}" but not defined`);let l=e[a];for(const h of o)l=ct(h.name,l,h.args);return de(l)});return ut(s)},ut=t=>t.split("/").map(e=>e.endsWith(".tera")||e.endsWith(".twig")?e.slice(0,-5):e).join("/"),ge=t=>t.endsWith(".raw")?t.slice(0,-4):t,ye=t=>{const e=t.split("/");return(e.at(-1)??"").startsWith("_")?!0:e.slice(0,-1).includes("partials")},k="---",we=(t,e)=>{if(!t.startsWith(`${k}
2
2
  `)&&!t.startsWith(`${k}\r
3
3
  `))return{body:t};const s=t.indexOf(`
4
4
  ${k}`,k.length);if(s===-1)return{body:t};let n=s+1+k.length;t[n]==="\r"&&(n+=1),t[n]===`
5
5
  `&&(n+=1);const r=t.startsWith(`${k}\r
6
6
  `)?k.length+2:k.length+1,o=t.slice(r,s).replaceAll("\r","");let a;try{a=e(o)}catch(l){const h=l instanceof Error?l.message:String(l);throw new Error(`Failed to parse frontmatter YAML: ${h}`,{cause:l})}if(a==null)return{body:t.slice(n)};if(typeof a!="object"||Array.isArray(a))throw new TypeError(`Frontmatter must be a YAML mapping, got ${Array.isArray(a)?"array":typeof a}`);return{body:t.slice(n),frontmatter:a}},$e=/\{\{-?(.+?)-?\}\}|\{%-?(.+?)-?%\}/gs,pt=t=>{const e=[];let s=0,n=1;const r=o=>{for(const a of o)a===`
7
- `&&(n+=1)};for(const o of t.matchAll($e)){const a=o.index??0;if(a>s){const i=t.slice(s,a);e.push({line:n,type:"text",value:i}),r(i)}const l=n,h=o[0];h.startsWith("{{")?e.push({line:l,type:"expr",value:(o[1]??"").trim()}):e.push({line:l,type:"stmt",value:(o[2]??"").trim()}),r(h),s=a+h.length}if(s<t.length){const o=t.slice(s);e.push({line:n,type:"text",value:o})}return e},Ae=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),ht=(t,e)=>{let s=0;const n=(o,a)=>{throw new Error(`${e}:${o}: ${a}`)},r=o=>{const a=[];for(;s<t.length;){const l=t[s];if(l.type==="text"){a.push({type:"text",value:l.value}),s+=1;continue}if(l.type==="expr"){a.push({expression:l.value,line:l.line,type:"expr"}),s+=1;continue}const h=l.value.split(/\s+/)[0]??"";if(o.includes(h))return a;if(Ae.has(h)&&n(l.line,`Tera feature "{% ${h} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),h==="if"){s+=1;const i=l.value.slice(2).trim(),p=r(["else","endif"]);let d;s<t.length&&t[s].type==="stmt"&&t[s].value.split(/\s+/)[0]==="else"&&(s+=1,d=r(["endif"])),(s>=t.length||t[s].type!=="stmt"||t[s].value.split(/\s+/)[0]!=="endif")&&n(l.line,"Unterminated {% if %} — missing {% endif %}"),s+=1,a.push({alternate:d,condition:i,consequent:p,line:l.line,type:"if"});continue}if(h==="for"){s+=1;const i=l.value.slice(3).trim(),p=i.indexOf(" in ");p===-1&&n(l.line,"Malformed {% for %} — expected `for <name> in <collection>`");const d=i.slice(0,p).trim(),c=i.slice(p+4).trim();(!d||!c)&&n(l.line,"Malformed {% for %} — missing binding or collection");const u=r(["endfor"]);(s>=t.length||t[s].type!=="stmt"||t[s].value.split(/\s+/)[0]!=="endfor")&&n(l.line,"Unterminated {% for %} — missing {% endfor %}"),s+=1,a.push({binding:d,body:u,collection:c,line:l.line,type:"for"});continue}if(h==="include"){s+=1;const i=l.value.slice(7).trim(),p=dt(i);p===void 0&&n(l.line,"Malformed {% include %} — expected a quoted partial name"),a.push({line:l.line,name:p,type:"include"});continue}n(l.line,`Unknown tag "{% ${h} %}". Supported: if, for, include.`)}return a};return r([])},dt=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},Ee=t=>t==null?"":typeof t=="boolean"||typeof t=="number"?String(t):typeof t=="string"?t:JSON.stringify(t),be=t=>t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:!0,mt=(t,e,s,n,r=!0)=>{const o=t.split(".");if(r&&o.length>0&&!Object.hasOwn(e,o[0]))throw new Error(`${n}:${s}: Variable "${t}" is not defined`);let a=e;for(const l of o){if(a==null)return;if(typeof a!="object")throw new TypeError(`${n}:${s}: Cannot read "${l}" on non-object value`);a=a[l]}return a},xe=t=>{const e=[];let s=0,n=0,r;for(let o=0;o<t.length;o+=1){const a=t[o];if(r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a==="|"&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},Ce=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r?{args:ft(r).map(o=>o.trim()),name:n}:{args:[],name:n}},_=(t,e,s,n,r=!0)=>{const o=t.trim();if(o==="true")return!0;if(o==="false")return!1;if(o==="null"||o==="none")return null;const a=dt(o);return a!==void 0?a:/^-?\d+(?:\.\d+)?$/.test(o)?Number(o):mt(o,e,s,n,r)},gt=(t,e,s,n,r=!0)=>{const o=xe(t),a=o[0].trim();let l=_(a,e,s,n,r);for(let h=1;h<o.length;h+=1){const i=o[h].trim(),{args:p,name:d}=Ce(i),c=p.map(u=>_(u,e,s,n,r));try{l=ct(d,l,c)}catch(u){const f=u instanceof Error?u.message:String(u);throw new Error(`${n}:${s}: ${f}`,{cause:u})}}return l},yt=(t,e)=>{let s,n=0;for(let r=0;r<=t.length-e.length;r+=1){const o=t[r];if(s){o===s&&(s=void 0);continue}if(o==='"'||o==="'"){s=o;continue}if(o==="("){n+=1;continue}if(o===")"){n-=1;continue}if(n===0&&t.slice(r,r+e.length)===e)return r}return-1},X=(t,e)=>{const s=[];let n=0,r=0;for(;r<=t.length-e.length;){const o=yt(t.slice(r),e);if(o===-1)break;s.push(t.slice(n,r+o)),r+=o+e.length,n=r}return s.push(t.slice(n)),s},U=(t,e,s,n)=>{const r=t.trim();if(r==="")return!1;if(r.startsWith("(")&&r.endsWith(")")&&je(r)===r.length-1)return U(r.slice(1,-1),e,s,n);const o=X(r," or ");if(o.length>1)return o.some(l=>U(l,e,s,n));const a=X(r," and ");if(a.length>1)return a.every(l=>U(l,e,s,n));if(r.startsWith("not "))return!U(r.slice(4),e,s,n);for(const l of["==","!="]){const h=yt(r,l);if(h!==-1){const i=_(r.slice(0,h),e,n,s,!1),p=_(r.slice(h+l.length),e,n,s,!1),d=i===p;return l==="=="?d:!d}}return be(gt(r,e,n,s,!1))},je=t=>{if(t[0]!=="(")return-1;let e=0,s,n=-1;for(const r of t){if(n+=1,s){r===s&&(s=void 0);continue}if(r==='"'||r==="'"){s=r;continue}if(r==="(")e+=1;else if(r===")"&&(e-=1,e===0))return n}return-1},P=(t,e)=>{let s="";for(const n of t){if(n.type==="text"){s+=n.value;continue}if(n.type==="expr"){s+=Ee(gt(n.expression,e.scope,n.line,e.filename));continue}if(n.type==="if"){const r=U(n.condition,e.scope,e.filename,n.line)?n.consequent:n.alternate??[];s+=P(r,e);continue}if(n.type==="for"){const r=mt(n.collection,e.scope,n.line,e.filename,!1);if(r==null)continue;if(!Array.isArray(r))throw new TypeError(`${e.filename}:${n.line}: {% for %} expected an array, got ${typeof r}`);for(const o of r){const a={...e.scope,[n.binding]:o};s+=P(n.body,{...e,scope:a})}continue}if(n.type==="include"){const r=e.partials?.get(n.name);if(!r)throw new Error(`${e.filename}:${n.line}: Partial "${n.name}" not found. Available: ${[...e.partials?.keys()??[]].join(", ")||"(none)"}`);const o=e.includeStack??new Set;if(o.has(n.name)){const a=[...o,n.name].join(" → ");throw new Error(`${e.filename}:${n.line}: Circular partial include detected: ${a}`)}o.add(n.name);try{s+=P(r,{...e,filename:`<partial:${n.name}>`,includeStack:o})}finally{o.delete(n.name)}}}return s},ke=(t,e)=>ht(pt(t),e),B=(t,e)=>P(ht(pt(t),e.filename),e),tt="template.yml",Le=".raw",We=new Set([".cjs",".css",".env",".gitattributes",".gitignore",".graphql",".html",".ini",".js",".json",".json5",".jsonc",".jsx",".lock",".md",".mdx",".mjs",".prettierrc",".raw",".rs",".scss",".sh",".sql",".svg",".tera",".toml",".ts",".tsx",".twig",".txt",".vue",".xml",".yaml",".yml"]),Ue=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),Se=t=>{const e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),s=e===-1?t:t.slice(e+1),n=s.lastIndexOf(".");return n===-1||n===0?"":s.slice(n).toLowerCase()},wt=t=>{const e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?t:t.slice(e+1)},Te=t=>{const e=Se(t);if(e!=="")return We.has(e);const s=wt(t);return Ue.has(s)},Oe=t=>{const e={default:t.default,internal:t.internal,order:t.order,prompt:t.prompt,required:t.required};switch(t.type){case"array":return{...e,type:"array"};case"boolean":return{...e,default:typeof e.default=="boolean"?e.default:void 0,type:"boolean"};case"enum":return{...e,multiple:t.multiple,type:"enum",values:t.values??[]};case"number":return{...e,type:"number"};case"string":return{...e,type:"string"};default:throw new Error(`Unsupported variable type "${String(t.type)}"`)}},Pe=t=>t.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),_e=(t,e,s)=>{const n=e.split("/").filter(Boolean);if(n.length===0)throw new Error("Empty destination path for value");let r=t;for(let o=0;o<n.length-1;o+=1){const a=n[o],l=r[a];if(l===void 0){const h={};r[a]=h,r=h}else if(typeof l=="object"&&!Buffer.isBuffer(l))r=l;else throw new TypeError(`Path conflict: "${n.slice(0,o+1).join("/")}" is both a file and a directory`)}r[n.at(-1)]=s},et=(t,e,s)=>{if(typeof t!="string")return Ie(t);const n=t.includes("{{")||t.includes("{%")?B(t,{filename:`${s}#frontmatter`,scope:e}):t;return U(n,e,`${s}#frontmatter`,1)},Ie=t=>t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:typeof t=="string"?t!=="false"&&t!=="0":!0,qe=(t,e)=>{const s=st(t,tt),n=At(s);if(!n||typeof n!="object")throw new Error(`${s}: must contain a YAML mapping`);const r={};if(n.variables)for(const[h,i]of Object.entries(n.variables))r[h]=Oe(i);const o=new Map,a=[];for(const h of qt(t,{includeDirs:!1,includeSymlinks:!1})){if(h.path===s)continue;const i=nt(t,h.path).replaceAll("\\","/");if(i===tt)continue;if(ye(i)){const c=O(h.path),u=ke(c,i);for(const f of Re(i))o.has(f)&&o.get(f)!==u&&bt.warn(`partial name "${f}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),o.set(f,u);continue}if(i.endsWith(Le)){const c=O(h.path);a.push({binary:null,isRaw:!0,rawText:c,relativePath:i});continue}if(Te(i)){const c=O(h.path);a.push({binary:null,isRaw:!1,rawText:c,relativePath:i});continue}const d=O(h.path,{buffer:!0});a.push({binary:d,isRaw:!1,rawText:null,relativePath:i})}const l=h=>{const i={...h.builtins,...h.options},p={},d={};for(const u of a){const f=u.relativePath;let g,y,m=!1;if(u.binary)g=u.binary;else if(u.isRaw)g=u.rawText??"";else{const $=u.rawText??"",A=we($,T=>Et(T));if(A.frontmatter){if(A.frontmatter.skip!==void 0&&et(A.frontmatter.skip,i,f)||A.frontmatter.if!==void 0&&!et(A.frontmatter.if,i,f))continue;typeof A.frontmatter.to=="string"&&(y=B(A.frontmatter.to,{filename:`${f}#frontmatter.to`,partials:o,scope:i})),A.frontmatter.force===!0&&(m=!0)}g=B(A.body,{filename:f,partials:o,scope:i})}const w=Pe(y??me(ge(f),i));_e(p,w,g),m&&(d[w]={force:!0})}const c={files:p};return Object.keys(d).length>0&&(c.filesMeta=d),c};return{about:{description:n.description??`Moon-format template at ${t}`,name:n.title??e},destination:n.destination,options:r,produce:l}},Re=t=>{const e=ut(t),s=wt(e),n=new Set([s,e]);if(s.startsWith("_")){n.add(s.replace(/^_+/,""));const r=e.slice(0,e.length-s.length);n.add(`${r}${s.replace(/^_+/,"")}`)}return[...n]};export{qe as loadMoonTemplate};
7
+ `&&(n+=1)};for(const o of t.matchAll($e)){const a=o.index??0;if(a>s){const i=t.slice(s,a);e.push({line:n,type:"text",value:i}),r(i)}const l=n,h=o[0];h.startsWith("{{")?e.push({line:l,type:"expr",value:(o[1]??"").trim()}):e.push({line:l,type:"stmt",value:(o[2]??"").trim()}),r(h),s=a+h.length}if(s<t.length){const o=t.slice(s);e.push({line:n,type:"text",value:o})}return e},Ae=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),ht=(t,e)=>{let s=0;const n=(o,a)=>{throw new Error(`${e}:${o}: ${a}`)},r=o=>{const a=[];for(;s<t.length;){const l=t[s];if(l.type==="text"){a.push({type:"text",value:l.value}),s+=1;continue}if(l.type==="expr"){a.push({expression:l.value,line:l.line,type:"expr"}),s+=1;continue}const h=l.value.split(/\s+/)[0]??"";if(o.includes(h))return a;if(Ae.has(h)&&n(l.line,`Tera feature "{% ${h} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),h==="if"){s+=1;const i=l.value.slice(2).trim(),p=r(["else","endif"]);let d;s<t.length&&t[s].type==="stmt"&&t[s].value.split(/\s+/)[0]==="else"&&(s+=1,d=r(["endif"])),(s>=t.length||t[s].type!=="stmt"||t[s].value.split(/\s+/)[0]!=="endif")&&n(l.line,"Unterminated {% if %} — missing {% endif %}"),s+=1,a.push({alternate:d,condition:i,consequent:p,line:l.line,type:"if"});continue}if(h==="for"){s+=1;const i=l.value.slice(3).trim(),p=i.indexOf(" in ");p===-1&&n(l.line,"Malformed {% for %} — expected `for <name> in <collection>`");const d=i.slice(0,p).trim(),c=i.slice(p+4).trim();(!d||!c)&&n(l.line,"Malformed {% for %} — missing binding or collection");const u=r(["endfor"]);(s>=t.length||t[s].type!=="stmt"||t[s].value.split(/\s+/)[0]!=="endfor")&&n(l.line,"Unterminated {% for %} — missing {% endfor %}"),s+=1,a.push({binding:d,body:u,collection:c,line:l.line,type:"for"});continue}if(h==="include"){s+=1;const i=l.value.slice(7).trim(),p=dt(i);p===void 0&&n(l.line,"Malformed {% include %} — expected a quoted partial name"),a.push({line:l.line,name:p,type:"include"});continue}n(l.line,`Unknown tag "{% ${h} %}". Supported: if, for, include.`)}return a};return r([])},dt=t=>{if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1)},Ee=t=>t==null?"":typeof t=="boolean"||typeof t=="number"?String(t):typeof t=="string"?t:JSON.stringify(t),be=t=>t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:!0,mt=(t,e,s,n,r=!0)=>{const o=t.split(".");if(r&&o.length>0&&!Object.hasOwn(e,o[0]))throw new Error(`${n}:${s}: Variable "${t}" is not defined`);let a=e;for(const l of o){if(a==null)return;if(typeof a!="object")throw new TypeError(`${n}:${s}: Cannot read "${l}" on non-object value`);a=a[l]}return a},xe=t=>{const e=[];let s=0,n=0,r;for(let o=0;o<t.length;o+=1){const a=t[o];if(r){a===r&&(r=void 0);continue}if(a==='"'||a==="'"){r=a;continue}a==="("?s+=1:a===")"?s-=1:a==="|"&&s===0&&(e.push(t.slice(n,o)),n=o+1)}return e.push(t.slice(n)),e},Ce=t=>{const e=t.trim(),s=e.indexOf("(");if(s===-1)return{args:[],name:e};if(!e.endsWith(")"))throw new Error(`Filter call "${t}" missing closing ")"`);const n=e.slice(0,s).trim(),r=e.slice(s+1,-1).trim();return r?{args:ft(r).map(o=>o.trim()),name:n}:{args:[],name:n}},P=(t,e,s,n,r=!0)=>{const o=t.trim();if(o==="true")return!0;if(o==="false")return!1;if(o==="null"||o==="none")return null;const a=dt(o);return a!==void 0?a:/^-?\d+(?:\.\d+)?$/.test(o)?Number(o):mt(o,e,s,n,r)},gt=(t,e,s,n,r=!0)=>{const o=xe(t),a=o[0].trim();let l=P(a,e,s,n,r);for(let h=1;h<o.length;h+=1){const i=o[h].trim(),{args:p,name:d}=Ce(i),c=p.map(u=>P(u,e,s,n,r));try{l=ct(d,l,c)}catch(u){const f=u instanceof Error?u.message:String(u);throw new Error(`${n}:${s}: ${f}`,{cause:u})}}return l},yt=(t,e)=>{let s,n=0;for(let r=0;r<=t.length-e.length;r+=1){const o=t[r];if(s){o===s&&(s=void 0);continue}if(o==='"'||o==="'"){s=o;continue}if(o==="("){n+=1;continue}if(o===")"){n-=1;continue}if(n===0&&t.slice(r,r+e.length)===e)return r}return-1},H=(t,e)=>{const s=[];let n=0,r=0;for(;r<=t.length-e.length;){const o=yt(t.slice(r),e);if(o===-1)break;s.push(t.slice(n,r+o)),r+=o+e.length,n=r}return s.push(t.slice(n)),s},S=(t,e,s,n)=>{const r=t.trim();if(r==="")return!1;if(r.startsWith("(")&&r.endsWith(")")&&je(r)===r.length-1)return S(r.slice(1,-1),e,s,n);const o=H(r," or ");if(o.length>1)return o.some(l=>S(l,e,s,n));const a=H(r," and ");if(a.length>1)return a.every(l=>S(l,e,s,n));if(r.startsWith("not "))return!S(r.slice(4),e,s,n);for(const l of["==","!="]){const h=yt(r,l);if(h!==-1){const i=P(r.slice(0,h),e,n,s,!1),p=P(r.slice(h+l.length),e,n,s,!1),d=i===p;return l==="=="?d:!d}}return be(gt(r,e,n,s,!1))},je=t=>{if(t[0]!=="(")return-1;let e=0,s,n=-1;for(const r of t){if(n+=1,s){r===s&&(s=void 0);continue}if(r==='"'||r==="'"){s=r;continue}if(r==="(")e+=1;else if(r===")"&&(e-=1,e===0))return n}return-1},_=(t,e)=>{let s="";for(const n of t){if(n.type==="text"){s+=n.value;continue}if(n.type==="expr"){s+=Ee(gt(n.expression,e.scope,n.line,e.filename));continue}if(n.type==="if"){const r=S(n.condition,e.scope,e.filename,n.line)?n.consequent:n.alternate??[];s+=_(r,e);continue}if(n.type==="for"){const r=mt(n.collection,e.scope,n.line,e.filename,!1);if(r==null)continue;if(!Array.isArray(r))throw new TypeError(`${e.filename}:${n.line}: {% for %} expected an array, got ${typeof r}`);for(const o of r){const a={...e.scope,[n.binding]:o};s+=_(n.body,{...e,scope:a})}continue}if(n.type==="include"){const r=e.partials?.get(n.name);if(!r)throw new Error(`${e.filename}:${n.line}: Partial "${n.name}" not found. Available: ${[...e.partials?.keys()??[]].join(", ")||"(none)"}`);const o=e.includeStack??new Set;if(o.has(n.name)){const a=[...o,n.name].join(" → ");throw new Error(`${e.filename}:${n.line}: Circular partial include detected: ${a}`)}o.add(n.name);try{s+=_(r,{...e,filename:`<partial:${n.name}>`,includeStack:o})}finally{o.delete(n.name)}}}return s},ke=(t,e)=>ht(pt(t),e),B=(t,e)=>_(ht(pt(t),e.filename),e),tt="template.yml",Le=".raw",We=new Set([".cjs",".css",".env",".gitattributes",".gitignore",".graphql",".html",".ini",".js",".json",".json5",".jsonc",".jsx",".lock",".md",".mdx",".mjs",".prettierrc",".raw",".rs",".scss",".sh",".sql",".svg",".tera",".toml",".ts",".tsx",".twig",".txt",".vue",".xml",".yaml",".yml"]),Se=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),Ue=t=>{const e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),s=e===-1?t:t.slice(e+1),n=s.lastIndexOf(".");return n===-1||n===0?"":s.slice(n).toLowerCase()},wt=t=>{const e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?t:t.slice(e+1)},Te=t=>{const e=Ue(t);if(e!=="")return We.has(e);const s=wt(t);return Se.has(s)},Oe=t=>{const e={default:t.default,internal:t.internal,order:t.order,prompt:t.prompt,required:t.required};switch(t.type){case"array":return{...e,type:"array"};case"boolean":return{...e,default:typeof e.default=="boolean"?e.default:void 0,type:"boolean"};case"enum":return{...e,multiple:t.multiple,type:"enum",values:t.values??[]};case"number":return{...e,type:"number"};case"string":return{...e,type:"string"};default:throw new Error(`Unsupported variable type "${String(t.type)}"`)}},_e=t=>t.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),Pe=(t,e,s)=>{const n=e.split("/").filter(Boolean);if(n.length===0)throw new Error("Empty destination path for value");let r=t;for(let o=0;o<n.length-1;o+=1){const a=n[o],l=r[a];if(l===void 0){const h={};r[a]=h,r=h}else if(typeof l=="object"&&!Buffer.isBuffer(l))r=l;else throw new TypeError(`Path conflict: "${n.slice(0,o+1).join("/")}" is both a file and a directory`)}r[n.at(-1)]=s},et=(t,e,s)=>{if(typeof t!="string")return Ie(t);const n=t.includes("{{")||t.includes("{%")?B(t,{filename:`${s}#frontmatter`,scope:e}):t;return S(n,e,`${s}#frontmatter`,1)},Ie=t=>t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:typeof t=="string"?t!=="false"&&t!=="0":!0,qe=(t,e)=>{const s=st(t,tt),n=At(s);if(!n||typeof n!="object")throw new Error(`${s}: must contain a YAML mapping`);const r={};if(n.variables)for(const[h,i]of Object.entries(n.variables))r[h]=Oe(i);const o=new Map,a=[];for(const h of qt(t,{includeDirs:!1,includeSymlinks:!1})){if(h.path===s)continue;const i=nt(t,h.path).replaceAll("\\","/");if(i===tt)continue;if(ye(i)){const c=O(h.path),u=ke(c,i);for(const f of Re(i))o.has(f)&&o.get(f)!==u&&bt.warn(`partial name "${f}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),o.set(f,u);continue}if(i.endsWith(Le)){const c=O(h.path);a.push({binary:null,isRaw:!0,rawText:c,relativePath:i});continue}if(Te(i)){const c=O(h.path);a.push({binary:null,isRaw:!1,rawText:c,relativePath:i});continue}const d=O(h.path,{buffer:!0});a.push({binary:d,isRaw:!1,rawText:null,relativePath:i})}const l=h=>{const i={...h.builtins,...h.options},p={},d={};for(const u of a){const f=u.relativePath;let g,y,m=!1;if(u.binary)g=u.binary;else if(u.isRaw)g=u.rawText??"";else{const $=u.rawText??"",A=we($,T=>Et(T));if(A.frontmatter){if(A.frontmatter.skip!==void 0&&et(A.frontmatter.skip,i,f)||A.frontmatter.if!==void 0&&!et(A.frontmatter.if,i,f))continue;typeof A.frontmatter.to=="string"&&(y=B(A.frontmatter.to,{filename:`${f}#frontmatter.to`,partials:o,scope:i})),A.frontmatter.force===!0&&(m=!0)}g=B(A.body,{filename:f,partials:o,scope:i})}const w=_e(y??me(ge(f),i));Pe(p,w,g),m&&(d[w]={force:!0})}const c={files:p};return Object.keys(d).length>0&&(c.filesMeta=d),c};return{about:{description:n.description??`Moon-format template at ${t}`,name:n.title??e},destination:n.destination,options:r,produce:l}},Re=t=>{const e=ut(t),s=wt(e),n=new Set([s,e]);if(s.startsWith("_")){n.add(s.replace(/^_+/,""));const r=e.slice(0,e.length-s.length);n.add(`${r}${s.replace(/^_+/,"")}`)}return[...n]};export{qe as loadMoonTemplate};
@@ -1,4 +1,4 @@
1
- import{p as s}from"./cli-main.js";import{c as a,f as c}from"../packem_shared/registry-keys-z038Ecb4.js";const f=async({options:r})=>{if(r.clear){const t=a();if(r.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
1
+ import{p as s}from"./cli-main.js";import{c as a,f as c}from"../packem_shared/registry-keys-CE-RZlp_.js";const f=async({options:r})=>{if(r.clear){const t=a();if(r.json){process.stdout.write(`${JSON.stringify({cleared:t,refetched:!1},void 0,2)}
2
2
  `);return}s.success(t?"Cleared cached npm signing keys.":"No cached npm signing keys to clear.");return}const e=await c({forceRefresh:!0});if(e===void 0){if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,error:"fetch-failed",refetched:!1},void 0,2)}
3
3
  `),process.exitCode=1;return}s.error("Failed to fetch npm signing keys (network error and no cached keys available)."),process.exitCode=1;return}if(r.json){process.stdout.write(`${JSON.stringify({cleared:!1,fromCache:e.fromCache,keyCount:e.keys.length,refetched:!e.fromCache,stale:e.stale??!1},void 0,2)}
4
4
  `);return}if(e.fromCache&&e.stale===!0){s.warn(`Network fetch failed — falling back to expired cache (${String(e.keys.length)} keys).`);return}s.success(`Refreshed npm signing keys (${String(e.keys.length)} keys).`)};export{f as default};
@@ -1,3 +1,3 @@
1
- import{v as d,U as a}from"../packem_shared/index-BzhrR_iC.js";import{r as m}from"../packem_shared/resolve-runtime-DNukUjIr.js";import{r as l}from"../packem_shared/run-file-UBukWaha.js";const p=s=>{let r,o=!1,n;const i=[];for(let e=0;e<s.length;e+=1){const t=s[e];if(n===void 0){if(t==="--node"){o=!0;continue}if(t==="--runtime"){r=s[e+1],e+=1;continue}if(t.startsWith("--runtime=")){r=t.slice(10);continue}n=t;continue}i.push(t)}return i[0]==="--"&&i.shift(),{file:n,node:o,runtimeFlag:r,scriptArguments:i}},w=async s=>{const{file:r,node:o,runtimeFlag:n,scriptArguments:i}=p(s);if(r===void 0){process.stderr.write(`No file specified. Usage: vis x <file> [args...]
1
+ import{v as d,U as a}from"../packem_shared/index-0dnGN3GP.js";import{r as m}from"../packem_shared/resolve-runtime-D8rxuo3J.js";import{r as l}from"../packem_shared/run-file-D1mlOnd8.js";const p=s=>{let r,o=!1,n;const i=[];for(let e=0;e<s.length;e+=1){const t=s[e];if(n===void 0){if(t==="--node"){o=!0;continue}if(t==="--runtime"){r=s[e+1],e+=1;continue}if(t.startsWith("--runtime=")){r=t.slice(10);continue}n=t;continue}i.push(t)}return i[0]==="--"&&i.shift(),{file:n,node:o,runtimeFlag:r,scriptArguments:i}},w=async s=>{const{file:r,node:o,runtimeFlag:n,scriptArguments:i}=p(s);if(r===void 0){process.stderr.write(`No file specified. Usage: vis x <file> [args...]
2
2
  `),process.exitCode=1;return}const e=process.cwd(),t=d(r)?r:a(e,r);if(o){const c=await l(t,i,"node",e,{node:!0});c!==0&&(process.exitCode=c);return}let u;try{u=m(e,{flag:n})}catch(c){process.stderr.write(`${c.message}
3
3
  `),process.exitCode=1;return}const f=await l(t,i,u.runtime,e);f!==0&&(process.exitCode=f)};export{p as parseLeanXArgs,w as runLeanX};
@@ -1,3 +1,3 @@
1
- import{createRequire as _}from"node:module";import{l as R,p as t,m as x}from"./cli-main.js";import{d as P}from"../packem_shared/pm-runner-RM72mDZg.js";import{a as M}from"../packem_shared/build-scripts-CEDx_nJp.js";import{e as v}from"../packem_shared/index-BzhrR_iC.js";import{y as k}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{p as q}from"../packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js";let j;const B=c=>(j??=_(import.meta.url))(c),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[i,f]=y.versions.node.split(".").map(Number);if(i>22||i===22&&f>=3||i===20&&f>=16)return y.getBuiltinModule(c)}return B(c)},{readdirSync:S,statSync:N}=D("node:fs"),T=(c,i={})=>{const f=v(c,"node_modules");if(!k(f))return[];const l=new Map,p=new Set,b=(n,o,r)=>{const e=`${o}@${r}`;if(p.has(e))return;p.add(e);const s=r.startsWith(c)?r.slice(c.length+1):r;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===o)||u.push({name:o,relativePath:s})},m=(n,o="")=>{let r;try{r=S(n)}catch{return}for(const e of r){const s=v(n,e);if(e.startsWith("@")){m(s,`${e}/`);continue}if(e===".pnpm"&&o===""){let a;try{a=S(s)}catch{continue}for(const d of a){const g=v(s,d,"node_modules");k(g)&&m(g)}continue}if(e.startsWith("."))continue;const u=o+e,$=v(s,"package.json");try{if(!N(s).isDirectory()||!k($))continue;const a=q($),d=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const w=d.includes("/")?d.split("/").pop():d;b(w,d,s)}else if(a.bin&&typeof a.bin=="object")for(const w of Object.keys(a.bin))b(w,d,s);const g=v(s,"node_modules");k(g)&&m(g)}catch{}}};m(f);const h=[];for(const[n,o]of l)o.length<2||i[n]===!0||o.every(e=>i[`${e.name}#${n}`]===!0)||h.push({bin:n,packages:o});return h.sort((n,o)=>n.bin.localeCompare(o.bin))},V=new Set(["bun","npm","pnpm","yarn"]),F=({options:c,visConfig:i,workspaceRoot:f})=>{const l=f??process.cwd(),p=P(l),b=i?.security?.policies?.installScripts?.allow??{},m=i?.security?.allowBins??{},h=i?.security?.pinVersions===!0,n=M(l,b,{pinVersions:h}),o=T(l,m),r=i&&V.has(p.name)?R(i,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:o,drift:r,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:h,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
1
+ import{createRequire as _}from"node:module";import{m as R,p as t,n as x}from"./cli-main.js";import{d as P}from"../packem_shared/pm-runner-Dboj-wZG.js";import{a as M}from"../packem_shared/build-scripts-BeMIA-_q.js";import{e as v}from"../packem_shared/index-0dnGN3GP.js";import{y as k}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{p as q}from"../packem_shared/package-version-x7sPg2TM.js";let j;const B=c=>(j??=_(import.meta.url))(c),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,D=c=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[i,f]=y.versions.node.split(".").map(Number);if(i>22||i===22&&f>=3||i===20&&f>=16)return y.getBuiltinModule(c)}return B(c)},{readdirSync:S,statSync:N}=D("node:fs"),T=(c,i={})=>{const f=v(c,"node_modules");if(!k(f))return[];const l=new Map,p=new Set,b=(n,o,r)=>{const e=`${o}@${r}`;if(p.has(e))return;p.add(e);const s=r.startsWith(c)?r.slice(c.length+1):r;let u=l.get(n);u||(u=[],l.set(n,u)),u.some($=>$.name===o)||u.push({name:o,relativePath:s})},m=(n,o="")=>{let r;try{r=S(n)}catch{return}for(const e of r){const s=v(n,e);if(e.startsWith("@")){m(s,`${e}/`);continue}if(e===".pnpm"&&o===""){let a;try{a=S(s)}catch{continue}for(const d of a){const g=v(s,d,"node_modules");k(g)&&m(g)}continue}if(e.startsWith("."))continue;const u=o+e,$=v(s,"package.json");try{if(!N(s).isDirectory()||!k($))continue;const a=q($),d=typeof a.name=="string"?a.name:u;if(typeof a.bin=="string"){const w=d.includes("/")?d.split("/").pop():d;b(w,d,s)}else if(a.bin&&typeof a.bin=="object")for(const w of Object.keys(a.bin))b(w,d,s);const g=v(s,"node_modules");k(g)&&m(g)}catch{}}};m(f);const h=[];for(const[n,o]of l)o.length<2||i[n]===!0||o.every(e=>i[`${e.name}#${n}`]===!0)||h.push({bin:n,packages:o});return h.sort((n,o)=>n.bin.localeCompare(o.bin))},V=new Set(["bun","npm","pnpm","yarn"]),F=({options:c,visConfig:i,workspaceRoot:f})=>{const l=f??process.cwd(),p=P(l),b=i?.security?.policies?.installScripts?.allow??{},m=i?.security?.allowBins??{},h=i?.security?.pinVersions===!0,n=M(l,b,{pinVersions:h}),o=T(l,m),r=i&&V.has(p.name)?R(i,p.name,l):void 0;if(c.json){process.stdout.write(`${JSON.stringify({binConflicts:o,drift:r,excess:n.excess,installed:n.installed.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),packageManager:p.name,pinVersions:h,unapproved:n.unapproved.map(e=>({hooks:e.hooks,name:e.name,version:e.version})),versionDrift:n.versionDrift},void 0,2)}
2
2
  `);return}if(t.info(`Build-script status (${p.name}):
3
3
  `),n.installed.length===0&&n.unapproved.length===0&&t.success(" No installed packages declare lifecycle scripts."),n.installed.length>0){t.success(` Approved (${String(n.installed.length)}):`);for(const e of n.installed)t.info(` ✓ ${e.name} — ${e.hooks.join(", ")}`)}if(n.unapproved.length>0){t.info(""),t.warn(` Unapproved (${String(n.unapproved.length)}):`);for(const e of n.unapproved)t.info(` ✗ ${e.name} — ${e.hooks.join(", ")}`);t.notice(" Run 'vis approve-builds' to review.")}if(n.excess.length>0){t.info(""),t.warn(` Stale allowlist entries (${String(n.excess.length)}):`);for(const e of n.excess)t.info(` ! ${e}`);t.notice(" Remove these from vis.config.ts security.policies.installScripts.allow.")}if(n.versionDrift.length>0){t.info(""),t.warn(` Version drift (pinVersions: true) — ${String(n.versionDrift.length)} entr${n.versionDrift.length===1?"y":"ies"} point at outdated versions:`);for(const{from:e,to:s}of n.versionDrift)t.info(` ${e} → ${s}`);t.notice(" Update vis.config.ts security.policies.installScripts.allow keys to migrate.")}if(o.length>0){t.info(""),t.warn(` Bin conflicts (${String(o.length)}) — multiple packages expose the same bin name:`);for(const e of o)t.info(` ${e.bin} ← ${e.packages.map(s=>s.name).join(", ")}`);t.notice(" Add the bin (or 'pkg#bin') to vis.config.ts security.allowBins to silence this.")}if(r?.hasDrift){t.info("");for(const e of x(r))t.warn(e)}};export{F as default};
@@ -1,4 +1,4 @@
1
- import{createRequire as f}from"node:module";import{d as p,c as I}from"../packem_shared/pm-runner-RM72mDZg.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-Dboj-wZG.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,3 +1,3 @@
1
- import{p as o}from"./cli-main.js";import{r as f}from"../packem_shared/advisories-DO-P0V1_.js";const d=async({fs:c,logger:u,options:r,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const e=r.db??f(t),s=r.format==="json";if(!r.force){o.warn(`Prune is destructive. Will remove: ${e}`),o.info("Re-run with --force to proceed."),s&&process.stdout.write(`${JSON.stringify({dbPath:e,reason:"needs --force",removed:!1})}
1
+ import{p as o}from"./cli-main.js";import{r as f}from"../packem_shared/advisories-DHGJ6XhP.js";const d=async({fs:c,logger:u,options:r,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a workspace.");const e=r.db??f(t),s=r.format==="json";if(!r.force){o.warn(`Prune is destructive. Will remove: ${e}`),o.info("Re-run with --force to proceed."),s&&process.stdout.write(`${JSON.stringify({dbPath:e,reason:"needs --force",removed:!1})}
2
2
  `);return}const a=[e,`${e}-wal`,`${e}-shm`,`${e}-journal`],i=[];for(const n of a)try{await c.rm(n,{force:!0}),i.push(n)}catch{}if(s){process.stdout.write(`${JSON.stringify({dbPath:e,files:i,removed:!0})}
3
3
  `);return}o.success(`Removed ${e}.`)},v=d;export{v as advisoriesPruneExecute};
@@ -1 +1 @@
1
- import{p as s,d as a,f as p}from"./cli-main.js";const f=({options:t,visConfig:i,workspaceRoot:c})=>{const r=c??process.cwd(),l=i?.security?.policies?.installScripts?.allow??{},e=Object.entries(l).filter(([,o])=>o).map(([o])=>o);e.length===0&&!t.rootOnly&&(s.warn("No approved packages in security.policies.installScripts.allow — nothing to run."),!t.withRoot)||(t.rootOnly||a(r,e),(t.withRoot||t.rootOnly)&&p(r))};export{f as default};
1
+ import{p as s,f as a,g as p}from"./cli-main.js";const f=({options:t,visConfig:i,workspaceRoot:c})=>{const r=c??process.cwd(),l=i?.security?.policies?.installScripts?.allow??{},e=Object.entries(l).filter(([,o])=>o).map(([o])=>o);e.length===0&&!t.rootOnly&&(s.warn("No approved packages in security.policies.installScripts.allow — nothing to run."),!t.withRoot)||(t.rootOnly||a(r,e),(t.withRoot||t.rootOnly)&&p(r))};export{f as default};
@@ -1,2 +1,2 @@
1
- import{b as d,F as i,J as l}from"../packem_shared/index.server-Ca_EEVfw.js";import{p as a}from"./cli-main.js";import{r as y,g}from"../packem_shared/advisories-DO-P0V1_.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-Ca_EEVfw.js";import{p as a}from"./cli-main.js";import{r as y,g}from"../packem_shared/advisories-DHGJ6XhP.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-Ca_EEVfw.js";import{p as c}from"./cli-main.js";import{s as S}from"../packem_shared/scan-progress-DymX71_5.js";import{D as $,s as b,A as D}from"../packem_shared/advisories-DO-P0V1_.js";import{c as w}from"../packem_shared/multi-eco-lockfiles-fgkpeHJv.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-Ca_EEVfw.js";import{p as c}from"./cli-main.js";import{s as S}from"../packem_shared/scan-progress-CY3XIDOY.js";import{D as $,s as b,A as D}from"../packem_shared/advisories-DHGJ6XhP.js";import{c as w}from"../packem_shared/multi-eco-lockfiles-D5tM7pkg.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-RM72mDZg.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-Dboj-wZG.js";import{s as p}from"../packem_shared/native-config-sync-DDGt3vvd.js";import{s as g}from"../packem_shared/min-release-age-yvuPbJ8G.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,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-RM72mDZg.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-0dnGN3GP.js";import{p as e}from"./cli-main.js";import{d as _}from"../packem_shared/pm-runner-Dboj-wZG.js";import{y as u}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{p as m}from"../packem_shared/package-version-x7sPg2TM.js";import{U as $}from"../packem_shared/env-BymuoTL8.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};
@@ -1,4 +1,4 @@
1
- import{createRequire as ze}from"node:module";import{z as D,f as Ke,c as Ce,r as et,T as tt,C as nt,U as j,m as L,a as P,k as X,e as h,g as Ne,v as me,G as Y,t as ot,L as it}from"../packem_shared/index-BzhrR_iC.js";import{parse as st}from"./index4.js";import{L as ge}from"../packem_shared/index-BisalDCf.js";import{y as $}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";import{transformTs as Le}from"#native";let Qe;const Xe=e=>(Qe??=ze(import.meta.url))(e),U=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,fe=e=>{if(typeof U<"u"&&U.versions&&U.versions.node){const[n,i]=U.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return U.getBuiltinModule(e)}return Xe(e)},{readFileSync:ae,writeFileSync:Ye,unlinkSync:Ze,statSync:$e}=fe("node:fs"),re=fe("node:module"),{createRequire:je}=re,{pathToFileURL:Q,fileURLToPath:G}=fe("node:url");function rt(e,n,i){const{beforeParse:t,buffer:o,compression:r,encoding:s="utf8",flag:f}={},c=D(e,{buffer:o,compression:r,encoding:s,flag:f}),u=typeof t=="function"?t(c):c;return Ke.parse(u,n)}function lt(e,n=!1){const i=e.length;let t=0,o="",r=0,s=16,f=0,c=0,u=0,a=0,m=0;function v(l,O){let k=0,g=0;for(;k<l;){let p=e.charCodeAt(t);if(p>=48&&p<=57)g=g*16+p-48;else if(p>=65&&p<=70)g=g*16+p-65+10;else if(p>=97&&p<=102)g=g*16+p-97+10;else break;t++,k++}return k<l&&(g=-1),g}function b(l){t=l,o="",r=0,s=16,m=0}function y(){let l=t;if(e.charCodeAt(t)===48)t++;else for(t++;t<e.length&&R(e.charCodeAt(t));)t++;if(t<e.length&&e.charCodeAt(t)===46)if(t++,t<e.length&&R(e.charCodeAt(t)))for(t++;t<e.length&&R(e.charCodeAt(t));)t++;else return m=3,e.substring(l,t);let O=t;if(t<e.length&&(e.charCodeAt(t)===69||e.charCodeAt(t)===101))if(t++,(t<e.length&&e.charCodeAt(t)===43||e.charCodeAt(t)===45)&&t++,t<e.length&&R(e.charCodeAt(t))){for(t++;t<e.length&&R(e.charCodeAt(t));)t++;O=t}else m=3;return e.substring(l,O)}function A(){let l="",O=t;for(;;){if(t>=i){l+=e.substring(O,t),m=2;break}const k=e.charCodeAt(t);if(k===34){l+=e.substring(O,t),t++;break}if(k===92){if(l+=e.substring(O,t),t++,t>=i){m=2;break}switch(e.charCodeAt(t++)){case 34:l+='"';break;case 92:l+="\\";break;case 47:l+="/";break;case 98:l+="\b";break;case 102:l+="\f";break;case 110:l+=`
1
+ import{createRequire as ze}from"node:module";import{z as D,c as Ke,f as Ce,r as et,T as tt,C as nt,U as j,m as L,a as P,k as X,e as h,g as Ne,v as me,G as Y,t as ot,L as it}from"../packem_shared/index-0dnGN3GP.js";import{parse as st}from"./index4.js";import{L as ge}from"../packem_shared/index-BisalDCf.js";import{y as $}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{transformTs as Le}from"#native";let Qe;const Xe=e=>(Qe??=ze(import.meta.url))(e),U=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,fe=e=>{if(typeof U<"u"&&U.versions&&U.versions.node){const[n,i]=U.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return U.getBuiltinModule(e)}return Xe(e)},{readFileSync:ae,writeFileSync:Ye,unlinkSync:Ze,statSync:$e}=fe("node:fs"),re=fe("node:module"),{createRequire:je}=re,{pathToFileURL:Q,fileURLToPath:G}=fe("node:url");function rt(e,n,i){const{beforeParse:t,buffer:o,compression:r,encoding:s="utf8",flag:f}={},c=D(e,{buffer:o,compression:r,encoding:s,flag:f}),u=typeof t=="function"?t(c):c;return Ke.parse(u,n)}function lt(e,n=!1){const i=e.length;let t=0,o="",r=0,s=16,f=0,c=0,u=0,a=0,m=0;function v(l,O){let k=0,g=0;for(;k<l;){let p=e.charCodeAt(t);if(p>=48&&p<=57)g=g*16+p-48;else if(p>=65&&p<=70)g=g*16+p-65+10;else if(p>=97&&p<=102)g=g*16+p-97+10;else break;t++,k++}return k<l&&(g=-1),g}function b(l){t=l,o="",r=0,s=16,m=0}function y(){let l=t;if(e.charCodeAt(t)===48)t++;else for(t++;t<e.length&&R(e.charCodeAt(t));)t++;if(t<e.length&&e.charCodeAt(t)===46)if(t++,t<e.length&&R(e.charCodeAt(t)))for(t++;t<e.length&&R(e.charCodeAt(t));)t++;else return m=3,e.substring(l,t);let O=t;if(t<e.length&&(e.charCodeAt(t)===69||e.charCodeAt(t)===101))if(t++,(t<e.length&&e.charCodeAt(t)===43||e.charCodeAt(t)===45)&&t++,t<e.length&&R(e.charCodeAt(t))){for(t++;t<e.length&&R(e.charCodeAt(t));)t++;O=t}else m=3;return e.substring(l,O)}function A(){let l="",O=t;for(;;){if(t>=i){l+=e.substring(O,t),m=2;break}const k=e.charCodeAt(t);if(k===34){l+=e.substring(O,t),t++;break}if(k===92){if(l+=e.substring(O,t),t++,t>=i){m=2;break}switch(e.charCodeAt(t++)){case 34:l+='"';break;case 92:l+="\\";break;case 47:l+="/";break;case 98:l+="\b";break;case 102:l+="\f";break;case 110:l+=`
2
2
  `;break;case 114:l+="\r";break;case 116:l+=" ";break;case 117:const p=v(4);p>=0?l+=String.fromCharCode(p):m=4;break;default:m=5}O=t;continue}if(k>=0&&k<=31)if(x(k)){l+=e.substring(O,t),m=2;break}else m=6;t++}return l}function N(){if(o="",m=0,r=t,c=f,a=u,t>=i)return r=i,s=17;let l=e.charCodeAt(t);if(ee(l)){do t++,o+=String.fromCharCode(l),l=e.charCodeAt(t);while(ee(l));return s=15}if(x(l))return t++,o+=String.fromCharCode(l),l===13&&e.charCodeAt(t)===10&&(t++,o+=`
3
3
  `),f++,u=t,s=14;switch(l){case 123:return t++,s=1;case 125:return t++,s=2;case 91:return t++,s=3;case 93:return t++,s=4;case 58:return t++,s=6;case 44:return t++,s=5;case 34:return t++,o=A(),s=10;case 47:const O=t-1;if(e.charCodeAt(t+1)===47){for(t+=2;t<i&&!x(e.charCodeAt(t));)t++;return o=e.substring(O,t),s=12}if(e.charCodeAt(t+1)===42){t+=2;const k=i-1;let g=!1;for(;t<k;){const p=e.charCodeAt(t);if(p===42&&e.charCodeAt(t+1)===47){t+=2,g=!0;break}t++,x(p)&&(p===13&&e.charCodeAt(t)===10&&t++,f++,u=t)}return g||(t++,m=1),o=e.substring(O,t),s=13}return o+=String.fromCharCode(l),t++,s=16;case 45:if(o+=String.fromCharCode(l),t++,t===i||!R(e.charCodeAt(t)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=y(),s=11;default:for(;t<i&&_(l);)t++,l=e.charCodeAt(t);if(r!==t){switch(o=e.substring(r,t),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(l),t++,s=16}}function _(l){if(ee(l)||x(l))return!1;switch(l){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function d(){let l;do l=N();while(l>=12&&l<=15);return l}return{setPosition:b,getPosition:()=>t,scan:n?d:N,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>r,getTokenLength:()=>t-r,getTokenStartLine:()=>c,getTokenStartCharacter:()=>r-a,getTokenError:()=>m}}function ee(e){return e===32||e===9}function x(e){return e===10||e===13}function R(e){return e>=48&&e<=57}var Oe;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(Oe||(Oe={}));var Z;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Z||(Z={}));function ct(e,n=[],i=Z.DEFAULT){let t=null,o=[];const r=[];function s(c){Array.isArray(o)?o.push(c):t!==null&&(o[t]=c)}return ut(e,{onObjectBegin:()=>{const c={};s(c),r.push(o),o=c,t=null},onObjectProperty:c=>{t=c},onObjectEnd:()=>{o=r.pop()},onArrayBegin:()=>{const c=[];s(c),r.push(o),o=c,t=null},onArrayEnd:()=>{o=r.pop()},onLiteralValue:s,onError:(c,u,a)=>{n.push({error:c,offset:u,length:a})}},i),o[0]}function ut(e,n,i=Z.DEFAULT){const t=lt(e,!1),o=[];let r=0;function s(w){return w?()=>r===0&&w(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter()):()=>!0}function f(w){return w?T=>r===0&&w(T,t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter()):()=>!0}function c(w){return w?T=>r===0&&w(T,t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter(),()=>o.slice()):()=>!0}function u(w){return w?()=>{r>0?r++:w(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter(),()=>o.slice())===!1&&(r=1)}:()=>!0}function a(w){return w?()=>{r>0&&r--,r===0&&w(t.getTokenOffset(),t.getTokenLength(),t.getTokenStartLine(),t.getTokenStartCharacter())}:()=>!0}const m=u(n.onObjectBegin),v=c(n.onObjectProperty),b=a(n.onObjectEnd),y=u(n.onArrayBegin),A=a(n.onArrayEnd),N=c(n.onLiteralValue),_=f(n.onSeparator),d=s(n.onComment),l=f(n.onError),O=i&&i.disallowComments,k=i&&i.allowTrailingComma;function g(){for(;;){const w=t.scan();switch(t.getTokenError()){case 4:p(14);break;case 5:p(15);break;case 3:p(13);break;case 1:O||p(11);break;case 2:p(12);break;case 6:p(16);break}switch(w){case 12:case 13:O?p(10):d();break;case 16:p(1);break;case 15:case 14:break;default:return w}}}function p(w,T=[],de=[]){if(l(w),T.length+de.length>0){let q=t.getToken();for(;q!==17;){if(T.indexOf(q)!==-1){g();break}else if(de.indexOf(q)!==-1)break;q=g()}}}function I(w){const T=t.getTokenValue();return w?N(T):(v(T),o.push(T)),g(),!0}function B(){switch(t.getToken()){case 11:const w=t.getTokenValue();let T=Number(w);isNaN(T)&&(p(2),T=0),N(T);break;case 7:N(null);break;case 8:N(!0);break;case 9:N(!1);break;default:return!1}return g(),!0}function J(){return t.getToken()!==10?(p(3,[],[2,5]),!1):(I(!1),t.getToken()===6?(_(":"),g(),C()||p(4,[],[2,5])):p(5,[],[2,5]),o.pop(),!0)}function Ge(){m(),g();let w=!1;for(;t.getToken()!==2&&t.getToken()!==17;){if(t.getToken()===5){if(w||p(4,[],[]),_(","),g(),t.getToken()===2&&k)break}else w&&p(6,[],[]);J()||p(4,[],[2,5]),w=!0}return b(),t.getToken()!==2?p(7,[2],[]):g(),!0}function He(){y(),g();let w=!0,T=!1;for(;t.getToken()!==4&&t.getToken()!==17;){if(t.getToken()===5){if(T||p(4,[],[]),_(","),g(),t.getToken()===4&&k)break}else T&&p(6,[],[]);w?(o.push(0),w=!1):o[o.length-1]++,C()||p(4,[],[4,5]),T=!0}return A(),w||o.pop(),t.getToken()!==4?p(8,[4],[]):g(),!0}function C(){switch(t.getToken()){case 3:return He();case 1:return Ge();case 10:return I(!0);default:return B()}}return g(),t.getToken()===17?i.allowEmptyContent?!0:(p(4,[],[]),!1):C()?(t.getToken()!==17&&p(9,[],[]),!0):(p(4,[],[]),!1)}var be;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(be||(be={}));var ke;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(ke||(ke={}));const K=ct;var we;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(we||(we={}));function pt(e){switch(e){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}const ft=(e,n,i,t)=>{if(e.length===0)return;const o=e[0],r=Ce(n,o.offset),s=new et(`${pt(o.error)} at offset ${o.offset}`);throw s.fileName=i,s.codeFrame=tt(n,{start:r},{tabWidth:!1,...t}),s},at=(e,n)=>{const{allowEmptyContent:i,allowTrailingComma:t=!0,beforeParse:o,buffer:r,color:s,compression:f,disallowComments:c,encoding:u="utf8",flag:a}=n??{},m=D(e,{buffer:r,compression:f,encoding:u,flag:a}),v=typeof o=="function"?o(m):m,b=[],y=K(v,b,{allowEmptyContent:i,allowTrailingComma:t,disallowComments:c});return ft(b,v,nt(e),{color:s}),y},le=e=>Array.isArray(e)?e.map(n=>le(n)):e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===null?Object.fromEntries(Object.entries(e).map(([n,i])=>[n,le(i)])):e,mt=(e,n)=>{const i=D(e,{encoding:"utf8",...n});return le(st(i))};function dt(e,n,i){const t={},{buffer:o,compression:r,encoding:s="utf8",flag:f,...c}=t,u=D(e,{buffer:o,compression:r,encoding:s,flag:f});return typeof n=="function"?ge(u,n,c):ge(u,c)}var S={},ye;function gt(){if(ye)return S;ye=1,Object.defineProperty(S,"__esModule",{value:!0});const e=d=>d!==null&&typeof d=="object",n=(d,l)=>Object.assign(new Error(`[${d}]: ${l}`),{code:d}),i="ERR_INVALID_PACKAGE_CONFIG",t="ERR_INVALID_PACKAGE_TARGET",o="ERR_PACKAGE_PATH_NOT_EXPORTED",r="ERR_PACKAGE_IMPORT_NOT_DEFINED",s=/^\d+$/,f=/^(\.{1,2}|node_modules)$/i,c=/\/|\\/;var u=(d=>(d.Export="exports",d.Import="imports",d))(u||{});const a=(d,l,O,k,g)=>{if(l==null)return[];if(typeof l=="string"){const[p,...I]=l.split(c);if(p===".."||I.some(B=>f.test(B)))throw n(t,`Invalid "${d}" target "${l}" defined in the package config`);return[g?l.replace(/\*/g,g):l]}if(Array.isArray(l))return l.flatMap(p=>a(d,p,O,k,g));if(e(l)){for(const p of Object.keys(l)){if(s.test(p))throw n(i,"Cannot contain numeric property keys");if(p==="default"||k.includes(p))return a(d,l[p],O,k,g)}return[]}throw n(t,`Invalid "${d}" target "${l}"`)},m="*",v=(d,l)=>{const O=d.indexOf(m),k=l.indexOf(m);return O===k?l.length>d.length:k>O};function b(d,l){if(!l.includes(m)&&d.hasOwnProperty(l))return[l];let O,k;for(const g of Object.keys(d))if(g.includes(m)){const[p,I,B]=g.split(m);if(B===void 0&&l.startsWith(p)&&l.endsWith(I)){const J=l.slice(p.length,-I.length||void 0);J&&(!O||v(O,g))&&(O=g,k=J)}}return[O,k]}const y=d=>Object.keys(d).reduce((l,O)=>{const k=O===""||O[0]!==".";if(l===void 0||l===k)return k;throw n(i,'"exports" cannot contain some keys starting with "." and some not')},void 0),A=/^\w+:/,N=(d,l,O)=>{if(!d)throw new Error('"exports" is required');l=l===""?".":`./${l}`,(typeof d=="string"||Array.isArray(d)||e(d)&&y(d))&&(d={".":d});const[k,g]=b(d,l),p=a(u.Export,d[k],l,O,g);if(p.length===0)throw n(o,l==="."?'No "exports" main defined':`Package subpath '${l}' is not defined by "exports"`);for(const I of p)if(!I.startsWith("./")&&!A.test(I))throw n(t,`Invalid "exports" target "${I}" defined in the package config`);return p},_=(d,l,O)=>{if(!d)throw new Error('"imports" is required');const[k,g]=b(d,l),p=a(u.Import,d[k],l,O,g);if(p.length===0)throw n(r,`Package import specifier "${l}" is not defined in package`);return p};return S.resolveExports=N,S.resolveImports=_,S}var Ot=gt();let bt;const kt=e=>(bt??=je(import.meta.url))(e),W=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=e=>{if(typeof W<"u"&&W.versions&&W.versions.node){const[n,i]=W.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return W.getBuiltinModule(e)}return kt(e)},{statSync:H}=_e("node:fs"),wt=_e("node:module"),De=(e=process.cwd())=>{const{findPnpApi:n}=wt;return n?n(e):void 0},yt=e=>K(D(e,{buffer:!1})),te=(e,n,i,t)=>{const o=`resolveFromPackageJsonPath:${e}:${n}:${i?"yes":"no"}`;if(t?.has(o))return t.get(o);const r=yt(e);if(!r)return;let s=n||"tsconfig.json";if(!i&&r.exports)try{const[f]=Ot.resolveExports(r.exports,n,["require","types"]);s=f}catch{return!1}else!n&&r.tsconfig&&(s=r.tsconfig);return s=h(e,"..",s),t?.set(o,s),s},ne="package.json",oe="tsconfig.json",vt=(e,n,i)=>{let t=e;if(e===".."&&(t=h(t,oe)),e.startsWith(".")&&(t=j(n,t)),me(t)){if($(t)){if(H(t).isFile())return t}else if(!t.endsWith(".json")){const b=`${t}.json`;if($(b))return b}return}const[o="",...r]=e.split("/"),s=o.startsWith("@")?`${o}/${String(r.shift())}`:o,f=r.join("/"),c=De(n);if(c){const{resolveRequest:b}=c;try{if(s===e){const y=b(h(s,ne),n);if(y){const A=te(y,f,!1,i);if(A&&$(A))return A}}else{let y;try{y=b(e,n,{extensions:[".json"]})}catch{y=b(h(e,oe),n)}if(y)return y}}catch{}}const u=X(b=>{const y=h(j(b),"node_modules",s);if($(y))return h("node_modules",s)},{cwd:n,type:"directory"});if(!u||!H(u).isDirectory())return;const a=h(u,ne);if($(a)){const b=te(a,f,!1,i);if(b===!1)return;if(b&&$(b)&&H(b).isFile())return b}const m=h(u,f),v=m.endsWith(".json");if(!v){const b=`${m}.json`;if($(b))return b}if($(m)){if(H(m).isDirectory()){const b=h(m,ne);if($(b)){const A=te(b,"",!0,i);if(A&&$(A))return A}const y=h(m,oe);if($(y))return y}else if(v)return m}},Re=e=>{const n=j(e);let i;const t=De(n);if(t)try{i=t.resolveRequest("typescript/package.json",n)??void 0}catch{}if(i??=X(o=>h(o,"node_modules","typescript","package.json"),{cwd:n,type:"file"}),!!i)try{const o=K(D(i,{buffer:!1}));if(typeof o?.version=="string")return o.version}catch{}},Fe=new Set(["node16","node18","node20","nodenext"]),Be=e=>e!==void 0&&Fe.has(e),Tt=e=>{switch(e){case"node20":return"es2023";case"nodenext":return"esnext";default:return"es2022"}},ht=e=>e==="nodenext"?"nodenext":"node16",At=e=>{if(e==="nodenext")return"nodenext";if(e==="node16")return"node16"},Ue=(e,n,i)=>{const t=n.has("module")?e.module:void 0,o=n.has("moduleResolution")?e.moduleResolution:void 0;let r;t!==void 0&&Fe.has(t)?r=t:o!==void 0&&(r=At(o)),i.target!==void 0&&!n.has("target")&&(e.target=r?Tt(r):i.target),n.has("module")||(e.module=r??i.module),n.has("moduleResolution")||(e.moduleResolution=r?ht(r):"bundler")},Et=(e,n)=>{!n.has("target")&&!Be(e.module)&&(e.target="es3")},It=(e,n)=>{!n.has("target")&&!Be(e.module)&&(e.target="es5")},$t=(e,n)=>{n.has("strict")||(e.strict=!0),Ue(e,n,{module:"es2022",target:"es2025"}),n.has("rootDir")||(e.rootDir="."),n.has("types")||(e.types=[]),n.has("noUncheckedSideEffectImports")||(e.noUncheckedSideEffectImports=!0),n.has("libReplacement")||(e.libReplacement=!1),n.has("alwaysStrict")||(e.alwaysStrict=!0)},jt=(e,n)=>{Ue(e,n,{module:"esnext"}),n.has("stableTypeOrdering")||(e.stableTypeOrdering=!0)},Nt=[[4,Et],[5,It],[6,$t],[7,jt]],Lt=/^v?(\d+)/,_t=e=>{const n=Lt.exec(e);return n?Number(n[1]):void 0},Dt=(e,n)=>{const i=_t(n);if(i===void 0)return;const t=new Set(Object.keys(e));for(const[o,r]of Nt)o<=i&&r(e,t)},Rt=e=>K(D(e,{buffer:!1})),Ft=e=>e.replaceAll("\\","/"),M=e=>{const n=ot(e);return it(n)?n:`./${n}`},ce=["files","include","exclude"],ve=(e,n,i)=>{const t=h(n,i),o=P(e,t);return Y(o)||"./"},Bt=(e,n,i)=>{const t=P(e,n);if(!t)return i;const o=i.startsWith("./")?i.slice(2):i;return`${t}/${o}`},Ut=(e,n,i,t,o)=>{if(i.has(e))throw new Error(`Circularity detected while resolving configuration: ${e}`);i.add(e);const r=L(e),s=xe(e,t,i,o);delete s.references;const{compilerOptions:f}=s;if(f){const{baseUrl:c}=f;c&&!c.startsWith(E)&&(f.baseUrl=ve(n,r,c));const{outDir:u}=f;u&&!u.startsWith(E)&&(f.outDir=ve(n,r,u))}for(const c of ce){const u=s[c];u&&(s[c]=u.map(a=>a.startsWith(E)||me(a)?a:Bt(n,r,a)))}return s},xe=(e,n,i=new Set,t=new Map)=>{let o;try{o=Rt(e)??{}}catch(s){throw new Error(`Cannot resolve tsconfig at path: ${e}`,{cause:s})}if(typeof o!="object")throw new SyntaxError(`Failed to parse tsconfig at: ${e}`);const r=L(e);if(o.compilerOptions){const{compilerOptions:s}=o;s.paths&&!s.baseUrl&&(s[Se]=r)}if(o.extends){const s=Array.isArray(o.extends)?o.extends:[o.extends];delete o.extends;const f=s.toReversed();for(let c=0;c<f.length;c++){const u=f[c],a=vt(u,r,t);if(!a)throw new Ne(`No such file or directory, for '${u}' found.`);const m=Ut(a,r,new Set(i),n,t);m.compilerOptions?.rootDir!==void 0&&!m.compilerOptions.rootDir.startsWith(E)&&(m.compilerOptions.rootDir=h(L(a),m.compilerOptions.rootDir));const v={...m,...o,compilerOptions:{...m.compilerOptions,...o.compilerOptions}};m.watchOptions&&(v.watchOptions={...m.watchOptions,...o.watchOptions}),o=v}}if(o.compilerOptions){const{compilerOptions:s}=o;for(const f of["baseUrl","rootDir"]){const c=s[f];if(c&&!c.startsWith(E)){const u=j(r,c);s[f]=M(P(r,u))}}for(const f of["outDir","declarationDir"]){let c=s[f];c&&(Array.isArray(o.exclude)||(o.exclude=["outDir","declarationDir"].map(u=>{const a=s[u];if(a)return a.startsWith(E)||me(a)?a:h(r,a)}).filter(Boolean)),c.startsWith(E)||(c=M(c)),s[f]=c)}}else o.compilerOptions={};if(o.include&&(o.include=o.include.map(s=>Ft(s))),o.files&&(o.files=o.files.map(s=>s.startsWith(E)?s:M(s))),o.watchOptions){const{watchOptions:s}=o;s.excludeDirectories&&(s.excludeDirectories=s.excludeDirectories.map(f=>Y(j(r,f)))),s.excludeFiles&&(s.excludeFiles=s.excludeFiles.map(f=>Y(j(r,f)))),s.watchFile&&(s.watchFile=s.watchFile.toLowerCase()),s.watchDirectory&&(s.watchDirectory=s.watchDirectory.toLowerCase()),s.fallbackPolling&&(s.fallbackPolling=s.fallbackPolling.toLowerCase())}if(o.compilerOptions.lib&&(o.compilerOptions.lib=o.compilerOptions.lib.map(s=>s.toLowerCase())),o.compilerOptions.module){let s=o.compilerOptions.module.toLowerCase();s==="es2015"&&(s="es6"),o.compilerOptions.module=s}if(o.compilerOptions.target){let s=o.compilerOptions.target.toLowerCase();s==="es2015"&&(s="es6"),o.compilerOptions.target=s}if(o.compilerOptions.moduleResolution){let s=o.compilerOptions.moduleResolution.toLowerCase();s==="node"&&(s="node10"),o.compilerOptions.moduleResolution=s}return o.compilerOptions.jsx&&(o.compilerOptions.jsx=o.compilerOptions.jsx.toLowerCase()),o.compilerOptions.moduleDetection&&(o.compilerOptions.moduleDetection=o.compilerOptions.moduleDetection.toLowerCase()),o.compilerOptions.importsNotUsedAsValues&&(o.compilerOptions.importsNotUsedAsValues=o.compilerOptions.importsNotUsedAsValues.toLowerCase()),o.compilerOptions.newLine&&(o.compilerOptions.newLine=o.compilerOptions.newLine.toLowerCase()),o},z=(e,n)=>{if(e.startsWith(E))return Y(h(n,e.slice(E.length)))},xt=["outDir","declarationDir","outFile","rootDir","baseUrl","tsBuildInfoFile"],Te=e=>e==="es2022"||e==="es2023"||e==="es2024"||e==="es2025"||e==="esnext",St=(e,n)=>{if(e.compilerOptions===void 0)return e;if(e.compilerOptions.rewriteRelativeImportExtensions&&(e.compilerOptions.allowImportingTsExtensions??=!0),e.compilerOptions.composite&&(e.compilerOptions.declaration??=!0,e.compilerOptions.incremental??=!0),e.compilerOptions.checkJs&&(e.compilerOptions.allowJs??=!0),e.compilerOptions.verbatimModuleSyntax&&(e.compilerOptions.isolatedModules??=!0,e.compilerOptions.preserveConstEnums??=!0),["5.4","5.5","5.6","5.7","5.8","5.9"].includes(String(n?.tscCompatible))){if(e.compilerOptions.esModuleInterop===void 0&&(e.compilerOptions.module==="node16"||e.compilerOptions.module==="node18"||e.compilerOptions.module==="node20"||e.compilerOptions.module==="nodenext"||e.compilerOptions.module==="preserve")&&(e.compilerOptions.esModuleInterop=!0),e.compilerOptions.moduleDetection===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.moduleDetection="force"),e.compilerOptions.moduleResolution===void 0){let i="classic";if(e.compilerOptions.module!==void 0)switch(e.compilerOptions.module.toLocaleLowerCase()){case"commonjs":{i="node10";break}case"node16":case"node18":{i="node16";break}case"node20":{i="node16";break}case"nodenext":{i="nodenext";break}case"preserve":{i="bundler";break}}i!=="classic"&&(e.compilerOptions.moduleResolution=i)}if(e.compilerOptions.moduleResolution==="bundler"&&(e.compilerOptions.resolveJsonModule??=!0),e.compilerOptions.module&&["node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.resolveJsonModule??=!0),(e.compilerOptions.esModuleInterop||e.compilerOptions.module==="system"||e.compilerOptions.moduleResolution==="bundler")&&e.compilerOptions.allowSyntheticDefaultImports===void 0&&(e.compilerOptions.allowSyntheticDefaultImports=!0),["5.7","5.8","5.9"].includes(String(n?.tscCompatible))&&e.compilerOptions.moduleResolution){let i=!1;["bundler","node16","nodenext"].includes(e.compilerOptions.moduleResolution.toLocaleLowerCase())&&(i=!0),e.compilerOptions.resolvePackageJsonExports===void 0&&i&&(e.compilerOptions.resolvePackageJsonExports=!0),e.compilerOptions.resolvePackageJsonImports===void 0&&i&&(e.compilerOptions.resolvePackageJsonImports=!0)}if(e.compilerOptions.target===void 0){let i="es5";switch(e.compilerOptions.module){case"node16":case"node18":{i="es2022";break}case"node20":{i="es2023";break}case"nodenext":{i="esnext";break}}i!=="es5"&&(e.compilerOptions.target=i)}e.compilerOptions.useDefineForClassFields===void 0&&e.compilerOptions.target&&Te(e.compilerOptions.target)&&(e.compilerOptions.useDefineForClassFields=!0)}if(["5.6","5.7","5.8","5.9"].includes(String(n?.tscCompatible))&&e.compilerOptions.strict&&e.compilerOptions.strictBuiltinIteratorReturn===void 0&&(e.compilerOptions.strictBuiltinIteratorReturn=!0),["5.4","5.5","5.6","5.7","5.8","5.9"].includes(String(n?.tscCompatible))&&(e.compilerOptions.strict&&(e.compilerOptions.noImplicitAny=e.compilerOptions.noImplicitAny??!0,e.compilerOptions.noImplicitThis=e.compilerOptions.noImplicitThis??!0,e.compilerOptions.strictNullChecks=e.compilerOptions.strictNullChecks??!0,e.compilerOptions.strictFunctionTypes=e.compilerOptions.strictFunctionTypes??!0,e.compilerOptions.strictBindCallApply=e.compilerOptions.strictBindCallApply??!0,e.compilerOptions.strictPropertyInitialization=e.compilerOptions.strictPropertyInitialization??!0,e.compilerOptions.alwaysStrict=e.compilerOptions.alwaysStrict??!0),e.compilerOptions.strict&&e.compilerOptions.useUnknownInCatchVariables===void 0&&(e.compilerOptions.useUnknownInCatchVariables=!0),e.compilerOptions.isolatedModules&&(e.compilerOptions.preserveConstEnums=e.compilerOptions.preserveConstEnums??!0)),["6.0","7.0","true"].includes(String(n?.tscCompatible))){if(e.compilerOptions.moduleDetection===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&(e.compilerOptions.moduleDetection="force"),e.compilerOptions.moduleResolution===void 0&&e.compilerOptions.module){const i=e.compilerOptions.module.toLocaleLowerCase();i==="node16"||i==="node18"||i==="node20"?e.compilerOptions.moduleResolution="node16":i==="nodenext"&&(e.compilerOptions.moduleResolution="nodenext")}if(e.compilerOptions.useDefineForClassFields===void 0&&e.compilerOptions.module&&["node16","node18","node20","nodenext"].includes(e.compilerOptions.module)&&e.compilerOptions.target&&!Te(e.compilerOptions.target)&&(e.compilerOptions.useDefineForClassFields=!1),e.compilerOptions.isolatedModules&&e.compilerOptions.preserveConstEnums===void 0&&(e.compilerOptions.preserveConstEnums=!0),e.compilerOptions.resolveJsonModule===void 0){const i=e.compilerOptions.module,t=e.compilerOptions.moduleResolution?.toLocaleLowerCase();!(i!==void 0&&["node20","nodenext"].includes(i)||t==="bundler")&&t&&(e.compilerOptions.resolveJsonModule=!1)}if(e.compilerOptions.moduleResolution){const i=e.compilerOptions.moduleResolution.toLocaleLowerCase();["bundler","node16","nodenext"].includes(i)||(e.compilerOptions.resolvePackageJsonExports??=!1,e.compilerOptions.resolvePackageJsonImports??=!1)}}return e.compileOnSave===!1&&delete e.compileOnSave,e},Wt=(e,n)=>{const i=e?.typescriptVersion;if(!(i===!1||i===void 0))return i==="auto"?Re(n):i},E="${configDir}",Se=Symbol("implicitBaseUrl"),Vt=(e,n)=>{const i=j(e),t=xe(i,n),o=L(i),r=Wt(n,o);r&&t.compilerOptions&&Dt(t.compilerOptions,r);const{compilerOptions:s}=t;if(s){for(const c of xt){const u=s[c];if(u){const a=z(u,o);s[c]=a?M(P(o,a)):u}}for(const c of["rootDirs","typeRoots"]){const u=s[c];u&&(s[c]=u.map(a=>{const m=z(a,o);return m?M(P(o,m)):a}))}const{paths:f}=s;if(f){const c=Object.keys(f);for(let u=0;u<c.length;u++){const a=c[u];f[a]=f[a].map(m=>z(m,o)??m)}}}for(let f=0;f<ce.length;f++){const c=ce[f],u=t[c];u&&(t[c]=u.map(a=>z(a,o)??a))}return St(t,n)};let Mt;const Pt=e=>(Mt??=je(import.meta.url))(e),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Jt=e=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[n,i]=V.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return V.getBuiltinModule(e)}return Pt(e)},{statSync:qt}=Jt("node:fs"),Gt=new Map,ue=new WeakMap,Ht="tsconfig.json",We=e=>{try{return qt(e).mtimeMs}catch{return 0}},zt=(e,n)=>{let i=String(n.typescriptVersion);return n.typescriptVersion==="auto"&&(i=`auto:${String(Re(L(e)))}`),`${e}::${String(n.tscCompatible)}::${i}`},Qt=(e,n,i)=>{if(e.has(n)&&ue.get(e)?.get(n)===We(i))return e.get(n)},Xt=(e,n,i,t)=>{e.set(n,t);let o=ue.get(e);o||(o=new Map,ue.set(e,o)),o.set(n,We(i))},Yt=(e,n={})=>{const i=n.configFileName??Ht,t=n.configFileName===void 0;let o=X(i,{...e&&{cwd:e},type:"file"});if(!o&&t&&(o=X("jsconfig.json",{...e&&{cwd:e},type:"file"})),!o)throw new Ne(t?`No such file or directory, for '${i}' or 'jsconfig.json' found.`:`No such file or directory, for '${i}' found.`);const r=n.cache&&typeof n.cache!="boolean"?n.cache:Gt,s=zt(o,n);if(n.cache){const c=Qt(r,s,o);if(c)return c}const f={config:Vt(o,{tscCompatible:n.tscCompatible,typescriptVersion:n.typescriptVersion}),path:o};return n.cache&&Xt(r,s,o,f),f},Zt=/\.[cm]?tsx?$/,Kt=[".yaml",".yml",".toml",".jsonc",".json5",".txt"],Ve=/\.(?:ya?ml|toml|jsonc|json5|txt)$/,Ct=e=>e.endsWith(".yaml")||e.endsWith(".yml")?dt(e):e.endsWith(".toml")?mt(e):e.endsWith(".jsonc")?at(e,{allowTrailingComma:!0}):e.endsWith(".json5")?rt(e):ae(e,"utf8"),pe=e=>e===void 0?"undefined":e===null?"null":typeof e=="number"?Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":String(e):typeof e=="bigint"?`${e}n`:typeof e=="boolean"?String(e):typeof e=="string"?JSON.stringify(e):e instanceof Date?`new Date(${JSON.stringify(e.toISOString())})`:Array.isArray(e)?`[${e.map(n=>pe(n)).join(",")}]`:typeof e=="object"?`{${Object.entries(e).map(([i,t])=>`${JSON.stringify(i)}:${pe(t)}`).join(",")}}`:"null",ie=new Map,en=(e,n)=>e.startsWith(E)?h(n,e.slice(E.length)):e,tn=e=>{if(ie.has(e))return ie.get(e);let n;try{const{config:i,path:t}=Yt(e,{cache:!1}),o=L(t),r=i.compilerOptions,s=r?.paths??{};if(r!==void 0){const{baseUrl:f}=r;let c,u=!1;if(f===void 0){const a=r[Se];c=typeof a=="string"?a:o}else u=!0,c=j(o,en(f,o));n={hasBaseUrl:u,paths:s,pathsBase:c}}}catch{n=void 0}return ie.set(e,n),n},Me=(e,n)=>{const i=tn(n);if(i===void 0)return;const{hasBaseUrl:t,pathsBase:o}=i,r=s=>Pe(s)??Je(s);for(const[s,f]of Object.entries(i.paths)){const c=s.indexOf("*");if(c===-1){if(s===e)for(const m of f){const v=r(j(o,m));if(v!==void 0)return v}continue}const u=s.slice(0,c),a=s.slice(c+1);if(e.startsWith(u)&&e.endsWith(a)&&e.length>=u.length+a.length){const m=e.slice(u.length,e.length-a.length);for(const v of f){const b=v.replace("*",m),y=r(j(o,b));if(y!==void 0)return y}}}if(t){const s=r(j(o,e));if(s!==void 0)return s}};let he=!1,se=0,Ae=!1,Ee=!1;const nn=()=>{Ee||(Ee=!0,process.setSourceMapsEnabled?.(!0))},on=e=>{const n=e.indexOf("?");return n===-1?e:e.slice(0,n)},sn=e=>e.endsWith(".cts")?"commonjs":"module",Ie=[".ts",".tsx",".mts",".cts",".js",".mjs",".cjs",".json"],F=e=>{try{return $e(e).isFile()}catch{return!1}},rn=e=>{try{return $e(e).isDirectory()}catch{return!1}},ln=e=>{if(e.endsWith(".js"))return`${e.slice(0,-3)}.ts`;if(e.endsWith(".mjs"))return`${e.slice(0,-4)}.mts`;if(e.endsWith(".cjs"))return`${e.slice(0,-4)}.cts`},Pe=e=>{if(F(e))return e;const n=ln(e);if(n!==void 0&&F(n))return n;for(const i of Ie)if(F(e+i))return e+i;if(rn(e))for(const i of Ie){const t=`${e}/index${i}`;if(F(t))return t}},Je=e=>{if(F(e)&&Ve.test(e))return e;for(const n of Kt)if(F(e+n))return e+n},qe=()=>{nn();const{registerHooks:e}=re;return typeof e!="function"?!1:(he||(e({load(n,i,t){const o=on(n);if(o.startsWith("file:")&&Zt.test(o)){const r=G(o),{code:s}=Le(r,ae(r,"utf8"));return{format:sn(r),shortCircuit:!0,source:s}}if(o.startsWith("file:")&&Ve.test(o)){const r=G(o),s=Ct(r);return{format:"module",shortCircuit:!0,source:`export default ${pe(s)};
4
4
  `}}return t(n,i)},resolve(n,i,t){if((n.startsWith(".")||n.startsWith("/"))&&i.parentURL!==void 0){let o;try{o=new URL(n,i.parentURL)}catch{o=void 0}if(o?.protocol==="file:"){const r=G(o),s=Pe(r)??Je(r);if(s!==void 0)return{shortCircuit:!0,url:Q(s).href}}}if(i.parentURL!==void 0&&!n.startsWith(".")&&!n.startsWith("/")&&!n.startsWith("#")&&!n.startsWith("node:")&&!re.isBuiltin?.(n)){let o;try{o=L(G(i.parentURL))}catch{o=void 0}if(o!==void 0){const r=Me(n,o);if(r!==void 0)return{shortCircuit:!0,url:Q(r).href}}}return t(n,i)}}),he=!0),!0)},cn=()=>qe(),un=async e=>{if(se+=1,qe())return await import(`${Q(e).href}?v=${String(se)}`);Ae||(Ae=!0,process.stderr.write(`vis: Node < 22.15 has no module.registerHooks — only the entry file is transpiled; local TypeScript imports won't load. Upgrade to Node >= 22.15 for full support.
@@ -1,2 +1,2 @@
1
- import{p}from"./cli-main.js";import{d as b}from"../packem_shared/pm-runner-RM72mDZg.js";import{r as m,l as w,L as v}from"../packem_shared/dependency-scan-D_v3KM59.js";import{z as S,e as g}from"../packem_shared/index-BzhrR_iC.js";import{S as $}from"../packem_shared/lockfile-DhHAaHN5.js";import{e as x}from"../packem_shared/index-BS6A9QR_.js";import{y as C}from"../packem_shared/isAccessibleSync-DYKTrrvc-C-_5cgwu.js";const E=e=>{const o=e.trim();return o===""?!1:/^(?:git\+|git:\/\/|git@|ssh:\/\/)/i.test(o)||/^(?:github|gitlab|bitbucket|gist):/i.test(o)||/^[\w.-]+\/[\w.-]+(?:#.+)?$/.test(o)&&!o.includes("@")?!0:/^https?:\/\//i.test(o)},M=(e,o)=>{for(const i of o)if(i===e||i.endsWith("*")&&e.startsWith(i.slice(0,-1)))return!0;return!1},L=(e,o,i={})=>{const t=m(e,o);if(!t)return[];let s;try{s=S(g(e,t.file))}catch{return[]}const n=$(s,t.type);if(n.length===0)return[];const r=i.allow??[],l=[],f=new Set;for(const c of n){const a=`${c.name}@${c.version}`;for(const d of[c.dependencies,c.optionalDependencies])if(d){for(const[u,h]of Object.entries(d))if(!M(u,r))for(const k of h){if(!E(k))continue;const y=`${a}->${u}@${k}`;f.has(y)||(f.add(y),l.push({declaredBy:a,packageName:u,source:k}))}}}return l.sort((c,a)=>c.packageName.localeCompare(a.packageName)||c.declaredBy.localeCompare(a.declaredBy))},D=new Set(["firstSeen","publisherChange"]),I=e=>e.severity==="block"&&e.acceptedRisk===void 0,N=e=>{const o=e.security?.policies?.firstSeen?.minutes,i=typeof o=="number"&&o>0,t=e.security?.policies?.publisherChange?.mode==="no-downgrade",s=e.security?.blockExoticSubdeps===!0;return i||t||s},O=async e=>{const{offline:o=!1,packageManager:i,visConfig:t,workspaceRoot:s}=e,n=Date.now();if(!N(t))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!1,status:"skipped"};const r=m(s,i);if(!r||!C(g(s,r.file)))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!0,status:"fail"};const l=w(s,i,{includeDev:!0}),f=l.length,c=await x({offline:o,packageManager:i,packages:l,workspaceRoot:s},"install",{enabledPolicies:new Set(D),visConfig:t}),a=t.security?.blockExoticSubdeps===!0?L(s,i,{allow:t.security.exoticSubdepsAllow}):[],d=c.some(u=>I(u))||a.length>0;return{decisions:c,durationMs:Date.now()-n,entryCount:f,exoticViolations:a,lockfileMissing:!1,status:d?"fail":"pass"}},P=e=>e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`,V=e=>{if(e.status==="skipped")return["– Lockfile supply-chain verification skipped (no firstSeen / publisherChange / blockExoticSubdeps policy configured)"];if(e.lockfileMissing)return["✗ Lockfile supply-chain verification failed — no lockfile found, the resolved closure cannot be attested"];const o=`(${String(e.entryCount)} ${e.entryCount===1?"entry":"entries"}, ${P(e.durationMs)})`;if(e.status==="pass")return[`✓ Lockfile passes supply-chain policies ${o}`];const i=[`✗ Lockfile failed supply-chain policy check ${o}`];for(const t of e.decisions)t.severity==="block"&&t.acceptedRisk===void 0&&i.push(` [${t.policy}] ${t.reason}`);for(const t of e.exoticViolations)i.push(` [blockExoticSubdeps] ${t.packageName} pulled from exotic source by ${t.declaredBy}: ${t.source}`);return i},z=async({options:e,visConfig:o,workspaceRoot:i})=>{const t=i??process.cwd(),s=b(t);if(!v[s.name]){p.warn(`Package manager '${s.name}' has no lockfile vis can verify.`);return}const n=await O({offline:!!e.offline,packageManager:s.name,visConfig:o??{},workspaceRoot:t});if(e.json){process.stdout.write(`${JSON.stringify(n,void 0,2)}
1
+ import{p}from"./cli-main.js";import{d as b}from"../packem_shared/pm-runner-Dboj-wZG.js";import{r as m,l as w,L as v}from"../packem_shared/dependency-scan-D8e370_h.js";import{z as S,e as g}from"../packem_shared/index-0dnGN3GP.js";import{S as $}from"../packem_shared/lockfile-DhHAaHN5.js";import{e as x}from"../packem_shared/index-Doab17tq.js";import{y as C}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";const E=e=>{const o=e.trim();return o===""?!1:/^(?:git\+|git:\/\/|git@|ssh:\/\/)/i.test(o)||/^(?:github|gitlab|bitbucket|gist):/i.test(o)||/^[\w.-]+\/[\w.-]+(?:#.+)?$/.test(o)&&!o.includes("@")?!0:/^https?:\/\//i.test(o)},M=(e,o)=>{for(const i of o)if(i===e||i.endsWith("*")&&e.startsWith(i.slice(0,-1)))return!0;return!1},L=(e,o,i={})=>{const t=m(e,o);if(!t)return[];let s;try{s=S(g(e,t.file))}catch{return[]}const n=$(s,t.type);if(n.length===0)return[];const r=i.allow??[],l=[],f=new Set;for(const c of n){const a=`${c.name}@${c.version}`;for(const d of[c.dependencies,c.optionalDependencies])if(d){for(const[u,h]of Object.entries(d))if(!M(u,r))for(const k of h){if(!E(k))continue;const y=`${a}->${u}@${k}`;f.has(y)||(f.add(y),l.push({declaredBy:a,packageName:u,source:k}))}}}return l.sort((c,a)=>c.packageName.localeCompare(a.packageName)||c.declaredBy.localeCompare(a.declaredBy))},D=new Set(["firstSeen","publisherChange"]),I=e=>e.severity==="block"&&e.acceptedRisk===void 0,N=e=>{const o=e.security?.policies?.firstSeen?.minutes,i=typeof o=="number"&&o>0,t=e.security?.policies?.publisherChange?.mode==="no-downgrade",s=e.security?.blockExoticSubdeps===!0;return i||t||s},O=async e=>{const{offline:o=!1,packageManager:i,visConfig:t,workspaceRoot:s}=e,n=Date.now();if(!N(t))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!1,status:"skipped"};const r=m(s,i);if(!r||!C(g(s,r.file)))return{decisions:[],durationMs:Date.now()-n,entryCount:0,exoticViolations:[],lockfileMissing:!0,status:"fail"};const l=w(s,i,{includeDev:!0}),f=l.length,c=await x({offline:o,packageManager:i,packages:l,workspaceRoot:s},"install",{enabledPolicies:new Set(D),visConfig:t}),a=t.security?.blockExoticSubdeps===!0?L(s,i,{allow:t.security.exoticSubdepsAllow}):[],d=c.some(u=>I(u))||a.length>0;return{decisions:c,durationMs:Date.now()-n,entryCount:f,exoticViolations:a,lockfileMissing:!1,status:d?"fail":"pass"}},P=e=>e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`,V=e=>{if(e.status==="skipped")return["– Lockfile supply-chain verification skipped (no firstSeen / publisherChange / blockExoticSubdeps policy configured)"];if(e.lockfileMissing)return["✗ Lockfile supply-chain verification failed — no lockfile found, the resolved closure cannot be attested"];const o=`(${String(e.entryCount)} ${e.entryCount===1?"entry":"entries"}, ${P(e.durationMs)})`;if(e.status==="pass")return[`✓ Lockfile passes supply-chain policies ${o}`];const i=[`✗ Lockfile failed supply-chain policy check ${o}`];for(const t of e.decisions)t.severity==="block"&&t.acceptedRisk===void 0&&i.push(` [${t.policy}] ${t.reason}`);for(const t of e.exoticViolations)i.push(` [blockExoticSubdeps] ${t.packageName} pulled from exotic source by ${t.declaredBy}: ${t.source}`);return i},z=async({options:e,visConfig:o,workspaceRoot:i})=>{const t=i??process.cwd(),s=b(t);if(!v[s.name]){p.warn(`Package manager '${s.name}' has no lockfile vis can verify.`);return}const n=await O({offline:!!e.offline,packageManager:s.name,visConfig:o??{},workspaceRoot:t});if(e.json){process.stdout.write(`${JSON.stringify(n,void 0,2)}
2
2
  `),n.status==="fail"&&(process.exitCode=1);return}const[r,...l]=V(n);if(n.status==="skipped"){p.info(r);return}if(n.status==="pass"){p.success(r);return}p.error(r);for(const f of l)p.error(f);process.exitCode=1};export{z as default};
@@ -1 +1 @@
1
- import{b as i}from"../packem_chunks/context.js";import{a as d}from"./apply-DoeQAAGm.js";import{p as u}from"./publish-Dc0XGH3K.js";const y=async(t={})=>{const e=await i(t),a=await d(e,{dryRun:t.dryRun});return{changedFiles:a.changedFiles,deletedFiles:a.deletedFiles,plan:a.plan}},w=async(t={})=>{const e=await i(t),{resolveFormatter:a}=await import("../packem_chunks/resolveFormatter.js"),n=await a(e.config.changelog,e.cwd),r=new Date().toISOString().slice(0,10),s=[];for(const c of e.plan.releases){const l=e.depGraph.getPackage(c.name);if(!l)continue;const o=await n({changeFiles:c.changeFiles,date:r,release:c,target:"changelog"});s.push({content:o,file:`${l.dir}/CHANGELOG.md`,package:c.name})}return{projectChangelogs:s}},m=async(t={})=>{const e=await i(t);return await u(e,{dryRun:t.dryRun,otp:t.otp,tag:t.tag})},F=async(t={})=>{const e=await i(t);let a=!1,n;const r=async()=>{if(n)return n;a=!0;const s=await d(e,{dryRun:t.dryRun});return n={changedFiles:s.changedFiles,deletedFiles:s.deletedFiles,plan:s.plan},n};return{apply:r,discard:()=>{a=!0},plan:e.plan,[Symbol.asyncDispose]:async()=>{a||await r()}}},R=async t=>{const e=await i(t),{runSnapshot:a}=await import("../packem_chunks/snapshot.js"),n=await a({context:e,dryRun:t.dryRun,registry:t.registry,tag:t.tag});return{failed:n.failed,published:n.published,skipped:n.skipped,snapshotVersion:n.snapshotVersion,tag:n.tag}},C=async(t={})=>{const e=await i(t),a=await d(e,{dryRun:t.dryRun}),n={changedFiles:a.changedFiles,deletedFiles:a.deletedFiles,plan:a.plan},{resolveFormatter:r}=await import("../packem_chunks/resolveFormatter.js"),s=await r(e.config.changelog,e.cwd),c=new Date().toISOString().slice(0,10),l=[];for(const g of a.plan.releases){const p=e.depGraph.getPackage(g.name);if(!p)continue;const f=await s({changeFiles:g.changeFiles,date:c,release:g,target:"changelog"});l.push({content:f,file:`${p.dir}/CHANGELOG.md`,package:g.name})}const o={projectChangelogs:l};if(t.skipPublish)return{changelog:o,publish:{failed:[],published:[],skipped:[]},version:n};const h=await u(e,{dryRun:t.dryRun,otp:void 0,tag:void 0});return{changelog:o,publish:h,version:n}};class S{constructor(e={}){this.config=e}config;releaseVersion(e={}){return y({...e,config:this.config})}releaseChangelog(e={}){return w({...e,config:this.config})}releasePublish(e={}){return m({...e,config:this.config})}releaseDraft(e={}){return F({...e,config:this.config})}releaseSnapshot(e){return R({...e,config:this.config})}}export{S as ReleaseClient,C as release,w as releaseChangelog,F as releaseDraft,m as releasePublish,R as releaseSnapshot,y as releaseVersion};
1
+ import{b as i}from"../packem_chunks/context.js";import{a as d}from"./apply-DoeQAAGm.js";import{p as u}from"./publish-DkgvB2Lk.js";const y=async(t={})=>{const e=await i(t),a=await d(e,{dryRun:t.dryRun});return{changedFiles:a.changedFiles,deletedFiles:a.deletedFiles,plan:a.plan}},w=async(t={})=>{const e=await i(t),{resolveFormatter:a}=await import("../packem_chunks/resolveFormatter.js"),n=await a(e.config.changelog,e.cwd),r=new Date().toISOString().slice(0,10),s=[];for(const c of e.plan.releases){const l=e.depGraph.getPackage(c.name);if(!l)continue;const o=await n({changeFiles:c.changeFiles,date:r,release:c,target:"changelog"});s.push({content:o,file:`${l.dir}/CHANGELOG.md`,package:c.name})}return{projectChangelogs:s}},m=async(t={})=>{const e=await i(t);return await u(e,{dryRun:t.dryRun,otp:t.otp,tag:t.tag})},F=async(t={})=>{const e=await i(t);let a=!1,n;const r=async()=>{if(n)return n;a=!0;const s=await d(e,{dryRun:t.dryRun});return n={changedFiles:s.changedFiles,deletedFiles:s.deletedFiles,plan:s.plan},n};return{apply:r,discard:()=>{a=!0},plan:e.plan,[Symbol.asyncDispose]:async()=>{a||await r()}}},R=async t=>{const e=await i(t),{runSnapshot:a}=await import("../packem_chunks/snapshot.js"),n=await a({context:e,dryRun:t.dryRun,registry:t.registry,tag:t.tag});return{failed:n.failed,published:n.published,skipped:n.skipped,snapshotVersion:n.snapshotVersion,tag:n.tag}},C=async(t={})=>{const e=await i(t),a=await d(e,{dryRun:t.dryRun}),n={changedFiles:a.changedFiles,deletedFiles:a.deletedFiles,plan:a.plan},{resolveFormatter:r}=await import("../packem_chunks/resolveFormatter.js"),s=await r(e.config.changelog,e.cwd),c=new Date().toISOString().slice(0,10),l=[];for(const g of a.plan.releases){const p=e.depGraph.getPackage(g.name);if(!p)continue;const f=await s({changeFiles:g.changeFiles,date:c,release:g,target:"changelog"});l.push({content:f,file:`${p.dir}/CHANGELOG.md`,package:g.name})}const o={projectChangelogs:l};if(t.skipPublish)return{changelog:o,publish:{failed:[],published:[],skipped:[]},version:n};const h=await u(e,{dryRun:t.dryRun,otp:void 0,tag:void 0});return{changelog:o,publish:h,version:n}};class S{constructor(e={}){this.config=e}config;releaseVersion(e={}){return y({...e,config:this.config})}releaseChangelog(e={}){return w({...e,config:this.config})}releasePublish(e={}){return m({...e,config:this.config})}releaseDraft(e={}){return F({...e,config:this.config})}releaseSnapshot(e){return R({...e,config:this.config})}}export{S as ReleaseClient,C as release,w as releaseChangelog,F as releaseDraft,m as releasePublish,R as releaseSnapshot,y as releaseVersion};
@@ -0,0 +1 @@
1
+ import{createRequire as N}from"node:module";import{L as M}from"./index-CIdjkZgt.js";import{advisoriesStatus as h,advisoriesQuery as k,NATIVE_BINDING_VERSION as E,advisoriesIngest as z}from"#native";import{V as S}from"./vis-user-error-BivZDkQD.js";let R;const T=e=>(R??=N(import.meta.url))(e),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[s,r]=m.versions.node.split(".").map(Number);if(s>22||s===22&&r>=3||s===20&&r>=16)return m.getBuiltinModule(e)}return T(e)},{randomUUID:D}=l("node:crypto"),{existsSync:_,createWriteStream:U}=l("node:fs"),{mkdir:P,rm:w,rename:O,stat:L,unlink:V}=l("node:fs/promises"),{join:p,dirname:B}=l("node:path"),{Readable:x}=l("node:stream"),{pipeline:C}=l("node:stream/promises"),b=6;if(E!==b)throw new Error(`vis native binding ABI mismatch in advisories: expected ${b}, got ${E}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const oe="https://osv-vulnerabilities.storage.googleapis.com",W=new Set(["osv-vulnerabilities.storage.googleapis.com"]);class j extends Error{cause="DB_NOT_FOUND";constructor(s){super(`No local advisory DB at ${s}. Run 'vis advisories sync' first.`),this.name="AdvisoryDbNotFoundError"}}const v=2;class H extends Error{cause="DB_SCHEMA_OUTDATED";constructor(s,r){super(`Advisory DB at ${s} uses schema v${String(r)}; this build of vis needs v${String(v)}. Run 'vis advisories sync' to rebuild it.`),this.name="AdvisoryDbSchemaError"}}class F extends Error{cause="DB_REBUILD_FAILED";constructor(s,r,o){super(`Could not rebuild advisory DB at ${s} from schema v${String(r)} to v${String(v)}: ${o}. The existing file was left unchanged.`),this.name="AdvisoryDbRebuildError"}}const ne=e=>{const{schemaVersion:s}=h(e);return s<v?new H(e,s):void 0};class y extends Error{cause="SOURCE_NOT_ALLOWED";constructor(s){super(`Advisory source host '${s}' is not in the built-in allowlist. Add it to \`security.audit.advisories.allowedHosts\` if intentional.`),this.name="AdvisorySourceNotAllowedError"}}class $ extends Error{cause="SYNC_NETWORK";constructor(s,r){super(`Advisory sync failed for ${s}: ${r}. Check connectivity, proxy env vars, or --source.`),this.name="AdvisorySyncNetworkError"}}const f=e=>{const r=M("vis",{create:!0,cwd:e})??p(e,"node_modules",".cache","vis");return p(r,"advisories","db.sqlite")},G=(e,s)=>{let r;try{r=new URL(e)}catch{throw new y(e)}if(r.protocol!=="https:")throw new y(`${r.protocol}//${r.host}`);if(!new Set([...W,...s??[]]).has(r.host))throw new y(r.host);return r},A=["-wal","-shm","-journal"],g=async e=>{const s=`${e.dbPath}.${e.ecosystem}.${process.pid}.${D()}.zip.tmp`;try{const r=await I(e.zipUrl,{method:"GET"});if(!r.ok||!r.body)throw new $(e.zipUrl.toString(),r.status);const o=e.etag??r.headers.get("etag"),a=r.headers.get("content-length"),n=a?Number.parseInt(a,10):null;let i=0;const t=U(s),d=x.fromWeb(r.body);return e.onProgress&&n&&d.on("data",c=>{i+=c.byteLength,e.onProgress?.(i,n,"download")}),await C(d,t),await z({dbPath:e.dbPath,ecosystem:e.ecosystem,manifestEtag:o??void 0,zipPath:s},(c,u)=>e.onProgress?.(c,u,"ingest"))}finally{await V(s).catch(()=>{})}},K=async(e,s,r,o,a)=>{const n=`${s}.rebuild.${process.pid}.${D()}.tmp`;try{const i=await g({dbPath:n,ecosystem:e.ecosystem,etag:null,onProgress:e.onProgress,zipUrl:a(e.ecosystem)});for(const t of o)t!==e.ecosystem&&await g({dbPath:n,ecosystem:t,etag:null,onProgress:e.onProgress,zipUrl:a(t)});return await Promise.all(A.map(t=>w(`${s}${t}`,{force:!0}))),await O(n,s),i}catch(i){throw await Promise.all(["",...A].map(t=>w(`${n}${t}`,{force:!0}).catch(()=>{}))),new F(s,r,i instanceof Error?i.message:String(i))}},Y=(e,s)=>{if(!/^[A-Z0-9][\w.:-]*$/i.test(s))throw new S(`Advisory ecosystem "${s}" is not a valid OSV name.`);const r=J(e.toString()),o=new URL(`${s}/all.zip`,r);if(o.origin!==e.origin||!o.pathname.startsWith(new URL(r).pathname))throw new S(`Advisory ecosystem "${s}" resolves outside the configured advisory source.`);return o},ie=async e=>{const s=e.dbPath??f(e.workspaceRoot),r=G(e.source,e.allowedHosts),o=t=>Y(r,t);if(_(s)){const t=h(s);if(t.schemaVersion<v){const d=t.ecosystems.map(u=>u.name),c=await K(e,s,t.schemaVersion,d,o);return{advisoriesIngested:c.advisoriesIngested,dbPath:s,durationMs:c.durationMs,rebuiltFromSchema:t.schemaVersion,upToDate:!1}}}await P(B(s),{recursive:!0});const a=await Z(s,e.ecosystem);let n=null;if(!e.force){const t=await I(o(e.ecosystem),{method:"HEAD"});if(t.ok&&(n=t.headers.get("etag"),n&&a&&n===a))return{advisoriesIngested:0,dbPath:s,durationMs:0,upToDate:!0}}const i=await g({dbPath:s,ecosystem:e.ecosystem,etag:n,onProgress:e.onProgress,zipUrl:o(e.ecosystem)});return{advisoriesIngested:i.advisoriesIngested,dbPath:s,durationMs:i.durationMs,upToDate:!1}},Q=(e,s)=>`${e}@${s}`,ae=(e,s)=>{if(e.length===0)return new Map;const r=s.dbPath??f(s.workspaceRoot),o=s.ecosystem??"npm";if(!_(r))throw new j(r);const a=e.map(t=>({ecosystem:o,name:t.name,version:t.version})),n=k(r,a),i=new Map;for(const[t,d]of e.entries()){const c=n[t];!c||c.vulnerabilities.length===0||i.set(Q(d.name,d.version),c.vulnerabilities.map(u=>X(u)))}return i},ce=async(e,s)=>{const r=s??f(e);return h(r)},Z=async(e,s)=>{try{await L(e)}catch{return null}return h(e).ecosystems.find(a=>a.name===s)?.manifestEtag??null},X=e=>({aliases:e.aliases.length>0?e.aliases:void 0,cvssScore:e.cvssScore??void 0,fixedVersions:e.fixedVersions,id:e.id,severity:q(e.severity),summary:e.summary}),q=e=>{const s=e.toUpperCase();return s==="CRITICAL"||s==="HIGH"||s==="MODERATE"||s==="LOW"?s:"UNKNOWN"},J=e=>e.endsWith("/")?e:`${e}/`,I=async(e,s)=>{try{return await fetch(e,s)}catch(r){throw new $(e.toString(),r instanceof Error?r.message:String(r))}};export{v as A,oe as D,Q as a,ne as b,j as c,ce as g,ae as q,f as r,ie as s};
@@ -0,0 +1 @@
1
+ import{createRequire as F}from"node:module";import{m as q,e as M}from"./index-0dnGN3GP.js";import{collectExternalInputs as N,getAffectedProjects as U}from"@visulima/task-runner";import{i as J}from"./index-BjdW45xX.js";import{V as E}from"./vis-user-error-BivZDkQD.js";import{r as L}from"./affected-shas-CycHU3nr.js";import{D as z}from"./env-BymuoTL8.js";let O;const P=e=>(O??=F(import.meta.url))(e),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[n,t]=h.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return h.getBuiltinModule(e)}return P(e)},{spawnSync:H}=S("node:child_process"),{mkdir:W,writeFile:D,rename:B,rm:C,readFile:V}=S("node:fs/promises"),k=new Set(["deep","direct","none"]),G=e=>{const n=[],t=e.split("\0");for(let s=0;s<t.length;s++){const r=t[s];if(!r||r.length<4)continue;const l=r.slice(0,2),f=r.slice(3);if(f&&n.push(f),l.includes("R")||l.includes("C")){s+=1;const g=t[s];g&&n.push(g)}}return n},K=e=>{const n=H("git",["status","--porcelain","-z"],{cwd:e,encoding:"utf8"});return n.error||n.status!==0||typeof n.stdout!="string"?[]:G(n.stdout)},Y=async e=>{try{const n=await V(e,"utf8"),t=JSON.parse(n);return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:void 0}catch{return}},Q=async(e,n)=>{const t=`${e}.${process.pid}.tmp`;try{await W(q(e),{recursive:!0}),await D(t,JSON.stringify(n)),await B(t,e)}catch{await C(t,{force:!0}).catch(()=>{})}},oe=async e=>{await C(e,{force:!0}).catch(()=>{})},ae=async(e,n,t={})=>{const s=e.downstream??"deep",r=e.upstream??"none";if(!k.has(s))throw new E(`Invalid --downstream value: "${s}". Must be "none", "direct", or "deep".`);if(!k.has(r))throw new E(`Invalid --upstream value: "${r}". Must be "none", "direct", or "deep".`);const{fileOwners:l,namedInputs:f,projectGraph:g,projects:I,targetDefaults:$,workspaceRoot:u}=n,i=[];let{base:m}=e,{head:c}=e;if(!m||!c){const p=L({defaultBase:t.defaultBase,workspaceRoot:u});m=m||p.base,c=c||p.head,i.push(`Resolved affected refs from ${p.provider} (${p.notes.join("; ")})`)}const b=t.runningInCi??J,y=c==="HEAD"||c==="",R=e.uncommitted??(!b&&y);let d=[];if(R)if(y){const _=(t.readWorkingTreeChanges??K)(u),A=Object.values(I).map(a=>a.root?.replace(/\/$/,"")).filter(a=>!!a&&a!==".");d=_.filter(a=>l!==void 0&&Object.hasOwn(l,a)||A.some(x=>a===x||a.startsWith(`${x}/`)));const j=_.length-d.length;d.length>0&&i.push(`including ${d.length} uncommitted working-tree file(s)`),j>0&&i.push(`ignoring ${j} uncommitted path(s) outside any project (untracked scratch would otherwise mark every project affected)`)}else i.push(`ignoring --uncommitted: --head=${c} pins the comparison to a commit, not the working tree`);const w=N(u,I,{namedInputs:f,targetDefaults:$}),v=t.externalInputStatePath??M(u,z,"external-inputs.json"),T=w.length>0?await Y(v):void 0,o=await U({additionalChangedFiles:d,base:m,downstream:s,externalInputs:w,fileOwners:l,head:c,ignoredFiles:t.affectedIgnore,previousExternalInputHashes:T,projectGraph:g,projects:I,upstream:r,workspaceRoot:u});return w.length>0&&o.externalInputHashes&&t.persistExternalInputState!==!1&&await Q(v,o.externalInputHashes),o.changedExternalInputs&&o.changedExternalInputs.length>0&&i.push(`including ${o.changedExternalInputs.length} changed external input(s) outside the workspace`),o.ignoredFiles.length>0&&i.push(`ignoring ${o.ignoredFiles.length} changed path(s) outside any project matching affectedIgnore`),{...o,externalInputStatePath:w.length>0?v:void 0,notes:i,uncommittedFileCount:d.length}};export{oe as i,Q as p,ae as s};
@@ -1 +1 @@
1
- import{createRequire as l}from"node:module";import{z as g}from"./index-BzhrR_iC.js";import{y as b}from"./isAccessibleSync-DYKTrrvc-C-_5cgwu.js";let E;const d=e=>(E??=l(import.meta.url))(e),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[t,r]=u.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return u.getBuiltinModule(e)}return d(e)},{spawnSync:p}=h("node:child_process"),A="0000000000000000000000000000000000000000",f=e=>{if(b(e))try{const t=g(e);return JSON.parse(t)}catch{return}},R=(e,t)=>{const r=p("git",e,{cwd:t,encoding:"utf8"});if(!(r.error||typeof r.status!="number"||r.status!==0))return typeof r.stdout=="string"?r.stdout.trim():void 0},_=e=>typeof e=="string"&&e.length>0&&e!==A,S=(e,t,r)=>{const o=[],s=e.GITHUB_BASE_REF,n=e.GITHUB_SHA??"HEAD";if(s&&s.length>0)return o.push(`pull_request: $GITHUB_BASE_REF=${s}`),{base:`origin/${s}`,head:n,notes:o,provider:"github"};const i=e.GITHUB_EVENT_PATH,c=i?r(i):void 0;if(c){const a=typeof c.before=="string"?c.before:void 0;if(_(a))return o.push(`push: event.before=${a}`),{base:a,head:n,notes:o,provider:"github"}}return o.push(`fallback: origin/${t}`),{base:`origin/${t}`,head:n,notes:o,provider:"github"}},I=(e,t)=>{const r=[],o=e.CI_COMMIT_SHA??"HEAD";if(e.CI_PIPELINE_SOURCE==="merge_request_event"){const c=e.CI_MERGE_REQUEST_DIFF_BASE_SHA;if(_(c))return r.push(`merge_request: $CI_MERGE_REQUEST_DIFF_BASE_SHA=${c}`),{base:c,head:o,notes:r,provider:"gitlab"};const a=e.CI_MERGE_REQUEST_TARGET_BRANCH_NAME;if(a&&a.length>0)return r.push(`merge_request: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME=${a}`),{base:`origin/${a}`,head:o,notes:r,provider:"gitlab"}}const n=e.CI_COMMIT_BEFORE_SHA;if(_(n))return r.push(`push: $CI_COMMIT_BEFORE_SHA=${n}`),{base:n,head:o,notes:r,provider:"gitlab"};const i=e.CI_DEFAULT_BRANCH??t;return r.push(`fallback: origin/${i}`),{base:`origin/${i}`,head:o,notes:r,provider:"gitlab"}},T=(e,t)=>{const r=[],o=e.BUILD_SOURCEVERSION??"HEAD",s=e.SYSTEM_PULLREQUEST_TARGETBRANCHNAME,n=e.SYSTEM_PULLREQUEST_TARGETBRANCH,i=s&&s.length>0?s:n?.replace(/^refs\/heads\//,"");return i&&i.length>0?(r.push(`pull_request: target branch ${i}`),{base:`origin/${i}`,head:o,notes:r,provider:"azure"}):(r.push(`fallback: origin/${t} (azure has no canonical previous-build SHA env)`),{base:`origin/${t}`,head:o,notes:r,provider:"azure"})},C=(e,t)=>{const r=[],o=e.BUILDKITE_COMMIT??"HEAD",s=e.BUILDKITE_PULL_REQUEST_BASE_BRANCH;return s&&s.length>0?(r.push(`pull_request: $BUILDKITE_PULL_REQUEST_BASE_BRANCH=${s}`),{base:`origin/${s}`,head:o,notes:r,provider:"buildkite"}):(r.push(`fallback: origin/${t} (buildkite has no canonical previous-build SHA env)`),{base:`origin/${t}`,head:o,notes:r,provider:"buildkite"})},B=(e,t)=>{const r=[],o=e.CIRCLE_SHA1??"HEAD",s=e.CIRCLE_PR_BASE_BRANCH;return s&&s.length>0?(r.push(`pull_request: $CIRCLE_PR_BASE_BRANCH=${s}`),{base:`origin/${s}`,head:o,notes:r,provider:"circleci"}):(r.push(`fallback: origin/${t} (circleci has no canonical previous-build SHA env)`),{base:`origin/${t}`,head:o,notes:r,provider:"circleci"})},H=(e,t,r)=>{const o=[],s=t(["merge-base","HEAD",`origin/${e}`],r);return s&&s.length>0?(o.push(`local: git merge-base HEAD origin/${e}=${s}`),{base:s,head:"HEAD",notes:o,provider:"local"}):(o.push(`local fallback: origin/${e} (no merge-base available)`),{base:`origin/${e}`,head:"HEAD",notes:o,provider:"local"})},m=e=>{const t=e?.env??process.env,r=e?.defaultBase??"main",o=e?.readEventPayload??f,s=e?.runGit??R,n=e?.workspaceRoot??process.cwd();return t.GITHUB_ACTIONS==="true"?S(t,r,o):t.GITLAB_CI==="true"?I(t,r):t.TF_BUILD?.toLowerCase()==="true"?T(t,r):t.BUILDKITE==="true"?C(t,r):t.CIRCLECI==="true"?B(t,r):H(r,s,n)};export{m as r};
1
+ import{createRequire as l}from"node:module";import{z as g}from"./index-0dnGN3GP.js";import{y as b}from"./isAccessibleSync-DYKTrrvc-CBsMZhj-.js";let E;const d=e=>(E??=l(import.meta.url))(e),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[t,r]=u.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return u.getBuiltinModule(e)}return d(e)},{spawnSync:p}=h("node:child_process"),A="0000000000000000000000000000000000000000",f=e=>{if(b(e))try{const t=g(e);return JSON.parse(t)}catch{return}},R=(e,t)=>{const r=p("git",e,{cwd:t,encoding:"utf8"});if(!(r.error||typeof r.status!="number"||r.status!==0))return typeof r.stdout=="string"?r.stdout.trim():void 0},_=e=>typeof e=="string"&&e.length>0&&e!==A,S=(e,t,r)=>{const o=[],s=e.GITHUB_BASE_REF,n=e.GITHUB_SHA??"HEAD";if(s&&s.length>0)return o.push(`pull_request: $GITHUB_BASE_REF=${s}`),{base:`origin/${s}`,head:n,notes:o,provider:"github"};const i=e.GITHUB_EVENT_PATH,c=i?r(i):void 0;if(c){const a=typeof c.before=="string"?c.before:void 0;if(_(a))return o.push(`push: event.before=${a}`),{base:a,head:n,notes:o,provider:"github"}}return o.push(`fallback: origin/${t}`),{base:`origin/${t}`,head:n,notes:o,provider:"github"}},I=(e,t)=>{const r=[],o=e.CI_COMMIT_SHA??"HEAD";if(e.CI_PIPELINE_SOURCE==="merge_request_event"){const c=e.CI_MERGE_REQUEST_DIFF_BASE_SHA;if(_(c))return r.push(`merge_request: $CI_MERGE_REQUEST_DIFF_BASE_SHA=${c}`),{base:c,head:o,notes:r,provider:"gitlab"};const a=e.CI_MERGE_REQUEST_TARGET_BRANCH_NAME;if(a&&a.length>0)return r.push(`merge_request: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME=${a}`),{base:`origin/${a}`,head:o,notes:r,provider:"gitlab"}}const n=e.CI_COMMIT_BEFORE_SHA;if(_(n))return r.push(`push: $CI_COMMIT_BEFORE_SHA=${n}`),{base:n,head:o,notes:r,provider:"gitlab"};const i=e.CI_DEFAULT_BRANCH??t;return r.push(`fallback: origin/${i}`),{base:`origin/${i}`,head:o,notes:r,provider:"gitlab"}},T=(e,t)=>{const r=[],o=e.BUILD_SOURCEVERSION??"HEAD",s=e.SYSTEM_PULLREQUEST_TARGETBRANCHNAME,n=e.SYSTEM_PULLREQUEST_TARGETBRANCH,i=s&&s.length>0?s:n?.replace(/^refs\/heads\//,"");return i&&i.length>0?(r.push(`pull_request: target branch ${i}`),{base:`origin/${i}`,head:o,notes:r,provider:"azure"}):(r.push(`fallback: origin/${t} (azure has no canonical previous-build SHA env)`),{base:`origin/${t}`,head:o,notes:r,provider:"azure"})},C=(e,t)=>{const r=[],o=e.BUILDKITE_COMMIT??"HEAD",s=e.BUILDKITE_PULL_REQUEST_BASE_BRANCH;return s&&s.length>0?(r.push(`pull_request: $BUILDKITE_PULL_REQUEST_BASE_BRANCH=${s}`),{base:`origin/${s}`,head:o,notes:r,provider:"buildkite"}):(r.push(`fallback: origin/${t} (buildkite has no canonical previous-build SHA env)`),{base:`origin/${t}`,head:o,notes:r,provider:"buildkite"})},B=(e,t)=>{const r=[],o=e.CIRCLE_SHA1??"HEAD",s=e.CIRCLE_PR_BASE_BRANCH;return s&&s.length>0?(r.push(`pull_request: $CIRCLE_PR_BASE_BRANCH=${s}`),{base:`origin/${s}`,head:o,notes:r,provider:"circleci"}):(r.push(`fallback: origin/${t} (circleci has no canonical previous-build SHA env)`),{base:`origin/${t}`,head:o,notes:r,provider:"circleci"})},H=(e,t,r)=>{const o=[],s=t(["merge-base","HEAD",`origin/${e}`],r);return s&&s.length>0?(o.push(`local: git merge-base HEAD origin/${e}=${s}`),{base:s,head:"HEAD",notes:o,provider:"local"}):(o.push(`local fallback: origin/${e} (no merge-base available)`),{base:`origin/${e}`,head:"HEAD",notes:o,provider:"local"})},m=e=>{const t=e?.env??process.env,r=e?.defaultBase??"main",o=e?.readEventPayload??f,s=e?.runGit??R,n=e?.workspaceRoot??process.cwd();return t.GITHUB_ACTIONS==="true"?S(t,r,o):t.GITLAB_CI==="true"?I(t,r):t.TF_BUILD?.toLowerCase()==="true"?T(t,r):t.BUILDKITE==="true"?C(t,r):t.CIRCLECI==="true"?B(t,r):H(r,s,n)};export{m as r};
@@ -1,4 +1,4 @@
1
- import{createRequire as Z}from"node:module";import{O as ie}from"./renderToString-DR0zDUjh-DXppT6AM.js";import{R as v,X as ce,O as k}from"./registry-Dg9XI6RT.js";import{q as de}from"./table-oA7p7-yP.js";import{a as le,c as ue,d as pe,e as me}from"./ai-cache-iSIyY3So.js";let ee;const te=e=>(ee??=Z(import.meta.url))(e),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[n,t]=y.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return y.getBuiltinModule(e)}return te(e)},{spawn:ne,execFileSync:G,execFile:se}=E("node:child_process"),{existsSync:_,readFileSync:oe}=E("node:fs"),{platform:re,homedir:q}=E("node:os"),{join:h,win32:R}=E("node:path"),{StringDecoder:$}=E("node:string_decoder"),{promisify:ae}=E("node:util"),fe=/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/,he=5e3,ge=1e4,ve=3e5,be=4096,O=re()==="win32",U=["amp","claude","codex","copilot","crush","cursor","droid","gemini","kimi","opencode","qwen"],ke={alternateCommands:[],buildArgs:(e,{dangerous:n})=>{const t=["-x",e];return n&&t.push("--dangerously-allow-all"),t},command:"amp",defaultModel:"",displayName:"Amp",envVariable:"AMP_PATH",sessionMarkers:[{confidence:"definite",variable:"AMP_CURRENT_THREAD_ID"},{confidence:"definite",equals:"amp",variable:"AGENT"}],supportsMaxTokens:!1,supportsModel:!1},Ae={alternateCommands:[],buildArgs:(e,{dangerous:n,model:t})=>{const s=[];return n&&s.push("--dangerously-skip-permissions"),t&&s.push("--model",t),s.push("--output-format","text","-p",e),s},command:"claude",defaultModel:"",displayName:"Claude Code",envVariable:"CLAUDE_PATH",sessionMarkers:[{confidence:"definite",variable:"CLAUDECODE"},{confidence:"definite",variable:"CLAUDE_CODE"}],supportsMaxTokens:!1,supportsModel:!0},Ee={alternateCommands:["openai-codex"],buildArgs:(e,{dangerous:n,model:t})=>{const s=["exec"];return t&&s.push("--model",t),n&&s.push("--dangerously-bypass-approvals-and-sandbox"),s.push("--",e),s},command:"codex",defaultModel:"",displayName:"Codex",envVariable:"CODEX_PATH",sessionMarkers:[{confidence:"definite",variable:"CODEX_SANDBOX"},{confidence:"definite",variable:"CODEX_THREAD_ID"},{confidence:"definite",variable:"CODEX_CI"}],supportsMaxTokens:!1,supportsModel:!0},Ce={alternateCommands:[],buildArgs:(e,{dangerous:n,model:t})=>{const s=["-p",e];return n&&s.push("--allow-all-tools"),t&&s.push("--model",t),s},command:"copilot",defaultModel:"",displayName:"GitHub Copilot CLI",envVariable:"COPILOT_PATH",sessionMarkers:[{confidence:"definite",variable:"COPILOT_MODEL"},{confidence:"definite",variable:"COPILOT_ALLOW_ALL"},{confidence:"definite",variable:"COPILOT_GITHUB_TOKEN"},{agent:"GitHub Copilot in VS Code",confidence:"definite",label:"TERM_PROGRAM+GIT_PAGER",match:{all:[["TERM_PROGRAM","vscode"],["GIT_PAGER","cat"]],none:["CURSOR_TRACE_ID"]}}],supportsMaxTokens:!1,supportsModel:!0},ye={alternateCommands:[],buildArgs:(e,{dangerous:n,model:t})=>{const s=["run"];return n&&s.push("--yolo"),t&&s.push("-m",t),s.push("--",e),s},command:"crush",defaultModel:"",displayName:"Crush",envVariable:"CRUSH_PATH",sessionMarkers:[{confidence:"definite",equals:"1",variable:"CRUSH"},{confidence:"definite",equals:"crush",variable:"AGENT"}],supportsMaxTokens:!1,supportsModel:!0},we={alternateCommands:["cursor"],buildArgs:(e,{dangerous:n,model:t})=>{const s=["-p"];return n&&s.push("--force"),s.push("--output-format","text"),t&&s.push("--model",t),s.push("--",e),s},command:"agent",defaultModel:"",displayName:"Cursor Agent",envVariable:"CURSOR_PATH",sessionMarkers:[{confidence:"definite",variable:"CURSOR_AGENT"},{confidence:"definite",label:"CURSOR_TRACE_ID+PAGER",match:{all:["CURSOR_TRACE_ID",["PAGER","head -n 10000 | cat"]]}},{agent:"Cursor editor",confidence:"ambient",variable:"CURSOR_TRACE_ID"}],supportsMaxTokens:!1,supportsModel:!0},Se={alternateCommands:[],buildArgs:(e,{dangerous:n,model:t})=>{const s=[];return n&&s.push("--skip-permissions-unsafe"),s.push("-o","text"),t&&s.push("-m",t),s.push("--",e),s},command:"droid",defaultModel:"",displayName:"Droid",envVariable:"DROID_PATH",sessionMarkers:[],supportsMaxTokens:!1,supportsModel:!0},Me={alternateCommands:["gemini-cli"],buildArgs:(e,{dangerous:n,maxTokens:t,model:s})=>{const o=[];return n||o.push("--sandbox"),s&&o.push("--model",s),o.push("--max-output-tokens",String(t),"-p",e),o},command:"gemini",defaultModel:"gemini-2.5-pro",displayName:"Gemini CLI",envVariable:"GEMINI_PATH",sessionMarkers:[{confidence:"definite",label:"GEMINI_CLI",match:{all:["GEMINI_CLI"],none:["QWEN_CODE"]}}],supportsMaxTokens:!0,supportsModel:!0},_e={alternateCommands:[],buildArgs:(e,{model:n})=>{const t=["--quiet","-p",e];return n&&t.push("-m",n),t},command:"kimi",defaultModel:"",displayName:"Kimi CLI",envVariable:"KIMI_PATH",sessionMarkers:[],supportsMaxTokens:!1,supportsModel:!0},Re={alternateCommands:[],buildArgs:(e,{model:n})=>{const t=["run"];return n&&t.push("-m",n),t.push("--",e),t},command:"opencode",defaultModel:"",displayName:"opencode",envVariable:"OPENCODE_PATH",sessionMarkers:[{confidence:"definite",label:"OPENCODE",match:{any:["OPENCODE","OPENCODE_BIN_PATH","OPENCODE_SERVER","OPENCODE_APP_INFO","OPENCODE_MODES","OPENCODE_CLIENT"]}}],supportsMaxTokens:!1,supportsModel:!0},Oe={alternateCommands:["qwen-code"],buildArgs:(e,{dangerous:n,model:t})=>{const s=["-p",e];return n&&s.push("--yolo"),s.push("-o","text"),t&&s.push("-m",t),s},command:"qwen",defaultModel:"",displayName:"Qwen Code",envVariable:"QWEN_PATH",sessionMarkers:[{confidence:"definite",equals:"1",variable:"QWEN_CODE"}],supportsMaxTokens:!1,supportsModel:!0},F={amp:ke,claude:Ae,codex:Ee,copilot:Ce,crush:ye,cursor:we,droid:Se,gemini:Me,kimi:_e,opencode:Re,qwen:Oe};class A extends Error{exitCode;durationMs;provider;stderr;stdout;timedOut;aborted;constructor(n,t){super(n),this.name="AiRunError",this.provider=t.provider,this.exitCode=t.exitCode??null,this.durationMs=t.durationMs,this.stdout=t.stdout??"",this.stderr=t.stderr??"",this.timedOut=t.timedOut??!1,this.aborted=t.aborted??!1}}const Te=/"%~?dp0%?\\?([^"]+?\.[cm]?js)"/i,Ie=(e,n)=>{const t=Te.exec(e)?.[1];if(t!==void 0)return R.resolve(R.dirname(n),t)},Ne=e=>{let n;try{n=oe(e,"utf8")}catch{return}const t=Ie(n,e);if(t!==void 0)return _(t)?t:void 0},Le=e=>{const n=R.join(R.dirname(e),"node.exe");return _(n)?n:"node"};ae(se);const xe=/\.(?:bat|cmd)$/i,j=e=>`"${e.replaceAll('"','""')}"`,B=(e,n=O)=>{if(!n||!xe.test(e))return{file:e,mode:"direct",prefixArguments:[]};const t=Ne(e);return t!==void 0?{file:Le(e),mode:"direct",prefixArguments:[t]}:{commandPath:e,mode:"shell"}},K=(e,n)=>e.mode==="shell"?{file:j(e.commandPath),shell:!0,spawnArguments:n.map(t=>j(t))}:{file:e.file,shell:!1,spawnArguments:[...e.prefixArguments,...n]},V=e=>e==="~"||e.startsWith("~/")||O&&e.startsWith("~\\")?h(q(),e.slice(2)):e,Pe=e=>{try{const n=G(O?"where":"which",[e],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:he}).trim().split(`
1
+ import{createRequire as Z}from"node:module";import{O as ie}from"./renderToString-DR0zDUjh-DeiCwydO.js";import{R as v,X as ce,O as k}from"./registry-CndByNx9.js";import{q as de}from"./table-bu4cV-it.js";import{a as le,c as ue,d as pe,e as me}from"./ai-cache-Dkb6me20.js";let ee;const te=e=>(ee??=Z(import.meta.url))(e),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[n,t]=y.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return y.getBuiltinModule(e)}return te(e)},{spawn:ne,execFileSync:G,execFile:se}=E("node:child_process"),{existsSync:_,readFileSync:oe}=E("node:fs"),{platform:re,homedir:q}=E("node:os"),{join:h,win32:R}=E("node:path"),{StringDecoder:$}=E("node:string_decoder"),{promisify:ae}=E("node:util"),fe=/v?(\d+\.\d+\.\d+(?:-[\w.]+)?)/,he=5e3,ge=1e4,ve=3e5,be=4096,O=re()==="win32",U=["amp","claude","codex","copilot","crush","cursor","droid","gemini","kimi","opencode","qwen"],ke={alternateCommands:[],buildArgs:(e,{dangerous:n})=>{const t=["-x",e];return n&&t.push("--dangerously-allow-all"),t},command:"amp",defaultModel:"",displayName:"Amp",envVariable:"AMP_PATH",sessionMarkers:[{confidence:"definite",variable:"AMP_CURRENT_THREAD_ID"},{confidence:"definite",equals:"amp",variable:"AGENT"}],supportsMaxTokens:!1,supportsModel:!1},Ae={alternateCommands:[],buildArgs:(e,{dangerous:n,model:t})=>{const s=[];return n&&s.push("--dangerously-skip-permissions"),t&&s.push("--model",t),s.push("--output-format","text","-p",e),s},command:"claude",defaultModel:"",displayName:"Claude Code",envVariable:"CLAUDE_PATH",sessionMarkers:[{confidence:"definite",variable:"CLAUDECODE"},{confidence:"definite",variable:"CLAUDE_CODE"}],supportsMaxTokens:!1,supportsModel:!0},Ee={alternateCommands:["openai-codex"],buildArgs:(e,{dangerous:n,model:t})=>{const s=["exec"];return t&&s.push("--model",t),n&&s.push("--dangerously-bypass-approvals-and-sandbox"),s.push("--",e),s},command:"codex",defaultModel:"",displayName:"Codex",envVariable:"CODEX_PATH",sessionMarkers:[{confidence:"definite",variable:"CODEX_SANDBOX"},{confidence:"definite",variable:"CODEX_THREAD_ID"},{confidence:"definite",variable:"CODEX_CI"}],supportsMaxTokens:!1,supportsModel:!0},Ce={alternateCommands:[],buildArgs:(e,{dangerous:n,model:t})=>{const s=["-p",e];return n&&s.push("--allow-all-tools"),t&&s.push("--model",t),s},command:"copilot",defaultModel:"",displayName:"GitHub Copilot CLI",envVariable:"COPILOT_PATH",sessionMarkers:[{confidence:"definite",variable:"COPILOT_MODEL"},{confidence:"definite",variable:"COPILOT_ALLOW_ALL"},{confidence:"definite",variable:"COPILOT_GITHUB_TOKEN"},{agent:"GitHub Copilot in VS Code",confidence:"definite",label:"TERM_PROGRAM+GIT_PAGER",match:{all:[["TERM_PROGRAM","vscode"],["GIT_PAGER","cat"]],none:["CURSOR_TRACE_ID"]}}],supportsMaxTokens:!1,supportsModel:!0},ye={alternateCommands:[],buildArgs:(e,{dangerous:n,model:t})=>{const s=["run"];return n&&s.push("--yolo"),t&&s.push("-m",t),s.push("--",e),s},command:"crush",defaultModel:"",displayName:"Crush",envVariable:"CRUSH_PATH",sessionMarkers:[{confidence:"definite",equals:"1",variable:"CRUSH"},{confidence:"definite",equals:"crush",variable:"AGENT"}],supportsMaxTokens:!1,supportsModel:!0},we={alternateCommands:["cursor"],buildArgs:(e,{dangerous:n,model:t})=>{const s=["-p"];return n&&s.push("--force"),s.push("--output-format","text"),t&&s.push("--model",t),s.push("--",e),s},command:"agent",defaultModel:"",displayName:"Cursor Agent",envVariable:"CURSOR_PATH",sessionMarkers:[{confidence:"definite",variable:"CURSOR_AGENT"},{confidence:"definite",label:"CURSOR_TRACE_ID+PAGER",match:{all:["CURSOR_TRACE_ID",["PAGER","head -n 10000 | cat"]]}},{agent:"Cursor editor",confidence:"ambient",variable:"CURSOR_TRACE_ID"}],supportsMaxTokens:!1,supportsModel:!0},Se={alternateCommands:[],buildArgs:(e,{dangerous:n,model:t})=>{const s=[];return n&&s.push("--skip-permissions-unsafe"),s.push("-o","text"),t&&s.push("-m",t),s.push("--",e),s},command:"droid",defaultModel:"",displayName:"Droid",envVariable:"DROID_PATH",sessionMarkers:[],supportsMaxTokens:!1,supportsModel:!0},Me={alternateCommands:["gemini-cli"],buildArgs:(e,{dangerous:n,maxTokens:t,model:s})=>{const o=[];return n||o.push("--sandbox"),s&&o.push("--model",s),o.push("--max-output-tokens",String(t),"-p",e),o},command:"gemini",defaultModel:"gemini-2.5-pro",displayName:"Gemini CLI",envVariable:"GEMINI_PATH",sessionMarkers:[{confidence:"definite",label:"GEMINI_CLI",match:{all:["GEMINI_CLI"],none:["QWEN_CODE"]}}],supportsMaxTokens:!0,supportsModel:!0},_e={alternateCommands:[],buildArgs:(e,{model:n})=>{const t=["--quiet","-p",e];return n&&t.push("-m",n),t},command:"kimi",defaultModel:"",displayName:"Kimi CLI",envVariable:"KIMI_PATH",sessionMarkers:[],supportsMaxTokens:!1,supportsModel:!0},Re={alternateCommands:[],buildArgs:(e,{model:n})=>{const t=["run"];return n&&t.push("-m",n),t.push("--",e),t},command:"opencode",defaultModel:"",displayName:"opencode",envVariable:"OPENCODE_PATH",sessionMarkers:[{confidence:"definite",label:"OPENCODE",match:{any:["OPENCODE","OPENCODE_BIN_PATH","OPENCODE_SERVER","OPENCODE_APP_INFO","OPENCODE_MODES","OPENCODE_CLIENT"]}}],supportsMaxTokens:!1,supportsModel:!0},Oe={alternateCommands:["qwen-code"],buildArgs:(e,{dangerous:n,model:t})=>{const s=["-p",e];return n&&s.push("--yolo"),s.push("-o","text"),t&&s.push("-m",t),s},command:"qwen",defaultModel:"",displayName:"Qwen Code",envVariable:"QWEN_PATH",sessionMarkers:[{confidence:"definite",equals:"1",variable:"QWEN_CODE"}],supportsMaxTokens:!1,supportsModel:!0},F={amp:ke,claude:Ae,codex:Ee,copilot:Ce,crush:ye,cursor:we,droid:Se,gemini:Me,kimi:_e,opencode:Re,qwen:Oe};class A extends Error{exitCode;durationMs;provider;stderr;stdout;timedOut;aborted;constructor(n,t){super(n),this.name="AiRunError",this.provider=t.provider,this.exitCode=t.exitCode??null,this.durationMs=t.durationMs,this.stdout=t.stdout??"",this.stderr=t.stderr??"",this.timedOut=t.timedOut??!1,this.aborted=t.aborted??!1}}const Te=/"%~?dp0%?\\?([^"]+?\.[cm]?js)"/i,Ie=(e,n)=>{const t=Te.exec(e)?.[1];if(t!==void 0)return R.resolve(R.dirname(n),t)},Ne=e=>{let n;try{n=oe(e,"utf8")}catch{return}const t=Ie(n,e);if(t!==void 0)return _(t)?t:void 0},Le=e=>{const n=R.join(R.dirname(e),"node.exe");return _(n)?n:"node"};ae(se);const xe=/\.(?:bat|cmd)$/i,j=e=>`"${e.replaceAll('"','""')}"`,B=(e,n=O)=>{if(!n||!xe.test(e))return{file:e,mode:"direct",prefixArguments:[]};const t=Ne(e);return t!==void 0?{file:Le(e),mode:"direct",prefixArguments:[t]}:{commandPath:e,mode:"shell"}},K=(e,n)=>e.mode==="shell"?{file:j(e.commandPath),shell:!0,spawnArguments:n.map(t=>j(t))}:{file:e.file,shell:!1,spawnArguments:[...e.prefixArguments,...n]},V=e=>e==="~"||e.startsWith("~/")||O&&e.startsWith("~\\")?h(q(),e.slice(2)):e,Pe=e=>{try{const n=G(O?"where":"which",[e],{encoding:"utf8",stdio:["pipe","pipe","pipe"],timeout:he}).trim().split(`
2
2
  `)[0]?.trim();return n&&n.length>0?n:void 0}catch{return}},De=e=>{const n=q();if(O){const t=process.env.APPDATA??"",s=process.env.LOCALAPPDATA??"",o=process.env.ProgramFiles??"";return[h(t,"npm",`${e}.cmd`),h(t,"npm",e),h(s,"Programs",e,`${e}.exe`),h(o,e,`${e}.exe`),h(n,".npm-global","bin",`${e}.cmd`)]}return[`/opt/homebrew/bin/${e}`,`/usr/local/bin/${e}`,h(n,".npm-global","bin",e),h(n,".local","bin",e),h(n,".cargo","bin",e)]},$e=e=>{try{const{file:n,shell:t,spawnArguments:s}=K(B(e),["--version"]),o=G(n,s,{encoding:"utf8",shell:t,stdio:["pipe","pipe","pipe"],timeout:ge}),r=fe.exec(o);return r?r[1]:void 0}catch{return}},X=(e,n={})=>{const t=F[e],s={available:!1,name:e},o=n.version!==!1,r=i=>{if(o)return $e(i)},a=process.env[t.envVariable];if(a&&_(V(a))){const i=V(a);return{...s,available:!0,detectionMethod:"envvar",path:i,version:r(i)}}const l=[t.command,...t.alternateCommands];for(const i of l){const c=Pe(i);if(c)return{...s,available:!0,detectionMethod:"which",path:c,version:r(c)}}for(const i of l)for(const c of De(i))if(_(c))return{...s,available:!0,detectionMethod:"known-path",path:c,version:r(c)};return s},je=(e={})=>U.map(n=>X(n,e)),Ve=(e={})=>je(e).filter(n=>n.available),He=(e,n,t={})=>{const s=F[e],o=t.model??s.defaultModel,r=t.maxTokens!==void 0&&Number.isFinite(t.maxTokens)?t.maxTokens:be;return s.buildArgs(n,{dangerous:t.dangerous===!0,maxTokens:r,model:o})},Ge=async(e,n,t={})=>{if(!e.available||!e.path)throw new A(`AI provider "${e.name}" is not available.`,{durationMs:0,provider:e.name});const s=He(e.name,n,t),o=t.timeoutMs!==void 0&&Number.isFinite(t.timeoutMs)?t.timeoutMs:ve,r=e.path,a=K(B(r),s),l=Date.now();if(t.signal?.aborted)throw new A(`${e.name} CLI run was aborted.`,{aborted:!0,durationMs:0,provider:e.name});return new Promise((i,c)=>{const f={cwd:t.cwd,env:{...process.env,...t.env,FORCE_COLOR:"0",NO_COLOR:"1"},shell:a.shell,stdio:["pipe","pipe","pipe"]},d=ne(a.file,a.spawnArguments,f);d.stdin?.end();let m="",g="",b=!1;const N=new $("utf8"),L=new $("utf8");let w,x,S;const T=()=>{clearTimeout(x),S&&t.signal?.removeEventListener("abort",S)},Q=()=>{d.kill("SIGKILL")},P=p=>{if(b)return;b=!0,d.kill("SIGTERM"),w=setTimeout(Q,5e3),w.unref(),T();const u=Date.now()-l,C=p?new A(`${e.name} CLI run was aborted.`,{aborted:!0,durationMs:u,provider:e.name,stderr:g,stdout:m}):new A(`${e.name} CLI timed out after ${String(o)}ms`,{durationMs:u,provider:e.name,stderr:g,stdout:m,timedOut:!0});c(C)};x=setTimeout(P,o,!1),S=()=>{P(!0)},t.signal?.addEventListener("abort",S,{once:!0}),d.stdout?.on("data",p=>{const u=N.write(p);u&&(m+=u,t.onStdout?.(u))}),d.stderr?.on("data",p=>{const u=L.write(p);u&&(g+=u,t.onStderr?.(u))}),d.on("close",p=>{clearTimeout(w);const u=N.end();u&&(m+=u,t.onStdout?.(u));const C=L.end();if(C&&(g+=C,t.onStderr?.(C)),b)return;b=!0,T();const D=Date.now()-l;p===0?i({durationMs:D,exitCode:p,provider:e.name,stderr:g,stdout:m}):c(new A(`${e.name} CLI exited with code ${String(p)}: ${g||m}`,{durationMs:D,exitCode:p,provider:e.name,stderr:g,stdout:m}))}),d.on("error",p=>{clearTimeout(w),!b&&(b=!0,T(),c(new A(`Failed to spawn ${e.name} CLI: ${p.message}`,{durationMs:Date.now()-l,provider:e.name,stderr:g,stdout:m})))})})},qe=12e4,Ue=2,Fe=1e3,Be=e=>new Promise(n=>{setTimeout(n,e)}),J=async(e,n,t=Ue)=>{let s;for(let o=0;o<=t;o+=1)try{return(await Ge(e,n,{timeoutMs:qe})).stdout}catch(r){if(s=r instanceof Error?r:new Error(String(r)),s.message.includes("timed out"))throw s;if(o<t){const a=Fe*2**o;await Be(a)}}throw s??new Error("AI request failed after retries")},Ke={amp:30,claude:80,codex:60,copilot:50,crush:35,cursor:40,droid:20,gemini:100,kimi:25,opencode:35,qwen:30},Xe=e=>{if(e?.provider){if(!U.includes(e.provider))return;const s=X(e.provider);return s.available?s:void 0}const n=Ve();if(n.length===0)return;const t={...Ke,...e?.priority};return n.toSorted((s,o)=>(t[o.name]??0)-(t[s.name]??0))[0]},Je=new Set(["defer","review","skip","update"]),We=new Set(["critical","high","low","medium"]),Ye=new Set(["high","low","medium"]),ze=50,I=30,Qe=e=>e.map(n=>{const t=n.vulnerabilities&&n.vulnerabilities.length>0?` [VULNERABILITIES: ${n.vulnerabilities.map(o=>`${o.severity} ${o.id}`).join(", ")}]`:"";let s="";if(n.socketReport){const o=Math.round(n.socketReport.score.overall*100),r=[`score:${String(o)}%`];if(n.socketReport.alerts.length>0){const a={};for(const i of n.socketReport.alerts)a[i.severity]=(a[i.severity]??0)+1;const l=Object.entries(a).map(([i,c])=>`${String(c)} ${i}`).join(", ");r.push(`alerts: ${l}`)}r.push(`supply-chain:${String(Math.round(n.socketReport.score.supplyChain*100))}%`),r.push(`quality:${String(Math.round(n.socketReport.score.quality*100))}%`),s=` [SOCKET.DEV: ${r.join(", ")}]`}return`- ${n.packageName}: ${n.currentRange} → ${n.newRange} (${n.updateType})${t}${s}`}).join(`
3
3
  `),M=`Respond ONLY with valid JSON in this exact structure:
4
4
  {
@@ -0,0 +1 @@
1
+ import{createRequire as v}from"node:module";import{x as p}from"./xxh3-BLHlvhgT.js";import{e as c}from"./index-0dnGN3GP.js";import{g as M,h as $}from"./env-BymuoTL8.js";import{y as d}from"./isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{p as g}from"./package-version-x7sPg2TM.js";let C;const D=t=>(C??=v(import.meta.url))(t),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=t=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[e,r]=a.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return a.getBuiltinModule(t)}return D(t)},{randomUUID:j}=h("node:crypto"),{rmSync:f,writeFileSync:w,renameSync:T,unlinkSync:A,readdirSync:m,statSync:b}=h("node:fs"),i=()=>c(M(),"ai"),B=3600*1e3,E=1800*1e3,_=()=>{$(i())},S=(t,e)=>{const r=`${t}.${String(process.pid)}.${j()}.tmp`;try{w(r,e,"utf8"),T(r,t)}catch(o){try{A(r)}catch{}throw o}},P=(t,e,r)=>{const o=r.map(n=>({currentRange:n.currentRange,name:n.packageName,targetVersion:n.targetVersion})).toSorted((n,l)=>n.name.localeCompare(l.name)),s=JSON.stringify({analysisType:e,packages:o,provider:t});return p(Buffer.from(s))},U=t=>{const e=c(i(),`${t}.json`);if(d(e))try{const r=g(e);if(Date.now()-r.createdAt>r.ttlMs){f(e,{force:!0});return}return r.result}catch{f(e,{force:!0});return}},k=(t,e,r)=>{_();const o=i(),s={createdAt:Date.now(),result:e,ttlMs:r};S(c(o,`${t}.json`),JSON.stringify(s,void 0,2))},z=(t,e)=>e!==void 0&&e>0?e:t==="security"?E:B,F=()=>{const t=i();if(!d(t))return{entries:0,newestEntry:void 0,oldestEntry:void 0,totalSizeBytes:0};const e=m(t).filter(n=>n.endsWith(".json"));let r=0,o,s;for(const n of e){const l=c(t,n),y=b(l);r+=y.size;const{mtimeMs:u}=y;(o===void 0||u<o)&&(o=u),(s===void 0||u>s)&&(s=u)}return{entries:e.length,newestEntry:s,oldestEntry:o,totalSizeBytes:r}},L=t=>p(Buffer.from(JSON.stringify(t))),V=t=>{const e=c(i(),`${t}.json`);if(d(e))try{const r=g(e);if(Date.now()-r.createdAt>r.ttlMs){f(e,{force:!0});return}return r.result}catch{f(e,{force:!0});return}},W=(t,e,r)=>{_();const o=i(),s={createdAt:Date.now(),result:e,ttlMs:r};S(c(o,`${t}.json`),JSON.stringify(s,void 0,2))},H=()=>{const t=i();if(!d(t))return 0;const e=m(t).filter(r=>r.endsWith(".json"));for(const r of e)f(c(t,r),{force:!0});return e.length};export{P as a,L as b,U as c,k as d,z as e,H as f,V as g,F as h,W as s};
@@ -1,4 +1,4 @@
1
- import{createRequire as T}from"node:module";import{readLastRunSummary as _}from"@visulima/task-runner";import{a as $}from"./failure-log-DIsKBKaI.js";import{f as v,a as P,d as D,r as j}from"./run-summary-utils-CMeURYtS.js";import{d as E}from"./env-BSXG3QKH.js";import{v as x,U as y,e as R,a as L}from"./index-BzhrR_iC.js";import{a as M,b as B,e as H}from"./ai-analysis-BCJ1kuDM.js";import{g as C,s as U,b as k}from"./ai-cache-iSIyY3So.js";let I;const F=e=>(I??=T(import.meta.url))(e),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,n]=h.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return h.getBuiltinModule(e)}return F(e)},{readFile:N,writeFile:A}=O("node:fs/promises"),q=32*1024,W=(e,t)=>{if(e.length<=t)return e;const n=e.slice(-t),o=e.length-n.length;return`[…${String(o)} bytes truncated from head…]
1
+ import{createRequire as T}from"node:module";import{readLastRunSummary as _}from"@visulima/task-runner";import{a as $}from"./failure-log-BslhfaEO.js";import{f as v,a as P,d as D,r as j}from"./run-summary-utils-DbyeUM6f.js";import{d as E}from"./env-BymuoTL8.js";import{v as x,U as y,e as R,a as L}from"./index-0dnGN3GP.js";import{a as M,b as B,e as H}from"./ai-analysis-CO4rT3Nd.js";import{g as C,s as U,b as k}from"./ai-cache-Dkb6me20.js";let I;const F=e=>(I??=T(import.meta.url))(e),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[t,n]=h.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return h.getBuiltinModule(e)}return F(e)},{readFile:N,writeFile:A}=O("node:fs/promises"),q=32*1024,W=(e,t)=>{if(e.length<=t)return e;const n=e.slice(-t),o=e.length-n.length;return`[…${String(o)} bytes truncated from head…]
2
2
  ${n}`},J=async(e,t)=>t===void 0?_(e,{dataDirectory:E(e)}):j(e,t),le=async(e,t,n={})=>{const o=n.terminalOutputLimit??q,[r,i]=await Promise.all([$(e,t),J(e,n.runId)]),s=i?v(i,t):void 0;if(!r&&!s)return;let a,c;if(i&&s){const u=await P(e,i.id),f=u?v(u,t):void 0;a=D(s.hashDetails,f?.hashDetails),c=u?.id}const d=r?.terminalOutput??"";return{command:r?.command??void 0,cwd:r?.cwd??void 0,dependencies:s?.dependencies??[],duration:s?.duration,exitCode:r?.exitCode??s?.exitCode,hash:s?.hash??r?.hash,hashDetails:s?.hashDetails,hashDiff:a,previousRunId:c,project:s?.target.project,runId:i?.id??r?.runId,status:r?.status??(s?K(s):void 0),target:s?.target.target,taskId:t,terminalOutput:W(d,o),terminalOutputCaptured:!!r,timestamp:r?.timestamp??s?.endTime??s?.startTime}},K=e=>{if(e.exitCode!==void 0&&e.exitCode!==0)return"failure";switch(e.cacheStatus){case"HIT":return"local-cache";case"REMOTE_HIT":return"remote-cache";case"SKIPPED":return"skipped";default:return e.exitCode===0?"success":void 0}},Y=3600*1e3,w=80,V=new Set(["high","low","medium"]),X=()=>`You are an expert software engineer helping fix a failing build/test/lint task.
3
3
 
4
4
  You will be given:
@@ -1,4 +1,4 @@
1
- import{createRequire as _}from"node:module";import{l as L}from"./target-options-DsHFmRZH.js";import{e as q}from"./index-BzhrR_iC.js";let P;const R=e=>(P??=_(import.meta.url))(e),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[t,r]=g.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return g.getBuiltinModule(e)}return R(e)},{createRequire:j}=b("node:module"),{pathToFileURL:F}=b("node:url"),w=["temporal","urlpattern","reporterror","regexp-escape","promise-try","float16array","error-iserror","navigator-locks"],x=e=>{const t=e.trim().toLowerCase();return t===""||t==="all"||t==="1"||t==="true"?w:t.split(",").map(r=>r.trim()).filter(r=>w.includes(r))},E=async(e,t)=>{try{const o=j(q(t,"__vis_polyfill_resolver__.js")).resolve(e);return await import(F(o).href)}catch{return}},A=async e=>{if(globalThis.Temporal!==void 0)return;const t=await E("@js-temporal/polyfill",e);t?.Temporal===void 0?process.stderr.write(`vis: --polyfill temporal requested but @js-temporal/polyfill is not installed in this project.
1
+ import{createRequire as _}from"node:module";import{l as L}from"./target-options-rIthWS4M.js";import{e as q}from"./index-0dnGN3GP.js";let P;const R=e=>(P??=_(import.meta.url))(e),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[t,r]=g.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return g.getBuiltinModule(e)}return R(e)},{createRequire:j}=b("node:module"),{pathToFileURL:F}=b("node:url"),w=["temporal","urlpattern","reporterror","regexp-escape","promise-try","float16array","error-iserror","navigator-locks"],x=e=>{const t=e.trim().toLowerCase();return t===""||t==="all"||t==="1"||t==="true"?w:t.split(",").map(r=>r.trim()).filter(r=>w.includes(r))},E=async(e,t)=>{try{const o=j(q(t,"__vis_polyfill_resolver__.js")).resolve(e);return await import(F(o).href)}catch{return}},A=async e=>{if(globalThis.Temporal!==void 0)return;const t=await E("@js-temporal/polyfill",e);t?.Temporal===void 0?process.stderr.write(`vis: --polyfill temporal requested but @js-temporal/polyfill is not installed in this project.
2
2
  `):globalThis.Temporal=t.Temporal},I=async e=>{if(globalThis.URLPattern!==void 0)return;const t=await E("urlpattern-polyfill",e);t?.URLPattern===void 0?process.stderr.write(`vis: --polyfill urlpattern requested but urlpattern-polyfill is not installed in this project.
3
3
  `):globalThis.URLPattern=t.URLPattern},N=()=>{typeof globalThis.reportError!="function"&&(globalThis.reportError=e=>{const t=e instanceof Error?e.stack??`${e.name}: ${e.message}`:String(e);process.stderr.write(`${t}
4
4
  `)})},O=()=>{if(typeof RegExp.escape=="function")return;const e=new Set(String.raw`^$\.*+?()[]{}|/`),t={"\f":String.raw`\f`,"\n":String.raw`\n`,"\r":String.raw`\r`," ":String.raw`\t`,"\v":String.raw`\v`},r=/\s/u,o=l=>l<=255?String.raw`\x${l.toString(16).padStart(2,"0")}`:String.raw`\u${l.toString(16).padStart(4,"0")}`;RegExp.escape=l=>{if(typeof l!="string")throw new TypeError("RegExp.escape requires a string argument");let i="",s=!0;for(const a of l){const u=a.codePointAt(0);s&&/[\dA-Za-z]/u.test(a)?i+=o(u):e.has(a)?i+=`\\${a}`:t[a]!==void 0?i+=t[a]:r.test(a)?i+=o(u):i+=a,s=!1}return i}},k=()=>{typeof Promise.try!="function"&&(Promise.try=function(t,...r){const o=typeof this=="function"?this:Promise;return new o((n,l)=>{try{n(t(...r))}catch(i){l(i)}})})},h=e=>{const t=new Float32Array(1),r=new Uint32Array(t.buffer);t[0]=e;const o=r[0],n=o>>>16&32768,l=o>>>23&255,i=o&8388607;if(l===255)return i===0?n|31744:n|32256;const s=l-127+15;if(s>=31)return n|31744;if(s<=0){if(s<-10)return n;const f=i|8388608,c=14-s;let p=f>>c;const m=f&(1<<c)-1,d=1<<c-1;return(m>d||m===d&&(p&1)===1)&&(p+=1),n|p}let a=s<<10|i>>13;const u=i&8191;return(u>4096||u===4096&&(a&1)===1)&&(a+=1),n|a},v=e=>{const t=e&32768?-1:1,r=e>>10&31,o=e&1023;return r===0?t*o*2**-24:r===31?o?Number.NaN:t*Number.POSITIVE_INFINITY:t*(1+o/1024)*2**(r-15)},U=()=>{const e=Math;typeof e.f16round!="function"&&(e.f16round=r=>v(h(r)));const t=DataView.prototype;typeof t.getFloat16!="function"&&(t.getFloat16=function(o,n){return v(this.getUint16(o,n))}),typeof t.setFloat16!="function"&&(t.setFloat16=function(o,n,l){this.setUint16(o,h(n),l)})},C=()=>{typeof Error.isError!="function"&&(Error.isError=e=>typeof e=="object"&&e!==null&&Object.prototype.toString.call(e)==="[object Error]")},V=()=>{const e=globalThis,t=e.navigator;if(t?.locks!==void 0)return;const r=new Map,o=new Set,n=s=>s.reason??(typeof DOMException=="function"?new DOMException("The lock request is aborted","AbortError"):Object.assign(new Error("The lock request is aborted"),{name:"AbortError"})),i={request:async(s,a,u)=>{const f=typeof a!="function",c=(f?a:{})??{},p=f?u:a,m=c.mode==="shared"?"shared":"exclusive";if(c.signal?.aborted)throw n(c.signal);if(c.ifAvailable===!0&&o.has(s))return p(null);const d=r.get(s)??Promise.resolve();let y;const S=new Promise(T=>{y=T});if(r.set(s,d.then(()=>S)),await d.catch(()=>{}),c.signal?.aborted)throw y(),n(c.signal);o.add(s);try{return await p({mode:m,name:s})}finally{o.delete(s),y()}}};t===void 0?Object.defineProperty(e,"navigator",{configurable:!0,enumerable:!0,value:{locks:i},writable:!0}):Object.defineProperty(t,"locks",{configurable:!0,enumerable:!0,value:i})},$={"error-iserror":C,float16array:U,"navigator-locks":V,"promise-try":k,"regexp-escape":O,reporterror:N},M=async(e,t=process.cwd())=>{const r=x(e);await Promise.all(r.map(async o=>{o==="temporal"?await A(t):o==="urlpattern"?await I(t):$[o]?.()}))},H=async e=>{for(const[t,r]of Object.entries(L(e,!0)))process.env[t]===void 0&&(process.env[t]=r);process.env.VIS_POLYFILL!==void 0&&await M(process.env.VIS_POLYFILL,e)};export{H as p};