just-bash 2.11.14 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/Bash.d.ts +6 -0
  2. package/dist/bin/chunks/awk2-YRDDZZBN.js +2 -0
  3. package/dist/bin/{shell/chunks/bash-WB6O736J.js → chunks/bash-6ZHZ6BX7.js} +1 -1
  4. package/dist/bin/chunks/{chunk-PDVXLMUU.js → chunk-27KQPTIX.js} +17 -17
  5. package/dist/bin/chunks/{chunk-XB2MDT3B.js → chunk-3NVWSLHI.js} +1 -1
  6. package/dist/bin/chunks/{chunk-K5IXNHO5.js → chunk-6KZRLMG3.js} +3 -3
  7. package/dist/bin/{shell/chunks/chunk-AHMZLMTU.js → chunks/chunk-6L4K3UGO.js} +1 -1
  8. package/dist/bin/{shell/chunks/chunk-K7XSYP4L.js → chunks/chunk-6SAF32NO.js} +1 -1
  9. package/dist/bin/chunks/{chunk-V4CRXAQO.js → chunk-7SWOLTCR.js} +1 -1
  10. package/dist/bin/chunks/{chunk-ISOXAKGQ.js → chunk-CPL5P744.js} +1 -1
  11. package/dist/bin/chunks/{chunk-BWWPUUC5.js → chunk-EPIOK4SY.js} +1 -1
  12. package/dist/bin/chunks/chunk-F37UEO7A.js +10 -0
  13. package/dist/bin/chunks/chunk-GO6FXSC4.js +6 -0
  14. package/dist/bin/chunks/chunk-HA4QZ6XJ.js +12 -0
  15. package/dist/bin/chunks/chunk-KTFEQPO7.js +4 -0
  16. package/dist/bin/{shell/chunks/chunk-LW7FS3EH.js → chunks/chunk-ND23BJUM.js} +1 -1
  17. package/dist/bin/chunks/chunk-QC46PWBQ.js +63 -0
  18. package/dist/bin/{shell/chunks/chunk-XORPAMNK.js → chunks/chunk-RYXW3SZQ.js} +1 -1
  19. package/dist/bin/chunks/chunk-WIWKAGK6.js +2 -0
  20. package/dist/bin/chunks/{expansion-AMH5BAVV.js → expansion-HLAOHDFJ.js} +1 -1
  21. package/dist/bin/{shell/chunks/flag-coverage-KFNWHFPU.js → chunks/flag-coverage-GZCUF7B4.js} +1 -1
  22. package/dist/bin/{shell/chunks/jq-TIHNHMOR.js → chunks/jq-CXSPO2J5.js} +1 -1
  23. package/dist/bin/chunks/printf-P3QVL4IO.js +2 -0
  24. package/dist/bin/chunks/python3-XRP5IZRL.js +16 -0
  25. package/dist/bin/chunks/sed-DNLJZZXZ.js +2 -0
  26. package/dist/bin/chunks/sleep-RA6DYTJX.js +2 -0
  27. package/dist/bin/chunks/sqlite3-2UNB5OLS.js +2 -0
  28. package/dist/bin/chunks/tar-GP2CCB47.js +2 -0
  29. package/dist/bin/chunks/timeout-QMKFLOWX.js +2 -0
  30. package/dist/bin/chunks/worker.js +62 -24
  31. package/dist/bin/chunks/{xan-3IA4WP2G.js → xan-7NIVZ3HP.js} +1 -1
  32. package/dist/bin/chunks/yq-L5ZSGLLO.js +2 -0
  33. package/dist/bin/just-bash.js +286 -286
  34. package/dist/bin/shell/chunks/awk2-YRDDZZBN.js +2 -0
  35. package/dist/bin/{chunks/bash-WB6O736J.js → shell/chunks/bash-6ZHZ6BX7.js} +1 -1
  36. package/dist/bin/shell/chunks/{chunk-PDVXLMUU.js → chunk-27KQPTIX.js} +17 -17
  37. package/dist/bin/shell/chunks/{chunk-XB2MDT3B.js → chunk-3NVWSLHI.js} +1 -1
  38. package/dist/bin/shell/chunks/{chunk-K5IXNHO5.js → chunk-6KZRLMG3.js} +3 -3
  39. package/dist/bin/{chunks/chunk-AHMZLMTU.js → shell/chunks/chunk-6L4K3UGO.js} +1 -1
  40. package/dist/bin/{chunks/chunk-K7XSYP4L.js → shell/chunks/chunk-6SAF32NO.js} +1 -1
  41. package/dist/bin/shell/chunks/{chunk-V4CRXAQO.js → chunk-7SWOLTCR.js} +1 -1
  42. package/dist/bin/shell/chunks/{chunk-ISOXAKGQ.js → chunk-CPL5P744.js} +1 -1
  43. package/dist/bin/shell/chunks/{chunk-BWWPUUC5.js → chunk-EPIOK4SY.js} +1 -1
  44. package/dist/bin/shell/chunks/chunk-F37UEO7A.js +10 -0
  45. package/dist/bin/shell/chunks/chunk-GO6FXSC4.js +6 -0
  46. package/dist/bin/shell/chunks/chunk-HA4QZ6XJ.js +12 -0
  47. package/dist/bin/shell/chunks/chunk-KTFEQPO7.js +4 -0
  48. package/dist/bin/{chunks/chunk-LW7FS3EH.js → shell/chunks/chunk-ND23BJUM.js} +1 -1
  49. package/dist/bin/shell/chunks/chunk-QC46PWBQ.js +63 -0
  50. package/dist/bin/{chunks/chunk-XORPAMNK.js → shell/chunks/chunk-RYXW3SZQ.js} +1 -1
  51. package/dist/bin/shell/chunks/chunk-WIWKAGK6.js +2 -0
  52. package/dist/bin/shell/chunks/{expansion-AMH5BAVV.js → expansion-HLAOHDFJ.js} +1 -1
  53. package/dist/bin/{chunks/flag-coverage-KFNWHFPU.js → shell/chunks/flag-coverage-GZCUF7B4.js} +1 -1
  54. package/dist/bin/{chunks/jq-TIHNHMOR.js → shell/chunks/jq-CXSPO2J5.js} +1 -1
  55. package/dist/bin/shell/chunks/printf-P3QVL4IO.js +2 -0
  56. package/dist/bin/shell/chunks/python3-XRP5IZRL.js +16 -0
  57. package/dist/bin/shell/chunks/sed-DNLJZZXZ.js +2 -0
  58. package/dist/bin/shell/chunks/sleep-RA6DYTJX.js +2 -0
  59. package/dist/bin/shell/chunks/sqlite3-2UNB5OLS.js +2 -0
  60. package/dist/bin/shell/chunks/tar-GP2CCB47.js +2 -0
  61. package/dist/bin/shell/chunks/timeout-QMKFLOWX.js +2 -0
  62. package/dist/bin/shell/chunks/{xan-3IA4WP2G.js → xan-7NIVZ3HP.js} +1 -1
  63. package/dist/bin/shell/chunks/yq-L5ZSGLLO.js +2 -0
  64. package/dist/bin/shell/shell.js +288 -288
  65. package/dist/bundle/browser.js +617 -615
  66. package/dist/bundle/chunks/awk2-66MVVLQI.js +1 -0
  67. package/dist/bundle/chunks/{bash-DYXMG247.js → bash-IJWYRKFO.js} +1 -1
  68. package/dist/bundle/chunks/{chunk-IBG6HR7V.js → chunk-AOFQVUAD.js} +1 -1
  69. package/dist/bundle/chunks/{chunk-U5TNQJ3C.js → chunk-C6ZZC5FL.js} +1 -1
  70. package/dist/bundle/chunks/{chunk-V4CDPGZH.js → chunk-CCCK5QHL.js} +1 -1
  71. package/dist/bundle/chunks/chunk-D6CWQ5DW.js +5 -0
  72. package/dist/bundle/chunks/chunk-FPGA7RT4.js +62 -0
  73. package/dist/bundle/chunks/{chunk-PSW6BMXW.js → chunk-GFQRA5P5.js} +3 -3
  74. package/dist/bundle/chunks/{chunk-HDZ4QEVJ.js → chunk-K4OVSVUA.js} +17 -17
  75. package/dist/bundle/chunks/{chunk-FWYCF7NE.js → chunk-KPFCTJEX.js} +1 -1
  76. package/dist/bundle/chunks/chunk-LEOLL6PF.js +1 -0
  77. package/dist/bundle/chunks/{chunk-3JDQKHMS.js → chunk-LN5KAJOV.js} +1 -1
  78. package/dist/bundle/chunks/chunk-R7KYILVY.js +3 -0
  79. package/dist/bundle/chunks/{chunk-3KWUDRIP.js → chunk-RARYJBGX.js} +1 -1
  80. package/dist/bundle/chunks/chunk-S7ED3RD5.js +11 -0
  81. package/dist/bundle/chunks/{chunk-M2LI252W.js → chunk-T56QNPHK.js} +1 -1
  82. package/dist/bundle/chunks/chunk-VFBZTF5G.js +9 -0
  83. package/dist/bundle/chunks/{chunk-OAOCWUTE.js → chunk-XULIVM35.js} +1 -1
  84. package/dist/bundle/chunks/{expansion-5HXXJ2SG.js → expansion-GY7U2FC2.js} +1 -1
  85. package/dist/bundle/chunks/{flag-coverage-ZCNVOYRY.js → flag-coverage-25MQKYJJ.js} +1 -1
  86. package/dist/bundle/chunks/{jq-YDGLHC7M.js → jq-MYSLFARY.js} +1 -1
  87. package/dist/bundle/chunks/printf-CX64KX2P.js +1 -0
  88. package/dist/bundle/chunks/python3-E7VF6UYO.js +15 -0
  89. package/dist/bundle/chunks/sed-3ZCNFRHI.js +1 -0
  90. package/dist/bundle/chunks/sleep-RKLUWJ7F.js +1 -0
  91. package/dist/bundle/chunks/sqlite3-TLIZUW3F.js +1 -0
  92. package/dist/bundle/chunks/tar-H6XTXOAP.js +1 -0
  93. package/dist/bundle/chunks/timeout-QDZFJCOQ.js +1 -0
  94. package/dist/bundle/chunks/worker.js +62 -24
  95. package/dist/bundle/chunks/{xan-Y62IEVU4.js → xan-VTO4FP3H.js} +1 -1
  96. package/dist/bundle/chunks/yq-JRZFRYSK.js +1 -0
  97. package/dist/bundle/index.cjs +763 -761
  98. package/dist/bundle/index.js +242 -242
  99. package/dist/commands/python3/protocol.d.ts +0 -1
  100. package/dist/commands/python3/python3.d.ts +2 -0
  101. package/dist/commands/tar/archive.d.ts +20 -6
  102. package/dist/interpreter/errors.d.ts +10 -2
  103. package/dist/interpreter/helpers/result.d.ts +1 -1
  104. package/dist/interpreter/types.d.ts +5 -0
  105. package/dist/limits.d.ts +4 -0
  106. package/dist/network/allow-list.d.ts +5 -0
  107. package/dist/network/types.d.ts +6 -0
  108. package/dist/sandbox/Sandbox.d.ts +6 -0
  109. package/dist/timers.d.ts +15 -0
  110. package/dist/types.d.ts +12 -0
  111. package/dist/vitest-setup.d.ts +1 -0
  112. package/package.json +2 -2
  113. package/dist/bin/chunks/awk2-PWEGD656.js +0 -2
  114. package/dist/bin/chunks/chunk-5UHJVSR5.js +0 -10
  115. package/dist/bin/chunks/chunk-EFX3F2HZ.js +0 -63
  116. package/dist/bin/chunks/chunk-P7UCWJ33.js +0 -12
  117. package/dist/bin/chunks/chunk-RDZMRK5M.js +0 -6
  118. package/dist/bin/chunks/printf-4NJFGX3O.js +0 -2
  119. package/dist/bin/chunks/python3-YJ7YGEW7.js +0 -16
  120. package/dist/bin/chunks/sed-3DO5EXEU.js +0 -2
  121. package/dist/bin/chunks/sleep-3QRDZXBH.js +0 -2
  122. package/dist/bin/chunks/sqlite3-4SEIR46P.js +0 -2
  123. package/dist/bin/chunks/tar-7B5KH3QG.js +0 -2
  124. package/dist/bin/chunks/timeout-RS7REDYT.js +0 -2
  125. package/dist/bin/chunks/yq-OUNV2BWM.js +0 -2
  126. package/dist/bin/shell/chunks/awk2-PWEGD656.js +0 -2
  127. package/dist/bin/shell/chunks/chunk-5UHJVSR5.js +0 -10
  128. package/dist/bin/shell/chunks/chunk-EFX3F2HZ.js +0 -63
  129. package/dist/bin/shell/chunks/chunk-P7UCWJ33.js +0 -12
  130. package/dist/bin/shell/chunks/chunk-RDZMRK5M.js +0 -6
  131. package/dist/bin/shell/chunks/printf-4NJFGX3O.js +0 -2
  132. package/dist/bin/shell/chunks/python3-YJ7YGEW7.js +0 -16
  133. package/dist/bin/shell/chunks/sed-3DO5EXEU.js +0 -2
  134. package/dist/bin/shell/chunks/sleep-3QRDZXBH.js +0 -2
  135. package/dist/bin/shell/chunks/sqlite3-4SEIR46P.js +0 -2
  136. package/dist/bin/shell/chunks/tar-7B5KH3QG.js +0 -2
  137. package/dist/bin/shell/chunks/timeout-RS7REDYT.js +0 -2
  138. package/dist/bin/shell/chunks/yq-OUNV2BWM.js +0 -2
  139. package/dist/bundle/chunks/awk2-BDPR2JPZ.js +0 -1
  140. package/dist/bundle/chunks/chunk-7WX4V2UH.js +0 -9
  141. package/dist/bundle/chunks/chunk-JP44OYZS.js +0 -5
  142. package/dist/bundle/chunks/chunk-VZWXH2PZ.js +0 -62
  143. package/dist/bundle/chunks/chunk-XNL7YAHW.js +0 -11
  144. package/dist/bundle/chunks/printf-IO3EBW5H.js +0 -1
  145. package/dist/bundle/chunks/python3-6Y4Z63NZ.js +0 -15
  146. package/dist/bundle/chunks/sed-2K6ULZ6P.js +0 -1
  147. package/dist/bundle/chunks/sleep-U2ORRQJB.js +0 -1
  148. package/dist/bundle/chunks/sqlite3-Z2IGWYCE.js +0 -1
  149. package/dist/bundle/chunks/tar-K7K7BL55.js +0 -1
  150. package/dist/bundle/chunks/timeout-5UJUQXOE.js +0 -1
  151. package/dist/bundle/chunks/yq-CESEW5B3.js +0 -1
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as b,b as g,c as T,d as k,e as X}from"./chunk-UYBH3FNE.js";import{a as G,c as ht}from"./chunk-4PRVMER6.js";import{a as C}from"./chunk-SE4C7FJY.js";import{k as D}from"./chunk-K5IXNHO5.js";function W(t,r,e,n,p,i,u,c,s,f){switch(r){case"sort":return Array.isArray(t)?[[...t].sort(u)]:[null];case"sort_by":return!Array.isArray(t)||e.length===0?[null]:[[...t].sort((h,y)=>{let a=p(h,e[0],n)[0],l=p(y,e[0],n)[0];return u(a,l)})];case"bsearch":{if(!Array.isArray(t)){let h=t===null?"null":typeof t=="object"?"object":typeof t;throw new Error(`${h} (${JSON.stringify(t)}) cannot be searched from`)}return e.length===0?[null]:p(t,e[0],n).map(h=>{let y=0,a=t.length;for(;y<a;){let l=y+a>>>1;u(t[l],h)<0?y=l+1:a=l}return y<t.length&&u(t[y],h)===0?y:-y-1})}case"unique_by":{if(!Array.isArray(t)||e.length===0)return[null];let o=new Map;for(let y of t){let a=p(y,e[0],n)[0],l=JSON.stringify(a);o.has(l)||o.set(l,{item:y,key:a})}let h=[...o.values()];return h.sort((y,a)=>u(y.key,a.key)),[h.map(y=>y.item)]}case"group_by":{if(!Array.isArray(t)||e.length===0)return[null];let o=new Map;for(let h of t){let y=JSON.stringify(p(h,e[0],n)[0]);o.has(y)||o.set(y,[]),o.get(y)?.push(h)}return[[...o.values()]]}case"max":return Array.isArray(t)&&t.length>0?[t.reduce((o,h)=>u(o,h)>0?o:h)]:[null];case"max_by":return!Array.isArray(t)||t.length===0||e.length===0?[null]:[t.reduce((o,h)=>{let y=p(o,e[0],n)[0],a=p(h,e[0],n)[0];return u(y,a)>0?o:h})];case"min":return Array.isArray(t)&&t.length>0?[t.reduce((o,h)=>u(o,h)<0?o:h)]:[null];case"min_by":return!Array.isArray(t)||t.length===0||e.length===0?[null]:[t.reduce((o,h)=>{let y=p(o,e[0],n)[0],a=p(h,e[0],n)[0];return u(y,a)<0?o:h})];case"add":{let o=h=>{let y=h.filter(a=>a!==null);return y.length===0?null:y.every(a=>typeof a=="number")?y.reduce((a,l)=>a+l,0):y.every(a=>typeof a=="string")?y.join(""):y.every(a=>Array.isArray(a))?y.flat():y.every(a=>a&&typeof a=="object"&&!Array.isArray(a))?ht(...y):null};if(e.length>=1){let h=p(t,e[0],n);return[o(h)]}return Array.isArray(t)?[o(t)]:[null]}case"any":{if(e.length>=2){try{let o=i(t,e[0],n);for(let h of o)if(p(h,e[1],n).some(c))return[!0]}catch(o){if(o instanceof f)throw o}return[!1]}return e.length===1?Array.isArray(t)?[t.some(o=>c(p(o,e[0],n)[0]))]:[!1]:Array.isArray(t)?[t.some(c)]:[!1]}case"all":{if(e.length>=2){try{let o=i(t,e[0],n);for(let h of o)if(!p(h,e[1],n).some(c))return[!1]}catch(o){if(o instanceof f)throw o}return[!0]}return e.length===1?Array.isArray(t)?[t.every(o=>c(p(o,e[0],n)[0]))]:[!0]:Array.isArray(t)?[t.every(c)]:[!0]}case"select":return e.length===0?[t]:p(t,e[0],n).some(c)?[t]:[];case"map":return e.length===0||!Array.isArray(t)?[null]:[t.flatMap(h=>p(h,e[0],n))];case"map_values":{if(e.length===0)return[null];if(Array.isArray(t))return[t.flatMap(o=>p(o,e[0],n))];if(t&&typeof t=="object"){let o=Object.create(null);for(let[h,y]of Object.entries(t)){if(!b(h))continue;let a=p(y,e[0],n);a.length>0&&g(o,h,a[0])}return[o]}return[null]}case"has":{if(e.length===0)return[!1];let h=p(t,e[0],n)[0];return Array.isArray(t)&&typeof h=="number"?[h>=0&&h<t.length]:t&&typeof t=="object"&&typeof h=="string"?[T(t,h)]:[!1]}case"in":{if(e.length===0)return[!1];let h=p(t,e[0],n)[0];return Array.isArray(h)&&typeof t=="number"?[t>=0&&t<h.length]:h&&typeof h=="object"&&typeof t=="string"?[T(h,t)]:[!1]}case"contains":{if(e.length===0)return[!1];let o=p(t,e[0],n);return[s(t,o[0])]}case"inside":{if(e.length===0)return[!1];let o=p(t,e[0],n);return[s(o[0],t)]}default:return null}}function Q(t,r,e,n,p,i,u,c){switch(r){case"first":if(e.length>0)try{let s=i(t,e[0],n);return s.length>0?[s[0]]:[]}catch(s){if(s instanceof c)throw s;return[]}return Array.isArray(t)&&t.length>0?[t[0]]:[null];case"last":if(e.length>0){let s=p(t,e[0],n);return s.length>0?[s[s.length-1]]:[]}return Array.isArray(t)&&t.length>0?[t[t.length-1]]:[null];case"nth":{if(e.length<1)return[null];let s=p(t,e[0],n);if(e.length>1){for(let o of s)if(o<0)throw new Error("nth doesn't support negative indices");let f;try{f=i(t,e[1],n)}catch(o){if(o instanceof c)throw o;f=[]}return s.flatMap(o=>{let h=o;return h<f.length?[f[h]]:[]})}return Array.isArray(t)?s.flatMap(f=>{let o=f;if(o<0)throw new Error("nth doesn't support negative indices");return o<t.length?[t[o]]:[null]}):[null]}case"range":{if(e.length===0)return[];let s=Math.max(n.limits.maxIterations*100,1e6),f=l=>l.length>=s,o=p(t,e[0],n);if(e.length===1){let l=[];for(let m of o){let A=m;for(let E=0;E<A;E++)if(l.push(E),f(l))return l}return l}let h=p(t,e[1],n);if(e.length===2){let l=[];for(let m of o)for(let A of h){let E=m,w=A;for(let N=E;N<w;N++)if(l.push(N),f(l))return l}return l}let y=p(t,e[2],n),a=[];for(let l of o)for(let m of h)for(let A of y){let E=l,w=m,N=A;if(N!==0){if(N>0){for(let S=E;S<w;S+=N)if(a.push(S),f(a))return a}else for(let S=E;S>w;S+=N)if(a.push(S),f(a))return a}}return a}case"limit":return e.length<2?[]:p(t,e[0],n).flatMap(f=>{let o=f;if(o<0)throw new Error("limit doesn't support negative count");if(o===0)return[];let h;try{h=i(t,e[1],n)}catch(y){if(y instanceof c)throw y;h=[]}return h.slice(0,o)});case"isempty":{if(e.length<1)return[!0];try{return[i(t,e[0],n).length===0]}catch(s){if(s instanceof c)throw s;return[!0]}}case"isvalid":{if(e.length<1)return[!0];try{return[p(t,e[0],n).length>0]}catch(s){if(s instanceof c)throw s;return[!1]}}case"skip":return e.length<2?[]:p(t,e[0],n).flatMap(f=>{let o=f;if(o<0)throw new Error("skip doesn't support negative count");return p(t,e[1],n).slice(o)});case"until":{if(e.length<2)return[t];let s=t,f=n.limits.maxIterations;for(let o=0;o<f;o++){if(p(s,e[0],n).some(u))return[s];let y=p(s,e[1],n);if(y.length===0)return[s];s=y[0]}throw new c(`jq until: too many iterations (${f}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(e.length<2)return[t];let s=[],f=t,o=n.limits.maxIterations;for(let h=0;h<o&&p(f,e[0],n).some(u);h++){s.push(f);let a=p(f,e[1],n);if(a.length===0)break;f=a[0]}if(s.length>=o)throw new c(`jq while: too many iterations (${o}), increase executionLimits.maxJqIterations`,"iterations");return s}case"repeat":{if(e.length===0)return[t];let s=[],f=t,o=n.limits.maxIterations;for(let h=0;h<o;h++){s.push(f);let y=p(f,e[0],n);if(y.length===0)break;f=y[0]}if(s.length>=o)throw new c(`jq repeat: too many iterations (${o}), increase executionLimits.maxJqIterations`,"iterations");return s}default:return null}}function Z(t,r,e,n,p){switch(r){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof t!="number")return[null];let i=new Date(t*1e3),u=i.getUTCFullYear(),c=i.getUTCMonth(),s=i.getUTCDate(),f=i.getUTCHours(),o=i.getUTCMinutes(),h=i.getUTCSeconds(),y=i.getUTCDay(),a=Date.UTC(u,0,1),l=Math.floor((i.getTime()-a)/(1440*60*1e3));return[[u,c,s,f,o,h,y,l]]}case"mktime":{if(!Array.isArray(t))throw new Error("mktime requires parsed datetime inputs");let[i,u,c,s=0,f=0,o=0]=t;if(typeof i!="number"||typeof u!="number")throw new Error("mktime requires parsed datetime inputs");let h=Date.UTC(i,u,c??1,s??0,f??0,o??0);return[Math.floor(h/1e3)]}case"strftime":{if(e.length===0)return[null];let u=p(t,e[0],n)[0];if(typeof u!="string")throw new Error("strftime/1 requires a string format");let c;if(typeof t=="number")c=new Date(t*1e3);else if(Array.isArray(t)){let[y,a,l,m=0,A=0,E=0]=t;if(typeof y!="number"||typeof a!="number")throw new Error("strftime/1 requires parsed datetime inputs");c=new Date(Date.UTC(y,a,l??1,m??0,A??0,E??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],f=["January","February","March","April","May","June","July","August","September","October","November","December"],o=(y,a=2)=>String(y).padStart(a,"0");return[u.replace(/%Y/g,String(c.getUTCFullYear())).replace(/%m/g,o(c.getUTCMonth()+1)).replace(/%d/g,o(c.getUTCDate())).replace(/%H/g,o(c.getUTCHours())).replace(/%M/g,o(c.getUTCMinutes())).replace(/%S/g,o(c.getUTCSeconds())).replace(/%A/g,s[c.getUTCDay()]).replace(/%B/g,f[c.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(e.length===0)return[null];if(typeof t!="string")throw new Error("strptime/1 requires a string input");let u=p(t,e[0],n)[0];if(typeof u!="string")throw new Error("strptime/1 requires a string format");if(u==="%Y-%m-%dT%H:%M:%SZ"){let s=t.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(s){let[,f,o,h,y,a,l]=s.map(Number),m=new Date(Date.UTC(f,o-1,h,y,a,l)),A=m.getUTCDay(),E=Date.UTC(f,0,1),w=Math.floor((m.getTime()-E)/(1440*60*1e3));return[[f,o-1,h,y,a,l,A,w]]}}let c=new Date(t);if(!Number.isNaN(c.getTime())){let s=c.getUTCFullYear(),f=c.getUTCMonth(),o=c.getUTCDate(),h=c.getUTCHours(),y=c.getUTCMinutes(),a=c.getUTCSeconds(),l=c.getUTCDay(),m=Date.UTC(s,0,1),A=Math.floor((c.getTime()-m)/(1440*60*1e3));return[[s,f,o,h,y,a,l,A]]}throw new Error(`Cannot parse date: ${t}`)}case"fromdate":{if(typeof t!="string")throw new Error("fromdate requires a string input");let i=new Date(t);if(Number.isNaN(i.getTime()))throw new Error(`date "${t}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(i.getTime()/1e3)]}case"todate":{if(typeof t!="number")throw new Error("todate requires a number input");return[new Date(t*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}function O(t){return t!==!1&&t!==null}function I(t,r){return JSON.stringify(t)===JSON.stringify(r)}function B(t,r){return typeof t=="number"&&typeof r=="number"?t-r:typeof t=="string"&&typeof r=="string"?t.localeCompare(r):0}function z(t,r){let e=k(t);for(let n of Object.keys(r))b(n)&&(T(e,n)&&e[n]&&typeof e[n]=="object"&&!Array.isArray(e[n])&&r[n]&&typeof r[n]=="object"&&!Array.isArray(r[n])?g(e,n,z(e[n],r[n])):g(e,n,r[n]));return e}function x(t,r=3e3){let e=0,n=t;for(;e<r;)if(Array.isArray(n)){if(n.length===0)return e+1;n=n[0],e++}else if(n!==null&&typeof n=="object"){let p=Object.keys(n);if(p.length===0)return e+1;n=n[p[0]],e++}else return e;return e}function _(t,r){let e=i=>i===null?0:typeof i=="boolean"?1:typeof i=="number"?2:typeof i=="string"?3:Array.isArray(i)?4:typeof i=="object"?5:6,n=e(t),p=e(r);if(n!==p)return n-p;if(typeof t=="number"&&typeof r=="number")return t-r;if(typeof t=="string"&&typeof r=="string")return t.localeCompare(r);if(typeof t=="boolean"&&typeof r=="boolean")return(t?1:0)-(r?1:0);if(Array.isArray(t)&&Array.isArray(r)){for(let i=0;i<Math.min(t.length,r.length);i++){let u=_(t[i],r[i]);if(u!==0)return u}return t.length-r.length}if(t&&r&&typeof t=="object"&&typeof r=="object"){let i=t,u=r,c=Object.keys(i).sort(),s=Object.keys(u).sort();for(let f=0;f<Math.min(c.length,s.length);f++){let o=c[f].localeCompare(s[f]);if(o!==0)return o}if(c.length!==s.length)return c.length-s.length;for(let f of c){let o=_(i[f],u[f]);if(o!==0)return o}}return 0}function $(t,r){if(I(t,r))return!0;if(typeof t=="string"&&typeof r=="string")return t.includes(r);if(Array.isArray(t)&&Array.isArray(r))return r.every(e=>t.some(n=>$(n,e)));if(t&&r&&typeof t=="object"&&typeof r=="object"&&!Array.isArray(t)&&!Array.isArray(r)){let e=t,n=r;return Object.keys(n).every(p=>T(e,p)&&$(e[p],n[p]))}return!1}var Et=2e3;function v(t,r,e){switch(r){case"@base64":return typeof t=="string"?typeof Buffer<"u"?[Buffer.from(t,"utf-8").toString("base64")]:[btoa(t)]:[null];case"@base64d":return typeof t=="string"?typeof Buffer<"u"?[Buffer.from(t,"base64").toString("utf-8")]:[atob(t)]:[null];case"@uri":return typeof t=="string"?[encodeURIComponent(t).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")]:[null];case"@urid":return typeof t=="string"?[decodeURIComponent(t)]:[null];case"@csv":return Array.isArray(t)?[t.map(p=>{if(p===null)return"";if(typeof p=="boolean")return p?"true":"false";if(typeof p=="number")return String(p);let i=String(p);return i.includes(",")||i.includes('"')||i.includes(`
2
+ import{a as b,b as g,c as T,d as k,e as X}from"./chunk-UYBH3FNE.js";import{a as G,c as ht}from"./chunk-4PRVMER6.js";import{a as C}from"./chunk-SE4C7FJY.js";import{k as D}from"./chunk-6KZRLMG3.js";function W(t,r,e,n,p,i,u,c,s,f){switch(r){case"sort":return Array.isArray(t)?[[...t].sort(u)]:[null];case"sort_by":return!Array.isArray(t)||e.length===0?[null]:[[...t].sort((h,y)=>{let a=p(h,e[0],n)[0],l=p(y,e[0],n)[0];return u(a,l)})];case"bsearch":{if(!Array.isArray(t)){let h=t===null?"null":typeof t=="object"?"object":typeof t;throw new Error(`${h} (${JSON.stringify(t)}) cannot be searched from`)}return e.length===0?[null]:p(t,e[0],n).map(h=>{let y=0,a=t.length;for(;y<a;){let l=y+a>>>1;u(t[l],h)<0?y=l+1:a=l}return y<t.length&&u(t[y],h)===0?y:-y-1})}case"unique_by":{if(!Array.isArray(t)||e.length===0)return[null];let o=new Map;for(let y of t){let a=p(y,e[0],n)[0],l=JSON.stringify(a);o.has(l)||o.set(l,{item:y,key:a})}let h=[...o.values()];return h.sort((y,a)=>u(y.key,a.key)),[h.map(y=>y.item)]}case"group_by":{if(!Array.isArray(t)||e.length===0)return[null];let o=new Map;for(let h of t){let y=JSON.stringify(p(h,e[0],n)[0]);o.has(y)||o.set(y,[]),o.get(y)?.push(h)}return[[...o.values()]]}case"max":return Array.isArray(t)&&t.length>0?[t.reduce((o,h)=>u(o,h)>0?o:h)]:[null];case"max_by":return!Array.isArray(t)||t.length===0||e.length===0?[null]:[t.reduce((o,h)=>{let y=p(o,e[0],n)[0],a=p(h,e[0],n)[0];return u(y,a)>0?o:h})];case"min":return Array.isArray(t)&&t.length>0?[t.reduce((o,h)=>u(o,h)<0?o:h)]:[null];case"min_by":return!Array.isArray(t)||t.length===0||e.length===0?[null]:[t.reduce((o,h)=>{let y=p(o,e[0],n)[0],a=p(h,e[0],n)[0];return u(y,a)<0?o:h})];case"add":{let o=h=>{let y=h.filter(a=>a!==null);return y.length===0?null:y.every(a=>typeof a=="number")?y.reduce((a,l)=>a+l,0):y.every(a=>typeof a=="string")?y.join(""):y.every(a=>Array.isArray(a))?y.flat():y.every(a=>a&&typeof a=="object"&&!Array.isArray(a))?ht(...y):null};if(e.length>=1){let h=p(t,e[0],n);return[o(h)]}return Array.isArray(t)?[o(t)]:[null]}case"any":{if(e.length>=2){try{let o=i(t,e[0],n);for(let h of o)if(p(h,e[1],n).some(c))return[!0]}catch(o){if(o instanceof f)throw o}return[!1]}return e.length===1?Array.isArray(t)?[t.some(o=>c(p(o,e[0],n)[0]))]:[!1]:Array.isArray(t)?[t.some(c)]:[!1]}case"all":{if(e.length>=2){try{let o=i(t,e[0],n);for(let h of o)if(!p(h,e[1],n).some(c))return[!1]}catch(o){if(o instanceof f)throw o}return[!0]}return e.length===1?Array.isArray(t)?[t.every(o=>c(p(o,e[0],n)[0]))]:[!0]:Array.isArray(t)?[t.every(c)]:[!0]}case"select":return e.length===0?[t]:p(t,e[0],n).some(c)?[t]:[];case"map":return e.length===0||!Array.isArray(t)?[null]:[t.flatMap(h=>p(h,e[0],n))];case"map_values":{if(e.length===0)return[null];if(Array.isArray(t))return[t.flatMap(o=>p(o,e[0],n))];if(t&&typeof t=="object"){let o=Object.create(null);for(let[h,y]of Object.entries(t)){if(!b(h))continue;let a=p(y,e[0],n);a.length>0&&g(o,h,a[0])}return[o]}return[null]}case"has":{if(e.length===0)return[!1];let h=p(t,e[0],n)[0];return Array.isArray(t)&&typeof h=="number"?[h>=0&&h<t.length]:t&&typeof t=="object"&&typeof h=="string"?[T(t,h)]:[!1]}case"in":{if(e.length===0)return[!1];let h=p(t,e[0],n)[0];return Array.isArray(h)&&typeof t=="number"?[t>=0&&t<h.length]:h&&typeof h=="object"&&typeof t=="string"?[T(h,t)]:[!1]}case"contains":{if(e.length===0)return[!1];let o=p(t,e[0],n);return[s(t,o[0])]}case"inside":{if(e.length===0)return[!1];let o=p(t,e[0],n);return[s(o[0],t)]}default:return null}}function Q(t,r,e,n,p,i,u,c){switch(r){case"first":if(e.length>0)try{let s=i(t,e[0],n);return s.length>0?[s[0]]:[]}catch(s){if(s instanceof c)throw s;return[]}return Array.isArray(t)&&t.length>0?[t[0]]:[null];case"last":if(e.length>0){let s=p(t,e[0],n);return s.length>0?[s[s.length-1]]:[]}return Array.isArray(t)&&t.length>0?[t[t.length-1]]:[null];case"nth":{if(e.length<1)return[null];let s=p(t,e[0],n);if(e.length>1){for(let o of s)if(o<0)throw new Error("nth doesn't support negative indices");let f;try{f=i(t,e[1],n)}catch(o){if(o instanceof c)throw o;f=[]}return s.flatMap(o=>{let h=o;return h<f.length?[f[h]]:[]})}return Array.isArray(t)?s.flatMap(f=>{let o=f;if(o<0)throw new Error("nth doesn't support negative indices");return o<t.length?[t[o]]:[null]}):[null]}case"range":{if(e.length===0)return[];let s=Math.max(n.limits.maxIterations*100,1e6),f=l=>l.length>=s,o=p(t,e[0],n);if(e.length===1){let l=[];for(let m of o){let A=m;for(let E=0;E<A;E++)if(l.push(E),f(l))return l}return l}let h=p(t,e[1],n);if(e.length===2){let l=[];for(let m of o)for(let A of h){let E=m,w=A;for(let N=E;N<w;N++)if(l.push(N),f(l))return l}return l}let y=p(t,e[2],n),a=[];for(let l of o)for(let m of h)for(let A of y){let E=l,w=m,N=A;if(N!==0){if(N>0){for(let S=E;S<w;S+=N)if(a.push(S),f(a))return a}else for(let S=E;S>w;S+=N)if(a.push(S),f(a))return a}}return a}case"limit":return e.length<2?[]:p(t,e[0],n).flatMap(f=>{let o=f;if(o<0)throw new Error("limit doesn't support negative count");if(o===0)return[];let h;try{h=i(t,e[1],n)}catch(y){if(y instanceof c)throw y;h=[]}return h.slice(0,o)});case"isempty":{if(e.length<1)return[!0];try{return[i(t,e[0],n).length===0]}catch(s){if(s instanceof c)throw s;return[!0]}}case"isvalid":{if(e.length<1)return[!0];try{return[p(t,e[0],n).length>0]}catch(s){if(s instanceof c)throw s;return[!1]}}case"skip":return e.length<2?[]:p(t,e[0],n).flatMap(f=>{let o=f;if(o<0)throw new Error("skip doesn't support negative count");return p(t,e[1],n).slice(o)});case"until":{if(e.length<2)return[t];let s=t,f=n.limits.maxIterations;for(let o=0;o<f;o++){if(p(s,e[0],n).some(u))return[s];let y=p(s,e[1],n);if(y.length===0)return[s];s=y[0]}throw new c(`jq until: too many iterations (${f}), increase executionLimits.maxJqIterations`,"iterations")}case"while":{if(e.length<2)return[t];let s=[],f=t,o=n.limits.maxIterations;for(let h=0;h<o&&p(f,e[0],n).some(u);h++){s.push(f);let a=p(f,e[1],n);if(a.length===0)break;f=a[0]}if(s.length>=o)throw new c(`jq while: too many iterations (${o}), increase executionLimits.maxJqIterations`,"iterations");return s}case"repeat":{if(e.length===0)return[t];let s=[],f=t,o=n.limits.maxIterations;for(let h=0;h<o;h++){s.push(f);let y=p(f,e[0],n);if(y.length===0)break;f=y[0]}if(s.length>=o)throw new c(`jq repeat: too many iterations (${o}), increase executionLimits.maxJqIterations`,"iterations");return s}default:return null}}function Z(t,r,e,n,p){switch(r){case"now":return[Date.now()/1e3];case"gmtime":{if(typeof t!="number")return[null];let i=new Date(t*1e3),u=i.getUTCFullYear(),c=i.getUTCMonth(),s=i.getUTCDate(),f=i.getUTCHours(),o=i.getUTCMinutes(),h=i.getUTCSeconds(),y=i.getUTCDay(),a=Date.UTC(u,0,1),l=Math.floor((i.getTime()-a)/(1440*60*1e3));return[[u,c,s,f,o,h,y,l]]}case"mktime":{if(!Array.isArray(t))throw new Error("mktime requires parsed datetime inputs");let[i,u,c,s=0,f=0,o=0]=t;if(typeof i!="number"||typeof u!="number")throw new Error("mktime requires parsed datetime inputs");let h=Date.UTC(i,u,c??1,s??0,f??0,o??0);return[Math.floor(h/1e3)]}case"strftime":{if(e.length===0)return[null];let u=p(t,e[0],n)[0];if(typeof u!="string")throw new Error("strftime/1 requires a string format");let c;if(typeof t=="number")c=new Date(t*1e3);else if(Array.isArray(t)){let[y,a,l,m=0,A=0,E=0]=t;if(typeof y!="number"||typeof a!="number")throw new Error("strftime/1 requires parsed datetime inputs");c=new Date(Date.UTC(y,a,l??1,m??0,A??0,E??0))}else throw new Error("strftime/1 requires parsed datetime inputs");let s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],f=["January","February","March","April","May","June","July","August","September","October","November","December"],o=(y,a=2)=>String(y).padStart(a,"0");return[u.replace(/%Y/g,String(c.getUTCFullYear())).replace(/%m/g,o(c.getUTCMonth()+1)).replace(/%d/g,o(c.getUTCDate())).replace(/%H/g,o(c.getUTCHours())).replace(/%M/g,o(c.getUTCMinutes())).replace(/%S/g,o(c.getUTCSeconds())).replace(/%A/g,s[c.getUTCDay()]).replace(/%B/g,f[c.getUTCMonth()]).replace(/%Z/g,"UTC").replace(/%%/g,"%")]}case"strptime":{if(e.length===0)return[null];if(typeof t!="string")throw new Error("strptime/1 requires a string input");let u=p(t,e[0],n)[0];if(typeof u!="string")throw new Error("strptime/1 requires a string format");if(u==="%Y-%m-%dT%H:%M:%SZ"){let s=t.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/);if(s){let[,f,o,h,y,a,l]=s.map(Number),m=new Date(Date.UTC(f,o-1,h,y,a,l)),A=m.getUTCDay(),E=Date.UTC(f,0,1),w=Math.floor((m.getTime()-E)/(1440*60*1e3));return[[f,o-1,h,y,a,l,A,w]]}}let c=new Date(t);if(!Number.isNaN(c.getTime())){let s=c.getUTCFullYear(),f=c.getUTCMonth(),o=c.getUTCDate(),h=c.getUTCHours(),y=c.getUTCMinutes(),a=c.getUTCSeconds(),l=c.getUTCDay(),m=Date.UTC(s,0,1),A=Math.floor((c.getTime()-m)/(1440*60*1e3));return[[s,f,o,h,y,a,l,A]]}throw new Error(`Cannot parse date: ${t}`)}case"fromdate":{if(typeof t!="string")throw new Error("fromdate requires a string input");let i=new Date(t);if(Number.isNaN(i.getTime()))throw new Error(`date "${t}" does not match format "%Y-%m-%dT%H:%M:%SZ"`);return[Math.floor(i.getTime()/1e3)]}case"todate":{if(typeof t!="number")throw new Error("todate requires a number input");return[new Date(t*1e3).toISOString().replace(/\.\d{3}Z$/,"Z")]}default:return null}}function O(t){return t!==!1&&t!==null}function I(t,r){return JSON.stringify(t)===JSON.stringify(r)}function B(t,r){return typeof t=="number"&&typeof r=="number"?t-r:typeof t=="string"&&typeof r=="string"?t.localeCompare(r):0}function z(t,r){let e=k(t);for(let n of Object.keys(r))b(n)&&(T(e,n)&&e[n]&&typeof e[n]=="object"&&!Array.isArray(e[n])&&r[n]&&typeof r[n]=="object"&&!Array.isArray(r[n])?g(e,n,z(e[n],r[n])):g(e,n,r[n]));return e}function x(t,r=3e3){let e=0,n=t;for(;e<r;)if(Array.isArray(n)){if(n.length===0)return e+1;n=n[0],e++}else if(n!==null&&typeof n=="object"){let p=Object.keys(n);if(p.length===0)return e+1;n=n[p[0]],e++}else return e;return e}function _(t,r){let e=i=>i===null?0:typeof i=="boolean"?1:typeof i=="number"?2:typeof i=="string"?3:Array.isArray(i)?4:typeof i=="object"?5:6,n=e(t),p=e(r);if(n!==p)return n-p;if(typeof t=="number"&&typeof r=="number")return t-r;if(typeof t=="string"&&typeof r=="string")return t.localeCompare(r);if(typeof t=="boolean"&&typeof r=="boolean")return(t?1:0)-(r?1:0);if(Array.isArray(t)&&Array.isArray(r)){for(let i=0;i<Math.min(t.length,r.length);i++){let u=_(t[i],r[i]);if(u!==0)return u}return t.length-r.length}if(t&&r&&typeof t=="object"&&typeof r=="object"){let i=t,u=r,c=Object.keys(i).sort(),s=Object.keys(u).sort();for(let f=0;f<Math.min(c.length,s.length);f++){let o=c[f].localeCompare(s[f]);if(o!==0)return o}if(c.length!==s.length)return c.length-s.length;for(let f of c){let o=_(i[f],u[f]);if(o!==0)return o}}return 0}function $(t,r){if(I(t,r))return!0;if(typeof t=="string"&&typeof r=="string")return t.includes(r);if(Array.isArray(t)&&Array.isArray(r))return r.every(e=>t.some(n=>$(n,e)));if(t&&r&&typeof t=="object"&&typeof r=="object"&&!Array.isArray(t)&&!Array.isArray(r)){let e=t,n=r;return Object.keys(n).every(p=>T(e,p)&&$(e[p],n[p]))}return!1}var Et=2e3;function v(t,r,e){switch(r){case"@base64":return typeof t=="string"?typeof Buffer<"u"?[Buffer.from(t,"utf-8").toString("base64")]:[btoa(t)]:[null];case"@base64d":return typeof t=="string"?typeof Buffer<"u"?[Buffer.from(t,"base64").toString("utf-8")]:[atob(t)]:[null];case"@uri":return typeof t=="string"?[encodeURIComponent(t).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")]:[null];case"@urid":return typeof t=="string"?[decodeURIComponent(t)]:[null];case"@csv":return Array.isArray(t)?[t.map(p=>{if(p===null)return"";if(typeof p=="boolean")return p?"true":"false";if(typeof p=="number")return String(p);let i=String(p);return i.includes(",")||i.includes('"')||i.includes(`
3
3
  `)||i.includes("\r")?`"${i.replace(/"/g,'""')}"`:i}).join(",")]:[null];case"@tsv":return Array.isArray(t)?[t.map(n=>String(n??"").replace(/\t/g,"\\t").replace(/\n/g,"\\n")).join(" ")]:[null];case"@json":{let n=e??Et;return x(t,n+1)>n?[null]:[JSON.stringify(t)]}case"@html":return typeof t=="string"?[t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;")]:[null];case"@sh":return typeof t=="string"?[`'${t.replace(/'/g,"'\\''")}'`]:[null];case"@text":return typeof t=="string"?[t]:t==null?[""]:[String(t)];default:return null}}function tt(t,r,e,n,p,i){switch(r){case"index":return e.length===0?[null]:p(t,e[0],n).map(c=>{if(typeof t=="string"&&typeof c=="string"){if(c===""&&t==="")return null;let s=t.indexOf(c);return s>=0?s:null}if(Array.isArray(t)){if(Array.isArray(c)){for(let f=0;f<=t.length-c.length;f++){let o=!0;for(let h=0;h<c.length;h++)if(!i(t[f+h],c[h])){o=!1;break}if(o)return f}return null}let s=t.findIndex(f=>i(f,c));return s>=0?s:null}return null});case"rindex":return e.length===0?[null]:p(t,e[0],n).map(c=>{if(typeof t=="string"&&typeof c=="string"){let s=t.lastIndexOf(c);return s>=0?s:null}if(Array.isArray(t)){if(Array.isArray(c)){for(let s=t.length-c.length;s>=0;s--){let f=!0;for(let o=0;o<c.length;o++)if(!i(t[s+o],c[o])){f=!1;break}if(f)return s}return null}for(let s=t.length-1;s>=0;s--)if(i(t[s],c))return s;return null}return null});case"indices":return e.length===0?[[]]:p(t,e[0],n).map(c=>{let s=[];if(typeof t=="string"&&typeof c=="string"){let f=t.indexOf(c);for(;f!==-1;)s.push(f),f=t.indexOf(c,f+1)}else if(Array.isArray(t))if(Array.isArray(c)){let f=c.length;if(f===0)for(let o=0;o<=t.length;o++)s.push(o);else for(let o=0;o<=t.length-f;o++){let h=!0;for(let y=0;y<f;y++)if(!i(t[o+y],c[y])){h=!1;break}h&&s.push(o)}}else for(let f=0;f<t.length;f++)i(t[f],c)&&s.push(f);return s});default:return null}}function et(t,r,e,n,p){switch(r){case"fabs":case"abs":return typeof t=="number"?[Math.abs(t)]:typeof t=="string"?[t]:[null];case"exp10":return typeof t=="number"?[10**t]:[null];case"exp2":return typeof t=="number"?[2**t]:[null];case"pow":{if(e.length<2)return[null];let i=p(t,e[0],n),u=p(t,e[1],n),c=i[0],s=u[0];return typeof c!="number"||typeof s!="number"?[null]:[c**s]}case"atan2":{if(e.length<2)return[null];let i=p(t,e[0],n),u=p(t,e[1],n),c=i[0],s=u[0];return typeof c!="number"||typeof s!="number"?[null]:[Math.atan2(c,s)]}case"hypot":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[Math.hypot(t,i)]}case"fma":{if(typeof t!="number"||e.length<2)return[null];let i=p(t,e[0],n)[0],u=p(t,e[1],n)[0];return[t*i+u]}case"copysign":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[Math.sign(i)*Math.abs(t)]}case"drem":case"remainder":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[t-Math.round(t/i)*i]}case"fdim":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[Math.max(0,t-i)]}case"fmax":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[Math.max(t,i)]}case"fmin":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[Math.min(t,i)]}case"ldexp":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[t*2**i]}case"scalbn":case"scalbln":{if(typeof t!="number"||e.length===0)return[null];let i=p(t,e[0],n)[0];return[t*2**i]}case"nearbyint":return typeof t=="number"?[Math.round(t)]:[null];case"logb":return typeof t=="number"?[Math.floor(Math.log2(Math.abs(t)))]:[null];case"significand":if(typeof t=="number"){let i=Math.floor(Math.log2(Math.abs(t)));return[t/2**i]}return[null];case"frexp":if(typeof t=="number"){if(t===0)return[[0,0]];let i=Math.floor(Math.log2(Math.abs(t)))+1;return[[t/2**i,i]]}return[null];case"modf":if(typeof t=="number"){let i=Math.trunc(t);return[[t-i,i]]}return[null];default:return null}}function rt(t,r,e,n,p,i,u,c){switch(r){case"recurse":{if(e.length===0){let a=[],l=m=>{if(a.push(m),Array.isArray(m))for(let A of m)l(A);else if(m&&typeof m=="object")for(let A of Object.keys(m))l(m[A])};return l(t),a}let s=[],f=e.length>=2?e[1]:null,o=1e4,h=0,y=a=>{if(h++>o||f&&!p(a,f,n).some(i))return;s.push(a);let l=p(a,e[0],n);for(let m of l)m!=null&&y(m)};return y(t),s}case"recurse_down":return c(t,"recurse",e,n);case"walk":{if(e.length===0)return[t];let s=new WeakSet,f=o=>{if(o&&typeof o=="object"){if(s.has(o))return o;s.add(o)}let h;if(Array.isArray(o))h=o.map(f);else if(o&&typeof o=="object"){let a=Object.create(null);for(let[l,m]of Object.entries(o))b(l)&&g(a,l,f(m));h=a}else h=o;return p(h,e[0],n)[0]};return[f(t)]}case"transpose":{if(!Array.isArray(t))return[null];if(t.length===0)return[[]];let s=Math.max(...t.map(o=>Array.isArray(o)?o.length:0)),f=[];for(let o=0;o<s;o++)f.push(t.map(h=>Array.isArray(h)?h[o]:null));return[f]}case"combinations":{if(e.length>0){let h=p(t,e[0],n)[0];if(!Array.isArray(t)||h<0)return[];if(h===0)return[[]];let y=[],a=(l,m)=>{if(m===h){y.push([...l]);return}for(let A of t)l.push(A),a(l,m+1),l.pop()};return a([],0),y}if(!Array.isArray(t))return[];if(t.length===0)return[[]];for(let o of t)if(!Array.isArray(o))return[];let s=[],f=(o,h)=>{if(o===t.length){s.push([...h]);return}let y=t[o];for(let a of y)h.push(a),f(o+1,h),h.pop()};return f(0,[]),s}case"parent":{if(n.root===void 0||n.currentPath===void 0)return[];let s=n.currentPath;if(s.length===0)return[];let f=e.length>0?p(t,e[0],n)[0]:1;if(f>=0){if(f>s.length)return[];let o=s.slice(0,s.length-f);return[u(n.root,o)]}else{let o=-f-1;if(o>=s.length)return[t];let h=s.slice(0,o);return[u(n.root,h)]}}case"parents":{if(n.root===void 0||n.currentPath===void 0)return[[]];let s=n.currentPath,f=[];for(let o=s.length-1;o>=0;o--)f.push(u(n.root,s.slice(0,o)));return[f]}case"root":return n.root!==void 0?[n.root]:[];default:return null}}var wt=2e3;function nt(t,r,e,n,p){switch(r){case"keys":return Array.isArray(t)?[t.map((i,u)=>u)]:t&&typeof t=="object"?[Object.keys(t).sort()]:[null];case"keys_unsorted":return Array.isArray(t)?[t.map((i,u)=>u)]:t&&typeof t=="object"?[Object.keys(t)]:[null];case"length":return typeof t=="string"?[t.length]:Array.isArray(t)?[t.length]:t&&typeof t=="object"?[Object.keys(t).length]:t===null?[0]:typeof t=="number"?[Math.abs(t)]:[null];case"utf8bytelength":{if(typeof t=="string")return[new TextEncoder().encode(t).length];let i=t===null?"null":Array.isArray(t)?"array":typeof t,u=i==="array"||i==="object"?JSON.stringify(t):String(t);throw new Error(`${i} (${u}) only strings have UTF-8 byte length`)}case"to_entries":return t&&typeof t=="object"&&!Array.isArray(t)?[Object.entries(t).map(([i,u])=>({key:i,value:u}))]:[null];case"from_entries":if(Array.isArray(t)){let i=Object.create(null);for(let u of t)if(u&&typeof u=="object"){let c=u,s=c.key??c.Key??c.name??c.Name??c.k,f=c.value??c.Value??c.v;if(s!==void 0){let o=String(s);b(o)&&g(i,o,f)}}return[i]}return[null];case"with_entries":{if(e.length===0)return[t];if(t&&typeof t=="object"&&!Array.isArray(t)){let u=Object.entries(t).map(([s,f])=>({key:s,value:f})).flatMap(s=>p(s,e[0],n)),c=Object.create(null);for(let s of u)if(s&&typeof s=="object"){let f=s,o=f.key??f.name??f.k,h=f.value??f.v;if(o!==void 0){let y=String(o);b(y)&&g(c,y,h)}}return[c]}return[null]}case"reverse":return Array.isArray(t)?[[...t].reverse()]:typeof t=="string"?[t.split("").reverse().join("")]:[null];case"flatten":return Array.isArray(t)?(e.length>0?p(t,e[0],n):[Number.POSITIVE_INFINITY]).map(u=>{let c=u;if(c<0)throw new Error("flatten depth must not be negative");return t.flat(c)}):[null];case"unique":if(Array.isArray(t)){let i=new Set,u=[];for(let c of t){let s=JSON.stringify(c);i.has(s)||(i.add(s),u.push(c))}return[u]}return[null];case"tojson":case"tojsonstream":{let i=n.limits.maxDepth??wt;return x(t,i+1)>i?[null]:[JSON.stringify(t)]}case"fromjson":{if(typeof t=="string"){let i=t.trim().toLowerCase();if(i==="nan")return[Number.NaN];if(i==="inf"||i==="infinity")return[Number.POSITIVE_INFINITY];if(i==="-inf"||i==="-infinity")return[Number.NEGATIVE_INFINITY];try{return[JSON.parse(t)]}catch{throw new Error(`Invalid JSON: ${t}`)}}return[t]}case"tostring":return typeof t=="string"?[t]:[JSON.stringify(t)];case"tonumber":if(typeof t=="number")return[t];if(typeof t=="string"){let i=Number(t);if(Number.isNaN(i))throw new Error(`${JSON.stringify(t)} cannot be parsed as a number`);return[i]}throw new Error(`${typeof t} cannot be parsed as a number`);case"toboolean":{if(typeof t=="boolean")return[t];if(typeof t=="string"){if(t==="true")return[!0];if(t==="false")return[!1];throw new Error(`string (${JSON.stringify(t)}) cannot be parsed as a boolean`)}let i=t===null?"null":Array.isArray(t)?"array":typeof t,u=i==="array"||i==="object"?JSON.stringify(t):String(t);throw new Error(`${i} (${u}) cannot be parsed as a boolean`)}case"tostream":{let i=[],u=(c,s)=>{if(c===null||typeof c!="object")i.push([s,c]);else if(Array.isArray(c))if(c.length===0)i.push([s,[]]);else for(let f=0;f<c.length;f++)u(c[f],[...s,f]);else{let f=Object.keys(c);if(f.length===0)i.push([s,Object.create(null)]);else for(let o of f)u(c[o],[...s,o])}};return u(t,[]),i.push([[]]),i}case"fromstream":{if(e.length===0)return[t];let i=p(t,e[0],n),u=null;for(let c of i){if(!Array.isArray(c)||c.length===1&&Array.isArray(c[0])&&c[0].length===0||c.length!==2)continue;let[s,f]=c;if(!Array.isArray(s))continue;if(s.length===0){u=f;continue}u===null&&(u=typeof s[0]=="number"?[]:{});let o=u;for(let y=0;y<s.length-1;y++){let a=s[y],l=s[y+1];if(Array.isArray(o)&&typeof a=="number"){for(;o.length<=a;)o.push(null);o[a]===null&&(o[a]=typeof l=="number"?[]:{}),o=o[a]}else if(o&&typeof o=="object"&&!Array.isArray(o)){let m=String(a);if(!b(m))continue;let A=o;(A[m]===null||A[m]===void 0)&&g(A,m,typeof l=="number"?[]:{}),o=A[m]}}let h=s[s.length-1];if(Array.isArray(o)&&typeof h=="number"){for(;o.length<=h;)o.push(null);o[h]=f}else if(o&&typeof o=="object"&&!Array.isArray(o)){let y=String(h);b(y)&&g(o,y,f)}}return[u]}case"truncate_stream":{let i=typeof t=="number"?Math.floor(t):0;if(e.length===0)return[];let u=[],c=p(t,e[0],n);for(let s of c)if(Array.isArray(s)){if(s.length===1&&Array.isArray(s[0])){let f=s[0];f.length>i&&u.push([f.slice(i)]);continue}if(s.length===2&&Array.isArray(s[0])){let f=s[0],o=s[1];f.length>i&&u.push([f.slice(i),o])}}return u}default:return null}}function st(t,r,e,n,p,i,u,c,s,f){switch(r){case"getpath":{if(e.length===0)return[null];let o=p(t,e[0],n),h=[];for(let y of o){let a=y,l=t;for(let m of a){if(l==null){l=null;break}if(Array.isArray(l)&&typeof m=="number")l=l[m];else if(typeof l=="object"&&typeof m=="string"){let A=l;if(!Object.hasOwn(A,m)){l=null;break}l=A[m]}else{l=null;break}}h.push(l)}return h}case"setpath":{if(e.length<2)return[null];let h=p(t,e[0],n)[0],a=p(t,e[1],n)[0];return[u(t,h,a)]}case"delpaths":{if(e.length===0)return[t];let h=p(t,e[0],n)[0],y=t;for(let a of h.sort((l,m)=>m.length-l.length))y=c(y,a);return[y]}case"path":{if(e.length===0)return[[]];let o=[];return f(t,e[0],n,[],o),o}case"del":return e.length===0?[t]:[s(t,e[0],n)];case"pick":{if(e.length===0)return[null];let o=[];for(let y of e)f(t,y,n,[],o);let h=null;for(let y of o){for(let l of y)if(typeof l=="number"&&l<0)throw new Error("Out of bounds negative array index");let a=t;for(let l of y){if(a==null)break;if(Array.isArray(a)&&typeof l=="number")a=a[l];else if(typeof a=="object"&&typeof l=="string"){let m=a;if(!Object.hasOwn(m,l)){a=null;break}a=m[l]}else{a=null;break}}h=u(h,y,a)}return[h]}case"paths":{let o=[],h=(y,a)=>{if(y&&typeof y=="object")if(Array.isArray(y))for(let l=0;l<y.length;l++)o.push([...a,l]),h(y[l],[...a,l]);else for(let l of Object.keys(y))o.push([...a,l]),h(y[l],[...a,l])};return h(t,[]),e.length>0?o.filter(y=>{let a=t;for(let m of y)if(Array.isArray(a)&&typeof m=="number")a=a[m];else if(a&&typeof a=="object"&&typeof m=="string"){let A=a;if(!Object.hasOwn(A,m))return!1;a=A[m]}else return!1;return p(a,e[0],n).some(i)}):o}case"leaf_paths":{let o=[],h=(y,a)=>{if(y===null||typeof y!="object")o.push(a);else if(Array.isArray(y))for(let l=0;l<y.length;l++)h(y[l],[...a,l]);else for(let l of Object.keys(y))h(y[l],[...a,l])};return h(t,[]),o}default:return null}}function it(t,r,e,n,p,i){switch(r){case"IN":{if(e.length===0)return[!1];if(e.length===1){let f=p(t,e[0],n);for(let o of f)if(i(t,o))return[!0];return[!1]}let u=p(t,e[0],n),c=p(t,e[1],n),s=new Set(c.map(f=>JSON.stringify(f)));for(let f of u)if(s.has(JSON.stringify(f)))return[!0];return[!1]}case"INDEX":{if(e.length===0)return[{}];if(e.length===1){let s=p(t,e[0],n),f=Object.create(null);for(let o of s){let h=String(o);b(h)&&g(f,h,o)}return[f]}if(e.length===2){let s=p(t,e[0],n),f=Object.create(null);for(let o of s){let h=p(o,e[1],n);if(h.length>0){let y=String(h[0]);b(y)&&g(f,y,o)}}return[f]}let u=p(t,e[0],n),c=Object.create(null);for(let s of u){let f=p(s,e[1],n),o=p(s,e[2],n);if(f.length>0&&o.length>0){let h=String(f[0]);b(h)&&g(c,h,o[0])}}return[c]}case"JOIN":{if(e.length<2)return[null];let u=p(t,e[0],n)[0];if(!u||typeof u!="object"||Array.isArray(u))return[null];let c=u;if(!Array.isArray(t))return[null];let s=[];for(let f of t){let o=p(f,e[1],n),h=o.length>0?String(o[0]):"",y=T(c,h)?c[h]:null;s.push([f,y])}return[s]}default:return null}}function ot(t,r,e,n,p){switch(r){case"join":{if(!Array.isArray(t))return[null];let i=e.length>0?p(t,e[0],n):[""];for(let u of t)if(Array.isArray(u)||u!==null&&typeof u=="object")throw new Error("cannot join: contains arrays or objects");return i.map(u=>t.map(c=>c===null?"":typeof c=="string"?c:String(c)).join(String(u)))}case"split":{if(typeof t!="string"||e.length===0)return[null];let i=p(t,e[0],n),u=String(i[0]);return[t.split(u)]}case"splits":{if(typeof t!="string"||e.length===0)return[];let i=p(t,e[0],n),u=String(i[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"g";return C(u,c.includes("g")?c:`${c}g`).split(t)}catch{return[]}}case"scan":{if(typeof t!="string"||e.length===0)return[];let i=p(t,e[0],n),u=String(i[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"";return[...C(u,c.includes("g")?c:`${c}g`).matchAll(t)].map(o=>o.length>1?o.slice(1):o[0])}catch{return[]}}case"test":{if(typeof t!="string"||e.length===0)return[!1];let i=p(t,e[0],n),u=String(i[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"";return[C(u,c).test(t)]}catch{return[!1]}}case"match":{if(typeof t!="string"||e.length===0)return[null];let i=p(t,e[0],n),u=String(i[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"",f=C(u,`${c}d`).exec(t);if(!f)return[];let o=f.indices;return[{offset:f.index,length:f[0].length,string:f[0],captures:f.slice(1).map((h,y)=>({offset:o?.[y+1]?.[0]??null,length:h?.length??0,string:h??"",name:null}))}]}catch{return[null]}}case"capture":{if(typeof t!="string"||e.length===0)return[null];let i=p(t,e[0],n),u=String(i[0]);try{let c=e.length>1?String(p(t,e[1],n)[0]):"",f=C(u,c).match(t);return!f||!f.groups?[{}]:[f.groups]}catch{return[null]}}case"sub":{if(typeof t!="string"||e.length<2)return[null];let i=p(t,e[0],n),u=p(t,e[1],n),c=String(i[0]),s=String(u[0]);try{let f=e.length>2?String(p(t,e[2],n)[0]):"";return[C(c,f).replace(t,s)]}catch{return[t]}}case"gsub":{if(typeof t!="string"||e.length<2)return[null];let i=p(t,e[0],n),u=p(t,e[1],n),c=String(i[0]),s=String(u[0]);try{let f=e.length>2?String(p(t,e[2],n)[0]):"g",o=f.includes("g")?f:`${f}g`;return[C(c,o).replace(t,s)]}catch{return[t]}}case"ascii_downcase":return typeof t=="string"?[t.replace(/[A-Z]/g,i=>String.fromCharCode(i.charCodeAt(0)+32))]:[null];case"ascii_upcase":return typeof t=="string"?[t.replace(/[a-z]/g,i=>String.fromCharCode(i.charCodeAt(0)-32))]:[null];case"ltrimstr":{if(typeof t!="string"||e.length===0)return[t];let i=p(t,e[0],n),u=String(i[0]);return[t.startsWith(u)?t.slice(u.length):t]}case"rtrimstr":{if(typeof t!="string"||e.length===0)return[t];let i=p(t,e[0],n),u=String(i[0]);return u===""?[t]:[t.endsWith(u)?t.slice(0,-u.length):t]}case"trimstr":{if(typeof t!="string"||e.length===0)return[t];let i=p(t,e[0],n),u=String(i[0]);if(u==="")return[t];let c=t;return c.startsWith(u)&&(c=c.slice(u.length)),c.endsWith(u)&&(c=c.slice(0,-u.length)),[c]}case"trim":if(typeof t=="string")return[t.trim()];throw new Error("trim input must be a string");case"ltrim":if(typeof t=="string")return[t.trimStart()];throw new Error("trim input must be a string");case"rtrim":if(typeof t=="string")return[t.trimEnd()];throw new Error("trim input must be a string");case"startswith":{if(typeof t!="string"||e.length===0)return[!1];let i=p(t,e[0],n);return[t.startsWith(String(i[0]))]}case"endswith":{if(typeof t!="string"||e.length===0)return[!1];let i=p(t,e[0],n);return[t.endsWith(String(i[0]))]}case"ascii":return typeof t=="string"&&t.length>0?[t.charCodeAt(0)]:[null];case"explode":return typeof t=="string"?[Array.from(t).map(i=>i.codePointAt(0))]:[null];case"implode":if(!Array.isArray(t))throw new Error("implode input must be an array");return[t.map(c=>{if(typeof c=="string")throw new Error(`string (${JSON.stringify(c)}) can't be imploded, unicode codepoint needs to be numeric`);if(typeof c!="number"||Number.isNaN(c))throw new Error("number (null) can't be imploded, unicode codepoint needs to be numeric");let s=Math.trunc(c);return s<0||s>1114111||s>=55296&&s<=57343?String.fromCodePoint(65533):String.fromCodePoint(s)}).join("")];default:return null}}function ft(t,r){switch(r){case"type":return t===null?["null"]:Array.isArray(t)?["array"]:typeof t=="boolean"?["boolean"]:typeof t=="number"?["number"]:typeof t=="string"?["string"]:typeof t=="object"?["object"]:["null"];case"infinite":return[Number.POSITIVE_INFINITY];case"nan":return[Number.NaN];case"isinfinite":return[typeof t=="number"&&!Number.isFinite(t)];case"isnan":return[typeof t=="number"&&Number.isNaN(t)];case"isnormal":return[typeof t=="number"&&Number.isFinite(t)&&t!==0];case"isfinite":return[typeof t=="number"&&Number.isFinite(t)];case"numbers":return typeof t=="number"?[t]:[];case"strings":return typeof t=="string"?[t]:[];case"booleans":return typeof t=="boolean"?[t]:[];case"nulls":return t===null?[t]:[];case"arrays":return Array.isArray(t)?[t]:[];case"objects":return t&&typeof t=="object"&&!Array.isArray(t)?[t]:[];case"iterables":return Array.isArray(t)||t&&typeof t=="object"&&!Array.isArray(t)?[t]:[];case"scalars":return!Array.isArray(t)&&!(t&&typeof t=="object")?[t]:[];case"values":return t===null?[]:[t];case"not":return t===!1||t===null?[!0]:[!1];case"null":return[null];case"true":return[!0];case"false":return[!1];case"empty":return[];default:return null}}function F(t,r,e){if(r.length===0)return e;let[n,...p]=r;if(typeof n=="number"){if(t&&typeof t=="object"&&!Array.isArray(t))throw new Error("Cannot index object with number");if(n>536870911)throw new Error("Array index too large");if(n<0)throw new Error("Out of bounds negative array index");let s=Array.isArray(t)?[...t]:[];for(;s.length<=n;)s.push(null);return s[n]=F(s[n],p,e),s}if(Array.isArray(t))throw new Error("Cannot index array with string");if(!b(n))return t??Object.create(null);let i=t&&typeof t=="object"&&!Array.isArray(t)?k(t):Object.create(null),u=Object.hasOwn(i,n)?i[n]:void 0;return g(i,n,F(u,p,e)),i}function K(t,r){if(r.length===0)return null;if(r.length===1){let p=r[0];if(Array.isArray(t)&&typeof p=="number"){let i=[...t];return i.splice(p,1),i}if(t&&typeof t=="object"&&!Array.isArray(t)){let i=String(p);if(!b(i))return t;let u=k(t);return delete u[i],u}return t}let[e,...n]=r;if(Array.isArray(t)&&typeof e=="number"){let p=[...t];return p[e]=K(p[e],n),p}if(t&&typeof t=="object"&&!Array.isArray(t)){let p=String(e);if(!b(p))return t;let i=k(t);return Object.hasOwn(i,p)&&g(i,p,K(i[p],n)),i}return t}var P=class t extends Error{label;partialResults;constructor(r,e=[]){super(`break ${r}`),this.label=r,this.partialResults=e,this.name="BreakError"}withPrependedResults(r){return new t(this.label,[...r,...this.partialResults])}},J=class extends Error{value;constructor(r){super(typeof r=="string"?r:JSON.stringify(r)),this.value=r,this.name="JqError"}},kt=1e4,lt=2e3,Nt=new Map([["floor",Math.floor],["ceil",Math.ceil],["round",Math.round],["sqrt",Math.sqrt],["log",Math.log],["log10",Math.log10],["log2",Math.log2],["exp",Math.exp],["sin",Math.sin],["cos",Math.cos],["tan",Math.tan],["asin",Math.asin],["acos",Math.acos],["atan",Math.atan],["sinh",Math.sinh],["cosh",Math.cosh],["tanh",Math.tanh],["asinh",Math.asinh],["acosh",Math.acosh],["atanh",Math.atanh],["cbrt",Math.cbrt],["expm1",Math.expm1],["log1p",Math.log1p],["trunc",Math.trunc]]);function Ot(t){return{vars:new Map,limits:{maxIterations:t?.limits?.maxIterations??kt,maxDepth:t?.limits?.maxDepth??lt},env:t?.env,coverage:t?.coverage}}function H(t,r,e){let n=new Map(t.vars);return n.set(r,e),{vars:n,limits:t.limits,env:t.env,root:t.root,currentPath:t.currentPath,funcs:t.funcs,labels:t.labels,coverage:t.coverage}}function U(t,r,e){switch(r.type){case"var":return H(t,r.name,e);case"array":{if(!Array.isArray(e))return null;let n=t;for(let p=0;p<r.elements.length;p++){let i=r.elements[p],u=p<e.length?e[p]:null,c=U(n,i,u);if(c===null)return null;n=c}return n}case"object":{if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e,p=t;for(let i of r.fields){let u;if(typeof i.key=="string")u=i.key;else{let f=d(e,i.key,t);if(f.length===0)return null;u=String(f[0])}let c=T(n,u)?n[u]:null;i.keyVar&&(p=H(p,i.keyVar,c));let s=U(p,i.pattern,c);if(s===null)return null;p=s}return p}}}function St(t,r){let e=t;for(let n of r)if(e&&typeof e=="object")if(Array.isArray(e))if(typeof n=="number")e=e[n];else return;else{let p=e;if(typeof n=="string"&&Object.hasOwn(p,n))e=p[n];else return}else return;return e}function R(t){if(t.type==="Identity")return[];if(t.type==="Field"){let r=t.base?R(t.base):[];return r===null?null:[...r,t.name]}if(t.type==="Index"&&t.index.type==="Literal"){let r=t.base?R(t.base):[];if(r===null)return null;let e=t.index.value;return typeof e=="number"||typeof e=="string"?[...r,e]:null}if(t.type==="Pipe"){let r=R(t.left);return r===null?null:ct(r,t.right)}if(t.type==="Call"){if(t.name==="parent"||t.name==="root")return null;if(t.name==="first"&&t.args.length===0)return[0];if(t.name==="last"&&t.args.length===0)return[-1]}return null}function ct(t,r){if(r.type==="Call"){if(r.name==="parent"){let e=1;if(r.args.length>0&&r.args[0].type==="Literal"){let n=r.args[0].value;typeof n=="number"&&(e=n)}if(e>=0)return t.slice(0,Math.max(0,t.length-e));{let n=-e-1;return t.slice(0,Math.min(n,t.length))}}if(r.name==="root")return[]}if(r.type==="Field"){let e=R(r);if(e!==null)return[...t,...e]}if(r.type==="Index"&&r.index.type==="Literal"){let e=R(r);if(e!==null)return[...t,...e]}if(r.type==="Pipe"){let e=ct(t,r.left);return e===null?null:ct(e,r.right)}return r.type==="Identity"?t:null}function yt(t,r,e){if(r.type==="Comma"){let n=[];try{n.push(...d(t,r.left,e))}catch(p){if(p instanceof D)throw p;if(n.length>0)return n;throw new Error("evaluation failed")}try{n.push(...d(t,r.right,e))}catch(p){if(p instanceof D)throw p;return n}return n}return d(t,r,e)}function d(t,r,e){let n=e&&"vars"in e?e:Ot(e);switch(n.root===void 0&&(n={...n,root:t,currentPath:[]}),n.coverage?.hit(`jq:node:${r.type}`),r.type){case"Identity":return[t];case"Field":return(r.base?d(t,r.base,n):[t]).flatMap(i=>{if(i&&typeof i=="object"&&!Array.isArray(i)){let c=i;if(!Object.hasOwn(c,r.name))return[null];let s=c[r.name];return[s===void 0?null:s]}if(i===null)return[null];let u=Array.isArray(i)?"array":typeof i;throw new Error(`Cannot index ${u} with string "${r.name}"`)});case"Index":return(r.base?d(t,r.base,n):[t]).flatMap(i=>d(i,r.index,n).flatMap(c=>{if(typeof c=="number"&&Array.isArray(i)){if(Number.isNaN(c))return[null];let s=Math.trunc(c),f=s<0?i.length+s:s;return f>=0&&f<i.length?[i[f]]:[null]}if(typeof c=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){let s=i;return Object.hasOwn(s,c)?[s[c]]:[null]}return[null]}));case"Slice":return(r.base?d(t,r.base,n):[t]).flatMap(i=>{if(i===null)return[null];if(!Array.isArray(i)&&typeof i!="string")throw new Error(`Cannot slice ${typeof i} (${JSON.stringify(i)})`);let u=i.length,c=r.start?d(t,r.start,n):[0],s=r.end?d(t,r.end,n):[u];return c.flatMap(f=>s.map(o=>{let h=f,y=o,a=Number.isNaN(h)?0:Number.isInteger(h)?h:Math.floor(h),l=Number.isNaN(y)?u:Number.isInteger(y)?y:Math.ceil(y),m=at(a,u),A=at(l,u);return Array.isArray(i),i.slice(m,A)}))});case"Iterate":return(r.base?d(t,r.base,n):[t]).flatMap(i=>Array.isArray(i)?i:i&&typeof i=="object"?Object.values(i):[]);case"Pipe":{let p=d(t,r.left,n),i=R(r.left),u=[];for(let c of p)try{if(i!==null){let s={...n,currentPath:[...n.currentPath??[],...i]};u.push(...d(c,r.right,s))}else u.push(...d(c,r.right,n))}catch(s){throw s instanceof P?s.withPrependedResults(u):s}return u}case"Comma":{let p=d(t,r.left,n),i=d(t,r.right,n);return[...p,...i]}case"Literal":return[r.value];case"Array":return r.elements?[d(t,r.elements,n)]:[[]];case"Object":{let p=[Object.create(null)];for(let i of r.entries){let u=typeof i.key=="string"?[i.key]:d(t,i.key,n),c=d(t,i.value,n),s=[];for(let f of p)for(let o of u){if(typeof o!="string"){let h=o===null?"null":Array.isArray(o)?"array":typeof o;throw new Error(`Cannot use ${h} (${JSON.stringify(o)}) as object key`)}if(!b(o)){for(let h of c)s.push(k(f));continue}for(let h of c){let y=k(f);g(y,o,h),s.push(y)}}p.length=0,p.push(...s)}return p}case"Paren":return d(t,r.expr,n);case"BinaryOp":return Rt(t,r.op,r.left,r.right,n);case"UnaryOp":return d(t,r.operand,n).map(i=>{if(r.op==="-"){if(typeof i=="number")return-i;if(typeof i=="string"){let u=c=>c.length>5?`"${c.slice(0,3)}...`:JSON.stringify(c);throw new Error(`string (${u(i)}) cannot be negated`)}return null}return r.op==="not"?!O(i):null});case"Cond":return d(t,r.cond,n).flatMap(i=>{if(O(i))return d(t,r.then,n);for(let u of r.elifs)if(d(t,u.cond,n).some(O))return d(t,u.then,n);return r.else?d(t,r.else,n):[t]});case"Try":try{return d(t,r.body,n)}catch(p){if(r.catch){let i=p instanceof J?p.value:p instanceof Error?p.message:String(p);return d(i,r.catch,n)}return[]}case"Call":return mt(t,r.name,r.args,n);case"VarBind":return d(t,r.value,n).flatMap(i=>{let u=null,c=[];r.pattern?c.push(r.pattern):r.name&&c.push({type:"var",name:r.name}),r.alternatives&&c.push(...r.alternatives);for(let s of c)if(u=U(n,s,i),u!==null)break;return u===null?[]:d(t,r.body,u)});case"VarRef":{if(r.name==="$ENV")return[n.env?G(n.env):Object.create(null)];let p=n.vars.get(r.name);return p!==void 0?[p]:[null]}case"Recurse":{let p=[],i=new WeakSet,u=c=>{if(c&&typeof c=="object"){if(i.has(c))return;i.add(c)}if(p.push(c),Array.isArray(c))for(let s of c)u(s);else if(c&&typeof c=="object")for(let s of Object.keys(c))u(c[s])};return u(t),p}case"Optional":try{return d(t,r.expr,n)}catch{return[]}case"StringInterp":return[r.parts.map(i=>typeof i=="string"?i:d(t,i,n).map(c=>typeof c=="string"?c:JSON.stringify(c)).join("")).join("")];case"UpdateOp":return[Tt(t,r.path,r.op,r.value,n)];case"Reduce":{let p=d(t,r.expr,n),i=d(t,r.init,n)[0],u=n.limits.maxDepth??lt;for(let c of p){let s;if(r.pattern){if(s=U(n,r.pattern,c),s===null)continue}else s=H(n,r.varName,c);if(i=d(i,r.update,s)[0],x(i,u+1)>u)return[null]}return[i]}case"Foreach":{let p=d(t,r.expr,n),i=d(t,r.init,n)[0],u=[];for(let c of p)try{let s;if(r.pattern){if(s=U(n,r.pattern,c),s===null)continue}else s=H(n,r.varName,c);if(i=d(i,r.update,s)[0],r.extract){let f=d(i,r.extract,s);u.push(...f)}else u.push(i)}catch(s){throw s instanceof P?s.withPrependedResults(u):s}return u}case"Label":try{return d(t,r.body,{...n,labels:new Set([...n.labels??[],r.name])})}catch(p){if(p instanceof P&&p.label===r.name)return p.partialResults;throw p}case"Break":throw new P(r.name);case"Def":{let p=new Map(n.funcs??[]),i=`${r.name}/${r.params.length}`;p.set(i,{params:r.params,body:r.funcBody,closure:new Map(n.funcs??[])});let u={...n,funcs:p};return d(t,r.body,u)}default:{let p=r;throw new Error(`Unknown AST node type: ${p.type}`)}}}function at(t,r){return t<0?Math.max(0,r+t):Math.min(t,r)}function Tt(t,r,e,n,p){function i(s,f){switch(e){case"=":return f;case"|=":return d(s,n,p)[0]??null;case"+=":return typeof s=="number"&&typeof f=="number"||typeof s=="string"&&typeof f=="string"?s+f:Array.isArray(s)&&Array.isArray(f)?[...s,...f]:s&&f&&typeof s=="object"&&typeof f=="object"?X(s,f):f;case"-=":return typeof s=="number"&&typeof f=="number"?s-f:s;case"*=":return typeof s=="number"&&typeof f=="number"?s*f:s;case"/=":return typeof s=="number"&&typeof f=="number"?s/f:s;case"%=":return typeof s=="number"&&typeof f=="number"?s%f:s;case"//=":return s===null||s===!1?f:s;default:return f}}function u(s,f,o){switch(f.type){case"Identity":return o(s);case"Field":{if(!b(f.name))return s;if(f.base)return u(s,f.base,h=>{if(h&&typeof h=="object"&&!Array.isArray(h)){let y=k(h),a=Object.hasOwn(y,f.name)?y[f.name]:void 0;return g(y,f.name,o(a)),y}return h});if(s&&typeof s=="object"&&!Array.isArray(s)){let h=k(s),y=Object.hasOwn(h,f.name)?h[f.name]:void 0;return g(h,f.name,o(y)),h}return s}case"Index":{let y=d(t,f.index,p)[0];if(typeof y=="number"&&Number.isNaN(y))throw new Error("Cannot set array element at NaN index");if(typeof y=="number"&&!Number.isInteger(y)&&(y=Math.trunc(y)),f.base)return u(s,f.base,a=>{if(typeof y=="number"&&Array.isArray(a)){let l=[...a],m=y<0?l.length+y:y;if(m>=0){for(;l.length<=m;)l.push(null);l[m]=o(l[m])}return l}if(typeof y=="string"&&a&&typeof a=="object"&&!Array.isArray(a)){if(!b(y))return a;let l=k(a),m=Object.hasOwn(l,y)?l[y]:void 0;return g(l,y,o(m)),l}return a});if(typeof y=="number"){if(y>536870911)throw new Error("Array index too large");if(y<0&&(!s||!Array.isArray(s)))throw new Error("Out of bounds negative array index");if(Array.isArray(s)){let l=[...s],m=y<0?l.length+y:y;if(m>=0){for(;l.length<=m;)l.push(null);l[m]=o(l[m])}return l}if(s==null){let l=[];for(;l.length<=y;)l.push(null);return l[y]=o(null),l}return s}if(typeof y=="string"&&s&&typeof s=="object"&&!Array.isArray(s)){if(!b(y))return s;let a=k(s),l=Object.hasOwn(a,y)?a[y]:void 0;return g(a,y,o(l)),a}return s}case"Iterate":{let h=y=>{if(Array.isArray(y))return y.map(a=>o(a));if(y&&typeof y=="object"){let a=Object.create(null);for(let[l,m]of Object.entries(y))b(l)&&g(a,l,o(m));return a}return y};return f.base?u(s,f.base,h):h(s)}case"Pipe":{let h=u(s,f.left,y=>y);return u(h,f.right,o)}default:return o(s)}}return u(t,r,s=>{if(e==="|=")return i(s,s);let f=d(t,n,p);return i(s,f[0]??null)})}function Ct(t,r,e){function n(i,u,c){switch(u.type){case"Identity":return c;case"Field":{if(!b(u.name))return i;if(u.base){let s=d(i,u.base,e)[0],f=n(s,{type:"Field",name:u.name},c);return n(i,u.base,f)}if(i&&typeof i=="object"&&!Array.isArray(i)){let s=k(i);return g(s,u.name,c),s}return i}case"Index":{if(u.base){let o=d(i,u.base,e)[0],h=n(o,{type:"Index",index:u.index},c);return n(i,u.base,h)}let f=d(t,u.index,e)[0];if(typeof f=="number"&&Array.isArray(i)){let o=[...i],h=f<0?o.length+f:f;return h>=0&&h<o.length&&(o[h]=c),o}if(typeof f=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!b(f))return i;let o=k(i);return g(o,f,c),o}return i}default:return i}}function p(i,u){switch(u.type){case"Identity":return null;case"Field":{if(!b(u.name))return i;if(u.base){let s=d(i,u.base,e)[0];if(s==null)return i;let f=p(s,{type:"Field",name:u.name});return n(i,u.base,f)}if(i&&typeof i=="object"&&!Array.isArray(i)){if(!b(u.name))return i;let s=k(i);return delete s[u.name],s}return i}case"Index":{if(u.base){let o=d(i,u.base,e)[0];if(o==null)return i;let h=p(o,{type:"Index",index:u.index});return n(i,u.base,h)}let f=d(t,u.index,e)[0];if(typeof f=="number"&&Array.isArray(i)){let o=[...i],h=f<0?o.length+f:f;return h>=0&&h<o.length&&o.splice(h,1),o}if(typeof f=="string"&&i&&typeof i=="object"&&!Array.isArray(i)){if(!b(f))return i;let o=k(i);return delete o[f],o}return i}case"Iterate":return Array.isArray(i)?[]:i&&typeof i=="object"?Object.create(null):i;case"Pipe":{let o=function(a,l,m){switch(l.type){case"Identity":return m;case"Field":{if(!b(l.name))return a;if(a&&typeof a=="object"&&!Array.isArray(a)){let A=k(a);return g(A,l.name,m),A}return a}case"Index":{let E=d(t,l.index,e)[0];if(typeof E=="number"&&Array.isArray(a)){let w=[...a],N=E<0?w.length+E:E;return N>=0&&N<w.length&&(w[N]=m),w}if(typeof E=="string"&&a&&typeof a=="object"&&!Array.isArray(a)){if(!b(E))return a;let w=k(a);return g(w,E,m),w}return a}case"Pipe":{let A=d(a,l.left,e)[0],E=o(A,l.right,m);return o(a,l.left,E)}default:return a}};var c=o;let s=u.left,f=u.right,h=d(i,s,e)[0];if(h==null)return i;let y=p(h,f);return o(i,s,y)}default:return i}}return p(t,r)}function Rt(t,r,e,n,p){if(r==="and")return d(t,e,p).flatMap(s=>O(s)?d(t,n,p).map(o=>O(o)):[!1]);if(r==="or")return d(t,e,p).flatMap(s=>O(s)?[!0]:d(t,n,p).map(o=>O(o)));if(r==="//"){let s=d(t,e,p).filter(f=>f!=null&&f!==!1);return s.length>0?s:d(t,n,p)}let i=d(t,e,p),u=d(t,n,p);return i.flatMap(c=>u.map(s=>{switch(r){case"+":return c===null?s:s===null?c:typeof c=="number"&&typeof s=="number"||typeof c=="string"&&typeof s=="string"?c+s:Array.isArray(c)&&Array.isArray(s)?[...c,...s]:c&&s&&typeof c=="object"&&typeof s=="object"&&!Array.isArray(c)&&!Array.isArray(s)?X(c,s):null;case"-":if(typeof c=="number"&&typeof s=="number")return c-s;if(Array.isArray(c)&&Array.isArray(s)){let f=new Set(s.map(o=>JSON.stringify(o)));return c.filter(o=>!f.has(JSON.stringify(o)))}if(typeof c=="string"&&typeof s=="string"){let f=o=>o.length>10?`"${o.slice(0,10)}...`:JSON.stringify(o);throw new Error(`string (${f(c)}) and string (${f(s)}) cannot be subtracted`)}return null;case"*":return typeof c=="number"&&typeof s=="number"?c*s:typeof c=="string"&&typeof s=="number"?c.repeat(s):c&&s&&typeof c=="object"&&typeof s=="object"&&!Array.isArray(c)&&!Array.isArray(s)?z(c,s):null;case"/":if(typeof c=="number"&&typeof s=="number"){if(s===0)throw new Error(`number (${c}) and number (${s}) cannot be divided because the divisor is zero`);return c/s}return typeof c=="string"&&typeof s=="string"?c.split(s):null;case"%":if(typeof c=="number"&&typeof s=="number"){if(s===0)throw new Error(`number (${c}) and number (${s}) cannot be divided (remainder) because the divisor is zero`);return!Number.isFinite(c)&&!Number.isNaN(c)?!Number.isFinite(s)&&!Number.isNaN(s)&&c<0&&s>0?-1:0:c%s}return null;case"==":return I(c,s);case"!=":return!I(c,s);case"<":return B(c,s)<0;case"<=":return B(c,s)<=0;case">":return B(c,s)>0;case">=":return B(c,s)>=0;default:return null}}))}function mt(t,r,e,n){let p=Nt.get(r);if(p)return typeof t=="number"?[p(t)]:[null];let i=et(t,r,e,n,d);if(i!==null)return i;let u=ot(t,r,e,n,d);if(u!==null)return u;let c=Z(t,r,e,n,d);if(c!==null)return c;let s=v(t,r,n.limits.maxDepth);if(s!==null)return s;let f=ft(t,r);if(f!==null)return f;let o=nt(t,r,e,n,d);if(o!==null)return o;let h=W(t,r,e,n,d,yt,_,O,$,D);if(h!==null)return h;let y=st(t,r,e,n,d,O,F,K,Ct,V);if(y!==null)return y;let a=tt(t,r,e,n,d,I);if(a!==null)return a;let l=Q(t,r,e,n,d,yt,O,D);if(l!==null)return l;let m=rt(t,r,e,n,d,O,St,mt);if(m!==null)return m;let A=it(t,r,e,n,d,I);if(A!==null)return A;switch(r){case"builtins":return[["add/0","all/0","all/1","all/2","any/0","any/1","any/2","arrays/0","ascii/0","ascii_downcase/0","ascii_upcase/0","booleans/0","bsearch/1","builtins/0","combinations/0","combinations/1","contains/1","debug/0","del/1","delpaths/1","empty/0","env/0","error/0","error/1","explode/0","first/0","first/1","flatten/0","flatten/1","floor/0","from_entries/0","fromdate/0","fromjson/0","getpath/1","gmtime/0","group_by/1","gsub/2","gsub/3","has/1","implode/0","IN/1","IN/2","INDEX/1","INDEX/2","index/1","indices/1","infinite/0","inside/1","isempty/1","isnan/0","isnormal/0","isvalid/1","iterables/0","join/1","keys/0","keys_unsorted/0","last/0","last/1","length/0","limit/2","ltrimstr/1","map/1","map_values/1","match/1","match/2","max/0","max_by/1","min/0","min_by/1","mktime/0","modulemeta/1","nan/0","not/0","nth/1","nth/2","null/0","nulls/0","numbers/0","objects/0","path/1","paths/0","paths/1","pick/1","range/1","range/2","range/3","recurse/0","recurse/1","recurse_down/0","repeat/1","reverse/0","rindex/1","rtrimstr/1","scalars/0","scan/1","scan/2","select/1","setpath/2","skip/2","sort/0","sort_by/1","split/1","splits/1","splits/2","sqrt/0","startswith/1","strftime/1","strings/0","strptime/1","sub/2","sub/3","test/1","test/2","to_entries/0","toboolean/0","todate/0","tojson/0","tostream/0","fromstream/1","truncate_stream/1","tonumber/0","tostring/0","transpose/0","trim/0","ltrim/0","rtrim/0","type/0","unique/0","unique_by/1","until/2","utf8bytelength/0","values/0","walk/1","while/2","with_entries/1"]];case"error":{let E=e.length>0?d(t,e[0],n)[0]:t;throw new J(E)}case"env":return[n.env?G(n.env):Object.create(null)];case"debug":return[t];case"input_line_number":return[1];default:{let E=`${r}/${e.length}`,w=n.funcs?.get(E);if(w){let N=w.closure??n.funcs??new Map,S=new Map(N);S.set(E,w);for(let L=0;L<w.params.length;L++){let gt=w.params[L],ut=e[L];if(ut){let j=d(t,ut,n),M;if(j.length===0)M={type:"Call",name:"empty",args:[]};else if(j.length===1)M={type:"Literal",value:j[0]};else{M={type:"Literal",value:j[j.length-1]};for(let q=j.length-2;q>=0;q--)M={type:"Comma",left:{type:"Literal",value:j[q]},right:M}}S.set(`${gt}/0`,{params:[],body:M})}}let bt={...n,funcs:S};return d(t,w.body,bt)}throw new Error(`Unknown function: ${r}`)}}}function V(t,r,e,n,p){if(r.type==="Comma"){let c=r;V(t,c.left,e,n,p),V(t,c.right,e,n,p);return}let i=R(r);if(i!==null){p.push([...n,...i]);return}if(r.type==="Iterate"){if(Array.isArray(t))for(let c=0;c<t.length;c++)p.push([...n,c]);else if(t&&typeof t=="object")for(let c of Object.keys(t))p.push([...n,c]);return}if(r.type==="Recurse"){let c=(s,f)=>{if(p.push([...n,...f]),s&&typeof s=="object")if(Array.isArray(s))for(let o=0;o<s.length;o++)c(s[o],[...f,o]);else for(let o of Object.keys(s))c(s[o],[...f,o])};c(t,[]);return}if(r.type==="Pipe"){let c=R(r.left);if(c!==null){let s=d(t,r.left,e);for(let f of s)V(f,r.right,e,[...n,...c],p);return}}d(t,r,e).length>0&&p.push(n)}var dt=new Map([["and","AND"],["or","OR"],["not","NOT"],["if","IF"],["then","THEN"],["elif","ELIF"],["else","ELSE"],["end","END"],["as","AS"],["try","TRY"],["catch","CATCH"],["true","TRUE"],["false","FALSE"],["null","NULL"],["reduce","REDUCE"],["foreach","FOREACH"],["label","LABEL"],["break","BREAK"],["def","DEF"]]),Y=new Set(dt.values());function At(t){let r=[],e=0,n=(f=0)=>t[e+f],p=()=>t[e++],i=()=>e>=t.length,u=f=>f>="0"&&f<="9",c=f=>f>="a"&&f<="z"||f>="A"&&f<="Z"||f==="_",s=f=>c(f)||u(f);for(;!i();){let f=e,o=p();if(!(o===" "||o===" "||o===`
4
4
  `||o==="\r")){if(o==="#"){for(;!i()&&n()!==`
5
5
  `;)p();continue}if(o==="."&&n()==="."){p(),r.push({type:"DOTDOT",pos:f});continue}if(o==="="&&n()==="="){p(),r.push({type:"EQ",pos:f});continue}if(o==="!"&&n()==="="){p(),r.push({type:"NE",pos:f});continue}if(o==="<"&&n()==="="){p(),r.push({type:"LE",pos:f});continue}if(o===">"&&n()==="="){p(),r.push({type:"GE",pos:f});continue}if(o==="/"&&n()==="/"){p(),n()==="="?(p(),r.push({type:"UPDATE_ALT",pos:f})):r.push({type:"ALT",pos:f});continue}if(o==="+"&&n()==="="){p(),r.push({type:"UPDATE_ADD",pos:f});continue}if(o==="-"&&n()==="="){p(),r.push({type:"UPDATE_SUB",pos:f});continue}if(o==="*"&&n()==="="){p(),r.push({type:"UPDATE_MUL",pos:f});continue}if(o==="/"&&n()==="="){p(),r.push({type:"UPDATE_DIV",pos:f});continue}if(o==="%"&&n()==="="){p(),r.push({type:"UPDATE_MOD",pos:f});continue}if(o==="="&&n()!=="="){r.push({type:"ASSIGN",pos:f});continue}if(o==="."){r.push({type:"DOT",pos:f});continue}if(o==="|"){n()==="="?(p(),r.push({type:"UPDATE_PIPE",pos:f})):r.push({type:"PIPE",pos:f});continue}if(o===","){r.push({type:"COMMA",pos:f});continue}if(o===":"){r.push({type:"COLON",pos:f});continue}if(o===";"){r.push({type:"SEMICOLON",pos:f});continue}if(o==="("){r.push({type:"LPAREN",pos:f});continue}if(o===")"){r.push({type:"RPAREN",pos:f});continue}if(o==="["){r.push({type:"LBRACKET",pos:f});continue}if(o==="]"){r.push({type:"RBRACKET",pos:f});continue}if(o==="{"){r.push({type:"LBRACE",pos:f});continue}if(o==="}"){r.push({type:"RBRACE",pos:f});continue}if(o==="?"){r.push({type:"QUESTION",pos:f});continue}if(o==="+"){r.push({type:"PLUS",pos:f});continue}if(o==="-"){r.push({type:"MINUS",pos:f});continue}if(o==="*"){r.push({type:"STAR",pos:f});continue}if(o==="/"){r.push({type:"SLASH",pos:f});continue}if(o==="%"){r.push({type:"PERCENT",pos:f});continue}if(o==="<"){r.push({type:"LT",pos:f});continue}if(o===">"){r.push({type:"GT",pos:f});continue}if(u(o)){let h=o;for(;!i()&&(u(n())||n()==="."||n()==="e"||n()==="E");)(n()==="e"||n()==="E")&&(t[e+1]==="+"||t[e+1]==="-")&&(h+=p()),h+=p();r.push({type:"NUMBER",value:Number(h),pos:f});continue}if(o==='"'){let h="";for(;!i()&&n()!=='"';)if(n()==="\\"){if(p(),i())break;let y=p();switch(y){case"n":h+=`
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ import{a,b as o}from"./chunk-WIWKAGK6.js";import{a as i,b as l}from"./chunk-GTNBSMZR.js";var d={name:"sleep",summary:"delay for a specified amount of time",usage:"sleep NUMBER[SUFFIX]",description:`Pause for NUMBER seconds. SUFFIX may be:
3
+ s - seconds (default)
4
+ m - minutes
5
+ h - hours
6
+ d - days
7
+
8
+ NUMBER may be a decimal number.`,options:[" --help display this help and exit"]},u=36e5;function m(n){let s=n.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!s)return null;let e=parseFloat(s[1]);switch(s[2]||"s"){case"s":return e*1e3;case"m":return e*60*1e3;case"h":return e*60*60*1e3;case"d":return e*24*60*60*1e3;default:return null}}var c={name:"sleep",async execute(n,s){if(l(n))return i(d);if(n.length===0)return{stdout:"",stderr:`sleep: missing operand
9
+ `,exitCode:1};let e=0;for(let t of n){let r=m(t);if(r===null)return{stdout:"",stderr:`sleep: invalid time interval '${t}'
10
+ `,exitCode:1};e+=r}return e>u&&(e=u),s.signal?.aborted?{stdout:"",stderr:"",exitCode:0}:(s.sleep?await s.sleep(e):s.signal?await new Promise(t=>{let r=a(t,e);s.signal?.addEventListener("abort",()=>{o(r),t()},{once:!0})}):await new Promise(t=>a(t,e)),{stdout:"",stderr:"",exitCode:0})}},h={name:"sleep",flags:[],needsArgs:!0};export{c as a,h as b};
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{c as u}from"./chunk-4PRVMER6.js";import{a as l,b as h}from"./chunk-GTNBSMZR.js";var d={name:"bash",summary:"execute shell commands or scripts",usage:"bash [OPTIONS] [SCRIPT_FILE] [ARGUMENTS...]",options:["-c COMMAND execute COMMAND string"," --help display this help and exit"],notes:["Without -c, reads and executes commands from SCRIPT_FILE.","Arguments are passed as $1, $2, etc. to the script.",'$0 is set to the script name (or "bash" with -c).']},y={name:"bash",async execute(t,e){if(h(t))return l(d);if(t[0]==="-c"&&t.length>=2){let i=t[1],s=t[2]||"bash",c=t.slice(3);return o(i,s,c,e)}if(t.length===0)return e.stdin?.trim()?o(e.stdin,"bash",[],e):{stdout:"",stderr:"",exitCode:0};let n=t[0],r=t.slice(1);try{let i=e.fs.resolvePath(e.cwd,n),s=await e.fs.readFile(i);return o(s,n,r,e)}catch{return{stdout:"",stderr:`bash: ${n}: No such file or directory
3
+ `,exitCode:127}}}},C={name:"sh",async execute(t,e){if(h(t))return l({...d,name:"sh",summary:"execute shell commands or scripts (POSIX shell)"});if(t[0]==="-c"&&t.length>=2){let i=t[1],s=t[2]||"sh",c=t.slice(3);return o(i,s,c,e)}if(t.length===0)return e.stdin?.trim()?o(e.stdin,"sh",[],e):{stdout:"",stderr:"",exitCode:0};let n=t[0],r=t.slice(1);try{let i=e.fs.resolvePath(e.cwd,n),s=await e.fs.readFile(i);return o(s,n,r,e)}catch{return{stdout:"",stderr:`sh: ${n}: No such file or directory
4
+ `,exitCode:127}}}};async function o(t,e,n,r){if(!r.exec)return{stdout:"",stderr:`bash: internal error: exec function not available
5
+ `,exitCode:1};let i=u(r.exportedEnv||{},{0:e,"#":String(n.length),"@":n.join(" "),"*":n.join(" ")});n.forEach((a,m)=>{i[String(m+1)]=a});let s=t;if(s.startsWith("#!")){let a=s.indexOf(`
6
+ `);a!==-1&&(s=s.slice(a+1))}return await r.exec(s,{env:i,cwd:r.cwd,stdin:r.stdin,signal:r.signal})}var b={name:"bash",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"},P={name:"sh",flags:[{flag:"-c",type:"value",valueHint:"string"}],stdinType:"text"};export{y as a,C as b,b as c,P as d};
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import{a as c}from"./chunk-WIWKAGK6.js";import{a as g,b as p,c as a}from"./chunk-GTNBSMZR.js";var O={name:"timeout",summary:"run a command with a time limit",usage:"timeout [OPTION] DURATION COMMAND [ARG]...",description:`Start COMMAND, and kill it if still running after DURATION.
3
+
4
+ DURATION is a number with optional suffix:
5
+ s - seconds (default)
6
+ m - minutes
7
+ h - hours
8
+ d - days`,options:["-k, --kill-after=DURATION send KILL signal after DURATION if still running","-s, --signal=SIGNAL specify signal to send (default: TERM)"," --preserve-status exit with same status as COMMAND, even on timeout"," --foreground run command in foreground"," --help display this help and exit"]};function v(r){let i=r.match(/^(\d+\.?\d*)(s|m|h|d)?$/);if(!i)return null;let n=parseFloat(i[1]);switch(i[2]||"s"){case"s":return n*1e3;case"m":return n*60*1e3;case"h":return n*60*60*1e3;case"d":return n*24*60*60*1e3;default:return null}}var C={name:"timeout",async execute(r,i){if(p(r))return g(O);let n=!1,s=0;for(let t=0;t<r.length;t++){let e=r[t];if(e==="--preserve-status")n=!0,s=t+1;else if(e==="--foreground")s=t+1;else if(e==="-k"||e==="--kill-after")t++,s=t+1;else if(e.startsWith("--kill-after="))s=t+1;else if(e==="-s"||e==="--signal")t++,s=t+1;else if(e.startsWith("--signal="))s=t+1;else{if(e.startsWith("--")&&e!=="--")return a("timeout",e);if(e.startsWith("-")&&e.length>1&&e!=="--")if(e.startsWith("-k"))s=t+1;else if(e.startsWith("-s"))s=t+1;else return a("timeout",e);else{s=t;break}}}let o=r.slice(s);if(o.length===0)return{stdout:"",stderr:`timeout: missing operand
9
+ `,exitCode:1};let u=o[0],l=v(u);if(l===null)return{stdout:"",stderr:`timeout: invalid time interval '${u}'
10
+ `,exitCode:1};let m=o.slice(1);if(m.length===0)return{stdout:"",stderr:`timeout: missing operand
11
+ `,exitCode:1};if(!i.exec)return{stdout:"",stderr:`timeout: exec not available
12
+ `,exitCode:1};let h=m.map(t=>t.includes(" ")||t.includes(" ")?`'${t.replace(/'/g,"'\\''")}'`:t).join(" "),d=new AbortController,x=new Promise(t=>{c(()=>{d.abort(),t({timedOut:!0})},l)}),A=i.exec(h,{cwd:i.cwd,signal:d.signal}).then(t=>({timedOut:!1,result:t})),f=await Promise.race([x,A]);return f.timedOut?{stdout:"",stderr:"",exitCode:124}:f.result}},N={name:"timeout",flags:[{flag:"-k",type:"value",valueHint:"string"},{flag:"-s",type:"value",valueHint:"string"},{flag:"--preserve-status",type:"boolean"},{flag:"--foreground",type:"boolean"}],needsArgs:!0,minArgs:2};export{C as a,N as b};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{a as h}from"./chunk-KGOUQS5A.js";function x(){let a=[{prop:"Function",target:globalThis,violationType:"function_constructor",strategy:"throw",reason:"Function constructor allows arbitrary code execution"},{prop:"eval",target:globalThis,violationType:"eval",strategy:"throw",reason:"eval() allows arbitrary code execution"},{prop:"setTimeout",target:globalThis,violationType:"setTimeout",strategy:"throw",reason:"setTimeout with string argument allows code execution"},{prop:"setInterval",target:globalThis,violationType:"setInterval",strategy:"throw",reason:"setInterval with string argument allows code execution"},{prop:"setImmediate",target:globalThis,violationType:"setImmediate",strategy:"throw",reason:"setImmediate could be used to escape sandbox context"},{prop:"env",target:process,violationType:"process_env",strategy:"throw",reason:"process.env could leak sensitive environment variables",allowedKeys:new Set(["NODE_V8_COVERAGE","NODE_DEBUG","NODE_DEBUG_NATIVE","NODE_COMPILE_CACHE","WATCH_REPORT_DEPENDENCIES","FORCE_COLOR","DEBUG","UNDICI_NO_FG","JEST_WORKER_ID","__MINIMATCH_TESTING_PLATFORM__","LOG_TOKENS","LOG_STREAM"])},{prop:"binding",target:process,violationType:"process_binding",strategy:"throw",reason:"process.binding provides access to native Node.js modules"},{prop:"_linkedBinding",target:process,violationType:"process_binding",strategy:"throw",reason:"process._linkedBinding provides access to native Node.js modules"},{prop:"dlopen",target:process,violationType:"process_dlopen",strategy:"throw",reason:"process.dlopen allows loading native addons"},{prop:"getBuiltinModule",target:process,violationType:"process_get_builtin_module",strategy:"throw",reason:"process.getBuiltinModule allows loading native Node.js modules (fs, child_process, vm)"},{prop:"exit",target:process,violationType:"process_exit",strategy:"throw",reason:"process.exit could terminate the interpreter"},{prop:"abort",target:process,violationType:"process_exit",strategy:"throw",reason:"process.abort could crash the interpreter"},{prop:"kill",target:process,violationType:"process_kill",strategy:"throw",reason:"process.kill could signal other processes"},{prop:"setuid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setuid could escalate privileges"},{prop:"setgid",target:process,violationType:"process_setuid",strategy:"throw",reason:"process.setgid could escalate privileges"},{prop:"umask",target:process,violationType:"process_umask",strategy:"throw",reason:"process.umask could modify file creation permissions"},{prop:"argv",target:process,violationType:"process_argv",strategy:"throw",reason:"process.argv may contain secrets in CLI arguments"},{prop:"chdir",target:process,violationType:"process_chdir",strategy:"throw",reason:"process.chdir could confuse the interpreter's CWD tracking"},{prop:"send",target:process,violationType:"process_send",strategy:"throw",reason:"process.send could communicate with parent process in IPC contexts"},{prop:"channel",target:process,violationType:"process_channel",strategy:"throw",reason:"process.channel could access IPC channel to parent process"},{prop:"cpuUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.cpuUsage could enable timing side-channel attacks"},{prop:"memoryUsage",target:process,violationType:"process_timing",strategy:"throw",reason:"process.memoryUsage could enable timing side-channel attacks"},{prop:"hrtime",target:process,violationType:"process_timing",strategy:"throw",reason:"process.hrtime could enable timing side-channel attacks"},{prop:"WeakRef",target:globalThis,violationType:"weak_ref",strategy:"throw",reason:"WeakRef could be used to leak references outside sandbox"},{prop:"FinalizationRegistry",target:globalThis,violationType:"finalization_registry",strategy:"throw",reason:"FinalizationRegistry could be used to leak references outside sandbox"},{prop:"Reflect",target:globalThis,violationType:"reflect",strategy:"freeze",reason:"Reflect provides introspection capabilities"},{prop:"Proxy",target:globalThis,violationType:"proxy",strategy:"throw",reason:"Proxy allows intercepting and modifying object behavior"},{prop:"WebAssembly",target:globalThis,violationType:"webassembly",strategy:"throw",reason:"WebAssembly allows executing arbitrary compiled code"},{prop:"SharedArrayBuffer",target:globalThis,violationType:"shared_array_buffer",strategy:"throw",reason:"SharedArrayBuffer could enable side-channel communication or timing attacks"},{prop:"Atomics",target:globalThis,violationType:"atomics",strategy:"throw",reason:"Atomics could enable side-channel communication or timing attacks"}];try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(async()=>{}),violationType:"async_function_constructor",strategy:"throw",reason:"AsyncFunction constructor allows arbitrary async code execution"})}catch{}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&a.push({prop:"constructor",target:Object.getPrototypeOf(function*(){}),violationType:"generator_function_constructor",strategy:"throw",reason:"GeneratorFunction constructor allows arbitrary generator code execution"})}catch{}try{let e=Object.getPrototypeOf(async function*(){}).constructor;e&&e!==Function&&e!==Object.getPrototypeOf(async()=>{}).constructor&&a.push({prop:"constructor",target:Object.getPrototypeOf(async function*(){}),violationType:"async_generator_function_constructor",strategy:"throw",reason:"AsyncGeneratorFunction constructor allows arbitrary async generator code execution"})}catch{}return a.filter(e=>{try{return e.target[e.prop]!==void 0}catch{return!1}})}var g=typeof __BROWSER__<"u"&&__BROWSER__;function m(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{let e=Math.random()*16|0;return(a==="x"?e:e&3|8).toString(16)})}var b=null;if(!g)try{let{AsyncLocalStorage:a}=h("node:async_hooks");b=a}catch{}var _=`
3
+
4
+ This is a defense-in-depth measure and indicates a bug in just-bash. Please report this at security@vercel.com`,p=class extends Error{violation;constructor(e,t){super(e+_),this.violation=t,this.name="SecurityViolationError"}},u=!g&&b?new b:null,P=1e3,y={enabled:!0,auditMode:!1};function T(a){return a===void 0?{...y,enabled:!1}:typeof a=="boolean"?{...y,enabled:a}:{...y,...a}}var v=class a{static instance=null;config;refCount=0;patchFailures=[];originalDescriptors=[];violations=[];activationTime=0;totalActiveTimeMs=0;constructor(e){this.config=e}static getInstance(e){let t=T(e);if(!a.instance)a.instance=new a(t);else{let r=a.instance.config;if(t.enabled!==r.enabled||t.auditMode!==r.auditMode)throw new Error(`DefenseInDepthBox config conflict: requested {enabled: ${t.enabled}, auditMode: ${t.auditMode}} but singleton already has {enabled: ${r.enabled}, auditMode: ${r.auditMode}}. All Bash instances must use the same defense-in-depth security settings, or call DefenseInDepthBox.resetInstance() between incompatible configurations.`)}return a.instance}static resetInstance(){a.instance&&(a.instance.forceDeactivate(),a.instance=null)}static isInSandboxedContext(){return u?u?.getStore()?.sandboxActive===!0:!1}static getCurrentExecutionId(){if(u)return u?.getStore()?.executionId}isEnabled(){return this.config.enabled===!0&&u!==null&&!g}updateConfig(e){this.config={...this.config,...e}}activate(){if(g||!this.config.enabled||!u){let t=m();return{run:r=>r(),deactivate:()=>{},executionId:t}}this.refCount++,this.refCount===1&&(this.applyPatches(),this.activationTime=Date.now());let e=m();return{run:t=>u.run({sandboxActive:!0,executionId:e},t),deactivate:()=>{this.refCount--,this.refCount===0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount<0&&(this.refCount=0)},executionId:e}}forceDeactivate(){this.refCount>0&&(this.restorePatches(),this.totalActiveTimeMs+=Date.now()-this.activationTime),this.refCount=0}isActive(){return this.refCount>0}getStats(){return{violationsBlocked:this.violations.length,violations:[...this.violations],activeTimeMs:this.totalActiveTimeMs+(this.refCount>0?Date.now()-this.activationTime:0),refCount:this.refCount}}getPatchFailures(){return[...this.patchFailures]}clearViolations(){this.violations=[]}getPathForTarget(e,t){return e===globalThis?`globalThis.${t}`:e===process?`process.${t}`:e===Error?`Error.${t}`:e===Function.prototype?`Function.prototype.${t}`:e===Object.prototype?`Object.prototype.${t}`:`<object>.${t}`}static runTrusted(e){if(!u)return e();let t=u.getStore();return t?u.run({...t,trusted:!0},e):e()}static async runTrustedAsync(e){if(!u)return e();let t=u.getStore();return t?u.run({...t,trusted:!0},e):e()}shouldBlock(){if(g||this.config.auditMode||!u)return!1;let e=u?.getStore();return!(e?.sandboxActive!==!0||e.trusted)}recordViolation(e,t,r){let s={timestamp:Date.now(),type:e,message:r,path:t,stack:new Error().stack,executionId:u?.getStore()?.executionId};if(this.violations.length<P&&this.violations.push(s),this.config.onViolation)try{this.config.onViolation(s)}catch(o){console.debug("[DefenseInDepthBox] onViolation callback threw:",o instanceof Error?o.message:o)}return s}createBlockingProxy(e,t,r){let s=this;return new Proxy(e,{apply(o,n,c){if(s.shouldBlock()){let i=`${t} is blocked during script execution`,l=s.recordViolation(r,t,i);throw new p(i,l)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} called (audit mode)`),Reflect.apply(o,n,c)},construct(o,n,c){if(s.shouldBlock()){let i=`${t} constructor is blocked during script execution`,l=s.recordViolation(r,t,i);throw new p(i,l)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} constructor called (audit mode)`),Reflect.construct(o,n,c)}})}createBlockingObjectProxy(e,t,r,s){let o=this;return new Proxy(e,{get(n,c,i){if(o.shouldBlock()){if(s&&typeof c=="string"&&s.has(c))return Reflect.get(n,c,i);let l=`${t}.${String(c)}`,d=`${l} is blocked during script execution`,f=o.recordViolation(r,l,d);throw new p(d,f)}if(o.config.auditMode&&u?.getStore()?.sandboxActive===!0){let l=`${t}.${String(c)}`;o.recordViolation(r,l,`${l} accessed (audit mode)`)}return Reflect.get(n,c,i)},set(n,c,i,l){if(o.shouldBlock()){let d=`${t}.${String(c)}`,f=`${d} modification is blocked during script execution`,w=o.recordViolation(r,d,f);throw new p(f,w)}return Reflect.set(n,c,i,l)},ownKeys(n){if(o.shouldBlock()){let c=`${t} enumeration is blocked during script execution`,i=o.recordViolation(r,t,c);throw new p(c,i)}return Reflect.ownKeys(n)},getOwnPropertyDescriptor(n,c){if(o.shouldBlock()){let i=`${t}.${String(c)}`,l=`${i} descriptor access is blocked during script execution`,d=o.recordViolation(r,i,l);throw new p(l,d)}return Reflect.getOwnPropertyDescriptor(n,c)},has(n,c){if(o.shouldBlock()){let i=`${t}.${String(c)}`,l=`${i} existence check is blocked during script execution`,d=o.recordViolation(r,i,l);throw new p(l,d)}return Reflect.has(n,c)}})}applyPatches(){this.patchFailures=[];let e=x(),t=new Set(["process_send","process_channel"]);for(let o of e)t.has(o.violationType)||this.applyPatch(o);this.protectConstructorChain(),this.protectErrorPrepareStackTrace(),this.protectModuleLoad(),this.protectProcessMainModule(),this.protectProcessExecPath();let r=["Function.prototype.constructor","Module._load"],s=this.patchFailures.filter(o=>r.includes(o));if(s.length>0)throw this.restorePatches(),new Error(`DefenseInDepthBox: critical patches failed: ${s.join(", ")}`)}protectConstructorChain(){this.patchPrototypeConstructor(Function.prototype,"Function.prototype.constructor","function_constructor");try{let e=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"AsyncFunction.prototype.constructor","async_function_constructor")}catch(e){this.patchFailures.push("AsyncFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(function*(){}).constructor;e&&e!==Function&&this.patchPrototypeConstructor(e.prototype,"GeneratorFunction.prototype.constructor","generator_function_constructor")}catch(e){this.patchFailures.push("GeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch GeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}try{let e=Object.getPrototypeOf(async function*(){}).constructor,t=Object.getPrototypeOf(async()=>{}).constructor;e&&e!==Function&&e!==t&&this.patchPrototypeConstructor(e.prototype,"AsyncGeneratorFunction.prototype.constructor","async_generator_function_constructor")}catch(e){this.patchFailures.push("AsyncGeneratorFunction.prototype.constructor"),console.debug("[DefenseInDepthBox] Could not patch AsyncGeneratorFunction.prototype.constructor:",e instanceof Error?e.message:e)}}protectErrorPrepareStackTrace(){let e=this;try{let t=Object.getOwnPropertyDescriptor(Error,"prepareStackTrace");this.originalDescriptors.push({target:Error,prop:"prepareStackTrace",descriptor:t});let r=t?.value;Object.defineProperty(Error,"prepareStackTrace",{get(){return r},set(s){if(e.shouldBlock()){let o="Error.prepareStackTrace modification is blocked during script execution",n=e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace",o);throw new p(o,n)}e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("error_prepare_stack_trace","Error.prepareStackTrace","Error.prepareStackTrace set (audit mode)"),r=s},configurable:!0})}catch(t){this.patchFailures.push("Error.prepareStackTrace"),console.debug("[DefenseInDepthBox] Could not protect Error.prepareStackTrace:",t instanceof Error?t.message:t)}}patchPrototypeConstructor(e,t,r){let s=this;try{let o=Object.getOwnPropertyDescriptor(e,"constructor");this.originalDescriptors.push({target:e,prop:"constructor",descriptor:o});let n=o?.value;Object.defineProperty(e,"constructor",{get(){if(s.shouldBlock()){let c=`${t} access is blocked during script execution`,i=s.recordViolation(r,t,c);throw new p(c,i)}return s.config.auditMode&&u?.getStore()?.sandboxActive===!0&&s.recordViolation(r,t,`${t} accessed (audit mode)`),n},set(c){if(s.shouldBlock()){let i=`${t} modification is blocked during script execution`,l=s.recordViolation(r,t,i);throw new p(i,l)}Object.defineProperty(this,"constructor",{value:c,writable:!0,configurable:!0})},configurable:!0})}catch(o){this.patchFailures.push(t),console.debug(`[DefenseInDepthBox] Could not patch ${t}:`,o instanceof Error?o.message:o)}}protectProcessMainModule(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"mainModule");this.originalDescriptors.push({target:process,prop:"mainModule",descriptor:t});let r=t?.value;r!==void 0&&Object.defineProperty(process,"mainModule",{get(){if(e.shouldBlock()){let s="process.mainModule access is blocked during script execution",o=e.recordViolation("process_main_module","process.mainModule",s);throw new p(s,o)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("process_main_module","process.mainModule","process.mainModule accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let o="process.mainModule modification is blocked during script execution",n=e.recordViolation("process_main_module","process.mainModule",o);throw new p(o,n)}Object.defineProperty(process,"mainModule",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.mainModule"),console.debug("[DefenseInDepthBox] Could not protect process.mainModule:",t instanceof Error?t.message:t)}}protectProcessExecPath(){if(typeof process>"u")return;let e=this;try{let t=Object.getOwnPropertyDescriptor(process,"execPath");this.originalDescriptors.push({target:process,prop:"execPath",descriptor:t});let r=t?.value??process.execPath;Object.defineProperty(process,"execPath",{get(){if(e.shouldBlock()){let s="process.execPath access is blocked during script execution",o=e.recordViolation("process_exec_path","process.execPath",s);throw new p(s,o)}return e.config.auditMode&&u?.getStore()?.sandboxActive===!0&&e.recordViolation("process_exec_path","process.execPath","process.execPath accessed (audit mode)"),r},set(s){if(e.shouldBlock()){let o="process.execPath modification is blocked during script execution",n=e.recordViolation("process_exec_path","process.execPath",o);throw new p(o,n)}Object.defineProperty(process,"execPath",{value:s,writable:!0,configurable:!0})},configurable:!0})}catch(t){this.patchFailures.push("process.execPath"),console.debug("[DefenseInDepthBox] Could not protect process.execPath:",t instanceof Error?t.message:t)}}protectModuleLoad(){if(!g)try{let e=null;if(typeof process<"u"){let n=process.mainModule;n&&typeof n=="object"&&(e=n.constructor)}if(!e&&typeof h<"u"&&typeof h.main<"u"&&(e=h.main.constructor),!e||typeof e._load!="function")return;let t=e._load,r=Object.getOwnPropertyDescriptor(e,"_load");this.originalDescriptors.push({target:e,prop:"_load",descriptor:r});let o=this.createBlockingProxy(t,"Module._load","module_load");Object.defineProperty(e,"_load",{value:o,writable:!0,configurable:!0})}catch(e){this.patchFailures.push("Module._load"),console.debug("[DefenseInDepthBox] Could not protect Module._load:",e instanceof Error?e.message:e)}}applyPatch(e){let{target:t,prop:r,violationType:s,strategy:o}=e;try{let n=t[r];if(n===void 0)return;let c=Object.getOwnPropertyDescriptor(t,r);if(this.originalDescriptors.push({target:t,prop:r,descriptor:c}),o==="freeze")typeof n=="object"&&n!==null&&Object.freeze(n);else{let i=this.getPathForTarget(t,r),l=typeof n=="function"?this.createBlockingProxy(n,i,s):this.createBlockingObjectProxy(n,i,s,e.allowedKeys);Object.defineProperty(t,r,{value:l,writable:!0,configurable:!0})}}catch(n){let c=this.getPathForTarget(t,r);this.patchFailures.push(c),console.debug(`[DefenseInDepthBox] Could not patch ${c}:`,n instanceof Error?n.message:n)}}restorePatches(){for(let e=this.originalDescriptors.length-1;e>=0;e--){let{target:t,prop:r,descriptor:s}=this.originalDescriptors[e];try{s?Object.defineProperty(t,r,s):delete t[r]}catch(o){let n=this.getPathForTarget(t,r);console.debug(`[DefenseInDepthBox] Could not restore ${n}:`,o instanceof Error?o.message:o)}}this.originalDescriptors=[]}};export{p as a,v as b};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as _,c as W}from"./chunk-D5WP4CKS.js";import{k as T}from"./chunk-K5IXNHO5.js";import{a as D}from"./chunk-4VDEBYW7.js";import{a as N,b as A}from"./chunk-GTNBSMZR.js";import{c as H,e as L}from"./chunk-KGOUQS5A.js";var z=H(C=>{(function(){"use strict";var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function a(c){return e(n(c),arguments)}function r(c,i){return a.apply(null,[c].concat(i||[]))}function e(c,i){var u=1,l=c.length,o,m="",p,d,f,h,y,S,k,x;for(p=0;p<l;p++)if(typeof c[p]=="string")m+=c[p];else if(typeof c[p]=="object"){if(f=c[p],f.keys)for(o=i[u],d=0;d<f.keys.length;d++){if(o==null)throw new Error(a('[sprintf] Cannot access property "%s" of undefined value "%s"',f.keys[d],f.keys[d-1]));o=o[f.keys[d]]}else f.param_no?o=i[f.param_no]:o=i[u++];if(t.not_type.test(f.type)&&t.not_primitive.test(f.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(f.type)&&typeof o!="number"&&isNaN(o))throw new TypeError(a("[sprintf] expecting number but found %T",o));switch(t.number.test(f.type)&&(k=o>=0),f.type){case"b":o=parseInt(o,10).toString(2);break;case"c":o=String.fromCharCode(parseInt(o,10));break;case"d":case"i":o=parseInt(o,10);break;case"j":o=JSON.stringify(o,null,f.width?parseInt(f.width):0);break;case"e":o=f.precision?parseFloat(o).toExponential(f.precision):parseFloat(o).toExponential();break;case"f":o=f.precision?parseFloat(o).toFixed(f.precision):parseFloat(o);break;case"g":o=f.precision?String(Number(o.toPrecision(f.precision))):parseFloat(o);break;case"o":o=(parseInt(o,10)>>>0).toString(8);break;case"s":o=String(o),o=f.precision?o.substring(0,f.precision):o;break;case"t":o=String(!!o),o=f.precision?o.substring(0,f.precision):o;break;case"T":o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=f.precision?o.substring(0,f.precision):o;break;case"u":o=parseInt(o,10)>>>0;break;case"v":o=o.valueOf(),o=f.precision?o.substring(0,f.precision):o;break;case"x":o=(parseInt(o,10)>>>0).toString(16);break;case"X":o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(f.type)?m+=o:(t.number.test(f.type)&&(!k||f.sign)?(x=k?"+":"-",o=o.toString().replace(t.sign,"")):x="",y=f.pad_char?f.pad_char==="0"?"0":f.pad_char.charAt(1):" ",S=f.width-(x+o).length,h=f.width&&S>0?y.repeat(S):"",m+=f.align?x+o+h:y==="0"?x+h+o:h+x+o)}return m}var s=Object.create(null);function n(c){if(s[c])return s[c];for(var i=c,u,l=[],o=0;i;){if((u=t.text.exec(i))!==null)l.push(u[0]);else if((u=t.modulo.exec(i))!==null)l.push("%");else if((u=t.placeholder.exec(i))!==null){if(u[2]){o|=1;var m=[],p=u[2],d=[];if((d=t.key.exec(p))!==null)for(m.push(d[1]);(p=p.substring(d[0].length))!=="";)if((d=t.key_access.exec(p))!==null)m.push(d[1]);else if((d=t.index_access.exec(p))!==null)m.push(d[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");u[2]=m}else o|=2;if(o===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");l.push({placeholder:u[0],param_no:u[1],keys:u[2],sign:u[3],pad_char:u[4],align:u[5],width:u[6],precision:u[7],type:u[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");i=i.substring(u[0].length)}return s[c]=l}typeof C<"u"&&(C.sprintf=a,C.vsprintf=r),typeof window<"u"&&(window.sprintf=a,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:a,vsprintf:r}}))})()});var $=L(z(),1);function P(t,a,r){let e=new Date(a*1e3),s="",n=0;for(;n<t.length;)if(t[n]==="%"&&n+1<t.length){let c=t[n+1],i=R(e,c,r);i!==null?(s+=i,n+=2):(s+=t[n],n++)}else s+=t[n],n++;return s}function G(t,a){let r={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",hour12:!1,timeZone:a};try{let s=new Intl.DateTimeFormat("en-US",r).formatToParts(t),n=u=>s.find(l=>l.type===u)?.value??"",c=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),i=n("weekday");return{year:Number.parseInt(n("year"),10)||t.getFullYear(),month:Number.parseInt(n("month"),10)||t.getMonth()+1,day:Number.parseInt(n("day"),10)||t.getDate(),hour:Number.parseInt(n("hour"),10)||t.getHours(),minute:Number.parseInt(n("minute"),10)||t.getMinutes(),second:Number.parseInt(n("second"),10)||t.getSeconds(),weekday:c.get(i)??t.getDay()}}catch{return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),weekday:t.getDay()}}}function R(t,a,r){let e=G(t,r),s=(u,l=2)=>String(u).padStart(l,"0"),n=Z(e.year,e.month,e.day),c=j(e.year,e.month,e.day,e.weekday,0),i=j(e.year,e.month,e.day,e.weekday,1);switch(a){case"a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][e.weekday];case"A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.weekday];case"b":case"h":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.month-1];case"B":return["January","February","March","April","May","June","July","August","September","October","November","December"][e.month-1];case"c":return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][e.weekday]} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.month-1]} ${String(e.day).padStart(2," ")} ${s(e.hour)}:${s(e.minute)}:${s(e.second)} ${e.year}`;case"C":return s(Math.floor(e.year/100));case"d":return s(e.day);case"D":return`${s(e.month)}/${s(e.day)}/${s(e.year%100)}`;case"e":return String(e.day).padStart(2," ");case"F":return`${e.year}-${s(e.month)}-${s(e.day)}`;case"g":return s(O(e.year,e.month,e.day)%100);case"G":return String(O(e.year,e.month,e.day));case"H":return s(e.hour);case"I":return s(e.hour%12||12);case"j":return String(n).padStart(3,"0");case"k":return String(e.hour).padStart(2," ");case"l":return String(e.hour%12||12).padStart(2," ");case"m":return s(e.month);case"M":return s(e.minute);case"n":return`
2
+ import{a as _,c as W}from"./chunk-D5WP4CKS.js";import{k as T}from"./chunk-6KZRLMG3.js";import{a as D}from"./chunk-4VDEBYW7.js";import{a as N,b as A}from"./chunk-GTNBSMZR.js";import{c as H,e as L}from"./chunk-KGOUQS5A.js";var z=H(C=>{(function(){"use strict";var t={not_string:/[^s]/,not_bool:/[^t]/,not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function a(c){return e(n(c),arguments)}function r(c,i){return a.apply(null,[c].concat(i||[]))}function e(c,i){var u=1,l=c.length,o,m="",p,d,f,h,y,S,k,x;for(p=0;p<l;p++)if(typeof c[p]=="string")m+=c[p];else if(typeof c[p]=="object"){if(f=c[p],f.keys)for(o=i[u],d=0;d<f.keys.length;d++){if(o==null)throw new Error(a('[sprintf] Cannot access property "%s" of undefined value "%s"',f.keys[d],f.keys[d-1]));o=o[f.keys[d]]}else f.param_no?o=i[f.param_no]:o=i[u++];if(t.not_type.test(f.type)&&t.not_primitive.test(f.type)&&o instanceof Function&&(o=o()),t.numeric_arg.test(f.type)&&typeof o!="number"&&isNaN(o))throw new TypeError(a("[sprintf] expecting number but found %T",o));switch(t.number.test(f.type)&&(k=o>=0),f.type){case"b":o=parseInt(o,10).toString(2);break;case"c":o=String.fromCharCode(parseInt(o,10));break;case"d":case"i":o=parseInt(o,10);break;case"j":o=JSON.stringify(o,null,f.width?parseInt(f.width):0);break;case"e":o=f.precision?parseFloat(o).toExponential(f.precision):parseFloat(o).toExponential();break;case"f":o=f.precision?parseFloat(o).toFixed(f.precision):parseFloat(o);break;case"g":o=f.precision?String(Number(o.toPrecision(f.precision))):parseFloat(o);break;case"o":o=(parseInt(o,10)>>>0).toString(8);break;case"s":o=String(o),o=f.precision?o.substring(0,f.precision):o;break;case"t":o=String(!!o),o=f.precision?o.substring(0,f.precision):o;break;case"T":o=Object.prototype.toString.call(o).slice(8,-1).toLowerCase(),o=f.precision?o.substring(0,f.precision):o;break;case"u":o=parseInt(o,10)>>>0;break;case"v":o=o.valueOf(),o=f.precision?o.substring(0,f.precision):o;break;case"x":o=(parseInt(o,10)>>>0).toString(16);break;case"X":o=(parseInt(o,10)>>>0).toString(16).toUpperCase();break}t.json.test(f.type)?m+=o:(t.number.test(f.type)&&(!k||f.sign)?(x=k?"+":"-",o=o.toString().replace(t.sign,"")):x="",y=f.pad_char?f.pad_char==="0"?"0":f.pad_char.charAt(1):" ",S=f.width-(x+o).length,h=f.width&&S>0?y.repeat(S):"",m+=f.align?x+o+h:y==="0"?x+h+o:h+x+o)}return m}var s=Object.create(null);function n(c){if(s[c])return s[c];for(var i=c,u,l=[],o=0;i;){if((u=t.text.exec(i))!==null)l.push(u[0]);else if((u=t.modulo.exec(i))!==null)l.push("%");else if((u=t.placeholder.exec(i))!==null){if(u[2]){o|=1;var m=[],p=u[2],d=[];if((d=t.key.exec(p))!==null)for(m.push(d[1]);(p=p.substring(d[0].length))!=="";)if((d=t.key_access.exec(p))!==null)m.push(d[1]);else if((d=t.index_access.exec(p))!==null)m.push(d[1]);else throw new SyntaxError("[sprintf] failed to parse named argument key");else throw new SyntaxError("[sprintf] failed to parse named argument key");u[2]=m}else o|=2;if(o===3)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");l.push({placeholder:u[0],param_no:u[1],keys:u[2],sign:u[3],pad_char:u[4],align:u[5],width:u[6],precision:u[7],type:u[8]})}else throw new SyntaxError("[sprintf] unexpected placeholder");i=i.substring(u[0].length)}return s[c]=l}typeof C<"u"&&(C.sprintf=a,C.vsprintf=r),typeof window<"u"&&(window.sprintf=a,window.vsprintf=r,typeof define=="function"&&define.amd&&define(function(){return{sprintf:a,vsprintf:r}}))})()});var $=L(z(),1);function P(t,a,r){let e=new Date(a*1e3),s="",n=0;for(;n<t.length;)if(t[n]==="%"&&n+1<t.length){let c=t[n+1],i=R(e,c,r);i!==null?(s+=i,n+=2):(s+=t[n],n++)}else s+=t[n],n++;return s}function G(t,a){let r={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",weekday:"short",hour12:!1,timeZone:a};try{let s=new Intl.DateTimeFormat("en-US",r).formatToParts(t),n=u=>s.find(l=>l.type===u)?.value??"",c=new Map([["Sun",0],["Mon",1],["Tue",2],["Wed",3],["Thu",4],["Fri",5],["Sat",6]]),i=n("weekday");return{year:Number.parseInt(n("year"),10)||t.getFullYear(),month:Number.parseInt(n("month"),10)||t.getMonth()+1,day:Number.parseInt(n("day"),10)||t.getDate(),hour:Number.parseInt(n("hour"),10)||t.getHours(),minute:Number.parseInt(n("minute"),10)||t.getMinutes(),second:Number.parseInt(n("second"),10)||t.getSeconds(),weekday:c.get(i)??t.getDay()}}catch{return{year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),second:t.getSeconds(),weekday:t.getDay()}}}function R(t,a,r){let e=G(t,r),s=(u,l=2)=>String(u).padStart(l,"0"),n=Z(e.year,e.month,e.day),c=j(e.year,e.month,e.day,e.weekday,0),i=j(e.year,e.month,e.day,e.weekday,1);switch(a){case"a":return["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][e.weekday];case"A":return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e.weekday];case"b":case"h":return["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.month-1];case"B":return["January","February","March","April","May","June","July","August","September","October","November","December"][e.month-1];case"c":return`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][e.weekday]} ${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.month-1]} ${String(e.day).padStart(2," ")} ${s(e.hour)}:${s(e.minute)}:${s(e.second)} ${e.year}`;case"C":return s(Math.floor(e.year/100));case"d":return s(e.day);case"D":return`${s(e.month)}/${s(e.day)}/${s(e.year%100)}`;case"e":return String(e.day).padStart(2," ");case"F":return`${e.year}-${s(e.month)}-${s(e.day)}`;case"g":return s(O(e.year,e.month,e.day)%100);case"G":return String(O(e.year,e.month,e.day));case"H":return s(e.hour);case"I":return s(e.hour%12||12);case"j":return String(n).padStart(3,"0");case"k":return String(e.hour).padStart(2," ");case"l":return String(e.hour%12||12).padStart(2," ");case"m":return s(e.month);case"M":return s(e.minute);case"n":return`
3
3
  `;case"N":return"000000000";case"p":return e.hour<12?"AM":"PM";case"P":return e.hour<12?"am":"pm";case"r":return`${s(e.hour%12||12)}:${s(e.minute)}:${s(e.second)} ${e.hour<12?"AM":"PM"}`;case"R":return`${s(e.hour)}:${s(e.minute)}`;case"s":return String(Math.floor(t.getTime()/1e3));case"S":return s(e.second);case"t":return" ";case"T":return`${s(e.hour)}:${s(e.minute)}:${s(e.second)}`;case"u":return String(e.weekday===0?7:e.weekday);case"U":return s(c);case"V":return s(Q(e.year,e.month,e.day));case"w":return String(e.weekday);case"W":return s(i);case"x":return`${s(e.month)}/${s(e.day)}/${s(e.year%100)}`;case"X":return`${s(e.hour)}:${s(e.minute)}:${s(e.second)}`;case"y":return s(e.year%100);case"Y":return String(e.year);case"z":return V(t,r);case"Z":return q(t,r);case"%":return"%";default:return null}}function V(t,a){if(!a){let c=-t.getTimezoneOffset(),i=c>=0?"+":"-",u=Math.floor(Math.abs(c)/60),l=Math.abs(c)%60;return`${i}${String(u).padStart(2,"0")}${String(l).padStart(2,"0")}`}try{let u=new Intl.DateTimeFormat("en-US",{timeZone:a,timeZoneName:"longOffset"}).formatToParts(t).find(l=>l.type==="timeZoneName");if(u){let l=u.value.match(/GMT([+-])(\d{2}):(\d{2})/);if(l)return`${l[1]}${l[2]}${l[3]}`;if(u.value==="GMT"||u.value==="UTC")return"+0000"}}catch{}let r=-t.getTimezoneOffset(),e=r>=0?"+":"-",s=Math.floor(Math.abs(r)/60),n=Math.abs(r)%60;return`${e}${String(s).padStart(2,"0")}${String(n).padStart(2,"0")}`}function q(t,a){try{return new Intl.DateTimeFormat("en-US",{timeZone:a,timeZoneName:"short"}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??"UTC"}catch{return"UTC"}}function Z(t,a,r){let e=[31,28,31,30,31,30,31,31,30,31,30,31];(t%4===0&&t%100!==0||t%400===0)&&(e[1]=29);let n=r;for(let c=0;c<a-1;c++)n+=e[c];return n}function j(t,a,r,e,s){let n=Z(t,a,r),u=(new Date(t,0,1).getDay()-s+7)%7,l=(e-s+7)%7,o=n-1+u;return Math.floor((o-l+7)/7)}function Q(t,a,r){let e=new Date(t,a-1,r,12,0,0);e.setDate(e.getDate()+3-(e.getDay()+6)%7);let s=new Date(e.getFullYear(),0,4);s.setDate(s.getDate()+3-(s.getDay()+6)%7);let n=e.getTime()-s.getTime();return 1+Math.round(n/(10080*60*1e3))}function O(t,a,r){let e=new Date(t,a-1,r,12,0,0);return e.setDate(e.getDate()+3-(e.getDay()+6)%7),e.getFullYear()}function B(t){let a="",r=0;for(;r<t.length;){let e=t[r];if(e<128){a+=String.fromCharCode(e),r++;continue}if((e&224)===192){if(r+1<t.length&&(t[r+1]&192)===128&&e>=194){let s=(e&31)<<6|t[r+1]&63;a+=String.fromCharCode(s),r+=2;continue}a+=String.fromCharCode(e),r++;continue}if((e&240)===224){if(r+2<t.length&&(t[r+1]&192)===128&&(t[r+2]&192)===128){if(e===224&&t[r+1]<160){a+=String.fromCharCode(e),r++;continue}let s=(e&15)<<12|(t[r+1]&63)<<6|t[r+2]&63;if(s>=55296&&s<=57343){a+=String.fromCharCode(e),r++;continue}a+=String.fromCharCode(s),r+=3;continue}a+=String.fromCharCode(e),r++;continue}if((e&248)===240&&e<=244){if(r+3<t.length&&(t[r+1]&192)===128&&(t[r+2]&192)===128&&(t[r+3]&192)===128){if(e===240&&t[r+1]<144){a+=String.fromCharCode(e),r++;continue}let s=(e&7)<<18|(t[r+1]&63)<<12|(t[r+2]&63)<<6|t[r+3]&63;if(s>1114111){a+=String.fromCharCode(e),r++;continue}a+=String.fromCodePoint(s),r+=4;continue}a+=String.fromCharCode(e),r++;continue}a+=String.fromCharCode(e),r++}return a}var K={name:"printf",summary:"format and print data",usage:"printf [-v var] FORMAT [ARGUMENT...]",options:[" -v var assign the output to shell variable VAR rather than display it"," --help display this help and exit"],notes:["FORMAT controls the output like in C printf.","Escape sequences: \\n (newline), \\t (tab), \\\\ (backslash)","Format specifiers: %s (string), %d (integer), %f (float), %x (hex), %o (octal), %% (literal %)","Width and precision: %10s (width 10), %.2f (2 decimal places), %010d (zero-padded)","Flags: %- (left-justify), %+ (show sign), %0 (zero-pad)"]},ge={name:"printf",async execute(t,a){if(A(t))return N(K);if(t.length===0)return{stdout:"",stderr:`printf: usage: printf format [arguments]
4
4
  `,exitCode:2};let r=null,e=0;for(;e<t.length;){let c=t[e];if(c==="--"){e++;break}if(c==="-v"){if(e+1>=t.length)return{stdout:"",stderr:`printf: -v: option requires an argument
5
5
  `,exitCode:1};if(r=t[e+1],!/^[a-zA-Z_][a-zA-Z0-9_]*(\[[a-zA-Z0-9_@*"'$]+\])?$/.test(r))return{stdout:"",stderr:`printf: \`${r}': not a valid identifier
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ import{b as K}from"./chunk-KTFEQPO7.js";import{a as x}from"./chunk-SE4C7FJY.js";import{a as ie,b as se,c as P}from"./chunk-GTNBSMZR.js";import xe from"compressjs";var W="file",ce="link",le="symlink",M="directory",$e={file:"0",link:"1",symlink:"2","character-device":"3","block-device":"4",directory:"5",fifo:"6","pax-header":"x","pax-global-header":"g","gnu-long-name":"L","gnu-long-link-name":"K"},Ze={0:W,1:ce,2:le,3:"character-device",4:"block-device",5:M,6:"fifo",x:"pax-header",g:"pax-global-header",L:"gnu-long-name",K:"gnu-long-link-name"},Be=new Uint8Array(512),O=new Uint8Array(0),U=new TextEncoder,ue=new TextDecoder;function T(e,t,n,r){r&&U.encodeInto(r,e.subarray(t,t+n))}function v(e,t,n,r){if(r===void 0)return;let i=r.toString(8).padStart(n-1,"0");U.encodeInto(i,e.subarray(t,t+n-1))}function A(e,t,n){let r=e.indexOf(0,t),i=r===-1||r>t+n?t+n:r;return ue.decode(e.subarray(t,i))}function X(e,t,n){let r=0,i=t+n;for(let s=t;s<i;s++){let o=e[s];if(o===0)break;o!==32&&(r=r*8+(o-48))}return r}function k(e,t,n){if(e[t]&128){let r=0;r=e[t]&127;for(let i=1;i<n;i++)r=r*256+e[t+i];if(!Number.isSafeInteger(r))throw new Error("TAR number too large");return r}return X(e,t,n)}var z=e=>e.type===M||e.type===le||e.type===ce;async function fe(e){if(e==null)return O;if(e instanceof Uint8Array)return e;if(typeof e=="string")return U.encode(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(e instanceof Blob)return new Uint8Array(await e.arrayBuffer());throw new TypeError("Unsupported content type for entry body.")}function de(e,t){let{strip:n,filter:r,map:i}=t;if(!n&&!r&&!i)return e;let s={...e};if(n&&n>0){let a=s.name.split("/").filter(Boolean);if(n>=a.length)return null;let c=a.slice(n).join("/");if(s.name=s.type===M&&!c.endsWith("/")?`${c}/`:c,s.linkname?.startsWith("/")){let l=s.linkname.split("/").filter(Boolean);s.linkname=n>=l.length?"/":`/${l.slice(n).join("/")}`}}if(r?.(s)===!1)return null;let o=i?i(s):s;return o&&(!o.name||!o.name.trim()||o.name==="."||o.name==="/")?null:o}var H=32,De=48;function Ne(e){let t=X(e,148,8),n=0;for(let r=0;r<e.length;r++)r>=148&&r<156?n+=H:n+=e[r];return t===n}function Le(e){e.fill(H,148,156);let t=0;for(let n of e)t+=n;for(let n=153;n>=148;n--)e[n]=(t&7)+De,t>>=3;e[154]=0,e[155]=H}function Ke(e){let t={};e.name.length>100&&me(e.name)===null&&(t.path=e.name),e.linkname&&e.linkname.length>100&&(t.linkpath=e.linkname),e.uname&&e.uname.length>32&&(t.uname=e.uname),e.gname&&e.gname.length>32&&(t.gname=e.gname),e.uid!=null&&e.uid>2097151&&(t.uid=String(e.uid)),e.gid!=null&&e.gid>2097151&&(t.gid=String(e.gid)),e.size!=null&&e.size>8589934591&&(t.size=String(e.size)),e.pax&&Object.assign(t,e.pax);let n=Object.entries(t);if(n.length===0)return null;let r=U.encode(n.map(([i,s])=>{let o=`${i}=${s}
3
+ `,a=U.encode(o).length+1,c=a+String(a).length;return c=a+String(c).length,`${c} ${o}`}).join(""));return{paxHeader:pe({name:ue.decode(U.encode(`PaxHeader/${e.name}`).slice(0,100)),size:r.length,type:"pax-header",mode:420,mtime:e.mtime,uname:e.uname,gname:e.gname,uid:e.uid,gid:e.gid}),paxBody:r}}function me(e){if(e.length<=100)return null;let t=e.length-100-1,n=e.lastIndexOf("/",155);return n>0&&n>=t?{prefix:e.slice(0,n),name:e.slice(n+1)}:null}function pe(e){let t=new Uint8Array(512),n=z(e)?0:e.size??0,r=e.name,i="";if(!e.pax?.path){let s=me(r);s&&(r=s.name,i=s.prefix)}return T(t,0,100,r),v(t,100,8,e.mode??(e.type===M?493:420)),v(t,108,8,e.uid??0),v(t,116,8,e.gid??0),v(t,124,12,n),v(t,136,12,Math.floor((e.mtime?.getTime()??Date.now())/1e3)),T(t,156,1,$e[e.type??W]),T(t,157,100,e.linkname),T(t,257,6,"ustar\0"),T(t,263,2,"00"),T(t,265,32,e.uname),T(t,297,32,e.gname),T(t,345,155,i),Le(t),t}function Pe(e,t){if(t&&!Ne(e))throw new Error("Invalid tar header checksum.");let n=A(e,156,1),r={name:A(e,0,100),mode:X(e,100,8),uid:k(e,108,8),gid:k(e,116,8),size:k(e,124,12),mtime:new Date(k(e,136,12)*1e3),type:Ze[n]||W,linkname:A(e,157,100)},i=A(e,257,6);return i.trim()==="ustar"&&(r.uname=A(e,265,32),r.gname=A(e,297,32)),i==="ustar"&&(r.prefix=A(e,345,155)),r}var Ge={path:["name",e=>e],linkpath:["linkname",e=>e],size:["size",e=>parseInt(e,10)],mtime:["mtime",parseFloat],uid:["uid",e=>parseInt(e,10)],gid:["gid",e=>parseInt(e,10)],uname:["uname",e=>e],gname:["gname",e=>e]};function He(e){let t=new TextDecoder("utf-8"),n={},r={},i=0;for(;i<e.length;){let s=e.indexOf(32,i);if(s===-1)break;let o=parseInt(t.decode(e.subarray(i,s)),10);if(Number.isNaN(o)||o===0)break;let a=i+o,[c,l]=t.decode(e.subarray(s+1,a-1)).split("=",2);if(c&&l!==void 0){r[c]=l;let d=Ge[c];if(d){let[u,g]=d,p=g(l);(typeof p=="string"||!Number.isNaN(p))&&(n[u]=p)}}i=a}return Object.keys(r).length>0&&(n.pax=r),n}function ae(e,t){t.name!==void 0&&(e.name=t.name),t.linkname!==void 0&&(e.linkname=t.linkname),t.size!==void 0&&(e.size=t.size),t.mtime!==void 0&&(e.mtime=new Date(t.mtime*1e3)),t.uid!==void 0&&(e.uid=t.uid),t.gid!==void 0&&(e.gid=t.gid),t.uname!==void 0&&(e.uname=t.uname),t.gname!==void 0&&(e.gname=t.gname),t.pax&&(e.pax=Object.assign({},e.pax??{},t.pax))}function We(e){switch(e){case"pax-global-header":case"pax-header":return He;case"gnu-long-name":return t=>({name:A(t,0,t.length)});case"gnu-long-link-name":return t=>({linkname:A(t,0,t.length)});default:return}}function Xe(e){let t=pe(e),n=Ke(e);if(!n)return[t];let r=-n.paxBody.length&511,i=r>0?[Be.subarray(0,r)]:[];return[n.paxHeader,n.paxBody,...i,t]}var je=new Uint8Array(512*2);function he(e,t,n){let r=null,i=0,s=!1;return{add(o){if(s){let a=new Error("No new tar entries after finalize.");throw t(a),a}if(r!==null){let a=new Error("Previous entry must be completed before adding a new one");throw t(a),a}try{let a=z(o)?0:o.size??0,c=Xe({...o,size:a});for(let l of c)e(l);r={...o,size:a},i=0}catch(a){t(a)}},write(o){if(!r){let c=new Error("No active tar entry.");throw t(c),c}if(s){let c=new Error("Cannot write data after finalize.");throw t(c),c}let a=i+o.length;if(a>r.size){let c=new Error(`"${r.name}" exceeds given size of ${r.size} bytes.`);throw t(c),c}try{i=a,e(o)}catch(c){t(c)}},endEntry(){if(!r){let o=new Error("No active entry to end.");throw t(o),o}if(s){let o=new Error("Cannot end entry after finalize.");throw t(o),o}try{if(i!==r.size){let a=new Error(`Size mismatch for "${r.name}".`);throw t(a),a}let o=-r.size&511;o>0&&e(new Uint8Array(o)),r=null,i=0}catch(o){throw t(o),o}},finalize(){if(s){let o=new Error("Archive has already been finalized");throw t(o),o}if(r!==null){let o=new Error("Cannot finalize while an entry is still active");throw t(o),o}try{e(je),s=!0,n&&n()}catch(o){t(o)}}}}var R=256;function qe(){let e=new Array(R),t=e.length-1,n=0,r=0,i=0,s=a=>{let c=e[n];a===c.length?(e[n]=O,n=n+1&t):e[n]=c.subarray(a),i-=a,i===0&&e.length>R&&(e=new Array(R),t=R-1,n=0,r=0)};function o(a,c){if(c){let p=0,f=Math.min(a,i);for(;f>0;){let h=e[n],m=Math.min(f,h.length),S=m===h.length?h:h.subarray(0,m);if(s(m),f-=m,p+=m,!c(S))break}return p}if(i<a)return null;if(a===0)return O;let l=e[n];if(l.length>=a){let p=l.length===a?l:l.subarray(0,a);return s(a),p}let d=new Uint8Array(a),u=0,g=a;for(;g>0;){let p=e[n],f=Math.min(g,p.length);d.set(f===p.length?p:p.subarray(0,f),u),u+=f,g-=f,s(f)}return d}return{push:a=>{if(a.length===0)return;let c=r+1&t;if(c===n){let l=e.length,d=l*2,u=new Array(d),g=r-n+l&l-1;if(n<r)for(let p=0;p<g;p++)u[p]=e[n+p];else if(g>0){let p=l-n;for(let f=0;f<p;f++)u[f]=e[n+f];for(let f=0;f<r;f++)u[p+f]=e[f]}e=u,t=d-1,n=0,r=g,c=r+1&t}e[r]=a,r=c,i+=a.length},available:()=>i,peek:a=>{if(i<a)return null;if(a===0)return O;let c=e[n];if(c.length>=a)return c.length===a?c:c.subarray(0,a);let l=new Uint8Array(a),d=0,u=n;for(;d<a;){let g=e[u],p=Math.min(a-d,g.length);p===g.length?l.set(g,d):l.set(g.subarray(0,p),d),d+=p,u=u+1&t}return l},discard:a=>{if(a>i)throw new Error("Too many bytes consumed");if(a===0)return;let c=a;for(;c>0;){let l=e[n],d=Math.min(c,l.length);s(d),c-=d}},pull:o}}var G=0,F=1,b=new Error("Tar archive is truncated.");function ge(e={}){let t=e.strict??!1,{available:n,peek:r,push:i,discard:s,pull:o}=qe(),a=G,c=!1,l=!1,d=!1,u=null,g={},p={},f={isEntryActive:()=>a===F,isBodyComplete:()=>!u||u.remaining===0,write(h){if(c)throw new Error("Archive already ended.");i(h)},end(){c=!0},readHeader(){if(a!==G)throw new Error("Cannot read header while an entry is active");if(!l)for(;!l;){if(n()<512){if(c){if(n()>0&&t)throw b;l=!0;return}return null}let h=r(512);if(oe(h)){if(n()<512*2){if(c){if(t)throw b;l=!0;return}return null}if(oe(r(512*2).subarray(512))){s(512*2),l=!0,d=!0;return}if(t)throw new Error("Invalid tar header.");s(512);continue}let m;try{m=Pe(h,t)}catch(y){if(t)throw y;s(512);continue}let S=We(m.type);if(S){let y=m.size+511&-512;if(n()<512+y){if(c&&t)throw b;return null}s(512);let I=S(o(y).subarray(0,m.size)),Me=m.type==="pax-global-header"?g:p;for(let ne in I)Me[ne]=I[ne];continue}s(512);let E=m;return m.prefix&&(E.name=`${m.prefix}/${E.name}`),ae(E,g),ae(E,p),p={},u={header:E,remaining:E.size,padding:-E.size&511},a=F,E}},streamBody(h){if(a!==F||!u||u.remaining===0)return 0;let m=Math.min(u.remaining,n());if(m===0)return 0;let S=o(m,h);return u.remaining-=S,S},skipPadding(){if(a!==F||!u)return!0;if(u.remaining>0)throw new Error("Body not fully consumed");return n()<u.padding?!1:(s(u.padding),u=null,a=G,!0)},skipEntry(){if(a!==F||!u)return!0;let h=Math.min(u.remaining,n());return h>0&&(s(h),u.remaining-=h),u.remaining>0?!1:f.skipPadding()},validateEOF(){if(t){if(!d)throw b;if(n()>0&&o(n()).some(h=>h!==0))throw new Error("Invalid EOF.")}}};return f}function oe(e){if(e.byteOffset%8===0){let t=new BigUint64Array(e.buffer,e.byteOffset,e.length/8);for(let n=0;n<t.length;n++)if(t[n]!==0n)return!1;return!0}for(let t=0;t<e.length;t++)if(e[t]!==0)return!1;return!0}function Ee(){return new CompressionStream("gzip")}function ye(){return new DecompressionStream("gzip")}function Ye(){let e,t;return{readable:new ReadableStream({start(n){e=n,t=he(n.enqueue.bind(n),n.error.bind(n),n.close.bind(n))}}),controller:{add(n){let r=z(n),i={...n};return r&&(i.size=0),t.add(i),r&&t.endEntry(),new WritableStream({write(s){t.write(s)},close(){r||t.endEntry()},abort(s){e.error(s)}})},finalize(){t.finalize()},error(n){e.error(n)}}}}async function we(e){let t=[],n=e.getReader(),r=0;try{for(;;){let{done:o,value:a}=await n.read();if(o)break;t.push(a),r+=a.length}let i=new Uint8Array(r),s=0;for(let o of t)i.set(o,s),s+=o.length;return i}finally{n.releaseLock()}}var Se=e=>e.pipeTo(new WritableStream);function Ve(e={}){let t=ge(e),n=null,r=!1,i=s=>{if(!r){r=!0;try{for(;;)if(t.isEntryActive()){if(n){if(t.streamBody(o=>(n.enqueue(o),!0))===0&&!t.isBodyComplete())break}else if(!t.skipEntry())break;if(t.isBodyComplete()){try{n?.close()}catch{}if(n=null,!t.skipPadding())break}}else{let o=t.readHeader();if(o==null)break;s.enqueue({header:o,body:new ReadableStream({start(a){o.size===0?a.close():n=a},pull:()=>i(s),cancel(){n=null,i(s)}})})}}catch(o){try{n?.error(o)}catch{}throw n=null,o}finally{r=!1}}};return new TransformStream({transform(s,o){try{t.write(s),i(o)}catch(a){try{n?.error(a)}catch{}throw a}},flush(s){try{if(t.end(),i(s),t.validateEOF(),t.isEntryActive()&&!t.isBodyComplete())try{n?.close()}catch{}}catch(o){try{n?.error(o)}catch{}throw o}}},void 0,{highWaterMark:1})}async function Ae(e){let{readable:t,controller:n}=Ye();return await(async()=>{for(let r of e){let i=n.add(r.header),s="body"in r?r.body:r.data;if(!s){await i.close();continue}if(s instanceof ReadableStream)await s.pipeTo(i);else if(s instanceof Blob)await s.stream().pipeTo(i);else try{let o=await fe(s);if(o.length>0){let a=i.getWriter();await a.write(o),await a.close()}else await i.close()}catch{throw new TypeError(`Unsupported content type for entry "${r.header.name}".`)}}})().then(()=>n.finalize()).catch(r=>n.error(r)),new Uint8Array(await we(t))}async function _e(e,t={}){let n=e instanceof ReadableStream?e:new ReadableStream({start(s){s.enqueue(e instanceof Uint8Array?e:new Uint8Array(e)),s.close()}}),r=[],i=n.pipeThrough(Ve(t));for await(let s of i){let o;try{o=de(s.header,t)}catch(a){throw await s.body.cancel(),a}if(o===null){await Se(s.body);continue}z(o)?(await Se(s.body),r.push({header:o})):r.push({header:o,data:await we(s.body)})}return r}var $=null,Z=null;async function Ue(){if($)return $;if(Z)throw Z;try{return $=await K.runTrustedAsync(()=>import("node-liblzma")),$}catch{throw Z=new Error("xz compression requires node-liblzma which failed to load. Install liblzma-dev (apt) or xz (brew) and reinstall dependencies."),Z}}var B=null,D=null;async function Ie(){if(B)return B;if(D)throw D;try{return B=await K.runTrustedAsync(()=>import("@mongodb-js/zstd")),B}catch{throw D=new Error("zstd compression requires @mongodb-js/zstd which is not installed. Install it with: npm install @mongodb-js/zstd"),D}}var w=100*1024*1024,Te=512,Ce=1e4;function Je(e){let t="file";e.isDirectory?t="directory":e.isSymlink&&(t="symlink");let n=e.name;e.isDirectory&&!n.endsWith("/")&&(n+="/");let r;e.content!==void 0&&(typeof e.content=="string"?r=new TextEncoder().encode(e.content):r=e.content);let i=e.isDirectory||e.isSymlink?0:r?.length??0;return{header:{name:n,mode:e.mode??(e.isDirectory?493:420),uid:e.uid??0,gid:e.gid??0,size:i,mtime:e.mtime??new Date,type:t,linkname:e.linkTarget??"",uname:"user",gname:"user"},body:r}}async function C(e){let t=e.map(Je);return Ae(t)}async function ve(e){let t=await C(e),i=new ReadableStream({start(l){l.enqueue(t),l.close()}}).pipeThrough(Ee()).getReader(),s=[];for(;;){let{done:l,value:d}=await i.read();if(l)break;s.push(d)}let o=s.reduce((l,d)=>l+d.length,0),a=new Uint8Array(o),c=0;for(let l of s)a.set(l,c),c+=l.length;return a}async function _(e){if(e.length>w)return{entries:[],error:`Archive too large (max ${w} bytes)`};if(e.length<Te||e.length%Te!==0)return{entries:[],error:"Invalid tar archive format"};try{let t=await _e(e),n=[];for(let r of t){if(n.length>=Ce)return{entries:n,error:`Too many entries (max ${Ce})`};let i="file";switch(r.header.type){case"directory":i="directory";break;case"symlink":i="symlink";break;case"link":i="hardlink";break;case"file":i="file";break;default:i="other"}n.push({name:r.header.name,mode:r.header.mode??420,uid:r.header.uid??0,gid:r.header.gid??0,size:r.header.size,mtime:r.header.mtime??new Date,type:i,linkTarget:r.header.linkname||void 0,content:r.data??new Uint8Array(0)})}return{entries:n}}catch(t){let n=t instanceof Error?t.message:"Unknown error";return{entries:[],error:n}}}async function j(e){if(e.length>w)return{entries:[],error:`Archive too large (max ${w} bytes)`};try{let r=new ReadableStream({start(c){c.enqueue(e),c.close()}}).pipeThrough(ye()).getReader(),i=[];for(;;){let{done:c,value:l}=await r.read();if(c)break;i.push(l)}let s=i.reduce((c,l)=>c+l.length,0),o=new Uint8Array(s),a=0;for(let c of i)o.set(c,a),a+=c.length;return _(o)}catch(t){let n=t instanceof Error?t.message:"Unknown error";return{entries:[],error:`Decompression failed: ${n}`}}}function q(e){return e.length>=2&&e[0]===31&&e[1]===139}function Y(e){return e.length>=3&&e[0]===66&&e[1]===90&&e[2]===104}function V(e){return e.length>=6&&e[0]===253&&e[1]===55&&e[2]===122&&e[3]===88&&e[4]===90&&e[5]===0}async function Qe(e){let n=xe.Bzip2.decompressFile(Array.from(e));return new Uint8Array(n)}async function et(e){let t=xe.Bzip2,n=[];return t.compressFile(Array.from(e),n,9),new Uint8Array(n)}async function tt(e){let n=(await Ue()).unxzSync(Buffer.from(e));return new Uint8Array(n)}async function rt(e){let n=(await Ue()).xzSync(Buffer.from(e));return new Uint8Array(n)}async function Fe(e){let t=await C(e);return et(t)}async function ze(e){let t=await C(e);return rt(t)}async function J(e){if(e.length>w)return{entries:[],error:`Archive too large (max ${w} bytes)`};try{let t=await Qe(e);return _(t)}catch(t){let n=t instanceof Error?t.message:"Unknown error";return{entries:[],error:n}}}async function Q(e,t){if(!t?.allowNativeCodecs)return{entries:[],error:"xz decompression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in, or decompress the archive externally before extraction."};if(e.length>w)return{entries:[],error:`Archive too large (max ${w} bytes)`};try{let n=await tt(e);return _(n)}catch(n){let r=n instanceof Error?n.message:"Unknown error";return{entries:[],error:r}}}function ee(e){return e.length>=4&&e[0]===40&&e[1]===181&&e[2]===47&&e[3]===253}async function nt(e){let n=await(await Ie()).compress(Buffer.from(e),3);return new Uint8Array(n)}async function it(e){let n=await(await Ie()).decompress(Buffer.from(e));return new Uint8Array(n)}async function ke(e){let t=await C(e);return nt(t)}async function te(e,t){if(!t?.allowNativeCodecs)return{entries:[],error:"zstd decompression is disabled by default (native codec risk). Pass { allowNativeCodecs: true } to opt in, or decompress the archive externally before extraction."};if(e.length>w)return{entries:[],error:`Archive too large (max ${w} bytes)`};try{let n=await it(e);return _(n)}catch(n){let r=n instanceof Error?n.message:"Unknown error";return{entries:[],error:r}}}function Re(e){let t={create:!1,append:!1,update:!1,extract:!1,list:!1,file:"",autoCompress:!1,gzip:!1,bzip2:!1,xz:!1,zstd:!1,verbose:!1,toStdout:!1,keepOldFiles:!1,touch:!1,directory:"",preserve:!1,strip:0,exclude:[],filesFrom:"",excludeFrom:"",wildcards:!1},n=[],r=0;for(;r<e.length;){let i=e[r];if(i.startsWith("-")&&!i.startsWith("--")&&i.length>2){if(/^-\d+$/.test(i)){n.push(i),r++;continue}for(let s=1;s<i.length;s++){let o=i[s];switch(o){case"c":t.create=!0;break;case"r":t.append=!0;break;case"u":t.update=!0;break;case"x":t.extract=!0;break;case"t":t.list=!0;break;case"a":t.autoCompress=!0;break;case"z":t.gzip=!0;break;case"j":t.bzip2=!0;break;case"J":t.xz=!0;break;case"v":t.verbose=!0;break;case"O":t.toStdout=!0;break;case"k":t.keepOldFiles=!0;break;case"m":t.touch=!0;break;case"p":t.preserve=!0;break;case"f":if(s<i.length-1)t.file=i.substring(s+1),s=i.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
4
+ `,exitCode:2}};t.file=e[r]}break;case"C":if(s<i.length-1)t.directory=i.substring(s+1),s=i.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
5
+ `,exitCode:2}};t.directory=e[r]}break;case"T":if(s<i.length-1)t.filesFrom=i.substring(s+1),s=i.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
6
+ `,exitCode:2}};t.filesFrom=e[r]}break;case"X":if(s<i.length-1)t.excludeFrom=i.substring(s+1),s=i.length;else{if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
7
+ `,exitCode:2}};t.excludeFrom=e[r]}break;default:return{ok:!1,error:P("tar",`-${o}`)}}}r++;continue}if(i==="-c"||i==="--create")t.create=!0;else if(i==="-r"||i==="--append")t.append=!0;else if(i==="-u"||i==="--update")t.update=!0;else if(i==="-x"||i==="--extract"||i==="--get")t.extract=!0;else if(i==="-t"||i==="--list")t.list=!0;else if(i==="-a"||i==="--auto-compress")t.autoCompress=!0;else if(i==="-z"||i==="--gzip"||i==="--gunzip")t.gzip=!0;else if(i==="-j"||i==="--bzip2")t.bzip2=!0;else if(i==="-J"||i==="--xz")t.xz=!0;else if(i==="--zstd")t.zstd=!0;else if(i==="-v"||i==="--verbose")t.verbose=!0;else if(i==="-O"||i==="--to-stdout")t.toStdout=!0;else if(i==="-k"||i==="--keep-old-files")t.keepOldFiles=!0;else if(i==="-m"||i==="--touch")t.touch=!0;else if(i==="--wildcards")t.wildcards=!0;else if(i==="-p"||i==="--preserve"||i==="--preserve-permissions")t.preserve=!0;else if(i==="-f"||i==="--file"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'f'
8
+ `,exitCode:2}};t.file=e[r]}else if(i.startsWith("--file="))t.file=i.substring(7);else if(i==="-C"||i==="--directory"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'C'
9
+ `,exitCode:2}};t.directory=e[r]}else if(i.startsWith("--directory="))t.directory=i.substring(12);else if(i.startsWith("--strip-components=")||i.startsWith("--strip=")){let s=i.includes("--strip-components=")?i.substring(19):i.substring(8),o=parseInt(s,10);if(Number.isNaN(o)||o<0)return{ok:!1,error:{stdout:"",stderr:`tar: invalid number for --strip: '${s}'
10
+ `,exitCode:2}};t.strip=o}else if(i.startsWith("--exclude="))t.exclude.push(i.substring(10));else if(i==="--exclude"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option '--exclude' requires an argument
11
+ `,exitCode:2}};t.exclude.push(e[r])}else if(i==="-T"||i==="--files-from"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'T'
12
+ `,exitCode:2}};t.filesFrom=e[r]}else if(i.startsWith("--files-from="))t.filesFrom=i.substring(13);else if(i==="-X"||i==="--exclude-from"){if(r++,r>=e.length)return{ok:!1,error:{stdout:"",stderr:`tar: option requires an argument -- 'X'
13
+ `,exitCode:2}};t.excludeFrom=e[r]}else if(i.startsWith("--exclude-from="))t.excludeFrom=i.substring(15);else if(i==="--"){n.push(...e.slice(r+1));break}else{if(i.startsWith("-"))return{ok:!1,error:P("tar",i)};n.push(i)}r++}return{ok:!0,options:t,files:n}}var be=100,st={name:"tar",summary:"manipulate tape archives",usage:"tar [options] [file...]",description:["Create, extract, or list contents of tar archives.","","One of -c, -r, -u, -x, or -t is required to specify the operation."],options:["-c, --create create a new archive","-r, --append append files to the end of an archive","-u, --update only append files newer than copy in archive","-x, --extract extract files from an archive","-t, --list list contents of an archive","-f, --file=ARCHIVE use archive file ARCHIVE","-a, --auto-compress use archive suffix to determine compression","-z, --gzip filter archive through gzip","-j, --bzip2 filter archive through bzip2","-J, --xz filter archive through xz","--zstd filter archive through zstd","-v, --verbose verbosely list files processed","-O, --to-stdout extract files to standard output","-k, --keep-old-files don't replace existing files when extracting","-m, --touch don't extract file modified time","-C, --directory=DIR change to directory DIR before performing operations","-p, --preserve preserve permissions","-T, --files-from=FILE read files to extract/create from FILE","-X, --exclude-from=FILE read exclude patterns from FILE","--strip=N strip N leading path components on extraction","--exclude=PATTERN exclude files matching PATTERN","--wildcards use wildcards for pattern matching"," --help display this help and exit"],examples:["tar -cvf archive.tar file1 file2 Create archive from files","tar -czvf archive.tar.gz dir/ Create gzip-compressed archive","tar -cjvf archive.tar.bz2 dir/ Create bzip2-compressed archive","tar -rf archive.tar newfile.txt Append file to archive","tar -uf archive.tar dir/ Update archive with newer files","tar -xvf archive.tar Extract archive","tar -xvf archive.tar -C /tmp Extract to /tmp","tar -tvf archive.tar List archive contents","tar -xzf archive.tar.gz Extract gzip archive","tar -xf archive.tar file1.txt Extract specific file","tar -xOf archive.tar file.txt Extract file to stdout","tar -xf archive.tar --wildcards '*.txt' Extract matching files"]};function re(e,t){let n=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;for(let r of t){let i=r.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,".");if(x(`^${i}$`).test(e)||x(`^${i}/`).test(e)||!r.includes("/")&&x(`^${i}$`).test(n))return!0}return!1}function N(e,t){let n=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"<<<GLOBSTAR>>>").replace(/\*/g,"[^/]*").replace(/<<<GLOBSTAR>>>/g,".*").replace(/\?/g,"."),r=e.includes("/")?e.substring(e.lastIndexOf("/")+1):e;return x(`^${n}$`).test(e)||x(`^${n}$`).test(r)}function Oe(e,t){if(t<=0)return e;let n=e.split("/").filter(r=>r!=="");return n.length<=t?"":n.slice(t).join("/")}function at(e,t){let n=t?"d":"-",r=[e&256?"r":"-",e&128?"w":"-",e&64?"x":"-",e&32?"r":"-",e&16?"w":"-",e&8?"x":"-",e&4?"r":"-",e&2?"w":"-",e&1?"x":"-"].join("");return n+r}function ot(e){let n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],r=e.getDate().toString().padStart(2," "),i=e.getHours().toString().padStart(2,"0"),s=e.getMinutes().toString().padStart(2,"0");return`${n} ${r} ${i}:${s}`}async function L(e,t,n,r){let i=[],s=[],o=e.fs.resolvePath(t,n);try{let a=await e.fs.stat(o);if(re(n,r))return{entries:i,errors:s};if(a.isDirectory){i.push({name:n,isDirectory:!0,mode:a.mode,mtime:a.mtime});let c=await e.fs.readdir(o);for(let l=0;l<c.length;l+=be){let d=c.slice(l,l+be),u=await Promise.all(d.map(g=>L(e,t,n?`${n}/${g}`:g,r)));for(let g of u)i.push(...g.entries),s.push(...g.errors)}}else if(a.isFile){let c=await e.fs.readFileBuffer(o);i.push({name:n,content:c,mode:a.mode,mtime:a.mtime})}else if(a.isSymbolicLink){let c=await e.fs.readlink(o);i.push({name:n,isSymlink:!0,linkTarget:c,mode:a.mode,mtime:a.mtime})}}catch(a){let c=a instanceof Error?a.message:"unknown error";s.push(`tar: ${n}: ${c}`)}return{entries:i,errors:s}}async function ct(e,t,n){if(n.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to create an empty archive
14
+ `,exitCode:2};let r=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,i=[],s=[],o="";for(let d of n){let{entries:u,errors:g}=await L(e,r,d,t.exclude);if(i.push(...u),s.push(...g),t.verbose)for(let p of u)o+=`${p.name}${p.isDirectory?"/":""}
15
+ `}if(i.length===0&&s.length>0)return{stdout:"",stderr:`${s.join(`
16
+ `)}
17
+ `,exitCode:2};let a;try{t.gzip?a=await ve(i):t.bzip2?a=await Fe(i):t.xz?a=await ze(i):t.zstd?a=await ke(i):a=await C(i)}catch(d){return{stdout:"",stderr:`tar: error creating archive: ${d instanceof Error?d.message:"unknown error"}
18
+ `,exitCode:2}}let c="";if(t.file&&t.file!=="-"){let d=e.fs.resolvePath(e.cwd,t.file);try{await e.fs.writeFile(d,a)}catch(u){let g=u instanceof Error?u.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${g}
19
+ `,exitCode:2}}}else c=String.fromCharCode(...a);let l=o;return s.length>0&&(l+=`${s.join(`
20
+ `)}
21
+ `),{stdout:c,stderr:l,exitCode:s.length>0?2:0}}async function lt(e,t,n){if(!t.file||t.file==="-")return{stdout:"",stderr:`tar: Cannot append to stdin/stdout
22
+ `,exitCode:2};if(n.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to append nothing to archive
23
+ `,exitCode:2};let r=e.fs.resolvePath(e.cwd,t.file),i;try{i=await e.fs.readFileBuffer(r)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
24
+ `,exitCode:2}}let s=await _(i);if(s.error)return{stdout:"",stderr:`tar: ${s.error}
25
+ `,exitCode:2};let o=s.entries.map(f=>({name:f.name,content:f.content,mode:f.mode,mtime:f.mtime,isDirectory:f.type==="directory",isSymlink:f.type==="symlink",linkTarget:f.linkTarget,uid:f.uid,gid:f.gid})),a=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,c=[],l=[],d="";for(let f of n){let{entries:h,errors:m}=await L(e,a,f,t.exclude);if(c.push(...h),l.push(...m),t.verbose)for(let S of h)d+=`${S.name}${S.isDirectory?"/":""}
26
+ `}let u=[...o,...c],g;try{g=await C(u)}catch(f){return{stdout:"",stderr:`tar: error creating archive: ${f instanceof Error?f.message:"unknown error"}
27
+ `,exitCode:2}}try{await e.fs.writeFile(r,g)}catch(f){let h=f instanceof Error?f.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${h}
28
+ `,exitCode:2}}let p=d;return l.length>0&&(p+=`${l.join(`
29
+ `)}
30
+ `),{stdout:"",stderr:p,exitCode:l.length>0?2:0}}async function ut(e,t,n){if(!t.file||t.file==="-")return{stdout:"",stderr:`tar: Cannot update stdin/stdout
31
+ `,exitCode:2};if(n.length===0)return{stdout:"",stderr:`tar: Cowardly refusing to update with nothing
32
+ `,exitCode:2};let r=e.fs.resolvePath(e.cwd,t.file),i;try{i=await e.fs.readFileBuffer(r)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
33
+ `,exitCode:2}}let s=await _(i);if(s.error)return{stdout:"",stderr:`tar: ${s.error}
34
+ `,exitCode:2};let o=new Map;for(let m of s.entries)o.set(m.name,m.mtime);let a=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,c=[],l=[],d="";for(let m of n){let{entries:S,errors:E}=await L(e,a,m,t.exclude);l.push(...E);for(let y of S){let I=o.get(y.name);(!I||y.mtime&&y.mtime.getTime()>I.getTime())&&(c.push(y),t.verbose&&(d+=`${y.name}${y.isDirectory?"/":""}
35
+ `))}}if(c.length===0){let m="";return l.length>0&&(m=`${l.join(`
36
+ `)}
37
+ `),{stdout:"",stderr:m,exitCode:l.length>0?2:0}}let u=new Set(c.map(m=>m.name)),p=[...s.entries.filter(m=>!u.has(m.name)).map(m=>({name:m.name,content:m.content,mode:m.mode,mtime:m.mtime,isDirectory:m.type==="directory",isSymlink:m.type==="symlink",linkTarget:m.linkTarget,uid:m.uid,gid:m.gid})),...c],f;try{f=await C(p)}catch(m){return{stdout:"",stderr:`tar: error creating archive: ${m instanceof Error?m.message:"unknown error"}
38
+ `,exitCode:2}}try{await e.fs.writeFile(r,f)}catch(m){let S=m instanceof Error?m.message:"unknown error";return{stdout:"",stderr:`tar: ${t.file}: ${S}
39
+ `,exitCode:2}}let h=d;return l.length>0&&(h+=`${l.join(`
40
+ `)}
41
+ `),{stdout:"",stderr:h,exitCode:l.length>0?2:0}}async function ft(e,t,n){let r;if(t.file&&t.file!=="-"){let f=e.fs.resolvePath(e.cwd,t.file);try{r=await e.fs.readFileBuffer(f)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
42
+ `,exitCode:2}}}else r=Uint8Array.from(e.stdin,f=>f.charCodeAt(0));let i,s=t.gzip||q(r),o=t.bzip2||Y(r),a=t.xz||V(r),c=t.zstd||ee(r);if(s?i=await j(r):o?i=await J(r):a?i=await Q(r):c?i=await te(r):i=await _(r),i.error)return{stdout:"",stderr:`tar: ${i.error}
43
+ `,exitCode:2};let l=t.directory?e.fs.resolvePath(e.cwd,t.directory):e.cwd,d="",u="",g=[];if(t.directory&&!t.toStdout)try{await e.fs.mkdir(l,{recursive:!0})}catch{}for(let f of i.entries){let h=Oe(f.name,t.strip);if(!h)continue;let m=h.endsWith("/")?h.slice(0,-1):h;if(n.length>0){let E;if(t.wildcards?E=n.some(y=>N(h,y)||N(m,y)||h.startsWith(`${y}/`)):E=n.some(y=>h===y||h.startsWith(`${y}/`)||m===y),!E)continue}if(re(h,t.exclude))continue;let S=e.fs.resolvePath(l,h);try{if(f.type==="directory"){if(t.toStdout)continue;await e.fs.mkdir(S,{recursive:!0}),t.verbose&&(d+=`${h}
44
+ `)}else if(f.type==="file"){if(t.toStdout){u+=new TextDecoder().decode(f.content),t.verbose&&(d+=`${h}
45
+ `);continue}if(t.keepOldFiles)try{await e.fs.stat(S),t.verbose&&(d+=`${h}: not overwritten, file exists
46
+ `);continue}catch{}let E=S.substring(0,S.lastIndexOf("/"));if(E)try{await e.fs.mkdir(E,{recursive:!0})}catch{}if(await e.fs.writeFile(S,f.content),t.preserve&&f.mode)try{await e.fs.chmod(S,f.mode)}catch{}t.verbose&&(d+=`${h}
47
+ `)}else if(f.type==="symlink"&&f.linkTarget){if(t.toStdout)continue;if(t.keepOldFiles)try{await e.fs.stat(S),t.verbose&&(d+=`${h}: not overwritten, file exists
48
+ `);continue}catch{}let E=S.substring(0,S.lastIndexOf("/"));if(E)try{await e.fs.mkdir(E,{recursive:!0})}catch{}try{await e.fs.symlink(f.linkTarget,S)}catch{}t.verbose&&(d+=`${h}
49
+ `)}}catch(E){let y=E instanceof Error?E.message:"unknown error";g.push(`tar: ${h}: ${y}`)}}let p=d;return g.length>0&&(p+=`${g.join(`
50
+ `)}
51
+ `),{stdout:u,stderr:p,exitCode:g.length>0?2:0}}async function dt(e,t,n){let r;if(t.file&&t.file!=="-"){let d=e.fs.resolvePath(e.cwd,t.file);try{r=await e.fs.readFileBuffer(d)}catch{return{stdout:"",stderr:`tar: ${t.file}: Cannot open: No such file or directory
52
+ `,exitCode:2}}}else r=Uint8Array.from(e.stdin,d=>d.charCodeAt(0));let i,s=t.gzip||q(r),o=t.bzip2||Y(r),a=t.xz||V(r),c=t.zstd||ee(r);if(s?i=await j(r):o?i=await J(r):a?i=await Q(r):c?i=await te(r):i=await _(r),i.error)return{stdout:"",stderr:`tar: ${i.error}
53
+ `,exitCode:2};let l="";for(let d of i.entries){let u=Oe(d.name,t.strip);if(!u)continue;let g=u.endsWith("/")?u.slice(0,-1):u;if(n.length>0){let p;if(t.wildcards?p=n.some(f=>N(u,f)||N(g,f)||u.startsWith(`${f}/`)):p=n.some(f=>u===f||u.startsWith(`${f}/`)||g===f),!p)continue}if(!re(u,t.exclude))if(t.verbose){let p=d.type==="directory",f=at(d.mode,p),h=`${d.uid}/${d.gid}`,m=d.size.toString().padStart(8," "),S=ot(d.mtime),E=`${f} ${h.padEnd(10)} ${m} ${S} ${u}`;d.type==="symlink"&&d.linkTarget&&(E+=` -> ${d.linkTarget}`),l+=`${E}
54
+ `}else l+=`${u}
55
+ `}return{stdout:l,stderr:"",exitCode:0}}var Ut={name:"tar",async execute(e,t){if(se(e))return ie(st);let n=Re(e);if(!n.ok)return n.error;let{options:r,files:i}=n,s=[r.create,r.append,r.update,r.extract,r.list].filter(Boolean).length;if(s===0)return{stdout:"",stderr:`tar: You must specify one of -c, -r, -u, -x, or -t
56
+ `,exitCode:2};if(s>1)return{stdout:"",stderr:`tar: You may not specify more than one of -c, -r, -u, -x, or -t
57
+ `,exitCode:2};if(r.autoCompress&&r.file&&r.create){let c=r.file.toLowerCase();c.endsWith(".tar.gz")||c.endsWith(".tgz")?r.gzip=!0:c.endsWith(".tar.bz2")||c.endsWith(".tbz2")?r.bzip2=!0:c.endsWith(".tar.xz")||c.endsWith(".txz")?r.xz=!0:(c.endsWith(".tar.zst")||c.endsWith(".tzst"))&&(r.zstd=!0)}let o=[r.gzip,r.bzip2,r.xz,r.zstd].filter(Boolean).length;if(o>1)return{stdout:"",stderr:`tar: You may not specify more than one compression option
58
+ `,exitCode:2};if((r.append||r.update)&&o>0)return{stdout:"",stderr:`tar: Cannot append/update compressed archives - decompress first
59
+ `,exitCode:2};let a=i;if(r.filesFrom){let c=t.fs.resolvePath(t.cwd,r.filesFrom);try{let d=(await t.fs.readFile(c)).split(`
60
+ `).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));a=[...i,...d]}catch{return{stdout:"",stderr:`tar: ${r.filesFrom}: Cannot open: No such file or directory
61
+ `,exitCode:2}}}if(r.excludeFrom){let c=t.fs.resolvePath(t.cwd,r.excludeFrom);try{let d=(await t.fs.readFile(c)).split(`
62
+ `).map(u=>u.trim()).filter(u=>u.length>0&&!u.startsWith("#"));r.exclude.push(...d)}catch{return{stdout:"",stderr:`tar: ${r.excludeFrom}: Cannot open: No such file or directory
63
+ `,exitCode:2}}}return r.create?ct(t,r,a):r.append?lt(t,r,a):r.update?ut(t,r,a):r.extract?ft(t,r,a):dt(t,r,a)}},It={name:"tar",flags:[{flag:"-c",type:"boolean"},{flag:"-x",type:"boolean"},{flag:"-t",type:"boolean"},{flag:"-f",type:"value",valueHint:"path"},{flag:"-z",type:"boolean"},{flag:"-j",type:"boolean"},{flag:"-v",type:"boolean"},{flag:"-C",type:"value",valueHint:"path"},{flag:"--strip-components",type:"value",valueHint:"number"},{flag:"--exclude",type:"value",valueHint:"pattern"}],needsArgs:!0};export{Ut as a,It as b};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as O,b as J}from"./chunk-BWWPUUC5.js";import{a as N}from"./chunk-5WFYIUU2.js";import{k as x}from"./chunk-K5IXNHO5.js";import{a as C,b as E,c as q}from"./chunk-GTNBSMZR.js";function I(s){let r=[],t=0,i=s.length;for(;t<i;){for(;t<i&&/\s/.test(s[t]);)t++;if(t>=i)break;let u=t,n=s[t];if(n==="{"||n==="["){let o=n,l=n==="{"?"}":"]",c=1,p=!1,d=!1;for(t++;t<i&&c>0;){let h=s[t];d?d=!1:h==="\\"?d=!0:h==='"'?p=!p:p||(h===o?c++:h===l&&c--),t++}if(c!==0)throw new Error(`Unexpected end of JSON input at position ${t} (unclosed ${o})`);r.push(JSON.parse(s.slice(u,t)))}else if(n==='"'){let o=!1;for(t++;t<i;){let l=s[t];if(o)o=!1;else if(l==="\\")o=!0;else if(l==='"'){t++;break}t++}r.push(JSON.parse(s.slice(u,t)))}else if(n==="-"||n>="0"&&n<="9"){for(;t<i&&/[\d.eE+-]/.test(s[t]);)t++;r.push(JSON.parse(s.slice(u,t)))}else if(s.slice(t,t+4)==="true")r.push(!0),t+=4;else if(s.slice(t,t+5)==="false")r.push(!1),t+=5;else if(s.slice(t,t+4)==="null")r.push(null),t+=4;else{let o=s.slice(t,t+10);throw new Error(`Invalid JSON at position ${u}: unexpected '${o.split(/\s/)[0]}'`)}}return r}var A={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE]",options:["-r, --raw-output output strings without quotes","-c, --compact compact output (no pretty printing)","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --tab use tabs for indentation"," --help display this help and exit"]};function j(s,r,t,i,u,n=0){if(s===null||s===void 0)return"null";if(typeof s=="boolean")return String(s);if(typeof s=="number")return Number.isFinite(s)?String(s):"null";if(typeof s=="string")return t?s:JSON.stringify(s);let o=u?" ":" ";if(Array.isArray(s))return s.length===0?"[]":r?`[${s.map(c=>j(c,!0,!1,i,u)).join(",")}]`:`[
2
+ import{a as O,b as J}from"./chunk-EPIOK4SY.js";import{a as N}from"./chunk-5WFYIUU2.js";import{k as x}from"./chunk-6KZRLMG3.js";import{a as C,b as E,c as q}from"./chunk-GTNBSMZR.js";function I(s){let r=[],t=0,i=s.length;for(;t<i;){for(;t<i&&/\s/.test(s[t]);)t++;if(t>=i)break;let u=t,n=s[t];if(n==="{"||n==="["){let o=n,l=n==="{"?"}":"]",c=1,p=!1,d=!1;for(t++;t<i&&c>0;){let h=s[t];d?d=!1:h==="\\"?d=!0:h==='"'?p=!p:p||(h===o?c++:h===l&&c--),t++}if(c!==0)throw new Error(`Unexpected end of JSON input at position ${t} (unclosed ${o})`);r.push(JSON.parse(s.slice(u,t)))}else if(n==='"'){let o=!1;for(t++;t<i;){let l=s[t];if(o)o=!1;else if(l==="\\")o=!0;else if(l==='"'){t++;break}t++}r.push(JSON.parse(s.slice(u,t)))}else if(n==="-"||n>="0"&&n<="9"){for(;t<i&&/[\d.eE+-]/.test(s[t]);)t++;r.push(JSON.parse(s.slice(u,t)))}else if(s.slice(t,t+4)==="true")r.push(!0),t+=4;else if(s.slice(t,t+5)==="false")r.push(!1),t+=5;else if(s.slice(t,t+4)==="null")r.push(null),t+=4;else{let o=s.slice(t,t+10);throw new Error(`Invalid JSON at position ${u}: unexpected '${o.split(/\s/)[0]}'`)}}return r}var A={name:"jq",summary:"command-line JSON processor",usage:"jq [OPTIONS] FILTER [FILE]",options:["-r, --raw-output output strings without quotes","-c, --compact compact output (no pretty printing)","-e, --exit-status set exit status based on output","-s, --slurp read entire input into array","-n, --null-input don't read any input","-j, --join-output don't print newlines after each output","-a, --ascii force ASCII output","-S, --sort-keys sort object keys","-C, --color colorize output (ignored)","-M, --monochrome monochrome output (ignored)"," --tab use tabs for indentation"," --help display this help and exit"]};function j(s,r,t,i,u,n=0){if(s===null||s===void 0)return"null";if(typeof s=="boolean")return String(s);if(typeof s=="number")return Number.isFinite(s)?String(s):"null";if(typeof s=="string")return t?s:JSON.stringify(s);let o=u?" ":" ";if(Array.isArray(s))return s.length===0?"[]":r?`[${s.map(c=>j(c,!0,!1,i,u)).join(",")}]`:`[
3
3
  ${s.map(c=>o.repeat(n+1)+j(c,!1,!1,i,u,n+1)).join(`,
4
4
  `)}
5
5
  ${o.repeat(n)}]`;if(typeof s=="object"){let l=Object.keys(s);return i&&(l=l.sort()),l.length===0?"{}":r?`{${l.map(p=>`${JSON.stringify(p)}:${j(s[p],!0,!1,i,u)}`).join(",")}}`:`{
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ var o=globalThis.setTimeout,e=globalThis.clearTimeout,t=globalThis.SharedArrayBuffer,r=globalThis.Atomics;export{o as a,e as b,t as c,r as d};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{A as c,B as d,C as e,I as f,J as g,K as h,L as i,M as j,N as k,O as l,y as a,z as b}from"./chunk-ISOXAKGQ.js";import"./chunk-SE4C7FJY.js";import"./chunk-K5IXNHO5.js";import"./chunk-OBH7XN5N.js";import"./chunk-KGOUQS5A.js";export{d as escapeGlobChars,e as escapeRegexChars,l as expandRedirectTarget,g as expandWord,i as expandWordForPattern,h as expandWordForRegex,j as expandWordWithGlob,a as getArrayElements,c as getVariable,k as hasQuotedMultiValueAt,b as isArray,f as isWordFullyQuoted};
2
+ import{A as c,B as d,C as e,I as f,J as g,K as h,L as i,M as j,N as k,O as l,y as a,z as b}from"./chunk-CPL5P744.js";import"./chunk-SE4C7FJY.js";import"./chunk-6KZRLMG3.js";import"./chunk-OBH7XN5N.js";import"./chunk-KGOUQS5A.js";export{d as escapeGlobChars,e as escapeRegexChars,l as expandRedirectTarget,g as expandWord,i as expandWordForPattern,h as expandWordForRegex,j as expandWordWithGlob,a as getArrayElements,c as getVariable,k as hasQuotedMultiValueAt,b as isArray,f as isWordFullyQuoted};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{b as yr}from"./chunk-EFX3F2HZ.js";import{b as Ar}from"./chunk-XB2MDT3B.js";import{b as $r}from"./chunk-V4CRXAQO.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import{b as Sr}from"./chunk-PDVXLMUU.js";import{b as wr}from"./chunk-XKPFI566.js";import{b as xr}from"./chunk-KLMOJKL4.js";import{b as vr}from"./chunk-IDGH4PGU.js";import{b as kr}from"./chunk-F3LGZXLQ.js";import{b as qr}from"./chunk-BYDV4VEF.js";import{b as Cr}from"./chunk-JLX6YWGA.js";import{b as br}from"./chunk-FLPVVSN5.js";import{d as Ir,e as Mr,f as jr}from"./chunk-DAGNL3F2.js";import{b as tr}from"./chunk-P7UCWJ33.js";import{b as lr}from"./chunk-N73TVRMN.js";import{b as ur}from"./chunk-THALLNXT.js";import{b as pr}from"./chunk-2SIXTZCJ.js";import{b as er}from"./chunk-3Y32LPNT.js";import{b as dr}from"./chunk-7BORMNPQ.js";import{b as cr}from"./chunk-N43DJTSI.js";import"./chunk-OBI37ZY4.js";import{b as hr}from"./chunk-N5OTVT4F.js";import{c as or,d as ar}from"./chunk-MAVV76T4.js";import{b as sr}from"./chunk-JTF74J6E.js";import{c as ir,d as gr}from"./chunk-RDZMRK5M.js";import{b as mr}from"./chunk-XORPAMNK.js";import"./chunk-BWWPUUC5.js";import"./chunk-UYBH3FNE.js";import{b as Fr}from"./chunk-BARKRZDC.js";import{b as zr}from"./chunk-P6GNZPVW.js";import{b as fr}from"./chunk-LOJMXC4F.js";import{b as nr}from"./chunk-5UHJVSR5.js";import{b as R}from"./chunk-PQNTKMH3.js";import{b as U}from"./chunk-PPBQJBC2.js";import{b as V}from"./chunk-NSUMEERA.js";import{b as W}from"./chunk-XY5HGZW5.js";import{c as X,d as Y}from"./chunk-W2FKF3MM.js";import{c as Z,d as _}from"./chunk-3MBAUIBB.js";import{b as N}from"./chunk-RT7TRQVZ.js";import{b as rr}from"./chunk-JXC25GVQ.js";import{b as G}from"./chunk-RJSAGJQJ.js";import{b as H}from"./chunk-YEKSVVRC.js";import{b as J}from"./chunk-26NO42TF.js";import{b as K}from"./chunk-LGJM5YFT.js";import{b as L}from"./chunk-LMK6G2HH.js";import{b as O}from"./chunk-ZKC5HQYO.js";import{b as P}from"./chunk-ROJPSS6N.js";import{b as Q}from"./chunk-5UH3Q7QT.js";import{b as y}from"./chunk-NEQEZ32M.js";import{b as A}from"./chunk-ZA4HUKJ3.js";import{b as $}from"./chunk-5U7Q4GUC.js";import{b as S}from"./chunk-JQBC3FXE.js";import{b as T}from"./chunk-KPWFKFSD.js";import{b as B}from"./chunk-5G2VOPPJ.js";import{b as D}from"./chunk-SGA7Y45Z.js";import{b as E}from"./chunk-EUXCM6C4.js";import{b as w}from"./chunk-YLE2OYY6.js";import{b as x}from"./chunk-S7OHMN3F.js";import{b as v}from"./chunk-XAL6VWGA.js";import{d as k,e as q,f as C}from"./chunk-GA6KXSOC.js";import"./chunk-GIFF636B.js";import{b}from"./chunk-D2VMRCQU.js";import"./chunk-G43H2WGH.js";import{b as I}from"./chunk-AHMZLMTU.js";import{b as M}from"./chunk-K7XSYP4L.js";import{b as j}from"./chunk-THLAHQXV.js";import{b as t}from"./chunk-YYQ22ZRL.js";import{b as l}from"./chunk-PS4LOXE5.js";import{b as u}from"./chunk-VNER2XXL.js";import{b as p}from"./chunk-4E3LY6YK.js";import{b as e}from"./chunk-5VFN7VVJ.js";import{b as d}from"./chunk-TEFXEYX3.js";import{b as c}from"./chunk-D2GFNFUN.js";import{b as h}from"./chunk-SXRVLCZ4.js";import"./chunk-FSZWFMB4.js";import"./chunk-4PRVMER6.js";import"./chunk-SE4C7FJY.js";import{b as i}from"./chunk-LJKIWB5F.js";import{b as g}from"./chunk-K47SEEPI.js";import"./chunk-5WFYIUU2.js";import{b as m}from"./chunk-LW7FS3EH.js";import"./chunk-D5WP4CKS.js";import"./chunk-K5IXNHO5.js";import{b as F}from"./chunk-MXVNCVD6.js";import"./chunk-OBH7XN5N.js";import{b as z}from"./chunk-KWLLB7S3.js";import{b as f}from"./chunk-EJQKHROT.js";import"./chunk-JBABAK44.js";import{b as n}from"./chunk-ITA43A73.js";import"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var Er=[i,g,m,F,z,f,n,t,l,u,p,e,d,c,h,w,x,v,k,q,C,b,I,M,j,y,A,$,S,T,B,D,E,G,H,J,K,L,O,P,Q,R,U,V,W,X,Y,Z,_,N,rr,or,ar,sr,ir,gr,mr,Fr,zr,fr,nr,tr,lr,ur,pr,er,dr,cr,hr,wr,xr,vr,kr,qr,Cr,br,Ir,Mr,jr,yr,Ar,$r,Sr];function Tr(){return Er}var Br=new Map;for(let r of Tr())Br.set(r.name,new Set(r.flags.map(o=>o.flag)));function Fa(r,o,Dr){let a=Br.get(o);if(!(!a||a.size===0))for(let s of Dr)a.has(s)&&r.hit(`cmd:flag:${o}:${s}`)}export{Fa as emitFlagCoverage};
2
+ import{b as yr}from"./chunk-QC46PWBQ.js";import{b as Ar}from"./chunk-3NVWSLHI.js";import{b as $r}from"./chunk-7SWOLTCR.js";import"./chunk-GZHFXDDO.js";import"./chunk-QSDVMMYI.js";import{b as Sr}from"./chunk-27KQPTIX.js";import{b as wr}from"./chunk-XKPFI566.js";import{b as xr}from"./chunk-KLMOJKL4.js";import{b as vr}from"./chunk-IDGH4PGU.js";import{b as kr}from"./chunk-F3LGZXLQ.js";import{b as qr}from"./chunk-BYDV4VEF.js";import{b as Cr}from"./chunk-JLX6YWGA.js";import{b as br}from"./chunk-FLPVVSN5.js";import{d as Ir,e as Mr,f as jr}from"./chunk-DAGNL3F2.js";import{b as tr}from"./chunk-HA4QZ6XJ.js";import{b as lr}from"./chunk-N73TVRMN.js";import{b as ur}from"./chunk-THALLNXT.js";import{b as pr}from"./chunk-2SIXTZCJ.js";import{b as er}from"./chunk-3Y32LPNT.js";import{b as dr}from"./chunk-7BORMNPQ.js";import{b as cr}from"./chunk-N43DJTSI.js";import"./chunk-OBI37ZY4.js";import{b as hr}from"./chunk-N5OTVT4F.js";import{c as or,d as ar}from"./chunk-MAVV76T4.js";import{b as sr}from"./chunk-JTF74J6E.js";import{c as ir,d as gr}from"./chunk-GO6FXSC4.js";import{b as mr}from"./chunk-RYXW3SZQ.js";import"./chunk-EPIOK4SY.js";import"./chunk-UYBH3FNE.js";import{b as Fr}from"./chunk-BARKRZDC.js";import{b as zr}from"./chunk-P6GNZPVW.js";import{b as fr}from"./chunk-LOJMXC4F.js";import{b as nr}from"./chunk-F37UEO7A.js";import{b as R}from"./chunk-PQNTKMH3.js";import{b as U}from"./chunk-PPBQJBC2.js";import{b as V}from"./chunk-NSUMEERA.js";import{b as W}from"./chunk-XY5HGZW5.js";import{c as X,d as Y}from"./chunk-W2FKF3MM.js";import{c as Z,d as _}from"./chunk-3MBAUIBB.js";import{b as N}from"./chunk-RT7TRQVZ.js";import{b as rr}from"./chunk-JXC25GVQ.js";import{b as G}from"./chunk-RJSAGJQJ.js";import{b as H}from"./chunk-YEKSVVRC.js";import{b as J}from"./chunk-26NO42TF.js";import{b as K}from"./chunk-LGJM5YFT.js";import{b as L}from"./chunk-LMK6G2HH.js";import{b as O}from"./chunk-ZKC5HQYO.js";import{b as P}from"./chunk-ROJPSS6N.js";import{b as Q}from"./chunk-5UH3Q7QT.js";import{b as y}from"./chunk-NEQEZ32M.js";import{b as A}from"./chunk-ZA4HUKJ3.js";import{b as $}from"./chunk-5U7Q4GUC.js";import{b as S}from"./chunk-JQBC3FXE.js";import{b as T}from"./chunk-KPWFKFSD.js";import{b as B}from"./chunk-5G2VOPPJ.js";import{b as D}from"./chunk-SGA7Y45Z.js";import{b as E}from"./chunk-EUXCM6C4.js";import{b as w}from"./chunk-YLE2OYY6.js";import{b as x}from"./chunk-S7OHMN3F.js";import{b as v}from"./chunk-XAL6VWGA.js";import{d as k,e as q,f as C}from"./chunk-GA6KXSOC.js";import"./chunk-GIFF636B.js";import{b}from"./chunk-D2VMRCQU.js";import"./chunk-G43H2WGH.js";import{b as I}from"./chunk-6L4K3UGO.js";import{b as M}from"./chunk-6SAF32NO.js";import{b as j}from"./chunk-THLAHQXV.js";import{b as t}from"./chunk-YYQ22ZRL.js";import{b as l}from"./chunk-PS4LOXE5.js";import{b as u}from"./chunk-VNER2XXL.js";import{b as p}from"./chunk-4E3LY6YK.js";import{b as e}from"./chunk-5VFN7VVJ.js";import{b as d}from"./chunk-TEFXEYX3.js";import{b as c}from"./chunk-D2GFNFUN.js";import{b as h}from"./chunk-SXRVLCZ4.js";import"./chunk-FSZWFMB4.js";import"./chunk-KTFEQPO7.js";import"./chunk-WIWKAGK6.js";import"./chunk-4PRVMER6.js";import"./chunk-SE4C7FJY.js";import{b as i}from"./chunk-LJKIWB5F.js";import{b as g}from"./chunk-K47SEEPI.js";import"./chunk-5WFYIUU2.js";import{b as m}from"./chunk-ND23BJUM.js";import"./chunk-D5WP4CKS.js";import"./chunk-6KZRLMG3.js";import{b as F}from"./chunk-MXVNCVD6.js";import"./chunk-OBH7XN5N.js";import{b as z}from"./chunk-KWLLB7S3.js";import{b as f}from"./chunk-EJQKHROT.js";import"./chunk-JBABAK44.js";import{b as n}from"./chunk-ITA43A73.js";import"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";var Er=[i,g,m,F,z,f,n,t,l,u,p,e,d,c,h,w,x,v,k,q,C,b,I,M,j,y,A,$,S,T,B,D,E,G,H,J,K,L,O,P,Q,R,U,V,W,X,Y,Z,_,N,rr,or,ar,sr,ir,gr,mr,Fr,zr,fr,nr,tr,lr,ur,pr,er,dr,cr,hr,wr,xr,vr,kr,qr,Cr,br,Ir,Mr,jr,yr,Ar,$r,Sr];function Tr(){return Er}var Br=new Map;for(let r of Tr())Br.set(r.name,new Set(r.flags.map(o=>o.flag)));function Fa(r,o,Dr){let a=Br.get(o);if(!(!a||a.size===0))for(let s of Dr)a.has(s)&&r.hit(`cmd:flag:${o}:${s}`)}export{Fa as emitFlagCoverage};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a,b}from"./chunk-XORPAMNK.js";import"./chunk-BWWPUUC5.js";import"./chunk-UYBH3FNE.js";import"./chunk-4PRVMER6.js";import"./chunk-SE4C7FJY.js";import"./chunk-5WFYIUU2.js";import"./chunk-K5IXNHO5.js";import"./chunk-OBH7XN5N.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as jqCommand};
2
+ import{a,b}from"./chunk-RYXW3SZQ.js";import"./chunk-EPIOK4SY.js";import"./chunk-UYBH3FNE.js";import"./chunk-4PRVMER6.js";import"./chunk-SE4C7FJY.js";import"./chunk-5WFYIUU2.js";import"./chunk-6KZRLMG3.js";import"./chunk-OBH7XN5N.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as jqCommand};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{a,b}from"./chunk-ND23BJUM.js";import"./chunk-D5WP4CKS.js";import"./chunk-6KZRLMG3.js";import"./chunk-4VDEBYW7.js";import"./chunk-GTNBSMZR.js";import"./chunk-KGOUQS5A.js";export{b as flagsForFuzzing,a as printfCommand};