@inkeep/open-knowledge 0.88.6-beta.4 → 0.88.6-beta.5

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 (203) hide show
  1. package/dist/alias-JE7RI5QX-D_KITrCa.mjs +1 -0
  2. package/dist/awk2-BBAGSFUB-CehlsFZ5.mjs +1 -0
  3. package/dist/bash-IJWYRKFO-D1gJZuWH.mjs +1 -0
  4. package/dist/chokidar-D0G-K3zc.mjs +3 -0
  5. package/dist/{chunk-3BS5SKQH-C9C8uLJE.mjs → chunk-3BS5SKQH-CKmQMz_L.mjs} +15 -15
  6. package/dist/{chunk-62RKD26F-Bv6peUyf.mjs → chunk-62RKD26F-B6OssxCM.mjs} +3 -3
  7. package/dist/{chunk-6Z5SFZXK-CiQN8zZ8.mjs → chunk-6Z5SFZXK-D2_6X1Dn.mjs} +35 -35
  8. package/dist/chunk-A4JSPFCI-DQxLkrTb.mjs +6 -0
  9. package/dist/chunk-D6CWQ5DW-BybImdUI.mjs +5 -0
  10. package/dist/chunk-GOV5EKKI-D42P07Xu.mjs +9 -0
  11. package/dist/{chunk-HKLCLINH-BHo2f5d2.mjs → chunk-HKLCLINH-C2rvDMlW.mjs} +20 -20
  12. package/dist/{chunk-HL6NGDO2-BFPiiJBP.mjs → chunk-HL6NGDO2-CvsVMff5.mjs} +9 -9
  13. package/dist/{chunk-I57KEIP3-C90kULU7.mjs → chunk-I57KEIP3-BrnLL4Gl.mjs} +4 -4
  14. package/dist/{chunk-K6LIBGJA-D-bMYdgr.mjs → chunk-K6LIBGJA-CN_13h4C.mjs} +7 -7
  15. package/dist/{chunk-KRBPSX3W-DXuvylLd.mjs → chunk-KRBPSX3W-CY8FCKFm.mjs} +2 -2
  16. package/dist/chunk-MDDMCKUK-ByCsPSNd.mjs +6 -0
  17. package/dist/chunk-MIZPJHVH-DrIwZ3F_.mjs +7 -0
  18. package/dist/chunk-NAERJDUW-nfjIZ3Pb.mjs +8 -0
  19. package/dist/chunk-NUYSJFDK-M0xrw_uS.mjs +7 -0
  20. package/dist/chunk-OCLXQMOG-DHLmxiVS.mjs +6 -0
  21. package/dist/{chunk-OCS6LSEM-BBT5tk28.mjs → chunk-OCS6LSEM-CUgQNrT_.mjs} +7 -7
  22. package/dist/{chunk-PBXLG62G-G7lHqZ9p.mjs → chunk-PBXLG62G-CuixUdAo.mjs} +3 -3
  23. package/dist/{chunk-T56QNPHK-BuLSSwpV.mjs → chunk-T56QNPHK-BhobE-0w.mjs} +3 -3
  24. package/dist/chunk-TLSUDHID-BpXt2GFu.mjs +6 -0
  25. package/dist/{chunk-TOMNU26N-CPb3jib2.mjs → chunk-TOMNU26N-Bhlbw7_h.mjs} +3 -3
  26. package/dist/{chunk-TP4BZANS-BKDDD1i2.mjs → chunk-TP4BZANS-Dv2qAxWh.mjs} +12 -12
  27. package/dist/{chunk-XKWWSDBF-CiyukTrj.mjs → chunk-XKWWSDBF-COm-Bab0.mjs} +10 -10
  28. package/dist/{chunk-YMMW5UAP-B7swMNER.mjs → chunk-YMMW5UAP-CTA9rr10.mjs} +7 -7
  29. package/dist/chunk-YTNYSM6T-gRMum0pq.mjs +11 -0
  30. package/dist/{chunk-YULBWSET-BjwIKz2I.mjs → chunk-YULBWSET-BZbeBpnM.mjs} +6 -6
  31. package/dist/{chunk-Z6LRHWXI-B5pNb54L.mjs → chunk-Z6LRHWXI-BE3EMa92.mjs} +5 -5
  32. package/dist/{chunk-ZZO3UDB3-Dr2Q2MNF.mjs → chunk-ZZO3UDB3-C92Poglu.mjs} +32 -32
  33. package/dist/cli-DtqA8k1H.mjs +110 -0
  34. package/dist/cli.mjs +1 -110
  35. package/dist/constants-D-73L_8T.mjs +1 -0
  36. package/dist/constants-ok-dir-DZ25OS9-.mjs +115 -0
  37. package/dist/{cp-XOYR4ABJ-BWvobbqd.mjs → cp-XOYR4ABJ-KRhRq3W9.mjs} +1 -1
  38. package/dist/{curl-47BFPSFW-CjxwhFSt.mjs → curl-47BFPSFW-D1cYHIfa.mjs} +8 -8
  39. package/dist/{diff-HJF2MPDN-B5Vu5bd_.mjs → diff-HJF2MPDN-CLb1d3Pm.mjs} +1 -1
  40. package/dist/dist-D4ipyg1q.mjs +1 -0
  41. package/dist/{dist-DIwQtyEF.mjs → dist-DPe6aLSk.mjs} +518 -522
  42. package/dist/env-5EPCWSXR-B6cYhau7.mjs +1 -0
  43. package/dist/expansion-VBDYWVZR-vhATs2YP.mjs +1 -0
  44. package/dist/expr-YYCVMXE3-BG-gQLPe.mjs +1 -0
  45. package/dist/{file-IGDTDPLG-CRy1Omyh.mjs → file-IGDTDPLG-CqcQiax7.mjs} +1 -1
  46. package/dist/find-DH2ALKQS-DUCbwSBg.mjs +1 -0
  47. package/dist/flag-coverage-6JEX67RU-BgXRRqNM.mjs +1 -0
  48. package/dist/fs-find-project-root-BYV07wjn.mjs +5 -0
  49. package/dist/git-credential-get-BOA4DNNp.mjs +2 -0
  50. package/dist/git-credential-helper-DY8W25nc.mjs +1 -0
  51. package/dist/git-credential-operation-9lLcCrJB.mjs +1 -0
  52. package/dist/grep-2HUTXO5U-CbvcQZdY.mjs +1 -0
  53. package/dist/index.mjs +302 -302
  54. package/dist/{init-DrtyRwCd.mjs → init-C08CTCp9.mjs} +28 -28
  55. package/dist/init-CSYVvJYZ.mjs +1 -0
  56. package/dist/jq-LYZFFBZB-DP4gih1P.mjs +1 -0
  57. package/dist/{js-exec-VXN6TZ7U-Z8_USGOo.mjs → js-exec-VXN6TZ7U-B4rL1N_3.mjs} +4 -4
  58. package/dist/{js-exec-VXN6TZ7U-D--44jnh.mjs → js-exec-VXN6TZ7U-CByMmXZz.mjs} +8 -8
  59. package/dist/launch-json-removal-B39BoBBe.mjs +1 -0
  60. package/dist/{lib-CxwDRGVJ.mjs → lib-CGyiYSWt.mjs} +15 -15
  61. package/dist/{ln-4TRFBYAT-xkfE7-89.mjs → ln-4TRFBYAT-RK1Uvly1.mjs} +1 -1
  62. package/dist/loader-D4dq2xfA.mjs +1 -0
  63. package/dist/loader-DeOCcx0c.mjs +1 -0
  64. package/dist/{lzma-CEMDJHEs.mjs → lzma-B6QS2aZK.mjs} +2 -2
  65. package/dist/{lzma-PPHiE419.mjs → lzma-VPfz3anC.mjs} +1 -1
  66. package/dist/md-manager-BGnqyqi1-DmEmjhMs.mjs +400 -0
  67. package/dist/{mkdir-TDEMSB6C-DKSMdaAE.mjs → mkdir-TDEMSB6C-Ds9y3YxN.mjs} +1 -1
  68. package/dist/{mv-Z6MORUFL-C-C4Dr_j.mjs → mv-Z6MORUFL-C9ixK1Sz.mjs} +1 -1
  69. package/dist/{open-browser-1Rfqcka0.mjs → open-browser-d8GjenQK.mjs} +1 -1
  70. package/dist/parse-worker.mjs +1 -1
  71. package/dist/preview-BD9T555q.mjs +1 -0
  72. package/dist/preview-BOmvdi0o.mjs +2 -0
  73. package/dist/printf-CX64KX2P-DlBDp9me.mjs +1 -0
  74. package/dist/public/assets/{AccountSection-CvEQFMeu.js → AccountSection-UK4fSEAo.js} +1 -1
  75. package/dist/public/assets/{ActivityModeContent-CXZShFfa.js → ActivityModeContent-CD3FGIx9.js} +1 -1
  76. package/dist/public/assets/{AddPropertiesButton-fzqN8jo0.js → AddPropertiesButton-B6p_gdr8.js} +1 -1
  77. package/dist/public/assets/{AgentDiffPane-DpPw6Vrx.js → AgentDiffPane-DkoQ7ai2.js} +1 -1
  78. package/dist/public/assets/{AttachmentsSection-CM625TNw.js → AttachmentsSection-B4oQIzeZ.js} +1 -1
  79. package/dist/public/assets/{CodeMirrorPropInput-DhTOQHoT.js → CodeMirrorPropInput-B9s5B9Bw.js} +1 -1
  80. package/dist/public/assets/{ContentRulesSection-CmbLyKpr.js → ContentRulesSection-aWJrYA4j.js} +1 -1
  81. package/dist/public/assets/{DocumentContext-BV1YTd2j.js → DocumentContext-DXpWi5ky.js} +1 -1
  82. package/dist/public/assets/{EditorModeToggle-DpLjVkbn.js → EditorModeToggle-Diya7MyF.js} +1 -1
  83. package/dist/public/assets/{ExcalidrawDocEditor-B8pXWkF3.js → ExcalidrawDocEditor-PRwr0WYf.js} +1 -1
  84. package/dist/public/assets/FeedbackForm-Cvqd9EXq.js +1 -0
  85. package/dist/public/assets/{ImportSkillDialog-BhxfW92X.js → ImportSkillDialog-CMk2xlCO.js} +1 -1
  86. package/dist/public/assets/{LinkPreviewsSection-CQbnzKbR.js → LinkPreviewsSection-KX_4h53c.js} +1 -1
  87. package/dist/public/assets/{LintConfigEditor-Cjpsh9rK.js → LintConfigEditor-7ZtCVw7Y.js} +1 -1
  88. package/dist/public/assets/{LintingSection-C1YnkUp9.js → LintingSection-ClAY_FjD.js} +1 -1
  89. package/dist/public/assets/ManagedArtifactProperties-C6A9h_XM.js +1 -0
  90. package/dist/public/assets/{ManagedArtifactProperties-Be_X7jvo.js → ManagedArtifactProperties-lEwwds9N.js} +1 -1
  91. package/dist/public/assets/{MermaidDocEditor-C4ZqQjrP.js → MermaidDocEditor-DHUtun4r.js} +1 -1
  92. package/dist/public/assets/{NetworkAccessSection-BBlBPreP.js → NetworkAccessSection-CkW30CIT.js} +1 -1
  93. package/dist/public/assets/{PropertyDisplayRow-Dug4mXDY.js → PropertyDisplayRow-D6c0dfSa.js} +1 -1
  94. package/dist/public/assets/{PublishToGitHubDialog-CTJhJVAo.js → PublishToGitHubDialog-CwF7zH2X.js} +1 -1
  95. package/dist/public/assets/{SchemaConfigEditor-BudGex9d.js → SchemaConfigEditor-BEJxtFtu.js} +1 -1
  96. package/dist/public/assets/{SearchSection-DoHDN8qv.js → SearchSection-CDyx2C9f.js} +1 -1
  97. package/dist/public/assets/{SessionsHost-hU0XdNe1.js → SessionsHost-H5NLeN9a.js} +2 -2
  98. package/dist/public/assets/{SettingsDialogBody-oVGZPfLs.js → SettingsDialogBody-C_YjecBu.js} +2 -2
  99. package/dist/public/assets/{ShareReceiveMissDialog-Cv1nXUjE.js → ShareReceiveMissDialog-D_FkOpht.js} +1 -1
  100. package/dist/public/assets/{SkillToolbarControls-Cmmd5rQT.js → SkillToolbarControls-CtxNLAp-.js} +1 -1
  101. package/dist/public/assets/{SourceEditor-BxGAh_1V.js → SourceEditor-B5LnWxyf.js} +1 -1
  102. package/dist/public/assets/{SyncSection-Bow4_eTH.js → SyncSection-D3PTVWIM.js} +1 -1
  103. package/dist/public/assets/{SyncStatusBadge-RstDs12m.js → SyncStatusBadge-BaJrZaL1.js} +1 -1
  104. package/dist/public/assets/{TerminalSection-CShVO8cy.js → TerminalSection-CsRkbMx2.js} +1 -1
  105. package/dist/public/assets/{TerminalWindowApp-QKtwgUJg.js → TerminalWindowApp-CA9GKqNE.js} +1 -1
  106. package/dist/public/assets/{TextDocEditor-CXd6guUM.js → TextDocEditor-Ch27GvYs.js} +1 -1
  107. package/dist/public/assets/{ThreadView-B1_dybM1.js → ThreadView-Dj6jQfOU.js} +1 -1
  108. package/dist/public/assets/{TimelineDiffPane-kMqLqGsp.js → TimelineDiffPane-4gPranZj.js} +1 -1
  109. package/dist/public/assets/{client-version-C9gO0ViI.js → client-version-B_xA5Zs6.js} +1 -1
  110. package/dist/public/assets/{comment-chips-CrIr3pI7.js → comment-chips-nSpyi8g5.js} +1 -1
  111. package/dist/public/assets/{config-provider-B6XrR1oF.js → config-provider-CNRgcd7O.js} +1 -1
  112. package/dist/public/assets/{doc-undo-manager-5pEmL4Md.js → doc-undo-manager-mWX4_oGV.js} +1 -1
  113. package/dist/public/assets/{index-B_LvEM9a.js → index-DvFhVjVJ.js} +7 -7
  114. package/dist/public/assets/{lint-plugins-DjYwHU6Y.js → lint-plugins-DAx86XSh.js} +1 -1
  115. package/dist/public/assets/{pending-receive-nav-store-z_w0V1XK.js → pending-receive-nav-store-hbWxGWbG.js} +1 -1
  116. package/dist/public/assets/{preferred-session-events-CnyBH-J0.js → preferred-session-events-CD3TX4uI.js} +1 -1
  117. package/dist/public/assets/{progress-CaJJRh70.js → progress-Bp-8Nd7B.js} +1 -1
  118. package/dist/public/assets/{selection-context-rkLAW0dO.js → selection-context-C7DBYtd4.js} +1 -1
  119. package/dist/public/assets/{src-BHmw898V.js → src-Bd4ITI6l.js} +1 -1
  120. package/dist/public/assets/{telemetry-impl-DMjnHwnz.js → telemetry-impl-D34TS_t5.js} +1 -1
  121. package/dist/public/assets/{telemetry-startup-Dp5luYdb.js → telemetry-startup-S6YVb_-D.js} +1 -1
  122. package/dist/public/assets/{typing-burst-detector-CZm4MWxf.js → typing-burst-detector-BPhBcJhO.js} +1 -1
  123. package/dist/public/assets/{use-activity-panel-jNpqo2Qu.js → use-activity-panel-DAiQAul-.js} +1 -1
  124. package/dist/public/assets/{use-open-skill-CAlUFWAX.js → use-open-skill-BiGTEBAG.js} +1 -1
  125. package/dist/public/assets/{use-terminal-enabled-2ee2nusY.js → use-terminal-enabled-BPFt3ZjV.js} +1 -1
  126. package/dist/public/assets/{use-timeline-entry-diff-BFUF2Y2y.js → use-timeline-entry-diff-DI6wb0mp.js} +1 -1
  127. package/dist/public/index.html +19 -19
  128. package/dist/python3-DNGS4G3E-BgcDJ4cm.mjs +11 -0
  129. package/dist/{python3-DNGS4G3E-CixyRGKv.mjs → python3-DNGS4G3E-Cm5Hwa-u.mjs} +3 -3
  130. package/dist/registry-probes-CQ5QHLWA.mjs +16 -0
  131. package/dist/{removal-file-path-El1_tQoY.mjs → removal-file-path-DhnfL9uo.mjs} +1 -1
  132. package/dist/{repair-launch-json-CUEk_b1D.mjs → repair-launch-json-D4tGRImu.mjs} +1 -1
  133. package/dist/{repair-mcp-configs-D7S2EP20.mjs → repair-mcp-configs-CkXUYNJq.mjs} +1 -1
  134. package/dist/rg-XNF3R3II-BCapXTDd.mjs +1 -0
  135. package/dist/{rm-RTZG23RL-CVxZCS0d.mjs → rm-RTZG23RL-pdC15ghA.mjs} +1 -1
  136. package/dist/{rmdir-XTQXT7RK-DnFOfz6J.mjs → rmdir-XTQXT7RK-DcllfdyA.mjs} +1 -1
  137. package/dist/sed-JAPPVBEU-BogTEm4c.mjs +1 -0
  138. package/dist/{sleep-VZFPZFWA-C-QGmlTD.mjs → sleep-VZFPZFWA-Z-cEwS7i.mjs} +1 -1
  139. package/dist/sqlite3-TE5AIOTF-DqoN8a9C.mjs +1 -0
  140. package/dist/{sqlite3-TE5AIOTF-DVwda1Ow.mjs → sqlite3-TE5AIOTF-DxxxT49W.mjs} +3 -3
  141. package/dist/src-DxORHPwx.mjs +1 -0
  142. package/dist/src-uYPRavFi.mjs +16 -0
  143. package/dist/start-BVplvpm0.mjs +5 -0
  144. package/dist/start-Dp7OVBDP.mjs +1 -0
  145. package/dist/tar-MZQD7NO4-DEw7Py1-.mjs +1 -0
  146. package/dist/{tar-MZQD7NO4-BRGDcHqv.mjs → tar-MZQD7NO4-ljX84Spn.mjs} +2 -2
  147. package/dist/time-DEUO3QV2-BdkhaszE.mjs +1 -0
  148. package/dist/{timeout-VRKMCG72-Bn-zPLw8.mjs → timeout-VRKMCG72-BJshiKR9.mjs} +1 -1
  149. package/dist/token-store-Bmb3_0hU.mjs +2 -0
  150. package/dist/touch-DX2IJOQ4-DQk2E3PA.mjs +1 -0
  151. package/dist/{tr-2HXZRDSW-D6nqhlWa.mjs → tr-2HXZRDSW-B9XzLO_W.mjs} +1 -1
  152. package/dist/xan-UD7JYIL2-B0nl-bKu.mjs +1 -0
  153. package/dist/xargs-I6EZUCYF-DyMYQH4H.mjs +1 -0
  154. package/dist/yq-OAKYHSXH-BuWuWli6.mjs +1 -0
  155. package/package.json +4 -4
  156. package/dist/alias-JE7RI5QX-DJCUhA0w.mjs +0 -1
  157. package/dist/awk2-BBAGSFUB-e61UM1Y8.mjs +0 -1
  158. package/dist/bash-IJWYRKFO-L9NsSg-G.mjs +0 -1
  159. package/dist/chokidar-BXdru135.mjs +0 -3
  160. package/dist/chunk-A4JSPFCI-Ywh1N_m_.mjs +0 -6
  161. package/dist/chunk-D6CWQ5DW-CWPsf9FV.mjs +0 -5
  162. package/dist/chunk-GOV5EKKI-DH8052og.mjs +0 -9
  163. package/dist/chunk-MDDMCKUK-B8V-vwhF.mjs +0 -6
  164. package/dist/chunk-MIZPJHVH-D45kCv1L.mjs +0 -7
  165. package/dist/chunk-NAERJDUW-g_zD_t_X.mjs +0 -8
  166. package/dist/chunk-NUYSJFDK-C3CfS8pU.mjs +0 -7
  167. package/dist/chunk-OCLXQMOG-BgcVHeKY.mjs +0 -6
  168. package/dist/chunk-TLSUDHID-BY7gVdyC.mjs +0 -6
  169. package/dist/chunk-YTNYSM6T-3WjLDS_v.mjs +0 -11
  170. package/dist/constants-BxUVFv0v.mjs +0 -1
  171. package/dist/dist-C1xee7WC.mjs +0 -1
  172. package/dist/env-5EPCWSXR-hkmWHgd5.mjs +0 -1
  173. package/dist/expansion-VBDYWVZR-CPnYsIZl.mjs +0 -1
  174. package/dist/expr-YYCVMXE3-DtiMaNQl.mjs +0 -1
  175. package/dist/find-DH2ALKQS-44-asZtW.mjs +0 -1
  176. package/dist/flag-coverage-6JEX67RU-CvfAS1f3.mjs +0 -1
  177. package/dist/grep-2HUTXO5U-CoGVhBxG.mjs +0 -1
  178. package/dist/init-D_UJIf3q.mjs +0 -1
  179. package/dist/jq-LYZFFBZB-CXMPfDWj.mjs +0 -1
  180. package/dist/launch-json-removal-CzsGIWza.mjs +0 -1
  181. package/dist/loader-651GN5sB.mjs +0 -1
  182. package/dist/loader-DbUHvJUZ.mjs +0 -1
  183. package/dist/md-manager-BGnqyqi1-uHVeQn_6.mjs +0 -514
  184. package/dist/preview-CZSVVTzm.mjs +0 -2
  185. package/dist/preview-Cem1ca21.mjs +0 -1
  186. package/dist/printf-CX64KX2P-zCdxSgaG.mjs +0 -1
  187. package/dist/public/assets/FeedbackForm-DZj72gd9.js +0 -1
  188. package/dist/public/assets/ManagedArtifactProperties-BJLN3Tgw.js +0 -1
  189. package/dist/python3-DNGS4G3E-CRyO5yp1.mjs +0 -11
  190. package/dist/registry-probes-BtvDhVsS.mjs +0 -17
  191. package/dist/rg-XNF3R3II-ClllMprJ.mjs +0 -1
  192. package/dist/sed-JAPPVBEU-D49-i6JC.mjs +0 -1
  193. package/dist/sqlite3-TE5AIOTF-BK092fD6.mjs +0 -1
  194. package/dist/src-D9bFP3lk.mjs +0 -1
  195. package/dist/src-TUVVD6Gp.mjs +0 -16
  196. package/dist/start-D8Lh1b_o.mjs +0 -1
  197. package/dist/start-MojQH3H6.mjs +0 -5
  198. package/dist/tar-MZQD7NO4-D__44nPJ.mjs +0 -1
  199. package/dist/time-DEUO3QV2-BAt2bzlP.mjs +0 -1
  200. package/dist/touch-DX2IJOQ4-BJTz2DiT.mjs +0 -1
  201. package/dist/xan-UD7JYIL2-IybnHHpT.mjs +0 -1
  202. package/dist/xargs-I6EZUCYF-CpVYZvg1.mjs +0 -1
  203. package/dist/yq-OAKYHSXH-kqRGBS-8.mjs +0 -1
