just-bash 2.14.1 → 2.14.3

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 (170) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/bin/chunks/{awk2-VTJMI54B.js → awk2-DB6QZAC5.js} +1 -1
  3. package/dist/bin/chunks/{chunk-HJEHIH4P.js → chunk-22NDZXS5.js} +1 -1
  4. package/dist/bin/chunks/{chunk-L2JBII6Z.js → chunk-2HVFB2TU.js} +72 -72
  5. package/dist/bin/{shell/chunks/chunk-SDLWFYVT.js → chunks/chunk-A5UGPLEI.js} +1 -1
  6. package/dist/bin/{shell/chunks/chunk-ZO5PSLKR.js → chunks/chunk-ARI4VLCN.js} +1 -1
  7. package/dist/bin/{shell/chunks/chunk-NLBRLRWD.js → chunks/chunk-BGGF3ELU.js} +1 -1
  8. package/dist/bin/{shell/chunks/chunk-VHUYNUT7.js → chunks/chunk-DU4S5MUI.js} +1 -1
  9. package/dist/bin/chunks/{chunk-SXB55JOI.js → chunk-EONWONZV.js} +1 -1
  10. package/dist/bin/{shell/chunks/chunk-SE4C7FJY.js → chunks/chunk-JDNI5HBX.js} +13 -13
  11. package/dist/bin/chunks/chunk-KCMUAACL.js +19 -0
  12. package/dist/bin/{shell/chunks/chunk-XKPFI566.js → chunks/chunk-L6XUBS6H.js} +17 -17
  13. package/dist/bin/{shell/chunks/chunk-B3RU2PUI.js → chunks/chunk-LTL632J4.js} +2 -2
  14. package/dist/bin/chunks/chunk-NTW6IA45.js +2 -0
  15. package/dist/bin/{shell/chunks/chunk-A3HQTYHR.js → chunks/chunk-OXHVTSNH.js} +1 -1
  16. package/dist/bin/{shell/chunks/chunk-RMQC3GS7.js → chunks/chunk-PNI5NMXP.js} +1 -1
  17. package/dist/bin/chunks/chunk-PXVBSPBE.js +2 -0
  18. package/dist/bin/{shell/chunks/chunk-YFPDB4PH.js → chunks/chunk-RA3TG4UK.js} +1 -1
  19. package/dist/bin/chunks/{chunk-GZHFXDDO.js → chunk-RBQGQWGV.js} +1 -1
  20. package/dist/bin/chunks/{chunk-THNL3XFF.js → chunk-S3QAKT3R.js} +1 -1
  21. package/dist/bin/chunks/{chunk-G43H2WGH.js → chunk-TTNNO45C.js} +1 -1
  22. package/dist/bin/chunks/chunk-UFJFAFSS.js +28 -0
  23. package/dist/bin/chunks/chunk-WLBA7L7U.js +23 -0
  24. package/dist/bin/{shell/chunks/chunk-3KAVXQP4.js → chunks/chunk-XXCTETRW.js} +2 -2
  25. package/dist/bin/chunks/chunk-ZUDPEMHG.js +63 -0
  26. package/dist/bin/chunks/{curl-SRTMGOVV.js → curl-2DCNBIKJ.js} +8 -8
  27. package/dist/bin/chunks/{diff-LE7GMFZD.js → diff-5NUI5BHG.js} +1 -1
  28. package/dist/bin/{shell/chunks/expansion-2RO5M3QC.js → chunks/expansion-QUT3FT7V.js} +1 -1
  29. package/dist/bin/{shell/chunks/expr-4CJYC4LY.js → chunks/expr-G4EF4POQ.js} +1 -1
  30. package/dist/bin/{shell/chunks/file-D5YKS5NV.js → chunks/file-MMSHRWCJ.js} +1 -1
  31. package/dist/bin/chunks/find-7CVMEZBO.js +2 -0
  32. package/dist/bin/{shell/chunks/flag-coverage-NSXW5TJP.js → chunks/flag-coverage-QMWFYZRC.js} +1 -1
  33. package/dist/bin/chunks/{grep-OZJTRD4D.js → grep-7BJ7HFBM.js} +1 -1
  34. package/dist/bin/chunks/{html-to-markdown-WVZA3MCP.js → html-to-markdown-V6PK6S5U.js} +1 -1
  35. package/dist/bin/{shell/chunks/jq-FIV5Q5T4.js → chunks/jq-DVZM2CEN.js} +1 -1
  36. package/dist/bin/chunks/{js-exec-BDQGEAU6.js → js-exec-RWEELTC2.js} +4 -4
  37. package/dist/bin/chunks/js-exec-worker.js +14 -3
  38. package/dist/bin/chunks/{ls-G2PXHSNX.js → ls-WONXDVOX.js} +1 -1
  39. package/dist/bin/chunks/{printf-P3QVL4IO.js → printf-NA7DYZBO.js} +1 -1
  40. package/dist/bin/chunks/{python3-VCIXXAXF.js → python3-JUJKPBFB.js} +1 -1
  41. package/dist/bin/chunks/rg-DK6FRF6Q.js +2 -0
  42. package/dist/bin/chunks/{sed-HALRQZKY.js → sed-WWXBUNG3.js} +1 -1
  43. package/dist/bin/chunks/tar-GTGFEWDS.js +2 -0
  44. package/dist/bin/chunks/worker.js +21 -2
  45. package/dist/bin/chunks/{xan-MOZFJGMY.js → xan-3G6YA5O6.js} +1 -1
  46. package/dist/bin/chunks/xan-view-6J5MMMQB.js +2 -0
  47. package/dist/bin/chunks/{yq-Q47JUWL6.js → yq-CWUVVSHY.js} +1 -1
  48. package/dist/bin/just-bash.js +262 -262
  49. package/dist/bin/shell/chunks/{awk2-VTJMI54B.js → awk2-DB6QZAC5.js} +1 -1
  50. package/dist/bin/shell/chunks/{chunk-HJEHIH4P.js → chunk-22NDZXS5.js} +1 -1
  51. package/dist/bin/shell/chunks/{chunk-L2JBII6Z.js → chunk-2HVFB2TU.js} +72 -72
  52. package/dist/bin/{chunks/chunk-SDLWFYVT.js → shell/chunks/chunk-A5UGPLEI.js} +1 -1
  53. package/dist/bin/{chunks/chunk-ZO5PSLKR.js → shell/chunks/chunk-ARI4VLCN.js} +1 -1
  54. package/dist/bin/{chunks/chunk-NLBRLRWD.js → shell/chunks/chunk-BGGF3ELU.js} +1 -1
  55. package/dist/bin/{chunks/chunk-VHUYNUT7.js → shell/chunks/chunk-DU4S5MUI.js} +1 -1
  56. package/dist/bin/shell/chunks/{chunk-SXB55JOI.js → chunk-EONWONZV.js} +1 -1
  57. package/dist/bin/shell/chunks/chunk-HC7WB764.js +2 -0
  58. package/dist/bin/{chunks/chunk-SE4C7FJY.js → shell/chunks/chunk-JDNI5HBX.js} +13 -13
  59. package/dist/bin/shell/chunks/chunk-KCMUAACL.js +19 -0
  60. package/dist/bin/{chunks/chunk-XKPFI566.js → shell/chunks/chunk-L6XUBS6H.js} +17 -17
  61. package/dist/bin/{chunks/chunk-B3RU2PUI.js → shell/chunks/chunk-LTL632J4.js} +2 -2
  62. package/dist/bin/shell/chunks/chunk-NTW6IA45.js +2 -0
  63. package/dist/bin/{chunks/chunk-A3HQTYHR.js → shell/chunks/chunk-OXHVTSNH.js} +1 -1
  64. package/dist/bin/{chunks/chunk-RMQC3GS7.js → shell/chunks/chunk-PNI5NMXP.js} +1 -1
  65. package/dist/bin/{chunks/chunk-YFPDB4PH.js → shell/chunks/chunk-RA3TG4UK.js} +1 -1
  66. package/dist/bin/shell/chunks/{chunk-GZHFXDDO.js → chunk-RBQGQWGV.js} +1 -1
  67. package/dist/bin/shell/chunks/{chunk-THNL3XFF.js → chunk-S3QAKT3R.js} +1 -1
  68. package/dist/bin/shell/chunks/{chunk-G43H2WGH.js → chunk-TTNNO45C.js} +1 -1
  69. package/dist/bin/shell/chunks/chunk-UFJFAFSS.js +28 -0
  70. package/dist/bin/shell/chunks/chunk-WLBA7L7U.js +23 -0
  71. package/dist/bin/{chunks/chunk-3KAVXQP4.js → shell/chunks/chunk-XXCTETRW.js} +2 -2
  72. package/dist/bin/shell/chunks/chunk-ZUDPEMHG.js +63 -0
  73. package/dist/bin/shell/chunks/{curl-SRTMGOVV.js → curl-2DCNBIKJ.js} +8 -8
  74. package/dist/bin/shell/chunks/{diff-LE7GMFZD.js → diff-5NUI5BHG.js} +1 -1
  75. package/dist/bin/{chunks/expansion-2RO5M3QC.js → shell/chunks/expansion-QUT3FT7V.js} +1 -1
  76. package/dist/bin/{chunks/expr-4CJYC4LY.js → shell/chunks/expr-G4EF4POQ.js} +1 -1
  77. package/dist/bin/{chunks/file-D5YKS5NV.js → shell/chunks/file-MMSHRWCJ.js} +1 -1
  78. package/dist/bin/shell/chunks/find-7CVMEZBO.js +2 -0
  79. package/dist/bin/{chunks/flag-coverage-NSXW5TJP.js → shell/chunks/flag-coverage-QMWFYZRC.js} +1 -1
  80. package/dist/bin/shell/chunks/{grep-OZJTRD4D.js → grep-7BJ7HFBM.js} +1 -1
  81. package/dist/bin/shell/chunks/{html-to-markdown-WVZA3MCP.js → html-to-markdown-V6PK6S5U.js} +1 -1
  82. package/dist/bin/{chunks/jq-FIV5Q5T4.js → shell/chunks/jq-DVZM2CEN.js} +1 -1
  83. package/dist/bin/shell/chunks/{js-exec-HPXZV7UJ.js → js-exec-AKWY6BP5.js} +4 -4
  84. package/dist/bin/shell/chunks/{ls-G2PXHSNX.js → ls-WONXDVOX.js} +1 -1
  85. package/dist/bin/shell/chunks/{printf-P3QVL4IO.js → printf-NA7DYZBO.js} +1 -1
  86. package/dist/bin/shell/chunks/{python3-KFZH67GD.js → python3-RRCCYJKA.js} +1 -1
  87. package/dist/bin/shell/chunks/rg-DK6FRF6Q.js +2 -0
  88. package/dist/bin/shell/chunks/{sed-HALRQZKY.js → sed-WWXBUNG3.js} +1 -1
  89. package/dist/bin/shell/chunks/tar-GTGFEWDS.js +2 -0
  90. package/dist/bin/shell/chunks/{xan-MOZFJGMY.js → xan-3G6YA5O6.js} +1 -1
  91. package/dist/bin/shell/chunks/xan-view-6J5MMMQB.js +2 -0
  92. package/dist/bin/shell/chunks/{yq-Q47JUWL6.js → yq-CWUVVSHY.js} +1 -1
  93. package/dist/bin/shell/shell.js +94 -94
  94. package/dist/browser.d.ts +1 -0
  95. package/dist/bundle/browser.js +587 -587
  96. package/dist/bundle/chunks/{awk2-POPGKRAI.js → awk2-RRKCSTJR.js} +1 -1
  97. package/dist/bundle/chunks/{chunk-FEIOJCZD.js → chunk-43RSSTFA.js} +1 -1
  98. package/dist/bundle/chunks/{chunk-YFG2CMIF.js → chunk-5PYKJV42.js} +1 -1
  99. package/dist/bundle/chunks/{chunk-XORM457F.js → chunk-75FNCC7W.js} +72 -72
  100. package/dist/bundle/chunks/{chunk-YS3AZT3J.js → chunk-B53Y5JFV.js} +1 -1
  101. package/dist/bundle/chunks/{chunk-J642UCRS.js → chunk-BAQA74XA.js} +1 -1
  102. package/dist/bundle/chunks/{chunk-F55TLFGB.js → chunk-DBKNVD4L.js} +1 -1
  103. package/dist/bundle/chunks/{chunk-LPQPILI2.js → chunk-GJTDUJ5Q.js} +1 -1
  104. package/dist/bundle/chunks/chunk-HL6NGDO2.js +22 -0
  105. package/dist/bundle/chunks/{chunk-OARHFVLG.js → chunk-HP7NBOKN.js} +1 -1
  106. package/dist/bundle/chunks/{chunk-S4EYC6T6.js → chunk-I57KEIP3.js} +2 -2
  107. package/dist/bundle/chunks/chunk-KX3P26DQ.js +1 -0
  108. package/dist/bundle/chunks/{chunk-BBXLRYSX.js → chunk-NRZWEENR.js} +1 -1
  109. package/dist/bundle/chunks/{chunk-VLGZJRPG.js → chunk-PYDZ2LCK.js} +1 -1
  110. package/dist/bundle/chunks/chunk-R6VWJ2ZL.js +1 -0
  111. package/dist/bundle/chunks/{chunk-UNYNJIFU.js → chunk-RAFHQYLP.js} +2 -2
  112. package/dist/bundle/chunks/{chunk-YCFVLTST.js → chunk-RQ254MFG.js} +1 -1
  113. package/dist/bundle/chunks/{chunk-NYQYO467.js → chunk-U6NMAV24.js} +1 -1
  114. package/dist/bundle/chunks/{chunk-OL3S66CO.js → chunk-VBEY5J6R.js} +1 -1
  115. package/dist/bundle/chunks/chunk-XIZSGUXJ.js +62 -0
  116. package/dist/bundle/chunks/{chunk-YNYSPYQ5.js → chunk-YSHZL3MF.js} +13 -13
  117. package/dist/bundle/chunks/{curl-COE4TZE6.js → curl-47BFPSFW.js} +8 -8
  118. package/dist/bundle/chunks/{expansion-ENLSRCXJ.js → expansion-UGGADTZC.js} +1 -1
  119. package/dist/bundle/chunks/{expr-5T3UU5KE.js → expr-DNFUYZGY.js} +1 -1
  120. package/dist/bundle/chunks/{file-ZIGAJ4YS.js → file-IGDTDPLG.js} +1 -1
  121. package/dist/bundle/chunks/find-KNMMLVJD.js +1 -0
  122. package/dist/bundle/chunks/{flag-coverage-QT4N2Z44.js → flag-coverage-XLSDDMFQ.js} +1 -1
  123. package/dist/bundle/chunks/{grep-3AIAIJVR.js → grep-2UMHPO7Y.js} +1 -1
  124. package/dist/bundle/chunks/{jq-ODXZBPLY.js → jq-LCDWFF5Y.js} +1 -1
  125. package/dist/bundle/chunks/{js-exec-4CW5N6RM.js → js-exec-VXN6TZ7U.js} +4 -4
  126. package/dist/bundle/chunks/js-exec-worker.js +14 -3
  127. package/dist/bundle/chunks/{python3-SG3DOKBZ.js → python3-BFV3N3GY.js} +1 -1
  128. package/dist/bundle/chunks/rg-KYSTAD4Q.js +1 -0
  129. package/dist/bundle/chunks/{sed-VFTTATXJ.js → sed-OFX3F4FE.js} +1 -1
  130. package/dist/bundle/chunks/tar-LYLTEJV3.js +1 -0
  131. package/dist/bundle/chunks/worker.js +21 -2
  132. package/dist/bundle/chunks/{xan-BXDXYEIB.js → xan-EY6QWK2V.js} +1 -1
  133. package/dist/bundle/chunks/xan-view-OW2TB7Z3.js +1 -0
  134. package/dist/bundle/chunks/{yq-MJMAR36V.js → yq-M7NFNNED.js} +1 -1
  135. package/dist/bundle/index.cjs +773 -773
  136. package/dist/bundle/index.js +166 -166
  137. package/dist/commands/js-exec/{worker.d.ts → js-exec-worker.d.ts} +2 -2
  138. package/dist/commands/worker-bridge/sync-backend.d.ts +1 -0
  139. package/dist/network/types.d.ts +2 -1
  140. package/package.json +7 -9
  141. package/dist/bin/chunks/chunk-MXVNCVD6.js +0 -30
  142. package/dist/bin/chunks/chunk-MY5PY2PL.js +0 -2
  143. package/dist/bin/chunks/chunk-N5OTVT4F.js +0 -23
  144. package/dist/bin/chunks/chunk-P6GNZPVW.js +0 -19
  145. package/dist/bin/chunks/chunk-VRUXUVWB.js +0 -63
  146. package/dist/bin/chunks/find-GAYRV4IF.js +0 -2
  147. package/dist/bin/chunks/rg-C6KMBFNG.js +0 -2
  148. package/dist/bin/chunks/tar-DNUNEW4Z.js +0 -2
  149. package/dist/bin/chunks/xan-view-5SZBYPLG.js +0 -2
  150. package/dist/bin/shell/chunks/chunk-D64U2VGQ.js +0 -2
  151. package/dist/bin/shell/chunks/chunk-MXVNCVD6.js +0 -30
  152. package/dist/bin/shell/chunks/chunk-N5OTVT4F.js +0 -23
  153. package/dist/bin/shell/chunks/chunk-P6GNZPVW.js +0 -19
  154. package/dist/bin/shell/chunks/chunk-VRUXUVWB.js +0 -63
  155. package/dist/bin/shell/chunks/find-GAYRV4IF.js +0 -2
  156. package/dist/bin/shell/chunks/rg-C6KMBFNG.js +0 -2
  157. package/dist/bin/shell/chunks/tar-DNUNEW4Z.js +0 -2
  158. package/dist/bin/shell/chunks/xan-view-5SZBYPLG.js +0 -2
  159. package/dist/bundle/chunks/chunk-BRGMQKJV.js +0 -62
  160. package/dist/bundle/chunks/chunk-CR5AFCPT.js +0 -22
  161. package/dist/bundle/chunks/chunk-XHM67O4N.js +0 -1
  162. package/dist/bundle/chunks/find-TPUOAIUQ.js +0 -1
  163. package/dist/bundle/chunks/rg-FOQSCCX3.js +0 -1
  164. package/dist/bundle/chunks/tar-ANUBEFJY.js +0 -1
  165. package/dist/bundle/chunks/xan-view-ECQUO7AJ.js +0 -1
  166. /package/dist/bin/chunks/{chunk-QSDVMMYI.js → chunk-4CFAYBLV.js} +0 -0
  167. /package/dist/bin/chunks/{chunk-ND23BJUM.js → chunk-LCDPWJBA.js} +0 -0
  168. /package/dist/bin/shell/chunks/{chunk-QSDVMMYI.js → chunk-4CFAYBLV.js} +0 -0
  169. /package/dist/bin/shell/chunks/{chunk-ND23BJUM.js → chunk-LCDPWJBA.js} +0 -0
  170. /package/dist/bundle/chunks/{chunk-SYMJJMQ4.js → chunk-PXTK5WE2.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{a as x}from"./chunk-J642UCRS.js";import{a as q,b as Z}from"./chunk-VLGZJRPG.js";import{a as _,b as X,c as G}from"./chunk-74CEPOFO.js";var se={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},j={name:"grep",async execute(t,s){if(X(t))return _(se);let l=!1,f=!1,c=!1,p=!1,m=!1,a=!1,n=!1,u=!1,y=!1,w=!1,h=!1,d=!1,v=!1,P=!1,B=!1,$=0,T=0,C=0,W=[],A=[],L=[],R=null,I=[];for(let r=0;r<t.length;r++){let i=t[r];if(i.startsWith("-")&&i!=="-"){if(i==="-e"&&r+1<t.length){R=t[++r];continue}if(i.startsWith("--include=")){W.push(i.slice(10));continue}if(i.startsWith("--exclude=")){A.push(i.slice(10));continue}if(i.startsWith("--exclude-dir=")){L.push(i.slice(14));continue}if(i.startsWith("--max-count=")){$=parseInt(i.slice(12),10);continue}let b=i.match(/^-m(\d+)$/);if(b){$=parseInt(b[1],10);continue}if(i==="-m"&&r+1<t.length){$=parseInt(t[++r],10);continue}let o=i.match(/^-([ABC])(\d+)$/);if(o){let e=parseInt(o[2],10);o[1]==="A"?C=e:o[1]==="B"?T=e:o[1]==="C"&&(T=e,C=e);continue}if((i==="-A"||i==="-B"||i==="-C")&&r+1<t.length){let e=parseInt(t[++r],10);i==="-A"?C=e:i==="-B"?T=e:(T=e,C=e);continue}let g=i.startsWith("--")?[i]:i.slice(1).split("");for(let e of g)if(e==="i"||e==="--ignore-case")l=!0;else if(e==="n"||e==="--line-number")f=!0;else if(e==="v"||e==="--invert-match")c=!0;else if(e==="c"||e==="--count")p=!0;else if(e==="l"||e==="--files-with-matches")m=!0;else if(e==="L"||e==="--files-without-match")a=!0;else if(e==="r"||e==="R"||e==="--recursive")n=!0;else if(e==="w"||e==="--word-regexp")u=!0;else if(e==="x"||e==="--line-regexp")y=!0;else if(e==="E"||e==="--extended-regexp")w=!0;else if(e==="P"||e==="--perl-regexp")h=!0;else if(e==="F"||e==="--fixed-strings")d=!0;else if(e==="o"||e==="--only-matching")v=!0;else if(e==="h"||e==="--no-filename")P=!0;else if(e==="q"||e==="--quiet"||e==="--silent")B=!0;else{if(e.startsWith("--"))return G("grep",e);if(e.length===1)return G("grep",`-${e}`)}}else R===null?R=i:I.push(i)}if(R===null)return{stdout:"",stderr:`grep: missing pattern
1
+ import{a as x}from"./chunk-BAQA74XA.js";import{a as q,b as Z}from"./chunk-PYDZ2LCK.js";import{a as _,b as X,c as G}from"./chunk-74CEPOFO.js";var se={name:"grep",summary:"print lines that match patterns",usage:"grep [OPTION]... PATTERN [FILE]...",options:["-E, --extended-regexp PATTERN is an extended regular expression","-P, --perl-regexp PATTERN is a Perl regular expression","-F, --fixed-strings PATTERN is a set of newline-separated strings","-i, --ignore-case ignore case distinctions","-v, --invert-match select non-matching lines","-w, --word-regexp match only whole words","-x, --line-regexp match only whole lines","-c, --count print only a count of matching lines","-l, --files-with-matches print only names of files with matches","-L, --files-without-match print names of files with no matches","-m NUM, --max-count=NUM stop after NUM matches","-n, --line-number print line number with output lines","-h, --no-filename suppress the file name prefix on output","-o, --only-matching show only nonempty parts of lines that match","-q, --quiet, --silent suppress all normal output","-r, -R, --recursive search directories recursively","-A NUM print NUM lines of trailing context","-B NUM print NUM lines of leading context","-C NUM print NUM lines of context","-e PATTERN use PATTERN for matching"," --include=GLOB search only files matching GLOB"," --exclude=GLOB skip files matching GLOB"," --exclude-dir=DIR skip directories matching DIR"," --help display this help and exit"]},j={name:"grep",async execute(t,s){if(X(t))return _(se);let l=!1,f=!1,c=!1,p=!1,m=!1,a=!1,n=!1,u=!1,y=!1,w=!1,h=!1,d=!1,v=!1,P=!1,B=!1,$=0,T=0,C=0,W=[],A=[],L=[],R=null,I=[];for(let r=0;r<t.length;r++){let i=t[r];if(i.startsWith("-")&&i!=="-"){if(i==="-e"&&r+1<t.length){R=t[++r];continue}if(i.startsWith("--include=")){W.push(i.slice(10));continue}if(i.startsWith("--exclude=")){A.push(i.slice(10));continue}if(i.startsWith("--exclude-dir=")){L.push(i.slice(14));continue}if(i.startsWith("--max-count=")){$=parseInt(i.slice(12),10);continue}let b=i.match(/^-m(\d+)$/);if(b){$=parseInt(b[1],10);continue}if(i==="-m"&&r+1<t.length){$=parseInt(t[++r],10);continue}let o=i.match(/^-([ABC])(\d+)$/);if(o){let e=parseInt(o[2],10);o[1]==="A"?C=e:o[1]==="B"?T=e:o[1]==="C"&&(T=e,C=e);continue}if((i==="-A"||i==="-B"||i==="-C")&&r+1<t.length){let e=parseInt(t[++r],10);i==="-A"?C=e:i==="-B"?T=e:(T=e,C=e);continue}let g=i.startsWith("--")?[i]:i.slice(1).split("");for(let e of g)if(e==="i"||e==="--ignore-case")l=!0;else if(e==="n"||e==="--line-number")f=!0;else if(e==="v"||e==="--invert-match")c=!0;else if(e==="c"||e==="--count")p=!0;else if(e==="l"||e==="--files-with-matches")m=!0;else if(e==="L"||e==="--files-without-match")a=!0;else if(e==="r"||e==="R"||e==="--recursive")n=!0;else if(e==="w"||e==="--word-regexp")u=!0;else if(e==="x"||e==="--line-regexp")y=!0;else if(e==="E"||e==="--extended-regexp")w=!0;else if(e==="P"||e==="--perl-regexp")h=!0;else if(e==="F"||e==="--fixed-strings")d=!0;else if(e==="o"||e==="--only-matching")v=!0;else if(e==="h"||e==="--no-filename")P=!0;else if(e==="q"||e==="--quiet"||e==="--silent")B=!0;else{if(e.startsWith("--"))return G("grep",e);if(e.length===1)return G("grep",`-${e}`)}}else R===null?R=i:I.push(i)}if(R===null)return{stdout:"",stderr:`grep: missing pattern
2
2
  `,exitCode:2};let V=d?"fixed":w?"extended":h?"perl":"basic",O,Q;try{let r=Z(R,{mode:V,ignoreCase:l,wholeWord:u,lineRegexp:y});O=r.regex,Q=r.kResetGroup}catch{return{stdout:"",stderr:`grep: invalid regular expression: ${R}
3
3
  `,exitCode:2}}if(I.length===0&&s.stdin!==void 0){let r=q(s.stdin,O,{invertMatch:c,showLineNumbers:f,countOnly:p,filename:"",onlyMatching:v,beforeContext:T,afterContext:C,maxCount:$,kResetGroup:Q});return B?{stdout:"",stderr:"",exitCode:r.matched?0:1}:{stdout:r.output,stderr:"",exitCode:r.matched?0:1}}if(I.length===0)return{stdout:"",stderr:`grep: no input files
4
4
  `,exitCode:2};let M="",z="",S=!1,D=!1,F=[];for(let r of I)if(r.includes("*")||r.includes("?")||r.includes("[")){let i=await ne(r,s);if(n)for(let b of i){let o=await H(b.path,s,W,A,L,b.isFile);F.push(...o)}else F.push(...i)}else if(n){let i=await H(r,s,W,A,L);F.push(...i)}else F.push({path:r});let Y=(F.length>1||n)&&!P,k=50;for(let r=0;r<F.length;r+=k){let i=F.slice(r,r+k),b=await Promise.all(i.map(async o=>{let g=o.path,e=g.split("/").pop()||g;if(A.length>0&&!n&&A.some(N=>x(e,N,{stripQuotes:!0}))||W.length>0&&!n&&!W.some(N=>x(e,N,{stripQuotes:!0})))return null;try{let N=s.fs.resolvePath(s.cwd,g),U=!1;if(o.isFile===void 0?U=(await s.fs.stat(N)).isDirectory:U=!o.isFile,U)return n?null:{error:`grep: ${g}: Is a directory
@@ -1 +1 @@
1
- import{a as r}from"./chunk-YNYSPYQ5.js";var g=2048,o=new Map;function u(l,c,t){let s=typeof t=="boolean"?{ignoreCase:t}:t??{},e=c;s.stripQuotes&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));let i=s.ignoreCase?`i:${e}`:e,n=o.get(i);if(!n){if(n=a(e,s.ignoreCase),o.size>=g){let f=o.keys().next().value;f!==void 0&&o.delete(f)}o.set(i,n)}return n.test(l)}function a(l,c){let t="^";for(let s=0;s<l.length;s++){let e=l[s];if(e==="*")t+=".*";else if(e==="?")t+=".";else if(e==="["){let i=s+1;for(;i<l.length&&l[i]!=="]";)i++;t+=l.slice(s,i+1),s=i}else e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="\\"?t+=`\\${e}`:t+=e}return t+="$",r(t,c?"i":"")}export{u as a};
1
+ import{a as r}from"./chunk-YSHZL3MF.js";var g=2048,o=new Map;function u(l,c,t){let s=typeof t=="boolean"?{ignoreCase:t}:t??{},e=c;s.stripQuotes&&(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1));let i=s.ignoreCase?`i:${e}`:e,n=o.get(i);if(!n){if(n=a(e,s.ignoreCase),o.size>=g){let f=o.keys().next().value;f!==void 0&&o.delete(f)}o.set(i,n)}return n.test(l)}function a(l,c){let t="^";for(let s=0;s<l.length;s++){let e=l[s];if(e==="*")t+=".*";else if(e==="?")t+=".";else if(e==="["){let i=s+1;for(;i<l.length&&l[i]!=="]";)i++;t+=l.slice(s,i+1),s=i}else e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="\\"?t+=`\\${e}`:t+=e}return t+="$",r(t,c?"i":"")}export{u as a};
@@ -1,4 +1,4 @@
1
- import{a as v}from"./chunk-SYMJJMQ4.js";import{e as x}from"./chunk-DXB73IDG.js";var w=x(v(),1);function j(){return Object.create(null)}function S(e,o,r){e[o]=r}function C(e){let o=j();for(let r of Object.keys(e)){let s=e[r];(typeof s=="string"||typeof s=="number"||typeof s=="boolean"||s===null)&&(o[r]=s)}return o}function b(e){let o=w.default.parse(e.trim(),{header:!0,dynamicTyping:!0,skipEmptyLines:!0}),r=o.data.map(s=>C(s));return{headers:o.meta.fields||[],data:r}}function R(e,o){return o.length===0?`${e.join(",")}
1
+ import{a as v}from"./chunk-PXTK5WE2.js";import{e as x}from"./chunk-DXB73IDG.js";var w=x(v(),1);function j(){return Object.create(null)}function S(e,o,r){e[o]=r}function C(e){let o=j();for(let r of Object.keys(e)){let s=e[r];(typeof s=="string"||typeof s=="number"||typeof s=="boolean"||s===null)&&(o[r]=s)}return o}function b(e){let o=w.default.parse(e.trim(),{header:!0,dynamicTyping:!0,skipEmptyLines:!0}),r=o.data.map(s=>C(s));return{headers:o.meta.fields||[],data:r}}function R(e,o){return o.length===0?`${e.join(",")}
2
2
  `:`${w.default.unparse(o,{columns:e}).replace(/\r\n/g,`
3
3
  `)}
4
4
  `}async function g(e,o){let r=e.find(p=>!p.startsWith("-")),s;if(!r||r==="-")s=o.stdin;else try{let p=o.fs.resolvePath(o.cwd,r);s=await o.fs.readFile(p)}catch{return{headers:[],data:[],error:{stdout:"",stderr:`xan: ${r}: No such file or directory
@@ -1,4 +1,4 @@
1
- import{a as fe}from"./chunk-X2AJGDEF.js";import{a as Y}from"./chunk-J642UCRS.js";import{a as ne}from"./chunk-IPJHKYVM.js";import{a as te}from"./chunk-YNYSPYQ5.js";import{a as oe,b as pe,c as ce}from"./chunk-EEXR5ZDP.js";import{a as ie,b as le}from"./chunk-74CEPOFO.js";function k(e,t){switch(e.type){case"name":{let n=e.pattern,a=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(a){let s=a[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,a=t.relativePath,s=n.split("/");for(let i=0;i<s.length-1;i++){let r=s[i];if(r&&r!=="."&&r!==".."&&!r.includes("*")&&!r.includes("?")&&!r.includes("[")){let p=`/${r}/`;if(e.ignoreCase){if(!a.toLowerCase().includes(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!a.includes(p))return{matches:!1,pruned:!1,printed:!1}}}let o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let i=o[1];if(e.ignoreCase){if(!a.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!a.endsWith(i))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(a,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:te(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let a=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=a>e.days:e.comparison==="less"?s=a<e.days:s=Math.floor(a)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let a;return e.comparison==="more"?a=t.size>n:e.comparison==="less"?a=t.size<n:e.unit==="b"?a=Math.ceil(t.size/512)===e.value:a=t.size===n,{matches:a,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,a=e.mode&511,s;return e.matchType==="exact"?s=n===a:e.matchType==="all"?s=(n&a)===a:s=(n&a)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let n=k(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=k(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let a=k(e.right,t);return{matches:a.matches,pruned:n.pruned||a.pruned,printed:n.printed||a.printed}}case"or":{let n=k(e.left,t);if(n.matches)return n;let a=k(e.right,t);return{matches:a.matches,pruned:n.pruned||a.pruned,printed:a.printed}}}}function _(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(e.right)}}function j(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return j(e.expr);case"and":case"or":return j(e.left)||j(e.right);default:return!1}}function ue(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=Ee(e);if(Me(e)&&n.length===1){let o=n[0].split("/").filter(i=>i.length>0);if(o.length>=2)for(let i=o.length-2;i>=0;i--){let r=o[i];if(!r.includes("*")&&!r.includes("?")&&!r.includes("[")&&r!=="."&&r!==".."){let p=o[i+1];if(p&&(p.includes("*")||p.includes("?"))){t.terminalDirName=r;let l=p.match(/^\*(\.[a-zA-Z0-9]+)$/);l&&(t.requiredExtension=l[1])}break}}}return t}function Ee(e){let t=[],n=a=>{a.type==="path"?t.push(a.pattern):a.type==="not"?n(a.expr):(a.type==="and"||a.type==="or")&&(n(a.left),n(a.right))};return n(e),t}function Me(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function he(e){let t=[],n=a=>{a&&(a.type==="newer"?t.push(a.refPath):a.type==="not"?n(a.expr):(a.type==="and"||a.type==="or")&&(n(a.left),n(a.right)))};return n(e),t}function J(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return J(e.expr);case"and":case"or":return J(e.left)&&J(e.right)}}function L(e,t,n,a,s){switch(e.type){case"name":{let o=e.pattern,i=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(i){let r=i[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(r.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(r))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,i=o.split("/");for(let p=0;p<i.length-1;p++){let l=i[p];if(l&&l!=="."&&l!==".."&&!l.includes("*")&&!l.includes("?")&&!l.includes("[")){let d=`/${l}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(d.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(d))return{matches:!1,pruned:!1,printed:!1}}}let r=o.match(/\*(\.[a-zA-Z0-9]+)$/);if(r){let p=r[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(p))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(n,o,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let o=e.ignoreCase?"i":"";return{matches:te(e.pattern,o).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:a,pruned:!1,printed:!1}:e.fileType==="d"?{matches:s,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let o=L(e.expr,t,n,a,s);return{matches:!o.matches,pruned:o.pruned,printed:!1}}case"and":{let o=L(e.left,t,n,a,s);if(!o.matches)return{matches:!1,pruned:o.pruned,printed:!1};let i=L(e.right,t,n,a,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:o.printed||i.printed}}case"or":{let o=L(e.left,t,n,a,s);if(o.matches)return o;let i=L(e.right,t,n,a,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:i.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function V(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return V(e.expr);case"and":case"or":return V(e.left)||V(e.right);default:return!1}}function z(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return z(e.expr);case"and":case"or":return z(e.left)&&z(e.right)}}function de(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!z(e))return se(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:k(e,n).pruned}}function se(e,t){switch(e.type){case"or":{if(z(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(k(e.left,n).pruned)return{shouldPrune:!0}}return se(e.right,t)}case"and":{if(z(e.left)&&z(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:k(e,n).pruned}}if(z(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return k(e.left,n).matches?se(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function me(e,t){let n=[],a=[],s=t;for(;s<e.length;){let i=e[s];if(i==="("||i==="\\("){n.push({type:"lparen"}),s++;continue}if(i===")"||i==="\\)"){n.push({type:"rparen"}),s++;continue}if(i==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(i==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(i==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(i==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(i==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(i==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(i==="-type"&&s+1<e.length){let r=e[++s];if(r==="f"||r==="d")n.push({type:"expr",expr:{type:"type",fileType:r}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${r}
1
+ import{a as fe}from"./chunk-X2AJGDEF.js";import{a as Y}from"./chunk-BAQA74XA.js";import{a as ne}from"./chunk-IPJHKYVM.js";import{a as te}from"./chunk-YSHZL3MF.js";import{a as oe,b as pe,c as ce}from"./chunk-EEXR5ZDP.js";import{a as ie,b as le}from"./chunk-74CEPOFO.js";function k(e,t){switch(e.type){case"name":{let n=e.pattern,a=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(a){let s=a[1],o=t.name;if(e.ignoreCase){if(!o.toLowerCase().endsWith(s.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!o.endsWith(s))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let n=e.pattern,a=t.relativePath,s=n.split("/");for(let i=0;i<s.length-1;i++){let r=s[i];if(r&&r!=="."&&r!==".."&&!r.includes("*")&&!r.includes("?")&&!r.includes("[")){let p=`/${r}/`;if(e.ignoreCase){if(!a.toLowerCase().includes(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!a.includes(p))return{matches:!1,pruned:!1,printed:!1}}}let o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let i=o[1];if(e.ignoreCase){if(!a.toLowerCase().endsWith(i.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!a.endsWith(i))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(a,n,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let n=e.ignoreCase?"i":"";return{matches:te(e.pattern,n).test(t.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:t.isFile,pruned:!1,printed:!1}:e.fileType==="d"?{matches:t.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"empty":return{matches:t.isEmpty,pruned:!1,printed:!1};case"mtime":{let a=(Date.now()-t.mtime)/(1e3*60*60*24),s;return e.comparison==="more"?s=a>e.days:e.comparison==="less"?s=a<e.days:s=Math.floor(a)===e.days,{matches:s,pruned:!1,printed:!1}}case"newer":{let n=t.newerRefTimes.get(e.refPath);return n===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:t.mtime>n,pruned:!1,printed:!1}}case"size":{let n=e.value;switch(e.unit){case"c":n=e.value;break;case"k":n=e.value*1024;break;case"M":n=e.value*1024*1024;break;case"G":n=e.value*1024*1024*1024;break;case"b":n=e.value*512;break}let a;return e.comparison==="more"?a=t.size>n:e.comparison==="less"?a=t.size<n:e.unit==="b"?a=Math.ceil(t.size/512)===e.value:a=t.size===n,{matches:a,pruned:!1,printed:!1}}case"perm":{let n=t.mode&511,a=e.mode&511,s;return e.matchType==="exact"?s=n===a:e.matchType==="all"?s=(n&a)===a:s=(n&a)!==0,{matches:s,pruned:!1,printed:!1}}case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let n=k(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case"and":{let n=k(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let a=k(e.right,t);return{matches:a.matches,pruned:n.pruned||a.pruned,printed:n.printed||a.printed}}case"or":{let n=k(e.left,t);if(n.matches)return n;let a=k(e.right,t);return{matches:a.matches,pruned:n.pruned||a.pruned,printed:a.printed}}}}function _(e){if(!e)return!1;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!1;case"empty":case"mtime":case"newer":case"size":case"perm":return!0;case"not":return _(e.expr);case"and":case"or":return _(e.left)||_(e.right)}}function j(e){if(!e)return!1;switch(e.type){case"empty":return!0;case"not":return j(e.expr);case"and":case"or":return j(e.left)||j(e.right);default:return!1}}function ue(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=Ee(e);if(Me(e)&&n.length===1){let o=n[0].split("/").filter(i=>i.length>0);if(o.length>=2)for(let i=o.length-2;i>=0;i--){let r=o[i];if(!r.includes("*")&&!r.includes("?")&&!r.includes("[")&&r!=="."&&r!==".."){let p=o[i+1];if(p&&(p.includes("*")||p.includes("?"))){t.terminalDirName=r;let l=p.match(/^\*(\.[a-zA-Z0-9]+)$/);l&&(t.requiredExtension=l[1])}break}}}return t}function Ee(e){let t=[],n=a=>{a.type==="path"?t.push(a.pattern):a.type==="not"?n(a.expr):(a.type==="and"||a.type==="or")&&(n(a.left),n(a.right))};return n(e),t}function Me(e){let t=n=>n.type==="type"&&n.fileType==="f"?!0:n.type==="not"?t(n.expr):n.type==="and"||n.type==="or"?t(n.left)||t(n.right):!1;return t(e)}function he(e){let t=[],n=a=>{a&&(a.type==="newer"?t.push(a.refPath):a.type==="not"?n(a.expr):(a.type==="and"||a.type==="or")&&(n(a.left),n(a.right)))};return n(e),t}function J(e){if(!e)return!0;switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return J(e.expr);case"and":case"or":return J(e.left)&&J(e.right)}}function L(e,t,n,a,s){switch(e.type){case"name":{let o=e.pattern,i=o.match(/^\*(\.[a-zA-Z0-9]+)$/);if(i){let r=i[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(r.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(r))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:Y(t,o,e.ignoreCase),pruned:!1,printed:!1}}case"path":{let o=e.pattern,i=o.split("/");for(let p=0;p<i.length-1;p++){let l=i[p];if(l&&l!=="."&&l!==".."&&!l.includes("*")&&!l.includes("?")&&!l.includes("[")){let d=`/${l}/`;if(e.ignoreCase){if(!n.toLowerCase().includes(d.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.includes(d))return{matches:!1,pruned:!1,printed:!1}}}let r=o.match(/\*(\.[a-zA-Z0-9]+)$/);if(r){let p=r[1];if(e.ignoreCase){if(!n.toLowerCase().endsWith(p.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(p))return{matches:!1,pruned:!1,printed:!1}}return{matches:Y(n,o,e.ignoreCase),pruned:!1,printed:!1}}case"regex":try{let o=e.ignoreCase?"i":"";return{matches:te(e.pattern,o).test(n),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case"type":return e.fileType==="f"?{matches:a,pruned:!1,printed:!1}:e.fileType==="d"?{matches:s,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case"prune":return{matches:!0,pruned:!0,printed:!1};case"print":return{matches:!0,pruned:!1,printed:!0};case"not":{let o=L(e.expr,t,n,a,s);return{matches:!o.matches,pruned:o.pruned,printed:!1}}case"and":{let o=L(e.left,t,n,a,s);if(!o.matches)return{matches:!1,pruned:o.pruned,printed:!1};let i=L(e.right,t,n,a,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:o.printed||i.printed}}case"or":{let o=L(e.left,t,n,a,s);if(o.matches)return o;let i=L(e.right,t,n,a,s);return{matches:i.matches,pruned:o.pruned||i.pruned,printed:i.printed}}default:return{matches:!1,pruned:!1,printed:!1}}}function V(e){if(!e)return!1;switch(e.type){case"prune":return!0;case"not":return V(e.expr);case"and":case"or":return V(e.left)||V(e.right);default:return!1}}function z(e){switch(e.type){case"name":case"path":case"regex":case"type":case"prune":case"print":return!0;case"empty":case"mtime":case"newer":case"size":case"perm":return!1;case"not":return z(e.expr);case"and":case"or":return z(e.left)&&z(e.right)}}function de(e,t){if(!e||!t.isDirectory)return{shouldPrune:!1};if(!z(e))return se(e,t);let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:k(e,n).pruned}}function se(e,t){switch(e.type){case"or":{if(z(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};if(k(e.left,n).pruned)return{shouldPrune:!0}}return se(e.right,t)}case"and":{if(z(e.left)&&z(e.right)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return{shouldPrune:k(e,n).pruned}}if(z(e.left)){let n={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map};return k(e.left,n).matches?se(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1}}case"not":return{shouldPrune:!1};default:return{shouldPrune:!1}}}function me(e,t){let n=[],a=[],s=t;for(;s<e.length;){let i=e[s];if(i==="("||i==="\\("){n.push({type:"lparen"}),s++;continue}if(i===")"||i==="\\)"){n.push({type:"rparen"}),s++;continue}if(i==="-name"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s]}});else if(i==="-iname"&&s+1<e.length)n.push({type:"expr",expr:{type:"name",pattern:e[++s],ignoreCase:!0}});else if(i==="-path"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s]}});else if(i==="-ipath"&&s+1<e.length)n.push({type:"expr",expr:{type:"path",pattern:e[++s],ignoreCase:!0}});else if(i==="-regex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s]}});else if(i==="-iregex"&&s+1<e.length)n.push({type:"expr",expr:{type:"regex",pattern:e[++s],ignoreCase:!0}});else if(i==="-type"&&s+1<e.length){let r=e[++s];if(r==="f"||r==="d")n.push({type:"expr",expr:{type:"type",fileType:r}});else return{expr:null,pathIndex:s,error:`find: Unknown argument to -type: ${r}
2
2
  `,actions:[]}}else if(i==="-empty")n.push({type:"expr",expr:{type:"empty"}});else if(i==="-mtime"&&s+1<e.length){let r=e[++s],p="exact",l=r;r.startsWith("+")?(p="more",l=r.slice(1)):r.startsWith("-")&&(p="less",l=r.slice(1));let d=parseInt(l,10);Number.isNaN(d)||n.push({type:"expr",expr:{type:"mtime",days:d,comparison:p}})}else if(i==="-newer"&&s+1<e.length){let r=e[++s];n.push({type:"expr",expr:{type:"newer",refPath:r}})}else if(i==="-size"&&s+1<e.length){let r=e[++s],p="exact",l=r;r.startsWith("+")?(p="more",l=r.slice(1)):r.startsWith("-")&&(p="less",l=r.slice(1));let d=l.match(/^(\d+)([ckMGb])?$/);if(d){let O=parseInt(d[1],10),x=d[2]||"b";n.push({type:"expr",expr:{type:"size",value:O,unit:x,comparison:p}})}}else if(i==="-perm"&&s+1<e.length){let r=e[++s],p="exact",l=r;r.startsWith("-")?(p="all",l=r.slice(1)):r.startsWith("/")&&(p="any",l=r.slice(1));let d=parseInt(l,8);Number.isNaN(d)||n.push({type:"expr",expr:{type:"perm",mode:d,matchType:p}})}else if(i==="-prune")n.push({type:"expr",expr:{type:"prune"}});else if(i==="-not"||i==="!")n.push({type:"not"});else if(i==="-o"||i==="-or")n.push({type:"op",op:"or"});else if(i==="-a"||i==="-and")n.push({type:"op",op:"and"});else if(i==="-maxdepth"||i==="-mindepth")s++;else if(i!=="-depth")if(i==="-exec"){let r=[];for(s++;s<e.length&&e[s]!==";"&&e[s]!=="+";)r.push(e[s]),s++;if(s>=e.length)return{expr:null,pathIndex:s,error:"find: missing argument to `-exec'\n",actions:[]};let p=e[s]==="+";a.push({type:"exec",command:r,batchMode:p})}else if(i==="-print")n.push({type:"expr",expr:{type:"print"}}),a.push({type:"print"});else if(i==="-print0")a.push({type:"print0"});else if(i==="-printf"&&s+1<e.length){let r=e[++s];a.push({type:"printf",format:r})}else if(i==="-delete")a.push({type:"delete"});else{if(i.startsWith("-"))return{expr:null,pathIndex:s,error:`find: unknown predicate '${i}'
3
3
  `,actions:[]};if(n.length===0){s++;continue}break}s++}if(n.length===0)return{expr:null,pathIndex:s,actions:a};let o=Fe(n);return o.error?{expr:null,pathIndex:s,error:o.error,actions:a}:{expr:o.expr,pathIndex:s,actions:a}}function Fe(e){let t=0;function n(){let r=a();if(!r)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="or"){t++;let l=a();if(!l)return r;r={type:"or",left:r,right:l}}else break}return r}function a(){let r=s();if(!r)return null;for(;t<e.length;){let p=e[t];if(p.type==="op"&&p.op==="and"){t++;let l=s();if(!l)return r;r={type:"and",left:r,right:l}}else if(p.type==="expr"||p.type==="not"||p.type==="lparen"){let l=s();if(!l)return r;r={type:"and",left:r,right:l}}else break}return r}function s(){if(t<e.length&&e[t].type==="not"){t++;let r=s();return r?{type:"not",expr:r}:null}return o()}function o(){if(t>=e.length)return null;let r=e[t];if(r.type==="lparen"){t++;let p=n();return t<e.length&&e[t].type==="rparen"&&t++,p}return r.type==="expr"?(t++,r.expr):(r.type==="rparen",null)}return{expr:n()}}var ye=500;function Ie(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function xe(e,t,n){e({category:"find",name:"summary",durationMs:n,details:{readdirCalls:t.readdirCalls,readdirTimeMs:t.readdirTime,statCalls:t.statCalls,statTimeMs:t.statTime,evalCalls:t.evalCalls,evalTimeMs:t.evalTime,nodeCount:t.nodeCount,batchCount:t.batchCount,batchTimeMs:t.batchTime,earlyPrunes:t.earlyPrunes,otherTimeMs:n-t.readdirTime-t.statTime-t.evalTime-t.batchTime}})}var $e={name:"find",summary:"search for files in a directory hierarchy",usage:"find [path...] [expression]",options:["-name PATTERN file name matches shell pattern PATTERN","-iname PATTERN like -name but case insensitive","-path PATTERN file path matches shell pattern PATTERN","-ipath PATTERN like -path but case insensitive","-regex PATTERN file path matches regular expression PATTERN","-iregex PATTERN like -regex but case insensitive","-type TYPE file is of type: f (regular file), d (directory)","-empty file is empty or directory is empty","-mtime N file's data was modified N*24 hours ago","-newer FILE file was modified more recently than FILE","-size N[ckMGb] file uses N units of space (c=bytes, k=KB, M=MB, G=GB, b=512B blocks)","-perm MODE file's permission bits are exactly MODE (octal)","-perm -MODE all permission bits MODE are set","-perm /MODE any permission bits MODE are set","-maxdepth LEVELS descend at most LEVELS directories","-mindepth LEVELS do not apply tests at levels less than LEVELS","-depth process directory contents before directory itself","-prune do not descend into this directory","-not, ! negate the following expression","-a, -and logical AND (default)","-o, -or logical OR","-exec CMD {} ; execute CMD on each file ({} is replaced by filename)","-exec CMD {} + execute CMD with multiple files at once","-print print the full file name (default action)","-print0 print the full file name followed by a null character","-printf FORMAT print FORMAT with directives: %f %h %p %P %s %d %m %M %t","-delete delete found files/directories"," --help display this help and exit"]},Re=new Set(["-name","-iname","-path","-ipath","-regex","-iregex","-type","-maxdepth","-mindepth","-mtime","-newer","-size","-perm"]),je={name:"find",async execute(e,t){if(le(e))return ie($e);let n=[],a=null,s=null,o=!1,i=!1;for(let c=0;c<e.length;c++){let f=e[c];if(f==="-maxdepth"&&c+1<e.length)i=!0,a=parseInt(e[++c],10);else if(f==="-mindepth"&&c+1<e.length)i=!0,s=parseInt(e[++c],10);else if(f==="-depth")i=!0,o=!0;else if(f==="-exec")for(i=!0,c++;c<e.length&&e[c]!==";"&&e[c]!=="+";)c++;else!f.startsWith("-")&&f!==";"&&f!=="+"&&f!=="("&&f!==")"&&f!=="\\("&&f!=="\\)"&&f!=="!"?i||n.push(f):Re.has(f)?(i=!0,c++):(f.startsWith("-")||f==="("||f==="\\("||f==="!")&&(i=!0)}n.length===0&&n.push(".");let{expr:r,error:p,actions:l}=me(e,0);if(p)return{stdout:"",stderr:p,exitCode:1};let d=l.some(c=>c.type==="print"),O=l.length===0,x=[],ge=l.some(c=>c.type==="printf"),re=[],B="",q=0,we=he(r),U=new Map;for(let c of we){let f=t.fs.resolvePath(t.cwd,c);try{let u=await t.fs.stat(f);U.set(c,u.mtime?.getTime()??Date.now())}catch{}}let De=l.some(c=>{if(c.type!=="printf")return!1;let f=c.format.replace(/%%/g,"");return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(f)}),Te=_(r)||De,Ce=j(r),K=ue(r),ae=V(r),Pe=J(r),Se=typeof t.fs.readdirWithFileTypes=="function";for(let c of n){let G=function(h){let $=s===null||h.depth>=s,P=!1;if($&&r!==null){let S=Date.now(),y;if(Pe)y=L(r,h.name,h.relativePath,h.isFile,h.isDirectory);else{let m={name:h.name,relativePath:h.relativePath,isFile:h.isFile,isDirectory:h.isDirectory,isEmpty:h.isEmpty,mtime:h.stat?.mtime?.getTime()??Date.now(),size:h.stat?.size??0,mode:h.stat?.mode??420,newerRefTimes:U};y=k(r,m)}$=y.matches,P=d?y.printed:$,u.evalCalls++,u.evalTime+=Date.now()-S}else $&&(P=!0);return P?{print:!0,printfData:ge?{path:h.relativePath,name:h.name,size:h.stat?.size??0,mtime:h.stat?.mtime?.getTime()??Date.now(),mode:h.stat?.mode??420,isDirectory:h.isDirectory,depth:h.depth,startingPoint:c}:null}:{print:!1,printfData:null}};var We=G;c.length>1&&c.endsWith("/")&&(c=c.slice(0,-1));let f=t.fs.resolvePath(t.cwd,c);try{await t.fs.stat(f)}catch{B+=`find: ${c}: No such file or directory
4
4
  `,q=1;continue}let u=Ie(),M=Date.now();async function N(h){let{path:b,depth:$,typeInfo:P}=h;if(u.nodeCount++,$>(a??256))return null;let v,S,y;if(P&&!Te)v=P.isFile,S=P.isDirectory;else{try{let A=Date.now();y=await t.fs.stat(b),u.statCalls++,u.statTime+=Date.now()-A}catch{return null}if(!y)return null;v=y.isFile,S=y.isDirectory}let m;b===f?m=c.split("/").pop()||c:m=b.split("/").pop()||"";let g=b===f?c:c==="."?`./${b.slice(f==="/"?f.length:f.length+1)}`:c+b.slice(f.length),T=[],C=null,w=null,D=!1;S&&ae&&!o&&(D=de(r,{name:m,relativePath:g,isFile:v,isDirectory:S}).shouldPrune,D&&u.earlyPrunes++);let F=$>=(a??256),I=K.terminalDirName!==null&&m===K.terminalDirName,Z=!F&&!I&&!D;if(S&&((Z||Ce||I)&&!D)){let A=Date.now();if(Se&&t.fs.readdirWithFileTypes){if(C=await t.fs.readdirWithFileTypes(b),w=C.map(E=>E.name),u.readdirCalls++,u.readdirTime+=Date.now()-A,Z)T=C.map((E,R)=>({path:b==="/"?`/${E.name}`:`${b}/${E.name}`,depth:$+1,typeInfo:{isFile:E.isFile,isDirectory:E.isDirectory},resultIndex:R}));else if(I){let E=K.requiredExtension;T=C.filter(R=>R.isFile&&(!E||R.name.endsWith(E))).map((R,ve)=>({path:b==="/"?`/${R.name}`:`${b}/${R.name}`,depth:$+1,typeInfo:{isFile:R.isFile,isDirectory:R.isDirectory},resultIndex:ve}))}}else w=await t.fs.readdir(b),u.readdirCalls++,u.readdirTime+=Date.now()-A,Z&&(T=w.map((E,R)=>({path:b==="/"?`/${E}`:`${b}/${E}`,depth:$+1,resultIndex:R})))}let Q=v?(y?.size??0)===0:w!==null&&w.length===0,H=D;if(!o&&r!==null&&!D&&ae){let A=Date.now(),E={name:m,relativePath:g,isFile:v,isDirectory:S,isEmpty:Q,mtime:y?.mtime?.getTime()??Date.now(),size:y?.size??0,mode:y?.mode??420,newerRefTimes:U};H=k(r,E).pruned,u.evalCalls++,u.evalTime+=Date.now()-A}return{relativePath:g,name:m,isFile:v,isDirectory:S,isEmpty:Q,stat:y,depth:$,children:H?[]:T,pruned:H}}async function be(){let h={paths:[],printfData:[]};if(o){let y=function(m){let g={paths:[],printfData:[]},T=P[m];if(!T)return g;for(let D of T.childIndices){let F=y(D);g.paths.push(...F.paths),g.printfData.push(...F.printfData)}let{print:C,printfData:w}=G(T.node);return C&&(g.paths.push(T.node.relativePath),w&&g.printfData.push(w)),g};var b=y;let P=[],v=[{item:{path:f,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],S=new Map;for(;v.length>0;){let m=Date.now(),g=v.splice(0,ye),T=await Promise.all(g.map(C=>N(C.item)));u.batchCount++,u.batchTime+=Date.now()-m;for(let C=0;C<g.length;C++){let w=T[C],D=g[C];if(!w)continue;let F=P.length;if(D.parentIndex>=0){let I=S.get(D.parentIndex)||[];I.push(F),S.set(D.parentIndex,I)}P.push({node:w,parentIndex:D.parentIndex,childIndices:[]});for(let I=0;I<w.children.length;I++)v.push({item:w.children[I],parentIndex:F,childOrderInParent:I})}}for(let[m,g]of S)m>=0&&m<P.length&&(P[m].childIndices=g);if(P.length>0){let m=y(0);h.paths.push(...m.paths),h.printfData.push(...m.printfData)}}else{let m=function(g){let T=P.get(g);T&&(h.paths.push(T.path),T.printfData&&h.printfData.push(T.printfData));let C=y.get(g);if(C)for(let w of C)m(w)};var $=m;let P=new Map,v=0,S=[{item:{path:f,depth:0,resultIndex:0},orderIndex:v++}],y=new Map;for(;S.length>0;){let g=Date.now(),T=S.splice(0,ye),C=await Promise.all(T.map(async({item:w,orderIndex:D})=>{let F=await N(w);return F?{node:F,orderIndex:D}:null}));u.batchCount++,u.batchTime+=Date.now()-g;for(let w of C){if(!w)continue;let{node:D,orderIndex:F}=w,{print:I,printfData:Z}=G(D);if(I&&P.set(F,{path:D.relativePath,printfData:Z}),D.children.length>0){let ee=[];for(let Q of D.children){let H=v++;ee.push(H),S.push({item:Q,orderIndex:H})}y.set(F,ee)}}}m(0)}return h}let X=await be();if(x.push(...X.paths),re.push(...X.printfData),t.trace){let h=Date.now()-M;xe(t.trace,u,h),t.trace({category:"find",name:"searchPath",durationMs:h,details:{path:c,resultsFound:X.paths.length}})}}let W="";if(l.length>0)for(let c of l)switch(c.type){case"print":W+=x.length>0?`${x.join(`
@@ -0,0 +1,22 @@
1
+ import{a as Ue,b as Re,c as ge}from"./chunk-74CEPOFO.js";import{a as re,c as L,e as Le}from"./chunk-DXB73IDG.js";var _e=L(ye=>{ye.read=function(i,e,t,r,n){var o,s,a=n*8-r-1,m=(1<<a)-1,f=m>>1,c=-7,p=t?n-1:0,u=t?-1:1,d=i[e+p];for(p+=u,o=d&(1<<-c)-1,d>>=-c,c+=a;c>0;o=o*256+i[e+p],p+=u,c-=8);for(s=o&(1<<-c)-1,o>>=-c,c+=r;c>0;s=s*256+i[e+p],p+=u,c-=8);if(o===0)o=1-f;else{if(o===m)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-f}return(d?-1:1)*s*Math.pow(2,o-r)};ye.write=function(i,e,t,r,n,o){var s,a,m,f=o*8-n-1,c=(1<<f)-1,p=c>>1,u=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,B=r?1:-1,k=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(m=Math.pow(2,-s))<1&&(s--,m*=2),s+p>=1?e+=u/m:e+=u*Math.pow(2,1-p),e*m>=2&&(s++,m/=2),s+p>=c?(a=0,s=c):s+p>=1?(a=(e*m-1)*Math.pow(2,n),s=s+p):(a=e*Math.pow(2,p-1)*Math.pow(2,n),s=0));n>=8;i[t+d]=a&255,d+=B,a/=256,n-=8);for(s=s<<n|a,f+=n;f>0;i[t+d]=s&255,d+=B,s/=256,f-=8);i[t+d-B]|=k*128}});var Je=L((cn,He)=>{var H=1e3,J=H*60,X=J*60,$=X*24,qt=$*7,Ht=$*365.25;He.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return Jt(i);if(t==="number"&&isFinite(i))return e.long?Qt(i):Xt(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Jt(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*Ht;case"weeks":case"week":case"w":return t*qt;case"days":case"day":case"d":return t*$;case"hours":case"hour":case"hrs":case"hr":case"h":return t*X;case"minutes":case"minute":case"mins":case"min":case"m":return t*J;case"seconds":case"second":case"secs":case"sec":case"s":return t*H;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Xt(i){var e=Math.abs(i);return e>=$?Math.round(i/$)+"d":e>=X?Math.round(i/X)+"h":e>=J?Math.round(i/J)+"m":e>=H?Math.round(i/H)+"s":i+"ms"}function Qt(i){var e=Math.abs(i);return e>=$?fe(i,e,$,"day"):e>=X?fe(i,e,X,"hour"):e>=J?fe(i,e,J,"minute"):e>=H?fe(i,e,H,"second"):i+" ms"}function fe(i,e,t,r){var n=e>=t*1.5;return Math.round(i/t)+" "+r+(n?"s":"")}});var Ce=L((fn,Xe)=>{function Yt(i){t.debug=t,t.default=t,t.coerce=m,t.disable=s,t.enable=n,t.enabled=a,t.humanize=Je(),t.destroy=f,Object.keys(i).forEach(c=>{t[c]=i[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let p=0;for(let u=0;u<c.length;u++)p=(p<<5)-p+c.charCodeAt(u),p|=0;return t.colors[Math.abs(p)%t.colors.length]}t.selectColor=e;function t(c){let p,u=null,d,B;function k(...E){if(!k.enabled)return;let P=k,te=Number(new Date),It=te-(p||te);P.diff=It,P.prev=p,P.curr=te,p=te,E[0]=t.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let ie=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(he,Bt)=>{if(he==="%%")return"%";ie++;let Me=t.formatters[Bt];if(typeof Me=="function"){let Dt=E[ie];he=Me.call(P,Dt),E.splice(ie,1),ie--}return he}),t.formatArgs.call(P,E),(P.log||t.log).apply(P,E)}return k.namespace=c,k.useColors=t.useColors(),k.color=t.selectColor(c),k.extend=r,k.destroy=t.destroy,Object.defineProperty(k,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(d!==t.namespaces&&(d=t.namespaces,B=t.enabled(c)),B),set:E=>{u=E}}),typeof t.init=="function"&&t.init(k),k}function r(c,p){let u=t(this.namespace+(typeof p>"u"?":":p)+c);return u.log=this.log,u}function n(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let p=(typeof c=="string"?c:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let u of p)u[0]==="-"?t.skips.push(u.slice(1)):t.names.push(u)}function o(c,p){let u=0,d=0,B=-1,k=0;for(;u<c.length;)if(d<p.length&&(p[d]===c[u]||p[d]==="*"))p[d]==="*"?(B=d,k=u,d++):(u++,d++);else if(B!==-1)d=B+1,k++,u=k;else return!1;for(;d<p.length&&p[d]==="*";)d++;return d===p.length}function s(){let c=[...t.names,...t.skips.map(p=>"-"+p)].join(",");return t.enable(""),c}function a(c){for(let p of t.skips)if(o(c,p))return!1;for(let p of t.names)if(o(c,p))return!0;return!1}function m(c){return c instanceof Error?c.stack||c.message:c}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Xe.exports=Yt});var Qe=L((F,pe)=>{F.formatArgs=ei;F.save=ti;F.load=ii;F.useColors=Kt;F.storage=ri();F.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();F.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Kt(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ei(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+pe.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),i.splice(r,0,e)}F.log=console.debug||console.log||(()=>{});function ti(i){try{i?F.storage.setItem("debug",i):F.storage.removeItem("debug")}catch{}}function ii(){let i;try{i=F.storage.getItem("debug")||F.storage.getItem("DEBUG")}catch{}return!i&&typeof process<"u"&&"env"in process&&(i=process.env.DEBUG),i}function ri(){try{return localStorage}catch{}}pe.exports=Ce()(F);var{formatters:ni}=pe.exports;ni.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Ke=L((pn,Ye)=>{"use strict";Ye.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),n=e.indexOf("--");return r!==-1&&(n===-1||r<n)}});var it=L((mn,tt)=>{"use strict";var oi=re("os"),et=re("tty"),T=Ke(),{env:w}=process,U;T("no-color")||T("no-colors")||T("color=false")||T("color=never")?U=0:(T("color")||T("colors")||T("color=true")||T("color=always"))&&(U=1);"FORCE_COLOR"in w&&(w.FORCE_COLOR==="true"?U=1:w.FORCE_COLOR==="false"?U=0:U=w.FORCE_COLOR.length===0?1:Math.min(parseInt(w.FORCE_COLOR,10),3));function Se(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function Fe(i,e){if(U===0)return 0;if(T("color=16m")||T("color=full")||T("color=truecolor"))return 3;if(T("color=256"))return 2;if(i&&!e&&U===void 0)return 0;let t=U||0;if(w.TERM==="dumb")return t;if(process.platform==="win32"){let r=oi.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in w)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in w)||w.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in w)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(w.TEAMCITY_VERSION)?1:0;if(w.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in w){let r=parseInt((w.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(w.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(w.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(w.TERM)||"COLORTERM"in w?1:t}function si(i){let e=Fe(i,i&&i.isTTY);return Se(e)}tt.exports={supportsColor:si,stdout:Se(Fe(!0,et.isatty(1))),stderr:Se(Fe(!0,et.isatty(2)))}});var nt=L((y,ue)=>{var ai=re("tty"),me=re("util");y.init=di;y.log=mi;y.formatArgs=fi;y.save=ui;y.load=li;y.useColors=ci;y.destroy=me.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");y.colors=[6,2,3,4,5,1];try{let i=it();i&&(i.stderr||i).level>=2&&(y.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}y.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(n,o)=>o.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function ci(){return"colors"in y.inspectOpts?!!y.inspectOpts.colors:ai.isatty(process.stderr.fd)}function fi(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),o=` ${n};1m${e} \x1B[0m`;i[0]=o+i[0].split(`
2
+ `).join(`
3
+ `+o),i.push(n+"m+"+ue.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=pi()+e+" "+i[0]}function pi(){return y.inspectOpts.hideDate?"":new Date().toISOString()+" "}function mi(...i){return process.stderr.write(me.formatWithOptions(y.inspectOpts,...i)+`
4
+ `)}function ui(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function li(){return process.env.DEBUG}function di(i){i.inspectOpts={};let e=Object.keys(y.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=y.inspectOpts[e[t]]}ue.exports=Ce()(y);var{formatters:rt}=ue.exports;rt.o=function(i){return this.inspectOpts.colors=this.useColors,me.inspect(i,this.inspectOpts).split(`
5
+ `).map(e=>e.trim()).join(" ")};rt.O=function(i){return this.inspectOpts.colors=this.useColors,me.inspect(i,this.inspectOpts)}});var ot=L((un,Ee)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ee.exports=Qe():Ee.exports=nt()});var Ot="End-Of-Stream",l=class extends Error{constructor(){super(Ot),this.name="EndOfStreamError"}},N=class extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}};var j=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){let r=await this.read(e,t);return this.peekQueue.push(e.subarray(0,r)),r}async read(e,t=!1){if(e.length===0)return 0;let r=this.readFromPeekBuffer(e);if(this.endOfStream||(r+=await this.readRemainderFromStream(e.subarray(r),t)),r===0&&!t)throw new l;return r}readFromPeekBuffer(e){let t=e.length,r=0;for(;this.peekQueue.length>0&&t>0;){let n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");let o=Math.min(n.length,t);e.set(n.subarray(0,o),r),r+=o,t-=o,o<n.length&&this.peekQueue.push(n.subarray(o))}return r}async readRemainderFromStream(e,t){let r=0;for(;r<e.length&&!this.endOfStream;){if(this.interrupted)throw new N;let n=await this.readFromStream(e.subarray(r),t);if(n===0)break;r+=n}if(!t&&r<e.length)throw new l;return r}};var ne=class extends j{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}};var Q=class extends ne{async readFromStream(e,t){if(e.length===0)return 0;let r=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return r.done&&(this.endOfStream=r.done),r.value?(e.set(r.value),r.value.length):0}};var Z=class extends j{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){let r=Math.min(t.length,e.length);return e.set(t.subarray(0,r)),r<t.length?this.buffer=t.subarray(r):this.buffer=null,r}async readFromStream(e,t){if(e.length===0)return 0;let r=0;for(this.buffer&&(r+=this.writeChunk(e,this.buffer));r<e.length&&!this.endOfStream;){let n=await this.reader.read();if(n.done){this.endOfStream=!0;break}n.value&&(r+=this.writeChunk(e.subarray(r),n.value))}if(!t&&r===0&&this.endOfStream)throw new l;return r}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}};function we(i){try{let e=i.getReader({mode:"byob"});return e instanceof ReadableStreamDefaultReader?new Z(e):new Q(e)}catch(e){if(e instanceof TypeError)return new Z(i.getReader());throw e}}var A=class{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e?.onClose,e?.abortSignal&&e.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.readBuffer(r,{position:t})<e.len)throw new l;return e.get(r,0)}async peekToken(e,t=this.position){let r=new Uint8Array(e.len);if(await this.peekBuffer(r,{position:t})<e.len)throw new l;return e.get(r,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new l;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new l;return e.get(this.numBuffer,0)}async ignore(e){if(e<0)throw new RangeError("ignore length must be \u2265 0 bytes");if(this.fileInfo.size!==void 0){let t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&t.position!==void 0&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...t}}abort(){return Promise.resolve()}};var Mt=256e3,oe=class extends A{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=t?.fileInfo??{}}async readBuffer(e,t){let r=this.normalizeOptions(e,t),n=r.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(e,t);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(r.length===0)return 0;let o=await this.streamReader.read(e.subarray(0,r.length),r.mayBeLess);if(this.position+=o,(!t||!t.mayBeLess)&&o<r.length)throw new l;return o}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=0;if(r.position){let o=r.position-this.position;if(o>0){let s=new Uint8Array(r.length+o);return n=await this.peekBuffer(s,{mayBeLess:r.mayBeLess}),e.set(s.subarray(o)),n-o}if(o<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{n=await this.streamReader.peek(e.subarray(0,r.length),r.mayBeLess)}catch(o){if(t?.mayBeLess&&o instanceof l)return 0;throw o}if(!r.mayBeLess&&n<r.length)throw new l}return n}async ignore(e){if(e<0)throw new RangeError("ignore length must be \u2265 0 bytes");let t=Math.min(Mt,e),r=new Uint8Array(t),n=0;for(;n<e;){let o=e-n,s=await this.readBuffer(r,{length:Math.min(t,o)});if(s<0)return s;n+=s}return n}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}};var se=class extends A{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo={...t?.fileInfo??{},size:e.length}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.uint8Array.length-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new l;return e.set(this.uint8Array.subarray(r.position,r.position+n)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};var ae=class extends A{constructor(e,t){super(t),this.blob=e,this.fileInfo={...t?.fileInfo??{},size:e.size,mimeType:e.type}}async readBuffer(e,t){t?.position&&(this.position=t.position);let r=await this.peekBuffer(e,t);return this.position+=r,r}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=Math.min(this.blob.size-r.position,r.length);if(!r.mayBeLess&&n<r.length)throw new l;let o=await this.blob.slice(r.position,r.position+n).arrayBuffer();return e.set(new Uint8Array(o)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};function Pe(i,e){let t=we(i),r=e??{},n=r.onClose;return r.onClose=async()=>{if(await t.close(),n)return n()},new oe(t,r)}function Ne(i,e){return new se(i,e)}function je(i,e){return new ae(i,e)}import{open as Ut}from"node:fs/promises";var V=class i extends A{static async fromFile(e){let t=await Ut(e,"r"),r=await t.stat();return new i(t,{fileInfo:{path:e,size:r.size}})}constructor(e,t){super(t),this.fileHandle=e,this.fileInfo=t.fileInfo}async readBuffer(e,t){let r=this.normalizeOptions(e,t);if(this.position=r.position,r.length===0)return 0;let n=await this.fileHandle.read(e,0,r.length,r.position);if(this.position+=n.bytesRead,n.bytesRead<r.length&&(!t||!t.mayBeLess))throw new l;return n.bytesRead}async peekBuffer(e,t){let r=this.normalizeOptions(e,t),n=await this.fileHandle.read(e,0,r.length,r.position);if(!r.mayBeLess&&n.bytesRead<r.length)throw new l;return n.bytesRead}async close(){return await this.fileHandle.close(),super.close()}setPosition(e){this.position=e}supportsRandomAccess(){return!0}};var tn=V.fromFile;var Ge=Le(_e(),1);var $e={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},Pt={};for(let[i,e]of Object.entries($e))Pt[e]=Number.parseInt(i,10);var ce;function Nt(){if(!(typeof globalThis.TextDecoder>"u"))return ce??(ce=new globalThis.TextDecoder("utf-8"))}var q=32*1024,I=65533;function We(i,e="utf-8"){switch(e.toLowerCase()){case"utf-8":case"utf8":{let t=Nt();return t?t.decode(i):_t(i)}case"utf-16le":return $t(i);case"us-ascii":case"ascii":return Wt(i);case"latin1":case"iso-8859-1":return Gt(i);case"windows-1252":return Zt(i);default:throw new RangeError(`Encoding '${e}' not supported`)}}function ke(i,e){e.length!==0&&(i.push(String.fromCharCode.apply(null,e)),e.length=0)}function g(i,e,t){e.push(t),e.length>=q&&ke(i,e)}function jt(i,e,t){if(t<=65535){g(i,e,t);return}t-=65536,g(i,e,55296+(t>>10)),g(i,e,56320+(t&1023))}function _t(i){let e=[],t=[],r=0;for(i.length>=3&&i[0]===239&&i[1]===187&&i[2]===191&&(r=3);r<i.length;){let n=i[r];if(n<=127){g(e,t,n),r++;continue}if(n<194||n>244){g(e,t,I),r++;continue}if(n<=223){if(r+1>=i.length){g(e,t,I),r++;continue}let c=i[r+1];if((c&192)!==128){g(e,t,I),r++;continue}let p=(n&31)<<6|c&63;g(e,t,p),r+=2;continue}if(n<=239){if(r+2>=i.length){g(e,t,I),r++;continue}let c=i[r+1],p=i[r+2];if(!((c&192)===128&&(p&192)===128&&!(n===224&&c<160)&&!(n===237&&c>=160))){g(e,t,I),r++;continue}let d=(n&15)<<12|(c&63)<<6|p&63;g(e,t,d),r+=3;continue}if(r+3>=i.length){g(e,t,I),r++;continue}let o=i[r+1],s=i[r+2],a=i[r+3];if(!((o&192)===128&&(s&192)===128&&(a&192)===128&&!(n===240&&o<144)&&!(n===244&&o>143))){g(e,t,I),r++;continue}let f=(n&7)<<18|(o&63)<<12|(s&63)<<6|a&63;jt(e,t,f),r+=4}return ke(e,t),e.join("")}function $t(i){let e=[],t=[],r=i.length,n=0;for(;n+1<r;){let o=i[n]|i[n+1]<<8;if(n+=2,o>=55296&&o<=56319){if(n+1<r){let s=i[n]|i[n+1]<<8;s>=56320&&s<=57343?(g(e,t,o),g(e,t,s),n+=2):g(e,t,I)}else g(e,t,I);continue}if(o>=56320&&o<=57343){g(e,t,I);continue}g(e,t,o)}return n<r&&g(e,t,I),ke(e,t),e.join("")}function Wt(i){let e=[];for(let t=0;t<i.length;t+=q){let r=Math.min(i.length,t+q),n=new Array(r-t);for(let o=t,s=0;o<r;o++,s++)n[s]=i[o]&127;e.push(String.fromCharCode.apply(null,n))}return e.join("")}function Gt(i){let e=[];for(let t=0;t<i.length;t+=q){let r=Math.min(i.length,t+q),n=new Array(r-t);for(let o=t,s=0;o<r;o++,s++)n[s]=i[o];e.push(String.fromCharCode.apply(null,n))}return e.join("")}function Zt(i){let e=[],t="";for(let r=0;r<i.length;r++){let n=i[r],o=n>=128&&n<=159?$e[n]:void 0;t+=o??String.fromCharCode(n),t.length>=q&&(e.push(t),t="")}return t&&e.push(t),e.join("")}function C(i){return new DataView(i.buffer,i.byteOffset)}var Ze={len:1,get(i,e){return C(i).getUint8(e)},put(i,e,t){return C(i).setUint8(e,t),e+1}},h={len:2,get(i,e){return C(i).getUint16(e,!0)},put(i,e,t){return C(i).setUint16(e,t,!0),e+2}},_={len:2,get(i,e){return C(i).getUint16(e)},put(i,e,t){return C(i).setUint16(e,t),e+2}};var x={len:4,get(i,e){return C(i).getUint32(e,!0)},put(i,e,t){return C(i).setUint32(e,t,!0),e+4}},be={len:4,get(i,e){return C(i).getUint32(e)},put(i,e,t){return C(i).setUint32(e,t),e+4}};var Ve={len:4,get(i,e){return C(i).getInt32(e)},put(i,e,t){return C(i).setInt32(e,t),e+4}};var qe={len:8,get(i,e){return C(i).getBigUint64(e,!0)},put(i,e,t){return C(i).setBigUint64(e,t,!0),e+8}};var S=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t=0){let r=e.subarray(t,t+this.len);return We(r,this.encoding)}};var ft=Le(ot(),1);var W={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Te={get(i){return{signature:x.get(i,0),compressedSize:x.get(i,8),uncompressedSize:x.get(i,12)}},len:16},st={get(i){let e=h.get(i,6);return{signature:x.get(i,0),minVersion:h.get(i,4),dataDescriptor:!!(e&8),compressedMethod:h.get(i,8),compressedSize:x.get(i,18),uncompressedSize:x.get(i,22),filenameLength:h.get(i,26),extraFieldLength:h.get(i,28),filename:null}},len:30},at={get(i){return{signature:x.get(i,0),nrOfThisDisk:h.get(i,4),nrOfThisDiskWithTheStart:h.get(i,6),nrOfEntriesOnThisDisk:h.get(i,8),nrOfEntriesOfSize:h.get(i,10),sizeOfCd:x.get(i,12),offsetOfStartOfCd:x.get(i,16),zipFileCommentLength:h.get(i,20)}},len:22},ct={get(i){let e=h.get(i,8);return{signature:x.get(i,0),minVersion:h.get(i,6),dataDescriptor:!!(e&8),compressedMethod:h.get(i,10),compressedSize:x.get(i,20),uncompressedSize:x.get(i,24),filenameLength:h.get(i,28),extraFieldLength:h.get(i,30),fileCommentLength:h.get(i,32),relativeOffsetOfLocalHeader:x.get(i,42),filename:null}},len:46};function pt(i){let e=new Uint8Array(x.len);return x.put(e,0,i),e}var D=(0,ft.default)("tokenizer:inflate"),ve=256*1024,xi=pt(W.DataDescriptor),le=pt(W.EndOfCentralDirectory),G=class i{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(ve)}async isZip(){return await this.peekSignature()===W.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(x)}async findEndOfCentralDirectoryLocator(){let e=this.tokenizer,t=Math.min(16*1024,e.fileInfo.size),r=this.syncBuffer.subarray(0,t);await this.tokenizer.readBuffer(r,{position:e.fileInfo.size-t});for(let n=r.length-4;n>=0;n--)if(r[n]===le[0]&&r[n+1]===le[1]&&r[n+2]===le[2]&&r[n+3]===le[3])return e.fileInfo.size-t+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){D("Cannot reading central-directory without random-read support");return}D("Reading central-directory...");let e=this.tokenizer.position,t=await this.findEndOfCentralDirectoryLocator();if(t>0){D("Central-directory 32-bit signature found");let r=await this.tokenizer.readToken(at,t),n=[];this.tokenizer.setPosition(r.offsetOfStartOfCd);for(let o=0;o<r.nrOfEntriesOfSize;++o){let s=await this.tokenizer.readToken(ct);if(s.signature!==W.CentralFileHeader)throw new Error("Expected Central-File-Header signature");s.filename=await this.tokenizer.readToken(new S(s.filenameLength,"utf-8")),await this.tokenizer.ignore(s.extraFieldLength),await this.tokenizer.ignore(s.fileCommentLength),n.push(s),D(`Add central-directory file-entry: n=${o+1}/${n.length}: filename=${n[o].filename}`)}return this.tokenizer.setPosition(e),n}this.tokenizer.setPosition(e)}async unzip(e){let t=await this.readCentralDirectory();if(t)return this.iterateOverCentralDirectory(t,e);let r=!1;do{let n=await this.readLocalFileHeader();if(!n)break;let o=e(n);r=!!o.stop;let s;if(await this.tokenizer.ignore(n.extraFieldLength),n.dataDescriptor&&n.compressedSize===0){let a=[],m=ve;D("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let f=-1;for(;f<0&&m===ve;){m=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),f=hi(this.syncBuffer.subarray(0,m),xi);let c=f>=0?f:m;if(o.handler){let p=new Uint8Array(c);await this.tokenizer.readBuffer(p),a.push(p)}else await this.tokenizer.ignore(c)}D(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),o.handler&&await this.inflate(n,gi(a),o.handler)}else o.handler?(D(`Reading compressed-file-data: ${n.compressedSize} bytes`),s=new Uint8Array(n.compressedSize),await this.tokenizer.readBuffer(s),await this.inflate(n,s,o.handler)):(D(`Ignoring compressed-file-data: ${n.compressedSize} bytes`),await this.tokenizer.ignore(n.compressedSize));if(D(`Reading data-descriptor at pos=${this.tokenizer.position}`),n.dataDescriptor&&(await this.tokenizer.readToken(Te)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Te.len}`)}while(!r)}async iterateOverCentralDirectory(e,t){for(let r of e){let n=t(r);if(n.handler){this.tokenizer.setPosition(r.relativeOffsetOfLocalHeader);let o=await this.readLocalFileHeader();if(o){await this.tokenizer.ignore(o.extraFieldLength);let s=new Uint8Array(r.compressedSize);await this.tokenizer.readBuffer(s),await this.inflate(o,s,n.handler)}}if(n.stop)break}}async inflate(e,t,r){if(e.compressedMethod===0)return r(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);D(`Decompress filename=${e.filename}, compressed-size=${t.length}`);let n=await i.decompressDeflateRaw(t);return r(n)}static async decompressDeflateRaw(e){let t=new ReadableStream({start(o){o.enqueue(e),o.close()}}),r=new DecompressionStream("deflate-raw"),n=t.pipeThrough(r);try{let s=await new Response(n).arrayBuffer();return new Uint8Array(s)}catch(o){let s=o instanceof Error?`Failed to deflate ZIP entry: ${o.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(s)}}async readLocalFileHeader(){let e=await this.tokenizer.peekToken(x);if(e===W.LocalFileHeader){let t=await this.tokenizer.readToken(st);return t.filename=await this.tokenizer.readToken(new S(t.filenameLength,"utf-8")),t}if(e===W.CentralFileHeader)return!1;throw e===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}};function hi(i,e){let t=i.length,r=e.length;if(r>t)return-1;for(let n=0;n<=t-r;n++){let o=!0;for(let s=0;s<r;s++)if(i[n+s]!==e[s]){o=!1;break}if(o)return n}return-1}function gi(i){let e=i.reduce((n,o)=>n+o.length,0),t=new Uint8Array(e),r=0;for(let n of i)t.set(n,r),r+=n.length;return t}var Y=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(t){let r=new Uint8Array(1024),n=await e.readBuffer(r,{mayBeLess:!0});if(n===0){t.close();return}t.enqueue(r.subarray(0,n))}}).pipeThrough(new DecompressionStream("gzip"))}};var Cn={utf8:new globalThis.TextDecoder("utf8")};var Sn=new globalThis.TextEncoder;var Fn=Array.from({length:256},(i,e)=>e.toString(16).padStart(2,"0"));function Ae(i){let{byteLength:e}=i;if(e===6)return i.getUint16(0)*2**32+i.getUint32(2);if(e===5)return i.getUint8(0)*2**32+i.getUint32(1);if(e===4)return i.getUint32(0);if(e===3)return i.getUint8(0)*2**16+i.getUint16(1);if(e===2)return i.getUint16(0);if(e===1)return i.getUint8(0)}function mt(i,e){if(e==="utf-16le"){let t=[];for(let r=0;r<i.length;r++){let n=i.charCodeAt(r);t.push(n&255,n>>8&255)}return t}if(e==="utf-16be"){let t=[];for(let r=0;r<i.length;r++){let n=i.charCodeAt(r);t.push(n>>8&255,n&255)}return t}return[...i].map(t=>t.charCodeAt(0))}function ut(i,e=0){let t=Number.parseInt(new S(6).get(i,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(t))return!1;let r=256;for(let n=e;n<e+148;n++)r+=i[n];for(let n=e+156;n<e+512;n++)r+=i[n];return t===r}var lt={get:(i,e)=>i[e+3]&127|i[e+2]<<7|i[e+1]<<14|i[e]<<21,len:4};var dt=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat"],xt=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data"];var K=4100,wi=K-2,z=1024*1024,ht=1024,yi=2**31-1,v=16*1024*1024,xe=z,gt=z,ki=v,bi=1,wt=100,Ie=v,yt=64,kt=xe,Ci=256,Si=512,Fi=v,Ei=512,Ti=512,bt=256,Ct=xe,St=xe,vi=xe,Ft=v,Ai=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),Ii=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],Bi=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]),M=class extends Error{};function Di(i){let e=i?.streamReader;if(e?.constructor?.name!=="WebStreamByobReader")return i;let{reader:t}=e,r=async()=>{await t.cancel(),t.releaseLock()};return e.close=r,e.abort=async()=>{e.interrupted=!0,await r()},i}function Oe(i,e,t){if(!Number.isFinite(i)||i<0||i>e)throw new M(`${t} has invalid size ${i} (maximum ${e} bytes)`);return i}async function R(i,e,{maximumLength:t=v,reason:r="skip"}={}){let n=Oe(e,t,r);await i.ignore(n)}async function Be(i,e,t,{maximumLength:r=e.length,reason:n="read"}={}){let o=t?.length??e.length,s=Oe(o,r,n);return i.readBuffer(e,{...t,length:s})}async function Oi(i,{maximumLength:e=z}={}){let n=new ReadableStream({start(f){f.enqueue(i),f.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),o=[],s=0;try{for(;;){let{done:f,value:c}=await n.read();if(f)break;if(s+=c.length,s>e)throw await n.cancel(),new Error(`ZIP entry decompressed data exceeds ${e} bytes`);o.push(c)}}finally{n.releaseLock()}let a=new Uint8Array(s),m=0;for(let f of o)a.set(f,m),m+=f.length;return a}var At=134695760,de=16,zi=de-1;function Mi(i,e){if(i.length<de)return-1;let t=i.length-de;for(let r=0;r<=t;r++)if(x.get(i,r)===At&&x.get(i,r+8)===e+r)return r;return-1}function Li(i){return(i.codePointAt(0)&32)!==0}function Ui(i,e){let t=new Uint8Array(e),r=0;for(let n of i)t.set(n,r),r+=n.length;return t}async function Ri(i,{shouldBuffer:e,maximumLength:t=z}={}){let{syncBuffer:r}=i,{length:n}=r,o=[],s=0;for(;;){let a=await i.tokenizer.peekBuffer(r,{mayBeLess:!0}),m=Mi(r.subarray(0,a),s),f=m>=0?0:a===n?Math.min(zi,a-1):0,c=m>=0?m:a-f;if(c===0)break;if(s+=c,s>t)throw new Error(`ZIP entry compressed data exceeds ${t} bytes`);if(e){let p=new Uint8Array(c);await i.tokenizer.readBuffer(p),o.push(p)}else await i.tokenizer.ignore(c);if(m>=0)break}if(b(i.tokenizer)||(i.knownSizeDescriptorScannedBytes+=s),!!e)return Ui(o,s)}function Pi(i,e){return b(i.tokenizer)?Math.max(0,v-(i.tokenizer.position-e)):Math.max(0,z-i.knownSizeDescriptorScannedBytes)}async function Ni(i,e,{shouldBuffer:t,maximumDescriptorLength:r=z}={}){if(e.dataDescriptor&&e.compressedSize===0)return Ri(i,{shouldBuffer:t,maximumLength:r});if(!t){await R(i.tokenizer,e.compressedSize,{maximumLength:b(i.tokenizer)?z:i.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let n=Zi(i.tokenizer);if(!Number.isFinite(e.compressedSize)||e.compressedSize<0||e.compressedSize>n)throw new Error(`ZIP entry compressed data exceeds ${n} bytes`);let o=new Uint8Array(e.compressedSize);return await i.tokenizer.readBuffer(o),o}G.prototype.inflate=async function(i,e,t){if(i.compressedMethod===0)return t(e);if(i.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${i.compressedMethod}`);let r=await Oi(e,{maximumLength:z});return t(r)};G.prototype.unzip=async function(i){let e=!1,t=0,r=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(ee(this.tokenizer,r,v))throw new M(`ZIP stream probing exceeds ${v} bytes`);let n=await this.readLocalFileHeader();if(!n)break;if(t++,t>ht)throw new Error(`ZIP entry count exceeds ${ht}`);let o=i(n);e=!!o.stop,await this.tokenizer.ignore(n.extraFieldLength);let s=await Ni(this,n,{shouldBuffer:!!o.handler,maximumDescriptorLength:Math.min(z,Pi(this,r))});if(o.handler&&await this.inflate(n,s,o.handler),n.dataDescriptor){let a=new Uint8Array(de);if(await this.tokenizer.readBuffer(a),x.get(a,0)!==At)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-a.length}`)}if(ee(this.tokenizer,r,v))throw new M(`ZIP stream probing exceeds ${v} bytes`)}while(!e)};function ji(i,e){let t=i.getReader(),r=0,n=!1,o=!1,s=async a=>{n||o||(o=!0,await t.cancel(a))};return new ReadableStream({async pull(a){if(r>=e){a.close(),await s();return}let{done:m,value:f}=await t.read();if(m||!f){n=!0,a.close();return}let c=e-r;if(f.length>c){a.enqueue(f.subarray(0,c)),r+=c,a.close(),await s();return}a.enqueue(f),r+=f.length},async cancel(a){await s(a)}})}async function ze(i,e){return new De(e).fromBuffer(i)}function Et(i){switch(i=i.toLowerCase(),i){case"application/epub+zip":return{ext:"epub",mime:i};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:i};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:i};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:i};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:i};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:i};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:i};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:i};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:i};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:i};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:i};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:i};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:i};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:i};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:i};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:i};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function O(i,e,t){t={offset:0,...t};for(let[r,n]of e.entries())if(t.mask){if(n!==(t.mask[r]&i[r+t.offset]))return!1}else if(n!==i[r+t.offset])return!1;return!0}function _i(i){return Number.isFinite(i)?Math.max(1,Math.trunc(i)):K}function $i(i,e,t){return t===void 0?i.read(e):(t.throwIfAborted(),new Promise((r,n)=>{let o=()=>{t.removeEventListener("abort",s)},s=()=>{let a=t.reason;o(),(async()=>{try{await i.cancel(a)}catch{}})(),n(a)};t.addEventListener("abort",s,{once:!0}),(async()=>{try{let a=await i.read(e);o(),r(a)}catch(a){o(),n(a)}})()}))}function Wi(i){return Number.isFinite(i)?Math.max(0,Math.min(wi,Math.trunc(i))):0}function Gi(i){return Number.isFinite(i)?Math.max(0,i):Number.MAX_SAFE_INTEGER}function b(i){let e=i.fileInfo.size;return!Number.isFinite(e)||e===Number.MAX_SAFE_INTEGER}function ee(i,e,t){return b(i)&&i.position-e>t}function Zi(i){let e=i.fileInfo.size,t=Number.isFinite(e)?Math.max(0,e-i.position):Number.MAX_SAFE_INTEGER;return Math.min(t,yi)}function Vi(i){if(i instanceof l||i instanceof M)return!0;if(!(i instanceof Error))return!1;if(Ai.has(i.message)||Bi.has(i.code))return!0;for(let e of Ii)if(i.message.startsWith(e))return!0;return!1}function Tt(i,e=z){let t=[i.compressedSize,i.uncompressedSize];for(let r of t)if(!Number.isFinite(r)||r<0||r>e)return!1;return!0}function qi(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function Hi(i,e){e.startsWith("word/")&&(i.hasWordDirectory=!0),e.startsWith("ppt/")&&(i.hasPresentationDirectory=!0),e.startsWith("xl/")&&(i.hasSpreadsheetDirectory=!0),e.startsWith("3D/")&&e.endsWith(".model")&&(i.hasThreeDimensionalModelEntry=!0)}function vt(i){if(!(!i.hasContentTypesEntry||i.hasUnparseableContentTypes||i.isParsingContentTypes||i.hasParsedContentTypesEntry)){if(i.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(i.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(i.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(i.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}}function Ji(i){let e=i.indexOf('.main+xml"');if(e===-1){let n="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return i.includes(`ContentType="${n}"`)?n:void 0}let t=i.slice(0,e),r=t.lastIndexOf('"');return t.slice(r+1)}var De=class i{constructor(e){let t=Wi(e?.mpegOffsetTolerance);this.options={...e,mpegOffsetTolerance:t},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(e){return Di(Pe(e,this.getTokenizerOptions()))}async parseTokenizer(e,t=0){this.detectionReentryCount=t;let r=e.position;for(let n of this.detectors){let o;try{o=await n.detect(e)}catch(s){if(s instanceof l||s instanceof M)return;throw s}if(o)return o;if(r!==e.position)return}}async fromTokenizer(e){try{return await this.parseTokenizer(e)}finally{await e.close()}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);let t=e instanceof Uint8Array?e:new Uint8Array(e);if(t?.length>1)return this.fromTokenizer(Ne(t,this.getTokenizerOptions()))}async fromBlob(e){this.options.signal?.throwIfAborted();let t=je(e,this.getTokenizerOptions());return this.fromTokenizer(t)}async fromStream(e){this.options.signal?.throwIfAborted();let t=this.createTokenizerFromWebStream(e);return this.fromTokenizer(t)}async toDetectionStream(e,t){let r=_i(t?.sampleSize??K),n,o,s=e.getReader({mode:"byob"});try{let{value:f,done:c}=await $i(s,new Uint8Array(r),this.options.signal);if(o=f,!c&&f)try{n=await this.fromBuffer(f.subarray(0,r))}catch(p){if(!(p instanceof l))throw p;n=void 0}o=f}finally{s.releaseLock()}let a=new TransformStream({async start(f){f.enqueue(o)},transform(f,c){c.enqueue(f)}}),m=e.pipeThrough(a);return m.fileType=n,m}async detectGzip(e){if(this.gzipProbeDepth>=bi)return{ext:"gz",mime:"application/gzip"};let t=new Y(e),r=ji(t.inflate(),ki),n=b(e),o,s,a,m;if(n){let f=new AbortController;o=setTimeout(()=>{f.abort(new DOMException(`Operation timed out after ${wt} ms`,"TimeoutError"))},wt),s=this.options.signal===void 0?f.signal:AbortSignal.any([this.options.signal,f.signal]),a=new i({...this.options,signal:s}),a.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{m=await(a??this).fromStream(r)}catch(f){if(f?.name==="AbortError"&&s?.reason?.name!=="TimeoutError")throw f}finally{clearTimeout(o),n||this.gzipProbeDepth--}return m?.ext==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(e,t){return O(this.buffer,e,t)}checkString(e,t){return this.check(mt(e,t?.encoding),t)}detectConfident=async e=>{if(this.buffer=new Uint8Array(K),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,b(e)&&(await e.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(e);if(await e.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=bt?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(e));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(e);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await R(e,6,{maximumLength:6,reason:"ID3 header prefix"});let t=await e.readToken(lt),r=b(e);if(!Number.isFinite(t)||t<0||r&&(t>Ie||e.position+t>Ie))return;if(e.position+t>e.fileInfo.size)return r?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await R(e,t,{maximumLength:r?Ie:e.fileInfo.size,reason:"ID3 payload"})}catch(n){if(n instanceof l)return;throw n}return this.detectionReentryCount>=bt?void 0:(this.detectionReentryCount++,this.parseTokenizer(e,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let t,r=qi();try{await new G(e).unzip(n=>{Hi(r,n.filename);let o=n.filename==="[Content_Types].xml",s=vt(r);if(!o&&s)return t=s,{stop:!0};switch(n.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return Tt(n,gt)?{async handler(a){let m=new TextDecoder("utf-8").decode(a).trim();t=Et(m)},stop:!0}:{};case"[Content_Types].xml":return r.hasContentTypesEntry=!0,Tt(n,gt)?(r.isParsingContentTypes=!0,{async handler(a){let m=new TextDecoder("utf-8").decode(a),f=Ji(m);f&&(t=Et(f)),r.hasParsedContentTypesEntry=!0,r.isParsingContentTypes=!1},stop:!0}):(r.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(n.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(n){if(!Vi(n))throw n;r.isParsingContentTypes&&(r.isParsingContentTypes=!1,r.hasUnparseableContentTypes=!0)}return t??vt(r)??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);let t=new Uint8Array(8);return await e.readBuffer(t),O(t,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:O(t,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:O(t,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:O(t,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:O(t,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:O(t,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let t=await this.readTiffHeader(!1);if(t)return t}if(this.check([77,77])){let t=await this.readTiffHeader(!0);if(t)return t}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function t(){let m=await e.peekNumber(Ze),f=128,c=0;for(;(m&f)===0&&f!==0;)++c,f>>=1;let p=new Uint8Array(c+1);return await Be(e,p,void 0,{maximumLength:p.length,reason:"EBML field"}),p}async function r(){let m=await t(),f=await t();f[0]^=128>>f.length-1;let c=Math.min(6,f.length),p=new DataView(m.buffer),u=new DataView(f.buffer,f.length-c,c);return{id:Ae(p),len:Ae(u)}}async function n(m){let f=0;for(;m>0;){if(f++,f>Ci||ee(e,s,v))return;let c=e.position,p=await r();if(p.id===17026){if(p.len>yt)return;let u=Oe(p.len,yt,"EBML DocType");return(await e.readToken(new S(u))).replaceAll(/\00.*$/g,"")}if(b(e)&&(!Number.isFinite(p.len)||p.len<0||p.len>kt)||(await R(e,p.len,{maximumLength:b(e)?kt:e.fileInfo.size,reason:"EBML payload"}),--m,e.position<=c))return}}let o=await r(),s=e.position;switch(await n(o.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){let t=be.get(this.buffer,4),r=_.get(this.buffer,6);if(t>0&&t<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(r>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let t=new S(4,"latin1").get(this.buffer,2);if(t.match("^d*")&&t>=1e3&&t<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await e.ignore(8),await e.readToken(new S(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
6
+ `,"\r"," "," ","\0"].some(t=>this.checkString(t,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){let t={ext:"png",mime:"image/png"},r={ext:"apng",mime:"image/apng"};await e.ignore(8);async function n(){return{length:await e.readToken(Ve),type:await e.readToken(new S(4,"latin1"))}}let o=b(e),s=e.position,a=0,m=!1;do{if(a++,a>Si||ee(e,s,Fi))break;let f=e.position,c=await n();if(c.length<0)return;if(c.type==="IHDR"){if(c.length!==13)return;m=!0}switch(c.type){case"IDAT":return t;case"acTL":return r;default:if(!m&&c.type!=="CgBI")return;if(o&&c.length>Ct)return m&&Li(c.type)?t:void 0;try{await R(e,c.length+4,{maximumLength:o?Ct+4:e.fileInfo.size,reason:"PNG chunk payload"})}catch(p){if(!o&&(p instanceof M||p instanceof l))return t;throw p}}if(e.position<=f)break}while(e.position+8<e.fileInfo.size);return t}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let t=new S(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(t){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return t.startsWith("3g")?t.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
7
+ `))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){let t=!1;try{async function r(){let a=new Uint8Array(16);return await Be(e,a,void 0,{maximumLength:a.length,reason:"ASF header GUID"}),{id:a,size:Number(await e.readToken(qe))}}await R(e,30,{maximumLength:30,reason:"ASF header prelude"});let n=b(e),o=e.position,s=0;for(;e.position+24<e.fileInfo.size&&(s++,!(s>Ei||ee(e,o,v)));){let a=e.position,m=await r(),f=m.size-24;if(!Number.isFinite(f)||f<0){t=!0;break}if(O(m.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let c=new Uint8Array(16);if(f-=await Be(e,c,void 0,{maximumLength:c.length,reason:"ASF stream type GUID"}),O(c,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(O(c,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(n&&f>St){t=!0;break}if(await R(e,f,{maximumLength:n?St:e.fileInfo.size,reason:"ASF header payload"}),e.position<=a){t=!0;break}}}catch(r){if(r instanceof l||r instanceof M)b(e)&&(t=!0);else throw r}return t?void 0:{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await e.ignore(20),await e.readToken(new S(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let t=new DataView(this.buffer.buffer).getUint32(12,!0);if(t>12&&this.buffer.length>=t+16)try{let r=new TextDecoder().decode(this.buffer.subarray(16,t+16));if(JSON.parse(r).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&ut(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let t="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:t})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:t})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
8
+ `,{offset:2,encoding:t})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async e=>{this.buffer=new Uint8Array(K);let t=Gi(e.fileInfo.size);if(await e.peekBuffer(this.buffer,{length:Math.min(8,t),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await e.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,t),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let r=0;r<=this.options.mpegOffsetTolerance;++r){let n=this.scanMpeg(r);if(n)return n}};async readTiffTag(e){let t=await this.tokenizer.readToken(e?_:h);switch(await this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(e){let t=await this.tokenizer.readToken(e?_:h);if(!(t>Ti)&&!(b(this.tokenizer)&&2+t*12>Ft))for(let r=0;r<t;++r){let n=await this.readTiffTag(e);if(n)return n}}async readTiffHeader(e){let t={ext:"tif",mime:"image/tiff"},r=(e?_:h).get(this.buffer,2),n=(e?be:x).get(this.buffer,4);if(r===42){if(n>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(n>=8){let a=(e?_:h).get(this.buffer,8),m=(e?_:h).get(this.buffer,10);if(a===28&&m===254||a===31&&m===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(b(this.tokenizer)&&n>vi)return t;let o=b(this.tokenizer)?Ft:this.tokenizer.fileInfo.size;try{await R(this.tokenizer,n,{maximumLength:o,reason:"TIFF IFD offset"})}catch(a){if(a instanceof l)return;throw a}let s;try{s=await this.readTiffIFD(e)}catch(a){if(a instanceof l)return;throw a}return s??t}if(r===43)return t}scanMpeg(e){if(this.check([255,224],{offset:e,mask:[255,224]})){if(this.check([16],{offset:e+1,mask:[22]}))return this.check([8],{offset:e+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:e+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:e+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:e+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},Xi=new Set(dt),Qi=new Set(xt);var Yi={name:"file",summary:"determine file type",usage:"file [OPTION]... FILE...",options:["-b, --brief do not prepend filenames to output","-i, --mime output MIME type strings","-L, --dereference follow symlinks"," --help display this help and exit"]},Ki=new Map([[".js",{description:"JavaScript source",mime:"text/javascript"}],[".mjs",{description:"JavaScript module",mime:"text/javascript"}],[".cjs",{description:"CommonJS module",mime:"text/javascript"}],[".ts",{description:"TypeScript source",mime:"text/typescript"}],[".tsx",{description:"TypeScript JSX source",mime:"text/typescript"}],[".jsx",{description:"JavaScript JSX source",mime:"text/javascript"}],[".py",{description:"Python script",mime:"text/x-python"}],[".rb",{description:"Ruby script",mime:"text/x-ruby"}],[".go",{description:"Go source",mime:"text/x-go"}],[".rs",{description:"Rust source",mime:"text/x-rust"}],[".c",{description:"C source",mime:"text/x-c"}],[".h",{description:"C header",mime:"text/x-c"}],[".cpp",{description:"C++ source",mime:"text/x-c++"}],[".hpp",{description:"C++ header",mime:"text/x-c++"}],[".java",{description:"Java source",mime:"text/x-java"}],[".sh",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".bash",{description:"Bourne-Again shell script",mime:"text/x-shellscript"}],[".zsh",{description:"Zsh shell script",mime:"text/x-shellscript"}],[".json",{description:"JSON data",mime:"application/json"}],[".yaml",{description:"YAML data",mime:"text/yaml"}],[".yml",{description:"YAML data",mime:"text/yaml"}],[".xml",{description:"XML document",mime:"application/xml"}],[".csv",{description:"CSV text",mime:"text/csv"}],[".toml",{description:"TOML data",mime:"text/toml"}],[".html",{description:"HTML document",mime:"text/html"}],[".htm",{description:"HTML document",mime:"text/html"}],[".css",{description:"CSS stylesheet",mime:"text/css"}],[".svg",{description:"SVG image",mime:"image/svg+xml"}],[".md",{description:"Markdown document",mime:"text/markdown"}],[".markdown",{description:"Markdown document",mime:"text/markdown"}],[".txt",{description:"ASCII text",mime:"text/plain"}],[".rst",{description:"reStructuredText",mime:"text/x-rst"}],[".env",{description:"ASCII text",mime:"text/plain"}],[".gitignore",{description:"ASCII text",mime:"text/plain"}],[".dockerignore",{description:"ASCII text",mime:"text/plain"}]]),er=new Map([["jpg","JPEG image data"],["jpeg","JPEG image data"],["png","PNG image data"],["gif","GIF image data"],["webp","WebP image data"],["bmp","PC bitmap"],["ico","MS Windows icon resource"],["tif","TIFF image data"],["tiff","TIFF image data"],["psd","Adobe Photoshop Document"],["avif","AVIF image"],["heic","HEIC image"],["heif","HEIF image"],["jxl","JPEG XL image"],["icns","Mac OS X icon"],["svg","SVG Scalable Vector Graphics image"],["pdf","PDF document"],["epub","EPUB document"],["mobi","Mobipocket E-book"],["djvu","DjVu document"],["zip","Zip archive data"],["gz","gzip compressed data"],["gzip","gzip compressed data"],["bz2","bzip2 compressed data"],["xz","XZ compressed data"],["tar","POSIX tar archive"],["rar","RAR archive data"],["7z","7-zip archive data"],["lz","lzip compressed data"],["lzma","LZMA compressed data"],["zst","Zstandard compressed data"],["cab","Microsoft Cabinet archive"],["ar","Unix ar archive"],["rpm","RPM package"],["deb","Debian binary package"],["apk","Android Package"],["dmg","Apple disk image"],["iso","ISO 9660 CD-ROM filesystem data"],["vhd","Microsoft Virtual Hard Disk"],["vhdx","Microsoft Virtual Hard Disk (new format)"],["qcow2","QEMU QCOW Image"],["mp3","Audio file with ID3"],["m4a","MPEG-4 audio"],["aac","AAC audio"],["wav","RIFF (little-endian) data, WAVE audio"],["flac","FLAC audio bitstream data"],["ogg","Ogg data"],["oga","Ogg audio"],["opus","Ogg Opus audio"],["aiff","AIFF audio"],["wma","Windows Media Audio"],["amr","AMR audio"],["mid","MIDI audio"],["midi","MIDI audio"],["ape","Monkey's Audio"],["mp4","ISO Media, MPEG-4"],["m4v","MPEG-4 video"],["webm","WebM"],["avi","RIFF (little-endian) data, AVI"],["mov","ISO Media, Apple QuickTime movie"],["mkv","Matroska data"],["wmv","Windows Media Video"],["flv","Flash Video"],["3gp","3GPP multimedia"],["3g2","3GPP2 multimedia"],["ogv","Ogg video"],["mts","MPEG transport stream"],["m2ts","MPEG transport stream"],["ts","MPEG transport stream"],["mpg","MPEG video"],["mpeg","MPEG video"],["exe","PE32 executable"],["dll","PE32 DLL"],["elf","ELF executable"],["mach","Mach-O executable"],["wasm","WebAssembly (wasm) binary module"],["dex","Android Dalvik executable"],["class","Java class file"],["swf","Adobe Flash"],["doc","Microsoft Word Document"],["docx","Microsoft Word 2007+ Document"],["xls","Microsoft Excel Spreadsheet"],["xlsx","Microsoft Excel 2007+ Spreadsheet"],["ppt","Microsoft PowerPoint Presentation"],["pptx","Microsoft PowerPoint 2007+ Presentation"],["odt","OpenDocument Text"],["ods","OpenDocument Spreadsheet"],["odp","OpenDocument Presentation"],["ttf","TrueType Font"],["otf","OpenType Font"],["woff","Web Open Font Format"],["woff2","Web Open Font Format 2"],["eot","Embedded OpenType font"],["stl","Stereolithography CAD"],["obj","Wavefront 3D Object"],["gltf","GL Transmission Format"],["glb","GL Transmission Format (binary)"],["sqlite","SQLite 3.x database"],["mdb","Microsoft Access Database"],["xml","XML document"],["json","JSON data"],["macho","Mach-O binary"],["ics","iCalendar data"],["vcf","vCard data"],["msi","Microsoft Installer"],["ps","PostScript"],["ai","Adobe Illustrator"],["indd","Adobe InDesign"],["sketch","Sketch design file"],["fig","Figma design file"],["xd","Adobe XD"],["blend","Blender"],["fbx","Autodesk FBX"],["lnk","MS Windows shortcut"],["alias","Mac OS alias"],["torrent","BitTorrent file"],["pcap","pcap capture file"],["arrow","Apache Arrow"],["parquet","Apache Parquet"]]);function tr(i,e){let t=er.get(i);if(t)return t;let[r,n]=e.split("/"),o=n?.split("+")[0]?.replace(/-/g," ")||i;switch(r){case"image":return`${o.toUpperCase()} image data`;case"audio":return`${o.toUpperCase()} audio`;case"video":return`${o.toUpperCase()} video`;case"font":return`${o} font`;case"model":return`${o} 3D model`;case"application":return n?.includes("zip")||n?.includes("compressed")?`${o} archive data`:n?.includes("executable")?`${o} executable`:`${i.toUpperCase()} data`;default:return`${i.toUpperCase()} data`}}function ir(i){let e=i.split("/").pop()||i;if(e.startsWith(".")&&!e.includes(".",1))return e;let t=e.lastIndexOf(".");return t===-1||t===0?"":e.slice(t).toLowerCase()}function rr(i,e){if(i.startsWith("#!")){let f=i.split(`
9
+ `)[0];return f.includes("python")?{description:"Python script, ASCII text executable",mime:"text/x-python"}:f.includes("node")||f.includes("bun")||f.includes("deno")?{description:"JavaScript script, ASCII text executable",mime:"text/javascript"}:f.includes("bash")?{description:"Bourne-Again shell script, ASCII text executable",mime:"text/x-shellscript"}:f.includes("sh")?{description:"POSIX shell script, ASCII text executable",mime:"text/x-shellscript"}:f.includes("ruby")?{description:"Ruby script, ASCII text executable",mime:"text/x-ruby"}:f.includes("perl")?{description:"Perl script, ASCII text executable",mime:"text/x-perl"}:{description:"script, ASCII text executable",mime:"text/plain"}}let t=i.trimStart();if(t.startsWith("<?xml"))return{description:"XML document",mime:"application/xml"};if(t.startsWith("<!DOCTYPE html")||t.toLowerCase().startsWith("<html"))return{description:"HTML document",mime:"text/html"};let r=i.includes(`\r
10
+ `),n=i.includes("\r")&&!r,o="";r?o=", with CRLF line terminators":n&&(o=", with CR line terminators");let s=ir(e),a=s?Ki.get(s):void 0;if(a)return a.mime.startsWith("text/")&&o?{description:`${a.description}${o}`,mime:a.mime}:a;let m=!1;for(let f=0;f<Math.min(i.length,8192);f++)if(i.charCodeAt(f)>127){m=!0;break}return m?{description:`UTF-8 Unicode text${o}`,mime:"text/plain; charset=utf-8"}:{description:`ASCII text${o}`,mime:"text/plain"}}async function nr(i,e){if(e.length===0)return{description:"empty",mime:"inode/x-empty"};let t=await ze(e);if(t)return{description:tr(t.ext,t.mime),mime:t.mime};let r=new TextDecoder("utf-8",{fatal:!1}).decode(e);return rr(r,i)}var _n={name:"file",async execute(i,e){if(Re(i))return Ue(Yi);let t=!1,r=!1,n=[];for(let a of i)if(a.startsWith("--")){if(a==="--brief")t=!0;else if(a==="--mime"||a==="--mime-type")r=!0;else if(a!=="--dereference")return ge("file",a)}else if(a.startsWith("-")&&a!=="-"){for(let m of a.slice(1))if(m==="b")t=!0;else if(m==="i")r=!0;else if(m!=="L")return ge("file",`-${m}`)}else n.push(a);if(n.length===0)return{stdout:"",stderr:`Usage: file [-bLi] FILE...
11
+ `,exitCode:1};let o="",s=0;for(let a of n)try{let m=e.fs.resolvePath(e.cwd,a);if((await e.fs.stat(m)).isDirectory){let d=r?"inode/directory":"directory";o+=t?`${d}
12
+ `:`${a}: ${d}
13
+ `;continue}let c=await e.fs.readFileBuffer(m),p=await nr(a,c),u=r?p.mime:p.description;o+=t?`${u}
14
+ `:`${a}: ${u}
15
+ `}catch{o+=t?`cannot open
16
+ `:`${a}: cannot open (No such file or directory)
17
+ `,s=1}return{stdout:o,stderr:"",exitCode:s}}},$n={name:"file",flags:[{flag:"-b",type:"boolean"},{flag:"-i",type:"boolean"},{flag:"-L",type:"boolean"}],needsArgs:!0};export{_n as a,$n as b};
18
+ /*! Bundled license information:
19
+
20
+ ieee754/index.js:
21
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
22
+ */
@@ -1,4 +1,4 @@
1
- import{a as de}from"./chunk-OJDRYQWQ.js";import{a as D,b as _}from"./chunk-24IMIIXA.js";import{a as x}from"./chunk-5QMZ5MUS.js";import{a as A,b as H}from"./chunk-YNYSPYQ5.js";import{k as P}from"./chunk-GFQRA5P5.js";import{a as pe,b as fe,c as re}from"./chunk-74CEPOFO.js";var Ue=1e4,Be=100,He=new H(/\s+/);function ie(e={}){let{fieldSep:t=He,maxIterations:n=Ue,maxRecursionDepth:i=Be,maxOutputSize:s=0,fs:a,cwd:o,exec:l,coverage:u,requireDefenseContext:N}=e;return{FS:" ",OFS:" ",ORS:`
1
+ import{a as de}from"./chunk-OJDRYQWQ.js";import{a as D,b as _}from"./chunk-24IMIIXA.js";import{a as x}from"./chunk-5QMZ5MUS.js";import{a as A,b as H}from"./chunk-YSHZL3MF.js";import{k as P}from"./chunk-GFQRA5P5.js";import{a as pe,b as fe,c as re}from"./chunk-74CEPOFO.js";var Ue=1e4,Be=100,He=new H(/\s+/);function ie(e={}){let{fieldSep:t=He,maxIterations:n=Ue,maxRecursionDepth:i=Be,maxOutputSize:s=0,fs:a,cwd:o,exec:l,coverage:u,requireDefenseContext:N}=e;return{FS:" ",OFS:" ",ORS:`
2
2
  `,OFMT:"%.6g",NR:0,NF:0,FNR:0,FILENAME:"",RSTART:0,RLENGTH:-1,SUBSEP:"",fields:[],line:"",vars:Object.create(null),arrays:Object.create(null),arrayAliases:new Map,ARGC:0,ARGV:Object.create(null),ENVIRON:Object.create(null),functions:new Map,fieldSep:t,maxIterations:n,maxRecursionDepth:i,maxOutputSize:s,currentRecursionDepth:0,exitCode:0,shouldExit:!1,shouldNext:!1,shouldNextFile:!1,loopBreak:!1,loopContinue:!1,hasReturn:!1,inEndBlock:!1,output:"",openedFiles:new Set,fs:a,cwd:o,exec:l,coverage:u,requireDefenseContext:N}}function Ee(e,t,n){switch(n){case"+":return e+t;case"-":return e-t;case"*":return e*t;case"/":return t!==0?e/t:0;case"%":return t!==0?e%t:0;case"^":case"**":return e**t;default:return 0}}function M(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function k(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}async function z(e,t){if(e.type==="regex")return e.pattern;let n=k(await t.evalExpr(e));return n.startsWith("/")&&n.endsWith("/")&&(n=n.slice(1,-1)),n}async function ye(e,t){return e?e.type==="variable"?e.name:e.type==="field"?`$${Math.floor(M(await t.evalExpr(e.index)))}`:"$0":"$0"}function me(e,t){if(e==="$0")return t.line;if(e.startsWith("$")){let n=parseInt(e.slice(1),10)-1;return t.fields[n]||""}return k(t.vars[e]??"")}function Se(e,t,n){if(e==="$0")n.line=t,n.fields=n.FS===" "?t.trim().split(/\s+/).filter(Boolean):n.fieldSep.split(t),n.NF=n.fields.length;else if(e.startsWith("$")){let i=parseInt(e.slice(1),10)-1;for(;n.fields.length<=i;)n.fields.push("");n.fields[i]=t,n.NF=n.fields.length,n.line=n.fields.join(n.OFS)}else n.vars[e]=t}async function $e(e,t,n){return e.length===0?t.line.length:k(await n.evalExpr(e[0])).length}async function We(e,t,n){if(e.length<2)return"";let i=k(await n.evalExpr(e[0])),s=Math.floor(M(await n.evalExpr(e[1])))-1;if(e.length>=3){let a=Math.floor(M(await n.evalExpr(e[2])));return i.substr(Math.max(0,s),a)}return i.substr(Math.max(0,s))}async function Ve(e,t,n){if(e.length<2)return 0;let i=k(await n.evalExpr(e[0])),s=k(await n.evalExpr(e[1])),a=i.indexOf(s);return a===-1?0:a+1}async function Ke(e,t,n){if(e.length<2)return 0;let i=k(await n.evalExpr(e[0])),s=e[1];if(s.type!=="variable")return 0;let a=s.name,o=t.FS;if(e.length>=3){let u=e[2];if(u.type==="regex")o=A(u.pattern);else{let N=k(await n.evalExpr(u));o=N===" "?A("\\s+"):N}}else t.FS===" "&&(o=A("\\s+"));let l=typeof o=="string"?i.split(o):o.split(i);t.arrays[a]=Object.create(null);for(let u=0;u<l.length;u++)t.arrays[a][String(u+1)]=l[u];return l.length}async function Xe(e,t,n){if(e.length<2)return 0;let i=await z(e[0],n),s=k(await n.evalExpr(e[1])),a=await ye(e[2],n),o=me(a,t);try{let u=A(i).replace(o,we(s)),N=u!==o?1:0;return Se(a,u,t),N}catch{return 0}}async function qe(e,t,n){if(e.length<2)return 0;let i=await z(e[0],n),s=k(await n.evalExpr(e[1])),a=await ye(e[2],n),o=me(a,t);try{let l=A(i,"g"),u=l.match(o),N=u?u.length:0,v=l.replace(o,we(s));return Se(a,v,t),N}catch{return 0}}function we(e){return t=>{let n="",i=0;for(;i<e.length;)if(e[i]==="\\"&&i+1<e.length){let s=e[i+1];s==="&"?(n+="&",i+=2):s==="\\"?(n+="\\",i+=2):(n+=e[i+1],i+=2)}else e[i]==="&"?(n+=t,i++):(n+=e[i],i++);return n}}async function ze(e,t,n){if(e.length<2)return t.RSTART=0,t.RLENGTH=-1,0;let i=k(await n.evalExpr(e[0])),s=await z(e[1],n);try{let o=A(s).exec(i);if(o)return t.RSTART=o.index+1,t.RLENGTH=o[0].length,t.RSTART}catch{}return t.RSTART=0,t.RLENGTH=-1,0}async function je(e,t,n){if(e.length<3)return"";let i=await z(e[0],n),s=k(await n.evalExpr(e[1])),a=k(await n.evalExpr(e[2])),o=e.length>=4?k(await n.evalExpr(e[3])):t.line;try{let l=a.toLowerCase()==="g",u=l?0:parseInt(a,10)||1;if(l)return A(i,"g").replace(o,(v,...C)=>Ne(s,v,C.slice(0,-2)));{let N=0;return A(i,"g").replace(o,(C,...O)=>(N++,N===u?Ne(s,C,O.slice(0,-2)):C))}}catch{return o}}function Ne(e,t,n){let i="",s=0;for(;s<e.length;)if(e[s]==="\\"&&s+1<e.length){let a=e[s+1];if(a==="&")i+="&",s+=2;else if(a==="0")i+=t,s+=2;else if(a>="1"&&a<="9"){let o=parseInt(a,10)-1;i+=n[o]||"",s+=2}else a==="n"?(i+=`
3
3
  `,s+=2):a==="t"?(i+=" ",s+=2):(i+=a,s+=2)}else e[s]==="&"?(i+=t,s++):(i+=e[s],s++);return i}async function Qe(e,t,n){return e.length===0?"":k(await n.evalExpr(e[0])).toLowerCase()}async function Je(e,t,n){return e.length===0?"":k(await n.evalExpr(e[0])).toUpperCase()}async function Ze(e,t,n){if(e.length===0)return"";let i=k(await n.evalExpr(e[0])),s=[];for(let a=1;a<e.length;a++)s.push(await n.evalExpr(e[a]));return j(i,s)}async function Ye(e,t,n){return e.length===0?0:Math.floor(M(await n.evalExpr(e[0])))}async function et(e,t,n){return e.length===0?0:Math.sqrt(M(await n.evalExpr(e[0])))}async function tt(e,t,n){return e.length===0?0:Math.sin(M(await n.evalExpr(e[0])))}async function nt(e,t,n){return e.length===0?0:Math.cos(M(await n.evalExpr(e[0])))}async function rt(e,t,n){let i=e.length>0?M(await n.evalExpr(e[0])):0,s=e.length>1?M(await n.evalExpr(e[1])):0;return Math.atan2(i,s)}async function it(e,t,n){return e.length===0?0:Math.log(M(await n.evalExpr(e[0])))}async function st(e,t,n){return e.length===0?1:Math.exp(M(await n.evalExpr(e[0])))}function at(e,t,n){return t.random?t.random():Math.random()}async function ot(e,t,n){let i=e.length>0?M(await n.evalExpr(e[0])):Date.now();return t.vars._srand_seed=i,i}function lt(e,t){return()=>{throw new Error(`${e}() is not supported - ${t}`)}}function se(e){return()=>{throw new Error(`function '${e}()' is not implemented`)}}var U=1e4;function j(e,t){let n=0,i="",s=0;for(;s<e.length;)if(e[s]==="%"&&s+1<e.length){let a=s+1,o="",l="",u="",N,v=a;for(;a<e.length&&/\d/.test(e[a]);)a++;a>v&&e[a]==="$"?(N=parseInt(e.substring(v,a),10)-1,a++):a=v;let C=()=>{if(a<e.length){if(a+1<e.length&&(e[a]==="h"&&e[a+1]==="h"||e[a]==="l"&&e[a+1]==="l")){a+=2;return}/[lzjh]/.test(e[a])&&a++}};for(;a<e.length&&/[-+ #0]/.test(e[a]);)o+=e[a++];if(e[a]==="*"){let d=t[n++],R=d!==void 0?Math.floor(Number(d)):0;R<0?(o+="-",l=String(Math.min(-R,U))):l=String(Math.min(R,U)),a++}else for(;a<e.length&&/\d/.test(e[a]);)l+=e[a++];if(l&&parseInt(l,10)>U&&(l=String(U)),e[a]==="."){if(a++,e[a]==="*"){let d=t[n++];u=String(Math.min(d!==void 0?Math.floor(Number(d)):0,U)),a++}else for(;a<e.length&&/\d/.test(e[a]);)u+=e[a++];u&&parseInt(u,10)>U&&(u=String(U))}C();let O=e[a],w=t[N!==void 0?N:n];switch(O){case"s":{let d=w!==void 0?String(w):"";if(u&&(d=d.substring(0,parseInt(u,10))),l){let R=parseInt(l,10);o.includes("-")?d=d.padEnd(R):d=d.padStart(R)}i+=d,N===void 0&&n++;break}case"d":case"i":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=d<0,h=Math.abs(d).toString();if(u){let F=parseInt(u,10);h=h.padStart(F,"0")}let c="";R?c="-":o.includes("+")?c="+":o.includes(" ")&&(c=" ");let E=c+h;if(l){let F=parseInt(l,10);o.includes("-")?E=E.padEnd(F):o.includes("0")&&!u?E=c+h.padStart(F-c.length,"0"):E=E.padStart(F)}i+=E,N===void 0&&n++;break}case"f":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d.toFixed(R);if(l){let c=parseInt(l,10);o.includes("-")?h=h.padEnd(c):h=h.padStart(c)}i+=h,N===void 0&&n++;break}case"e":case"E":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d.toExponential(R);if(O==="E"&&(h=h.toUpperCase()),l){let c=parseInt(l,10);o.includes("-")?h=h.padEnd(c):h=h.padStart(c)}i+=h,N===void 0&&n++;break}case"g":case"G":{let d=w!==void 0?Number(w):0;Number.isNaN(d)&&(d=0);let R=u?parseInt(u,10):6,h=d!==0?Math.floor(Math.log10(Math.abs(d))):0,c;if(d===0?c="0":h<-4||h>=R?(c=d.toExponential(R-1),O==="G"&&(c=c.toUpperCase())):c=d.toPrecision(R),c.includes(".")&&(c=c.replace(/\.?0+$/,"").replace(/\.?0+e/,"e")),c.includes("e")&&(c=c.replace(/\.?0+e/,"e")),l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"x":case"X":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=Math.abs(d).toString(16);if(O==="X"&&(R=R.toUpperCase()),u){let E=parseInt(u,10);R=R.padStart(E,"0")}let h=d<0?"-":"",c=h+R;if(l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):o.includes("0")&&!u?c=h+R.padStart(E-h.length,"0"):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"o":{let d=w!==void 0?Math.floor(Number(w)):0;Number.isNaN(d)&&(d=0);let R=Math.abs(d).toString(8);if(u){let E=parseInt(u,10);R=R.padStart(E,"0")}let h=d<0?"-":"",c=h+R;if(l){let E=parseInt(l,10);o.includes("-")?c=c.padEnd(E):o.includes("0")&&!u?c=h+R.padStart(E-h.length,"0"):c=c.padStart(E)}i+=c,N===void 0&&n++;break}case"c":{typeof w=="number"?i+=String.fromCharCode(w):i+=String(w??"").charAt(0)||"",N===void 0&&n++;break}case"%":i+="%";break;default:i+=e.substring(s,a+1)}s=a+1}else if(e[s]==="\\"&&s+1<e.length){let a=e[s+1];switch(a){case"n":i+=`
4
4
  `;break;case"t":i+=" ";break;case"r":i+="\r";break;case"\\":i+="\\";break;default:i+=a}s+=2}else i+=e[s++];return i}var Re=new Map([["length",$e],["substr",We],["index",Ve],["split",Ke],["sub",Xe],["gsub",qe],["match",ze],["gensub",je],["tolower",Qe],["toupper",Je],["sprintf",Ze],["int",Ye],["sqrt",et],["sin",tt],["cos",nt],["atan2",rt],["log",it],["exp",st],["rand",at],["srand",ot],["system",lt("system","shell execution not allowed in sandboxed environment")],["close",()=>0],["fflush",()=>0],["systime",se("systime")],["mktime",se("mktime")],["strftime",se("strftime")]]);function b(e){return typeof e=="number"?e!==0:!(e===""||e==="0")}function g(e){if(typeof e=="number")return e;let t=parseFloat(e);return Number.isNaN(t)?0:t}function S(e){return typeof e=="string"?e:(Number.isInteger(e),String(e))}function ae(e){if(typeof e=="number")return!0;let t=String(e).trim();return t===""?!1:!Number.isNaN(Number(t))}function K(e,t){try{return A(e).test(t)}catch{return!1}}function ge(e,t){return t===""?[]:e.FS===" "?t.trim().split(/\s+/).filter(Boolean):e.fieldSep.split(t)}function Q(e,t){return t===0?e.line:t<0||t>e.fields.length?"":e.fields[t-1]??""}function oe(e,t,n){if(t===0)e.line=S(n),e.fields=ge(e,e.line),e.NF=e.fields.length;else if(t>0){for(;e.fields.length<t;)e.fields.push("");e.fields[t-1]=S(n),e.NF=e.fields.length,e.line=e.fields.join(e.OFS)}}function $(e,t){e.line=t,e.fields=ge(e,t),e.NF=e.fields.length}function ve(e,t){if(e.FS=t,t===" ")e.fieldSep=new H(/\s+/);else try{e.fieldSep=A(t)}catch{e.fieldSep=A(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))}}function J(e,t){switch(t){case"FS":return e.FS;case"OFS":return e.OFS;case"ORS":return e.ORS;case"OFMT":return e.OFMT;case"NR":return e.NR;case"NF":return e.NF;case"FNR":return e.FNR;case"FILENAME":return e.FILENAME;case"RSTART":return e.RSTART;case"RLENGTH":return e.RLENGTH;case"SUBSEP":return e.SUBSEP;case"ARGC":return e.ARGC}return e.vars[t]??""}function W(e,t,n){switch(t){case"FS":ve(e,S(n));return;case"OFS":e.OFS=S(n);return;case"ORS":e.ORS=S(n);return;case"OFMT":e.OFMT=S(n);return;case"NR":e.NR=Math.floor(g(n));return;case"NF":{let i=Math.floor(g(n));if(i<e.NF)e.fields=e.fields.slice(0,i),e.line=e.fields.join(e.OFS);else if(i>e.NF){for(;e.fields.length<i;)e.fields.push("");e.line=e.fields.join(e.OFS)}e.NF=i;return}case"FNR":e.FNR=Math.floor(g(n));return;case"FILENAME":e.FILENAME=S(n);return;case"RSTART":e.RSTART=Math.floor(g(n));return;case"RLENGTH":e.RLENGTH=Math.floor(g(n));return;case"SUBSEP":e.SUBSEP=S(n);return}e.vars[t]=n}function X(e,t){let n=t,i=new Set,s=e.arrayAliases.get(n);for(;s!==void 0&&!i.has(n);)i.add(n),n=s,s=e.arrayAliases.get(n);return n}function Z(e,t,n){if(t==="ARGV")return e.ARGV[n]??"";if(t==="ENVIRON")return e.ENVIRON[n]??"";let i=X(e,t);return e.arrays[i]?.[n]??""}function le(e,t,n,i){let s=X(e,t);e.arrays[s]||(e.arrays[s]=Object.create(null)),e.arrays[s][n]=i}function Ae(e,t,n){if(t==="ARGV")return e.ARGV[n]!==void 0;if(t==="ENVIRON")return e.ENVIRON[n]!==void 0;let i=X(e,t);return e.arrays[i]?.[n]!==void 0}function Ie(e,t,n){let i=X(e,t);e.arrays[i]&&delete e.arrays[i][n]}function ke(e,t){let n=X(e,t);delete e.arrays[n]}var Ce=null;function be(e){Ce=e}function L(e,t){D(e.requireDefenseContext,"awk",t)}function m(e,t,n){return _(e.requireDefenseContext,"awk",t,n)}async function f(e,t){switch(L(e,"expression evaluation"),e.coverage?.hit(`awk:expr:${t.type}`),t.type){case"number":return t.value;case"string":return t.value;case"regex":return K(t.pattern,e.line)?1:0;case"field":return ut(e,t);case"variable":return J(e,t.name);case"array_access":return ct(e,t);case"binary":return ht(e,t);case"unary":return dt(e,t);case"ternary":return b(await m(e,"ternary condition evaluation",()=>f(e,t.condition)))?await m(e,"ternary consequent evaluation",()=>f(e,t.consequent)):await m(e,"ternary alternate evaluation",()=>f(e,t.alternate));case"call":return Et(e,t.name,t.args);case"assignment":return yt(e,t);case"pre_increment":return mt(e,t.operand);case"pre_decrement":return St(e,t.operand);case"post_increment":return wt(e,t.operand);case"post_decrement":return Rt(e,t.operand);case"in":return gt(e,t.key,t.array);case"getline":return vt(e,t.variable,t.file,t.command);case"tuple":return kt(e,t.elements);default:return""}}async function ut(e,t){L(e,"field reference evaluation");let n=Math.floor(g(await m(e,"field index evaluation",()=>f(e,t.index))));return Q(e,n)}async function ct(e,t){L(e,"array access evaluation");let n=S(await m(e,"array key evaluation",()=>f(e,t.key)));return Z(e,t.array,n)}async function ht(e,t){L(e,"binary expression evaluation");let n=t.operator;if(n==="||")return b(await m(e,"logical-or left evaluation",()=>f(e,t.left)))||b(await m(e,"logical-or right evaluation",()=>f(e,t.right)))?1:0;if(n==="&&")return b(await m(e,"logical-and left evaluation",()=>f(e,t.left)))&&b(await m(e,"logical-and right evaluation",()=>f(e,t.right)))?1:0;if(n==="~"){let l=await m(e,"regex left evaluation",()=>f(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let u=t.right.type==="regex"?t.right.pattern:S(await m(e,"regex right evaluation",()=>f(e,t.right)));try{return A(u).test(S(l))?1:0}catch{return 0}}if(n==="!~"){let l=await m(e,"negated-regex left evaluation",()=>f(e,t.left));t.right.type==="regex"&&e.coverage?.hit("awk:expr:regex");let u=t.right.type==="regex"?t.right.pattern:S(await m(e,"negated-regex right evaluation",()=>f(e,t.right)));try{return A(u).test(S(l))?0:1}catch{return 1}}let i=await m(e,"binary left evaluation",()=>f(e,t.left)),s=await m(e,"binary right evaluation",()=>f(e,t.right));if(n===" "){let l=S(i)+S(s);if(e.maxOutputSize>0&&l.length>e.maxOutputSize)throw new P(`awk: string concatenation size limit exceeded (${e.maxOutputSize} bytes)`,"string_length",e.output);return l}if(pt(n))return ft(i,s,n);let a=g(i),o=g(s);return Ee(a,o,n)}function pt(e){return["<","<=",">",">=","==","!="].includes(e)}function ft(e,t,n){let i=ae(e),s=ae(t);if(i&&s){let l=g(e),u=g(t);switch(n){case"<":return l<u?1:0;case"<=":return l<=u?1:0;case">":return l>u?1:0;case">=":return l>=u?1:0;case"==":return l===u?1:0;case"!=":return l!==u?1:0}}let a=S(e),o=S(t);switch(n){case"<":return a<o?1:0;case"<=":return a<=o?1:0;case">":return a>o?1:0;case">=":return a>=o?1:0;case"==":return a===o?1:0;case"!=":return a!==o?1:0}return 0}async function dt(e,t){L(e,"unary expression evaluation");let n=await m(e,"unary operand evaluation",()=>f(e,t.operand));switch(t.operator){case"!":return b(n)?0:1;case"-":return-g(n);case"+":return+g(n);default:return n}}async function Et(e,t,n){L(e,"function call evaluation");let i=Re.get(t);if(i)return i(n,e,{evalExpr:a=>f(e,a)});let s=e.functions.get(t);return s?Nt(e,s,n):""}async function Nt(e,t,n){if(L(e,"user function call"),e.currentRecursionDepth++,e.currentRecursionDepth>e.maxRecursionDepth)throw e.currentRecursionDepth--,new P(`awk: recursion depth exceeded maximum (${e.maxRecursionDepth})`,"recursion",e.output);let i=Object.create(null);for(let l of t.params)i[l]=e.vars[l];let s=[];for(let l=0;l<t.params.length;l++){let u=t.params[l];if(l<n.length){let N=n[l];N.type==="variable"&&(e.arrayAliases.set(u,N.name),s.push(u));let v=await m(e,"user function argument evaluation",()=>f(e,N));e.vars[u]=v}else e.vars[u]=""}e.hasReturn=!1,e.returnValue=void 0;let a=Ce;a&&await m(e,"user function body execution",()=>a(e,t.body.statements));let o=e.returnValue??"";for(let l of t.params)i[l]!==void 0?e.vars[l]=i[l]:delete e.vars[l];for(let l of s)e.arrayAliases.delete(l);return e.hasReturn=!1,e.returnValue=void 0,e.currentRecursionDepth--,o}async function yt(e,t){L(e,"assignment evaluation");let n=await m(e,"assignment value evaluation",()=>f(e,t.value)),i=t.target,s=t.operator,a;if(s==="=")a=n;else{let o;if(i.type==="field"){let N=Math.floor(g(await m(e,"assignment field index",()=>f(e,i.index))));o=Q(e,N)}else if(i.type==="variable")o=J(e,i.name);else{let N=S(await m(e,"assignment array key",()=>f(e,i.key)));o=Z(e,i.array,N)}let l=g(o),u=g(n);switch(s){case"+=":a=l+u;break;case"-=":a=l-u;break;case"*=":a=l*u;break;case"/=":a=u!==0?l/u:0;break;case"%=":a=u!==0?l%u:0;break;case"^=":a=l**u;break;default:a=n}}if(i.type==="field"){let o=Math.floor(g(await m(e,"assignment target field index",()=>f(e,i.index))));oe(e,o,a)}else if(i.type==="variable")W(e,i.name,a);else{let o=S(await m(e,"assignment target array key",()=>f(e,i.key)));le(e,i.array,o,a)}return a}async function Y(e,t,n,i){L(e,"inc/dec evaluation");let s;if(t.type==="field"){let a=Math.floor(g(await m(e,"inc/dec field index",()=>f(e,t.index))));s=g(Q(e,a)),oe(e,a,s+n)}else if(t.type==="variable")s=g(J(e,t.name)),W(e,t.name,s+n);else{let a=S(await m(e,"inc/dec array key",()=>f(e,t.key)));s=g(Z(e,t.array,a)),le(e,t.array,a,s+n)}return i?s+n:s}async function mt(e,t){return Y(e,t,1,!0)}async function St(e,t){return Y(e,t,-1,!0)}async function wt(e,t){return Y(e,t,1,!1)}async function Rt(e,t){return Y(e,t,-1,!1)}async function gt(e,t,n){L(e,"in-expression evaluation");let i;if(t.type==="tuple"){e.coverage?.hit("awk:expr:tuple");let s=[];for(let a of t.elements)s.push(S(await m(e,"tuple key element evaluation",()=>f(e,a))));i=s.join(e.SUBSEP)}else i=S(await m(e,"in-expression key evaluation",()=>f(e,t)));return Ae(e,n,i)?1:0}async function vt(e,t,n,i){if(L(e,"getline evaluation"),i)return At(e,t,i);if(n)return It(e,t,n);if(!e.lines||e.lineIndex===void 0)return-1;let s=e.lineIndex+1;if(s>=e.lines.length)return 0;let a=e.lines[s];return t?W(e,t,a):$(e,a),e.NR++,e.lineIndex=s,1}async function At(e,t,n){let i=e.exec;if(!i)return-1;L(e,"getline command source");let s=S(await m(e,"getline command expression",()=>f(e,n))),a=`__cmd_${s}`,o=`__cmdi_${s}`,l,u;if(e.vars[a]===void 0)try{l=(await m(e,"getline command exec",()=>i(s))).stdout.split(`
@@ -1,4 +1,4 @@
1
- import{a as w,b as n}from"./chunk-CWQS3NFK.js";import{a as T,b as g}from"./chunk-A5O5YHGN.js";import{a as F}from"./chunk-IPJHKYVM.js";import{a as m}from"./chunk-3THT3N7L.js";var h={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,RENAME:14,COPY_FILE:15,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200,EXEC_COMMAND:300},a={PENDING:0,READY:1,SUCCESS:2,ERROR:3},u={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,TIMEOUT:8,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10},s={OP_CODE:0,STATUS:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,PATH_BUFFER:32,DATA_BUFFER:4128},E={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:1048576,TOTAL:1052704},S={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},l={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function _(){return new w(E.TOTAL)}var R=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return n.load(this.int32View,s.OP_CODE/4)}setOpCode(t){n.store(this.int32View,s.OP_CODE/4,t)}getStatus(){return n.load(this.int32View,s.STATUS/4)}setStatus(t){n.store(this.int32View,s.STATUS/4,t)}getPathLength(){return n.load(this.int32View,s.PATH_LENGTH/4)}setPathLength(t){n.store(this.int32View,s.PATH_LENGTH/4,t)}getDataLength(){return n.load(this.int32View,s.DATA_LENGTH/4)}setDataLength(t){n.store(this.int32View,s.DATA_LENGTH/4,t)}getResultLength(){return n.load(this.int32View,s.RESULT_LENGTH/4)}setResultLength(t){n.store(this.int32View,s.RESULT_LENGTH/4,t)}getErrorCode(){return n.load(this.int32View,s.ERROR_CODE/4)}setErrorCode(t){n.store(this.int32View,s.ERROR_CODE/4,t)}getFlags(){return n.load(this.int32View,s.FLAGS/4)}setFlags(t){n.store(this.int32View,s.FLAGS/4,t)}getMode(){return n.load(this.int32View,s.MODE/4)}setMode(t){n.store(this.int32View,s.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(s.PATH_BUFFER,s.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>E.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${E.PATH_BUFFER}`);this.uint8View.set(e,s.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(s.DATA_BUFFER,s.DATA_BUFFER+t)}setData(t){if(t.length>E.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${E.DATA_BUFFER}`);this.uint8View.set(t,s.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(s.DATA_BUFFER,s.DATA_BUFFER+t)}setResult(t){if(t.length>E.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${E.DATA_BUFFER}`);this.uint8View.set(t,s.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[s.DATA_BUFFER+l.IS_FILE]=t.isFile?1:0,this.uint8View[s.DATA_BUFFER+l.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[s.DATA_BUFFER+l.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(s.DATA_BUFFER+l.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(s.DATA_BUFFER+l.SIZE,e,!0),this.dataView.setFloat64(s.DATA_BUFFER+l.MTIME,t.mtime.getTime(),!0),this.setResultLength(l.TOTAL)}decodeStat(){return{isFile:this.uint8View[s.DATA_BUFFER+l.IS_FILE]===1,isDirectory:this.uint8View[s.DATA_BUFFER+l.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[s.DATA_BUFFER+l.IS_SYMLINK]===1,mode:this.dataView.getInt32(s.DATA_BUFFER+l.MODE,!0),size:this.dataView.getFloat64(s.DATA_BUFFER+l.SIZE,!0),mtime:new Date(this.dataView.getFloat64(s.DATA_BUFFER+l.MTIME,!0))}}waitForReady(t){return n.wait(this.int32View,s.STATUS/4,a.PENDING,t)}waitForReadyAsync(t){return n.waitAsync(this.int32View,s.STATUS/4,a.PENDING,t)}async waitUntilReady(t){let e=Date.now();for(;;){let r=this.getStatus();if(r===a.READY)return!0;let o=Date.now()-e;if(o>=t)return!1;let i=t-o,c=n.waitAsync(this.int32View,s.STATUS/4,r,i);if(c.async&&await c.value==="timed-out")return!1}}waitForResult(t){return n.wait(this.int32View,s.STATUS/4,a.READY,t)}notify(){return n.notify(this.int32View,s.STATUS/4)}reset(){this.setOpCode(h.NOOP),this.setStatus(a.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(u.NONE),this.setFlags(S.NONE),this.setMode(0)}};var A=class{fs;cwd;commandName;secureFetch;maxOutputSize;exec;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;startTime=0;timeoutMs=0;constructor(t,e,r,o,i=void 0,c=0,d=void 0){this.fs=e,this.cwd=r,this.commandName=o,this.secureFetch=i,this.maxOutputSize=c,this.exec=d,this.protocol=new R(t)}remainingMs(){return Math.max(0,this.timeoutMs-(Date.now()-this.startTime))}raceDeadline(t){let e=this.remainingMs();if(e<=0)return this.running=!1,this.output.exitCode=124,this.output.stderr+=`
1
+ import{b as A}from"./chunk-R6VWJ2ZL.js";import{a as w,b as n}from"./chunk-CWQS3NFK.js";import{a as T,b as g}from"./chunk-A5O5YHGN.js";import{a as F}from"./chunk-IPJHKYVM.js";import{a as m}from"./chunk-3THT3N7L.js";var h={NOOP:0,READ_FILE:1,WRITE_FILE:2,STAT:3,READDIR:4,MKDIR:5,RM:6,EXISTS:7,APPEND_FILE:8,SYMLINK:9,READLINK:10,LSTAT:11,CHMOD:12,REALPATH:13,RENAME:14,COPY_FILE:15,WRITE_STDOUT:100,WRITE_STDERR:101,EXIT:102,HTTP_REQUEST:200,EXEC_COMMAND:300},a={PENDING:0,READY:1,SUCCESS:2,ERROR:3},u={NONE:0,NOT_FOUND:1,IS_DIRECTORY:2,NOT_DIRECTORY:3,EXISTS:4,PERMISSION_DENIED:5,INVALID_PATH:6,IO_ERROR:7,TIMEOUT:8,NETWORK_ERROR:9,NETWORK_NOT_CONFIGURED:10},s={OP_CODE:0,STATUS:4,PATH_LENGTH:8,DATA_LENGTH:12,RESULT_LENGTH:16,ERROR_CODE:20,FLAGS:24,MODE:28,PATH_BUFFER:32,DATA_BUFFER:4128},E={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:1048576,TOTAL:1052704},S={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},l={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function f(){return new w(E.TOTAL)}var R=class{int32View;uint8View;dataView;constructor(t){this.int32View=new Int32Array(t),this.uint8View=new Uint8Array(t),this.dataView=new DataView(t)}getOpCode(){return n.load(this.int32View,s.OP_CODE/4)}setOpCode(t){n.store(this.int32View,s.OP_CODE/4,t)}getStatus(){return n.load(this.int32View,s.STATUS/4)}setStatus(t){n.store(this.int32View,s.STATUS/4,t)}getPathLength(){return n.load(this.int32View,s.PATH_LENGTH/4)}setPathLength(t){n.store(this.int32View,s.PATH_LENGTH/4,t)}getDataLength(){return n.load(this.int32View,s.DATA_LENGTH/4)}setDataLength(t){n.store(this.int32View,s.DATA_LENGTH/4,t)}getResultLength(){return n.load(this.int32View,s.RESULT_LENGTH/4)}setResultLength(t){n.store(this.int32View,s.RESULT_LENGTH/4,t)}getErrorCode(){return n.load(this.int32View,s.ERROR_CODE/4)}setErrorCode(t){n.store(this.int32View,s.ERROR_CODE/4,t)}getFlags(){return n.load(this.int32View,s.FLAGS/4)}setFlags(t){n.store(this.int32View,s.FLAGS/4,t)}getMode(){return n.load(this.int32View,s.MODE/4)}setMode(t){n.store(this.int32View,s.MODE/4,t)}getPath(){let t=this.getPathLength(),e=this.uint8View.slice(s.PATH_BUFFER,s.PATH_BUFFER+t);return new TextDecoder().decode(e)}setPath(t){let e=new TextEncoder().encode(t);if(e.length>E.PATH_BUFFER)throw new Error(`Path too long: ${e.length} > ${E.PATH_BUFFER}`);this.uint8View.set(e,s.PATH_BUFFER),this.setPathLength(e.length)}getData(){let t=this.getDataLength();return this.uint8View.slice(s.DATA_BUFFER,s.DATA_BUFFER+t)}setData(t){if(t.length>E.DATA_BUFFER)throw new Error(`Data too large: ${t.length} > ${E.DATA_BUFFER}`);this.uint8View.set(t,s.DATA_BUFFER),this.setDataLength(t.length)}getDataAsString(){let t=this.getData();return new TextDecoder().decode(t)}setDataFromString(t){let e=new TextEncoder().encode(t);this.setData(e)}getResult(){let t=this.getResultLength();return this.uint8View.slice(s.DATA_BUFFER,s.DATA_BUFFER+t)}setResult(t){if(t.length>E.DATA_BUFFER)throw new Error(`Result too large: ${t.length} > ${E.DATA_BUFFER}`);this.uint8View.set(t,s.DATA_BUFFER),this.setResultLength(t.length)}getResultAsString(){let t=this.getResult();return new TextDecoder().decode(t)}setResultFromString(t){let e=new TextEncoder().encode(t);this.setResult(e)}encodeStat(t){this.uint8View[s.DATA_BUFFER+l.IS_FILE]=t.isFile?1:0,this.uint8View[s.DATA_BUFFER+l.IS_DIRECTORY]=t.isDirectory?1:0,this.uint8View[s.DATA_BUFFER+l.IS_SYMLINK]=t.isSymbolicLink?1:0,this.dataView.setInt32(s.DATA_BUFFER+l.MODE,t.mode,!0);let e=Math.min(t.size,Number.MAX_SAFE_INTEGER);this.dataView.setFloat64(s.DATA_BUFFER+l.SIZE,e,!0),this.dataView.setFloat64(s.DATA_BUFFER+l.MTIME,t.mtime.getTime(),!0),this.setResultLength(l.TOTAL)}decodeStat(){return{isFile:this.uint8View[s.DATA_BUFFER+l.IS_FILE]===1,isDirectory:this.uint8View[s.DATA_BUFFER+l.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[s.DATA_BUFFER+l.IS_SYMLINK]===1,mode:this.dataView.getInt32(s.DATA_BUFFER+l.MODE,!0),size:this.dataView.getFloat64(s.DATA_BUFFER+l.SIZE,!0),mtime:new Date(this.dataView.getFloat64(s.DATA_BUFFER+l.MTIME,!0))}}waitForReady(t){return n.wait(this.int32View,s.STATUS/4,a.PENDING,t)}waitForReadyAsync(t){return n.waitAsync(this.int32View,s.STATUS/4,a.PENDING,t)}async waitUntilReady(t){let e=Date.now();for(;;){let r=this.getStatus();if(r===a.READY)return!0;let o=Date.now()-e;if(o>=t)return!1;let i=t-o,c=n.waitAsync(this.int32View,s.STATUS/4,r,i);if(c.async&&await c.value==="timed-out")return!1}}waitForResult(t){return n.wait(this.int32View,s.STATUS/4,a.READY,t)}notify(){return n.notify(this.int32View,s.STATUS/4)}reset(){this.setOpCode(h.NOOP),this.setStatus(a.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(u.NONE),this.setFlags(S.NONE),this.setMode(0)}};var O=class{fs;cwd;commandName;secureFetch;maxOutputSize;exec;protocol;running=!1;output={stdout:"",stderr:"",exitCode:0};outputLimitExceeded=!1;startTime=0;timeoutMs=0;constructor(t,e,r,o,i=void 0,c=0,d=void 0){this.fs=e,this.cwd=r,this.commandName=o,this.secureFetch=i,this.maxOutputSize=c,this.exec=d,this.protocol=new R(t)}remainingMs(){return Math.max(0,this.timeoutMs-(Date.now()-this.startTime))}raceDeadline(t){let e=this.remainingMs();if(e<=0)return this.running=!1,this.output.exitCode=124,this.output.stderr+=`
2
2
  ${this.commandName}: execution timeout exceeded
3
3
  `,Promise.reject(new Error("Operation timed out"));let r=t();return new Promise((o,i)=>{let c=T(()=>{this.running=!1,this.output.exitCode=124,this.output.stderr+=`
4
4
  ${this.commandName}: execution timeout exceeded
@@ -7,4 +7,4 @@ ${this.commandName}: execution timeout exceeded
7
7
  `,this.output.exitCode=124;break}let r=this.remainingMs();if(!await this.protocol.waitUntilReady(r)){this.output.stderr+=`
8
8
  ${this.commandName}: execution timeout exceeded
9
9
  `,this.output.exitCode=124;break}let i=this.protocol.getOpCode();await this.handleOperation(i),this.protocol.notify()}return this.output}stop(){this.running=!1}async handleOperation(t){try{switch(t){case h.READ_FILE:await this.handleReadFile();break;case h.WRITE_FILE:await this.handleWriteFile();break;case h.STAT:await this.handleStat();break;case h.LSTAT:await this.handleLstat();break;case h.READDIR:await this.handleReaddir();break;case h.MKDIR:await this.handleMkdir();break;case h.RM:await this.handleRm();break;case h.EXISTS:await this.handleExists();break;case h.APPEND_FILE:await this.handleAppendFile();break;case h.SYMLINK:await this.handleSymlink();break;case h.READLINK:await this.handleReadlink();break;case h.CHMOD:await this.handleChmod();break;case h.REALPATH:await this.handleRealpath();break;case h.RENAME:await this.handleRename();break;case h.COPY_FILE:await this.handleCopyFile();break;case h.WRITE_STDOUT:this.handleWriteStdout();break;case h.WRITE_STDERR:this.handleWriteStderr();break;case h.EXIT:this.handleExit();break;case h.HTTP_REQUEST:await this.handleHttpRequest();break;case h.EXEC_COMMAND:await this.handleExecCommand();break;default:this.protocol.setErrorCode(u.IO_ERROR),this.protocol.setStatus(a.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(t){return this.fs.resolvePath(this.cwd,t)}async handleReadFile(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readFileBuffer(t);this.protocol.setResult(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.writeFile(t,e),this.protocol.setStatus(a.SUCCESS)}catch(r){this.setErrorFromException(r)}}async handleStat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.stat(t);this.protocol.encodeStat(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.lstat(t);this.protocol.encodeStat(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readdir(t);this.protocol.setResultFromString(JSON.stringify(e)),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let t=this.resolvePath(this.protocol.getPath()),r=(this.protocol.getFlags()&S.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(t,{recursive:r}),this.protocol.setStatus(a.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleRm(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getFlags(),r=(e&S.RECURSIVE)!==0,o=(e&S.FORCE)!==0;try{await this.fs.rm(t,{recursive:r,force:o}),this.protocol.setStatus(a.SUCCESS)}catch(i){this.setErrorFromException(i)}}async handleExists(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.exists(t);this.protocol.setResult(new Uint8Array([e?1:0])),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getData();try{await this.fs.appendFile(t,e),this.protocol.setStatus(a.SUCCESS)}catch(r){this.setErrorFromException(r)}}async handleSymlink(){let t=this.protocol.getPath(),e=this.protocol.getDataAsString(),r=this.resolvePath(t);try{await this.fs.symlink(e,r),this.protocol.setStatus(a.SUCCESS)}catch(o){this.setErrorFromException(o)}}async handleReadlink(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.readlink(t);this.protocol.setResultFromString(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let t=this.resolvePath(this.protocol.getPath()),e=this.protocol.getMode();try{await this.fs.chmod(t,e),this.protocol.setStatus(a.SUCCESS)}catch(r){this.setErrorFromException(r)}}async handleRealpath(){let t=this.resolvePath(this.protocol.getPath());try{let e=await this.fs.realpath(t);this.protocol.setResultFromString(e),this.protocol.setStatus(a.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleRename(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.mv(t,e),this.protocol.setStatus(a.SUCCESS)}catch(r){this.setErrorFromException(r)}}async handleCopyFile(){let t=this.resolvePath(this.protocol.getPath()),e=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.cp(t,e),this.protocol.setStatus(a.SUCCESS)}catch(r){this.setErrorFromException(r)}}handleWriteStdout(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stdout",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(u.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(a.ERROR);return}this.protocol.setStatus(a.SUCCESS)}handleWriteStderr(){let t=this.protocol.getDataAsString();if(!this.tryAppendOutput("stderr",t)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(u.IO_ERROR),this.protocol.setResultFromString("Output size limit exceeded"),this.protocol.setStatus(a.ERROR);return}this.protocol.setStatus(a.SUCCESS)}handleExit(){let t=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=t,this.protocol.setStatus(a.SUCCESS),this.running=!1}tryAppendOutput(t,e){return this.outputLimitExceeded?!1:this.maxOutputSize<=0?(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0):this.output.stdout.length+this.output.stderr.length+e.length>this.maxOutputSize?!1:(t==="stdout"?this.output.stdout+=e:this.output.stderr+=e,!0)}appendOutputLimitError(){if(this.maxOutputSize<=0)return;let t=`${this.commandName}: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
10
- `,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let o=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(o>0)if(this.output.stdout.length>=o)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-o);else{let i=o-this.output.stdout.length;this.output.stdout="",i>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-i)}this.output.stderr+=e}async handleHttpRequest(){let t=this.secureFetch;if(!t){this.protocol.setErrorCode(u.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(a.ERROR);return}let e=this.protocol.getPath(),r=this.protocol.getDataAsString();try{let o=r?JSON.parse(r):{},i=this.remainingMs(),c=await this.raceDeadline(()=>t(e,{method:o.method,headers:o.headers,body:o.body,timeoutMs:i})),d=JSON.stringify({status:c.status,statusText:c.statusText,headers:c.headers,body:c.body,url:c.url});this.protocol.setResultFromString(d),this.protocol.setStatus(a.SUCCESS)}catch(o){let i=m(o instanceof Error?o.message:String(o));this.protocol.setErrorCode(u.NETWORK_ERROR),this.protocol.setResultFromString(i),this.protocol.setStatus(a.ERROR)}}async handleExecCommand(){let t=this.exec;if(!t){this.protocol.setErrorCode(u.IO_ERROR),this.protocol.setResultFromString("Command execution not available in this context."),this.protocol.setStatus(a.ERROR);return}let e=this.protocol.getPath(),r=this.protocol.getDataAsString(),o=new AbortController;try{let i={cwd:this.cwd,signal:o.signal};if(r){let p=JSON.parse(r);p.stdin&&(i.stdin=p.stdin),p.args&&Array.isArray(p.args)&&(i.args=p.args.map(D=>String(D)),e=F([e]))}let c=await this.raceDeadline(()=>t(e,i)),d=JSON.stringify({stdout:c.stdout,stderr:c.stderr,exitCode:c.exitCode});this.protocol.setResultFromString(d),this.protocol.setStatus(a.SUCCESS)}catch(i){o.abort();let c=i instanceof Error?i.message:String(i);this.protocol.setErrorCode(u.IO_ERROR),this.protocol.setResultFromString(c),this.protocol.setStatus(a.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),r=m(e),o=u.IO_ERROR,i=e.toLowerCase();i.includes("no such file")||i.includes("not found")||i.includes("enoent")?o=u.NOT_FOUND:i.includes("is a directory")||i.includes("eisdir")?o=u.IS_DIRECTORY:i.includes("not a directory")||i.includes("enotdir")?o=u.NOT_DIRECTORY:i.includes("already exists")||i.includes("eexist")?o=u.EXISTS:(i.includes("permission")||i.includes("eperm")||i.includes("eacces"))&&(o=u.PERMISSION_DENIED),this.protocol.setErrorCode(o),this.protocol.setResultFromString(r),this.protocol.setStatus(a.ERROR)}};export{_ as a,A as b};
10
+ `,e=t.length>this.maxOutputSize?t.slice(0,this.maxOutputSize):t;if(this.output.stderr.includes("total output size exceeded"))return;let o=this.output.stdout.length+this.output.stderr.length+e.length-this.maxOutputSize;if(o>0)if(this.output.stdout.length>=o)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-o);else{let i=o-this.output.stdout.length;this.output.stdout="",i>=this.output.stderr.length?this.output.stderr="":this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-i)}this.output.stderr+=e}async handleHttpRequest(){let t=this.secureFetch;if(!t){this.protocol.setErrorCode(u.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString("Network access not configured. Enable network in Bash options."),this.protocol.setStatus(a.ERROR);return}let e=this.protocol.getPath(),r=this.protocol.getDataAsString();try{let o=r?JSON.parse(r):{},i=this.remainingMs(),c=await this.raceDeadline(()=>t(e,{method:o.method,headers:o.headers,body:o.body,timeoutMs:i})),d=JSON.stringify({status:c.status,statusText:c.statusText,headers:c.headers,bodyBase64:A(c.body,"base64"),url:c.url});this.protocol.setResultFromString(d),this.protocol.setStatus(a.SUCCESS)}catch(o){let i=m(o instanceof Error?o.message:String(o));this.protocol.setErrorCode(u.NETWORK_ERROR),this.protocol.setResultFromString(i),this.protocol.setStatus(a.ERROR)}}async handleExecCommand(){let t=this.exec;if(!t){this.protocol.setErrorCode(u.IO_ERROR),this.protocol.setResultFromString("Command execution not available in this context."),this.protocol.setStatus(a.ERROR);return}let e=this.protocol.getPath(),r=this.protocol.getDataAsString(),o=new AbortController;try{let i={cwd:this.cwd,signal:o.signal};if(r){let p=JSON.parse(r);p.stdin&&(i.stdin=p.stdin),p.args&&Array.isArray(p.args)&&(i.args=p.args.map(C=>String(C)),e=F([e]))}let c=await this.raceDeadline(()=>t(e,i)),d=JSON.stringify({stdout:c.stdout,stderr:c.stderr,exitCode:c.exitCode});this.protocol.setResultFromString(d),this.protocol.setStatus(a.SUCCESS)}catch(i){o.abort();let c=i instanceof Error?i.message:String(i);this.protocol.setErrorCode(u.IO_ERROR),this.protocol.setResultFromString(c),this.protocol.setStatus(a.ERROR)}}setErrorFromException(t){let e=t instanceof Error?t.message:String(t),r=m(e),o=u.IO_ERROR,i=e.toLowerCase();i.includes("no such file")||i.includes("not found")||i.includes("enoent")?o=u.NOT_FOUND:i.includes("is a directory")||i.includes("eisdir")?o=u.IS_DIRECTORY:i.includes("not a directory")||i.includes("enotdir")?o=u.NOT_DIRECTORY:i.includes("already exists")||i.includes("eexist")?o=u.EXISTS:(i.includes("permission")||i.includes("eperm")||i.includes("eacces"))&&(o=u.PERMISSION_DENIED),this.protocol.setErrorCode(o),this.protocol.setResultFromString(r),this.protocol.setStatus(a.ERROR)}};export{f as a,O as b};
@@ -0,0 +1 @@
1
+ function c(t){if(!t||t==="/")return"/";let e=t.endsWith("/")&&t!=="/"?t.slice(0,-1):t;e.startsWith("/")||(e=`/${e}`);let n=e.split("/").filter(r=>r&&r!=="."),s=[];for(let r of n)r===".."?s.pop():s.push(r);return`/${s.join("/")}`||"/"}function h(t,e){if(t.includes("\0"))throw new Error(`ENOENT: path contains null byte, ${e} '${t}'`)}function p(t){let e=c(t);if(e==="/")return"/";let n=e.lastIndexOf("/");return n===0?"/":e.slice(0,n)}function y(t,e){if(e.startsWith("/"))return c(e);let n=t==="/"?`/${e}`:`${t}/${e}`;return c(n)}function m(t,e){return t==="/"?`/${e}`:`${t}/${e}`}function v(t,e){if(e.startsWith("/"))return c(e);let n=p(t);return c(m(n,e))}import*as i from"node:fs";import*as o from"node:path";function d(t,e){if(t===e)return!0;let n=t[e.length];return(n==="/"||n==="\\")&&t.startsWith(e)}function f(t,e){try{let n=i.realpathSync(t);return d(n,e)?n:null}catch(n){if(n.code==="ENOENT"){let s=o.dirname(t);if(s===t)return null;let r=f(s,e);if(r===null)return null;try{if(i.lstatSync(t).isSymbolicLink()){let l=i.readlinkSync(t),u=o.isAbsolute(l)?l:o.resolve(o.dirname(t),l);if(f(u,e)===null)return null}}catch{}return o.join(r,o.basename(t))}return null}}function P(t,e,n){let s=f(t,n);if(s===null)return null;let r=o.resolve(t),a=r.slice(e.length),l=s.slice(n.length);if(a!==l)return null;try{if(i.lstatSync(r).isSymbolicLink())return null}catch{}return s}function $(t,e){if(!i.existsSync(t))throw new Error(`${e} root does not exist`);if(!i.statSync(t).isDirectory())throw new Error(`${e} root is not a directory`)}function D(t,e){if(!o.isAbsolute(t))return{withinRoot:!0,relativePath:t};let n;try{n=i.realpathSync(t)}catch{n=o.resolve(t)}return d(n,e)?{withinRoot:!0,relativePath:n.slice(e.length).replace(/\\/g,"/")||"/"}:{withinRoot:!1,safeName:o.basename(t)}}function N(t,e,n,s){let r=t;if(r.path===void 0){for(let l of s)if(r.message?.includes(l))throw t}let a=r.code||"EIO";throw new Error(`${a}: ${n} '${e}'`)}export{c as a,h as b,p as c,y as d,m as e,v as f,d as g,f as h,P as i,$ as j,D as k,N as l};