@@ -1,18 +1,18 @@
1
- import{a as e,r as t,t as n}from"./chunk-DXB73IDG-DFy9txNR.mjs";import{n as r,r as i,t as a}from"./chunk-74CEPOFO-BuzahJu2.mjs";import{open as o}from"node:fs/promises";var s=t(e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else{if(a===c)return o?NaN:1/0*(p?-1:1);o+=2**r,a-=l}return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}}),c=t((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}}),l=t((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=l,n.disable=o,n.enable=i,n.enabled=s,n.humanize=c(),n.destroy=u,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(typeof t>`u`?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function l(e){return e instanceof Error?e.stack||e.message:e}function u(){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 n.enable(n.load()),n}t.exports=n}),u=t((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})(),e.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`.split(`.`);function n(){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 e;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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=l()(e);var{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}}),d=t((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}}),f=t((e,t)=>{var r=n(`os`),i=n(`tty`),a=d(),{env:o}=process,s;a(`no-color`)||a(`no-colors`)||a(`color=false`)||a(`color=never`)?s=0:(a(`color`)||a(`colors`)||a(`color=true`)||a(`color=always`))&&(s=1),`FORCE_COLOR`in o&&(s=o.FORCE_COLOR===`true`?1:o.FORCE_COLOR===`false`?0:o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3));function c(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,t){if(s===0)return 0;if(a(`color=16m`)||a(`color=full`)||a(`color=truecolor`))return 3;if(a(`color=256`))return 2;if(e&&!t&&s===void 0)return 0;let n=s||0;if(o.TERM===`dumb`)return n;if(process.platform===`win32`){let e=r.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in o)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in o)||o.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in o)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION);if(o.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in o){let e=parseInt((o.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(o.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||`COLORTERM`in o?1:n}function u(e){return c(l(e,e&&e.isTTY))}t.exports={supportsColor:u,stdout:c(l(!0,i.isatty(1))),stderr:c(l(!0,i.isatty(2)))}}),p=t((e,t)=>{var r=n(`tty`),i=n(`util`);e.init=p,e.log=c,e.formatArgs=o,e.save=u,e.load=d,e.useColors=a,e.destroy=i.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{let t=f();t&&(t.stderr||t).level>=2&&(e.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{}e.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function a(){return`colors`in e.inspectOpts?!!e.inspectOpts.colors:r.isatty(process.stderr.fd)}function o(e){let{namespace:n,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${n} \x1B[0m`;e[0]=a+e[0].split(`
1
+ import{n as e,r as t,t as n}from"./chunk-74CEPOFO-BuzahJu2.mjs";import{a as r,r as i,t as a}from"./chunk-DXB73IDG-DFy9txNR.mjs";import{open as o}from"node:fs/promises";var s=i(e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else{if(a===c)return o?NaN:1/0*(p?-1:1);o+=2**r,a-=l}return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}}),c=i((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}}),l=i((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=l,n.disable=o,n.enable=i,n.enabled=s,n.humanize=c(),n.destroy=u,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(typeof t>`u`?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function l(e){return e instanceof Error?e.stack||e.message:e}function u(){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 n.enable(n.load()),n}t.exports=n}),u=i((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!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`."))}})(),e.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`.split(`.`);function n(){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 e;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&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=l()(e);var{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}}),d=i((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}}),f=i((e,t)=>{var n=a(`os`),r=a(`tty`),i=d(),{env:o}=process,s;i(`no-color`)||i(`no-colors`)||i(`color=false`)||i(`color=never`)?s=0:(i(`color`)||i(`colors`)||i(`color=true`)||i(`color=always`))&&(s=1),`FORCE_COLOR`in o&&(s=o.FORCE_COLOR===`true`?1:o.FORCE_COLOR===`false`?0:o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3));function c(e){return e!==0&&{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,t){if(s===0)return 0;if(i(`color=16m`)||i(`color=full`)||i(`color=truecolor`))return 3;if(i(`color=256`))return 2;if(e&&!t&&s===void 0)return 0;let r=s||0;if(o.TERM===`dumb`)return r;if(process.platform===`win32`){let e=n.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in o)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in o)||o.CI_NAME===`codeship`?1:r;if(`TEAMCITY_VERSION`in o)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION);if(o.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in o){let e=parseInt((o.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(o.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||`COLORTERM`in o?1:r}function u(e){return c(l(e,e&&e.isTTY))}t.exports={supportsColor:u,stdout:c(l(!0,r.isatty(1))),stderr:c(l(!0,r.isatty(2)))}}),p=i((e,t)=>{var n=a(`tty`),r=a(`util`);e.init=p,e.log=c,e.formatArgs=o,e.save=u,e.load=d,e.useColors=i,e.destroy=r.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{let t=f();t&&(t.stderr||t).level>=2&&(e.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{}e.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function i(){return`colors`in e.inspectOpts?!!e.inspectOpts.colors:n.isatty(process.stderr.fd)}function o(e){let{namespace:n,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${n} \x1B[0m`;e[0]=a+e[0].split(`
2
2
  `).join(`
3
- `+a),e.push(i+`m+`+t.exports.humanize(this.diff)+`\x1B[0m`)}else e[0]=s()+n+` `+e[0]}function s(){return e.inspectOpts.hideDate?``:new Date().toISOString()+` `}function c(...t){return process.stderr.write(i.formatWithOptions(e.inspectOpts,...t)+`
4
- `)}function u(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function d(){return process.env.DEBUG}function p(t){t.inspectOpts={};let n=Object.keys(e.inspectOpts);for(let r=0;r<n.length;r++)t.inspectOpts[n[r]]=e.inspectOpts[n[r]]}t.exports=l()(e);var{formatters:m}=t.exports;m.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split(`
5
- `).map(e=>e.trim()).join(` `)},m.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}}),m=t((e,t)=>{t.exports=typeof process>`u`||process.type===`renderer`||process.browser===!0||process.__nwjs?u():p()}),h=`End-Of-Stream`,g=class extends Error{constructor(){super(h),this.name=`EndOfStreamError`}},ee=class extends Error{constructor(e=`The operation was aborted`){super(e),this.name=`AbortError`}},te=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){let n=await this.read(e,t);return this.peekQueue.push(e.subarray(0,n)),n}async read(e,t=!1){if(e.length===0)return 0;let n=this.readFromPeekBuffer(e);if(this.endOfStream||(n+=await this.readRemainderFromStream(e.subarray(n),t)),n===0&&!t)throw new g;return n}readFromPeekBuffer(e){let t=e.length,n=0;for(;this.peekQueue.length>0&&t>0;){let r=this.peekQueue.pop();if(!r)throw Error(`peekData should be defined`);let i=Math.min(r.length,t);e.set(r.subarray(0,i),n),n+=i,t-=i,i<r.length&&this.peekQueue.push(r.subarray(i))}return n}async readRemainderFromStream(e,t){let n=0;for(;n<e.length&&!this.endOfStream;){if(this.interrupted)throw new ee;let r=await this.readFromStream(e.subarray(n),t);if(r===0)break;n+=r}if(!t&&n<e.length)throw new g;return n}},ne=class extends te{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}},re=class extends ne{async readFromStream(e,t){if(e.length===0)return 0;let n=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return n.done&&(this.endOfStream=n.done),n.value?(e.set(n.value),n.value.length):0}},ie=class extends te{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){let n=Math.min(t.length,e.length);return e.set(t.subarray(0,n)),this.buffer=n<t.length?t.subarray(n):null,n}async readFromStream(e,t){if(e.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(e,this.buffer));n<e.length&&!this.endOfStream;){let t=await this.reader.read();if(t.done){this.endOfStream=!0;break}t.value&&(n+=this.writeChunk(e.subarray(n),t.value))}if(!t&&n===0&&this.endOfStream)throw new g;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}};function ae(e){try{let t=e.getReader({mode:`byob`});return t instanceof ReadableStreamDefaultReader?new ie(t):new re(t)}catch(t){if(t instanceof TypeError)return new ie(e.getReader());throw t}}var _=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 n=new Uint8Array(e.len);if(await this.readBuffer(n,{position:t})<e.len)throw new g;return e.get(n,0)}async peekToken(e,t=this.position){let n=new Uint8Array(e.len);if(await this.peekBuffer(n,{position:t})<e.len)throw new g;return e.get(n,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new g;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new g;return e.get(this.numBuffer,0)}async ignore(e){if(e<0)throw RangeError(`ignore length must be ≥ 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 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()}},oe=256e3,se=class extends _{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=t?.fileInfo??{}}async readBuffer(e,t){let n=this.normalizeOptions(e,t),r=n.position-this.position;if(r>0)return await this.ignore(r),this.readBuffer(e,t);if(r<0)throw Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;let i=await this.streamReader.read(e.subarray(0,n.length),n.mayBeLess);if(this.position+=i,(!t||!t.mayBeLess)&&i<n.length)throw new g;return i}async peekBuffer(e,t){let n=this.normalizeOptions(e,t),r=0;if(n.position){let t=n.position-this.position;if(t>0){let i=new Uint8Array(n.length+t);return r=await this.peekBuffer(i,{mayBeLess:n.mayBeLess}),e.set(i.subarray(t)),r-t}if(t<0)throw Error(`Cannot peek from a negative offset in a stream`)}if(n.length>0){try{r=await this.streamReader.peek(e.subarray(0,n.length),n.mayBeLess)}catch(e){if(t?.mayBeLess&&e instanceof g)return 0;throw e}if(!n.mayBeLess&&r<n.length)throw new g}return r}async ignore(e){if(e<0)throw RangeError(`ignore length must be ≥ 0 bytes`);let t=Math.min(oe,e),n=new Uint8Array(t),r=0;for(;r<e;){let i=e-r,a=await this.readBuffer(n,{length:Math.min(t,i)});if(a<0)return a;r+=a}return r}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}},ce=class extends _{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 n=await this.peekBuffer(e,t);return this.position+=n,n}async peekBuffer(e,t){let n=this.normalizeOptions(e,t),r=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&r<n.length)throw new g;return e.set(this.uint8Array.subarray(n.position,n.position+r)),r}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}},le=class extends _{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 n=await this.peekBuffer(e,t);return this.position+=n,n}async peekBuffer(e,t){let n=this.normalizeOptions(e,t),r=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&r<n.length)throw new g;let i=await this.blob.slice(n.position,n.position+r).arrayBuffer();return e.set(new Uint8Array(i)),r}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};function ue(e,t){let n=ae(e),r=t??{},i=r.onClose;return r.onClose=async()=>{if(await n.close(),i)return i()},new se(n,r)}function de(e,t){return new ce(e,t)}function fe(e,t){return new le(e,t)}(class e extends _{static async fromFile(t){let n=await o(t,`r`),r=await n.stat();return new e(n,{fileInfo:{path:t,size:r.size}})}constructor(e,t){super(t),this.fileHandle=e,this.fileInfo=t.fileInfo}async readBuffer(e,t){let n=this.normalizeOptions(e,t);if(this.position=n.position,n.length===0)return 0;let r=await this.fileHandle.read(e,0,n.length,n.position);if(this.position+=r.bytesRead,r.bytesRead<n.length&&(!t||!t.mayBeLess))throw new g;return r.bytesRead}async peekBuffer(e,t){let n=this.normalizeOptions(e,t),r=await this.fileHandle.read(e,0,n.length,n.position);if(!n.mayBeLess&&r.bytesRead<n.length)throw new g;return r.bytesRead}async close(){return await this.fileHandle.close(),super.close()}setPosition(e){this.position=e}supportsRandomAccess(){return!0}}).fromFile,e(s(),1);var v={128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`},pe={};for(let[e,t]of Object.entries(v))pe[t]=Number.parseInt(e,10);var me;function he(){if(!(typeof globalThis.TextDecoder>`u`))return me??=new globalThis.TextDecoder(`utf-8`)}var y=32768,b=65533;function ge(e,t=`utf-8`){switch(t.toLowerCase()){case`utf-8`:case`utf8`:{let t=he();return t?t.decode(e):ve(e)}case`utf-16le`:return ye(e);case`us-ascii`:case`ascii`:return be(e);case`latin1`:case`iso-8859-1`:return xe(e);case`windows-1252`:return Se(e);default:throw RangeError(`Encoding '${t}' not supported`)}}function x(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function S(e,t,n){t.push(n),t.length>=y&&x(e,t)}function _e(e,t,n){if(n<=65535){S(e,t,n);return}n-=65536,S(e,t,55296+(n>>10)),S(e,t,56320+(n&1023))}function ve(e){let t=[],n=[],r=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(r=3);r<e.length;){let i=e[r];if(i<=127){S(t,n,i),r++;continue}if(i<194||i>244){S(t,n,b),r++;continue}if(i<=223){if(r+1>=e.length){S(t,n,b),r++;continue}let a=e[r+1];if((a&192)!=128){S(t,n,b),r++;continue}S(t,n,(i&31)<<6|a&63),r+=2;continue}if(i<=239){if(r+2>=e.length){S(t,n,b),r++;continue}let a=e[r+1],o=e[r+2];if(!((a&192)==128&&(o&192)==128&&!(i===224&&a<160)&&!(i===237&&a>=160))){S(t,n,b),r++;continue}S(t,n,(i&15)<<12|(a&63)<<6|o&63),r+=3;continue}if(r+3>=e.length){S(t,n,b),r++;continue}let a=e[r+1],o=e[r+2],s=e[r+3];if(!((a&192)==128&&(o&192)==128&&(s&192)==128&&!(i===240&&a<144)&&!(i===244&&a>143))){S(t,n,b),r++;continue}_e(t,n,(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63),r+=4}return x(t,n),t.join(``)}function ye(e){let t=[],n=[],r=e.length,i=0;for(;i+1<r;){let a=e[i]|e[i+1]<<8;if(i+=2,a>=55296&&a<=56319){if(i+1<r){let r=e[i]|e[i+1]<<8;r>=56320&&r<=57343?(S(t,n,a),S(t,n,r),i+=2):S(t,n,b)}else S(t,n,b);continue}if(a>=56320&&a<=57343){S(t,n,b);continue}S(t,n,a)}return i<r&&S(t,n,b),x(t,n),t.join(``)}function be(e){let t=[];for(let n=0;n<e.length;n+=y){let r=Math.min(e.length,n+y),i=Array(r-n);for(let t=n,a=0;t<r;t++,a++)i[a]=e[t]&127;t.push(String.fromCharCode.apply(null,i))}return t.join(``)}function xe(e){let t=[];for(let n=0;n<e.length;n+=y){let r=Math.min(e.length,n+y),i=Array(r-n);for(let t=n,a=0;t<r;t++,a++)i[a]=e[t];t.push(String.fromCharCode.apply(null,i))}return t.join(``)}function Se(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r],a=i>=128&&i<=159?v[i]:void 0;n+=a??String.fromCharCode(i),n.length>=y&&(t.push(n),n=``)}return n&&t.push(n),t.join(``)}function C(e){return new DataView(e.buffer,e.byteOffset)}var Ce={len:1,get(e,t){return C(e).getUint8(t)},put(e,t,n){return C(e).setUint8(t,n),t+1}},w={len:2,get(e,t){return C(e).getUint16(t,!0)},put(e,t,n){return C(e).setUint16(t,n,!0),t+2}},T={len:2,get(e,t){return C(e).getUint16(t)},put(e,t,n){return C(e).setUint16(t,n),t+2}},E={len:4,get(e,t){return C(e).getUint32(t,!0)},put(e,t,n){return C(e).setUint32(t,n,!0),t+4}},we={len:4,get(e,t){return C(e).getUint32(t)},put(e,t,n){return C(e).setUint32(t,n),t+4}},Te={len:4,get(e,t){return C(e).getInt32(t)},put(e,t,n){return C(e).setInt32(t,n),t+4}},Ee={len:8,get(e,t){return C(e).getBigUint64(t,!0)},put(e,t,n){return C(e).setBigUint64(t,n,!0),t+8}},D=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t=0){return ge(e.subarray(t,t+this.len),this.encoding)}},De=e(m(),1),O={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},k={get(e){return{signature:E.get(e,0),compressedSize:E.get(e,8),uncompressedSize:E.get(e,12)}},len:16},Oe={get(e){let t=w.get(e,6);return{signature:E.get(e,0),minVersion:w.get(e,4),dataDescriptor:!!(t&8),compressedMethod:w.get(e,8),compressedSize:E.get(e,18),uncompressedSize:E.get(e,22),filenameLength:w.get(e,26),extraFieldLength:w.get(e,28),filename:null}},len:30},ke={get(e){return{signature:E.get(e,0),nrOfThisDisk:w.get(e,4),nrOfThisDiskWithTheStart:w.get(e,6),nrOfEntriesOnThisDisk:w.get(e,8),nrOfEntriesOfSize:w.get(e,10),sizeOfCd:E.get(e,12),offsetOfStartOfCd:E.get(e,16),zipFileCommentLength:w.get(e,20)}},len:22},Ae={get(e){let t=w.get(e,8);return{signature:E.get(e,0),minVersion:w.get(e,6),dataDescriptor:!!(t&8),compressedMethod:w.get(e,10),compressedSize:E.get(e,20),uncompressedSize:E.get(e,24),filenameLength:w.get(e,28),extraFieldLength:w.get(e,30),fileCommentLength:w.get(e,32),relativeOffsetOfLocalHeader:E.get(e,42),filename:null}},len:46};function je(e){let t=new Uint8Array(E.len);return E.put(t,0,e),t}var A=(0,De.default)(`tokenizer:inflate`),j=262144,Me=je(O.DataDescriptor),M=je(O.EndOfCentralDirectory),N=class e{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(j)}async isZip(){return await this.peekSignature()===O.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(E)}async findEndOfCentralDirectoryLocator(){let e=this.tokenizer,t=Math.min(16384,e.fileInfo.size),n=this.syncBuffer.subarray(0,t);await this.tokenizer.readBuffer(n,{position:e.fileInfo.size-t});for(let r=n.length-4;r>=0;r--)if(n[r]===M[0]&&n[r+1]===M[1]&&n[r+2]===M[2]&&n[r+3]===M[3])return e.fileInfo.size-t+r;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){A(`Cannot reading central-directory without random-read support`);return}A(`Reading central-directory...`);let e=this.tokenizer.position,t=await this.findEndOfCentralDirectoryLocator();if(t>0){A(`Central-directory 32-bit signature found`);let n=await this.tokenizer.readToken(ke,t),r=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let e=0;e<n.nrOfEntriesOfSize;++e){let t=await this.tokenizer.readToken(Ae);if(t.signature!==O.CentralFileHeader)throw Error(`Expected Central-File-Header signature`);t.filename=await this.tokenizer.readToken(new D(t.filenameLength,`utf-8`)),await this.tokenizer.ignore(t.extraFieldLength),await this.tokenizer.ignore(t.fileCommentLength),r.push(t),A(`Add central-directory file-entry: n=${e+1}/${r.length}: filename=${r[e].filename}`)}return this.tokenizer.setPosition(e),r}this.tokenizer.setPosition(e)}async unzip(e){let t=await this.readCentralDirectory();if(t)return this.iterateOverCentralDirectory(t,e);let n=!1;do{let t=await this.readLocalFileHeader();if(!t)break;let r=e(t);n=!!r.stop;let i;if(await this.tokenizer.ignore(t.extraFieldLength),t.dataDescriptor&&t.compressedSize===0){let e=[],n=j;A(`Compressed-file-size unknown, scanning for next data-descriptor-signature....`);let i=-1;for(;i<0&&n===j;){n=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),i=Ne(this.syncBuffer.subarray(0,n),Me);let t=i>=0?i:n;if(r.handler){let n=new Uint8Array(t);await this.tokenizer.readBuffer(n),e.push(n)}else await this.tokenizer.ignore(t)}A(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),r.handler&&await this.inflate(t,Pe(e),r.handler)}else r.handler?(A(`Reading compressed-file-data: ${t.compressedSize} bytes`),i=new Uint8Array(t.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(t,i,r.handler)):(A(`Ignoring compressed-file-data: ${t.compressedSize} bytes`),await this.tokenizer.ignore(t.compressedSize));if(A(`Reading data-descriptor at pos=${this.tokenizer.position}`),t.dataDescriptor&&(await this.tokenizer.readToken(k)).signature!==134695760)throw Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-k.len}`)}while(!n)}async iterateOverCentralDirectory(e,t){for(let n of e){let e=t(n);if(e.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);let t=await this.readLocalFileHeader();if(t){await this.tokenizer.ignore(t.extraFieldLength);let r=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(r),await this.inflate(t,r,e.handler)}}if(e.stop)break}}async inflate(t,n,r){if(t.compressedMethod===0)return r(n);if(t.compressedMethod!==8)throw Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);return A(`Decompress filename=${t.filename}, compressed-size=${n.length}`),r(await e.decompressDeflateRaw(n))}static async decompressDeflateRaw(e){let t=new ReadableStream({start(t){t.enqueue(e),t.close()}}),n=new DecompressionStream(`deflate-raw`),r=t.pipeThrough(n);try{let e=await new Response(r).arrayBuffer();return new Uint8Array(e)}catch(e){let t=e instanceof Error?`Failed to deflate ZIP entry: ${e.message}`:`Unknown decompression error in ZIP entry`;throw TypeError(t)}}async readLocalFileHeader(){let e=await this.tokenizer.peekToken(E);if(e===O.LocalFileHeader){let e=await this.tokenizer.readToken(Oe);return e.filename=await this.tokenizer.readToken(new D(e.filenameLength,`utf-8`)),e}if(e===O.CentralFileHeader)return!1;throw Error(e===3759263696?`Encrypted ZIP`:`Unexpected signature`)}};function Ne(e,t){let n=e.length,r=t.length;if(r>n)return-1;for(let i=0;i<=n-r;i++){let n=!0;for(let a=0;a<r;a++)if(e[i+a]!==t[a]){n=!1;break}if(n)return i}return-1}function Pe(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}var Fe=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(t){let n=new Uint8Array(1024),r=await e.readBuffer(n,{mayBeLess:!0});if(r===0){t.close();return}t.enqueue(n.subarray(0,r))}}).pipeThrough(new DecompressionStream(`gzip`))}};new globalThis.TextDecoder(`utf8`),new globalThis.TextEncoder,Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Ie(e){let{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function Le(e,t){if(t===`utf-16le`){let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t.push(r&255,r>>8&255)}return t}if(t===`utf-16be`){let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t.push(r>>8&255,r&255)}return t}return[...e].map(e=>e.charCodeAt(0))}function Re(e,t=0){let n=Number.parseInt(new D(6).get(e,148).replace(/\0.*$/,``).trim(),8);if(Number.isNaN(n))return!1;let r=256;for(let n=t;n<t+148;n++)r+=e[n];for(let n=t+156;n<t+512;n++)r+=e[n];return n===r}var ze={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},Be=`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`.split(`,`),Ve=`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`.split(`,`),P=4100,He=P-2,F=1048576,I=1024,Ue=2**31-1,L=16777216,R=F,z=F,We=L,Ge=1,B=100,V=L,H=64,U=R,Ke=256,qe=512,Je=L,Ye=512,Xe=512,W=256,G=R,Ze=R,Qe=R,$e=L,et=new Set([`Unexpected signature`,`Encrypted ZIP`,`Expected Central-File-Header signature`]),tt=[`ZIP entry count exceeds `,`Unsupported ZIP compression method:`,`ZIP entry compressed data exceeds `,`ZIP entry decompressed data exceeds `,`Expected data-descriptor-signature at position `],nt=new Set([`Z_BUF_ERROR`,`Z_DATA_ERROR`,`ERR_INVALID_STATE`]),K=class extends Error{};function rt(e){let t=e?.streamReader;if(t?.constructor?.name!==`WebStreamByobReader`)return e;let{reader:n}=t,r=async()=>{await n.cancel(),n.releaseLock()};return t.close=r,t.abort=async()=>{t.interrupted=!0,await r()},e}function q(e,t,n){if(!Number.isFinite(e)||e<0||e>t)throw new K(`${n} has invalid size ${e} (maximum ${t} bytes)`);return e}async function J(e,t,{maximumLength:n=L,reason:r=`skip`}={}){let i=q(t,n,r);await e.ignore(i)}async function Y(e,t,n,{maximumLength:r=t.length,reason:i=`read`}={}){let a=q(n?.length??t.length,r,i);return e.readBuffer(t,{...n,length:a})}async function it(e,{maximumLength:t=F}={}){let n=new ReadableStream({start(t){t.enqueue(e),t.close()}}).pipeThrough(new DecompressionStream(`deflate-raw`)).getReader(),r=[],i=0;try{for(;;){let{done:e,value:a}=await n.read();if(e)break;if(i+=a.length,i>t)throw await n.cancel(),Error(`ZIP entry decompressed data exceeds ${t} bytes`);r.push(a)}}finally{n.releaseLock()}let a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.length;return a}var at=134695760,X=16,ot=X-1;function st(e,t){if(e.length<X)return-1;let n=e.length-X;for(let r=0;r<=n;r++)if(E.get(e,r)===at&&E.get(e,r+8)===t+r)return r;return-1}function ct(e){return!!(e.codePointAt(0)&32)}function lt(e,t){let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}async function ut(e,{shouldBuffer:t,maximumLength:n=F}={}){let{syncBuffer:r}=e,{length:i}=r,a=[],o=0;for(;;){let s=await e.tokenizer.peekBuffer(r,{mayBeLess:!0}),c=st(r.subarray(0,s),o),l=c>=0?0:s===i?Math.min(ot,s-1):0,u=c>=0?c:s-l;if(u===0)break;if(o+=u,o>n)throw Error(`ZIP entry compressed data exceeds ${n} bytes`);if(t){let t=new Uint8Array(u);await e.tokenizer.readBuffer(t),a.push(t)}else await e.tokenizer.ignore(u);if(c>=0)break}if(Q(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=o),t)return lt(a,o)}function dt(e,t){return Q(e.tokenizer)?Math.max(0,L-(e.tokenizer.position-t)):Math.max(0,F-e.knownSizeDescriptorScannedBytes)}async function ft(e,t,{shouldBuffer:n,maximumDescriptorLength:r=F}={}){if(t.dataDescriptor&&t.compressedSize===0)return ut(e,{shouldBuffer:n,maximumLength:r});if(!n){await J(e.tokenizer,t.compressedSize,{maximumLength:Q(e.tokenizer)?F:e.tokenizer.fileInfo.size,reason:`ZIP entry compressed data`});return}let i=bt(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>i)throw Error(`ZIP entry compressed data exceeds ${i} bytes`);let a=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(a),a}N.prototype.inflate=async function(e,t,n){if(e.compressedMethod===0)return n(t);if(e.compressedMethod!==8)throw Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);return n(await it(t,{maximumLength:F}))},N.prototype.unzip=async function(e){let t=!1,n=0,r=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if($(this.tokenizer,r,L))throw new K(`ZIP stream probing exceeds ${L} bytes`);let i=await this.readLocalFileHeader();if(!i)break;if(n++,n>I)throw Error(`ZIP entry count exceeds ${I}`);let a=e(i);t=!!a.stop,await this.tokenizer.ignore(i.extraFieldLength);let o=await ft(this,i,{shouldBuffer:!!a.handler,maximumDescriptorLength:Math.min(F,dt(this,r))});if(a.handler&&await this.inflate(i,o,a.handler),i.dataDescriptor){let e=new Uint8Array(X);if(await this.tokenizer.readBuffer(e),E.get(e,0)!==at)throw Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-e.length}`)}if($(this.tokenizer,r,L))throw new K(`ZIP stream probing exceeds ${L} bytes`)}while(!t)};function pt(e,t){let n=e.getReader(),r=0,i=!1,a=!1,o=async e=>{i||a||(a=!0,await n.cancel(e))};return new ReadableStream({async pull(e){if(r>=t){e.close(),await o();return}let{done:a,value:s}=await n.read();if(a||!s){i=!0,e.close();return}let c=t-r;if(s.length>c){e.enqueue(s.subarray(0,c)),r+=c,e.close(),await o();return}e.enqueue(s),r+=s.length},async cancel(e){await o(e)}})}async function mt(e,t){return new Dt(t).fromBuffer(e)}function ht(e){switch(e=e.toLowerCase(),e){case`application/epub+zip`:return{ext:`epub`,mime:e};case`application/vnd.oasis.opendocument.text`:return{ext:`odt`,mime:e};case`application/vnd.oasis.opendocument.text-template`:return{ext:`ott`,mime:e};case`application/vnd.oasis.opendocument.spreadsheet`:return{ext:`ods`,mime:e};case`application/vnd.oasis.opendocument.spreadsheet-template`:return{ext:`ots`,mime:e};case`application/vnd.oasis.opendocument.presentation`:return{ext:`odp`,mime:e};case`application/vnd.oasis.opendocument.presentation-template`:return{ext:`otp`,mime:e};case`application/vnd.oasis.opendocument.graphics`:return{ext:`odg`,mime:e};case`application/vnd.oasis.opendocument.graphics-template`:return{ext:`otg`,mime:e};case`application/vnd.openxmlformats-officedocument.presentationml.slideshow`:return{ext:`ppsx`,mime:e};case`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`:return{ext:`xlsx`,mime:e};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:e};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:e};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:e};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:e};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:e};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`}}}function Z(e,t,n){n={offset:0,...n};for(let[r,i]of t.entries())if(n.mask){if(i!==(n.mask[r]&e[r+n.offset]))return!1}else if(i!==e[r+n.offset])return!1;return!0}function gt(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):P}function _t(e,t,n){return n===void 0?e.read(t):(n.throwIfAborted(),new Promise((r,i)=>{let a=()=>{n.removeEventListener(`abort`,o)},o=()=>{let t=n.reason;a(),(async()=>{try{await e.cancel(t)}catch{}})(),i(t)};n.addEventListener(`abort`,o,{once:!0}),(async()=>{try{let n=await e.read(t);a(),r(n)}catch(e){a(),i(e)}})()}))}function vt(e){return Number.isFinite(e)?Math.max(0,Math.min(He,Math.trunc(e))):0}function yt(e){return Number.isFinite(e)?Math.max(0,e):2**53-1}function Q(e){let t=e.fileInfo.size;return!Number.isFinite(t)||t===2**53-1}function $(e,t,n){return Q(e)&&e.position-t>n}function bt(e){let t=e.fileInfo.size,n=Number.isFinite(t)?Math.max(0,t-e.position):2**53-1;return Math.min(n,Ue)}function xt(e){if(e instanceof g||e instanceof K)return!0;if(!(e instanceof Error))return!1;if(et.has(e.message)||nt.has(e.code))return!0;for(let t of tt)if(e.message.startsWith(t))return!0;return!1}function St(e,t=F){let n=[e.compressedSize,e.uncompressedSize];for(let e of n)if(!Number.isFinite(e)||e<0||e>t)return!1;return!0}function Ct(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function wt(e,t){t.startsWith(`word/`)&&(e.hasWordDirectory=!0),t.startsWith(`ppt/`)&&(e.hasPresentationDirectory=!0),t.startsWith(`xl/`)&&(e.hasSpreadsheetDirectory=!0),t.startsWith(`3D/`)&&t.endsWith(`.model`)&&(e.hasThreeDimensionalModelEntry=!0)}function Tt(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:`docx`,mime:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`};if(e.hasPresentationDirectory)return{ext:`pptx`,mime:`application/vnd.openxmlformats-officedocument.presentationml.presentation`};if(e.hasSpreadsheetDirectory)return{ext:`xlsx`,mime:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`};if(e.hasThreeDimensionalModelEntry)return{ext:`3mf`,mime:`model/3mf`}}}function Et(e){let t=e.indexOf(`.main+xml"`);if(t===-1){let t=`application/vnd.ms-package.3dmanufacturing-3dmodel+xml`;return e.includes(`ContentType="${t}"`)?t:void 0}let n=e.slice(0,t),r=n.lastIndexOf(`"`);return n.slice(r+1)}var Dt=class e{constructor(e){let t=vt(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 rt(ue(e,this.getTokenizerOptions()))}async parseTokenizer(e,t=0){this.detectionReentryCount=t;let n=e.position;for(let t of this.detectors){let r;try{r=await t.detect(e)}catch(e){if(e instanceof g||e instanceof K)return;throw e}if(r)return r;if(n!==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 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(de(t,this.getTokenizerOptions()))}async fromBlob(e){this.options.signal?.throwIfAborted();let t=fe(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 n=gt(t?.sampleSize??P),r,i,a=e.getReader({mode:`byob`});try{let{value:e,done:t}=await _t(a,new Uint8Array(n),this.options.signal);if(i=e,!t&&e)try{r=await this.fromBuffer(e.subarray(0,n))}catch(e){if(!(e instanceof g))throw e;r=void 0}i=e}finally{a.releaseLock()}let o=new TransformStream({async start(e){e.enqueue(i)},transform(e,t){t.enqueue(e)}}),s=e.pipeThrough(o);return s.fileType=r,s}async detectGzip(t){if(this.gzipProbeDepth>=Ge)return{ext:`gz`,mime:`application/gzip`};let n=pt(new Fe(t).inflate(),We),r=Q(t),i,a,o,s;if(r){let t=new AbortController;i=setTimeout(()=>{t.abort(new DOMException(`Operation timed out after ${B} ms`,`TimeoutError`))},B),a=this.options.signal===void 0?t.signal:AbortSignal.any([this.options.signal,t.signal]),o=new e({...this.options,signal:a}),o.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{s=await(o??this).fromStream(n)}catch(e){if(e?.name===`AbortError`&&a?.reason?.name!==`TimeoutError`)throw e}finally{clearTimeout(i),r||this.gzipProbeDepth--}return s?.ext===`tar`?{ext:`tar.gz`,mime:`application/gzip`}:{ext:`gz`,mime:`application/gzip`}}check(e,t){return Z(this.buffer,e,t)}checkString(e,t){return this.check(Le(e,t?.encoding),t)}detectConfident=async e=>{if(this.buffer=new Uint8Array(P),e.fileInfo.size===void 0&&(e.fileInfo.size=2**53-1),this.tokenizer=e,Q(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>=W?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 J(e,6,{maximumLength:6,reason:`ID3 header prefix`});let t=await e.readToken(ze),n=Q(e);if(!Number.isFinite(t)||t<0||n&&(t>V||e.position+t>V))return;if(e.position+t>e.fileInfo.size)return n?void 0:{ext:`mp3`,mime:`audio/mpeg`};try{await J(e,t,{maximumLength:n?V:e.fileInfo.size,reason:`ID3 payload`})}catch(e){if(e instanceof g)return;throw e}return this.detectionReentryCount>=W?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,n=Ct();try{await new N(e).unzip(e=>{wt(n,e.filename);let r=e.filename===`[Content_Types].xml`,i=Tt(n);if(!r&&i)return t=i,{stop:!0};switch(e.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 St(e,z)?{async handler(e){t=ht(new TextDecoder(`utf-8`).decode(e).trim())},stop:!0}:{};case`[Content_Types].xml`:return n.hasContentTypesEntry=!0,St(e,z)?(n.isParsingContentTypes=!0,{async handler(e){let r=Et(new TextDecoder(`utf-8`).decode(e));r&&(t=ht(r)),n.hasParsedContentTypesEntry=!0,n.isParsingContentTypes=!1},stop:!0}):(n.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(e.filename)?(t={ext:`apk`,mime:`application/vnd.android.package-archive`},{stop:!0}):{}}})}catch(e){if(!xt(e))throw e;n.isParsingContentTypes&&(n.isParsingContentTypes=!1,n.hasUnparseableContentTypes=!0)}return t??Tt(n)??{ext:`zip`,mime:`application/zip`}}if(this.checkString(`OggS`)){await e.ignore(28);let t=new Uint8Array(8);return await e.readBuffer(t),Z(t,[79,112,117,115,72,101,97,100])?{ext:`opus`,mime:`audio/ogg; codecs=opus`}:Z(t,[128,116,104,101,111,114,97])?{ext:`ogv`,mime:`video/ogg`}:Z(t,[1,118,105,100,101,111,0])?{ext:`ogm`,mime:`video/ogg`}:Z(t,[127,70,76,65,67])?{ext:`oga`,mime:`audio/ogg`}:Z(t,[83,112,101,101,120,32,32])?{ext:`spx`,mime:`audio/ogg`}:Z(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 e=await this.readTiffHeader(!1);if(e)return e}if(this.check([77,77])){let e=await this.readTiffHeader(!0);if(e)return e}if(this.checkString(`MAC `))return{ext:`ape`,mime:`audio/ape`};if(this.check([26,69,223,163])){async function t(){let t=await e.peekNumber(Ce),n=128,r=0;for(;(t&n)===0&&n!==0;)++r,n>>=1;let i=new Uint8Array(r+1);return await Y(e,i,void 0,{maximumLength:i.length,reason:`EBML field`}),i}async function n(){let e=await t(),n=await t();n[0]^=128>>n.length-1;let r=Math.min(6,n.length),i=new DataView(e.buffer),a=new DataView(n.buffer,n.length-r,r);return{id:Ie(i),len:Ie(a)}}async function r(t){let r=0;for(;t>0;){if(r++,r>Ke||$(e,a,L))return;let i=e.position,o=await n();if(o.id===17026){if(o.len>H)return;let t=q(o.len,H,`EBML DocType`);return(await e.readToken(new D(t))).replaceAll(/\00.*$/g,``)}if(Q(e)&&(!Number.isFinite(o.len)||o.len<0||o.len>U)||(await J(e,o.len,{maximumLength:Q(e)?U:e.fileInfo.size,reason:`EBML payload`}),--t,e.position<=i))return}}let i=await n(),a=e.position;switch(await r(i.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 e=we.get(this.buffer,4),t=T.get(this.buffer,6);if(e>0&&e<=30)return{ext:`macho`,mime:`application/x-mach-binary`};if(t>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 e=new D(4,`latin1`).get(this.buffer,2);if(e.match(`^d*`)&&e>=1e3&&e<=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 D(13,`ascii`))===`debian-binary`?{ext:`deb`,mime:`application/x-deb`}:{ext:`ar`,mime:`application/x-unix-archive`};if(this.checkString(`WEBVTT`)&&[`
3
+ `+a),e.push(i+`m+`+t.exports.humanize(this.diff)+`\x1B[0m`)}else e[0]=s()+n+` `+e[0]}function s(){return e.inspectOpts.hideDate?``:new Date().toISOString()+` `}function c(...t){return process.stderr.write(r.formatWithOptions(e.inspectOpts,...t)+`
4
+ `)}function u(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function d(){return process.env.DEBUG}function p(t){t.inspectOpts={};let n=Object.keys(e.inspectOpts);for(let r=0;r<n.length;r++)t.inspectOpts[n[r]]=e.inspectOpts[n[r]]}t.exports=l()(e);var{formatters:m}=t.exports;m.o=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts).split(`
5
+ `).map(e=>e.trim()).join(` `)},m.O=function(e){return this.inspectOpts.colors=this.useColors,r.inspect(e,this.inspectOpts)}}),m=i((e,t)=>{t.exports=typeof process>`u`||process.type===`renderer`||process.browser===!0||process.__nwjs?u():p()}),h=`End-Of-Stream`,g=class extends Error{constructor(){super(h),this.name=`EndOfStreamError`}},ee=class extends Error{constructor(e=`The operation was aborted`){super(e),this.name=`AbortError`}},te=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){let n=await this.read(e,t);return this.peekQueue.push(e.subarray(0,n)),n}async read(e,t=!1){if(e.length===0)return 0;let n=this.readFromPeekBuffer(e);if(this.endOfStream||(n+=await this.readRemainderFromStream(e.subarray(n),t)),n===0&&!t)throw new g;return n}readFromPeekBuffer(e){let t=e.length,n=0;for(;this.peekQueue.length>0&&t>0;){let r=this.peekQueue.pop();if(!r)throw Error(`peekData should be defined`);let i=Math.min(r.length,t);e.set(r.subarray(0,i),n),n+=i,t-=i,i<r.length&&this.peekQueue.push(r.subarray(i))}return n}async readRemainderFromStream(e,t){let n=0;for(;n<e.length&&!this.endOfStream;){if(this.interrupted)throw new ee;let r=await this.readFromStream(e.subarray(n),t);if(r===0)break;n+=r}if(!t&&n<e.length)throw new g;return n}},ne=class extends te{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}},re=class extends ne{async readFromStream(e,t){if(e.length===0)return 0;let n=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return n.done&&(this.endOfStream=n.done),n.value?(e.set(n.value),n.value.length):0}},ie=class extends te{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){let n=Math.min(t.length,e.length);return e.set(t.subarray(0,n)),this.buffer=n<t.length?t.subarray(n):null,n}async readFromStream(e,t){if(e.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(e,this.buffer));n<e.length&&!this.endOfStream;){let t=await this.reader.read();if(t.done){this.endOfStream=!0;break}t.value&&(n+=this.writeChunk(e.subarray(n),t.value))}if(!t&&n===0&&this.endOfStream)throw new g;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}};function ae(e){try{let t=e.getReader({mode:`byob`});return t instanceof ReadableStreamDefaultReader?new ie(t):new re(t)}catch(t){if(t instanceof TypeError)return new ie(e.getReader());throw t}}var _=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 n=new Uint8Array(e.len);if(await this.readBuffer(n,{position:t})<e.len)throw new g;return e.get(n,0)}async peekToken(e,t=this.position){let n=new Uint8Array(e.len);if(await this.peekBuffer(n,{position:t})<e.len)throw new g;return e.get(n,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new g;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new g;return e.get(this.numBuffer,0)}async ignore(e){if(e<0)throw RangeError(`ignore length must be ≥ 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 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()}},oe=256e3,se=class extends _{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=t?.fileInfo??{}}async readBuffer(e,t){let n=this.normalizeOptions(e,t),r=n.position-this.position;if(r>0)return await this.ignore(r),this.readBuffer(e,t);if(r<0)throw Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;let i=await this.streamReader.read(e.subarray(0,n.length),n.mayBeLess);if(this.position+=i,(!t||!t.mayBeLess)&&i<n.length)throw new g;return i}async peekBuffer(e,t){let n=this.normalizeOptions(e,t),r=0;if(n.position){let t=n.position-this.position;if(t>0){let i=new Uint8Array(n.length+t);return r=await this.peekBuffer(i,{mayBeLess:n.mayBeLess}),e.set(i.subarray(t)),r-t}if(t<0)throw Error(`Cannot peek from a negative offset in a stream`)}if(n.length>0){try{r=await this.streamReader.peek(e.subarray(0,n.length),n.mayBeLess)}catch(e){if(t?.mayBeLess&&e instanceof g)return 0;throw e}if(!n.mayBeLess&&r<n.length)throw new g}return r}async ignore(e){if(e<0)throw RangeError(`ignore length must be ≥ 0 bytes`);let t=Math.min(oe,e),n=new Uint8Array(t),r=0;for(;r<e;){let i=e-r,a=await this.readBuffer(n,{length:Math.min(t,i)});if(a<0)return a;r+=a}return r}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}},ce=class extends _{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 n=await this.peekBuffer(e,t);return this.position+=n,n}async peekBuffer(e,t){let n=this.normalizeOptions(e,t),r=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&r<n.length)throw new g;return e.set(this.uint8Array.subarray(n.position,n.position+r)),r}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}},le=class extends _{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 n=await this.peekBuffer(e,t);return this.position+=n,n}async peekBuffer(e,t){let n=this.normalizeOptions(e,t),r=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&r<n.length)throw new g;let i=await this.blob.slice(n.position,n.position+r).arrayBuffer();return e.set(new Uint8Array(i)),r}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}};function ue(e,t){let n=ae(e),r=t??{},i=r.onClose;return r.onClose=async()=>{if(await n.close(),i)return i()},new se(n,r)}function de(e,t){return new ce(e,t)}function fe(e,t){return new le(e,t)}(class e extends _{static async fromFile(t){let n=await o(t,`r`),r=await n.stat();return new e(n,{fileInfo:{path:t,size:r.size}})}constructor(e,t){super(t),this.fileHandle=e,this.fileInfo=t.fileInfo}async readBuffer(e,t){let n=this.normalizeOptions(e,t);if(this.position=n.position,n.length===0)return 0;let r=await this.fileHandle.read(e,0,n.length,n.position);if(this.position+=r.bytesRead,r.bytesRead<n.length&&(!t||!t.mayBeLess))throw new g;return r.bytesRead}async peekBuffer(e,t){let n=this.normalizeOptions(e,t),r=await this.fileHandle.read(e,0,n.length,n.position);if(!n.mayBeLess&&r.bytesRead<n.length)throw new g;return r.bytesRead}async close(){return await this.fileHandle.close(),super.close()}setPosition(e){this.position=e}supportsRandomAccess(){return!0}}).fromFile,r(s(),1);var v={128:`€`,130:`‚`,131:`ƒ`,132:`„`,133:`…`,134:`†`,135:`‡`,136:`ˆ`,137:`‰`,138:`Š`,139:`‹`,140:`Œ`,142:`Ž`,145:`‘`,146:`’`,147:`“`,148:`”`,149:`•`,150:`–`,151:`—`,152:`˜`,153:`™`,154:`š`,155:`›`,156:`œ`,158:`ž`,159:`Ÿ`},pe={};for(let[e,t]of Object.entries(v))pe[t]=Number.parseInt(e,10);var me;function he(){if(!(typeof globalThis.TextDecoder>`u`))return me??=new globalThis.TextDecoder(`utf-8`)}var y=32768,b=65533;function ge(e,t=`utf-8`){switch(t.toLowerCase()){case`utf-8`:case`utf8`:{let t=he();return t?t.decode(e):ve(e)}case`utf-16le`:return ye(e);case`us-ascii`:case`ascii`:return be(e);case`latin1`:case`iso-8859-1`:return xe(e);case`windows-1252`:return Se(e);default:throw RangeError(`Encoding '${t}' not supported`)}}function x(e,t){t.length!==0&&(e.push(String.fromCharCode.apply(null,t)),t.length=0)}function S(e,t,n){t.push(n),t.length>=y&&x(e,t)}function _e(e,t,n){if(n<=65535){S(e,t,n);return}n-=65536,S(e,t,55296+(n>>10)),S(e,t,56320+(n&1023))}function ve(e){let t=[],n=[],r=0;for(e.length>=3&&e[0]===239&&e[1]===187&&e[2]===191&&(r=3);r<e.length;){let i=e[r];if(i<=127){S(t,n,i),r++;continue}if(i<194||i>244){S(t,n,b),r++;continue}if(i<=223){if(r+1>=e.length){S(t,n,b),r++;continue}let a=e[r+1];if((a&192)!=128){S(t,n,b),r++;continue}S(t,n,(i&31)<<6|a&63),r+=2;continue}if(i<=239){if(r+2>=e.length){S(t,n,b),r++;continue}let a=e[r+1],o=e[r+2];if(!((a&192)==128&&(o&192)==128&&!(i===224&&a<160)&&!(i===237&&a>=160))){S(t,n,b),r++;continue}S(t,n,(i&15)<<12|(a&63)<<6|o&63),r+=3;continue}if(r+3>=e.length){S(t,n,b),r++;continue}let a=e[r+1],o=e[r+2],s=e[r+3];if(!((a&192)==128&&(o&192)==128&&(s&192)==128&&!(i===240&&a<144)&&!(i===244&&a>143))){S(t,n,b),r++;continue}_e(t,n,(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63),r+=4}return x(t,n),t.join(``)}function ye(e){let t=[],n=[],r=e.length,i=0;for(;i+1<r;){let a=e[i]|e[i+1]<<8;if(i+=2,a>=55296&&a<=56319){if(i+1<r){let r=e[i]|e[i+1]<<8;r>=56320&&r<=57343?(S(t,n,a),S(t,n,r),i+=2):S(t,n,b)}else S(t,n,b);continue}if(a>=56320&&a<=57343){S(t,n,b);continue}S(t,n,a)}return i<r&&S(t,n,b),x(t,n),t.join(``)}function be(e){let t=[];for(let n=0;n<e.length;n+=y){let r=Math.min(e.length,n+y),i=Array(r-n);for(let t=n,a=0;t<r;t++,a++)i[a]=e[t]&127;t.push(String.fromCharCode.apply(null,i))}return t.join(``)}function xe(e){let t=[];for(let n=0;n<e.length;n+=y){let r=Math.min(e.length,n+y),i=Array(r-n);for(let t=n,a=0;t<r;t++,a++)i[a]=e[t];t.push(String.fromCharCode.apply(null,i))}return t.join(``)}function Se(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r],a=i>=128&&i<=159?v[i]:void 0;n+=a??String.fromCharCode(i),n.length>=y&&(t.push(n),n=``)}return n&&t.push(n),t.join(``)}function C(e){return new DataView(e.buffer,e.byteOffset)}var Ce={len:1,get(e,t){return C(e).getUint8(t)},put(e,t,n){return C(e).setUint8(t,n),t+1}},w={len:2,get(e,t){return C(e).getUint16(t,!0)},put(e,t,n){return C(e).setUint16(t,n,!0),t+2}},T={len:2,get(e,t){return C(e).getUint16(t)},put(e,t,n){return C(e).setUint16(t,n),t+2}},E={len:4,get(e,t){return C(e).getUint32(t,!0)},put(e,t,n){return C(e).setUint32(t,n,!0),t+4}},we={len:4,get(e,t){return C(e).getUint32(t)},put(e,t,n){return C(e).setUint32(t,n),t+4}},Te={len:4,get(e,t){return C(e).getInt32(t)},put(e,t,n){return C(e).setInt32(t,n),t+4}},Ee={len:8,get(e,t){return C(e).getBigUint64(t,!0)},put(e,t,n){return C(e).setBigUint64(t,n,!0),t+8}},D=class{constructor(e,t){this.len=e,this.encoding=t}get(e,t=0){return ge(e.subarray(t,t+this.len),this.encoding)}},De=r(m(),1),O={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},k={get(e){return{signature:E.get(e,0),compressedSize:E.get(e,8),uncompressedSize:E.get(e,12)}},len:16},Oe={get(e){let t=w.get(e,6);return{signature:E.get(e,0),minVersion:w.get(e,4),dataDescriptor:!!(t&8),compressedMethod:w.get(e,8),compressedSize:E.get(e,18),uncompressedSize:E.get(e,22),filenameLength:w.get(e,26),extraFieldLength:w.get(e,28),filename:null}},len:30},ke={get(e){return{signature:E.get(e,0),nrOfThisDisk:w.get(e,4),nrOfThisDiskWithTheStart:w.get(e,6),nrOfEntriesOnThisDisk:w.get(e,8),nrOfEntriesOfSize:w.get(e,10),sizeOfCd:E.get(e,12),offsetOfStartOfCd:E.get(e,16),zipFileCommentLength:w.get(e,20)}},len:22},Ae={get(e){let t=w.get(e,8);return{signature:E.get(e,0),minVersion:w.get(e,6),dataDescriptor:!!(t&8),compressedMethod:w.get(e,10),compressedSize:E.get(e,20),uncompressedSize:E.get(e,24),filenameLength:w.get(e,28),extraFieldLength:w.get(e,30),fileCommentLength:w.get(e,32),relativeOffsetOfLocalHeader:E.get(e,42),filename:null}},len:46};function je(e){let t=new Uint8Array(E.len);return E.put(t,0,e),t}var A=(0,De.default)(`tokenizer:inflate`),j=262144,Me=je(O.DataDescriptor),M=je(O.EndOfCentralDirectory),N=class e{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(j)}async isZip(){return await this.peekSignature()===O.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(E)}async findEndOfCentralDirectoryLocator(){let e=this.tokenizer,t=Math.min(16384,e.fileInfo.size),n=this.syncBuffer.subarray(0,t);await this.tokenizer.readBuffer(n,{position:e.fileInfo.size-t});for(let r=n.length-4;r>=0;r--)if(n[r]===M[0]&&n[r+1]===M[1]&&n[r+2]===M[2]&&n[r+3]===M[3])return e.fileInfo.size-t+r;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){A(`Cannot reading central-directory without random-read support`);return}A(`Reading central-directory...`);let e=this.tokenizer.position,t=await this.findEndOfCentralDirectoryLocator();if(t>0){A(`Central-directory 32-bit signature found`);let n=await this.tokenizer.readToken(ke,t),r=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let e=0;e<n.nrOfEntriesOfSize;++e){let t=await this.tokenizer.readToken(Ae);if(t.signature!==O.CentralFileHeader)throw Error(`Expected Central-File-Header signature`);t.filename=await this.tokenizer.readToken(new D(t.filenameLength,`utf-8`)),await this.tokenizer.ignore(t.extraFieldLength),await this.tokenizer.ignore(t.fileCommentLength),r.push(t),A(`Add central-directory file-entry: n=${e+1}/${r.length}: filename=${r[e].filename}`)}return this.tokenizer.setPosition(e),r}this.tokenizer.setPosition(e)}async unzip(e){let t=await this.readCentralDirectory();if(t)return this.iterateOverCentralDirectory(t,e);let n=!1;do{let t=await this.readLocalFileHeader();if(!t)break;let r=e(t);n=!!r.stop;let i;if(await this.tokenizer.ignore(t.extraFieldLength),t.dataDescriptor&&t.compressedSize===0){let e=[],n=j;A(`Compressed-file-size unknown, scanning for next data-descriptor-signature....`);let i=-1;for(;i<0&&n===j;){n=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),i=Ne(this.syncBuffer.subarray(0,n),Me);let t=i>=0?i:n;if(r.handler){let n=new Uint8Array(t);await this.tokenizer.readBuffer(n),e.push(n)}else await this.tokenizer.ignore(t)}A(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),r.handler&&await this.inflate(t,Pe(e),r.handler)}else r.handler?(A(`Reading compressed-file-data: ${t.compressedSize} bytes`),i=new Uint8Array(t.compressedSize),await this.tokenizer.readBuffer(i),await this.inflate(t,i,r.handler)):(A(`Ignoring compressed-file-data: ${t.compressedSize} bytes`),await this.tokenizer.ignore(t.compressedSize));if(A(`Reading data-descriptor at pos=${this.tokenizer.position}`),t.dataDescriptor&&(await this.tokenizer.readToken(k)).signature!==134695760)throw Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-k.len}`)}while(!n)}async iterateOverCentralDirectory(e,t){for(let n of e){let e=t(n);if(e.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);let t=await this.readLocalFileHeader();if(t){await this.tokenizer.ignore(t.extraFieldLength);let r=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(r),await this.inflate(t,r,e.handler)}}if(e.stop)break}}async inflate(t,n,r){if(t.compressedMethod===0)return r(n);if(t.compressedMethod!==8)throw Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);return A(`Decompress filename=${t.filename}, compressed-size=${n.length}`),r(await e.decompressDeflateRaw(n))}static async decompressDeflateRaw(e){let t=new ReadableStream({start(t){t.enqueue(e),t.close()}}),n=new DecompressionStream(`deflate-raw`),r=t.pipeThrough(n);try{let e=await new Response(r).arrayBuffer();return new Uint8Array(e)}catch(e){let t=e instanceof Error?`Failed to deflate ZIP entry: ${e.message}`:`Unknown decompression error in ZIP entry`;throw TypeError(t)}}async readLocalFileHeader(){let e=await this.tokenizer.peekToken(E);if(e===O.LocalFileHeader){let e=await this.tokenizer.readToken(Oe);return e.filename=await this.tokenizer.readToken(new D(e.filenameLength,`utf-8`)),e}if(e===O.CentralFileHeader)return!1;throw Error(e===3759263696?`Encrypted ZIP`:`Unexpected signature`)}};function Ne(e,t){let n=e.length,r=t.length;if(r>n)return-1;for(let i=0;i<=n-r;i++){let n=!0;for(let a=0;a<r;a++)if(e[i+a]!==t[a]){n=!1;break}if(n)return i}return-1}function Pe(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}var Fe=class{constructor(e){this.tokenizer=e}inflate(){let e=this.tokenizer;return new ReadableStream({async pull(t){let n=new Uint8Array(1024),r=await e.readBuffer(n,{mayBeLess:!0});if(r===0){t.close();return}t.enqueue(n.subarray(0,r))}}).pipeThrough(new DecompressionStream(`gzip`))}};new globalThis.TextDecoder(`utf8`),new globalThis.TextEncoder,Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Ie(e){let{byteLength:t}=e;if(t===6)return e.getUint16(0)*2**32+e.getUint32(2);if(t===5)return e.getUint8(0)*2**32+e.getUint32(1);if(t===4)return e.getUint32(0);if(t===3)return e.getUint8(0)*2**16+e.getUint16(1);if(t===2)return e.getUint16(0);if(t===1)return e.getUint8(0)}function Le(e,t){if(t===`utf-16le`){let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t.push(r&255,r>>8&255)}return t}if(t===`utf-16be`){let t=[];for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t.push(r>>8&255,r&255)}return t}return[...e].map(e=>e.charCodeAt(0))}function Re(e,t=0){let n=Number.parseInt(new D(6).get(e,148).replace(/\0.*$/,``).trim(),8);if(Number.isNaN(n))return!1;let r=256;for(let n=t;n<t+148;n++)r+=e[n];for(let n=t+156;n<t+512;n++)r+=e[n];return n===r}var ze={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4},Be=`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`.split(`,`),Ve=`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`.split(`,`),P=4100,He=P-2,F=1048576,I=1024,Ue=2**31-1,L=16777216,R=F,z=F,We=L,Ge=1,B=100,V=L,H=64,U=R,Ke=256,qe=512,Je=L,Ye=512,Xe=512,W=256,G=R,Ze=R,Qe=R,$e=L,et=new Set([`Unexpected signature`,`Encrypted ZIP`,`Expected Central-File-Header signature`]),tt=[`ZIP entry count exceeds `,`Unsupported ZIP compression method:`,`ZIP entry compressed data exceeds `,`ZIP entry decompressed data exceeds `,`Expected data-descriptor-signature at position `],nt=new Set([`Z_BUF_ERROR`,`Z_DATA_ERROR`,`ERR_INVALID_STATE`]),K=class extends Error{};function rt(e){let t=e?.streamReader;if(t?.constructor?.name!==`WebStreamByobReader`)return e;let{reader:n}=t,r=async()=>{await n.cancel(),n.releaseLock()};return t.close=r,t.abort=async()=>{t.interrupted=!0,await r()},e}function q(e,t,n){if(!Number.isFinite(e)||e<0||e>t)throw new K(`${n} has invalid size ${e} (maximum ${t} bytes)`);return e}async function J(e,t,{maximumLength:n=L,reason:r=`skip`}={}){let i=q(t,n,r);await e.ignore(i)}async function Y(e,t,n,{maximumLength:r=t.length,reason:i=`read`}={}){let a=q(n?.length??t.length,r,i);return e.readBuffer(t,{...n,length:a})}async function it(e,{maximumLength:t=F}={}){let n=new ReadableStream({start(t){t.enqueue(e),t.close()}}).pipeThrough(new DecompressionStream(`deflate-raw`)).getReader(),r=[],i=0;try{for(;;){let{done:e,value:a}=await n.read();if(e)break;if(i+=a.length,i>t)throw await n.cancel(),Error(`ZIP entry decompressed data exceeds ${t} bytes`);r.push(a)}}finally{n.releaseLock()}let a=new Uint8Array(i),o=0;for(let e of r)a.set(e,o),o+=e.length;return a}var at=134695760,X=16,ot=X-1;function st(e,t){if(e.length<X)return-1;let n=e.length-X;for(let r=0;r<=n;r++)if(E.get(e,r)===at&&E.get(e,r+8)===t+r)return r;return-1}function ct(e){return!!(e.codePointAt(0)&32)}function lt(e,t){let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}async function ut(e,{shouldBuffer:t,maximumLength:n=F}={}){let{syncBuffer:r}=e,{length:i}=r,a=[],o=0;for(;;){let s=await e.tokenizer.peekBuffer(r,{mayBeLess:!0}),c=st(r.subarray(0,s),o),l=c>=0?0:s===i?Math.min(ot,s-1):0,u=c>=0?c:s-l;if(u===0)break;if(o+=u,o>n)throw Error(`ZIP entry compressed data exceeds ${n} bytes`);if(t){let t=new Uint8Array(u);await e.tokenizer.readBuffer(t),a.push(t)}else await e.tokenizer.ignore(u);if(c>=0)break}if(Q(e.tokenizer)||(e.knownSizeDescriptorScannedBytes+=o),t)return lt(a,o)}function dt(e,t){return Q(e.tokenizer)?Math.max(0,L-(e.tokenizer.position-t)):Math.max(0,F-e.knownSizeDescriptorScannedBytes)}async function ft(e,t,{shouldBuffer:n,maximumDescriptorLength:r=F}={}){if(t.dataDescriptor&&t.compressedSize===0)return ut(e,{shouldBuffer:n,maximumLength:r});if(!n){await J(e.tokenizer,t.compressedSize,{maximumLength:Q(e.tokenizer)?F:e.tokenizer.fileInfo.size,reason:`ZIP entry compressed data`});return}let i=bt(e.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>i)throw Error(`ZIP entry compressed data exceeds ${i} bytes`);let a=new Uint8Array(t.compressedSize);return await e.tokenizer.readBuffer(a),a}N.prototype.inflate=async function(e,t,n){if(e.compressedMethod===0)return n(t);if(e.compressedMethod!==8)throw Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);return n(await it(t,{maximumLength:F}))},N.prototype.unzip=async function(e){let t=!1,n=0,r=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if($(this.tokenizer,r,L))throw new K(`ZIP stream probing exceeds ${L} bytes`);let i=await this.readLocalFileHeader();if(!i)break;if(n++,n>I)throw Error(`ZIP entry count exceeds ${I}`);let a=e(i);t=!!a.stop,await this.tokenizer.ignore(i.extraFieldLength);let o=await ft(this,i,{shouldBuffer:!!a.handler,maximumDescriptorLength:Math.min(F,dt(this,r))});if(a.handler&&await this.inflate(i,o,a.handler),i.dataDescriptor){let e=new Uint8Array(X);if(await this.tokenizer.readBuffer(e),E.get(e,0)!==at)throw Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-e.length}`)}if($(this.tokenizer,r,L))throw new K(`ZIP stream probing exceeds ${L} bytes`)}while(!t)};function pt(e,t){let n=e.getReader(),r=0,i=!1,a=!1,o=async e=>{i||a||(a=!0,await n.cancel(e))};return new ReadableStream({async pull(e){if(r>=t){e.close(),await o();return}let{done:a,value:s}=await n.read();if(a||!s){i=!0,e.close();return}let c=t-r;if(s.length>c){e.enqueue(s.subarray(0,c)),r+=c,e.close(),await o();return}e.enqueue(s),r+=s.length},async cancel(e){await o(e)}})}async function mt(e,t){return new Dt(t).fromBuffer(e)}function ht(e){switch(e=e.toLowerCase(),e){case`application/epub+zip`:return{ext:`epub`,mime:e};case`application/vnd.oasis.opendocument.text`:return{ext:`odt`,mime:e};case`application/vnd.oasis.opendocument.text-template`:return{ext:`ott`,mime:e};case`application/vnd.oasis.opendocument.spreadsheet`:return{ext:`ods`,mime:e};case`application/vnd.oasis.opendocument.spreadsheet-template`:return{ext:`ots`,mime:e};case`application/vnd.oasis.opendocument.presentation`:return{ext:`odp`,mime:e};case`application/vnd.oasis.opendocument.presentation-template`:return{ext:`otp`,mime:e};case`application/vnd.oasis.opendocument.graphics`:return{ext:`odg`,mime:e};case`application/vnd.oasis.opendocument.graphics-template`:return{ext:`otg`,mime:e};case`application/vnd.openxmlformats-officedocument.presentationml.slideshow`:return{ext:`ppsx`,mime:e};case`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`:return{ext:`xlsx`,mime:e};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:e};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:e};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:e};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:e};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:e};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`}}}function Z(e,t,n){n={offset:0,...n};for(let[r,i]of t.entries())if(n.mask){if(i!==(n.mask[r]&e[r+n.offset]))return!1}else if(i!==e[r+n.offset])return!1;return!0}function gt(e){return Number.isFinite(e)?Math.max(1,Math.trunc(e)):P}function _t(e,t,n){return n===void 0?e.read(t):(n.throwIfAborted(),new Promise((r,i)=>{let a=()=>{n.removeEventListener(`abort`,o)},o=()=>{let t=n.reason;a(),(async()=>{try{await e.cancel(t)}catch{}})(),i(t)};n.addEventListener(`abort`,o,{once:!0}),(async()=>{try{let n=await e.read(t);a(),r(n)}catch(e){a(),i(e)}})()}))}function vt(e){return Number.isFinite(e)?Math.max(0,Math.min(He,Math.trunc(e))):0}function yt(e){return Number.isFinite(e)?Math.max(0,e):2**53-1}function Q(e){let t=e.fileInfo.size;return!Number.isFinite(t)||t===2**53-1}function $(e,t,n){return Q(e)&&e.position-t>n}function bt(e){let t=e.fileInfo.size,n=Number.isFinite(t)?Math.max(0,t-e.position):2**53-1;return Math.min(n,Ue)}function xt(e){if(e instanceof g||e instanceof K)return!0;if(!(e instanceof Error))return!1;if(et.has(e.message)||nt.has(e.code))return!0;for(let t of tt)if(e.message.startsWith(t))return!0;return!1}function St(e,t=F){let n=[e.compressedSize,e.uncompressedSize];for(let e of n)if(!Number.isFinite(e)||e<0||e>t)return!1;return!0}function Ct(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function wt(e,t){t.startsWith(`word/`)&&(e.hasWordDirectory=!0),t.startsWith(`ppt/`)&&(e.hasPresentationDirectory=!0),t.startsWith(`xl/`)&&(e.hasSpreadsheetDirectory=!0),t.startsWith(`3D/`)&&t.endsWith(`.model`)&&(e.hasThreeDimensionalModelEntry=!0)}function Tt(e){if(!(!e.hasContentTypesEntry||e.hasUnparseableContentTypes||e.isParsingContentTypes||e.hasParsedContentTypesEntry)){if(e.hasWordDirectory)return{ext:`docx`,mime:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`};if(e.hasPresentationDirectory)return{ext:`pptx`,mime:`application/vnd.openxmlformats-officedocument.presentationml.presentation`};if(e.hasSpreadsheetDirectory)return{ext:`xlsx`,mime:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`};if(e.hasThreeDimensionalModelEntry)return{ext:`3mf`,mime:`model/3mf`}}}function Et(e){let t=e.indexOf(`.main+xml"`);if(t===-1){let t=`application/vnd.ms-package.3dmanufacturing-3dmodel+xml`;return e.includes(`ContentType="${t}"`)?t:void 0}let n=e.slice(0,t),r=n.lastIndexOf(`"`);return n.slice(r+1)}var Dt=class e{constructor(e){let t=vt(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 rt(ue(e,this.getTokenizerOptions()))}async parseTokenizer(e,t=0){this.detectionReentryCount=t;let n=e.position;for(let t of this.detectors){let r;try{r=await t.detect(e)}catch(e){if(e instanceof g||e instanceof K)return;throw e}if(r)return r;if(n!==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 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(de(t,this.getTokenizerOptions()))}async fromBlob(e){this.options.signal?.throwIfAborted();let t=fe(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 n=gt(t?.sampleSize??P),r,i,a=e.getReader({mode:`byob`});try{let{value:e,done:t}=await _t(a,new Uint8Array(n),this.options.signal);if(i=e,!t&&e)try{r=await this.fromBuffer(e.subarray(0,n))}catch(e){if(!(e instanceof g))throw e;r=void 0}i=e}finally{a.releaseLock()}let o=new TransformStream({async start(e){e.enqueue(i)},transform(e,t){t.enqueue(e)}}),s=e.pipeThrough(o);return s.fileType=r,s}async detectGzip(t){if(this.gzipProbeDepth>=Ge)return{ext:`gz`,mime:`application/gzip`};let n=pt(new Fe(t).inflate(),We),r=Q(t),i,a,o,s;if(r){let t=new AbortController;i=setTimeout(()=>{t.abort(new DOMException(`Operation timed out after ${B} ms`,`TimeoutError`))},B),a=this.options.signal===void 0?t.signal:AbortSignal.any([this.options.signal,t.signal]),o=new e({...this.options,signal:a}),o.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{s=await(o??this).fromStream(n)}catch(e){if(e?.name===`AbortError`&&a?.reason?.name!==`TimeoutError`)throw e}finally{clearTimeout(i),r||this.gzipProbeDepth--}return s?.ext===`tar`?{ext:`tar.gz`,mime:`application/gzip`}:{ext:`gz`,mime:`application/gzip`}}check(e,t){return Z(this.buffer,e,t)}checkString(e,t){return this.check(Le(e,t?.encoding),t)}detectConfident=async e=>{if(this.buffer=new Uint8Array(P),e.fileInfo.size===void 0&&(e.fileInfo.size=2**53-1),this.tokenizer=e,Q(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>=W?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 J(e,6,{maximumLength:6,reason:`ID3 header prefix`});let t=await e.readToken(ze),n=Q(e);if(!Number.isFinite(t)||t<0||n&&(t>V||e.position+t>V))return;if(e.position+t>e.fileInfo.size)return n?void 0:{ext:`mp3`,mime:`audio/mpeg`};try{await J(e,t,{maximumLength:n?V:e.fileInfo.size,reason:`ID3 payload`})}catch(e){if(e instanceof g)return;throw e}return this.detectionReentryCount>=W?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,n=Ct();try{await new N(e).unzip(e=>{wt(n,e.filename);let r=e.filename===`[Content_Types].xml`,i=Tt(n);if(!r&&i)return t=i,{stop:!0};switch(e.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 St(e,z)?{async handler(e){t=ht(new TextDecoder(`utf-8`).decode(e).trim())},stop:!0}:{};case`[Content_Types].xml`:return n.hasContentTypesEntry=!0,St(e,z)?(n.isParsingContentTypes=!0,{async handler(e){let r=Et(new TextDecoder(`utf-8`).decode(e));r&&(t=ht(r)),n.hasParsedContentTypesEntry=!0,n.isParsingContentTypes=!1},stop:!0}):(n.hasUnparseableContentTypes=!0,{});default:return/classes\d*\.dex/.test(e.filename)?(t={ext:`apk`,mime:`application/vnd.android.package-archive`},{stop:!0}):{}}})}catch(e){if(!xt(e))throw e;n.isParsingContentTypes&&(n.isParsingContentTypes=!1,n.hasUnparseableContentTypes=!0)}return t??Tt(n)??{ext:`zip`,mime:`application/zip`}}if(this.checkString(`OggS`)){await e.ignore(28);let t=new Uint8Array(8);return await e.readBuffer(t),Z(t,[79,112,117,115,72,101,97,100])?{ext:`opus`,mime:`audio/ogg; codecs=opus`}:Z(t,[128,116,104,101,111,114,97])?{ext:`ogv`,mime:`video/ogg`}:Z(t,[1,118,105,100,101,111,0])?{ext:`ogm`,mime:`video/ogg`}:Z(t,[127,70,76,65,67])?{ext:`oga`,mime:`audio/ogg`}:Z(t,[83,112,101,101,120,32,32])?{ext:`spx`,mime:`audio/ogg`}:Z(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 e=await this.readTiffHeader(!1);if(e)return e}if(this.check([77,77])){let e=await this.readTiffHeader(!0);if(e)return e}if(this.checkString(`MAC `))return{ext:`ape`,mime:`audio/ape`};if(this.check([26,69,223,163])){async function t(){let t=await e.peekNumber(Ce),n=128,r=0;for(;(t&n)===0&&n!==0;)++r,n>>=1;let i=new Uint8Array(r+1);return await Y(e,i,void 0,{maximumLength:i.length,reason:`EBML field`}),i}async function n(){let e=await t(),n=await t();n[0]^=128>>n.length-1;let r=Math.min(6,n.length),i=new DataView(e.buffer),a=new DataView(n.buffer,n.length-r,r);return{id:Ie(i),len:Ie(a)}}async function r(t){let r=0;for(;t>0;){if(r++,r>Ke||$(e,a,L))return;let i=e.position,o=await n();if(o.id===17026){if(o.len>H)return;let t=q(o.len,H,`EBML DocType`);return(await e.readToken(new D(t))).replaceAll(/\00.*$/g,``)}if(Q(e)&&(!Number.isFinite(o.len)||o.len<0||o.len>U)||(await J(e,o.len,{maximumLength:Q(e)?U:e.fileInfo.size,reason:`EBML payload`}),--t,e.position<=i))return}}let i=await n(),a=e.position;switch(await r(i.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 e=we.get(this.buffer,4),t=T.get(this.buffer,6);if(e>0&&e<=30)return{ext:`macho`,mime:`application/x-mach-binary`};if(t>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 e=new D(4,`latin1`).get(this.buffer,2);if(e.match(`^d*`)&&e>=1e3&&e<=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 D(13,`ascii`))===`debian-binary`?{ext:`deb`,mime:`application/x-deb`}:{ext:`ar`,mime:`application/x-unix-archive`};if(this.checkString(`WEBVTT`)&&[`
6
6
  `,`\r`,` `,` `,`\0`].some(e=>this.checkString(e,{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`},n={ext:`apng`,mime:`image/apng`};await e.ignore(8);async function r(){return{length:await e.readToken(Te),type:await e.readToken(new D(4,`latin1`))}}let i=Q(e),a=e.position,o=0,s=!1;do{if(o++,o>qe||$(e,a,Je))break;let c=e.position,l=await r();if(l.length<0)return;if(l.type===`IHDR`){if(l.length!==13)return;s=!0}switch(l.type){case`IDAT`:return t;case`acTL`:return n;default:if(!s&&l.type!==`CgBI`)return;if(i&&l.length>G)return s&&ct(l.type)?t:void 0;try{await J(e,l.length+4,{maximumLength:i?G+4:e.fileInfo.size,reason:`PNG chunk payload`})}catch(e){if(!i&&(e instanceof K||e instanceof g))return t;throw e}}if(e.position<=c)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){let e=new D(4,`latin1`).get(this.buffer,8).replace(`\0`,` `).trim();switch(e){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 e.startsWith(`3g`)?e.startsWith(`3g2`)?{ext:`3g2`,mime:`video/3gpp2`}:{ext:`3gp`,mime:`video/3gpp`}:{ext:`mp4`,mime:`video/mp4`}}}if(this.checkString(`REGEDIT4\r
7
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 n(){let t=new Uint8Array(16);return await Y(e,t,void 0,{maximumLength:t.length,reason:`ASF header GUID`}),{id:t,size:Number(await e.readToken(Ee))}}await J(e,30,{maximumLength:30,reason:`ASF header prelude`});let r=Q(e),i=e.position,a=0;for(;e.position+24<e.fileInfo.size&&(a++,!(a>Ye||$(e,i,L)));){let i=e.position,a=await n(),o=a.size-24;if(!Number.isFinite(o)||o<0){t=!0;break}if(Z(a.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let t=new Uint8Array(16);if(o-=await Y(e,t,void 0,{maximumLength:t.length,reason:`ASF stream type GUID`}),Z(t,[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(Z(t,[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(r&&o>Ze){t=!0;break}if(await J(e,o,{maximumLength:r?Ze:e.fileInfo.size,reason:`ASF header payload`}),e.position<=i){t=!0;break}}}catch(n){if(n instanceof g||n instanceof K)Q(e)&&(t=!0);else throw n}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 D(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 e=new DataView(this.buffer.buffer).getUint32(12,!0);if(e>12&&this.buffer.length>=e+16)try{let t=new TextDecoder().decode(this.buffer.subarray(16,e+16));if(JSON.parse(t).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})||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})&&Re(this.buffer))return{ext:`tar`,mime:`application/x-tar`};if(this.check([255,254])){let e=`utf-16le`;return this.checkString(`<?xml `,{offset:2,encoding:e})?{ext:`xml`,mime:`application/xml`}:this.check([255,14],{offset:2})&&this.checkString(`SketchUp Model`,{offset:4,encoding:e})?{ext:`skp`,mime:`application/vnd.sketchup.skp`}:this.checkString(`Windows Registry Editor Version 5.00\r
8
8
  `,{offset:2,encoding:e})?{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(P);let t=yt(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 e=0;e<=this.options.mpegOffsetTolerance;++e){let t=this.scanMpeg(e);if(t)return t}};async readTiffTag(e){let t=await this.tokenizer.readToken(e?T:w);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`}}}async readTiffIFD(e){let t=await this.tokenizer.readToken(e?T:w);if(!(t>Xe)&&!(Q(this.tokenizer)&&2+t*12>$e))for(let n=0;n<t;++n){let t=await this.readTiffTag(e);if(t)return t}}async readTiffHeader(e){let t={ext:`tif`,mime:`image/tiff`},n=(e?T:w).get(this.buffer,2),r=(e?we:E).get(this.buffer,4);if(n===42){if(r>=6){if(this.checkString(`CR`,{offset:8}))return{ext:`cr2`,mime:`image/x-canon-cr2`};if(r>=8){let t=(e?T:w).get(this.buffer,8),n=(e?T:w).get(this.buffer,10);if(t===28&&n===254||t===31&&n===11)return{ext:`nef`,mime:`image/x-nikon-nef`}}}if(Q(this.tokenizer)&&r>Qe)return t;let n=Q(this.tokenizer)?$e:this.tokenizer.fileInfo.size;try{await J(this.tokenizer,r,{maximumLength:n,reason:`TIFF IFD offset`})}catch(e){if(e instanceof g)return;throw e}let i;try{i=await this.readTiffIFD(e)}catch(e){if(e instanceof g)return;throw e}return i??t}if(n===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`};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`}}}};new Set(Be),new Set(Ve);var Ot={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`]},kt=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`}]]),At=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 jt(e,t){let n=At.get(e);if(n)return n;let[r,i]=t.split(`/`),a=i?.split(`+`)[0]?.replace(/-/g,` `)||e;switch(r){case`image`:return`${a.toUpperCase()} image data`;case`audio`:return`${a.toUpperCase()} audio`;case`video`:return`${a.toUpperCase()} video`;case`font`:return`${a} font`;case`model`:return`${a} 3D model`;case`application`:return i?.includes(`zip`)||i?.includes(`compressed`)?`${a} archive data`:i?.includes(`executable`)?`${a} executable`:`${e.toUpperCase()} data`;default:return`${e.toUpperCase()} data`}}function Mt(e){let t=e.split(`/`).pop()||e;if(t.startsWith(`.`)&&!t.includes(`.`,1))return t;let n=t.lastIndexOf(`.`);return n===-1||n===0?``:t.slice(n).toLowerCase()}function Nt(e,t){if(e.startsWith(`#!`)){let t=e.split(`
9
9
  `)[0];return t.includes(`python`)?{description:`Python script, ASCII text executable`,mime:`text/x-python`}:t.includes(`node`)||t.includes(`bun`)||t.includes(`deno`)?{description:`JavaScript script, ASCII text executable`,mime:`text/javascript`}:t.includes(`bash`)?{description:`Bourne-Again shell script, ASCII text executable`,mime:`text/x-shellscript`}:t.includes(`sh`)?{description:`POSIX shell script, ASCII text executable`,mime:`text/x-shellscript`}:t.includes(`ruby`)?{description:`Ruby script, ASCII text executable`,mime:`text/x-ruby`}:t.includes(`perl`)?{description:`Perl script, ASCII text executable`,mime:`text/x-perl`}:{description:`script, ASCII text executable`,mime:`text/plain`}}let n=e.trimStart();if(n.startsWith(`<?xml`))return{description:`XML document`,mime:`application/xml`};if(n.startsWith(`<!DOCTYPE html`)||n.toLowerCase().startsWith(`<html`))return{description:`HTML document`,mime:`text/html`};let r=e.includes(`\r
10
- `),i=e.includes(`\r`)&&!r,a=``;r?a=`, with CRLF line terminators`:i&&(a=`, with CR line terminators`);let o=Mt(t),s=o?kt.get(o):void 0;if(s)return s.mime.startsWith(`text/`)&&a?{description:`${s.description}${a}`,mime:s.mime}:s;let c=!1;for(let t=0;t<Math.min(e.length,8192);t++)if(e.charCodeAt(t)>127){c=!0;break}return c?{description:`UTF-8 Unicode text${a}`,mime:`text/plain; charset=utf-8`}:{description:`ASCII text${a}`,mime:`text/plain`}}async function Pt(e,t){if(t.length===0)return{description:`empty`,mime:`inode/x-empty`};let n=await mt(t);return n?{description:jt(n.ext,n.mime),mime:n.mime}:Nt(new TextDecoder(`utf-8`,{fatal:!1}).decode(t),e)}var Ft={name:`file`,async execute(e,t){if(a(e))return i(Ot);let n=!1,o=!1,s=[];for(let t of e)if(t.startsWith(`--`)){if(t===`--brief`)n=!0;else if(t===`--mime`||t===`--mime-type`)o=!0;else if(t!==`--dereference`)return r(`file`,t)}else if(t.startsWith(`-`)&&t!==`-`){for(let e of t.slice(1))if(e===`b`)n=!0;else if(e===`i`)o=!0;else if(e!==`L`)return r(`file`,`-${e}`)}else s.push(t);if(s.length===0)return{stdout:``,stderr:`Usage: file [-bLi] FILE...
11
- `,exitCode:1};let c=``,l=0;for(let e of s)try{let r=t.fs.resolvePath(t.cwd,e);if((await t.fs.stat(r)).isDirectory){let t=o?`inode/directory`:`directory`;c+=n?`${t}
10
+ `),i=e.includes(`\r`)&&!r,a=``;r?a=`, with CRLF line terminators`:i&&(a=`, with CR line terminators`);let o=Mt(t),s=o?kt.get(o):void 0;if(s)return s.mime.startsWith(`text/`)&&a?{description:`${s.description}${a}`,mime:s.mime}:s;let c=!1;for(let t=0;t<Math.min(e.length,8192);t++)if(e.charCodeAt(t)>127){c=!0;break}return c?{description:`UTF-8 Unicode text${a}`,mime:`text/plain; charset=utf-8`}:{description:`ASCII text${a}`,mime:`text/plain`}}async function Pt(e,t){if(t.length===0)return{description:`empty`,mime:`inode/x-empty`};let n=await mt(t);return n?{description:jt(n.ext,n.mime),mime:n.mime}:Nt(new TextDecoder(`utf-8`,{fatal:!1}).decode(t),e)}var Ft={name:`file`,async execute(r,i){if(n(r))return t(Ot);let a=!1,o=!1,s=[];for(let t of r)if(t.startsWith(`--`)){if(t===`--brief`)a=!0;else if(t===`--mime`||t===`--mime-type`)o=!0;else if(t!==`--dereference`)return e(`file`,t)}else if(t.startsWith(`-`)&&t!==`-`){for(let n of t.slice(1))if(n===`b`)a=!0;else if(n===`i`)o=!0;else if(n!==`L`)return e(`file`,`-${n}`)}else s.push(t);if(s.length===0)return{stdout:``,stderr:`Usage: file [-bLi] FILE...
11
+ `,exitCode:1};let c=``,l=0;for(let e of s)try{let t=i.fs.resolvePath(i.cwd,e);if((await i.fs.stat(t)).isDirectory){let t=o?`inode/directory`:`directory`;c+=a?`${t}
12
12
  `:`${e}: ${t}
13
- `;continue}let i=await Pt(e,await t.fs.readFileBuffer(r)),a=o?i.mime:i.description;c+=n?`${a}
14
- `:`${e}: ${a}
15
- `}catch{c+=n?`cannot open
13
+ `;continue}let n=await Pt(e,await i.fs.readFileBuffer(t)),r=o?n.mime:n.description;c+=a?`${r}
14
+ `:`${e}: ${r}
15
+ `}catch{c+=a?`cannot open
16
16
  `:`${e}: cannot open (No such file or directory)
17
17
  `,l=1}return{stdout:c,stderr:``,exitCode:l}}},It={name:`file`,flags:[{flag:`-b`,type:`boolean`},{flag:`-i`,type:`boolean`},{flag:`-L`,type:`boolean`}],needsArgs:!0};
18
18
  /*! Bundled license information:
@@ -1,10 +1,10 @@
1
- import{t as e}from"./chunk-R6VWJ2ZL-DJY9gweS.mjs";import{i as t,n}from"./chunk-CWQS3NFK-BbpS-dVt.mjs";import{n as r,t as i}from"./chunk-A5O5YHGN-BRMz0iFo.mjs";import{t as a}from"./chunk-IPJHKYVM-BuXAD82m.mjs";import{n as o}from"./chunk-3THT3N7L-DVKHLRUO.mjs";var s={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},c={PENDING:0,READY:1,SUCCESS:2,ERROR:3},l={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},u={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},d={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:1048576,TOTAL:1052704},f={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},p={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function m(){return new t(d.TOTAL)}var h=class{int32View;uint8View;dataView;constructor(e){this.int32View=new Int32Array(e),this.uint8View=new Uint8Array(e),this.dataView=new DataView(e)}getOpCode(){return n.load(this.int32View,u.OP_CODE/4)}setOpCode(e){n.store(this.int32View,u.OP_CODE/4,e)}getStatus(){return n.load(this.int32View,u.STATUS/4)}setStatus(e){n.store(this.int32View,u.STATUS/4,e)}getPathLength(){return n.load(this.int32View,u.PATH_LENGTH/4)}setPathLength(e){n.store(this.int32View,u.PATH_LENGTH/4,e)}getDataLength(){return n.load(this.int32View,u.DATA_LENGTH/4)}setDataLength(e){n.store(this.int32View,u.DATA_LENGTH/4,e)}getResultLength(){return n.load(this.int32View,u.RESULT_LENGTH/4)}setResultLength(e){n.store(this.int32View,u.RESULT_LENGTH/4,e)}getErrorCode(){return n.load(this.int32View,u.ERROR_CODE/4)}setErrorCode(e){n.store(this.int32View,u.ERROR_CODE/4,e)}getFlags(){return n.load(this.int32View,u.FLAGS/4)}setFlags(e){n.store(this.int32View,u.FLAGS/4,e)}getMode(){return n.load(this.int32View,u.MODE/4)}setMode(e){n.store(this.int32View,u.MODE/4,e)}getPath(){let e=this.getPathLength(),t=this.uint8View.slice(u.PATH_BUFFER,u.PATH_BUFFER+e);return new TextDecoder().decode(t)}setPath(e){let t=new TextEncoder().encode(e);if(t.length>d.PATH_BUFFER)throw Error(`Path too long: ${t.length} > ${d.PATH_BUFFER}`);this.uint8View.set(t,u.PATH_BUFFER),this.setPathLength(t.length)}getData(){let e=this.getDataLength();return this.uint8View.slice(u.DATA_BUFFER,u.DATA_BUFFER+e)}setData(e){if(e.length>d.DATA_BUFFER)throw Error(`Data too large: ${e.length} > ${d.DATA_BUFFER}`);this.uint8View.set(e,u.DATA_BUFFER),this.setDataLength(e.length)}getDataAsString(){let e=this.getData();return new TextDecoder().decode(e)}setDataFromString(e){let t=new TextEncoder().encode(e);this.setData(t)}getResult(){let e=this.getResultLength();return this.uint8View.slice(u.DATA_BUFFER,u.DATA_BUFFER+e)}setResult(e){if(e.length>d.DATA_BUFFER)throw Error(`Result too large: ${e.length} > ${d.DATA_BUFFER}`);this.uint8View.set(e,u.DATA_BUFFER),this.setResultLength(e.length)}getResultAsString(){let e=this.getResult();return new TextDecoder().decode(e)}setResultFromString(e){let t=new TextEncoder().encode(e);this.setResult(t)}encodeStat(e){this.uint8View[u.DATA_BUFFER+p.IS_FILE]=+!!e.isFile,this.uint8View[u.DATA_BUFFER+p.IS_DIRECTORY]=+!!e.isDirectory,this.uint8View[u.DATA_BUFFER+p.IS_SYMLINK]=+!!e.isSymbolicLink,this.dataView.setInt32(u.DATA_BUFFER+p.MODE,e.mode,!0);let t=Math.min(e.size,2**53-1);this.dataView.setFloat64(u.DATA_BUFFER+p.SIZE,t,!0),this.dataView.setFloat64(u.DATA_BUFFER+p.MTIME,e.mtime.getTime(),!0),this.setResultLength(p.TOTAL)}decodeStat(){return{isFile:this.uint8View[u.DATA_BUFFER+p.IS_FILE]===1,isDirectory:this.uint8View[u.DATA_BUFFER+p.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[u.DATA_BUFFER+p.IS_SYMLINK]===1,mode:this.dataView.getInt32(u.DATA_BUFFER+p.MODE,!0),size:this.dataView.getFloat64(u.DATA_BUFFER+p.SIZE,!0),mtime:new Date(this.dataView.getFloat64(u.DATA_BUFFER+p.MTIME,!0))}}waitForReady(e){return n.wait(this.int32View,u.STATUS/4,c.PENDING,e)}waitForReadyAsync(e){return n.waitAsync(this.int32View,u.STATUS/4,c.PENDING,e)}async waitUntilReady(e){let t=Date.now();for(;;){let r=this.getStatus();if(r===c.READY)return!0;let i=Date.now()-t;if(i>=e)return!1;let a=e-i,o=n.waitAsync(this.int32View,u.STATUS/4,r,a);if(o.async&&await o.value===`timed-out`)return!1}}waitForResult(e){return n.wait(this.int32View,u.STATUS/4,c.READY,e)}notify(){return n.notify(this.int32View,u.STATUS/4)}reset(){this.setOpCode(s.NOOP),this.setStatus(c.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(l.NONE),this.setFlags(f.NONE),this.setMode(0)}},g=class{fs;cwd;commandName;secureFetch;maxOutputSize;exec;protocol;running=!1;output={stdout:``,stderr:``,exitCode:0};outputLimitExceeded=!1;startTime=0;timeoutMs=0;constructor(e,t,n,r,i=void 0,a=0,o=void 0){this.fs=t,this.cwd=n,this.commandName=r,this.secureFetch=i,this.maxOutputSize=a,this.exec=o,this.protocol=new h(e)}remainingMs(){return Math.max(0,this.timeoutMs-(Date.now()-this.startTime))}raceDeadline(e){let t=this.remainingMs();if(t<=0)return this.running=!1,this.output.exitCode=124,this.output.stderr+=`
1
+ import{t as e}from"./chunk-R6VWJ2ZL-DJY9gweS.mjs";import{i as t,n}from"./chunk-CWQS3NFK-BbpS-dVt.mjs";import{n as r}from"./chunk-3THT3N7L-DVKHLRUO.mjs";import{t as i}from"./chunk-IPJHKYVM-BuXAD82m.mjs";import{n as a,t as o}from"./chunk-A5O5YHGN-BRMz0iFo.mjs";var s={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},c={PENDING:0,READY:1,SUCCESS:2,ERROR:3},l={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},u={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},d={CONTROL_REGION:32,PATH_BUFFER:4096,DATA_BUFFER:1048576,TOTAL:1052704},f={NONE:0,RECURSIVE:1,FORCE:2,MKDIR_RECURSIVE:1},p={IS_FILE:0,IS_DIRECTORY:1,IS_SYMLINK:2,MODE:4,SIZE:8,MTIME:16,TOTAL:24};function m(){return new t(d.TOTAL)}var h=class{int32View;uint8View;dataView;constructor(e){this.int32View=new Int32Array(e),this.uint8View=new Uint8Array(e),this.dataView=new DataView(e)}getOpCode(){return n.load(this.int32View,u.OP_CODE/4)}setOpCode(e){n.store(this.int32View,u.OP_CODE/4,e)}getStatus(){return n.load(this.int32View,u.STATUS/4)}setStatus(e){n.store(this.int32View,u.STATUS/4,e)}getPathLength(){return n.load(this.int32View,u.PATH_LENGTH/4)}setPathLength(e){n.store(this.int32View,u.PATH_LENGTH/4,e)}getDataLength(){return n.load(this.int32View,u.DATA_LENGTH/4)}setDataLength(e){n.store(this.int32View,u.DATA_LENGTH/4,e)}getResultLength(){return n.load(this.int32View,u.RESULT_LENGTH/4)}setResultLength(e){n.store(this.int32View,u.RESULT_LENGTH/4,e)}getErrorCode(){return n.load(this.int32View,u.ERROR_CODE/4)}setErrorCode(e){n.store(this.int32View,u.ERROR_CODE/4,e)}getFlags(){return n.load(this.int32View,u.FLAGS/4)}setFlags(e){n.store(this.int32View,u.FLAGS/4,e)}getMode(){return n.load(this.int32View,u.MODE/4)}setMode(e){n.store(this.int32View,u.MODE/4,e)}getPath(){let e=this.getPathLength(),t=this.uint8View.slice(u.PATH_BUFFER,u.PATH_BUFFER+e);return new TextDecoder().decode(t)}setPath(e){let t=new TextEncoder().encode(e);if(t.length>d.PATH_BUFFER)throw Error(`Path too long: ${t.length} > ${d.PATH_BUFFER}`);this.uint8View.set(t,u.PATH_BUFFER),this.setPathLength(t.length)}getData(){let e=this.getDataLength();return this.uint8View.slice(u.DATA_BUFFER,u.DATA_BUFFER+e)}setData(e){if(e.length>d.DATA_BUFFER)throw Error(`Data too large: ${e.length} > ${d.DATA_BUFFER}`);this.uint8View.set(e,u.DATA_BUFFER),this.setDataLength(e.length)}getDataAsString(){let e=this.getData();return new TextDecoder().decode(e)}setDataFromString(e){let t=new TextEncoder().encode(e);this.setData(t)}getResult(){let e=this.getResultLength();return this.uint8View.slice(u.DATA_BUFFER,u.DATA_BUFFER+e)}setResult(e){if(e.length>d.DATA_BUFFER)throw Error(`Result too large: ${e.length} > ${d.DATA_BUFFER}`);this.uint8View.set(e,u.DATA_BUFFER),this.setResultLength(e.length)}getResultAsString(){let e=this.getResult();return new TextDecoder().decode(e)}setResultFromString(e){let t=new TextEncoder().encode(e);this.setResult(t)}encodeStat(e){this.uint8View[u.DATA_BUFFER+p.IS_FILE]=+!!e.isFile,this.uint8View[u.DATA_BUFFER+p.IS_DIRECTORY]=+!!e.isDirectory,this.uint8View[u.DATA_BUFFER+p.IS_SYMLINK]=+!!e.isSymbolicLink,this.dataView.setInt32(u.DATA_BUFFER+p.MODE,e.mode,!0);let t=Math.min(e.size,2**53-1);this.dataView.setFloat64(u.DATA_BUFFER+p.SIZE,t,!0),this.dataView.setFloat64(u.DATA_BUFFER+p.MTIME,e.mtime.getTime(),!0),this.setResultLength(p.TOTAL)}decodeStat(){return{isFile:this.uint8View[u.DATA_BUFFER+p.IS_FILE]===1,isDirectory:this.uint8View[u.DATA_BUFFER+p.IS_DIRECTORY]===1,isSymbolicLink:this.uint8View[u.DATA_BUFFER+p.IS_SYMLINK]===1,mode:this.dataView.getInt32(u.DATA_BUFFER+p.MODE,!0),size:this.dataView.getFloat64(u.DATA_BUFFER+p.SIZE,!0),mtime:new Date(this.dataView.getFloat64(u.DATA_BUFFER+p.MTIME,!0))}}waitForReady(e){return n.wait(this.int32View,u.STATUS/4,c.PENDING,e)}waitForReadyAsync(e){return n.waitAsync(this.int32View,u.STATUS/4,c.PENDING,e)}async waitUntilReady(e){let t=Date.now();for(;;){let r=this.getStatus();if(r===c.READY)return!0;let i=Date.now()-t;if(i>=e)return!1;let a=e-i,o=n.waitAsync(this.int32View,u.STATUS/4,r,a);if(o.async&&await o.value===`timed-out`)return!1}}waitForResult(e){return n.wait(this.int32View,u.STATUS/4,c.READY,e)}notify(){return n.notify(this.int32View,u.STATUS/4)}reset(){this.setOpCode(s.NOOP),this.setStatus(c.PENDING),this.setPathLength(0),this.setDataLength(0),this.setResultLength(0),this.setErrorCode(l.NONE),this.setFlags(f.NONE),this.setMode(0)}},g=class{fs;cwd;commandName;secureFetch;maxOutputSize;exec;protocol;running=!1;output={stdout:``,stderr:``,exitCode:0};outputLimitExceeded=!1;startTime=0;timeoutMs=0;constructor(e,t,n,r,i=void 0,a=0,o=void 0){this.fs=t,this.cwd=n,this.commandName=r,this.secureFetch=i,this.maxOutputSize=a,this.exec=o,this.protocol=new h(e)}remainingMs(){return Math.max(0,this.timeoutMs-(Date.now()-this.startTime))}raceDeadline(e){let t=this.remainingMs();if(t<=0)return this.running=!1,this.output.exitCode=124,this.output.stderr+=`
2
2
  ${this.commandName}: execution timeout exceeded
3
- `,Promise.reject(Error(`Operation timed out`));let n=e();return new Promise((e,a)=>{let o=i(()=>{this.running=!1,this.output.exitCode=124,this.output.stderr+=`
3
+ `,Promise.reject(Error(`Operation timed out`));let n=e();return new Promise((e,r)=>{let i=o(()=>{this.running=!1,this.output.exitCode=124,this.output.stderr+=`
4
4
  ${this.commandName}: execution timeout exceeded
5
- `,a(Error(`Operation timed out`))},t);n.then(t=>{r(o),e(t)},e=>{r(o),a(e)})})}async run(e){for(this.running=!0,this.startTime=Date.now(),this.timeoutMs=e;this.running;){if(Date.now()-this.startTime>=e){this.output.stderr+=`
5
+ `,r(Error(`Operation timed out`))},t);n.then(t=>{a(i),e(t)},e=>{a(i),r(e)})})}async run(e){for(this.running=!0,this.startTime=Date.now(),this.timeoutMs=e;this.running;){if(Date.now()-this.startTime>=e){this.output.stderr+=`
6
6
  ${this.commandName}: execution timeout exceeded
7
7
  `,this.output.exitCode=124;break}let t=this.remainingMs();if(!await this.protocol.waitUntilReady(t)){this.output.stderr+=`
8
8
  ${this.commandName}: execution timeout exceeded
9
9
  `,this.output.exitCode=124;break}let n=this.protocol.getOpCode();await this.handleOperation(n),this.protocol.notify()}return this.output}stop(){this.running=!1}async handleOperation(e){try{switch(e){case s.READ_FILE:await this.handleReadFile();break;case s.WRITE_FILE:await this.handleWriteFile();break;case s.STAT:await this.handleStat();break;case s.LSTAT:await this.handleLstat();break;case s.READDIR:await this.handleReaddir();break;case s.MKDIR:await this.handleMkdir();break;case s.RM:await this.handleRm();break;case s.EXISTS:await this.handleExists();break;case s.APPEND_FILE:await this.handleAppendFile();break;case s.SYMLINK:await this.handleSymlink();break;case s.READLINK:await this.handleReadlink();break;case s.CHMOD:await this.handleChmod();break;case s.REALPATH:await this.handleRealpath();break;case s.RENAME:await this.handleRename();break;case s.COPY_FILE:await this.handleCopyFile();break;case s.WRITE_STDOUT:this.handleWriteStdout();break;case s.WRITE_STDERR:this.handleWriteStderr();break;case s.EXIT:this.handleExit();break;case s.HTTP_REQUEST:await this.handleHttpRequest();break;case s.EXEC_COMMAND:await this.handleExecCommand();break;default:this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setStatus(c.ERROR)}}catch(e){this.setErrorFromException(e)}}resolvePath(e){return this.fs.resolvePath(this.cwd,e)}async handleReadFile(){let e=this.resolvePath(this.protocol.getPath());try{let t=await this.fs.readFileBuffer(e);this.protocol.setResult(t),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleWriteFile(){let e=this.resolvePath(this.protocol.getPath()),t=this.protocol.getData();try{await this.fs.writeFile(e,t),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleStat(){let e=this.resolvePath(this.protocol.getPath());try{let t=await this.fs.stat(e);this.protocol.encodeStat(t),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleLstat(){let e=this.resolvePath(this.protocol.getPath());try{let t=await this.fs.lstat(e);this.protocol.encodeStat(t),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReaddir(){let e=this.resolvePath(this.protocol.getPath());try{let t=await this.fs.readdir(e);this.protocol.setResultFromString(JSON.stringify(t)),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleMkdir(){let e=this.resolvePath(this.protocol.getPath()),t=(this.protocol.getFlags()&f.MKDIR_RECURSIVE)!==0;try{await this.fs.mkdir(e,{recursive:t}),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleRm(){let e=this.resolvePath(this.protocol.getPath()),t=this.protocol.getFlags(),n=(t&f.RECURSIVE)!==0,r=(t&f.FORCE)!==0;try{await this.fs.rm(e,{recursive:n,force:r}),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleExists(){let e=this.resolvePath(this.protocol.getPath());try{let t=await this.fs.exists(e);this.protocol.setResult(new Uint8Array([+!!t])),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleAppendFile(){let e=this.resolvePath(this.protocol.getPath()),t=this.protocol.getData();try{await this.fs.appendFile(e,t),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleSymlink(){let e=this.protocol.getPath(),t=this.protocol.getDataAsString(),n=this.resolvePath(e);try{await this.fs.symlink(t,n),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleReadlink(){let e=this.resolvePath(this.protocol.getPath());try{let t=await this.fs.readlink(e);this.protocol.setResultFromString(t),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleChmod(){let e=this.resolvePath(this.protocol.getPath()),t=this.protocol.getMode();try{await this.fs.chmod(e,t),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleRealpath(){let e=this.resolvePath(this.protocol.getPath());try{let t=await this.fs.realpath(e);this.protocol.setResultFromString(t),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleRename(){let e=this.resolvePath(this.protocol.getPath()),t=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.mv(e,t),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}async handleCopyFile(){let e=this.resolvePath(this.protocol.getPath()),t=this.resolvePath(this.protocol.getDataAsString());try{await this.fs.cp(e,t),this.protocol.setStatus(c.SUCCESS)}catch(e){this.setErrorFromException(e)}}handleWriteStdout(){let e=this.protocol.getDataAsString();if(!this.tryAppendOutput(`stdout`,e)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString(`Output size limit exceeded`),this.protocol.setStatus(c.ERROR);return}this.protocol.setStatus(c.SUCCESS)}handleWriteStderr(){let e=this.protocol.getDataAsString();if(!this.tryAppendOutput(`stderr`,e)){this.outputLimitExceeded=!0,this.output.exitCode=1,this.appendOutputLimitError(),this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString(`Output size limit exceeded`),this.protocol.setStatus(c.ERROR);return}this.protocol.setStatus(c.SUCCESS)}handleExit(){let e=this.protocol.getFlags();this.outputLimitExceeded?this.output.exitCode===0&&(this.output.exitCode=1):this.output.exitCode=e,this.protocol.setStatus(c.SUCCESS),this.running=!1}tryAppendOutput(e,t){return this.outputLimitExceeded?!1:this.maxOutputSize<=0?(e===`stdout`?this.output.stdout+=t:this.output.stderr+=t,!0):this.output.stdout.length+this.output.stderr.length+t.length>this.maxOutputSize?!1:(e===`stdout`?this.output.stdout+=t:this.output.stderr+=t,!0)}appendOutputLimitError(){if(this.maxOutputSize<=0)return;let e=`${this.commandName}: total output size exceeded (>${this.maxOutputSize} bytes), increase executionLimits.maxOutputSize
10
- `,t=e.length>this.maxOutputSize?e.slice(0,this.maxOutputSize):e;if(this.output.stderr.includes(`total output size exceeded`))return;let n=this.output.stdout.length+this.output.stderr.length+t.length-this.maxOutputSize;if(n>0){if(this.output.stdout.length>=n)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-n);else{let e=n-this.output.stdout.length;this.output.stdout=``,e>=this.output.stderr.length?this.output.stderr=``:this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-e)}}this.output.stderr+=t}async handleHttpRequest(){let t=this.secureFetch;if(!t){this.protocol.setErrorCode(l.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString(`Network access not configured. Enable network in Bash options.`),this.protocol.setStatus(c.ERROR);return}let n=this.protocol.getPath(),r=this.protocol.getDataAsString();try{let i=r?JSON.parse(r):{},a=this.remainingMs(),o=await this.raceDeadline(()=>t(n,{method:i.method,headers:i.headers,body:i.body,timeoutMs:a})),s=JSON.stringify({status:o.status,statusText:o.statusText,headers:o.headers,bodyBase64:e(o.body,`base64`),url:o.url});this.protocol.setResultFromString(s),this.protocol.setStatus(c.SUCCESS)}catch(e){let t=o(e instanceof Error?e.message:String(e));this.protocol.setErrorCode(l.NETWORK_ERROR),this.protocol.setResultFromString(t),this.protocol.setStatus(c.ERROR)}}async handleExecCommand(){let e=this.exec;if(!e){this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString(`Command execution not available in this context.`),this.protocol.setStatus(c.ERROR);return}let t=this.protocol.getPath(),n=this.protocol.getDataAsString(),r=new AbortController;try{let i={cwd:this.cwd,signal:r.signal};if(n){let e=JSON.parse(n);e.stdin&&(i.stdin=e.stdin),e.args&&Array.isArray(e.args)&&(i.args=e.args.map(e=>String(e)),t=a([t]))}let o=await this.raceDeadline(()=>e(t,i)),s=JSON.stringify({stdout:o.stdout,stderr:o.stderr,exitCode:o.exitCode});this.protocol.setResultFromString(s),this.protocol.setStatus(c.SUCCESS)}catch(e){r.abort();let t=e instanceof Error?e.message:String(e);this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString(t),this.protocol.setStatus(c.ERROR)}}setErrorFromException(e){let t=e instanceof Error?e.message:String(e),n=o(t),r=l.IO_ERROR,i=t.toLowerCase();i.includes(`no such file`)||i.includes(`not found`)||i.includes(`enoent`)?r=l.NOT_FOUND:i.includes(`is a directory`)||i.includes(`eisdir`)?r=l.IS_DIRECTORY:i.includes(`not a directory`)||i.includes(`enotdir`)?r=l.NOT_DIRECTORY:i.includes(`already exists`)||i.includes(`eexist`)?r=l.EXISTS:(i.includes(`permission`)||i.includes(`eperm`)||i.includes(`eacces`))&&(r=l.PERMISSION_DENIED),this.protocol.setErrorCode(r),this.protocol.setResultFromString(n),this.protocol.setStatus(c.ERROR)}};export{m as n,g as t};
10
+ `,t=e.length>this.maxOutputSize?e.slice(0,this.maxOutputSize):e;if(this.output.stderr.includes(`total output size exceeded`))return;let n=this.output.stdout.length+this.output.stderr.length+t.length-this.maxOutputSize;if(n>0){if(this.output.stdout.length>=n)this.output.stdout=this.output.stdout.slice(0,this.output.stdout.length-n);else{let e=n-this.output.stdout.length;this.output.stdout=``,e>=this.output.stderr.length?this.output.stderr=``:this.output.stderr=this.output.stderr.slice(0,this.output.stderr.length-e)}}this.output.stderr+=t}async handleHttpRequest(){let t=this.secureFetch;if(!t){this.protocol.setErrorCode(l.NETWORK_NOT_CONFIGURED),this.protocol.setResultFromString(`Network access not configured. Enable network in Bash options.`),this.protocol.setStatus(c.ERROR);return}let n=this.protocol.getPath(),i=this.protocol.getDataAsString();try{let r=i?JSON.parse(i):{},a=this.remainingMs(),o=await this.raceDeadline(()=>t(n,{method:r.method,headers:r.headers,body:r.body,timeoutMs:a})),s=JSON.stringify({status:o.status,statusText:o.statusText,headers:o.headers,bodyBase64:e(o.body,`base64`),url:o.url});this.protocol.setResultFromString(s),this.protocol.setStatus(c.SUCCESS)}catch(e){let t=r(e instanceof Error?e.message:String(e));this.protocol.setErrorCode(l.NETWORK_ERROR),this.protocol.setResultFromString(t),this.protocol.setStatus(c.ERROR)}}async handleExecCommand(){let e=this.exec;if(!e){this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString(`Command execution not available in this context.`),this.protocol.setStatus(c.ERROR);return}let t=this.protocol.getPath(),n=this.protocol.getDataAsString(),r=new AbortController;try{let a={cwd:this.cwd,signal:r.signal};if(n){let e=JSON.parse(n);e.stdin&&(a.stdin=e.stdin),e.args&&Array.isArray(e.args)&&(a.args=e.args.map(e=>String(e)),t=i([t]))}let o=await this.raceDeadline(()=>e(t,a)),s=JSON.stringify({stdout:o.stdout,stderr:o.stderr,exitCode:o.exitCode});this.protocol.setResultFromString(s),this.protocol.setStatus(c.SUCCESS)}catch(e){r.abort();let t=e instanceof Error?e.message:String(e);this.protocol.setErrorCode(l.IO_ERROR),this.protocol.setResultFromString(t),this.protocol.setStatus(c.ERROR)}}setErrorFromException(e){let t=e instanceof Error?e.message:String(e),n=r(t),i=l.IO_ERROR,a=t.toLowerCase();a.includes(`no such file`)||a.includes(`not found`)||a.includes(`enoent`)?i=l.NOT_FOUND:a.includes(`is a directory`)||a.includes(`eisdir`)?i=l.IS_DIRECTORY:a.includes(`not a directory`)||a.includes(`enotdir`)?i=l.NOT_DIRECTORY:a.includes(`already exists`)||a.includes(`eexist`)?i=l.EXISTS:(a.includes(`permission`)||a.includes(`eperm`)||a.includes(`eacces`))&&(i=l.PERMISSION_DENIED),this.protocol.setErrorCode(i),this.protocol.setResultFromString(n),this.protocol.setStatus(c.ERROR)}};export{m as n,g as t};
@@ -1,11 +1,11 @@
1
- import{t as e}from"./chunk-B74TABJS-DAm9lxFL.mjs";import{t}from"./chunk-IPJHKYVM-BuXAD82m.mjs";import{r as n,t as r}from"./chunk-74CEPOFO-BuzahJu2.mjs";import{t as i}from"./chunk-X2AJGDEF-CsSnWGW7.mjs";import{t as a}from"./chunk-SNN4IESC-CQKipF97.mjs";import{n as o,r as s,t as c}from"./chunk-EEXR5ZDP-Du7J2N1G.mjs";function l(t,n){switch(t.type){case`name`:{let e=t.pattern,r=e.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let e=r[1],i=n.name;if(t.ignoreCase){if(!i.toLowerCase().endsWith(e.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!i.endsWith(e))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:a(n.name,e,t.ignoreCase),pruned:!1,printed:!1}}case`path`:{let e=t.pattern,r=n.relativePath,i=e.split(`/`);for(let e=0;e<i.length-1;e++){let n=i[e];if(n&&n!==`.`&&n!==`..`&&!n.includes(`*`)&&!n.includes(`?`)&&!n.includes(`[`)){let e=`/${n}/`;if(t.ignoreCase){if(!r.toLowerCase().includes(e.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(e))return{matches:!1,pruned:!1,printed:!1}}}let o=e.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let e=o[1];if(t.ignoreCase){if(!r.toLowerCase().endsWith(e.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(e))return{matches:!1,pruned:!1,printed:!1}}return{matches:a(r,e,t.ignoreCase),pruned:!1,printed:!1}}case`regex`:try{let r=t.ignoreCase?`i`:``;return{matches:e(t.pattern,r).test(n.relativePath),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case`type`:return t.fileType===`f`?{matches:n.isFile,pruned:!1,printed:!1}:t.fileType===`d`?{matches:n.isDirectory,pruned:!1,printed:!1}:{matches:!1,pruned:!1,printed:!1};case`empty`:return{matches:n.isEmpty,pruned:!1,printed:!1};case`mtime`:{let e=(Date.now()-n.mtime)/864e5,r;return r=t.comparison===`more`?e>t.days:t.comparison===`less`?e<t.days:Math.floor(e)===t.days,{matches:r,pruned:!1,printed:!1}}case`newer`:{let e=n.newerRefTimes.get(t.refPath);return e===void 0?{matches:!1,pruned:!1,printed:!1}:{matches:n.mtime>e,pruned:!1,printed:!1}}case`size`:{let e=t.value;switch(t.unit){case`c`:e=t.value;break;case`k`:e=t.value*1024;break;case`M`:e=t.value*1024*1024;break;case`G`:e=t.value*1024*1024*1024;break;case`b`:e=t.value*512}let r;return r=t.comparison===`more`?n.size>e:t.comparison===`less`?n.size<e:t.unit===`b`?Math.ceil(n.size/512)===t.value:n.size===e,{matches:r,pruned:!1,printed:!1}}case`perm`:{let e=n.mode&511,r=t.mode&511,i;return i=t.matchType===`exact`?e===r:t.matchType===`all`?(e&r)===r:(e&r)!==0,{matches:i,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 e=l(t.expr,n);return{matches:!e.matches,pruned:e.pruned,printed:!1}}case`and`:{let e=l(t.left,n);if(!e.matches)return{matches:!1,pruned:e.pruned,printed:!1};let r=l(t.right,n);return{matches:r.matches,pruned:e.pruned||r.pruned,printed:e.printed||r.printed}}case`or`:{let e=l(t.left,n);if(e.matches)return e;let r=l(t.right,n);return{matches:r.matches,pruned:e.pruned||r.pruned,printed:r.printed}}}}function u(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 u(e.expr);case`and`:case`or`:return u(e.left)||u(e.right)}}function d(e){if(!e)return!1;switch(e.type){case`empty`:return!0;case`not`:return d(e.expr);case`and`:case`or`:return d(e.left)||d(e.right);default:return!1}}function f(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=p(e);if(m(e)&&n.length===1){let e=n[0].split(`/`).filter(e=>e.length>0);if(e.length>=2)for(let n=e.length-2;n>=0;n--){let r=e[n];if(!r.includes(`*`)&&!r.includes(`?`)&&!r.includes(`[`)&&r!==`.`&&r!==`..`){let i=e[n+1];if(i&&(i.includes(`*`)||i.includes(`?`))){t.terminalDirName=r;let e=i.match(/^\*(\.[a-zA-Z0-9]+)$/);e&&(t.requiredExtension=e[1])}break}}}return t}function p(e){let t=[],n=e=>{e.type===`path`?t.push(e.pattern):e.type===`not`?n(e.expr):(e.type===`and`||e.type===`or`)&&(n(e.left),n(e.right))};return n(e),t}function m(e){let t=e=>e.type===`type`&&e.fileType===`f`?!0:e.type===`not`?t(e.expr):e.type===`and`||e.type===`or`?t(e.left)||t(e.right):!1;return t(e)}function h(e){let t=[],n=e=>{e&&(e.type===`newer`?t.push(e.refPath):e.type===`not`?n(e.expr):(e.type===`and`||e.type===`or`)&&(n(e.left),n(e.right)))};return n(e),t}function g(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 g(e.expr);case`and`:case`or`:return g(e.left)&&g(e.right)}}function _(t,n,r,i,o){switch(t.type){case`name`:{let e=t.pattern,r=e.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let e=r[1];if(t.ignoreCase){if(!n.toLowerCase().endsWith(e.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!n.endsWith(e))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:a(n,e,t.ignoreCase),pruned:!1,printed:!1}}case`path`:{let e=t.pattern,n=e.split(`/`);for(let e=0;e<n.length-1;e++){let i=n[e];if(i&&i!==`.`&&i!==`..`&&!i.includes(`*`)&&!i.includes(`?`)&&!i.includes(`[`)){let e=`/${i}/`;if(t.ignoreCase){if(!r.toLowerCase().includes(e.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(e))return{matches:!1,pruned:!1,printed:!1}}}let i=e.match(/\*(\.[a-zA-Z0-9]+)$/);if(i){let e=i[1];if(t.ignoreCase){if(!r.toLowerCase().endsWith(e.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(e))return{matches:!1,pruned:!1,printed:!1}}return{matches:a(r,e,t.ignoreCase),pruned:!1,printed:!1}}case`regex`:try{let n=t.ignoreCase?`i`:``;return{matches:e(t.pattern,n).test(r),pruned:!1,printed:!1}}catch{return{matches:!1,pruned:!1,printed:!1}}case`type`:return t.fileType===`f`?{matches:i,pruned:!1,printed:!1}:t.fileType===`d`?{matches:o,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 e=_(t.expr,n,r,i,o);return{matches:!e.matches,pruned:e.pruned,printed:!1}}case`and`:{let e=_(t.left,n,r,i,o);if(!e.matches)return{matches:!1,pruned:e.pruned,printed:!1};let a=_(t.right,n,r,i,o);return{matches:a.matches,pruned:e.pruned||a.pruned,printed:e.printed||a.printed}}case`or`:{let e=_(t.left,n,r,i,o);if(e.matches)return e;let a=_(t.right,n,r,i,o);return{matches:a.matches,pruned:e.pruned||a.pruned,printed:a.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 y(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 y(e.expr);case`and`:case`or`:return y(e.left)&&y(e.right)}}function b(e,t){return!e||!t.isDirectory?{shouldPrune:!1}:y(e)?{shouldPrune:l(e,{name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map}).pruned}:x(e,t)}function x(e,t){switch(e.type){case`or`:if(y(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(l(e.left,n).pruned)return{shouldPrune:!0}}return x(e.right,t);case`and`:if(y(e.left)&&y(e.right))return{shouldPrune:l(e,{name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map}).pruned};if(y(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 l(e.left,n).matches?x(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1};case`not`:return{shouldPrune:!1};default:return{shouldPrune:!1}}}function S(e,t){let n=[],r=[],i=t;for(;i<e.length;){let t=e[i];if(t===`(`||t===`\\(`){n.push({type:`lparen`}),i++;continue}if(t===`)`||t===`\\)`){n.push({type:`rparen`}),i++;continue}if(t===`-name`&&i+1<e.length)n.push({type:`expr`,expr:{type:`name`,pattern:e[++i]}});else if(t===`-iname`&&i+1<e.length)n.push({type:`expr`,expr:{type:`name`,pattern:e[++i],ignoreCase:!0}});else if(t===`-path`&&i+1<e.length)n.push({type:`expr`,expr:{type:`path`,pattern:e[++i]}});else if(t===`-ipath`&&i+1<e.length)n.push({type:`expr`,expr:{type:`path`,pattern:e[++i],ignoreCase:!0}});else if(t===`-regex`&&i+1<e.length)n.push({type:`expr`,expr:{type:`regex`,pattern:e[++i]}});else if(t===`-iregex`&&i+1<e.length)n.push({type:`expr`,expr:{type:`regex`,pattern:e[++i],ignoreCase:!0}});else if(t===`-type`&&i+1<e.length){let t=e[++i];if(t===`f`||t===`d`)n.push({type:`expr`,expr:{type:`type`,fileType:t}});else return{expr:null,pathIndex:i,error:`find: Unknown argument to -type: ${t}
1
+ import{r as e,t}from"./chunk-74CEPOFO-BuzahJu2.mjs";import{t as n}from"./chunk-B74TABJS-DAm9lxFL.mjs";import{t as r}from"./chunk-X2AJGDEF-CsSnWGW7.mjs";import{t as i}from"./chunk-SNN4IESC-CQKipF97.mjs";import{t as a}from"./chunk-IPJHKYVM-BuXAD82m.mjs";import{n as o,r as s,t as c}from"./chunk-EEXR5ZDP-Du7J2N1G.mjs";function l(e,t){switch(e.type){case`name`:{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let n=r[1],i=t.name;if(e.ignoreCase){if(!i.toLowerCase().endsWith(n.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!i.endsWith(n))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:i(t.name,n,e.ignoreCase),pruned:!1,printed:!1}}case`path`:{let n=e.pattern,r=t.relativePath,a=n.split(`/`);for(let t=0;t<a.length-1;t++){let n=a[t];if(n&&n!==`.`&&n!==`..`&&!n.includes(`*`)&&!n.includes(`?`)&&!n.includes(`[`)){let t=`/${n}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(t))return{matches:!1,pruned:!1,printed:!1}}}let o=n.match(/\*(\.[a-zA-Z0-9]+)$/);if(o){let t=o[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(t))return{matches:!1,pruned:!1,printed:!1}}return{matches:i(r,n,e.ignoreCase),pruned:!1,printed:!1}}case`regex`:try{let r=e.ignoreCase?`i`:``;return{matches:n(e.pattern,r).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 n=(Date.now()-t.mtime)/864e5,r;return r=e.comparison===`more`?n>e.days:e.comparison===`less`?n<e.days:Math.floor(n)===e.days,{matches:r,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}let r;return r=e.comparison===`more`?t.size>n:e.comparison===`less`?t.size<n:e.unit===`b`?Math.ceil(t.size/512)===e.value:t.size===n,{matches:r,pruned:!1,printed:!1}}case`perm`:{let n=t.mode&511,r=e.mode&511,i;return i=e.matchType===`exact`?n===r:e.matchType===`all`?(n&r)===r:(n&r)!==0,{matches:i,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=l(e.expr,t);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case`and`:{let n=l(e.left,t);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let r=l(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:n.printed||r.printed}}case`or`:{let n=l(e.left,t);if(n.matches)return n;let r=l(e.right,t);return{matches:r.matches,pruned:n.pruned||r.pruned,printed:r.printed}}}}function u(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 u(e.expr);case`and`:case`or`:return u(e.left)||u(e.right)}}function d(e){if(!e)return!1;switch(e.type){case`empty`:return!0;case`not`:return d(e.expr);case`and`:case`or`:return d(e.left)||d(e.right);default:return!1}}function f(e){let t={terminalDirName:null,requiredExtension:null};if(!e)return t;let n=p(e);if(m(e)&&n.length===1){let e=n[0].split(`/`).filter(e=>e.length>0);if(e.length>=2)for(let n=e.length-2;n>=0;n--){let r=e[n];if(!r.includes(`*`)&&!r.includes(`?`)&&!r.includes(`[`)&&r!==`.`&&r!==`..`){let i=e[n+1];if(i&&(i.includes(`*`)||i.includes(`?`))){t.terminalDirName=r;let e=i.match(/^\*(\.[a-zA-Z0-9]+)$/);e&&(t.requiredExtension=e[1])}break}}}return t}function p(e){let t=[],n=e=>{e.type===`path`?t.push(e.pattern):e.type===`not`?n(e.expr):(e.type===`and`||e.type===`or`)&&(n(e.left),n(e.right))};return n(e),t}function m(e){let t=e=>e.type===`type`&&e.fileType===`f`?!0:e.type===`not`?t(e.expr):e.type===`and`||e.type===`or`?t(e.left)||t(e.right):!1;return t(e)}function h(e){let t=[],n=e=>{e&&(e.type===`newer`?t.push(e.refPath):e.type===`not`?n(e.expr):(e.type===`and`||e.type===`or`)&&(n(e.left),n(e.right)))};return n(e),t}function g(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 g(e.expr);case`and`:case`or`:return g(e.left)&&g(e.right)}}function _(e,t,r,a,o){switch(e.type){case`name`:{let n=e.pattern,r=n.match(/^\*(\.[a-zA-Z0-9]+)$/);if(r){let n=r[1];if(e.ignoreCase){if(!t.toLowerCase().endsWith(n.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!t.endsWith(n))return{matches:!1,pruned:!1,printed:!1};return{matches:!0,pruned:!1,printed:!1}}return{matches:i(t,n,e.ignoreCase),pruned:!1,printed:!1}}case`path`:{let t=e.pattern,n=t.split(`/`);for(let t=0;t<n.length-1;t++){let i=n[t];if(i&&i!==`.`&&i!==`..`&&!i.includes(`*`)&&!i.includes(`?`)&&!i.includes(`[`)){let t=`/${i}/`;if(e.ignoreCase){if(!r.toLowerCase().includes(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.includes(t))return{matches:!1,pruned:!1,printed:!1}}}let a=t.match(/\*(\.[a-zA-Z0-9]+)$/);if(a){let t=a[1];if(e.ignoreCase){if(!r.toLowerCase().endsWith(t.toLowerCase()))return{matches:!1,pruned:!1,printed:!1}}else if(!r.endsWith(t))return{matches:!1,pruned:!1,printed:!1}}return{matches:i(r,t,e.ignoreCase),pruned:!1,printed:!1}}case`regex`:try{let t=e.ignoreCase?`i`:``;return{matches:n(e.pattern,t).test(r),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:o,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 n=_(e.expr,t,r,a,o);return{matches:!n.matches,pruned:n.pruned,printed:!1}}case`and`:{let n=_(e.left,t,r,a,o);if(!n.matches)return{matches:!1,pruned:n.pruned,printed:!1};let i=_(e.right,t,r,a,o);return{matches:i.matches,pruned:n.pruned||i.pruned,printed:n.printed||i.printed}}case`or`:{let n=_(e.left,t,r,a,o);if(n.matches)return n;let i=_(e.right,t,r,a,o);return{matches:i.matches,pruned:n.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 y(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 y(e.expr);case`and`:case`or`:return y(e.left)&&y(e.right)}}function b(e,t){return!e||!t.isDirectory?{shouldPrune:!1}:y(e)?{shouldPrune:l(e,{name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map}).pruned}:x(e,t)}function x(e,t){switch(e.type){case`or`:if(y(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(l(e.left,n).pruned)return{shouldPrune:!0}}return x(e.right,t);case`and`:if(y(e.left)&&y(e.right))return{shouldPrune:l(e,{name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:!1,mtime:0,size:0,mode:0,newerRefTimes:new Map}).pruned};if(y(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 l(e.left,n).matches?x(e.right,t):{shouldPrune:!1}}return{shouldPrune:!1};case`not`:return{shouldPrune:!1};default:return{shouldPrune:!1}}}function S(e,t){let n=[],r=[],i=t;for(;i<e.length;){let t=e[i];if(t===`(`||t===`\\(`){n.push({type:`lparen`}),i++;continue}if(t===`)`||t===`\\)`){n.push({type:`rparen`}),i++;continue}if(t===`-name`&&i+1<e.length)n.push({type:`expr`,expr:{type:`name`,pattern:e[++i]}});else if(t===`-iname`&&i+1<e.length)n.push({type:`expr`,expr:{type:`name`,pattern:e[++i],ignoreCase:!0}});else if(t===`-path`&&i+1<e.length)n.push({type:`expr`,expr:{type:`path`,pattern:e[++i]}});else if(t===`-ipath`&&i+1<e.length)n.push({type:`expr`,expr:{type:`path`,pattern:e[++i],ignoreCase:!0}});else if(t===`-regex`&&i+1<e.length)n.push({type:`expr`,expr:{type:`regex`,pattern:e[++i]}});else if(t===`-iregex`&&i+1<e.length)n.push({type:`expr`,expr:{type:`regex`,pattern:e[++i],ignoreCase:!0}});else if(t===`-type`&&i+1<e.length){let t=e[++i];if(t===`f`||t===`d`)n.push({type:`expr`,expr:{type:`type`,fileType:t}});else return{expr:null,pathIndex:i,error:`find: Unknown argument to -type: ${t}
2
2
  `,actions:[]}}else if(t===`-empty`)n.push({type:`expr`,expr:{type:`empty`}});else if(t===`-mtime`&&i+1<e.length){let t=e[++i],r=`exact`,a=t;t.startsWith(`+`)?(r=`more`,a=t.slice(1)):t.startsWith(`-`)&&(r=`less`,a=t.slice(1));let o=parseInt(a,10);Number.isNaN(o)||n.push({type:`expr`,expr:{type:`mtime`,days:o,comparison:r}})}else if(t===`-newer`&&i+1<e.length){let t=e[++i];n.push({type:`expr`,expr:{type:`newer`,refPath:t}})}else if(t===`-size`&&i+1<e.length){let t=e[++i],r=`exact`,a=t;t.startsWith(`+`)?(r=`more`,a=t.slice(1)):t.startsWith(`-`)&&(r=`less`,a=t.slice(1));let o=a.match(/^(\d+)([ckMGb])?$/);if(o){let e=parseInt(o[1],10),t=o[2]||`b`;n.push({type:`expr`,expr:{type:`size`,value:e,unit:t,comparison:r}})}}else if(t===`-perm`&&i+1<e.length){let t=e[++i],r=`exact`,a=t;t.startsWith(`-`)?(r=`all`,a=t.slice(1)):t.startsWith(`/`)&&(r=`any`,a=t.slice(1));let o=parseInt(a,8);Number.isNaN(o)||n.push({type:`expr`,expr:{type:`perm`,mode:o,matchType:r}})}else if(t===`-prune`)n.push({type:`expr`,expr:{type:`prune`}});else if(t===`-not`||t===`!`)n.push({type:`not`});else if(t===`-o`||t===`-or`)n.push({type:`op`,op:`or`});else if(t===`-a`||t===`-and`)n.push({type:`op`,op:`and`});else if(t===`-maxdepth`||t===`-mindepth`)i++;else if(t!==`-depth`){if(t===`-exec`){let t=[];for(i++;i<e.length&&e[i]!==`;`&&e[i]!==`+`;)t.push(e[i]),i++;if(i>=e.length)return{expr:null,pathIndex:i,error:`find: missing argument to \`-exec'
3
3
  `,actions:[]};let n=e[i]===`+`;r.push({type:`exec`,command:t,batchMode:n})}else if(t===`-print`)n.push({type:`expr`,expr:{type:`print`}}),r.push({type:`print`});else if(t===`-print0`)r.push({type:`print0`});else if(t===`-printf`&&i+1<e.length){let t=e[++i];r.push({type:`printf`,format:t})}else if(t===`-delete`)r.push({type:`delete`});else{if(t.startsWith(`-`))return{expr:null,pathIndex:i,error:`find: unknown predicate '${t}'
4
- `,actions:[]};if(n.length===0){i++;continue}break}}i++}if(n.length===0)return{expr:null,pathIndex:i,actions:r};let a=C(n);return a.error?{expr:null,pathIndex:i,error:a.error,actions:r}:{expr:a.expr,pathIndex:i,actions:r}}function C(e){let t=0;function n(){let n=r();if(!n)return null;for(;t<e.length;){let i=e[t];if(i.type===`op`&&i.op===`or`){t++;let e=r();if(!e)return n;n={type:`or`,left:n,right:e}}else break}return n}function r(){let n=i();if(!n)return null;for(;t<e.length;){let r=e[t];if(r.type===`op`&&r.op===`and`){t++;let e=i();if(!e)return n;n={type:`and`,left:n,right:e}}else if(r.type===`expr`||r.type===`not`||r.type===`lparen`){let e=i();if(!e)return n;n={type:`and`,left:n,right:e}}else break}return n}function i(){if(t<e.length&&e[t].type===`not`){t++;let e=i();return e?{type:`not`,expr:e}:null}return a()}function a(){if(t>=e.length)return null;let r=e[t];if(r.type===`lparen`){t++;let r=n();return t<e.length&&e[t].type===`rparen`&&t++,r}return r.type===`expr`?(t++,r.expr):(r.type,null)}return{expr:n()}}var w=500;function T(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function E(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 D={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`.split(`.`)},O=new Set([`-name`,`-iname`,`-path`,`-ipath`,`-regex`,`-iregex`,`-type`,`-maxdepth`,`-mindepth`,`-mtime`,`-newer`,`-size`,`-perm`]),k={name:`find`,async execute(e,i){if(r(e))return n(D);let a=[],o=null,s=null,c=!1,p=!1;for(let t=0;t<e.length;t++){let n=e[t];if(n===`-maxdepth`&&t+1<e.length)p=!0,o=parseInt(e[++t],10);else if(n===`-mindepth`&&t+1<e.length)p=!0,s=parseInt(e[++t],10);else if(n===`-depth`)p=!0,c=!0;else if(n===`-exec`)for(p=!0,t++;t<e.length&&e[t]!==`;`&&e[t]!==`+`;)t++;else!n.startsWith(`-`)&&n!==`;`&&n!==`+`&&n!==`(`&&n!==`)`&&n!==`\\(`&&n!==`\\)`&&n!==`!`?p||a.push(n):O.has(n)?(p=!0,t++):(n.startsWith(`-`)||n===`(`||n===`\\(`||n===`!`)&&(p=!0)}a.length===0&&a.push(`.`);let{expr:m,error:y,actions:x}=S(e,0);if(y)return{stdout:``,stderr:y,exitCode:1};let C=x.some(e=>e.type===`print`),k=x.length===0,j=[],M=x.some(e=>e.type===`printf`),N=[],P=``,F=0,I=h(m),L=new Map;for(let e of I){let t=i.fs.resolvePath(i.cwd,e);try{let n=await i.fs.stat(t);L.set(e,n.mtime?.getTime()??Date.now())}catch{}}let R=x.some(e=>{if(e.type!==`printf`)return!1;let t=e.format.replace(/%%/g,``);return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(t)}),z=u(m)||R,B=d(m),V=f(m),H=v(m),U=g(m),W=typeof i.fs.readdirWithFileTypes==`function`;for(let e of a){let t=function(t){let n=s===null||t.depth>=s,i=!1;if(n&&m!==null){let e=Date.now(),a;if(U)a=_(m,t.name,t.relativePath,t.isFile,t.isDirectory);else{let e={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:t.isEmpty,mtime:t.stat?.mtime?.getTime()??Date.now(),size:t.stat?.size??0,mode:t.stat?.mode??420,newerRefTimes:L};a=l(m,e)}n=a.matches,i=C?a.printed:n,r.evalCalls++,r.evalTime+=Date.now()-e}else n&&(i=!0);return i?{print:!0,printfData:M?{path:t.relativePath,name:t.name,size:t.stat?.size??0,mtime:t.stat?.mtime?.getTime()??Date.now(),mode:t.stat?.mode??420,isDirectory:t.isDirectory,depth:t.depth,startingPoint:e}:null}:{print:!1,printfData:null}};e.length>1&&e.endsWith(`/`)&&(e=e.slice(0,-1));let n=i.fs.resolvePath(i.cwd,e);try{await i.fs.stat(n)}catch{P+=`find: ${e}: No such file or directory
5
- `,F=1;continue}let r=T(),a=Date.now();async function u(t){let{path:a,depth:s,typeInfo:u}=t;if(r.nodeCount++,s>(o??256))return null;let d,f,p;if(u&&!z)d=u.isFile,f=u.isDirectory;else{try{let e=Date.now();p=await i.fs.stat(a),r.statCalls++,r.statTime+=Date.now()-e}catch{return null}if(!p)return null;d=p.isFile,f=p.isDirectory}let h;h=a===n?e.split(`/`).pop()||e:a.split(`/`).pop()||``;let g=a===n?e:e===`.`?`./${a.slice(n===`/`?n.length:n.length+1)}`:e+a.slice(n.length),_=[],v=null,y=null,x=!1;f&&H&&!c&&(x=b(m,{name:h,relativePath:g,isFile:d,isDirectory:f}).shouldPrune,x&&r.earlyPrunes++);let S=s>=(o??256),C=V.terminalDirName!==null&&h===V.terminalDirName,w=!S&&!C&&!x;if(f&&(w||B||C)&&!x){let e=Date.now();if(W&&i.fs.readdirWithFileTypes){if(v=await i.fs.readdirWithFileTypes(a),y=v.map(e=>e.name),r.readdirCalls++,r.readdirTime+=Date.now()-e,w)_=v.map((e,t)=>({path:a===`/`?`/${e.name}`:`${a}/${e.name}`,depth:s+1,typeInfo:{isFile:e.isFile,isDirectory:e.isDirectory},resultIndex:t}));else if(C){let e=V.requiredExtension;_=v.filter(t=>t.isFile&&(!e||t.name.endsWith(e))).map((e,t)=>({path:a===`/`?`/${e.name}`:`${a}/${e.name}`,depth:s+1,typeInfo:{isFile:e.isFile,isDirectory:e.isDirectory},resultIndex:t}))}}else y=await i.fs.readdir(a),r.readdirCalls++,r.readdirTime+=Date.now()-e,w&&(_=y.map((e,t)=>({path:a===`/`?`/${e}`:`${a}/${e}`,depth:s+1,resultIndex:t})))}let T=d?(p?.size??0)===0:y!==null&&y.length===0,E=x;if(!c&&m!==null&&!x&&H){let e=Date.now(),t={name:h,relativePath:g,isFile:d,isDirectory:f,isEmpty:T,mtime:p?.mtime?.getTime()??Date.now(),size:p?.size??0,mode:p?.mode??420,newerRefTimes:L};E=l(m,t).pruned,r.evalCalls++,r.evalTime+=Date.now()-e}return{relativePath:g,name:h,isFile:d,isDirectory:f,isEmpty:T,stat:p,depth:s,children:E?[]:_,pruned:E}}async function d(){let e={paths:[],printfData:[]};if(c){let i=function(e){let n={paths:[],printfData:[]},r=a[e];if(!r)return n;for(let e of r.childIndices){let t=i(e);n.paths.push(...t.paths),n.printfData.push(...t.printfData)}let{print:o,printfData:s}=t(r.node);return o&&(n.paths.push(r.node.relativePath),s&&n.printfData.push(s)),n},a=[],o=[{item:{path:n,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],s=new Map;for(;o.length>0;){let e=Date.now(),t=o.splice(0,w),n=await Promise.all(t.map(e=>u(e.item)));r.batchCount++,r.batchTime+=Date.now()-e;for(let e=0;e<t.length;e++){let r=n[e],i=t[e];if(!r)continue;let c=a.length;if(i.parentIndex>=0){let e=s.get(i.parentIndex)||[];e.push(c),s.set(i.parentIndex,e)}a.push({node:r,parentIndex:i.parentIndex,childIndices:[]});for(let e=0;e<r.children.length;e++)o.push({item:r.children[e],parentIndex:c,childOrderInParent:e})}}for(let[e,t]of s)e>=0&&e<a.length&&(a[e].childIndices=t);if(a.length>0){let t=i(0);e.paths.push(...t.paths),e.printfData.push(...t.printfData)}}else{let i=function(t){let n=a.get(t);n&&(e.paths.push(n.path),n.printfData&&e.printfData.push(n.printfData));let r=c.get(t);if(r)for(let e of r)i(e)},a=new Map,o=0,s=[{item:{path:n,depth:0,resultIndex:0},orderIndex:o++}],c=new Map;for(;s.length>0;){let e=Date.now(),n=s.splice(0,w),i=await Promise.all(n.map(async({item:e,orderIndex:t})=>{let n=await u(e);return n?{node:n,orderIndex:t}:null}));r.batchCount++,r.batchTime+=Date.now()-e;for(let e of i){if(!e)continue;let{node:n,orderIndex:r}=e,{print:i,printfData:l}=t(n);if(i&&a.set(r,{path:n.relativePath,printfData:l}),n.children.length>0){let e=[];for(let t of n.children){let n=o++;e.push(n),s.push({item:t,orderIndex:n})}c.set(r,e)}}}i(0)}return e}let f=await d();if(j.push(...f.paths),N.push(...f.printfData),i.trace){let t=Date.now()-a;E(i.trace,r,t),i.trace({category:`find`,name:`searchPath`,durationMs:t,details:{path:e,resultsFound:f.paths.length}})}}let G=``;if(x.length>0)for(let e of x)switch(e.type){case`print`:G+=j.length>0?`${j.join(`
4
+ `,actions:[]};if(n.length===0){i++;continue}break}}i++}if(n.length===0)return{expr:null,pathIndex:i,actions:r};let a=C(n);return a.error?{expr:null,pathIndex:i,error:a.error,actions:r}:{expr:a.expr,pathIndex:i,actions:r}}function C(e){let t=0;function n(){let n=r();if(!n)return null;for(;t<e.length;){let i=e[t];if(i.type===`op`&&i.op===`or`){t++;let e=r();if(!e)return n;n={type:`or`,left:n,right:e}}else break}return n}function r(){let n=i();if(!n)return null;for(;t<e.length;){let r=e[t];if(r.type===`op`&&r.op===`and`){t++;let e=i();if(!e)return n;n={type:`and`,left:n,right:e}}else if(r.type===`expr`||r.type===`not`||r.type===`lparen`){let e=i();if(!e)return n;n={type:`and`,left:n,right:e}}else break}return n}function i(){if(t<e.length&&e[t].type===`not`){t++;let e=i();return e?{type:`not`,expr:e}:null}return a()}function a(){if(t>=e.length)return null;let r=e[t];if(r.type===`lparen`){t++;let r=n();return t<e.length&&e[t].type===`rparen`&&t++,r}return r.type===`expr`?(t++,r.expr):(r.type,null)}return{expr:n()}}var w=500;function T(){return{readdirCalls:0,readdirTime:0,statCalls:0,statTime:0,evalCalls:0,evalTime:0,nodeCount:0,batchCount:0,batchTime:0,earlyPrunes:0}}function E(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 D={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`.split(`.`)},O=new Set([`-name`,`-iname`,`-path`,`-ipath`,`-regex`,`-iregex`,`-type`,`-maxdepth`,`-mindepth`,`-mtime`,`-newer`,`-size`,`-perm`]),k={name:`find`,async execute(n,r){if(t(n))return e(D);let i=[],o=null,s=null,c=!1,p=!1;for(let e=0;e<n.length;e++){let t=n[e];if(t===`-maxdepth`&&e+1<n.length)p=!0,o=parseInt(n[++e],10);else if(t===`-mindepth`&&e+1<n.length)p=!0,s=parseInt(n[++e],10);else if(t===`-depth`)p=!0,c=!0;else if(t===`-exec`)for(p=!0,e++;e<n.length&&n[e]!==`;`&&n[e]!==`+`;)e++;else!t.startsWith(`-`)&&t!==`;`&&t!==`+`&&t!==`(`&&t!==`)`&&t!==`\\(`&&t!==`\\)`&&t!==`!`?p||i.push(t):O.has(t)?(p=!0,e++):(t.startsWith(`-`)||t===`(`||t===`\\(`||t===`!`)&&(p=!0)}i.length===0&&i.push(`.`);let{expr:m,error:y,actions:x}=S(n,0);if(y)return{stdout:``,stderr:y,exitCode:1};let C=x.some(e=>e.type===`print`),k=x.length===0,j=[],M=x.some(e=>e.type===`printf`),N=[],P=``,F=0,I=h(m),L=new Map;for(let e of I){let t=r.fs.resolvePath(r.cwd,e);try{let n=await r.fs.stat(t);L.set(e,n.mtime?.getTime()??Date.now())}catch{}}let R=x.some(e=>{if(e.type!==`printf`)return!1;let t=e.format.replace(/%%/g,``);return/%[-+]?[0-9]*\.?[0-9]*(s|m|M|t|T)/.test(t)}),z=u(m)||R,B=d(m),V=f(m),H=v(m),U=g(m),W=typeof r.fs.readdirWithFileTypes==`function`;for(let e of i){let t=function(t){let n=s===null||t.depth>=s,r=!1;if(n&&m!==null){let e=Date.now(),a;if(U)a=_(m,t.name,t.relativePath,t.isFile,t.isDirectory);else{let e={name:t.name,relativePath:t.relativePath,isFile:t.isFile,isDirectory:t.isDirectory,isEmpty:t.isEmpty,mtime:t.stat?.mtime?.getTime()??Date.now(),size:t.stat?.size??0,mode:t.stat?.mode??420,newerRefTimes:L};a=l(m,e)}n=a.matches,r=C?a.printed:n,i.evalCalls++,i.evalTime+=Date.now()-e}else n&&(r=!0);return r?{print:!0,printfData:M?{path:t.relativePath,name:t.name,size:t.stat?.size??0,mtime:t.stat?.mtime?.getTime()??Date.now(),mode:t.stat?.mode??420,isDirectory:t.isDirectory,depth:t.depth,startingPoint:e}:null}:{print:!1,printfData:null}};e.length>1&&e.endsWith(`/`)&&(e=e.slice(0,-1));let n=r.fs.resolvePath(r.cwd,e);try{await r.fs.stat(n)}catch{P+=`find: ${e}: No such file or directory
5
+ `,F=1;continue}let i=T(),a=Date.now();async function u(t){let{path:a,depth:s,typeInfo:u}=t;if(i.nodeCount++,s>(o??256))return null;let d,f,p;if(u&&!z)d=u.isFile,f=u.isDirectory;else{try{let e=Date.now();p=await r.fs.stat(a),i.statCalls++,i.statTime+=Date.now()-e}catch{return null}if(!p)return null;d=p.isFile,f=p.isDirectory}let h;h=a===n?e.split(`/`).pop()||e:a.split(`/`).pop()||``;let g=a===n?e:e===`.`?`./${a.slice(n===`/`?n.length:n.length+1)}`:e+a.slice(n.length),_=[],v=null,y=null,x=!1;f&&H&&!c&&(x=b(m,{name:h,relativePath:g,isFile:d,isDirectory:f}).shouldPrune,x&&i.earlyPrunes++);let S=s>=(o??256),C=V.terminalDirName!==null&&h===V.terminalDirName,w=!S&&!C&&!x;if(f&&(w||B||C)&&!x){let e=Date.now();if(W&&r.fs.readdirWithFileTypes){if(v=await r.fs.readdirWithFileTypes(a),y=v.map(e=>e.name),i.readdirCalls++,i.readdirTime+=Date.now()-e,w)_=v.map((e,t)=>({path:a===`/`?`/${e.name}`:`${a}/${e.name}`,depth:s+1,typeInfo:{isFile:e.isFile,isDirectory:e.isDirectory},resultIndex:t}));else if(C){let e=V.requiredExtension;_=v.filter(t=>t.isFile&&(!e||t.name.endsWith(e))).map((e,t)=>({path:a===`/`?`/${e.name}`:`${a}/${e.name}`,depth:s+1,typeInfo:{isFile:e.isFile,isDirectory:e.isDirectory},resultIndex:t}))}}else y=await r.fs.readdir(a),i.readdirCalls++,i.readdirTime+=Date.now()-e,w&&(_=y.map((e,t)=>({path:a===`/`?`/${e}`:`${a}/${e}`,depth:s+1,resultIndex:t})))}let T=d?(p?.size??0)===0:y!==null&&y.length===0,E=x;if(!c&&m!==null&&!x&&H){let e=Date.now(),t={name:h,relativePath:g,isFile:d,isDirectory:f,isEmpty:T,mtime:p?.mtime?.getTime()??Date.now(),size:p?.size??0,mode:p?.mode??420,newerRefTimes:L};E=l(m,t).pruned,i.evalCalls++,i.evalTime+=Date.now()-e}return{relativePath:g,name:h,isFile:d,isDirectory:f,isEmpty:T,stat:p,depth:s,children:E?[]:_,pruned:E}}async function d(){let e={paths:[],printfData:[]};if(c){let r=function(e){let n={paths:[],printfData:[]},i=a[e];if(!i)return n;for(let e of i.childIndices){let t=r(e);n.paths.push(...t.paths),n.printfData.push(...t.printfData)}let{print:o,printfData:s}=t(i.node);return o&&(n.paths.push(i.node.relativePath),s&&n.printfData.push(s)),n},a=[],o=[{item:{path:n,depth:0,resultIndex:0},parentIndex:-1,childOrderInParent:0}],s=new Map;for(;o.length>0;){let e=Date.now(),t=o.splice(0,w),n=await Promise.all(t.map(e=>u(e.item)));i.batchCount++,i.batchTime+=Date.now()-e;for(let e=0;e<t.length;e++){let r=n[e],i=t[e];if(!r)continue;let c=a.length;if(i.parentIndex>=0){let e=s.get(i.parentIndex)||[];e.push(c),s.set(i.parentIndex,e)}a.push({node:r,parentIndex:i.parentIndex,childIndices:[]});for(let e=0;e<r.children.length;e++)o.push({item:r.children[e],parentIndex:c,childOrderInParent:e})}}for(let[e,t]of s)e>=0&&e<a.length&&(a[e].childIndices=t);if(a.length>0){let t=r(0);e.paths.push(...t.paths),e.printfData.push(...t.printfData)}}else{let r=function(t){let n=a.get(t);n&&(e.paths.push(n.path),n.printfData&&e.printfData.push(n.printfData));let i=c.get(t);if(i)for(let e of i)r(e)},a=new Map,o=0,s=[{item:{path:n,depth:0,resultIndex:0},orderIndex:o++}],c=new Map;for(;s.length>0;){let e=Date.now(),n=s.splice(0,w),r=await Promise.all(n.map(async({item:e,orderIndex:t})=>{let n=await u(e);return n?{node:n,orderIndex:t}:null}));i.batchCount++,i.batchTime+=Date.now()-e;for(let e of r){if(!e)continue;let{node:n,orderIndex:r}=e,{print:i,printfData:l}=t(n);if(i&&a.set(r,{path:n.relativePath,printfData:l}),n.children.length>0){let e=[];for(let t of n.children){let n=o++;e.push(n),s.push({item:t,orderIndex:n})}c.set(r,e)}}}r(0)}return e}let f=await d();if(j.push(...f.paths),N.push(...f.printfData),r.trace){let t=Date.now()-a;E(r.trace,i,t),r.trace({category:`find`,name:`searchPath`,durationMs:t,details:{path:e,resultsFound:f.paths.length}})}}let G=``;if(x.length>0)for(let e of x)switch(e.type){case`print`:G+=j.length>0?`${j.join(`
6
6
  `)}
7
- `:``;break;case`print0`:G+=j.length>0?`${j.join(`\0`)}\0`:``;break;case`delete`:{let e=[...j].sort((e,t)=>t.length-e.length);for(let t of e){let e=i.fs.resolvePath(i.cwd,t);try{await i.fs.rm(e,{recursive:!1})}catch(e){let n=e instanceof Error?e.message:String(e);P+=`find: cannot delete '${t}': ${n}
8
- `,F=1}}break}case`printf`:for(let t of N)G+=A(e.format,t);break;case`exec`:if(!i.exec)return{stdout:``,stderr:`find: -exec not supported in this context
9
- `,exitCode:1};if(e.batchMode){let n=[];for(let t of e.command)t===`{}`?n.push(...j):n.push(t);let r=await i.exec(t([n[0]]),{cwd:i.cwd,signal:i.signal,args:n.slice(1)});G+=r.stdout,P+=r.stderr,r.exitCode!==0&&(F=r.exitCode)}else for(let n of j){let r=e.command.map(e=>e===`{}`?n:e),a=await i.exec(t([r[0]]),{cwd:i.cwd,signal:i.signal,args:r.slice(1)});G+=a.stdout,P+=a.stderr,a.exitCode!==0&&(F=a.exitCode)}}else k&&(G=j.length>0?`${j.join(`
7
+ `:``;break;case`print0`:G+=j.length>0?`${j.join(`\0`)}\0`:``;break;case`delete`:{let e=[...j].sort((e,t)=>t.length-e.length);for(let t of e){let e=r.fs.resolvePath(r.cwd,t);try{await r.fs.rm(e,{recursive:!1})}catch(e){let n=e instanceof Error?e.message:String(e);P+=`find: cannot delete '${t}': ${n}
8
+ `,F=1}}break}case`printf`:for(let t of N)G+=A(e.format,t);break;case`exec`:if(!r.exec)return{stdout:``,stderr:`find: -exec not supported in this context
9
+ `,exitCode:1};if(e.batchMode){let t=[];for(let n of e.command)n===`{}`?t.push(...j):t.push(n);let n=await r.exec(a([t[0]]),{cwd:r.cwd,signal:r.signal,args:t.slice(1)});G+=n.stdout,P+=n.stderr,n.exitCode!==0&&(F=n.exitCode)}else for(let t of j){let n=e.command.map(e=>e===`{}`?t:e),i=await r.exec(a([n[0]]),{cwd:r.cwd,signal:r.signal,args:n.slice(1)});G+=i.stdout,P+=i.stderr,i.exitCode!==0&&(F=i.exitCode)}}else k&&(G=j.length>0?`${j.join(`
10
10
  `)}
11
- `:``);return{stdout:G,stderr:P,exitCode:F}}};function A(e,t){let n=s(e),r=``,a=0;for(;a<n.length;)if(n[a]===`%`&&a+1<n.length){if(a++,n[a]===`%`){r+=`%`,a++;continue}let[e,s,l]=c(n,a);if(a+=l,a>=n.length){r+=`%`;break}let u=n[a],d;switch(u){case`f`:d=t.name,a++;break;case`h`:{let e=t.path.lastIndexOf(`/`);d=e>0?t.path.slice(0,e):`.`,a++;break}case`p`:d=t.path,a++;break;case`P`:{let e=t.startingPoint;d=t.path===e?``:t.path.startsWith(`${e}/`)?t.path.slice(e.length+1):e===`.`&&t.path.startsWith(`./`)?t.path.slice(2):t.path,a++;break}case`s`:d=String(t.size),a++;break;case`d`:d=String(t.depth),a++;break;case`m`:d=(t.mode&511).toString(8),a++;break;case`M`:d=i(t.mode,t.isDirectory),a++;break;case`t`:d=j(new Date(t.mtime)),a++;break;case`T`:if(a+1<n.length){let e=n[a+1];d=M(new Date(t.mtime),e),a+=2}else d=`%T`,a++;break;default:r+=`%${e!==0||s!==-1?`${e}.${s}`:``}${u}`,a++;continue}r+=o(d,e,s)}else r+=n[a],a++;return r}function j(e){return`${[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`][e.getDay()]} ${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][e.getMonth()]} ${String(e.getDate()).padStart(2,` `)} ${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)} ${e.getFullYear()}`}function M(e,t){switch(t){case`@`:return String(e.getTime()/1e3);case`Y`:return String(e.getFullYear());case`m`:return String(e.getMonth()+1).padStart(2,`0`);case`d`:return String(e.getDate()).padStart(2,`0`);case`H`:return String(e.getHours()).padStart(2,`0`);case`M`:return String(e.getMinutes()).padStart(2,`0`);case`S`:return String(e.getSeconds()).padStart(2,`0`);case`T`:return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}`;case`F`:return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;default:return`%T${t}`}}var N={name:`find`,flags:[{flag:`-name`,type:`value`,valueHint:`pattern`},{flag:`-iname`,type:`value`,valueHint:`pattern`},{flag:`-type`,type:`value`,valueHint:`string`},{flag:`-maxdepth`,type:`value`,valueHint:`number`},{flag:`-mindepth`,type:`value`,valueHint:`number`},{flag:`-empty`,type:`boolean`},{flag:`-print`,type:`boolean`},{flag:`-print0`,type:`boolean`}],needsFiles:!0};export{k as n,N as t};
11
+ `:``);return{stdout:G,stderr:P,exitCode:F}}};function A(e,t){let n=s(e),i=``,a=0;for(;a<n.length;)if(n[a]===`%`&&a+1<n.length){if(a++,n[a]===`%`){i+=`%`,a++;continue}let[e,s,l]=c(n,a);if(a+=l,a>=n.length){i+=`%`;break}let u=n[a],d;switch(u){case`f`:d=t.name,a++;break;case`h`:{let e=t.path.lastIndexOf(`/`);d=e>0?t.path.slice(0,e):`.`,a++;break}case`p`:d=t.path,a++;break;case`P`:{let e=t.startingPoint;d=t.path===e?``:t.path.startsWith(`${e}/`)?t.path.slice(e.length+1):e===`.`&&t.path.startsWith(`./`)?t.path.slice(2):t.path,a++;break}case`s`:d=String(t.size),a++;break;case`d`:d=String(t.depth),a++;break;case`m`:d=(t.mode&511).toString(8),a++;break;case`M`:d=r(t.mode,t.isDirectory),a++;break;case`t`:d=j(new Date(t.mtime)),a++;break;case`T`:if(a+1<n.length){let e=n[a+1];d=M(new Date(t.mtime),e),a+=2}else d=`%T`,a++;break;default:i+=`%${e!==0||s!==-1?`${e}.${s}`:``}${u}`,a++;continue}i+=o(d,e,s)}else i+=n[a],a++;return i}function j(e){return`${[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`][e.getDay()]} ${[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`][e.getMonth()]} ${String(e.getDate()).padStart(2,` `)} ${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)} ${e.getFullYear()}`}function M(e,t){switch(t){case`@`:return String(e.getTime()/1e3);case`Y`:return String(e.getFullYear());case`m`:return String(e.getMonth()+1).padStart(2,`0`);case`d`:return String(e.getDate()).padStart(2,`0`);case`H`:return String(e.getHours()).padStart(2,`0`);case`M`:return String(e.getMinutes()).padStart(2,`0`);case`S`:return String(e.getSeconds()).padStart(2,`0`);case`T`:return`${String(e.getHours()).padStart(2,`0`)}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}`;case`F`:return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;default:return`%T${t}`}}var N={name:`find`,flags:[{flag:`-name`,type:`value`,valueHint:`pattern`},{flag:`-iname`,type:`value`,valueHint:`pattern`},{flag:`-type`,type:`value`,valueHint:`string`},{flag:`-maxdepth`,type:`value`,valueHint:`number`},{flag:`-mindepth`,type:`value`,valueHint:`number`},{flag:`-empty`,type:`boolean`},{flag:`-print`,type:`boolean`},{flag:`-print0`,type:`boolean`}],needsFiles:!0};export{k as n,N as t};