sliccy 6.180.1 → 6.182.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/ui/.vite/manifest.json +223 -195
  2. package/dist/ui/assets/__vite-browser-external-CJkRLpJ-.js +1 -0
  3. package/dist/ui/assets/account-store-BxB3138q.js +2 -0
  4. package/dist/ui/assets/account-store-UA_3Tz4g.js +1 -0
  5. package/dist/ui/assets/adobe-C5iQ4vVx.js +2 -0
  6. package/dist/ui/assets/adobe-CGl3cGPR.js +1 -0
  7. package/dist/ui/assets/{agent-panels-D9_ZY4D5.js → agent-panels-DfmjvBS2.js} +1 -1
  8. package/dist/ui/assets/{almost-bash-shell-headless-DZG4oqzH.js → almost-bash-shell-headless-l1xuiFhc.js} +36 -36
  9. package/dist/ui/assets/{apply-layout-Cx30r95g.js → apply-layout-Bq6bvrT2.js} +1 -1
  10. package/dist/ui/assets/{apps-BL2lqoLK.js → apps-BX-IbYH9.js} +1 -1
  11. package/dist/ui/assets/{azure-openai-DjsbbGBV.js → azure-openai-BXvWNypo.js} +1 -1
  12. package/dist/ui/assets/{azure-openai-uHnbNrYv.js → azure-openai-C2dDMpxW.js} +1 -1
  13. package/dist/ui/assets/{backend-hostfs-BS8a2uMa.js → backend-hostfs-DV8kfBUj.js} +1 -1
  14. package/dist/ui/assets/{browser-DG5MjvHF.js → browser-BM_DFzrh.js} +2 -2
  15. package/dist/ui/assets/{bsh-watchdog-DBtF-C4h.js → bsh-watchdog-CmaS7wa9.js} +1 -1
  16. package/dist/ui/assets/{cdp-CR9Bgwdt.js → cdp-B0aSo4ch.js} +1 -1
  17. package/dist/ui/assets/{cerebras-AaPmCrmC.js → cerebras-B2SDJ5pX.js} +1 -1
  18. package/dist/ui/assets/{cerebras-TI77F1wW.js → cerebras-D29ytBVb.js} +1 -1
  19. package/dist/ui/assets/{composer-speech--qTARwXs.js → composer-speech-Dt-gM11M.js} +1 -1
  20. package/dist/ui/assets/{connect-surface-wSlNk5lx.js → connect-surface-Cb3XqWWR.js} +1 -1
  21. package/dist/ui/assets/core-B3ULTK7V.js +62 -0
  22. package/dist/ui/assets/core-CDo7qjEn.js +36 -0
  23. package/dist/ui/assets/{cost-command-DZQVtgRS.js → cost-command-CitGzr6C.js} +1 -1
  24. package/dist/ui/assets/{directed-approval-DP2KanR-.js → directed-approval-BEel8QYA.js} +1 -1
  25. package/dist/ui/assets/{emscripten-vfs-hook-BgP8ByDJ.js → emscripten-vfs-hook-bNKkM3Zb.js} +1 -1
  26. package/dist/ui/assets/{ensure-speech-assets-DdTSFGwk.js → ensure-speech-assets-DnCun_bM.js} +1 -1
  27. package/dist/ui/assets/{esbuild-wasm-DS_YG2EY.js → esbuild-wasm-CeZYVyQ9.js} +1 -1
  28. package/dist/ui/assets/feature-flags-BftQitIZ.js +1 -0
  29. package/dist/ui/assets/feature-flags-ysThCqxC.js +1 -0
  30. package/dist/ui/assets/{ffmpeg-wasm-B77gfnB_.js → ffmpeg-wasm-CV1BmGNS.js} +1 -1
  31. package/dist/ui/assets/{frozen-archive-writer-CCIT2Zwt.js → frozen-archive-writer-DWckLPIx.js} +1 -1
  32. package/dist/ui/assets/fs-Bl1dGTw7.js +2 -0
  33. package/dist/ui/assets/fs-Bvj_6WV6.js +1 -0
  34. package/dist/ui/assets/{gelatiere-store-jM4HX2A2.js → gelatiere-store-CslswlOn.js} +1 -1
  35. package/dist/ui/assets/{gelatiere-unit-DR5zq2su.js → gelatiere-unit-DOffAKPD.js} +1 -1
  36. package/dist/ui/assets/{github-snwIx537.js → github-DRuWNJ0x.js} +2 -2
  37. package/dist/ui/assets/{github-ZM7Q7_O6.js → github-DVquHzS1.js} +1 -1
  38. package/dist/ui/assets/{github-auth-B8mA34CT.js → github-auth-C5UPE82y.js} +1 -1
  39. package/dist/ui/assets/github-copilot-DXbnFsoC.js +1 -0
  40. package/dist/ui/assets/github-copilot-ha5V9jKJ.js +2 -0
  41. package/dist/ui/assets/{github-install-C0u8VOZN.js → github-install-z8nzKR56.js} +1 -1
  42. package/dist/ui/assets/{github-zip-CTQioLZg.js → github-zip-YeBT3Ny7.js} +1 -1
  43. package/dist/ui/assets/{guest-tool-gate-yzMDXmb7.js → guest-tool-gate-Dn4Cs-oT.js} +1 -1
  44. package/dist/ui/assets/{hear-D_vk3lPo.js → hear-ClByyjXy.js} +1 -1
  45. package/dist/ui/assets/{help-BYUkb2dx.js → help-p6vq-7bY.js} +1 -1
  46. package/dist/ui/assets/{host-command-ODKvqvjN.js → host-command-PUA7nfMk.js} +1 -1
  47. package/dist/ui/assets/{installer-Bw6Q7QDH.js → installer-hyWN7t-8.js} +1 -1
  48. package/dist/ui/assets/{interrupted-work-recovery-dk4HMys6.js → interrupted-work-recovery-C3eyzaf0.js} +1 -1
  49. package/dist/ui/assets/js-realm-worker-C8L3DYxo.js +53 -0
  50. package/dist/ui/assets/jsh-executor-BRw7B4H0.js +18 -0
  51. package/dist/ui/assets/{kernel-worker-hZ_EeCIo.js → kernel-worker-DJ8FZwqE.js} +68 -68
  52. package/dist/ui/assets/{lick-ws-bridge-PBwkjqko.js → lick-ws-bridge-AHYpxmrH.js} +1 -1
  53. package/dist/ui/assets/{lick-ws-bridge-CZrq--1Z.js → lick-ws-bridge-DjxKrqtY.js} +1 -1
  54. package/dist/ui/assets/live-session-curation-ChbHqCg_.js +1 -0
  55. package/dist/ui/assets/{live-session-snapshot-Dxy2otGN.js → live-session-snapshot-CEM9afjE.js} +1 -1
  56. package/dist/ui/assets/{local-llm-CfGHxdP5.js → local-llm-3Pq3W9JZ.js} +1 -1
  57. package/dist/ui/assets/{local-llm-D06PYbzn.js → local-llm-DSfR5Yt1.js} +1 -1
  58. package/dist/ui/assets/{magick-wasm-DCNZhAyd.js → magick-wasm-KFp97Nzb.js} +1 -1
  59. package/dist/ui/assets/main-DtPQfxOa.js +22 -0
  60. package/dist/ui/assets/{main-cherry-MA--Ysf4.js → main-cherry-GQeDS2ns.js} +1 -1
  61. package/dist/ui/assets/{memory-curation-seam-BYFAngSZ.js → memory-curation-seam-COOFWWtR.js} +1 -1
  62. package/dist/ui/assets/{memory-health-P_L793qo.js → memory-health-DxPjxnOp.js} +1 -1
  63. package/dist/ui/assets/memory-v2-flag-CX_dAcAR.js +1 -0
  64. package/dist/ui/assets/{memory-write-execute-DbOzn2Ls.js → memory-write-execute-CRxpEM2X.js} +1 -1
  65. package/dist/ui/assets/{mount-BbMOL6lc.js → mount-9N6h5nwh.js} +3 -3
  66. package/dist/ui/assets/{mount-BI96qb-b.js → mount-Dkwa5rwA.js} +1 -1
  67. package/dist/ui/assets/new-session-C2Unp_ay.js +2 -0
  68. package/dist/ui/assets/oauth-bootstrap-3r1LKeNV.js +2 -0
  69. package/dist/ui/assets/{onboarding-orchestrator-BsOs-LDn.js → onboarding-orchestrator-DagKmKCB.js} +1 -1
  70. package/dist/ui/assets/{openai-codex-Yv_pRtqx.js → openai-codex--tiTbtXj.js} +1 -1
  71. package/dist/ui/assets/{openai-codex-BHEC1wxB.js → openai-codex-CJC7uwBp.js} +1 -1
  72. package/dist/ui/assets/{openrouter-BiEHe5c8.js → openrouter-aXBsdtFI.js} +1 -1
  73. package/dist/ui/assets/{openrouter-free-VThl75bi.js → openrouter-free-BeCg7Ecw.js} +1 -1
  74. package/dist/ui/assets/{openrouter-free-Bhl4_AoU.js → openrouter-free-DqFFRvst.js} +1 -1
  75. package/dist/ui/assets/{openrouter-B1f6LZU0.js → openrouter-mBY_6dIp.js} +1 -1
  76. package/dist/ui/assets/{openrouter-oauth-KDRDxcb1.js → openrouter-oauth-C7CZ9fp_.js} +1 -1
  77. package/dist/ui/assets/{openrouter-oauth-Bi8ZFZ_R.js → openrouter-oauth-DQIC6b5R.js} +1 -1
  78. package/dist/ui/assets/{opfs-mount-CkmFzczI.js → opfs-mount-tiZR34GY.js} +1 -1
  79. package/dist/ui/assets/panel-rpc-handlers-D8NOrxvf.js +2 -0
  80. package/dist/ui/assets/{panelize-shell-CJV4yTFm.js → panelize-shell-C_Xs3rhf.js} +1 -1
  81. package/dist/ui/assets/{pi-edit-execution-d1SsBrpu.js → pi-edit-execution-kItlGFSm.js} +1 -1
  82. package/dist/ui/assets/{provider-CJWIlIUh.js → provider-BtTOwLci.js} +2 -2
  83. package/dist/ui/assets/{provider-CY4Z_xHq.js → provider-DuCd6_sr.js} +1 -1
  84. package/dist/ui/assets/{provider-settings-pSNckXcY.js → provider-settings-PedRbxpK.js} +1 -1
  85. package/dist/ui/assets/provider-store-access-BbD8NSzf.js +1 -0
  86. package/dist/ui/assets/provider-store-access-BvzkUnma.js +1 -0
  87. package/dist/ui/assets/providers-BkwBVwkB.js +2 -0
  88. package/dist/ui/assets/{providers-CGO7sSLt.js → providers-CWFcdblf.js} +1 -1
  89. package/dist/ui/assets/{py-live-vfs-Di71Rd2P.js → py-live-vfs-DMc0LhCg.js} +12 -0
  90. package/dist/ui/assets/{py-live-vfs-CJWt_6ye.js → py-live-vfs-Dm8bBjqR.js} +12 -0
  91. package/dist/ui/assets/py-realm-worker-BaO89JAR.js +255 -0
  92. package/dist/ui/assets/{pyodide-W71AWfnt.js → pyodide-DY17DXNV.js} +2 -2
  93. package/dist/ui/assets/{quick-llm-C2Nk4dBn.js → quick-llm-DKsocfis.js} +1 -1
  94. package/dist/ui/assets/realm-inprocess-CI_Msk8I.js +33 -0
  95. package/dist/ui/assets/{recovery-screen-DyaPW0rN.js → recovery-screen-HGByYfVb.js} +1 -1
  96. package/dist/ui/assets/{remote-terminal-view-CmzH03lN.js → remote-terminal-view-C6Ao0U4O.js} +1 -1
  97. package/dist/ui/assets/{require-guards-DPd9EYEo.js → require-guards-DPf5QETL.js} +14 -3
  98. package/dist/ui/assets/{restore-BW3VgfkS.js → restore-BsViTTTd.js} +1 -1
  99. package/dist/ui/assets/{run-B1T-WP7H.js → run-BEHokdPX.js} +1 -1
  100. package/dist/ui/assets/{run-CUbNU5Lc.js → run-BLi5_vwK.js} +2 -2
  101. package/dist/ui/assets/{run-CKp8YCSO.js → run-BOMvKGOX.js} +1 -1
  102. package/dist/ui/assets/{run-C-OJvA2b.js → run-BP0Pyqp1.js} +1 -1
  103. package/dist/ui/assets/{run-DrE_WJQw.js → run-C0CADtt5.js} +2 -2
  104. package/dist/ui/assets/{run-CX6BUmN-.js → run-C1e4W7pJ.js} +1 -1
  105. package/dist/ui/assets/{run-Bx3l1JfE.js → run-CKI507uv.js} +1 -1
  106. package/dist/ui/assets/{run-BKItPKix.js → run-CKdymE5z.js} +3 -3
  107. package/dist/ui/assets/{run-DqwgI93O.js → run-DEBWO_VC.js} +2 -2
  108. package/dist/ui/assets/{run-LhTauwg8.js → run-DgblerTV.js} +2 -2
  109. package/dist/ui/assets/{screencapture-run-BnyfqO9F.js → screencapture-run-Dt7lEfIp.js} +1 -1
  110. package/dist/ui/assets/{session-command-memory-FyHTpe4k.js → session-command-memory-D-p81a7P.js} +2 -2
  111. package/dist/ui/assets/{session-jsonl-DlJN9c2G.js → session-jsonl-C-BZSOHy.js} +1 -1
  112. package/dist/ui/assets/{session-jsonl-SoCRWCsd.js → session-jsonl-CXY4TQ4Y.js} +1 -1
  113. package/dist/ui/assets/{session-search-index-C9kfj8An.js → session-search-index-nhvgyuxV.js} +1 -1
  114. package/dist/ui/assets/setup-feature-flags-remote-CpzgUHLB.js +1 -0
  115. package/dist/ui/assets/setup-model-catalog-BGx3XYFY.js +1 -0
  116. package/dist/ui/assets/shared-BDXQKitm.js +1 -0
  117. package/dist/ui/assets/shared-DfMXB1pm.js +4 -0
  118. package/dist/ui/assets/{signed-fetch-DWtKYUhe.js → signed-fetch-t5uBcIk_.js} +1 -1
  119. package/dist/ui/assets/{silent-renew-backoff-Dd48Fpus.js → silent-renew-backoff-Q1A_jbQH.js} +1 -1
  120. package/dist/ui/assets/slicc-version-YnqCI9lq.js +1 -0
  121. package/dist/ui/assets/{snapshot-DSMXefaN.js → snapshot-Bb3mZrhI.js} +1 -1
  122. package/dist/ui/assets/{snapshot-features-Dz__FOXk.js → snapshot-features-D44t7iA7.js} +1 -1
  123. package/dist/ui/assets/{soundscape-Dh1QSTcg.js → soundscape-CUzGNWGR.js} +1 -1
  124. package/dist/ui/assets/{speak-CSh7c3Xc.js → speak-B-rF7cd2.js} +1 -1
  125. package/dist/ui/assets/sprinkle-manager-BWdoEwv2.js +1 -0
  126. package/dist/ui/assets/{sprinkle-renderer-p--7GmmU.js → sprinkle-renderer-B-1HSkrF.js} +16 -16
  127. package/dist/ui/assets/{ssh-BGtVaOJn.js → ssh-DGBxesfZ.js} +1 -1
  128. package/dist/ui/assets/{state-jFkPO-Cr.js → state-B7Ano9ql.js} +1 -1
  129. package/dist/ui/assets/{store-BBTU9p-V.js → store-B3uS3nQU.js} +1 -1
  130. package/dist/ui/assets/{store--4NgAKup.js → store-DTMATE-h.js} +1 -1
  131. package/dist/ui/assets/{sudo-rLVgWHbD.js → sudo-D8OGZd6t.js} +1 -1
  132. package/dist/ui/assets/{supervisor-C5Ox45-4.js → supervisor-Ck1Ryx2i.js} +1 -1
  133. package/dist/ui/assets/{sync-dialog-DMOwriul.js → sync-dialog-C2TF9Y3h.js} +1 -1
  134. package/dist/ui/assets/{transformers-env-BnutOG5N.js → transformers-env-h8uZoLwJ.js} +1 -1
  135. package/dist/ui/assets/{tray-leader-CvmAJf57.js → tray-leader-BHyMCdCH.js} +1 -1
  136. package/dist/ui/assets/{tray-leave-runtime-DRTgcvYI.js → tray-leave-runtime-DR6t2Cuo.js} +1 -1
  137. package/dist/ui/assets/{tray-sidecar-Xgf9oU_9.js → tray-sidecar-BdEGdpUe.js} +1 -1
  138. package/dist/ui/assets/{turn-journal-DGbDeEVx.js → turn-journal-B4vV4fDV.js} +1 -1
  139. package/dist/ui/assets/{upgrade-detection-CtrPGelw.js → upgrade-detection-BXyDgjYd.js} +1 -1
  140. package/dist/ui/assets/{upskill-lick-skip-D4ddnJHU.js → upskill-lick-skip-8Ozx8QGg.js} +1 -1
  141. package/dist/ui/assets/{voice-reply-CzPXMAbB.js → voice-reply-ChDAb3Rf.js} +1 -1
  142. package/dist/ui/assets/wc-attach-BN8rykoa.js +13 -0
  143. package/dist/ui/assets/{wc-browser-BbRb0vkM.js → wc-browser-z1N3wGuK.js} +1 -1
  144. package/dist/ui/assets/{wc-computers-DLx0FxSd.js → wc-computers-C1g9iCUj.js} +1 -1
  145. package/dist/ui/assets/{wc-detached-GASB41Bt.js → wc-detached-DHD--8Tf.js} +1 -1
  146. package/dist/ui/assets/wc-extension-qof5b3tN.js +2 -0
  147. package/dist/ui/assets/{wc-follower-oauth-B9UkHMb3.js → wc-follower-oauth-Bsskcjc7.js} +1 -1
  148. package/dist/ui/assets/wc-follower-sKXDjyv-.js +17 -0
  149. package/dist/ui/assets/wc-gelatiere-D_uq7S-T.js +1 -0
  150. package/dist/ui/assets/{wc-live-CahXQS8Q.js → wc-live-DWEUEDdK.js} +8 -8
  151. package/dist/ui/assets/wc-nav-DqIdooNV.js +2 -0
  152. package/dist/ui/assets/{wc-onboarding-Cv3LhXwu.js → wc-onboarding-38WwDwrA.js} +2 -2
  153. package/dist/ui/assets/{wc-permissions-CL9cRF2y.js → wc-permissions-o70pdgUK.js} +2 -2
  154. package/dist/ui/assets/wc-placeholder-DMKTZY8P.js +4 -0
  155. package/dist/ui/assets/{wc-secret-request-CJNrSuzt.js → wc-secret-request-CmpDh1Bs.js} +1 -1
  156. package/dist/ui/assets/{wc-settings-DxRelQ6L.js → wc-settings-7DxLA_ig.js} +3 -3
  157. package/dist/ui/assets/{wc-shell-CIfS5Y4z.js → wc-shell-DFszC8_0.js} +4 -4
  158. package/dist/ui/assets/{wc-shortcut-config-pj_Yu_t9.js → wc-shortcut-config-Co6ONiUg.js} +1 -1
  159. package/dist/ui/assets/wc-sprinkles-zxKMU9ju.js +2 -0
  160. package/dist/ui/assets/wc-transcript-export-BnOv-hzh.js +2 -0
  161. package/dist/ui/assets/{wc-tray-DdfIz2nD.js → wc-tray-B2w3dtCQ.js} +4 -4
  162. package/dist/ui/assets/welcome-detection-Cik05qcd.js +1 -0
  163. package/dist/ui/assets/whisper-session-BB92W1rY.js +2 -0
  164. package/dist/ui/assets/xai-grok-Btqu459a.js +1 -0
  165. package/dist/ui/assets/xai-grok-DsDg76ef.js +1 -0
  166. package/dist/ui/index.html +5 -4
  167. package/dist/ui/packages/webapp/index.html +5 -4
  168. package/package.json +1 -1
  169. package/dist/ui/assets/__vite-browser-external-BlQ4QU88.js +0 -1
  170. package/dist/ui/assets/account-store-CXalMQ8t.js +0 -1
  171. package/dist/ui/assets/account-store-eVhGH0WS.js +0 -2
  172. package/dist/ui/assets/adobe-BZHqM9vj.js +0 -1
  173. package/dist/ui/assets/adobe-D6gm_n2B.js +0 -2
  174. package/dist/ui/assets/core-DeN3S2m9.js +0 -62
  175. package/dist/ui/assets/core-QNbq3R8b.js +0 -36
  176. package/dist/ui/assets/fs-B1yU2z2-.js +0 -2
  177. package/dist/ui/assets/fs-BXFhQJ10.js +0 -1
  178. package/dist/ui/assets/github-copilot-CHtG5VrY.js +0 -2
  179. package/dist/ui/assets/github-copilot-YIqdmtQ0.js +0 -1
  180. package/dist/ui/assets/js-realm-worker-DB3B4d6t.js +0 -50
  181. package/dist/ui/assets/jsh-executor-2d4cR9W5.js +0 -18
  182. package/dist/ui/assets/live-session-curation-DsigUFAY.js +0 -1
  183. package/dist/ui/assets/main-DKXs6cI_.js +0 -22
  184. package/dist/ui/assets/memory-v2-flag-E4kSMeU4.js +0 -1
  185. package/dist/ui/assets/new-session-ITDoHfjG.js +0 -2
  186. package/dist/ui/assets/oauth-bootstrap-DGul_F7i.js +0 -2
  187. package/dist/ui/assets/panel-rpc-handlers-YlCf3bBm.js +0 -2
  188. package/dist/ui/assets/provider-store-access-DEjAygfR.js +0 -1
  189. package/dist/ui/assets/provider-store-access-S0kLxJ4O.js +0 -1
  190. package/dist/ui/assets/providers-Bq73MBTb.js +0 -2
  191. package/dist/ui/assets/py-realm-worker-DLb3nkyD.js +0 -244
  192. package/dist/ui/assets/realm-inprocess-BugPUDII.js +0 -30
  193. package/dist/ui/assets/setup-feature-flags-remote-W4by8ZZx.js +0 -1
  194. package/dist/ui/assets/shared-C_68vn79.js +0 -4
  195. package/dist/ui/assets/shared-mBEktoxE.js +0 -1
  196. package/dist/ui/assets/slicc-version-CNYRGsx2.js +0 -1
  197. package/dist/ui/assets/sprinkle-manager-DxNrXEee.js +0 -1
  198. package/dist/ui/assets/wc-attach-PiugjV7B.js +0 -13
  199. package/dist/ui/assets/wc-extension-G-340NDa.js +0 -2
  200. package/dist/ui/assets/wc-follower-C5qCkFzZ.js +0 -17
  201. package/dist/ui/assets/wc-gelatiere-CH2jst0l.js +0 -1
  202. package/dist/ui/assets/wc-nav-CNz69Q2c.js +0 -2
  203. package/dist/ui/assets/wc-placeholder-CBjXiyYG.js +0 -4
  204. package/dist/ui/assets/wc-sprinkles-DqlZ3JNX.js +0 -2
  205. package/dist/ui/assets/wc-transcript-export-BPyJvEoH.js +0 -2
  206. package/dist/ui/assets/welcome-detection-CLztqPwf.js +0 -1
  207. package/dist/ui/assets/whisper-session-BlR3Vpmh.js +0 -2
  208. package/dist/ui/assets/xai-grok-Bk55AFx6.js +0 -1
  209. package/dist/ui/assets/xai-grok-CGisev31.js +0 -1
@@ -0,0 +1,36 @@
1
+ import{t as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";import{r as n,t as r}from"./base64-BPBW1Gzr.js";import"./proxied-fetch-CNe6icTW.js";import{t as i}from"./runtime-env-DadgceZk.js";import{n as a}from"./feature-flags-ysThCqxC.js";import{a as o,s,t as c}from"./api-endpoint-D8lUKmPu.js";import{$ as l,G as u,S as d,U as f,y as p}from"./build-BRNa03GH.js";import{i as m,n as h,r as g}from"./compat-uEPf6-XW.js";import"./libesm-CTQYxJIv.js";import"./context-compaction-Dpr7xgBZ.js";import{t as _}from"./secrets-bridge-client-kWWipUuL.js";import{r as v,t as y}from"./image-markers-CwM1dvoI.js";import{o as b,s as x}from"./tool-ui-DRnUkp2g.js";function S(e,t){try{return Promise.resolve(t(C))}catch(e){return Promise.reject(e)}}const C={startSpan:S,addEvent:()=>{},setAttributes:()=>{},setStatus:()=>{}};Object.freeze(C);const ee=Symbol.for(`yaml.alias`),te=Symbol.for(`yaml.document`),w=Symbol.for(`yaml.map`),ne=Symbol.for(`yaml.pair`),re=Symbol.for(`yaml.scalar`),T=Symbol.for(`yaml.seq`),E=Symbol.for(`yaml.node.type`),D=e=>!!e&&typeof e==`object`&&e[E]===ee,O=e=>!!e&&typeof e==`object`&&e[E]===te,k=e=>!!e&&typeof e==`object`&&e[E]===w,A=e=>!!e&&typeof e==`object`&&e[E]===ne,j=e=>!!e&&typeof e==`object`&&e[E]===re,ie=e=>!!e&&typeof e==`object`&&e[E]===T;function M(e){if(e&&typeof e==`object`)switch(e[E]){case w:case T:return!0}return!1}function N(e){if(e&&typeof e==`object`)switch(e[E]){case ee:case w:case re:case T:return!0}return!1}const ae=e=>(j(e)||M(e))&&!!e.anchor,P=Symbol(`break visit`),oe=Symbol(`skip children`),F=Symbol(`remove node`);function se(e,t){let n=ce(t);O(e)?I(null,e.contents,n,Object.freeze([e]))===F&&(e.contents=null):I(null,e,n,Object.freeze([]))}se.BREAK=P,se.SKIP=oe,se.REMOVE=F;function I(e,t,n,r){let i=le(e,t,n,r);if(N(i)||A(i))return ue(e,r,i),I(e,i,n,r);if(typeof i!=`symbol`){if(M(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=I(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===P)return P;else i===F&&(t.items.splice(e,1),--e)}}else if(A(t)){r=Object.freeze(r.concat(t));let e=I(`key`,t.key,n,r);if(e===P)return P;e===F&&(t.key=null);let i=I(`value`,t.value,n,r);if(i===P)return P;i===F&&(t.value=null)}}return i}function ce(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function le(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(k(t))return n.Map?.(e,t,r);if(ie(t))return n.Seq?.(e,t,r);if(A(t))return n.Pair?.(e,t,r);if(j(t))return n.Scalar?.(e,t,r);if(D(t))return n.Alias?.(e,t,r)}function ue(e,t,n){let r=t[t.length-1];if(M(r))r.items[e]=n;else if(A(r))e===`key`?r.key=n:r.value=n;else if(O(r))r.contents=n;else{let e=D(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function de(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function L(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=L(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=L(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=L(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=L(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function R(e,t,n){if(Array.isArray(e))return e.map((e,t)=>R(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ae(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var fe=class{constructor(e){Object.defineProperty(this,E,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!O(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=R(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?L(i,{"":o},``,o):o}},pe=class extends fe{constructor(e){super(ee),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],se(e,{Node:(e,t)=>{(D(t)||ae(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(R(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=me(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(de(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function me(e,t,n){if(D(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(M(t)){let r=0;for(let i of t.items){let t=me(e,i,n);t>r&&(r=t)}return r}if(A(t)){let r=me(e,t.key,n),i=me(e,t.value,n);return Math.max(r,i)}return 1}const he=e=>!e||typeof e!=`function`&&typeof e!=`object`;var z=class extends fe{constructor(e){super(re),this.value=e}toJSON(e,t){return t?.keep?this.value:R(this.value,e,t)}toString(){return String(this.value)}};z.BLOCK_FOLDED=`BLOCK_FOLDED`,z.BLOCK_LITERAL=`BLOCK_LITERAL`,z.PLAIN=`PLAIN`,z.QUOTE_DOUBLE=`QUOTE_DOUBLE`,z.QUOTE_SINGLE=`QUOTE_SINGLE`;function ge(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function _e(e,t,n){if(O(e)&&(e=e.contents),N(e))return e;if(A(e)){let t=n.schema[w].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new pe(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=`tag:yaml.org,2002:`+t.slice(2));let l=ge(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new z(e);return c&&(c.node=t),t}l=e instanceof Map?o[w]:Symbol.iterator in Object(e)?o[T]:o[w]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new z(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ve(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return _e(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}const ye=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var be=class extends fe{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>N(t)||A(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(ye(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(M(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ve(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(M(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&j(i)?i.value:i:M(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!A(t))return!1;let n=t.value;return n==null||e&&j(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return M(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(M(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ve(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};const xe=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function B(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const V=(e,t,n)=>e.endsWith(`
2
+ `)?B(n,t):n.includes(`
3
+ `)?`
4
+ `+B(n,t):(e.endsWith(` `)?``:` `)+n,Se=`flow`;function Ce(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=we(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
5
+ `)n===`block`&&(h=we(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
6
+ `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
7
+ `&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function we(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
8
+ `);r=t,i=t+1,a=e[i]}return r}const Te=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ee=e=>/^(%|---|\.\.\.)/m.test(e);function De(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
9
+ `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function H(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Ee(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
10
+
11
+ `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
12
+ `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:Ce(o,a,`quoted`,Te(t,!1))}function Oe(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
13
+ `)||/[ \t]\n|\n[ \t]/.test(e))return H(e,t);let n=t.indent||(Ee(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:Ce(r,n,Se,Te(t,!1))}function U(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=H;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Oe:i&&!t?H:n?Oe:H}return r(e,t)}let ke;try{ke=RegExp(`(^|(?<!
14
+ ))
15
+ +(?!
16
+ |$)`,`g`)}catch{ke=/\n+(?!\n|$)/g}function Ae({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return U(n,r);let l=r.indent||(r.forceBlockIndent||Ee(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===z.BLOCK_FOLDED?!1:t===z.BLOCK_LITERAL||!De(n,c,l.length);if(!n)return u?`|
17
+ `:`>
18
+ `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
19
+ `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
20
+ `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
21
+ `&&(p=p.slice(0,-1)),p.replace(ke,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
22
+ `)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
23
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=Te(r,!0);o!==`folded`&&t!==z.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=Ce(`${v}${e}${p}`,l,`block`,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function je(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
24
+ `)||u&&/[[\]{},]/.test(a))return U(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
25
+ `)?U(a,t):Ae(e,t,n,r);if(!s&&!u&&i!==z.PLAIN&&a.includes(`
26
+ `))return Ae(e,t,n,r);if(Ee(a)){if(c===``)return t.forceBlockIndent=!0,Ae(e,t,n,r);if(s&&c===l)return U(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return U(a,t)}return s?d:Ce(d,c,Se,Te(t,!1))}function Me(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==z.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=z.QUOTE_DOUBLE);let c=e=>{switch(e){case z.BLOCK_FOLDED:case z.BLOCK_LITERAL:return i||a?U(o.value,t):Ae(o,t,n,r);case z.QUOTE_DOUBLE:return H(o.value,t);case z.QUOTE_SINGLE:return Oe(o.value,t);case z.PLAIN:return je(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Ne(e,t){let n=Object.assign({blockQuote:!0,commentString:xe,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Pe(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(j(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Fe(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(j(e)||M(e))&&e.anchor;a&&de(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Ie(e,t,n,r){if(A(e))return e.toString(t,n,r);if(D(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=N(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Pe(t.doc.schema.tags,a);let o=Fe(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):j(a)?Me(a,t,n,r):a.toString(t,n,r);return o?j(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Le({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=N(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(M(e)||!N(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||M(e)||(j(e)?e.type===z.BLOCK_FOLDED||e.type===z.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Ie(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=V(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=V(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=V(g,n.indent,l(f))));let _,v,y;N(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&j(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&ie(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Ie(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
27
+ `:``,v){let e=l(v);S+=`\n${B(e,n.indent)}`}x===``&&!n.inFlow?S===`
28
+ `&&y&&(S=`
29
+
30
+ `):S+=`\n${n.indent}`}else if(!p&&M(t)){let e=x[0],r=x.indexOf(`
31
+ `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
32
+ `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=V(g,n.indent,l(y)):h&&i&&i(),g}function Re(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}const ze={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new z(Symbol(`<<`)),{addToJSMap:Ve}),stringify:()=>`<<`},Be=(e,t)=>(ze.identify(t)||j(t)&&(!t.type||t.type===z.PLAIN)&&ze.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===ze.tag&&e.default);function Ve(e,t,n){let r=Ue(e,n);if(ie(r))for(let n of r.items)He(e,t,n);else if(Array.isArray(r))for(let n of r)He(e,t,n);else He(e,t,r)}function He(e,t,n){let r=Ue(e,n);if(!k(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Ue(e,t){return e&&D(t)?t.resolve(e.doc,e):t}function We(e,t,{key:n,value:r}){if(N(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Be(e,n))Ve(e,t,r);else{let i=R(n,``,e);if(t instanceof Map)t.set(i,R(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Ge(n,i,e),o=R(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Ge(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(N(e)&&n?.doc){let t=Ne(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Re(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Ke(e,t,n){return new W(_e(e,void 0,n),_e(t,void 0,n))}var W=class e{constructor(e,t=null){Object.defineProperty(this,E,{value:ne}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return N(n)&&(n=n.clone(t)),N(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return We(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Le(this,e,t,n):JSON.stringify(this)}};function qe(e,t,n){return(t.inFlow??e.flow?Ye:Je)(e,t,n)}function Je({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(N(i))!d&&i.spaceBefore&&f.push(``),Xe(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(A(i)){let e=N(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Xe(n,f,e.commentBefore,d))}d=!1;let s=Ie(i,u,()=>o=null,()=>d=!0);o&&(s+=V(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
33
+ `}}return e?(p+=`
34
+ `+B(l(e),c),s&&s()):d&&o&&o(),p}function Ye({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(N(i))i.spaceBefore&&d.push(``),Xe(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(A(i)){let e=N(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Xe(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=N(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Ie(i,c,()=>a=null);l||=d.length>u||o.includes(`
35
+ `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=V(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
36
+ `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Xe({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=B(t(r),e);n.push(i.trimStart())}}function G(e,t){let n=j(t)?t.value:t;for(let r of e)if(A(r)&&(r.key===t||r.key===n||j(r.key)&&r.key.value===n))return r}var K=class extends be{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(w,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Ke(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=A(e)?e:!e||typeof e!=`object`||!(`key`in e)?new W(e,e?.value):new W(e.key,e.value);let r=G(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);j(r.value)&&he(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=G(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=G(this.items,e)?.value;return(!t&&j(n)?n.value:n)??void 0}has(e){return!!G(this.items,e)}set(e,t){this.add(new W(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)We(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!A(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),qe(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}};const Ze={collection:`map`,default:!0,nodeClass:K,tag:`tag:yaml.org,2002:map`,resolve(e,t){return k(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>K.from(e,t,n)};var Qe=class extends be{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(T,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=$e(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=$e(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&j(r)?r.value:r}has(e){let t=$e(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=$e(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];j(r)&&he(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(R(e,String(r++),t));return n}toString(e,t,n){return e?qe(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(_e(a,void 0,n))}}return i}};function $e(e){let t=j(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}const et={collection:`seq`,default:!0,nodeClass:Qe,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return ie(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Qe.from(e,t,n)};function tt(e){return typeof e==`bigint`||Number.isInteger(e)}const nt=({value:e})=>JSON.stringify(e),rt=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:nt},{identify:e=>e==null,createNode:()=>new z(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:nt},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:nt},{identify:tt,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>tt(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:nt}];[Ze,et].concat(rt,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function it(e,t,n){let{replacer:r}=n,i=new Qe(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Ke(o,s,n))}return i}var at=class e extends Qe{constructor(){super(),this.add=K.prototype.add.bind(this),this.delete=K.prototype.delete.bind(this),this.get=K.prototype.get.bind(this),this.has=K.prototype.has.bind(this),this.set=K.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(A(e)?(r=R(e.key,``,t),i=R(e.value,r,t)):r=R(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=it(e,t,n),i=new this;return i.items=r.items,i}};at.tag=`tag:yaml.org,2002:omap`;var ot=class e extends K{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=A(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new W(e.key,null):new W(e,null),G(this.items,t.key)||this.items.push(t)}get(e,t){let n=G(this.items,e);return!t&&A(n)?j(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=G(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new W(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Ke(e,null,n));return i}};ot.tag=`tag:yaml.org,2002:set`;const st=Symbol(`break visit`),ct=Symbol(`skip children`),lt=Symbol(`remove item`);function q(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),ut(Object.freeze([]),e,t)}q.BREAK=st,q.SKIP=ct,q.REMOVE=lt,q.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},q.parentCollection=(e,t)=>{let n=q.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function ut(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=ut(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===st)return st;else r===lt&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}e(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.{0,2}\/|^\.{1,2}$/,l=/\/$/,u=`node-ignore`;typeof Symbol<`u`&&(u=Symbol.for(`node-ignore`));let d=u,f=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),p=/([0-z])-([0-z])/g,m=()=>!1,h=e=>e.replace(p,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),g=e=>{let{length:t}=e;return e.slice(0,t-t%2)},_=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${g(r)}${i}`:i===`]`&&r.length%2==0?`[${h(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],v=/(^|\\\/)?\\\*$/,y=`regex`,b=`checkRegex`,x={[y](e,t){return`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`},[b](e,t){return`${t?`${t}[^/]*`:`[^/]*`}(?=$|\\/$)`}},S=e=>_.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),C=e=>typeof e==`string`,ee=e=>e&&C(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,te=e=>e.split(s).filter(Boolean);var w=class{constructor(e,t,n,r,i,a){this.pattern=e,this.mark=t,this.negative=i,f(this,`body`,n),f(this,`ignoreCase`,r),f(this,`regexPrefix`,a)}get regex(){let e=`_regex`;return this[e]?this[e]:this._make(y,e)}get checkRegex(){let e=`_checkRegex`;return this[e]?this[e]:this._make(b,e)}_make(e,t){let n=this.regexPrefix.replace(v,x[e]),r=this.ignoreCase?new RegExp(n,`i`):new RegExp(n);return f(this,t,r)}};let ne=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf(`!`)===0&&(r=!0,i=i.substr(1)),i=i.replace(a,`!`).replace(o,`#`);let s=S(i);return new w(e,t,i,n,r,s)};var re=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[d]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(C(e)&&(e={pattern:e}),ee(e.pattern)){let t=ne(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(C(e)?te(e):e).forEach(this._add,this),this._added}test(e,t,n){let r=!1,i=!1,a;this._rules.forEach(o=>{let{negative:s}=o;i===s&&r!==i||s&&!r&&!i&&!t||o[n].test(e)&&(r=!s,i=s,a=s?void 0:o)});let o={ignored:r,unignored:i};return a&&(o.rule=a),o}};let T=(e,t)=>{throw new t(e)},E=(e,t,n)=>C(e)?e?!E.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),D=e=>c.test(e);E.isNotRelative=D,E.convert=e=>e;var O=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){f(this,d,!0),this._rules=new re(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n,r){let i=e&&E.convert(e);return E(i,e,this._strictPathCheck?T:m),this._t(i,t,n,r)}checkIgnore(e){if(!l.test(e))return this.test(e);let t=e.split(`/`).filter(Boolean);if(t.pop(),t.length){let e=this._t(t.join(`/`)+`/`,this._testCache,!0,t);if(e.ignored)return e}return this._rules.test(e,!1,b)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`).filter(Boolean),r.pop(),!r.length)return t[e]=this._rules.test(e,n,y);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._rules.test(e,n,y)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let k=e=>new O(e),A=e=>E(e&&E.convert(e),e,m),j=()=>{E.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;E.isNotRelative=t=>e.test(t)||D(t)};typeof process<`u`&&process.platform===`win32`&&j(),t.exports=k,k.default=k,t.exports.isPathValid=A,f(t.exports,Symbol.for(`setupWindows`),j)}))();const dt={"pi.session.id":{type:`string`,required:!0,cardinality:`high`,description:`Session id`},"pi.lane.name":{type:`string`,required:!0,cardinality:`high`,description:`Lane name`},"pi.operation.id":{type:`string`,required:!0,cardinality:`high`,description:`Durable operation id`},"pi.operation.recovery":{type:`boolean`,required:!0,description:`Whether this invocation resumes durable work`}},ft={"pi.error.code":{type:`string`,cardinality:`low`,description:`Stable operation error code`},"pi.error.type":{type:`string`,cardinality:`low`,description:`Low-cardinality operation error class`}};({...dt}),{...ft},{...dt},{...ft},{...dt},{...ft},globalThis.Buffer,f({command:p({description:`Bash command to execute`}),timeout:u(d({description:`Timeout in seconds (optional, no default timeout)`}))});const pt=f({oldText:p({description:`Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call.`}),newText:p({description:`Replacement text for this targeted edit.`})},{});f({path:p({description:`Path to the file to edit (relative or absolute)`}),edits:l(pt,{description:`One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead.`})},{}),f({path:p({description:`Path to the file to read (relative or absolute)`}),offset:u(d({description:`Line number to start reading from (1-indexed)`})),limit:u(d({description:`Maximum number of lines to read`}))}),f({path:p({description:`Path to the file to write (relative or absolute)`}),content:p({description:`Content to write to the file`})});function mt(){try{return globalThis.localStorage??null}catch{return null}}function J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Y(e,t){return Reflect.get(e,t)}function ht(e){let t=null;try{t=e?.getItem(`slicc_model_catalog`)??null}catch{return{raw:null,store:{}}}if(!t)return{raw:t,store:{}};try{let e=JSON.parse(t);return{raw:t,store:J(e)?e:{}}}catch{return{raw:t,store:{}}}}function X(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0}function gt(e){if(!J(e))return null;let t=Y(e,`input`),n=Y(e,`output`),r=Y(e,`cacheRead`),i=Y(e,`cacheWrite`);return!X(t)||!X(n)||!X(r)||!X(i)?null:{input:t,output:n,cacheRead:r,cacheWrite:i}}function _t(e){return!Array.isArray(e)||e.length===0||!e.every(e=>e===`text`||e===`image`)?null:[...e]}function vt(e){if(e===void 0)return;if(!J(e))return null;let t=Object.entries(e);return t.every(([,e])=>e===null||typeof e==`string`)?Object.fromEntries(t):null}function yt(e){return{apis:new Set(e.map(e=>e.api)),baseUrls:new Set(e.map(e=>e.baseUrl))}}function bt(e,t,n){if(!J(t))return null;let r=Y(t,`id`),i=Y(t,`name`),a=Y(t,`api`),o=Y(t,`baseUrl`),s=Y(t,`reasoning`),c=Y(t,`contextWindow`),l=Y(t,`maxTokens`);if(typeof r!=`string`||r.length===0||r.length>200||typeof i!=`string`||i.length===0||typeof a!=`string`||!n.apis.has(a)||typeof o!=`string`||!n.baseUrls.has(o)||typeof s!=`boolean`||!X(c)||c===0||!X(l)||l===0)return null;let u=gt(Y(t,`cost`)),d=_t(Y(t,`input`)),f=vt(Y(t,`thinkingLevelMap`));if(!u||!d||f===null)return null;let p=Y(t,`compat`),m={id:r,name:i,api:a,provider:e,baseUrl:o,reasoning:s,input:d,cost:u,contextWindow:c,maxTokens:l};return f&&(m.thinkingLevelMap=f),J(p)&&(m.compat={...p}),m}function xt(){return 1787954402569}let St,Ct=new Map;function wt(e){try{return g(e)}catch{return[]}}function Tt(e){if(!e||!Array.isArray(e.models)||e.models.length===0)return!1;let t=xt();return t===null||typeof e.lastModified==`number`&&e.lastModified>t}const Et=new Set([`id`,`name`,`api`,`provider`,`baseUrl`,`reasoning`,`input`,`cost`,`contextWindow`,`maxTokens`,`thinkingLevelMap`,`compat`]);function Dt(e,t,n){if(t)return{...Object.fromEntries(Object.entries(t).filter(([e])=>!Et.has(e))),...e};let r=n.find(t=>t.headers&&t.api===e.api&&t.baseUrl===e.baseUrl);return r?.headers?{...e,headers:{...r.headers}}:e}function Ot(e,t){let n=wt(e);if(n.length===0)return n;let r=yt(n),i=[...n],a=new Map(i.map((e,t)=>[e.id,t])),o=new Map(n.map(e=>[e.id,e]));for(let s of t.models){let t=bt(e,s,r);if(!t)continue;let c=a.get(t.id),l=Dt(t,o.get(t.id),n);c===void 0?(a.set(l.id,i.length),i.push(l)):i[c]=l}return i}function kt(e,t){if(!a(`live-model-catalog`))return wt(e);let{raw:n,store:r}=ht(t),i=r[e];if(!Tt(i))return wt(e);n!==St&&(St=n,Ct=new Map);let o=Ct.get(e);return o||(o=Ot(e,i),Ct.set(e,o)),o}function At(e){return[...kt(e,mt())]}function jt(e,t){return kt(e,mt()).find(e=>e.id===t)||h(e,t)}const Mt=m;function Nt(){return i()?`extension-direct`:o()?`extension-delegate`:globalThis.__slicc_connect_mode?`connect`:`node-rest`}function Pt(){return Nt()===`node-rest`}const Z=t(`secret-scrub`),Q=`[tool output withheld: secret scrub unavailable]`,Ft=async e=>e;function It(){let e=Nt();return e===`extension-direct`?async e=>{if(!e)return e;try{let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.scrub-tool-result`,text:e},e=>t(e??{}))});return t.error?(Z.debug(`SW scrub-tool-result returned error`),Q):typeof t.text==`string`?t.text:Q}catch{return Z.debug(`SW scrub-tool-result failed`),Q}}:e===`extension-delegate`?async e=>{if(!e)return e;try{let t=await _(`secrets.scrub-tool-result`,{text:e});return t?.error?(Z.debug(`Bridge scrub-tool-result returned error`),Q):typeof t?.text==`string`?t.text:Q}catch{return Z.debug(`Bridge scrub-tool-result failed`),Q}}:e===`connect`?Ft:async e=>{if(!e)return e;try{let t=await fetch(s(`/api/secrets/scrub`),{method:`POST`,headers:c({"content-type":`application/json`}),body:JSON.stringify({text:e})});if(!t.ok)return Z.debug(`Server scrub-tool-result returned non-ok`,{status:t.status}),e;let n=await t.json();return typeof n.text==`string`?n.text:e}catch(t){return Z.debug(`Server scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}}const $=t(`image-processor`),Lt=3932160;function Rt(e){let t=e.replace(/[\t\n\f\r ]/g,``),n=t.length%4;return n===2?`${t}==`:n===3?`${t}=`:t}function zt(e,t){let n=r(Rt(e.slice(0,t)));return new DataView(n.buffer,n.byteOffset,n.byteLength)}function Bt(e,t){return e>0&&t>0?{width:e,height:t}:null}function Vt(e){if(e.length<32)return null;let t=zt(e,32);return Bt(t.getUint32(16,!1),t.getUint32(20,!1))}function Ht(e){if(e.length<16)return null;let t=zt(e,16);return Bt(t.getUint16(6,!0),t.getUint16(8,!0))}function Ut(e){let t=zt(e,Math.min(87384,e.length));for(let e=0;e<t.byteLength-8;e++){if(t.getUint8(e)!==255)continue;let n=t.getUint8(e+1);if(n===192||n===194)return Bt(t.getUint16(e+7,!1),t.getUint16(e+5,!1))}return null}function Wt(e,t){try{let n=Rt(e);if(t===`image/png`)return Vt(n);if(t===`image/gif`)return Ht(n);if(t===`image/jpeg`)return Ut(n)}catch{}return null}async function Gt(e){if(!v(e.mimeType))return $.warn(`Unsupported image format`,{mimeType:e.mimeType}),{type:`text`,text:`[Image removed: unsupported format "${e.mimeType}". Supported: JPEG, PNG, GIF, WebP]`};let t=e.data.length,i=Wt(e.data,e.mimeType);if(!(t>5242880||i!==null&&(i.width>8e3||i.height>8e3)||i!==null&&Math.max(i.width,i.height)>1568))return e;$.info(`Image needs processing`,{base64Size:t,dimensions:i?`${i.width}x${i.height}`:`unknown`,reason:t>5242880?`size`:`dimensions`});let a,o;try{let e=await import(`./magick-wasm-KFp97Nzb.js`).then(e=>e.r);a=e.getMagick,o=e.MIME_TO_MAGICK_FORMAT}catch(e){return $.error(`ImageMagick WASM module unavailable`,{error:e instanceof Error?e.message:String(e)}),{type:`text`,text:`[Image removed: resize service unavailable (ImageMagick WASM could not be loaded)]`}}let s;try{s=await a()}catch(e){return $.error(`ImageMagick WASM initialization failed`,{error:e instanceof Error?e.message:String(e)}),{type:`text`,text:`[Image removed: resize service unavailable (WASM init failed)]`}}try{let i=r(Rt(e.data)),a={data:null,mime:e.mimeType};if(await s.ImageMagick.read(i,async t=>{let n=t.width,r=t.height,i=Math.max(n,r);if(i>1568){let e=1568/i,a=Math.round(n*e),o=Math.round(r*e);t.resize(a,o),$.info(`Resized image`,{from:`${n}x${r}`,to:`${a}x${o}`})}let s=o[e.mimeType]||`JPEG`;t.write(s,e=>{a.data=new Uint8Array(e)}),a.data&&a.data.length>Lt&&s!==`JPEG`?($.info(`Still over 5MB, compressing to JPEG q80`),t.quality=80,t.write(`JPEG`,e=>{a.data=new Uint8Array(e)}),a.mime=`image/jpeg`):a.data&&a.data.length>Lt&&($.info(`Still over 5MB as JPEG, reducing quality to 60`),t.quality=60,t.write(`JPEG`,e=>{a.data=new Uint8Array(e)}))}),!a.data)return $.warn(`ImageMagick produced no output`),{type:`text`,text:`[Image removed: could not be processed (empty output from resize)]`};if(a.data.length>Lt)return $.warn(`Image still over 5MB after resize+compress`,{size:a.data.length}),{type:`text`,text:`[Image removed: still ${Math.round(a.data.length/1024/1024*10)/10}MB after resize and compression, exceeds 5MB API limit]`};let c=n(a.data);return $.info(`Image processed successfully`,{originalBase64:t,newBase64:c.length,mimeType:a.mime}),{type:`image`,data:c,mimeType:a.mime}}catch(n){return $.error(`Image data processing failed (corrupt or unreadable)`,{mimeType:e.mimeType,estimatedBytes:t,error:n instanceof Error?n.message:String(n)}),{type:`text`,text:`[Image removed: image data could not be processed (${n instanceof Error?n.message:`corrupt or unreadable`})]`}}}const Kt=t(`tool-adapter`);function qt(e){let t=[],n=0;for(let r of y(e)){if(r.kind===`inert`||!r.parsed)continue;let i=e.slice(n,r.index);i.trim()&&t.push({type:`text`,text:i.trimEnd()}),t.push({type:`image`,mimeType:r.parsed.mimeType,data:r.parsed.data}),n=r.index+r.marker.length}let r=e.slice(n);return(r.trim()||t.length===0)&&t.push({type:`text`,text:r||e}),t}async function Jt(e){let t=qt(e),n=[];for(let e of t)e.type===`image`?n.push(await Gt(e)):n.push(e);return n}function Yt(e,t,n,r){if(!r)return{tracked:null,effectiveSignal:n};let i=r.processManager.spawn({kind:`tool`,argv:[e.name,...nn(t)],owner:r.owner,ppid:r.getParentPid?.()});n?.aborted?r.processManager.signal(i.pid,`SIGINT`):n&&n.addEventListener(`abort`,()=>r.processManager.signal(i.pid,`SIGINT`),{once:!0});let a=r.processManager.onSignal((e,t)=>{e.pid===i.pid&&t===`SIGKILL`&&r.processManager.exit(i.pid,null)});return{tracked:{record:i,manager:r.processManager,unsubscribeKill:a},effectiveSignal:i.abort.signal}}function Xt(e,t){e&&e.manager.exit(e.record.pid,t)}async function Zt(e,t,n){if(!n||typeof e!=`string`||e.length===0)return e;try{return await n.scrubToolResult(e)}catch(n){return Kt.warn(`Tool-result scrub failed, falling back to unscrubbed content`,{tool:t,error:n instanceof Error?n.message:String(n)}),e}}async function Qt(e,t){try{return await Jt(e)}catch(n){return Kt.warn(`Image processing failed, falling back to raw content`,{tool:t,error:n instanceof Error?n.message:String(n)}),qt(e)}}async function $t(e,t,n,r){let i=n?.currentGate();if(!i)return!0;if(r?.aborted)return!1;try{return await i.approve(e.name,t)&&r?.aborted!==!0}catch(t){return Kt.warn(`Tool-call gate threw — refusing the call`,{tool:e.name,error:t instanceof Error?t.message:String(t)}),!1}}function en(e,t,n,r){return{name:e.name,label:e.name,description:e.description,parameters:e.inputSchema,prepareArguments:e.prepareArguments,async execute(i,a,o,s){let c;if(s&&(c=x({onUpdate:s,toolName:e.name,toolCallId:i})),!await $t(e,a,r,o))return c&&b(c),{content:[{type:`text`,text:`${e.name}: not approved (guest-caused turn).`}],details:{isError:!0}};let l=Yt(e,a,o,t);try{let t=await e.execute(a??{},l.effectiveSignal),r=await Qt(await Zt(t.content,e.name,n),e.name);return Xt(l.tracked,+!!t.isError),{content:r,details:{isError:t.isError}}}catch(e){throw Xt(l.tracked,l.tracked?.record.abort.signal.aborted?null:1),e}finally{c&&b(c),l.tracked?.unsubscribeKill()}}}}function tn(e,t,n,r){return e.map(e=>en(e,t,n,r))}function nn(e){if(typeof e!=`object`||!e)return[];let t=e;for(let e of[`command`,`file_path`,`path`,`pattern`,`url`,`key`,`name`,`query`,`message`]){let n=t[e];if(typeof n==`string`&&n.length>0)return[n]}for(let e of Object.values(t))if(typeof e==`string`&&e.length>0)return[e];return[]}export{Nt as a,Mt as c,Pt as i,nn as n,jt as o,It as r,At as s,tn as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{c as t,t as n}from"./claude-model-version-ceOteQ2f.js";import{r}from"./browser-DG5MjvHF.js";import{n as i,t as a}from"./provider-budget-DbHWq3j6.js";import{t as o}from"./subcommand-flags-BZi7j78Q.js";import{t as s}from"./subcommand-help-CgO7wRS5.js";var c=e({createCostCommand:()=>C,frozenSessionToCostData:()=>h,registerSessionBudgetProvider:()=>p,registerSessionCostsProvider:()=>f});const l=[`--all`,`--json`];let u=null,d=null;function f(e){u=e}function p(e){d=e}function m(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function h(e){let r=Array.isArray(e.models)?e.models:[],i=new Map;for(let e of r){let t=typeof e?.model==`string`?e.model:``;if(!t)continue;let r=n(t),a=i.get(r),o=m(e?.cost);if(!a){i.set(r,{ids:[t],cost:o});continue}a.ids.includes(t)||a.ids.push(t),a.cost+=o}let a=[...i.values()].sort((e,t)=>t.cost-e.cost||(e.ids[0]??``).localeCompare(t.ids[0]??``)).map(e=>t(e.ids)),o=Number.isFinite(e.cost?.total);return{name:typeof e.title==`string`&&e.title.length>0?e.title:e.filename,type:`cone`,model:a[0]??`-`,models:a,source:`frozen`,costAvailable:o,usage:{input:null,output:null,cacheRead:null,cacheWrite:null,totalTokens:r.reduce((e,t)=>e+m(t?.tokens),0),cost:{input:m(e.cost?.input),output:m(e.cost?.output),cacheRead:m(e.cost?.cacheRead),cacheWrite:m(e.cost?.cacheWrite),total:m(e.cost?.total)}},turns:r.reduce((e,t)=>e+m(t?.turns),0)}}function g(){return`cost - show session cost breakdown
1
+ import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{c as t,t as n}from"./claude-model-version-ceOteQ2f.js";import{r}from"./browser-BM_DFzrh.js";import{n as i,t as a}from"./provider-budget-DbHWq3j6.js";import{t as o}from"./subcommand-flags-BZi7j78Q.js";import{t as s}from"./subcommand-help-CgO7wRS5.js";var c=e({createCostCommand:()=>C,frozenSessionToCostData:()=>h,registerSessionBudgetProvider:()=>p,registerSessionCostsProvider:()=>f});const l=[`--all`,`--json`];let u=null,d=null;function f(e){u=e}function p(e){d=e}function m(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function h(e){let r=Array.isArray(e.models)?e.models:[],i=new Map;for(let e of r){let t=typeof e?.model==`string`?e.model:``;if(!t)continue;let r=n(t),a=i.get(r),o=m(e?.cost);if(!a){i.set(r,{ids:[t],cost:o});continue}a.ids.includes(t)||a.ids.push(t),a.cost+=o}let a=[...i.values()].sort((e,t)=>t.cost-e.cost||(e.ids[0]??``).localeCompare(t.ids[0]??``)).map(e=>t(e.ids)),o=Number.isFinite(e.cost?.total);return{name:typeof e.title==`string`&&e.title.length>0?e.title:e.filename,type:`cone`,model:a[0]??`-`,models:a,source:`frozen`,costAvailable:o,usage:{input:null,output:null,cacheRead:null,cacheWrite:null,totalTokens:r.reduce((e,t)=>e+m(t?.tokens),0),cost:{input:m(e.cost?.input),output:m(e.cost?.output),cacheRead:m(e.cost?.cacheRead),cacheWrite:m(e.cost?.cacheWrite),total:m(e.cost?.total)}},turns:r.reduce((e,t)=>e+m(t?.turns),0)}}function g(){return`cost - show session cost breakdown
2
2
 
3
3
  Usage: cost [options]
4
4
 
@@ -1 +1 @@
1
- import{t as e}from"./logger-LESFN7Hj.js";import{S as t}from"./record-ChU1ND2B.js";import{h as n}from"./kernel-worker-hZ_EeCIo.js";const r=e(`directed-approval`);function i(e,n){if(e.kind===`user`)return a(`the user tier is not a directed approval`);if(e.kind===`agent`)return a(`agent approvals are not enqueued to a unit`);let r=e.unitJid;if(!n.scoops.has(r))return a(`the requesting unit is not registered`);let i=n.ownerRootOf(r);if(!i)return a(`no owning cone for the requesting unit`);let o=e.kind===`cone`?i:[...n.scoops.values()].find(t=>t.parentJid===i.jid&&(t.name===e.scoopName||t.folder===e.scoopName));return o?t(o).canResolveApprovals?{ok:!0,requesterJid:r,approver:o}:a(`the named approver cannot resolve approvals`):a(`delegated approver not found under this cone`)}function a(e){return r.warn(`Directed approval failing closed`,{reason:e}),{ok:!1,reason:e}}const o={decision:`deny`};async function s(e,t){let a=e.approver;if(a?.kind===`agent`){let i=globalThis[n];if(!i)return r.warn(`No agent bridge available for an approver agent — denying`),o;let{approverRunnerFor:s}=await import(`./approver-agent-CvnFt_s6.js`),c=t.getSharedFs(),l=await s({spawn:e=>i.spawn(e),readSharedFile:async e=>{if(!c)return null;try{let t=await c.readFile(e,{encoding:`utf-8`});return typeof t==`string`?t:null}catch{return null}},findUnit:e=>{let n=t.scoops.get(e);return n?{workspace:t.workspaceFor(n),folder:n.folder}:void 0}})({kind:e.kind===`guest-tool`?`guest-tool`:`guest-message`,requester:e.requester??`an unidentified requester`,detail:e.detail},a.unitJid);return r.info(`Approver agent verdict`,{decision:l.decision,reason:l.reason}),l.decision===`allow`?{decision:`allow`}:o}if(a&&a.kind!==`user`){let n=i(a,t);return n.ok?t.enqueue(n.requesterJid,e,{approver:n.approver}):o}return t.approveAsUser(e)}export{s as runDirectedApproval};
1
+ import{t as e}from"./logger-LESFN7Hj.js";import{S as t}from"./record-ChU1ND2B.js";import{h as n}from"./kernel-worker-DJ8FZwqE.js";const r=e(`directed-approval`);function i(e,n){if(e.kind===`user`)return a(`the user tier is not a directed approval`);if(e.kind===`agent`)return a(`agent approvals are not enqueued to a unit`);let r=e.unitJid;if(!n.scoops.has(r))return a(`the requesting unit is not registered`);let i=n.ownerRootOf(r);if(!i)return a(`no owning cone for the requesting unit`);let o=e.kind===`cone`?i:[...n.scoops.values()].find(t=>t.parentJid===i.jid&&(t.name===e.scoopName||t.folder===e.scoopName));return o?t(o).canResolveApprovals?{ok:!0,requesterJid:r,approver:o}:a(`the named approver cannot resolve approvals`):a(`delegated approver not found under this cone`)}function a(e){return r.warn(`Directed approval failing closed`,{reason:e}),{ok:!1,reason:e}}const o={decision:`deny`};async function s(e,t){let a=e.approver;if(a?.kind===`agent`){let i=globalThis[n];if(!i)return r.warn(`No agent bridge available for an approver agent — denying`),o;let{approverRunnerFor:s}=await import(`./approver-agent-CvnFt_s6.js`),c=t.getSharedFs(),l=await s({spawn:e=>i.spawn(e),readSharedFile:async e=>{if(!c)return null;try{let t=await c.readFile(e,{encoding:`utf-8`});return typeof t==`string`?t:null}catch{return null}},findUnit:e=>{let n=t.scoops.get(e);return n?{workspace:t.workspaceFor(n),folder:n.folder}:void 0}})({kind:e.kind===`guest-tool`?`guest-tool`:`guest-message`,requester:e.requester??`an unidentified requester`,detail:e.detail},a.unitJid);return r.info(`Approver agent verdict`,{decision:l.decision,reason:l.reason}),l.decision===`allow`?{decision:`allow`}:o}if(a&&a.kind!==`user`){let n=i(a,t);return n.ok?t.enqueue(n.requesterJid,e,{approver:n.approver}):o}return t.approveAsUser(e)}export{s as runDirectedApproval};
@@ -1 +1 @@
1
- import{t as e}from"./js-realm-worker-DB3B4d6t.js";const t={EACCES:2,EBADF:8,EBUSY:10,EEXIST:20,EINVAL:28,EIO:29,EISDIR:31,ELOOP:32,ENAMETOOLONG:37,ENOENT:44,ENOSPC:51,ENOSYS:52,ENOTDIR:54,ENOTEMPTY:55,EPERM:63,EROFS:69,ETIMEDOUT:73,EXDEV:75},n=4095;function r(e,n){if(n?.errno!==void 0&&n instanceof e.ErrnoError)return n;let r=n?.code,i=typeof r==`string`?t[r]??29:29;return new e.ErrnoError(i)}function i(e){let t=[],n=e;for(;n!==n.mount.root;)t.push(n.name),n=n.parent;let r=e.mount.opts.root.replace(/\/+$/,``);return t.length===0?r||`/`:`${r}/${t.reverse().join(`/`)}`}function a(e){let t=e.isSymbolicLink?40960:e.isDirectory?16384:32768,r=e.isDirectory||e.isSymbolicLink?511:438;return t|((e.mode??r)&n||r)}function o(e){if(e!=null)return e instanceof Date?e.getTime():e}function s(e,t){let n=e=>e.mount.opts.bridge;function o(t){try{return t()}catch(t){throw r(e,t)}}function s(e){return{...e?{stat:e}:{},len:0,loaded:!1,dirty:!1,openCount:0}}function c(n,r,i){let o=e.createNode(n,r,a(i),0);return o.node_ops=t.node,o.stream_ops=t.stream,o.live=s(i),o}function l(e){if(!e.live.stat){let t=o(()=>n(e).lstat(i(e)));e.live.stat=t,e.mode=a(t)}return e.live.stat}function u(e,t){let n=i(e);return n===`/`?`/${t}`:`${n}/${t}`}function d(e){let t=e.live;if(t.loaded)return;let r=o(()=>n(e).readFile(i(e)));t.data=r,t.len=r.length,t.loaded=!0}function f(e,t){let n=e.live,r=n.data??new Uint8Array;if(r.length>=t)return r;let i=new Uint8Array(Math.max(t,r.length*2,256));return i.set(r.subarray(0,n.len)),n.data=i,i}function p(e){let t=e.live;if(!t.dirty||!t.data)return;let r=t.data.slice(0,t.len);o(()=>n(e).writeFile(i(e),r)),t.dirty=!1,t.stat=void 0}function m(e,t){let r=e.live;if(r.openCount>0){t>0?d(e):r.loaded=!0;let n=f(e,t);t>r.len&&n.fill(0,r.len,t),r.len=t,r.dirty=!0;return}let a=i(e),s=new Uint8Array(t);if(t>0){let r=o(()=>n(e).readFile(a));s.set(r.subarray(0,Math.min(t,r.length)))}o(()=>n(e).writeFile(a,s)),r.stat=void 0}return{Fs:e,bridgeOf:n,call:o,makeNode:c,statOf:l,childPath:u,ensureLoaded:d,ensureCapacity:f,flushNode:p,truncate:m}}function c(e){let{Fs:r,bridgeOf:a,call:s,makeNode:c,statOf:l,childPath:u,flushNode:d,truncate:f}=e;return{getattr(e){let t=l(e),n=e.live,i=r.isDir(e.mode)?4096:n.loaded?n.len:t.size,a=new Date(t.mtimeMs??0);return{dev:1,ino:e.id,mode:e.mode,nlink:1,uid:0,gid:0,rdev:0,size:i,atime:a,mtime:a,ctime:a,blksize:4096,blocks:Math.ceil(i/4096)}},setattr(e,t){let c=i(e);if(t.mode!==void 0&&t.mode!==null){let r=t.mode&n;r!==(e.mode&n)&&(s(()=>a(e).chmod(c,r)),e.mode=e.mode&-4096|r)}t.size!==void 0&&t.size!==null&&r.isFile(e.mode)&&f(e,t.size);let l=o(t.mtime)??t.timestamp;if(l!==void 0){let n=o(t.atime)??l;d(e),s(()=>a(e).utimes(c,n,l))}e.live.stat=void 0},lookup(e,t){let n=s(()=>a(e).lstat(u(e,t)));return c(e,t,n)},mknod(e,n,i){let o=u(e,n);if(r.isDir(i))s(()=>a(e).mkdir(o));else if(r.isFile(i))s(()=>a(e).writeFile(o,new Uint8Array));else throw new r.ErrnoError(t.EPERM);let l=c(e,n,{isFile:r.isFile(i),isDirectory:r.isDir(i),isSymbolicLink:!1,size:0,mode:i,mtimeMs:Date.now()});return l.live.stat=void 0,l},rename(e,t,n){let o=i(e),c=u(t,n);d(e),s(()=>a(e).rename(o,c));try{let i=r.lookupNode?.(t,n);i&&i!==e&&r.hashRemoveNode?.(i)}catch{}e.name=n,e.live.stat=void 0},unlink(e,t){s(()=>a(e).unlink(u(e,t)))},rmdir(e,t){s(()=>a(e).rmdir(u(e,t)))},readdir(e){return[`.`,`..`,...s(()=>a(e).readdir(i(e)))]},symlink(e,t,n){let r=u(e,t);return s(()=>a(e).symlink(n,r)),c(e,t,{isFile:!1,isDirectory:!1,isSymbolicLink:!0,size:n.length})},readlink(e){if(!r.isLink(e.mode))throw new r.ErrnoError(t.EINVAL);return s(()=>a(e).readlink(i(e)))}}}function l(e){let{Fs:n,statOf:r,ensureLoaded:i,ensureCapacity:a,flushNode:o}=e;return{open(e){n.isFile(e.node.mode)&&e.node.live.openCount++},close(e){let t=e.node;if(!n.isFile(t.mode))return;let r=t.live;if(r.openCount=Math.max(0,r.openCount-1),!(r.openCount>0))try{o(t)}finally{r.data=void 0,r.len=0,r.loaded=!1}},read(e,r,a,o,s){let c=e.node;if(n.isDir(c.mode))throw new n.ErrnoError(t.EISDIR);i(c);let l=c.live;if(s>=l.len||o<=0)return 0;let u=Math.min(o,l.len-s);return new Uint8Array(r.buffer,r.byteOffset+a,u).set(l.data.subarray(s,s+u)),u},write(e,r,o,s,c){let l=e.node;if(n.isDir(l.mode))throw new n.ErrnoError(t.EISDIR);if(s<=0)return 0;i(l);let u=l.live,d=c+s,f=a(l,d);return c>u.len&&f.fill(0,u.len,c),f.set(new Uint8Array(r.buffer,r.byteOffset+o,s),c),u.len=Math.max(u.len,d),u.dirty=!0,s},llseek(e,i,a){let o=i;if(a===1)o+=e.position;else if(a===2&&n.isFile(e.node.mode)){let t=e.node.live;o+=t.loaded?t.len:r(e.node).size}if(o<0)throw new n.ErrnoError(t.EINVAL);return o},fsync(e){o(e.node)}}}function u(e){let n=new Set,r={},i=s(e,r),a=c(i),o=l(i);return r.node=a,r.stream=o,{mounts:n,node_ops:a,stream_ops:o,mount(r){let a=i.call(()=>r.opts.bridge.stat(r.opts.root));if(!a.isDirectory)throw new e.ErrnoError(t.ENOTDIR);let o=i.makeNode(null,`/`,a);return n.add(r),o}}}function d(e,t){return!!t&&e.mounts.has(t.mount)}function f(e,t){for(let n of e.nameTable??[])for(let a=n;a;a=a.name_next??null)if(!(!d(t,a)||!a.live.dirty||!a.live.data))try{let e=a.live.data.slice(0,a.live.len);a.mount.opts.bridge.writeFile(i(a),e),a.live.dirty=!1}catch(t){throw r(e,t)}}function p(e,t){let n=e.nameTable??[],r=[];for(let e of n)for(let n=e;n;n=n.name_next??null){if(!d(t,n))continue;let e=n.live;e.stat=void 0,e.openCount===0?n!==n.mount.root&&r.push(n):e.loaded&&!e.dirty&&(e.data=void 0,e.len=0,e.loaded=!1)}if(e.hashRemoveNode)for(let t of r)e.hashRemoveNode(t)}function m(e){let t=[...new Set(e.map(e=>e.replace(/\/+$/,``)||`/`))].sort();return t.filter(e=>!t.some(t=>t!==e&&(t===`/`||e.startsWith(`${t}/`))))}function h(e,t,n,r){let i=e.filesystems.SLICC_LIVE_FS??u(e);e.filesystems.SLICC_LIVE_FS=i;let a=[];for(let o of m(n))if(o!==`/`)try{e.mkdirTree(o),e.mount(i,{root:o,bridge:t},o),a.push(o)}catch(e){r(`live VFS mount of ${o} failed: ${e instanceof Error?e.message:String(e)}`)}return{plugin:i,mounted:a}}const g=new Set([`dev`,`proc`]),_=[`writeFile`,`mkdir`,`rm`,`rename`,`unlink`,`rmdir`,`symlink`,`chmod`,`utimes`];function v(t,n){let r={...t};for(let i of _){let a=t[i];r[i]=(...r)=>{n.wasUsed()&&e(n,t);try{a.apply(t,r)}finally{n.invalidate()}}}return r}function y(e,t){let n;try{n=e.readdir(`/`)}catch(e){return t(`cannot list the VFS root, nothing mounted: ${String(e)}`),[]}let r=[];for(let t of n)if(!(!t||t.includes(`/`)||g.has(t)))try{e.stat(`/${t}`).isDirectory&&r.push(`/${t}`)}catch{}return r}function b(t,n,r={}){let{bridge:i,syncFs:a,warn:o}=n;a.wasUsed()&&e(a,i);let{plugin:s,mounted:c}=h(t,v(i,a),y(i,o),o);try{t.chdir(r.cwd??n.cwd)}catch(e){o(`cannot chdir to ${r.cwd??n.cwd}: ${String(e)}`)}return{mounted:c,flush:()=>f(t,s),invalidate:()=>p(t,s)}}export{b as mountVfsIntoEmscripten};
1
+ import{t as e}from"./js-realm-worker-C8L3DYxo.js";const t={EACCES:2,EBADF:8,EBUSY:10,EEXIST:20,EINVAL:28,EIO:29,EISDIR:31,ELOOP:32,ENAMETOOLONG:37,ENOENT:44,ENOSPC:51,ENOSYS:52,ENOTDIR:54,ENOTEMPTY:55,EPERM:63,EROFS:69,ETIMEDOUT:73,EXDEV:75},n=4095;function r(e,n){if(n?.errno!==void 0&&n instanceof e.ErrnoError)return n;let r=n?.code,i=typeof r==`string`?t[r]??29:29;return new e.ErrnoError(i)}function i(e){let t=[],n=e;for(;n!==n.mount.root;)t.push(n.name),n=n.parent;let r=e.mount.opts.root.replace(/\/+$/,``);return t.length===0?r||`/`:`${r}/${t.reverse().join(`/`)}`}function a(e){let t=e.isSymbolicLink?40960:e.isDirectory?16384:32768,r=e.isDirectory||e.isSymbolicLink?511:438;return t|((e.mode??r)&n||r)}function o(e){if(e!=null)return e instanceof Date?e.getTime():e}function s(e,t){let n=e=>e.mount.opts.bridge;function o(t){try{return t()}catch(t){throw r(e,t)}}function s(e){return{...e?{stat:e}:{},len:0,loaded:!1,dirty:!1,openCount:0}}function c(n,r,i){let o=e.createNode(n,r,a(i),0);return o.node_ops=t.node,o.stream_ops=t.stream,o.live=s(i),o}function l(e){if(!e.live.stat){let t=o(()=>n(e).lstat(i(e)));e.live.stat=t,e.mode=a(t)}return e.live.stat}function u(e,t){let n=i(e);return n===`/`?`/${t}`:`${n}/${t}`}function d(e){let t=e.live;if(t.loaded)return;let r=o(()=>n(e).readFile(i(e)));t.data=r,t.len=r.length,t.loaded=!0}function f(e,t){let n=e.live,r=n.data??new Uint8Array;if(r.length>=t)return r;let i=new Uint8Array(Math.max(t,r.length*2,256));return i.set(r.subarray(0,n.len)),n.data=i,i}function p(e){let t=e.live;if(!t.dirty||!t.data)return;let r=t.data.slice(0,t.len);o(()=>n(e).writeFile(i(e),r)),t.dirty=!1,t.stat=void 0}function m(e,t){let r=e.live;if(r.openCount>0){t>0?d(e):r.loaded=!0;let n=f(e,t);t>r.len&&n.fill(0,r.len,t),r.len=t,r.dirty=!0;return}let a=i(e),s=new Uint8Array(t);if(t>0){let r=o(()=>n(e).readFile(a));s.set(r.subarray(0,Math.min(t,r.length)))}o(()=>n(e).writeFile(a,s)),r.stat=void 0}return{Fs:e,bridgeOf:n,call:o,makeNode:c,statOf:l,childPath:u,ensureLoaded:d,ensureCapacity:f,flushNode:p,truncate:m}}function c(e){let{Fs:r,bridgeOf:a,call:s,makeNode:c,statOf:l,childPath:u,flushNode:d,truncate:f}=e;return{getattr(e){let t=l(e),n=e.live,i=r.isDir(e.mode)?4096:n.loaded?n.len:t.size,a=new Date(t.mtimeMs??0);return{dev:1,ino:e.id,mode:e.mode,nlink:1,uid:0,gid:0,rdev:0,size:i,atime:a,mtime:a,ctime:a,blksize:4096,blocks:Math.ceil(i/4096)}},setattr(e,t){let c=i(e);if(t.mode!==void 0&&t.mode!==null){let r=t.mode&n;r!==(e.mode&n)&&(s(()=>a(e).chmod(c,r)),e.mode=e.mode&-4096|r)}t.size!==void 0&&t.size!==null&&r.isFile(e.mode)&&f(e,t.size);let l=o(t.mtime)??t.timestamp;if(l!==void 0){let n=o(t.atime)??l;d(e),s(()=>a(e).utimes(c,n,l))}e.live.stat=void 0},lookup(e,t){let n=s(()=>a(e).lstat(u(e,t)));return c(e,t,n)},mknod(e,n,i){let o=u(e,n);if(r.isDir(i))s(()=>a(e).mkdir(o));else if(r.isFile(i))s(()=>a(e).writeFile(o,new Uint8Array));else throw new r.ErrnoError(t.EPERM);let l=c(e,n,{isFile:r.isFile(i),isDirectory:r.isDir(i),isSymbolicLink:!1,size:0,mode:i,mtimeMs:Date.now()});return l.live.stat=void 0,l},rename(e,t,n){let o=i(e),c=u(t,n);d(e),s(()=>a(e).rename(o,c));try{let i=r.lookupNode?.(t,n);i&&i!==e&&r.hashRemoveNode?.(i)}catch{}e.name=n,e.live.stat=void 0},unlink(e,t){s(()=>a(e).unlink(u(e,t)))},rmdir(e,t){s(()=>a(e).rmdir(u(e,t)))},readdir(e){return[`.`,`..`,...s(()=>a(e).readdir(i(e)))]},symlink(e,t,n){let r=u(e,t);return s(()=>a(e).symlink(n,r)),c(e,t,{isFile:!1,isDirectory:!1,isSymbolicLink:!0,size:n.length})},readlink(e){if(!r.isLink(e.mode))throw new r.ErrnoError(t.EINVAL);return s(()=>a(e).readlink(i(e)))}}}function l(e){let{Fs:n,statOf:r,ensureLoaded:i,ensureCapacity:a,flushNode:o}=e;return{open(e){n.isFile(e.node.mode)&&e.node.live.openCount++},close(e){let t=e.node;if(!n.isFile(t.mode))return;let r=t.live;if(r.openCount=Math.max(0,r.openCount-1),!(r.openCount>0))try{o(t)}finally{r.data=void 0,r.len=0,r.loaded=!1}},read(e,r,a,o,s){let c=e.node;if(n.isDir(c.mode))throw new n.ErrnoError(t.EISDIR);i(c);let l=c.live;if(s>=l.len||o<=0)return 0;let u=Math.min(o,l.len-s);return new Uint8Array(r.buffer,r.byteOffset+a,u).set(l.data.subarray(s,s+u)),u},write(e,r,o,s,c){let l=e.node;if(n.isDir(l.mode))throw new n.ErrnoError(t.EISDIR);if(s<=0)return 0;i(l);let u=l.live,d=c+s,f=a(l,d);return c>u.len&&f.fill(0,u.len,c),f.set(new Uint8Array(r.buffer,r.byteOffset+o,s),c),u.len=Math.max(u.len,d),u.dirty=!0,s},llseek(e,i,a){let o=i;if(a===1)o+=e.position;else if(a===2&&n.isFile(e.node.mode)){let t=e.node.live;o+=t.loaded?t.len:r(e.node).size}if(o<0)throw new n.ErrnoError(t.EINVAL);return o},fsync(e){o(e.node)}}}function u(e){let n=new Set,r={},i=s(e,r),a=c(i),o=l(i);return r.node=a,r.stream=o,{mounts:n,node_ops:a,stream_ops:o,mount(r){let a=i.call(()=>r.opts.bridge.stat(r.opts.root));if(!a.isDirectory)throw new e.ErrnoError(t.ENOTDIR);let o=i.makeNode(null,`/`,a);return n.add(r),o}}}function d(e,t){return!!t&&e.mounts.has(t.mount)}function f(e,t){for(let n of e.nameTable??[])for(let a=n;a;a=a.name_next??null)if(!(!d(t,a)||!a.live.dirty||!a.live.data))try{let e=a.live.data.slice(0,a.live.len);a.mount.opts.bridge.writeFile(i(a),e),a.live.dirty=!1}catch(t){throw r(e,t)}}function p(e,t){let n=e.nameTable??[],r=[];for(let e of n)for(let n=e;n;n=n.name_next??null){if(!d(t,n))continue;let e=n.live;e.stat=void 0,e.openCount===0?n!==n.mount.root&&r.push(n):e.loaded&&!e.dirty&&(e.data=void 0,e.len=0,e.loaded=!1)}if(e.hashRemoveNode)for(let t of r)e.hashRemoveNode(t)}function m(e){let t=[...new Set(e.map(e=>e.replace(/\/+$/,``)||`/`))].sort();return t.filter(e=>!t.some(t=>t!==e&&(t===`/`||e.startsWith(`${t}/`))))}function h(e,t,n,r){let i=e.filesystems.SLICC_LIVE_FS??u(e);e.filesystems.SLICC_LIVE_FS=i;let a=[];for(let o of m(n))if(o!==`/`)try{e.mkdirTree(o),e.mount(i,{root:o,bridge:t},o),a.push(o)}catch(e){r(`live VFS mount of ${o} failed: ${e instanceof Error?e.message:String(e)}`)}return{plugin:i,mounted:a}}const g=new Set([`dev`,`proc`]),_=[`writeFile`,`mkdir`,`rm`,`rename`,`unlink`,`rmdir`,`symlink`,`chmod`,`utimes`];function v(t,n){let r={...t};for(let i of _){let a=t[i];r[i]=(...r)=>{n.wasUsed()&&e(n,t);try{a.apply(t,r)}finally{n.invalidate()}}}return r}function y(e,t){let n;try{n=e.readdir(`/`)}catch(e){return t(`cannot list the VFS root, nothing mounted: ${String(e)}`),[]}let r=[];for(let t of n)if(!(!t||t.includes(`/`)||g.has(t)))try{e.stat(`/${t}`).isDirectory&&r.push(`/${t}`)}catch{}return r}function b(t,n,r={}){let{bridge:i,syncFs:a,warn:o}=n;a.wasUsed()&&e(a,i);let{plugin:s,mounted:c}=h(t,v(i,a),y(i,o),o);try{t.chdir(r.cwd??n.cwd)}catch(e){o(`cannot chdir to ${r.cwd??n.cwd}: ${String(e)}`)}return{mounted:c,flush:()=>f(t,s),invalidate:()=>p(t,s)}}export{b as mountVfsIntoEmscripten};
@@ -1 +1 @@
1
- import{t as e}from"./logger-LESFN7Hj.js";import"./proxied-fetch-CNe6icTW.js";import{t}from"./runtime-env-DadgceZk.js";import"./shared-C_68vn79.js";import{f as n,p as r,r as i}from"./installer-Bw6Q7QDH.js";e(`speech:espeak`);const a=[`ort-wasm-simd-threaded.jsep.mjs`,`https://${["cdn","jsdelivr","net"].join(".")}/npm/onnxruntime-web@1.31.0-dev.20260914-8d85527a0/dist/ort-wasm-simd-threaded.jsep.wasm`,`ort-wasm-simd-threaded.mjs`,`https://${["cdn","jsdelivr","net"].join(".")}/npm/onnxruntime-web@1.31.0-dev.20260914-8d85527a0/dist/ort.wasm`,`ort-wasm-simd-threaded.asyncify.mjs`,`https://${["cdn","jsdelivr","net"].join(".")}/npm/onnxruntime-web@1.31.0-dev.20260914-8d85527a0/dist/ort-wasm-simd-threaded.asyncify.wasm`,`ort-wasm-simd-threaded.jspi.mjs`,`https://${["cdn","jsdelivr","net"].join(".")}/npm/onnxruntime-web@1.31.0-dev.20260914-8d85527a0/dist/ort-wasm-simd-threaded.jspi.wasm`],o=e(`speech:ensure-assets`),s=`onnxruntime-web`,c=`${s}@1.31.0-dev.20260914-8d85527a0`,l=`espeak-ng`,u=[`espeak-ng.js`,`espeak-ng.wasm`],d=`/workspace`,f=t,p=a.filter(e=>!/\.(asyncify|jspi)\./.test(e));async function m(e){try{let t=await e.readFile(`/workspace/node_modules/onnxruntime-web/package.json`,{encoding:`utf-8`}),n=typeof t==`string`?t:new TextDecoder().decode(t),r=JSON.parse(n);if(r&&typeof r==`object`&&`version`in r&&typeof r.version==`string`)return r.version}catch{}return null}async function h(e,t){let n=await Promise.all(p.map(t=>e.fs.exists(`/workspace/node_modules/onnxruntime-web/dist/${t}`))),r=await m(e.fs);if(n.every(Boolean)&&r===`1.31.0-dev.20260914-8d85527a0`)return t?.({asset:s,phase:`present`}),!1;t?.({asset:s,phase:`staging`});let{errors:a}=await i([c],{fs:e.fs,fetch:e.fetch,cwd:d});if(a.length>0)throw Error(`failed to stage ${s} wasm runtime: ${a[0].error.message}`);return t?.({asset:s,phase:`done`}),!0}async function g(e,t){if((await Promise.all(u.map(t=>e.fs.exists(`/workspace/node_modules/espeak-ng/dist/${t}`)))).every(Boolean))return t?.({asset:l,phase:`present`}),!1;t?.({asset:l,phase:`staging`});let{errors:n}=await i([l],{fs:e.fs,fetch:e.fetch,cwd:d});if(n.length>0)throw Error(`failed to stage ${l} wasm: ${n[0].error.message}`);return t?.({asset:l,phase:`done`}),!0}async function _(e,t){try{return await g(e,t)}catch(e){return o.warn(`optional espeak-ng staging failed; non-English Kokoro voices may fall back`,e),!1}}async function v(e,t,i){let a=r(t,null,d),o=0,s=await n({fetch:e.fetch,fs:e.fs,repo:t,targetDir:a,progress:{onListed:({files:e,totalBytes:n})=>i?.({asset:t,phase:`listing`,filesLoaded:0,filesTotal:e.length,bytesLoaded:0,bytesTotal:n}),onFile:e=>{o+=e.bytes,i?.({asset:t,phase:e.status,file:e.file,filesLoaded:e.index,filesTotal:e.total,bytesLoaded:o})}}});return i?.({asset:t,phase:`done`,filesLoaded:s.files.length,filesTotal:s.files.length,bytesLoaded:o,bytesTotal:o}),{repo:t,downloaded:s.downloaded,skipped:s.skipped}}async function y(e,t){if(f())return{skipped:!0,ortStaged:!1,espeakStaged:!1,repos:[]};let n=await h(e,t),r=e.repos??[`onnx-community/whisper-tiny`,`onnx-community/Kokoro-82M-v1.0-ONNX`],i=[];for(let n of r)i.push(await v(e,n,t));let a=await _(e,t);return o.info(`speech assets staged`,{ortStaged:n,espeakStaged:a,repos:i.length}),{skipped:!1,ortStaged:n,espeakStaged:a,repos:i}}export{y as ensureSpeechAssetsStaged};
1
+ import{t as e}from"./logger-LESFN7Hj.js";import"./proxied-fetch-CNe6icTW.js";import{t}from"./runtime-env-DadgceZk.js";import"./shared-DfMXB1pm.js";import{f as n,p as r,r as i}from"./installer-hyWN7t-8.js";e(`speech:espeak`);const a=[`ort-wasm-simd-threaded.jsep.mjs`,`https://${["cdn","jsdelivr","net"].join(".")}/npm/onnxruntime-web@1.31.0-dev.20260914-8d85527a0/dist/ort-wasm-simd-threaded.jsep.wasm`,`ort-wasm-simd-threaded.mjs`,`https://${["cdn","jsdelivr","net"].join(".")}/npm/onnxruntime-web@1.31.0-dev.20260914-8d85527a0/dist/ort.wasm`,`ort-wasm-simd-threaded.asyncify.mjs`,`https://${["cdn","jsdelivr","net"].join(".")}/npm/onnxruntime-web@1.31.0-dev.20260914-8d85527a0/dist/ort-wasm-simd-threaded.asyncify.wasm`,`ort-wasm-simd-threaded.jspi.mjs`,`https://${["cdn","jsdelivr","net"].join(".")}/npm/onnxruntime-web@1.31.0-dev.20260914-8d85527a0/dist/ort-wasm-simd-threaded.jspi.wasm`],o=e(`speech:ensure-assets`),s=`onnxruntime-web`,c=`${s}@1.31.0-dev.20260914-8d85527a0`,l=`espeak-ng`,u=[`espeak-ng.js`,`espeak-ng.wasm`],d=`/workspace`,f=t,p=a.filter(e=>!/\.(asyncify|jspi)\./.test(e));async function m(e){try{let t=await e.readFile(`/workspace/node_modules/onnxruntime-web/package.json`,{encoding:`utf-8`}),n=typeof t==`string`?t:new TextDecoder().decode(t),r=JSON.parse(n);if(r&&typeof r==`object`&&`version`in r&&typeof r.version==`string`)return r.version}catch{}return null}async function h(e,t){let n=await Promise.all(p.map(t=>e.fs.exists(`/workspace/node_modules/onnxruntime-web/dist/${t}`))),r=await m(e.fs);if(n.every(Boolean)&&r===`1.31.0-dev.20260914-8d85527a0`)return t?.({asset:s,phase:`present`}),!1;t?.({asset:s,phase:`staging`});let{errors:a}=await i([c],{fs:e.fs,fetch:e.fetch,cwd:d});if(a.length>0)throw Error(`failed to stage ${s} wasm runtime: ${a[0].error.message}`);return t?.({asset:s,phase:`done`}),!0}async function g(e,t){if((await Promise.all(u.map(t=>e.fs.exists(`/workspace/node_modules/espeak-ng/dist/${t}`)))).every(Boolean))return t?.({asset:l,phase:`present`}),!1;t?.({asset:l,phase:`staging`});let{errors:n}=await i([l],{fs:e.fs,fetch:e.fetch,cwd:d});if(n.length>0)throw Error(`failed to stage ${l} wasm: ${n[0].error.message}`);return t?.({asset:l,phase:`done`}),!0}async function _(e,t){try{return await g(e,t)}catch(e){return o.warn(`optional espeak-ng staging failed; non-English Kokoro voices may fall back`,e),!1}}async function v(e,t,i){let a=r(t,null,d),o=0,s=await n({fetch:e.fetch,fs:e.fs,repo:t,targetDir:a,progress:{onListed:({files:e,totalBytes:n})=>i?.({asset:t,phase:`listing`,filesLoaded:0,filesTotal:e.length,bytesLoaded:0,bytesTotal:n}),onFile:e=>{o+=e.bytes,i?.({asset:t,phase:e.status,file:e.file,filesLoaded:e.index,filesTotal:e.total,bytesLoaded:o})}}});return i?.({asset:t,phase:`done`,filesLoaded:s.files.length,filesTotal:s.files.length,bytesLoaded:o,bytesTotal:o}),{repo:t,downloaded:s.downloaded,skipped:s.skipped}}async function y(e,t){if(f())return{skipped:!0,ortStaged:!1,espeakStaged:!1,repos:[]};let n=await h(e,t),r=e.repos??[`onnx-community/whisper-tiny`,`onnx-community/Kokoro-82M-v1.0-ONNX`],i=[];for(let n of r)i.push(await v(e,n,t));let a=await _(e,t);return o.info(`speech assets staged`,{ortStaged:n,espeakStaged:a,repos:i.length}),{skipped:!1,ortStaged:n,espeakStaged:a,repos:i}}export{y as ensureSpeechAssetsStaged};
@@ -1,4 +1,4 @@
1
- import{i as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{a as n}from"./path-utils-DNJG-zQf.js";import{C as r,S as i,p as a,t as o}from"./shared-C_68vn79.js";import{n as s}from"./wasm-compiler-Ct7QZURL.js";var c=e(t(((e,t)=>{(e=>{var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},o=(e,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(let c of r(a))!i.call(e,c)&&c!==o&&t(e,c,{get:()=>a[c],enumerable:!(s=n(a,c))||s.enumerable});return e},s=e=>o(t({},`__esModule`,{value:!0}),e),c=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),l={};a(l,{analyzeMetafile:()=>xe,analyzeMetafileSync:()=>Te,build:()=>_e,buildSync:()=>Se,context:()=>ve,default:()=>je,formatMessages:()=>be,formatMessagesSync:()=>we,initialize:()=>ke,stop:()=>Ee,transform:()=>ye,transformSync:()=>Ce,version:()=>ge}),e.exports=s(l);function u(e){let t=e=>{if(e===null)n.write8(0);else if(typeof e==`boolean`)n.write8(1),n.write8(+e);else if(typeof e==`number`)n.write8(2),n.write32(e|0);else if(typeof e==`string`)n.write8(3),n.write(p(e));else if(e instanceof Uint8Array)n.write8(4),n.write(e);else if(e instanceof Array){n.write8(5),n.write32(e.length);for(let n of e)t(n)}else{let r=Object.keys(e);n.write8(6),n.write32(r.length);for(let i of r)n.write(p(i)),t(e[i])}},n=new f;return n.write32(0),n.write32(e.id<<1|!e.isRequest),t(e.value),_(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function d(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return m(n.read());case 4:return n.read();case 5:{let e=n.read32(),r=[];for(let n=0;n<e;n++)r.push(t());return r}case 6:{let e=n.read32(),r={};for(let i=0;i<e;i++)r[m(n.read())]=t();return r}default:throw Error(`Invalid packet`)}},n=new f(e),r=n.read32(),i=!(r&1);r>>>=1;let a=t();if(n.ptr!==e.length)throw Error(`Invalid packet`);return{id:r,isRequest:i,value:a}}var f=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e}write32(e){let t=this._write(4);_(this.buf,e,t)}write(e){let t=this._write(4+e.length);_(this.buf,e.length,t),this.buf.set(e,t+4)}_read(e){if(this.ptr+e>this.buf.length)throw Error(`Invalid packet`);return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return g(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),n=this._read(t.length);return t.set(this.buf.subarray(n,n+e)),t}},p,m,h;if(typeof TextEncoder<`u`&&typeof TextDecoder<`u`){let e=new TextEncoder,t=new TextDecoder;p=t=>e.encode(t),m=e=>t.decode(e),h=`new TextEncoder().encode("")`}else if(typeof Buffer<`u`)p=e=>Buffer.from(e),m=e=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},h=`Buffer.from("")`;else throw Error(`No UTF-8 codec found`);if(!(p(``)instanceof Uint8Array))throw Error(`Invariant violation: "${h} instanceof Uint8Array" is incorrectly false
1
+ import{i as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{a as n}from"./path-utils-DNJG-zQf.js";import{C as r,S as i,p as a,t as o}from"./shared-DfMXB1pm.js";import{n as s}from"./wasm-compiler-Ct7QZURL.js";var c=e(t(((e,t)=>{(e=>{var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},o=(e,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(let c of r(a))!i.call(e,c)&&c!==o&&t(e,c,{get:()=>a[c],enumerable:!(s=n(a,c))||s.enumerable});return e},s=e=>o(t({},`__esModule`,{value:!0}),e),c=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),l={};a(l,{analyzeMetafile:()=>xe,analyzeMetafileSync:()=>Te,build:()=>_e,buildSync:()=>Se,context:()=>ve,default:()=>je,formatMessages:()=>be,formatMessagesSync:()=>we,initialize:()=>ke,stop:()=>Ee,transform:()=>ye,transformSync:()=>Ce,version:()=>ge}),e.exports=s(l);function u(e){let t=e=>{if(e===null)n.write8(0);else if(typeof e==`boolean`)n.write8(1),n.write8(+e);else if(typeof e==`number`)n.write8(2),n.write32(e|0);else if(typeof e==`string`)n.write8(3),n.write(p(e));else if(e instanceof Uint8Array)n.write8(4),n.write(e);else if(e instanceof Array){n.write8(5),n.write32(e.length);for(let n of e)t(n)}else{let r=Object.keys(e);n.write8(6),n.write32(r.length);for(let i of r)n.write(p(i)),t(e[i])}},n=new f;return n.write32(0),n.write32(e.id<<1|!e.isRequest),t(e.value),_(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function d(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return m(n.read());case 4:return n.read();case 5:{let e=n.read32(),r=[];for(let n=0;n<e;n++)r.push(t());return r}case 6:{let e=n.read32(),r={};for(let i=0;i<e;i++)r[m(n.read())]=t();return r}default:throw Error(`Invalid packet`)}},n=new f(e),r=n.read32(),i=!(r&1);r>>>=1;let a=t();if(n.ptr!==e.length)throw Error(`Invalid packet`);return{id:r,isRequest:i,value:a}}var f=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e}write32(e){let t=this._write(4);_(this.buf,e,t)}write(e){let t=this._write(4+e.length);_(this.buf,e.length,t),this.buf.set(e,t+4)}_read(e){if(this.ptr+e>this.buf.length)throw Error(`Invalid packet`);return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return g(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),n=this._read(t.length);return t.set(this.buf.subarray(n,n+e)),t}},p,m,h;if(typeof TextEncoder<`u`&&typeof TextDecoder<`u`){let e=new TextEncoder,t=new TextDecoder;p=t=>e.encode(t),m=e=>t.decode(e),h=`new TextEncoder().encode("")`}else if(typeof Buffer<`u`)p=e=>Buffer.from(e),m=e=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},h=`Buffer.from("")`;else throw Error(`No UTF-8 codec found`);if(!(p(``)instanceof Uint8Array))throw Error(`Invariant violation: "${h} instanceof Uint8Array" is incorrectly false
2
2
 
3
3
  This indicates that your JavaScript environment is broken. You cannot use
4
4
  esbuild in this environment because esbuild relies on this invariant. This
@@ -0,0 +1 @@
1
+ var e=`slicc_feature_flags`,t=Object.freeze([Object.freeze({id:`experimental-settings`,label:`Experimental settings`,description:`Show controls for experimental features.`,defaultValue:`on`,floatDefaults:Object.freeze({cherry:`off`}),userToggleable:!1,since:`2026-07-31`}),Object.freeze({id:`panel-layouts`,label:`Panel layouts`,description:`Arrange the UI as movable, resizable panels instead of the fixed workbench.`,defaultValue:`off`,userToggleable:!0,since:`2026-08-03`}),Object.freeze({id:`agentic-memory`,label:`Agentic memory`,description:`Curate session memory with a background agent instead of a one-shot extraction call.`,defaultValue:`off`,userToggleable:!0,since:`2026-08-05`}),Object.freeze({id:`multiple-cones`,label:`Multiple cones`,description:`Add, switch between and remove cones from the freezer rail. Extra cones share the workspace.`,defaultValue:`on`,floatDefaults:Object.freeze({cherry:`off`}),userToggleable:!1,since:`2026-08-21`}),Object.freeze({id:`compact-on-idle`,label:`Compact on idle`,description:`When a cone has been idle for a while with a large context, summarize its history in the background. The full transcript is kept in /sessions.`,defaultValue:`on`,userToggleable:!1,since:`2026-09-02`}),Object.freeze({id:`memory-v2`,label:`Memory v2`,description:`Searchable session history, scoop pre-compaction snapshots, and the gelatiere — a resident advisor that reviews your sessions and suggests skills and use cases.`,defaultValue:`off`,userToggleable:!0,since:`2026-09-10`}),Object.freeze({id:`live-model-catalog`,label:`Live model catalogue`,description:`Refresh model lists from pi's hosted catalogue, so newly launched models appear without a release.`,defaultValue:`on`,userToggleable:!1,since:`2026-09-22`})]),n=new Map(t.map(e=>[e.id,e])),r=new Set([`1`,`on`,`true`]),i=`standalone`,a={},o={};function s(){return t}function c(e,n={},r=l()){let i={};for(let a of t){let t=r[a.id];if(typeof t==`string`&&b(a,e)){i[a.id]=t;continue}let s=o[a.id];if(typeof s==`string`&&b(a,e)){i[a.id]=s;continue}let c=n[a.id];i[a.id]=typeof c==`string`?c:y(a,e)}return i}function l(){try{let t=S()?.getItem(e);return t?x(JSON.parse(t)):{}}catch{return{}}}function u(t){try{S()?.setItem(e,JSON.stringify(x(t)))}catch{}}function d(e){let t=n.get(e);return t!==void 0&&b(t,i)}function f(e,t){let r=n.get(e);if(!r||!b(r,i))return;let a=l();typeof t==`string`?a[e]=t:delete a[e],u(a)}function p(e,t={}){i=e,a=x(t),o={}}function m(e,t){i=e,a=x(t)}function h(e){let t={};for(let[r,a]of Object.entries(e)){let e=n.get(r);!e||typeof a!=`string`||!b(e,i)||(t[e.id]=a)}return o={...o,...t},t}function g(e){return c(i,a)[e]}function _(e){return typeof e==`string`&&r.has(e.trim().toLowerCase())}function v(e){return _(g(e))}function y(e,t){return e.floatDefaults?.[t]??e.defaultValue}function b(e,t){return e.userToggleable&&(e.overridableFloats===void 0||e.overridableFloats.includes(t))}function x(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let n=e,r={};for(let e of t){let t=n[e.id];typeof t==`string`&&(r[e.id]=t)}return r}function S(){try{let e=globalThis.localStorage;return typeof e?.getItem!=`function`||typeof e.setItem!=`function`?void 0:e}catch{return}}export{s as a,m as c,v as i,d as n,l as o,p as r,f as s,h as t};
@@ -0,0 +1 @@
1
+ const e=Object.freeze([Object.freeze({id:`experimental-settings`,label:`Experimental settings`,description:`Show controls for experimental features.`,defaultValue:`on`,floatDefaults:Object.freeze({cherry:`off`}),userToggleable:!1,since:`2026-07-31`}),Object.freeze({id:`panel-layouts`,label:`Panel layouts`,description:`Arrange the UI as movable, resizable panels instead of the fixed workbench.`,defaultValue:`off`,userToggleable:!0,since:`2026-08-03`}),Object.freeze({id:`agentic-memory`,label:`Agentic memory`,description:`Curate session memory with a background agent instead of a one-shot extraction call.`,defaultValue:`off`,userToggleable:!0,since:`2026-08-05`}),Object.freeze({id:`multiple-cones`,label:`Multiple cones`,description:`Add, switch between and remove cones from the freezer rail. Extra cones share the workspace.`,defaultValue:`on`,floatDefaults:Object.freeze({cherry:`off`}),userToggleable:!1,since:`2026-08-21`}),Object.freeze({id:`compact-on-idle`,label:`Compact on idle`,description:`When a cone has been idle for a while with a large context, summarize its history in the background. The full transcript is kept in /sessions.`,defaultValue:`on`,userToggleable:!1,since:`2026-09-02`}),Object.freeze({id:`memory-v2`,label:`Memory v2`,description:`Searchable session history, scoop pre-compaction snapshots, and the gelatiere — a resident advisor that reviews your sessions and suggests skills and use cases.`,defaultValue:`off`,userToggleable:!0,since:`2026-09-10`}),Object.freeze({id:`live-model-catalog`,label:`Live model catalogue`,description:`Refresh model lists from pi's hosted catalogue, so newly launched models appear without a release.`,defaultValue:`on`,userToggleable:!1,since:`2026-09-22`})]);new Map(e.map(e=>[e.id,e]));const t=new Set([`1`,`on`,`true`]);let n=`standalone`,r={},i={};function a(t,n={},r=o()){let a={};for(let o of e){let e=r[o.id];if(typeof e==`string`&&p(o,t)){a[o.id]=e;continue}let s=i[o.id];if(typeof s==`string`&&p(o,t)){a[o.id]=s;continue}let c=n[o.id];a[o.id]=typeof c==`string`?c:f(o,t)}return a}function o(){try{let e=h()?.getItem(`slicc_feature_flags`);return e?m(JSON.parse(e)):{}}catch{return{}}}function s(e,t={}){n=e,r=m(t),i={}}function c(e,t){n=e,r=m(t)}function l(e){return a(n,r)[e]}function u(e){return typeof e==`string`&&t.has(e.trim().toLowerCase())}function d(e){return u(l(e))}function f(e,t){return e.floatDefaults?.[t]??e.defaultValue}function p(e,t){return e.userToggleable&&(e.overridableFloats===void 0||e.overridableFloats.includes(t))}function m(t){if(typeof t!=`object`||!t||Array.isArray(t))return{};let n=t,r={};for(let t of e){let e=n[t.id];typeof e==`string`&&(r[t.id]=e)}return r}function h(){try{let e=globalThis.localStorage;return typeof e?.getItem!=`function`||typeof e.setItem!=`function`?void 0:e}catch{return}}export{d as n,c as r,s as t};
@@ -1 +1 @@
1
- import{a as e}from"./path-utils-DNJG-zQf.js";import{C as t,p as n,t as r}from"./shared-C_68vn79.js";var i;(function(e){e.LOAD=`LOAD`,e.EXEC=`EXEC`,e.FFPROBE=`FFPROBE`,e.WRITE_FILE=`WRITE_FILE`,e.READ_FILE=`READ_FILE`,e.DELETE_FILE=`DELETE_FILE`,e.RENAME=`RENAME`,e.CREATE_DIR=`CREATE_DIR`,e.LIST_DIR=`LIST_DIR`,e.DELETE_DIR=`DELETE_DIR`,e.ERROR=`ERROR`,e.DOWNLOAD=`DOWNLOAD`,e.PROGRESS=`PROGRESS`,e.LOG=`LOG`,e.MOUNT=`MOUNT`,e.UNMOUNT=`UNMOUNT`})(i||={});const a=(()=>{let e=0;return()=>e++})(),o=Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),s=Error(`called FFmpeg.terminate()`);var c=class{#e=null;#t={};#n={};#r=[];#i=[];loaded=!1;#a=()=>{this.#e&&(this.#e.onmessage=({data:{id:e,type:t,data:n}})=>{switch(t){case i.LOAD:this.loaded=!0,this.#t[e](n);break;case i.MOUNT:case i.UNMOUNT:case i.EXEC:case i.FFPROBE:case i.WRITE_FILE:case i.READ_FILE:case i.DELETE_FILE:case i.RENAME:case i.CREATE_DIR:case i.LIST_DIR:case i.DELETE_DIR:this.#t[e](n);break;case i.LOG:this.#r.forEach(e=>e(n));break;case i.PROGRESS:this.#i.forEach(e=>e(n));break;case i.ERROR:this.#n[e](n)}delete this.#t[e],delete this.#n[e]})};#o=({type:e,data:t},n=[],r)=>this.#e?new Promise((i,o)=>{let s=a();this.#e&&this.#e.postMessage({id:s,type:e,data:t},n),this.#t[s]=i,this.#n[s]=o,r?.addEventListener(`abort`,()=>{o(new DOMException(`Message # ${s} was aborted`,`AbortError`))},{once:!0})}):Promise.reject(o);on(e,t){e===`log`?this.#r.push(t):e===`progress`&&this.#i.push(t)}off(e,t){e===`log`?this.#r=this.#r.filter(e=>e!==t):e===`progress`&&(this.#i=this.#i.filter(e=>e!==t))}load=({classWorkerURL:e,...t}={},{signal:n}={})=>(this.#e||(this.#e=e?new Worker(new URL(e,import.meta.url),{type:`module`}):new Worker(new URL(`/assets/worker-D1KsWRGg.js`,``+import.meta.url),{type:`module`}),this.#a()),this.#o({type:i.LOAD,data:t},void 0,n));exec=(e,t=-1,{signal:n}={})=>this.#o({type:i.EXEC,data:{args:e,timeout:t}},void 0,n);ffprobe=(e,t=-1,{signal:n}={})=>this.#o({type:i.FFPROBE,data:{args:e,timeout:t}},void 0,n);terminate=()=>{let e=Object.keys(this.#n);for(let t of e)this.#n[t](s),delete this.#n[t],delete this.#t[t];this.#e&&(this.#e.terminate(),this.#e=null,this.loaded=!1)};writeFile=(e,t,{signal:n}={})=>{let r=[];return t instanceof Uint8Array&&r.push(t.buffer),this.#o({type:i.WRITE_FILE,data:{path:e,data:t}},r,n)};mount=(e,t,n)=>this.#o({type:i.MOUNT,data:{fsType:e,options:t,mountPoint:n}},[]);unmount=e=>this.#o({type:i.UNMOUNT,data:{mountPoint:e}},[]);readFile=(e,t=`binary`,{signal:n}={})=>this.#o({type:i.READ_FILE,data:{path:e,encoding:t}},void 0,n);deleteFile=(e,{signal:t}={})=>this.#o({type:i.DELETE_FILE,data:{path:e}},void 0,t);rename=(e,t,{signal:n}={})=>this.#o({type:i.RENAME,data:{oldPath:e,newPath:t}},void 0,n);createDir=(e,{signal:t}={})=>this.#o({type:i.CREATE_DIR,data:{path:e}},void 0,t);listDir=(e,{signal:t}={})=>this.#o({type:i.LIST_DIR,data:{path:e}},void 0,t);deleteDir=(e,{signal:t}={})=>this.#o({type:i.DELETE_DIR,data:{path:e}},void 0,t)},l;(function(e){e.MEMFS=`MEMFS`,e.NODEFS=`NODEFS`,e.NODERAWFS=`NODERAWFS`,e.IDBFS=`IDBFS`,e.WORKERFS=`WORKERFS`,e.PROXYFS=`PROXYFS`})(l||={});const u=`0.12.10`,d=`@ffmpeg/core is not installed in node_modules: run \`${r} @ffmpeg/core@${u}\` (no network fallback)`,f=`@ffmpeg/core-mt`,p=`@ffmpeg/core-mt is not installed in node_modules (FFMPEG_CORE=mt asked for the multi-threaded core): run \`${r} ${f}@${u}\`, or unset FFMPEG_CORE and run \`${r} @ffmpeg/core@${u}\` (no network fallback)`;function m(){return globalThis.crossOriginIsolated===!0}function h(e=!1){return e&&m()?p:d}function g(e,t=m(),n=typeof navigator<`u`?navigator.hardwareConcurrency:void 0){let i=`${e.pkg} ${u}`;return e.pkg===`@ffmpeg/core-mt`?`${i} (multi-threaded${typeof n==`number`&&n>0?`, ${n} threads`:``}; single-input jobs only)`:t?`${i} (single-threaded; the multi-threaded core is opt-in on this isolated runtime: \`${r} ${f}@${u}\` then FFMPEG_CORE=mt, single-input jobs only)`:`${i} (single-threaded; runtime is not cross-origin isolated)`}const _=[`dist/esm`];async function v(e,t,n){for(let r of _){let i=`${e}/${r}`,a={core:`${i}/ffmpeg-core.js`,wasm:`${i}/ffmpeg-core.wasm`,worker:t===`@ffmpeg/core-mt`?`${i}/ffmpeg-core.worker.js`:null};if(await n.exists(a.core)&&await n.exists(a.wasm)&&!(a.worker&&!await n.exists(a.worker)))return a}return null}let y=null,b=null,x=[],S=null;function C(){return S}function w(e){for(let t of e)try{URL.revokeObjectURL(t)}catch{}}async function T(e={}){return y||=E(e.onProgress,e.ipk,e.preferMt===!0).catch(e=>{throw y=null,e}),y}async function E(e,t,n){let r=e??(()=>{}),i=new c,a=await k(t,r,n),o=[a.coreURL,a.wasmURL,a.workerURL,a.classWorkerURL].filter(e=>typeof e==`string`);r(`initializing ffmpeg-core...`);try{await i.load({coreURL:a.coreURL,wasmURL:a.wasmURL,...a.workerURL?{workerURL:a.workerURL}:{},...a.classWorkerURL?{classWorkerURL:a.classWorkerURL}:{}})}catch(e){throw w(o),e}return r(`ffmpeg ready`),b=i,x=o,S=a.pkg,i}async function D(n,r,i=!1){if(r===void 0)return O(n,i&&m());let a;try{a=await t(`${r}/package.json`,n.fromDir,n.reader)}catch{return null}if(a.type!==`file`)return null;let o=await v(e(a.path).dir,r,n.reader);if(!o)return null;try{let e=await n.reader.readFile(o.core),t=await n.readBytes(o.wasm),i=o.worker?await n.reader.readFile(o.worker):void 0;return{pkg:r,coreSource:e,wasmBytes:t,...i===void 0?{}:{workerSource:i}}}catch{return null}}async function O(e,t){if(t){let t=await D(e,f);if(t)return t}return D(e,`@ffmpeg/core`)}async function k(e,t,r){if(n())throw Error(`ffmpeg-wasm is not available in Node runtime`);let i=r&&m();if(!e)throw Error(h(i));let a=await O(e,i);if(!a)throw Error(h(i));t(`${a.pkg} loaded from ipk node_modules (js: ${a.coreSource.length} chars, wasm: ${a.wasmBytes.byteLength} bytes${a.workerSource?`, multi-threaded`:``})`);let o=A(a.wasmBytes,`application/wasm`);return{pkg:a.pkg,coreURL:j(a.coreSource,`text/javascript`),wasmURL:o,...a.workerSource===void 0?{}:{workerURL:j(a.workerSource,`text/javascript`)}}}function A(e,t){let n=new ArrayBuffer(e.byteLength);return new Uint8Array(n).set(e),URL.createObjectURL(new Blob([n],{type:t}))}function j(e,t){return URL.createObjectURL(new Blob([e],{type:t}))}function M(e){if(typeof WebAssembly<`u`&&e instanceof WebAssembly.RuntimeError||e instanceof RangeError)return!0;let t=e instanceof Error?e.message:String(e);return/RuntimeError|memory access out of bounds|unreachable|Aborted|out of memory|allocation failed|table index is out of bounds|function signature mismatch/i.test(t)}function N(e){if(e!==void 0&&b!==e)return;let t=b,n=x;if(y=null,b=null,x=[],S=null,t)try{t.terminate()}catch{}w(n)}export{T as a,N as c,h as i,D as l,f as n,M as o,g as r,C as s,u as t};
1
+ import{a as e}from"./path-utils-DNJG-zQf.js";import{C as t,p as n,t as r}from"./shared-DfMXB1pm.js";var i;(function(e){e.LOAD=`LOAD`,e.EXEC=`EXEC`,e.FFPROBE=`FFPROBE`,e.WRITE_FILE=`WRITE_FILE`,e.READ_FILE=`READ_FILE`,e.DELETE_FILE=`DELETE_FILE`,e.RENAME=`RENAME`,e.CREATE_DIR=`CREATE_DIR`,e.LIST_DIR=`LIST_DIR`,e.DELETE_DIR=`DELETE_DIR`,e.ERROR=`ERROR`,e.DOWNLOAD=`DOWNLOAD`,e.PROGRESS=`PROGRESS`,e.LOG=`LOG`,e.MOUNT=`MOUNT`,e.UNMOUNT=`UNMOUNT`})(i||={});const a=(()=>{let e=0;return()=>e++})(),o=Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),s=Error(`called FFmpeg.terminate()`);var c=class{#e=null;#t={};#n={};#r=[];#i=[];loaded=!1;#a=()=>{this.#e&&(this.#e.onmessage=({data:{id:e,type:t,data:n}})=>{switch(t){case i.LOAD:this.loaded=!0,this.#t[e](n);break;case i.MOUNT:case i.UNMOUNT:case i.EXEC:case i.FFPROBE:case i.WRITE_FILE:case i.READ_FILE:case i.DELETE_FILE:case i.RENAME:case i.CREATE_DIR:case i.LIST_DIR:case i.DELETE_DIR:this.#t[e](n);break;case i.LOG:this.#r.forEach(e=>e(n));break;case i.PROGRESS:this.#i.forEach(e=>e(n));break;case i.ERROR:this.#n[e](n)}delete this.#t[e],delete this.#n[e]})};#o=({type:e,data:t},n=[],r)=>this.#e?new Promise((i,o)=>{let s=a();this.#e&&this.#e.postMessage({id:s,type:e,data:t},n),this.#t[s]=i,this.#n[s]=o,r?.addEventListener(`abort`,()=>{o(new DOMException(`Message # ${s} was aborted`,`AbortError`))},{once:!0})}):Promise.reject(o);on(e,t){e===`log`?this.#r.push(t):e===`progress`&&this.#i.push(t)}off(e,t){e===`log`?this.#r=this.#r.filter(e=>e!==t):e===`progress`&&(this.#i=this.#i.filter(e=>e!==t))}load=({classWorkerURL:e,...t}={},{signal:n}={})=>(this.#e||(this.#e=e?new Worker(new URL(e,import.meta.url),{type:`module`}):new Worker(new URL(`/assets/worker-D1KsWRGg.js`,``+import.meta.url),{type:`module`}),this.#a()),this.#o({type:i.LOAD,data:t},void 0,n));exec=(e,t=-1,{signal:n}={})=>this.#o({type:i.EXEC,data:{args:e,timeout:t}},void 0,n);ffprobe=(e,t=-1,{signal:n}={})=>this.#o({type:i.FFPROBE,data:{args:e,timeout:t}},void 0,n);terminate=()=>{let e=Object.keys(this.#n);for(let t of e)this.#n[t](s),delete this.#n[t],delete this.#t[t];this.#e&&(this.#e.terminate(),this.#e=null,this.loaded=!1)};writeFile=(e,t,{signal:n}={})=>{let r=[];return t instanceof Uint8Array&&r.push(t.buffer),this.#o({type:i.WRITE_FILE,data:{path:e,data:t}},r,n)};mount=(e,t,n)=>this.#o({type:i.MOUNT,data:{fsType:e,options:t,mountPoint:n}},[]);unmount=e=>this.#o({type:i.UNMOUNT,data:{mountPoint:e}},[]);readFile=(e,t=`binary`,{signal:n}={})=>this.#o({type:i.READ_FILE,data:{path:e,encoding:t}},void 0,n);deleteFile=(e,{signal:t}={})=>this.#o({type:i.DELETE_FILE,data:{path:e}},void 0,t);rename=(e,t,{signal:n}={})=>this.#o({type:i.RENAME,data:{oldPath:e,newPath:t}},void 0,n);createDir=(e,{signal:t}={})=>this.#o({type:i.CREATE_DIR,data:{path:e}},void 0,t);listDir=(e,{signal:t}={})=>this.#o({type:i.LIST_DIR,data:{path:e}},void 0,t);deleteDir=(e,{signal:t}={})=>this.#o({type:i.DELETE_DIR,data:{path:e}},void 0,t)},l;(function(e){e.MEMFS=`MEMFS`,e.NODEFS=`NODEFS`,e.NODERAWFS=`NODERAWFS`,e.IDBFS=`IDBFS`,e.WORKERFS=`WORKERFS`,e.PROXYFS=`PROXYFS`})(l||={});const u=`0.12.10`,d=`@ffmpeg/core is not installed in node_modules: run \`${r} @ffmpeg/core@${u}\` (no network fallback)`,f=`@ffmpeg/core-mt`,p=`@ffmpeg/core-mt is not installed in node_modules (FFMPEG_CORE=mt asked for the multi-threaded core): run \`${r} ${f}@${u}\`, or unset FFMPEG_CORE and run \`${r} @ffmpeg/core@${u}\` (no network fallback)`;function m(){return globalThis.crossOriginIsolated===!0}function h(e=!1){return e&&m()?p:d}function g(e,t=m(),n=typeof navigator<`u`?navigator.hardwareConcurrency:void 0){let i=`${e.pkg} ${u}`;return e.pkg===`@ffmpeg/core-mt`?`${i} (multi-threaded${typeof n==`number`&&n>0?`, ${n} threads`:``}; single-input jobs only)`:t?`${i} (single-threaded; the multi-threaded core is opt-in on this isolated runtime: \`${r} ${f}@${u}\` then FFMPEG_CORE=mt, single-input jobs only)`:`${i} (single-threaded; runtime is not cross-origin isolated)`}const _=[`dist/esm`];async function v(e,t,n){for(let r of _){let i=`${e}/${r}`,a={core:`${i}/ffmpeg-core.js`,wasm:`${i}/ffmpeg-core.wasm`,worker:t===`@ffmpeg/core-mt`?`${i}/ffmpeg-core.worker.js`:null};if(await n.exists(a.core)&&await n.exists(a.wasm)&&!(a.worker&&!await n.exists(a.worker)))return a}return null}let y=null,b=null,x=[],S=null;function C(){return S}function w(e){for(let t of e)try{URL.revokeObjectURL(t)}catch{}}async function T(e={}){return y||=E(e.onProgress,e.ipk,e.preferMt===!0).catch(e=>{throw y=null,e}),y}async function E(e,t,n){let r=e??(()=>{}),i=new c,a=await k(t,r,n),o=[a.coreURL,a.wasmURL,a.workerURL,a.classWorkerURL].filter(e=>typeof e==`string`);r(`initializing ffmpeg-core...`);try{await i.load({coreURL:a.coreURL,wasmURL:a.wasmURL,...a.workerURL?{workerURL:a.workerURL}:{},...a.classWorkerURL?{classWorkerURL:a.classWorkerURL}:{}})}catch(e){throw w(o),e}return r(`ffmpeg ready`),b=i,x=o,S=a.pkg,i}async function D(n,r,i=!1){if(r===void 0)return O(n,i&&m());let a;try{a=await t(`${r}/package.json`,n.fromDir,n.reader)}catch{return null}if(a.type!==`file`)return null;let o=await v(e(a.path).dir,r,n.reader);if(!o)return null;try{let e=await n.reader.readFile(o.core),t=await n.readBytes(o.wasm),i=o.worker?await n.reader.readFile(o.worker):void 0;return{pkg:r,coreSource:e,wasmBytes:t,...i===void 0?{}:{workerSource:i}}}catch{return null}}async function O(e,t){if(t){let t=await D(e,f);if(t)return t}return D(e,`@ffmpeg/core`)}async function k(e,t,r){if(n())throw Error(`ffmpeg-wasm is not available in Node runtime`);let i=r&&m();if(!e)throw Error(h(i));let a=await O(e,i);if(!a)throw Error(h(i));t(`${a.pkg} loaded from ipk node_modules (js: ${a.coreSource.length} chars, wasm: ${a.wasmBytes.byteLength} bytes${a.workerSource?`, multi-threaded`:``})`);let o=A(a.wasmBytes,`application/wasm`);return{pkg:a.pkg,coreURL:j(a.coreSource,`text/javascript`),wasmURL:o,...a.workerSource===void 0?{}:{workerURL:j(a.workerSource,`text/javascript`)}}}function A(e,t){let n=new ArrayBuffer(e.byteLength);return new Uint8Array(n).set(e),URL.createObjectURL(new Blob([n],{type:t}))}function j(e,t){return URL.createObjectURL(new Blob([e],{type:t}))}function M(e){if(typeof WebAssembly<`u`&&e instanceof WebAssembly.RuntimeError||e instanceof RangeError)return!0;let t=e instanceof Error?e.message:String(e);return/RuntimeError|memory access out of bounds|unreachable|Aborted|out of memory|allocation failed|table index is out of bounds|function signature mismatch/i.test(t)}function N(e){if(e!==void 0&&b!==e)return;let t=b,n=x;if(y=null,b=null,x=[],S=null,t)try{t.terminate()}catch{}w(n)}export{T as a,N as c,h as i,D as l,f as n,M as o,g as r,C as s,u as t};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./slugify-BYJ6QVAt.js";import{n as t,r as n,t as r}from"./archive-redaction-ByV7X5fs.js";import{t as i}from"./types-D8gIX-W-.js";import{i as a,r as o,y as s}from"./kernel-worker-hZ_EeCIo.js";const c=/\uD83C\uDF99\uFE0F?/g,l=/\u25C1[\s\S]*?\u25B7/g;function u(e){return e.replace(l,``).replace(c,``).replace(/[ \t]+$/g,``).trimEnd()}function d(e){let t=``;for(let n of e){let e=n.role===`user`?`User`:`Assistant`,r=n.role===`user`?u(n.content):n.content;if(t+=`## ${e}\n${r}\n\n`,n.attachments?.length&&(t+=`Attachments:\n${n.attachments.map(e=>`- ${s(e)}`).join(`
1
+ import{t as e}from"./slugify-BYJ6QVAt.js";import{n as t,r as n,t as r}from"./archive-redaction-ByV7X5fs.js";import{t as i}from"./types-D8gIX-W-.js";import{i as a,r as o,y as s}from"./kernel-worker-DJ8FZwqE.js";const c=/\uD83C\uDF99\uFE0F?/g,l=/\u25C1[\s\S]*?\u25B7/g;function u(e){return e.replace(l,``).replace(c,``).replace(/[ \t]+$/g,``).trimEnd()}function d(e){let t=``;for(let n of e){let e=n.role===`user`?`User`:`Assistant`,r=n.role===`user`?u(n.content):n.content;if(t+=`## ${e}\n${r}\n\n`,n.attachments?.length&&(t+=`Attachments:\n${n.attachments.map(e=>`- ${s(e)}`).join(`
2
2
  `)}\n\n`),n.toolCalls)for(let e of n.toolCalls)t+=`### Tool: ${e.name}\nInput: ${JSON.stringify(e.input,null,2)}\nResult: ${e.result??``}\n\n`}return t}function f(e){return`live-${h(e)}-${m()}.md`}function p(e,t){return e.find(e=>e.live===!0&&(e.cone??`cone`)===t)}function m(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`}function h(t){return e(t,{maxLen:48,fallback:`session`})}const g=`untitled-session`,_=RegExp(`^(?:_Forwarded from .+?\\._\\s*)*(?:\\[@\\S+ (?:completed|idle|sudo-request|FAILED)\\b|\\[scoop_wait\\b|\\[(?:${[`Webhook Event`,`Sprinkle Event`,`File Watch Event`,`Session Reload`,`Navigate Event`,`Upgrade Event`,`Cherry Event`,`Workflow Event`,`Background Command`,`jshd Unit`,`Cron Event`,`Scoop Access Request`,`Preview Event`,`Preview event`,`Discovery Event`].join(`|`)})\\b|Preview tab (?:connected|disconnected) from |<context-summary\\b)`);function v(e){return e.slice(0,480).trim().replace(/\s+/g,` `).slice(0,240)}function y(e){let t=v(e);return t.length>0&&_.test(t)}function b(e){return e===g||y(e)}function x(e){return e.role!==`user`||!e.content?.trim()||e.source===`lick`||e.channel?!1:!y(e.content)}function S(e){let t=e.find(x);if(!t?.content)return g;let n=t.content.trim().replace(/\s+/g,` `);return n.length>60?`${n.slice(0,60)}…`:n||g}function C(e){return e.map(e=>{let t={id:e.id,role:e.role,content:e.content,timestamp:e.timestamp};return e.attachments?.length&&(t.attachments=e.attachments),e.toolCalls?.length&&(t.toolCalls=e.toolCalls.map(e=>({id:e.id,name:e.name,input:e.input,...e.result===void 0?{}:{result:e.result},...e.isError?{isError:e.isError}:{}}))),e.source&&(t.source=e.source),e.channel&&(t.channel=e.channel),e.compaction&&(t.compaction=e.compaction),t})}function w(e){let i=r(),a={...e,title:t(e.title,i),messages:n(e.messages,i)},o=(a.cost?`cost: ${JSON.stringify(a.cost)}\n`:``)+(a.models?`models: ${JSON.stringify(a.models)}\n`:``),s=(a.cone?`cone: ${a.cone}\n`:``)+(a.coneLabel?`coneLabel: ${JSON.stringify(a.coneLabel)}\n`:``)+(a.memorySkipped?`memorySkipped: true
3
3
  `:``)+(a.live?`live: true
4
4
  `:``)+(a.live&&a.liveThrough?`liveThrough: ${a.liveThrough}\n`:``)+(a.live&&a.compactions?`compactions: ${a.compactions}\n`:``)+(a.curatedThrough?`curatedThrough: ${a.curatedThrough}\n`:``),c=`---\nid: ${a.id}\ntitle: ${JSON.stringify(a.title)}\nfrozenAt: ${a.frozenAt}\ncreatedAt: ${a.createdAt}\nupdatedAt: ${a.updatedAt}\nmessageCount: ${a.messageCount}\n`+o+s+`---
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-b828m-Si.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/buffer-DvhmllZ2.js","assets/opfs-mount-tiZR34GY.js","assets/backend-hostfs-DV8kfBUj.js","assets/api-endpoint-DuEQRZ4g.js","assets/runtime-env-Dlaokqg1.js","assets/types-D8gIX-W-.js","assets/remote-cache-3KNT1gsp.js","assets/mount-9N6h5nwh.js","assets/preload-helper-Czpn1I53.js","assets/mime-types-D0xZwlMO.js","assets/base64-ELzoYfwP.js","assets/mount-table-store-dY2IfQ5S.js"])))=>i.map(i=>d[i]);
2
+ import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./preload-helper-Czpn1I53.js";import{t as n}from"./logger-DDBAeTLF.js";import{n as r,t as i}from"./types-D8gIX-W-.js";import{a,i as o,n as s,r as c,t as l}from"./path-utils-DNJG-zQf.js";import{r as u,t as d}from"./bounded-walk-BjxKWNqp.js";import{n as ee,t as te}from"./virtual-device-paths-D45tpPP6.js";import{t as f}from"./same-file-identity-DuEcSmPX.js";import{a as ne,i as re,n as ie,t as p}from"./mount-table-store-dY2IfQ5S.js";var m=n(`fs-watcher`),ae=0;function oe(e,t){return t===`/`||e===t||e.startsWith(t+`/`)}var h=class{registrations=new Map;watch(e,t,n){let r=`fsw-${++ae}`;return this.registrations.set(r,{id:r,basePath:e,filter:t,callback:n}),m.debug(`Watch registered`,{id:r,basePath:e}),()=>{this.registrations.delete(r),m.debug(`Watch unregistered`,{id:r})}}notify(e){if(e.length!==0)for(let[,t]of this.registrations){let n=e.filter(e=>oe(e.path,t.basePath)&&t.filter(e.path));if(n.length>0)try{t.callback(n)}catch(e){m.error(`Watch callback error`,{id:t.id,error:e instanceof Error?e.message:String(e)})}}}dispose(){this.registrations.clear(),m.debug(`All watchers disposed`)}get size(){return this.registrations.size}},g=n(`mount-index`),se=400,ce=2e6,le=`SLICC_MOUNT_INDEX_MAX_DEPTH`,ue=`SLICC_MOUNT_INDEX_MAX_ENTRIES`,_=256,v=class extends Error{cause;constructor(e,t){super(e),this.name=`MountIndexAbortError`,this.cause=t}};function de(e){let t=e.map(([e,t])=>`${e}\u0000${t.kind}`).sort(),n=t.length>_?t.slice(0,_):t;return`${t.length}\u0001${n.join(``)}`}async function fe(e,t){let n=e.isSameEntry;if(typeof n!=`function`)return!1;try{return await n.call(e,t)}catch{return!1}}function pe(e,t){return e instanceof Map?e.get(t):e[t]}function me(e){let t=e.trim();if(t===``)return;let n=Number(t);if(!(!Number.isInteger(n)||n<=0))return n}function y(e,t,n){let r=pe(e,t);if(r===void 0||r.trim()===``)return n;let i=me(r);return i===void 0?(g.warn(`Ignoring invalid ${t}; expected a positive integer, using default`,{value:r,fallback:n}),n):i}function b(e){return{maxDepth:y(e,le,se),maxEntries:y(e,ue,ce),skipNoiseDirs:!0}}var x=class{mounts=new Map;listeners=new Set;registerMount(e,t,n=b({})){this.mounts.get(e)?.abortController?.abort();let r=new AbortController,i={handle:t,state:{status:`pending`,indexed:0},files:new Set,directories:new Set,childrenByDirectory:new Map,abortController:r,limits:n};this.mounts.set(e,i),this.notifyListeners(),this.indexMount(e,i,r.signal)}unregisterMount(e){let t=this.mounts.get(e);t&&(t.abortController?.abort(),this.mounts.delete(e),this.notifyListeners())}async refreshMount(e,t){let n=this.mounts.get(e);if(!n)throw Error(`No mount at ${e}`);n.abortController?.abort();let r=new AbortController;n.abortController=r,n.state={status:`pending`,indexed:0},n.files.clear(),n.directories.clear(),n.childrenByDirectory.clear(),t&&(n.limits=t),this.notifyListeners(),await this.indexMount(e,n,r.signal)}isReady(e){return this.mounts.get(e)?.state.status===`ready`}isAnyIndexing(){for(let e of this.mounts.values())if(e.state.status===`indexing`||e.state.status===`pending`)return!0;return!1}dispose(){for(let e of this.mounts.values())e.abortController?.abort();this.mounts.clear(),this.listeners.clear()}getState(e){return this.mounts.get(e)?.state}getFiles(e,t){let n=this.mounts.get(e);if(n?.state.status!==`ready`)return;if(!t)return[...n.files];let r=[];for(let e of n.files)t(e)&&r.push(e);return r}getDirectoryEntries(e,t){let n=this.mounts.get(e);if(n?.state.status!==`ready`)return;let r=n.childrenByDirectory.get(t);if(r)return[...r].map(([e,t])=>({name:e,type:t}))}hasPath(e,t){let n=this.mounts.get(e);if(n?.state.status===`ready`)return n.files.has(t)||n.directories.has(t)}notifyWrite(e){let t=this.findMountForPath(e);if(!t)return;let n=this.mounts.get(t);if(n?.state.status!==`ready`||this.isSkippedNoisePath(t,e,n,`file`))return;n.files.add(e),this.addPathToChildIndex(n,e,`file`);let r=this.parentPath(e);for(;(r===t||r.startsWith(`${t}/`))&&(n.directories.add(r),this.ensureDirectoryChildren(n,r),r!==t);)this.addPathToChildIndex(n,r,`directory`),r=this.parentPath(r)}notifyDelete(e){let t=this.findMountForPath(e);if(!t)return;let n=this.mounts.get(t);if(n?.state.status!==`ready`||this.isSkippedNoisePath(t,e,n,`unknown`))return;n.files.delete(e),n.directories.delete(e);let r=e+`/`;for(let e of n.files)e.startsWith(r)&&n.files.delete(e);for(let e of n.directories)e.startsWith(r)&&n.directories.delete(e);this.removePathFromChildIndex(n,e);for(let t of n.childrenByDirectory.keys())(t===e||t.startsWith(r))&&n.childrenByDirectory.delete(t)}notifyRename(e,t){let n=this.findMountForPath(e);if(!n)return;let r=this.mounts.get(n);if(r?.state.status!==`ready`)return;let i=r.files.has(e)?`file`:r.directories.has(e)?`directory`:`unknown`;if(i===`unknown`||this.isSkippedNoisePath(n,e,r,i))return;if(this.isSkippedNoisePath(n,t,r,i)){this.notifyDelete(e);return}if(i===`file`){r.files.delete(e),r.files.add(t),this.removePathFromChildIndex(r,e),this.addPathToChildIndex(r,t,`file`);return}r.directories.delete(e),r.directories.add(t);let a=e+`/`,o=t+`/`;for(let e of[...r.files])e.startsWith(a)&&(r.files.delete(e),r.files.add(o+e.slice(a.length)));for(let e of[...r.directories])e.startsWith(a)&&(r.directories.delete(e),r.directories.add(o+e.slice(a.length)));this.removePathFromChildIndex(r,e),this.addPathToChildIndex(r,t,`directory`);let s=[...r.childrenByDirectory.entries()].filter(([t])=>t===e||t.startsWith(a));for(let[e]of s)r.childrenByDirectory.delete(e);for(let[n,i]of s){let s=n===e?t:o+n.slice(a.length);r.childrenByDirectory.set(s,i)}}ensureDirectoryChildren(e,t){let n=e.childrenByDirectory.get(t);return n||(n=new Map,e.childrenByDirectory.set(t,n)),n}addPathToChildIndex(e,t,n){let r=t.slice(t.lastIndexOf(`/`)+1);r&&(this.ensureDirectoryChildren(e,this.parentPath(t)).set(r,n),n===`directory`&&this.ensureDirectoryChildren(e,t))}removePathFromChildIndex(e,t){let n=t.slice(t.lastIndexOf(`/`)+1);e.childrenByDirectory.get(this.parentPath(t))?.delete(n)}parentPath(e){let t=e.lastIndexOf(`/`);return t<=0?`/`:e.slice(0,t)}isSkippedNoisePath(e,t,n,r){if(!n.limits.skipNoiseDirs||!t.startsWith(`${e}/`))return!1;let i=t.slice(e.length+1).split(`/`),a=r===`unknown`?n.files.has(t)?`file`:n.directories.has(t)?`directory`:`unknown`:r;for(let e=0;e<i.length;e++){let t=e===i.length-1;if(!(t&&a===`file`)&&!(t&&a===`unknown`&&!d(i[e]))&&d(i[e]))return!0}return!1}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}findMountForPath(e){let t;for(let n of this.mounts.keys())(e===n||e.startsWith(n+`/`))&&(!t||n.length>t.length)&&(t=n);return t}notifyListeners(){for(let e of this.listeners)try{e()}catch{}}async indexMount(e,t,n){t.state={status:`indexing`,indexed:0},this.notifyListeners();try{if(await this.walkHandle(e,t.handle,t,n),n.aborted)return;t.state={status:`ready`,indexed:t.files.size+t.directories.size,total:t.files.size+t.directories.size},t.abortController=null,g.info(`Mount indexed`,{path:e,files:t.files.size,directories:t.directories.size})}catch(r){if(n.aborted)return;let i=r instanceof Error?r.message:String(r),a=r instanceof v?r.cause:`indexing-error`;t.state={status:`error`,indexed:0,error:i,abortCause:a},g.error(`Mount indexing failed`,{path:e,error:i,abortCause:a})}this.notifyListeners()}async walkHandle(e,t,n,r,i=0,a=new Map){if(r.aborted)return;this.enforceWalkBounds(i,n),n.directories.add(e),this.ensureDirectoryChildren(n,e);let o=await this.readChildren(t,r,n);if(r.aborted)return;let s=await this.confirmNoCycle(e,t,o,a),c=this.pushAncestor(a,s,e,t);try{await this.walkChildren(e,o,n,r,i,a)}finally{this.popAncestor(a,s,c)}}enforceWalkBounds(e,t){if(e>t.limits.maxDepth)throw new v(`mount indexing aborted: directory nesting exceeded ${t.limits.maxDepth} levels`,`depth-exceeded`);if(t.directories.size+t.files.size>=t.limits.maxEntries)throw new v(`mount indexing aborted: exceeded ${t.limits.maxEntries} entries`,`entries-exceeded`)}async readChildren(e,t,n){let r=e,i=[];for await(let e of r){if(t.aborted)break;if(n.directories.size+n.files.size+i.length>=n.limits.maxEntries)throw new v(`mount indexing aborted: exceeded ${n.limits.maxEntries} entries`,`entries-exceeded`);i.push(e)}return i}async confirmNoCycle(e,t,n,r){let i=de(n),a=r.get(i);if(a){for(let n of a)if(await fe(n.handle,t))throw new v(`mount indexing aborted: self-referential mount cycle detected at ${e} (re-exposes ${n.path})`,`cycle-detected`)}return i}pushAncestor(e,t,n,r){let i=e.get(t);return i||(i=[],e.set(t,i)),i.push({path:n,handle:r,signature:t}),i}popAncestor(e,t,n){n.pop(),n.length===0&&e.delete(t)}async walkChildren(e,t,n,r,i,a){for(let[o,s]of t){if(r.aborted)return;let t=e===`/`?`/${o}`:`${e}/${o}`;if(s.kind===`file`)n.files.add(t),this.addPathToChildIndex(n,t,`file`),n.state.indexed++;else if(s.kind===`directory`){if(n.limits.skipNoiseDirs&&d(o))continue;this.addPathToChildIndex(n,t,`directory`),await this.walkHandle(t,s,n,r,i+1,a)}n.state.indexed%500==0&&(this.notifyListeners(),await new Promise(e=>setTimeout(e,0)))}}},S=new TextEncoder,C=new TextDecoder(`utf-8`,{fatal:!1}),w=class{entries=new Map;static handles(e){return ee(s(e))}has(e){return this.entries.has(s(e))}write(e,t){let n=s(e),r=typeof t==`string`?S.encode(t):new Uint8Array(t),i=Date.now(),a=this.entries.get(n);this.entries.set(n,{bytes:r,mtime:i,ctime:a?.ctime??i})}append(e,t){let n=this.entries.get(s(e))?.bytes??new Uint8Array,r=typeof t==`string`?S.encode(t):t,i=new Uint8Array(n.length+r.length);i.set(n),i.set(r,n.length),this.write(e,i)}read(e,t){let n=this.require(e);return(t?.encoding??`utf-8`)===`utf-8`?C.decode(n.bytes):new Uint8Array(n.bytes)}readText(e){return C.decode(this.require(e).bytes)}stat(e){let t=this.require(e);return{type:`file`,size:t.bytes.length,mtime:t.mtime,ctime:t.ctime}}remove(e){return this.entries.delete(s(e))}require(e){let t=s(e),n=this.entries.get(t);if(!n)throw new i(`ENOENT`,`no such file or directory`,t);return n}},T={[te]:{stat:()=>({type:`file`,size:0,mtime:0,ctime:0}),read:e=>(e?.encoding??`utf-8`)===`utf-8`?``:new Uint8Array,readText:()=>``,write:()=>{}}},E=[`/tmp/`],D=class{ephemeralFds=new w;vfs;allowedPrefixes;readOnlyPrefixes;readGrantPatterns=[];writeEnforcement;includeMounts;constructor(e,t,n=[],r=`hard`,i={}){this.vfs=e;let a=e=>{let t=s(e);return t.endsWith(`/`)?t:t+`/`};this.allowedPrefixes=t.map(a),this.readOnlyPrefixes=n.map(a),this.writeEnforcement=r,this.includeMounts=i.includeMounts!==!1}getAllPrefixes(){let e=this.includeMounts?this.vfs.listMounts().map(e=>e.endsWith(`/`)?e:e+`/`):[];return[...this.allowedPrefixes,...this.readOnlyPrefixes,...e,...E]}setReadGrants(e){this.readGrantPatterns=[];for(let t of new Set(e))this.addReadGrant(t)}addReadGrant(e){let t=e.split(`/`),n=[];for(let e=1;e<t.length;e++)n.push(c(t.slice(0,e).join(`/`)||`/`));this.readGrantPatterns.push({pattern:e,regex:c(e),ancestorRegexes:n})}matchesReadGrant(e){return this.readGrantPatterns.some(t=>t.regex.test(e))}leadsToReadGrant(e){return this.readGrantPatterns.some(t=>t.ancestorRegexes.some(t=>t.test(e)))}isAllowed(e){let t=s(e),n=this.getAllPrefixes();return this.matchesReadGrant(t)||this.leadsToReadGrant(t)||n.some(e=>t===e.slice(0,-1)||t.startsWith(e)||t===`/`||e.startsWith(t+`/`))}isAllowedStrict(e){let t=s(e),n=this.getAllPrefixes();return this.matchesReadGrant(t)||n.some(e=>t===e.slice(0,-1)||t.startsWith(e))}isWritable(e){let t=s(e);return[...this.allowedPrefixes,...E].some(e=>t===e.slice(0,-1)||t.startsWith(e))}canWrite(e){return w.handles(e)||this.isWritable(e)}checkWrite(e){if(this.writeEnforcement!==`sudo-delegated`&&!this.isWritable(e))throw new i(`EACCES`,`permission denied`,s(e))}async resolveAndCheckRead(e){try{let t=await this.vfs.realpath(e);if(!this.isAllowedStrict(t))throw new i(`ENOENT`,`no such file or directory`,s(e));return t}catch(t){throw t instanceof i?t:new i(`ENOENT`,`no such file or directory`,s(e))}}async resolveAndCheckWrite(e){try{let t=await this.vfs.realpath(e);if(!this.isWritable(t)&&!this.isSymlinkEscapeAllowed(t))throw new i(`EACCES`,`permission denied`,s(e));return t}catch(t){throw t instanceof i?t:new i(`EACCES`,`permission denied`,s(e))}}isSymlinkEscapeAllowed(e){return!1}async checkParentRealpathEscape(e){let t=this.vfs.dirname(e),n=this.vfs.basename(e),r;try{r=await this.vfs.realpath(t)}catch(e){if(e instanceof i&&e.code===`EACCES`)throw e;return}let a=r+`/`+n;if(this.isWritable(a))return;let o=s(r)!==s(t);if(!(this.writeEnforcement===`sudo-delegated`&&!o))throw new i(`EACCES`,`permission denied`,s(e))}getUnderlyingFS(){return this.vfs}invalidatePaths(e){this.vfs.invalidatePaths(e)}async forgetSidecarConsistency(){await this.vfs.forgetSidecarConsistency()}async flush(){await this.vfs.flush()}isPathUnderMount(e){return this.vfs.isPathUnderMount(e)}async readFile(e,t){let n=T[s(e)];if(n)return n.read(t);if(w.handles(e))return this.ephemeralFds.read(e,t);if(!this.isAllowedStrict(e))throw new i(`ENOENT`,`no such file or directory`,s(e));let r=await this.resolveAndCheckRead(e);return this.vfs.readFile(r,t)}async readFileRange(e,t,n){if(!this.isAllowedStrict(e))throw new i(`ENOENT`,`no such file or directory`,s(e));let r=await this.resolveAndCheckRead(e);return this.vfs.readFileRange(r,t,n)}async getNativeFile(e){if(T[s(e)]||w.handles(e)||!this.isAllowedStrict(e))return null;try{let t=await this.resolveAndCheckRead(e);return await this.vfs.getNativeFile(t)}catch{return null}}async readDir(e,t){if(!this.isAllowed(e))return[];let n=e;if(this.isAllowedStrict(e))try{n=await this.resolveAndCheckRead(e)}catch{return[]}let r=await this.vfs.readDir(n,t);if(!this.isAllowedStrict(e)){let t=s(e);return r.filter(e=>{let n=t===`/`?`/${e.name}`:`${t}/${e.name}`;return this.isAllowed(n)})}return r}async stat(e){let t=T[s(e)];if(t)return t.stat();if(w.handles(e))return this.ephemeralFds.stat(e);if(!this.isAllowed(e))throw new i(`ENOENT`,`no such file or directory`,s(e));if(this.isAllowedStrict(e)){let t=await this.resolveAndCheckRead(e);return this.vfs.stat(t)}return this.vfs.stat(e)}scanPathForSymlinks(e,t){let n=s(e);if(n===`/`)return!1;let r=n.slice(1).split(`/`),i=t?r.length:r.length-1,a=``;for(let e=0;e<i;e++){a=a+`/`+r[e];let t=this.vfs.lstatSync(a);if(t===null)return null;if(t.type===`symlink`)return!0}return!1}statSync(e){let t=T[s(e)];return t?t.stat():w.handles(e)?this.ephemeralFds.has(e)?this.ephemeralFds.stat(e):null:!this.isAllowedStrict(e)||this.scanPathForSymlinks(e,!0)!==!1?null:this.vfs.statSync(e)}lstatSync(e){let t=T[s(e)];return t?t.stat():w.handles(e)?this.ephemeralFds.has(e)?this.ephemeralFds.stat(e):null:!this.isAllowed(e)||this.scanPathForSymlinks(e,!1)!==!1?null:this.vfs.lstatSync(e)}readDirSync(e){if(!this.isAllowed(e)||this.scanPathForSymlinks(e,!0)!==!1)return null;let t=this.vfs.readDirSync(e);if(t===null)return null;if(this.isAllowedStrict(e))return t;let n=s(e);return t.filter(e=>{let t=n===`/`?`/${e.name}`:`${n}/${e.name}`;return this.isAllowed(t)})}async realpath(e){if(w.handles(e)){let t=s(e);if(!this.ephemeralFds.has(t))throw new i(`ENOENT`,`no such file or directory`,t);return t}let t;try{t=await this.vfs.realpath(e)}catch(t){throw t instanceof i?t:new i(`ENOENT`,`no such file or directory`,s(e))}if(!this.isAllowedStrict(t))throw new i(`ENOENT`,`no such file or directory`,s(e));return t}async exists(e){if(T[s(e)])return!0;if(w.handles(e))return this.ephemeralFds.has(e);if(!this.isAllowed(e))return!1;if(this.isAllowedStrict(e))try{await this.resolveAndCheckRead(e)}catch{return!1}return this.vfs.exists(e)}async readTextFile(e){let t=T[s(e)];if(t)return t.readText();if(w.handles(e))return this.ephemeralFds.readText(e);if(!this.isAllowedStrict(e))throw new i(`ENOENT`,`no such file or directory`,s(e));let n=await this.resolveAndCheckRead(e);return this.vfs.readTextFile(n)}async*walk(e){if(!this.isAllowed(e))return;let t=e;if(this.isAllowedStrict(e))try{t=await this.resolveAndCheckRead(e)}catch{return}for await(let e of this.vfs.walk(t))this.isAllowed(e)&&(yield e)}async writeFile(e,t,n){let r=T[s(e)];if(r){r.write(t);return}if(w.handles(e)){this.ephemeralFds.write(e,t);return}return await this.checkContentWrite(e),this.vfs.writeFile(e,t,n)}async appendFile(e,t){let n=T[s(e)];if(n){n.write(t);return}if(w.handles(e)){this.ephemeralFds.append(e,t);return}return await this.checkContentWrite(e),this.vfs.appendFile(e,t)}async chmod(e,t){return this.refuseDescriptorTreeOp(e),await this.checkContentWrite(e),this.vfs.chmod(e,t)}async utimes(e,t,n){return this.refuseDescriptorTreeOp(e),await this.checkContentWrite(e),this.vfs.utimes(e,t,n)}async checkContentWrite(e){this.checkWrite(e),await this.checkParentRealpathEscape(e);try{(await this.vfs.lstat(e)).type===`symlink`&&await this.resolveAndCheckWrite(e)}catch(e){if(e instanceof i&&e.code===`EACCES`)throw e}}refuseDescriptorTreeOp(e){if(w.handles(e))throw new i(`EACCES`,`permission denied`,s(e))}async mkdir(e,t){return this.refuseDescriptorTreeOp(e),this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.mkdir(e,t)}async rm(e,t){if(w.handles(e)){if(!this.ephemeralFds.remove(e))throw new i(`ENOENT`,`no such file or directory`,s(e));return}this.checkWrite(e);try{(await this.vfs.lstat(e)).type===`symlink`||await this.resolveAndCheckWrite(e)}catch(e){if(e instanceof i&&e.code===`EACCES`)throw e}return this.vfs.rm(e,t)}async rename(e,t){return this.refuseDescriptorTreeOp(e),this.refuseDescriptorTreeOp(t),this.checkWrite(e),this.checkWrite(t),await this.resolveAndCheckWrite(e),await this.checkParentRealpathEscape(t),this.vfs.rename(e,t)}async copyFile(e,t){if(w.handles(e)){let n=this.ephemeralFds.read(e,{encoding:`binary`});await this.writeFile(t,n);return}if(w.handles(t)){if(!this.isAllowed(e))throw new i(`ENOENT`,`no such file or directory`,s(e));let n=await this.resolveAndCheckRead(e);this.ephemeralFds.write(t,await this.vfs.readFile(n,{encoding:`binary`}));return}if(!this.isAllowed(e))throw new i(`ENOENT`,`no such file or directory`,s(e));this.checkWrite(t);let n=await this.resolveAndCheckRead(e);await this.checkParentRealpathEscape(t);try{(await this.vfs.lstat(t)).type===`symlink`&&await this.resolveAndCheckWrite(t)}catch(e){if(e instanceof i&&e.code===`EACCES`)throw e}return this.vfs.copyFile(n,t)}async symlink(e,t){return this.refuseDescriptorTreeOp(t),this.checkWrite(t),await this.checkParentRealpathEscape(t),this.vfs.symlink(e,t)}async readlink(e){if(!this.isAllowedStrict(e))throw new i(`ENOENT`,`no such file or directory`,s(e));let t=await this.vfs.readlink(e),n;if(t.startsWith(`/`))n=s(t);else{let r=this.vfs.dirname(e);n=s(r+`/`+t)}if(!this.isAllowedStrict(n))throw new i(`ENOENT`,`no such file or directory`,s(e));return t}async lstat(e){let t=T[s(e)];if(t)return t.stat();if(w.handles(e))return this.ephemeralFds.stat(e);if(!this.isAllowed(e))throw new i(`ENOENT`,`no such file or directory`,s(e));let n=s(e),r=this.vfs.dirname(n),a=this.vfs.basename(n),o;if(r===n)o=r;else try{o=await this.vfs.realpath(r)}catch{throw new i(`ENOENT`,`no such file or directory`,n)}let c=o===`/`?`/${a}`:`${o}/${a}`;if(!this.isAllowed(c))throw new i(`ENOENT`,`no such file or directory`,n);return this.vfs.lstat(c)}watch(e,t,n){if(!this.isAllowed(e))throw new i(`EACCES`,`permission denied`,s(e));let r=this.vfs.getWatcher();if(!r)throw new i(`EINVAL`,`no watcher configured`);return r.watch(s(e),t,n)}dirname(e){return this.vfs.dirname(e)}basename(e){return this.vfs.basename(e)}async mount(e,t,n){return this.refuseDescriptorTreeOp(e),this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.mount(e,t,n)}async unmount(e){return this.refuseDescriptorTreeOp(e),this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.unmount(e)}listMounts(){let e=this.vfs.listMounts();return this.includeMounts?e:e.filter(e=>this.isAllowedStrict(e))}listMountPoints(){let e=this.vfs.listMountPoints();return this.includeMounts?e:e.filter(e=>this.isAllowed(e.path))}getMountIndex(){return this.vfs.getMountIndex()}async refreshMount(e,t){return this.refuseDescriptorTreeOp(e),this.checkWrite(e),this.vfs.refreshMount(e,t)}async dispose(){await this.vfs.dispose()}};function O(e,t){if(e instanceof i){let n=`${e.code}: `,r=e.message;throw r.startsWith(n)&&(r=r.slice(n.length)),e.path&&r.endsWith(` '${e.path}'`)&&(r=r.slice(0,r.length-` '${e.path}'`.length)),new i(e.code,r,t)}throw e}var he=[`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`ENOSYS`,`EOPNOTSUPP`,`EXDEV`,`EIO`];function k(e,t){if(e instanceof i)return e;{let n=e instanceof Error?e.message:String(e);if(n.includes(`maximum size exceeded`)||n.includes(`call stack size exceeded`))return new i(`EIO`,`internal overflow, not storage: ${n} — reload the session`,t)}let n=e?.code;if(typeof n==`string`){let r=n;if(he.includes(r)){let n=e instanceof Error?e.message:String(e);return n.startsWith(`${r}: `)&&(n=n.slice(r.length+2),n=n.replace(/, undefined( '[^']*')?$/,``).replace(/ '[^']*'$/,``)),new i(r,n||r,t)}}let r=e instanceof Error?e.message:String(e);return r.includes(`ENOENT`)?new i(`ENOENT`,`no such file or directory`,t):r.includes(`EEXIST`)?new i(`EEXIST`,`file already exists`,t):r.includes(`ENOTDIR`)?new i(`ENOTDIR`,`not a directory`,t):r.includes(`EISDIR`)?new i(`EISDIR`,`is a directory`,t):r.includes(`ENOTEMPTY`)?new i(`ENOTEMPTY`,`directory not empty`,t):r.includes(`ELOOP`)?new i(`ELOOP`,`too many levels of symbolic links`,t):r.includes(`EOPNOTSUPP`)||r.includes(`ENOTSUP`)?new i(`EOPNOTSUPP`,`operation not supported`,t):r.includes(`EXDEV`)?new i(`EXDEV`,`cross-device link`,t):new i(`EINVAL`,r,t)}var ge=61440,_e=16384;function A(e){return e===void 0?`absent`:(e&ge)===_e?`directory`:`file`}function j(e,t){return t===`absent`?!1:e.kind===`missing`||e.kind!==t}function M(e){let t=e?.mode;return typeof t==`number`?t:void 0}function ve(e,t,n,r=new Set){let i=new Set(n);if(r.size>0){for(let t of Object.keys(e.entries??{}))for(let e of r)if(t===e||t.startsWith(`${e}/`)){i.add(t);break}}let a=[];for(let n of i){let r=e.entries?.[n],i=t.entries?.[n];if(!r||!i)continue;let o=A(M(r));o!==A(M(i))&&a.push({path:n,ownIsDirectory:o===`directory`})}return a}var N=512,P=class e{kind=`local`;listingStatsMatchStat=!0;source=void 0;profile=void 0;mountId;handle;dirCacheMax;dirCache=new Map;closed=!1;constructor(e,t){this.handle=e,this.mountId=t.mountId,this.dirCacheMax=t.dirCacheMax??N}static fromHandle(t,n){return new e(t,n)}getHandle(){return this.handle}assertOpen(e){if(this.closed)throw new i(`EBADF`,`mount closed`,e)}splitPath(e){return e.replace(/^\/+/,``).replace(/\/+$/,``).split(`/`).filter(e=>e.length>0)}cacheGet(e){let t=this.dirCache.get(e);if(t!==void 0)return this.dirCache.delete(e),this.dirCache.set(e,t),t}cacheSet(e,t){for(this.dirCache.has(e)&&this.dirCache.delete(e),this.dirCache.set(e,t);this.dirCache.size>this.dirCacheMax;){let e=this.dirCache.keys().next();if(e.done)break;this.dirCache.delete(e.value)}}invalidate(e){if(e===``){this.dirCache.clear();return}let t=`${e}/`;for(let n of[...this.dirCache.keys()])(n===e||n.startsWith(t))&&this.dirCache.delete(n)}getDirCacheSize(){return this.dirCache.size}async resolveDirFrom(e,t,n,r=!0){let i=this.handle,a=``,o=0;if(r)for(let t=e.length;t>0;t--){let n=e.slice(0,t).join(`/`),r=this.cacheGet(n);if(r){i=r,a=n,o=t;break}}let s=a;for(;o<e.length;o++){let r=e[o];try{i=await i.getDirectoryHandle(r,{create:n})}catch(r){if(n&&s!==``)return this.invalidate(s),this.resolveDirFrom(e,t,n,!1);throw this.toFsError(r,t)}a=a===``?r:`${a}/${r}`,this.cacheSet(a,i)}return i}async resolveDir(e,t=!1){return this.resolveDirFrom(this.splitPath(e),e,t)}async resolveParent(e,t){let n=this.splitPath(e);if(n.length===0)throw new i(`EISDIR`,`is a directory`,e);let r=n.pop();return{parent:await this.resolveDirFrom(n,e,t),name:r}}async resolveFile(e,t=!1){let{parent:n,name:r}=await this.resolveParent(e,t);try{return await n.getFileHandle(r,{create:t})}catch(t){throw this.toFsError(t,e)}}toFsError(e,t){if(e instanceof i)return e;if(e instanceof DOMException){if(e.name===`NotFoundError`)return new i(`ENOENT`,`no such file or directory`,t);if(e.name===`TypeMismatchError`)return new i(`ENOTDIR`,`not a directory`,t);if(e.name===`NotAllowedError`)return new i(`EACCES`,`permission denied`,t);if(e.name===`InvalidModificationError`)return new i(`ENOTEMPTY`,`directory not empty`,t)}if(e instanceof Error){if(e.name===`NotFound`||e.name===`NotFoundError`)return new i(`ENOENT`,`no such file or directory`,t);if(e.name===`TypeMismatch`||e.name===`TypeMismatchError`)return new i(`ENOTDIR`,`not a directory`,t);if(e.name===`InvalidModification`||e.name===`InvalidModificationError`)return new i(`ENOTEMPTY`,`directory not empty`,t)}return new i(`EINVAL`,e instanceof Error?e.message:String(e),t)}async readDir(e,t){this.assertOpen(e);let n=await this.resolveDir(e),r=[];for await(let[e,i]of n){if(i.kind!==`file`){r.push({name:e,kind:`directory`});continue}if(!t?.includeStats){r.push({name:e,kind:`file`});continue}let n=await i.getFile();r.push({name:e,kind:`file`,size:n.size,lastModified:n.lastModified})}return r}async readFile(e){this.assertOpen(e);let t=await(await this.resolveFile(e)).getFile();return new Uint8Array(await t.arrayBuffer())}async getNativeFile(e){this.assertOpen(e);try{return await(await this.resolveFile(e)).getFile()}catch{return null}}async writeFile(e,t){this.assertOpen(e);let n=await(await this.resolveFile(e,!0)).createWritable();await n.write(t),await n.close()}async stat(e){this.assertOpen(e);let t=this.splitPath(e);if(t.length===0)return{kind:`directory`,size:0,mtime:0};let n=t.pop(),r=await this.resolveDirFrom(t,e,!1);try{let e=await(await r.getFileHandle(n)).getFile();return{kind:`file`,size:e.size,mtime:e.lastModified}}catch(t){let n=this.toFsError(t,e);if(n.code!==`ENOENT`&&n.code!==`ENOTDIR`)throw n}try{let e=await r.getDirectoryHandle(n);this.cacheSet(t.length===0?n:`${t.join(`/`)}/${n}`,e)}catch(t){throw this.toFsError(t,e)}return{kind:`directory`,size:0,mtime:0}}async mkdir(e){this.assertOpen(e),await this.resolveDir(e,!0)}async remove(e,t){this.assertOpen(e);let n=this.splitPath(e);if(n.length===0)throw new i(`EINVAL`,`cannot remove mount root`,e);let r=n.pop(),a=await this.resolveDirFrom(n,e,!1);try{await a.removeEntry(r,{recursive:t?.recursive??!1})}catch(t){throw this.toFsError(t,e)}this.invalidate(n.length===0?r:`${n.join(`/`)}/${r}`)}async refresh(){return this.assertOpen(`/`),this.dirCache.clear(),{added:[],removed:[],changed:[],unchanged:0,errors:[]}}describe(){return{displayName:this.handle.name}}async close(){this.closed=!0,this.dirCache.clear()}};async function F(e,t){let n=t.split(`/`).filter(Boolean),r=n.pop();if(r===void 0)return null;try{let t=e;for(let e of n)t=await t.getDirectoryHandle(e);return await(await t.getFileHandle(r)).getFile()}catch{return null}}function I(e,t){return e===t||e.startsWith(t===`/`?`/`:`${t}/`)}var ye=`/.metadata.json`,L=`.metadata.consistent.json`,R=`/${L}`;function z(e){return e.entries&&(delete e.entries[ye],delete e.entries[R]),e}function be(e,t,n){let r=t.entries??{},i={...e.entries??{}};`/`in r&&(i[`/`]=r[`/`]);for(let e of n.paths)e in r?i[e]=r[e]:delete i[e];for(let e of n.prefixes){for(let t of Object.keys(i))I(t,e)&&delete i[t];for(let t of Object.keys(r))I(t,e)&&(i[t]=r[t])}let{entries:a,...o}=t;return z({...o,entries:i})}var B=1;async function xe(e,t,n){let r=Math.max(1,Math.trunc(e)||1),i=Array(t.length),a=0,o=async()=>{for(;a<t.length;){let e=a;if(a+=1,e>=t.length)return;i[e]=await n(t[e],e)}},s=[],c=Math.min(r,t.length);for(let e=0;e<c;e+=1)s.push(o());return await Promise.all(s),i}async function V(e){let t=e;if(typeof t.createSyncAccessHandle==`function`)try{let e=await t.createSyncAccessHandle();try{return e.getSize()}finally{try{await e.close()}catch{}}}catch{}return(await e.getFile()).size}async function H(e){let t;for(let n=0;n<3;n+=1)try{return await(await e.getFile()).text()}catch(e){if(e?.name!==`NotReadableError`)throw e;t=e}throw t}function Se(e){if(!e||typeof e!=`object`)return!1;let t=e.entries;return!!t&&typeof t==`object`}async function Ce(e){try{let t=await H(await e.getFileHandle(`.metadata.json`)),n=JSON.parse(t);return Se(n)?{text:t,doc:n}:null}catch{return null}}async function we(e,t){let n=await(await e.getFileHandle(`.metadata.json`,{create:!0})).createWritable();await n.write(t),await n.close()}async function U(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e)),n=new Uint8Array(t),r=``;for(let e of n)r+=e.toString(16).padStart(2,`0`);return r}async function W(e,t){try{let n=await e.getFileHandle(L),r=JSON.parse(await H(n));if(!r||typeof r!=`object`)return!1;let i=r;return i.v!==B||typeof i.hash!=`string`?!1:i.hash===await U(t)}catch{return!1}}async function Te(e,t){let n={v:B,hash:await U(t)},r=await(await e.getFileHandle(L,{create:!0})).createWritable();await r.write(JSON.stringify(n)),await r.close()}async function Ee(e){try{await e.removeEntry(L)}catch(e){if(e?.name===`NotFoundError`)return;throw e}}async function De(e,t,n){let r=e,i=``,a=0;for(let e=n.length;e>0;--e){let o=n.slice(0,e).join(`/`),s=t.get(o);if(s){r=s,i=o,a=e;break}}for(let e=a;e<n.length;e+=1){let a=n[e];try{r=await r.getDirectoryHandle(a)}catch{return null}i=i?`${i}/${a}`:a,t.set(i,r)}return r}async function Oe(e,t,n,r,i,a){let o=async()=>{try{let n=await e.getDirectoryHandle(t);return i.set(a?`${a}/${t}`:t,n),{kind:`directory`}}catch{return null}},s=async()=>{try{let n=await e.getFileHandle(t);return r?{kind:`file`,size:await V(n)}:{kind:`file`,size:0}}catch{return null}};return n===`directory`?await o()??await s()??{kind:`missing`}:await s()??await o()??{kind:`missing`}}function G(e,t){let n=t?.includeSize!==!1,r=new Map;return async(t,i)=>{let a=t.split(`/`).filter(Boolean),o=await De(e,r,a.slice(0,-1));if(!o)return{kind:`missing`};let s=a[a.length-1];if(s===void 0)return{kind:`directory`};let c=a.slice(0,-1).join(`/`);return Oe(o,s,i,n,r,c)}}async function ke(e){let t=new Map;for await(let[n,r]of e.entries())t.set(n,r);return t}function Ae(e){return e.kind===`directory`?`directory`:e.kind===`file`?`file`:`other`}function je(e){if(typeof e.entries!=`function`)return G(e);let t=new Map,n=(e,n)=>{let r=t.get(n);if(r)return r;let i=ke(e).catch(e=>{throw t.delete(n),e});return t.set(n,i),i};return async t=>{let r=t.split(`/`).filter(Boolean),i=e,a=``;for(let e=0;e<r.length;e+=1){let t=r[e],o=(await n(i,a)).get(t);if(!o)return{kind:`missing`};let s=Ae(o);if(e!==r.length-1){if(s!==`directory`)return{kind:`missing`};i=o,a=`${a}/${t}`;continue}return s===`directory`?{kind:`directory`}:s===`file`?{kind:`file`,size:await V(o)}:{kind:`missing`}}return{kind:`directory`}}}var Me=61440,K=16384,q=32768,Ne=40960;async function Pe(e,t,n,r=16){let i=J(),a=e.entries??{},o=[];for(let[e,t]of Object.entries(a)){let r=Fe(e,t,a,i);r?o.push(r):n?.()}return Ie(o,await xe(r,o,async e=>{n?.();let r=e.fmt===K?`directory`:`file`;return t(e.path,r)}),a,i),Le(a,i),i}function J(){return{kindFixed:[],sizesFixed:0,dropped:0,selfEntryDropped:!1,inosReassigned:0,nlinksFixed:0,changed:!1}}function Fe(e,t,n,r){if(e===`/`||typeof t!=`object`||!t)return null;if(e===`/.metadata.json`||e===R)return delete n[e],e===`/.metadata.json`&&(r.selfEntryDropped=!0),r.changed=!0,null;let i=t,a=(i.mode??0)&Me;return a===Ne?(Y(i,r),null):{path:e,entry:i,fmt:a}}function Ie(e,t,n,r){for(let i=0;i<e.length;i+=1){let a=e[i],o=t[i];if(o.kind===`missing`){delete n[a.path],r.dropped+=1,r.changed=!0;continue}Y(a.entry,r),Re(a.path,a.entry,a.fmt,o,r)}}function Le(e,t){let n=0;for(let t of Object.values(e)){let e=t;typeof e?.ino==`number`&&(n=Math.max(n,e.ino)),typeof e?.data==`number`&&(n=Math.max(n,e.data))}let r=n+1,i=new Set;for(let[n,a]of Object.entries(e)){if(typeof a!=`object`||!a)continue;let e=a;if(n===`/`){typeof e.ino==`number`&&i.add(e.ino);continue}let o=e.ino;if(typeof o==`number`&&o!==0&&!i.has(o)){i.add(o);continue}e.ino=r,e.data=r+1,i.add(r),r+=2,t.inosReassigned+=1,t.changed=!0}}function Y(e,t){e.nlink||(e.nlink=1,t.nlinksFixed+=1,t.changed=!0)}function Re(e,t,n,r,i){if(n===q&&r.kind===`directory`){t.mode=((t.mode??0)&511||493)|K,i.kindFixed.push(`${e} file→dir`),i.changed=!0;return}if(n===K&&r.kind===`file`){t.mode=((t.mode??0)&511||420)|q,t.size=r.size,i.kindFixed.push(`${e} dir→file`),i.changed=!0;return}n===q&&r.kind===`file`&&typeof t.size==`number`&&t.size!==r.size&&(t.size=r.size,i.sizesFixed+=1,i.changed=!0)}async function ze(e,t,n){try{return await e()}catch(r){let i=null;try{i=await t()}catch{}if(!i?.changed)throw r;return n(i),await e()}}async function Be(e,t){let n=await Ce(e);if(!n)return null;if(await W(e,n.text))return J();let r=await Pe(n.doc,je(e),t),i=r.changed?JSON.stringify(n.doc):n.text;r.changed&&await we(e,i);try{await Te(e,i)}catch{}return r}function X(e,t,n=0){if(!(!Number.isSafeInteger(t)||(t??0)<=0||!Number.isSafeInteger(n)||n<0))return JSON.stringify([e,n,t])}async function Ve(e,t,n,r){try{return await e.lstat(t)}catch(e){let t=k(e,r);if(t.code===`ENOENT`&&n)return null;throw t}}async function He(e,t,n){let r;try{r=await e.readlink(t)}catch(e){throw k(e,n)}return r.startsWith(`/`)?s(r):s(l(a(t).dir,r))}async function Ue(e,t,n,r,a,o){let s=t===`/`?`/${n}`:`${t}/${n}`;for(;;){let t=await Ve(e,s,r,a);if(t===null||!t.isSymbolicLink())return{resolved:s,hops:o};if(++o>10)throw new i(`ELOOP`,`too many symbolic links encountered`,a);s=await He(e,s,a)}}async function Z(e,t,n){let r=s(n);if(t(r))return r;let i=r.split(`/`).filter(Boolean),a=`/`,o=0;for(let t=0;t<i.length;t++){let n=await Ue(e,a,i[t],t===i.length-1,r,o);a=n.resolved,o=n.hops}return a}async function We(e,t,n){return t(n)?n:Z(e,t,n)}function Q(){try{if(typeof globalThis.navigator?.storage?.getDirectory==`function`)return`opfs`}catch{}return`memory`}function Ge(e,t){let n=e.kind===`directory`?`directory`:`file`;return t?{name:e.name,type:n,...e.size===void 0?{}:{size:e.size},...e.lastModified===void 0?{}:{mtime:e.lastModified},...e.ctime===void 0?{}:{ctime:e.ctime},...e.ino===void 0?{}:{ino:e.ino},...e.identity===void 0?{}:{identity:e.identity},...e.dev===void 0?{}:{dev:e.dev},...e.uid===void 0?{}:{uid:e.uid},...e.gid===void 0?{}:{gid:e.gid},...e.mode===void 0?{}:{mode:e.mode}}:{name:e.name,type:n}}function Ke(e,t){switch(e.kind){case`local`:case`proc`:return{kind:`local`,mountId:e.mountId,idbHandleKey:t};case`hostfs`:return{kind:`hostfs`,mountId:e.mountId,hostPath:e.getHostPath()};default:return{kind:e.kind===`s3`?`s3`:e.kind===`aem`?`aem`:`da`,mountId:e.mountId,source:e.source,profile:e.profile??`default`}}}var $=class e{lfs;lfsSync;rawLfs=null;rawLfsSync=null;_ready;_readyResolved=!1;backend;mountPoints=new Map;opfsBackendFs=null;opfsHandle=null;mountRoot=``;internalMounts=new Set;watcher=null;dbName;mountSyncChannel=null;mountIndex=new x;static writeChains=new Map;onRepairProgress;constructor(t,n,r,i,a,o){if(this.dbName=t,this.onRepairProgress=a,this.backend=r===`opfs`?`opfs`:`memory`,this.lfs=this.makeDeferredLfs(),this.lfsSync=this.makeDeferredLfsSync(),this._ready=this.backend===`opfs`?e.initOpfsBackend(this,i,n===!0,o):e.initMemoryBackend(this,t,n===!0),this._ready.then(()=>{this._readyResolved=!0},()=>{}),typeof BroadcastChannel<`u`)try{this.mountSyncChannel=new BroadcastChannel(`vfs-mount-sync:${t}`),this.mountSyncChannel.onmessage=e=>{let{type:t,path:n,descriptor:r}=e.data??{};if(t===`mount`&&typeof n==`string`&&r)this.reconstructBackendFromDescriptor(r,n).then(e=>{this.mountPoints.set(n,e),e.kind===`local`&&this.mountIndex.registerMount(n,e.getHandle()),this.watcher?.notify([{type:`modify`,path:n,entryType:`directory`}])}).catch(()=>{});else if(t===`unmount`&&typeof n==`string`){let e=this.mountPoints.get(n);this.mountPoints.delete(n),this.mountIndex.unregisterMount(n),e?.close(),this.watcher?.notify([{type:`modify`,path:n,entryType:`directory`}])}}}catch{}}static opfsInitChains=new Map;static async initOpfsBackend(t,n,r,i){let a=(e.opfsInitChains.get(t.dbName)??Promise.resolve()).catch(()=>{}).then(()=>e.resolveOpfsBackend(t,n,r,i));e.opfsInitChains.set(t.dbName,a);try{await a}finally{e.opfsInitChains.get(t.dbName)===a&&e.opfsInitChains.delete(t.dbName)}}static async resolveOpfsBackend(n,r,a,o){let s=e.opfsBackends.get(n.dbName);if(s&&a)throw new i(`EBUSY`,`Cannot wipe an OPFS backend with live holders`,n.dbName);if(s&&o!==void 0&&s.asyncCache!==o)throw new i(`EBUSY`,`OPFS async cache setting conflicts with the live backend`,n.dbName);let c=r??await e.acquireOpfsHandle(n.dbName,a);await n.withWriteLock(()=>e.seedOpfsMetadataSidecarIfMissing(c));let l=await t(()=>import(`./dist-b828m-Si.js`),__vite__mapDeps([0,1,2]));await e.ensureRootMount(l);let u=`/__opfs__/${n.dbName}`,d=e.opfsBackends.get(n.dbName);if(!d){let{resolveOpfsMount:r}=await t(async()=>{let{resolveOpfsMount:e}=await import(`./opfs-mount-tiZR34GY.js`);return{resolveOpfsMount:e}},__vite__mapDeps([3,0,1,2])),i=await r({handle:c,dbName:n.dbName,asyncCache:o,onRepairProgress:n.onRepairProgress,withWriteLock:e=>n.withWriteLock(e)});try{l.mount(u,i)}catch{}d={backendFs:i,refs:0,asyncCache:o!==!1,sidecarDirty:{paths:new Set,prefixes:new Set}},e.opfsBackends.set(n.dbName,d)}d.refs+=1,n.opfsBackendFs=d.backendFs.index?d.backendFs:null,n.opfsHandle=c,n.mountRoot=u,n.rawLfs=l.promises,n.rawLfsSync=l}static async initMemoryBackend(n,r,i){let a=await t(()=>import(`./dist-b828m-Si.js`),__vite__mapDeps([0,1,2]));await e.ensureRootMount(a);let o=`/__zenfs__/${r}`,s=e.memoryBackends.get(r);if(s&&i){try{a.umount(o)}catch{}e.memoryBackends.delete(r),s=void 0}s||(s={store:a.InMemory.create({label:r}),refs:0},e.memoryBackends.set(r,s)),s.refs+=1;try{a.mount(o,s.store)}catch{}n.mountRoot=o,n.rawLfs=a.promises,n.rawLfsSync=a,n.opfsBackendFs=null,n.opfsHandle=null}static rootMountReady=null;static memoryBackends=new Map;static opfsBackends=new Map;static async ensureRootMount(t){return e.rootMountReady===null&&(e.rootMountReady=(async()=>{await t.configureSingle({backend:t.InMemory,label:`__vfs_root__`})})()),e.rootMountReady}prefix(e){return this.mountRoot?e===`/`?this.mountRoot:this.mountRoot+e:e}unprefix(e){return!this.mountRoot||!e.startsWith(this.mountRoot)?e:e.slice(this.mountRoot.length)||`/`}makeDeferredLfs(){let e=e=>this.prefix(e),t=e=>this.unprefix(e),n=()=>{if(!this.rawLfs)throw Error(`VirtualFS used before init resolved`);return this.rawLfs};return{readFile:(t,r)=>this._readyResolved?n().readFile(e(t),r):this._ready.then(()=>n().readFile(e(t),r)),writeFile:(t,r,i)=>this._readyResolved?n().writeFile(e(t),r,i):this._ready.then(()=>n().writeFile(e(t),r,i)),appendFile:async(t,r)=>{this._readyResolved||await this._ready,await n().appendFile(e(t),r)},chmod:async(t,r)=>{this._readyResolved||await this._ready,await n().chmod(e(t),r)},utimes:async(t,r,i)=>{this._readyResolved||await this._ready,await n().utimes(e(t),r,i)},readdir:t=>this._readyResolved?n().readdir(e(t)):this._ready.then(()=>n().readdir(e(t))),mkdir:(t,r)=>this._readyResolved?n().mkdir(e(t),r):this._ready.then(()=>n().mkdir(e(t),r)),rmdir:t=>this._readyResolved?n().rmdir(e(t)):this._ready.then(()=>n().rmdir(e(t))),unlink:t=>this._readyResolved?n().unlink(e(t)):this._ready.then(()=>n().unlink(e(t))),rename:(t,r)=>this._readyResolved?n().rename(e(t),e(r)):this._ready.then(()=>n().rename(e(t),e(r))),stat:t=>this._readyResolved?n().stat(e(t)):this._ready.then(()=>n().stat(e(t))),lstat:t=>this._readyResolved?n().lstat(e(t)):this._ready.then(()=>n().lstat(e(t))),symlink:(t,r)=>{let i=t.startsWith(`/`)?e(t):t;return this._readyResolved?n().symlink(i,e(r)):this._ready.then(()=>n().symlink(i,e(r)))},readlink:async r=>(this._readyResolved||await this._ready,t(await n().readlink(e(r)))),truncate:async(t,r)=>{this._readyResolved||await this._ready;let i=n();typeof i.truncate==`function`&&await i.truncate(e(t),r)},realpath:async r=>{this._readyResolved||await this._ready;let i=n();return typeof i.realpath==`function`?t(await i.realpath(e(r))):e(r)}}}makeDeferredLfsSync(){let e=e=>this.prefix(e),t=e=>this.unprefix(e);return{readdirSync:t=>{let n=this.rawLfsSync;return n?.readdirSync?n.readdirSync(e(t)):void 0},statSync:t=>{let n=this.rawLfsSync;return n?.statSync?n.statSync(e(t)):void 0},lstatSync:t=>{let n=this.rawLfsSync;return n?.lstatSync?n.lstatSync(e(t)):void 0},readlinkSync:n=>{let r=this.rawLfsSync;return r?.readlinkSync?t(r.readlinkSync(e(n))):void 0}}}static async seedOpfsMetadataSidecarIfMissing(t){let n=`.metadata.json`;try{let r=await t.getFileHandle(n);if(e.isUsableMetadataDocument(await e.readSidecarText(r)))return;console.warn(`[virtual-fs] metadata sidecar is unparseable (torn write?); reseeding an empty index`)}catch(e){if(e?.name!==`NotFoundError`)throw e}let r=await(await t.getFileHandle(n,{create:!0})).createWritable(),i=JSON.stringify({version:1,maxSize:4294967295,entries:{}});await r.write(i),await r.close()}static async readSidecarText(e){let t;for(let n=0;n<3;n++)try{return await(await e.getFile()).text()}catch(e){if(e?.name!==`NotReadableError`)throw e;t=e}throw t}static isUsableMetadataDocument(e){let t;try{t=JSON.parse(e)}catch{return!1}if(!t||typeof t!=`object`)return!1;let n=t.entries;return!!n&&typeof n==`object`}static async acquireOpfsHandle(e,t){let n=navigator.storage;if(!n?.getDirectory)throw new i(`EINVAL`,`OPFS is not available in this environment`);let r=await n.getDirectory();if(t)try{await r.removeEntry(e,{recursive:!0})}catch{}return r.getDirectoryHandle(e,{create:!0})}static _createSyncForTests(t){return new e(t)}static async create(t){let n=t?.dbName??`browser-fs`,r=t?.wipe===!0,i=t?.backend??Q(),a=new e(n,r,i,void 0,t?.onRepairProgress,t?.opfsAsyncCache);try{await a._ready}catch(e){throw a.mountSyncChannel?.close(),e}return r&&await p().catch(()=>{}),a}async flush(){await this.writeOpfsMetadataSidecar()}async writeOpfsMetadataSidecar(){this.backend===`opfs`&&await this.withWriteLock(()=>this.writeOpfsMetadataSidecarUnlocked())}async writeOpfsMetadataSidecarUnlocked(){if(this.backend!==`opfs`)return;let t=this.opfsBackendFs,n=this.opfsHandle;if(!t||!n)return;let r=t.index.toJSON(),i=e.opfsBackends.get(this.dbName)?.sidecarDirty,a=r;if(i){let e=null;try{let t=await n.getFileHandle(`.metadata.json`),r=JSON.parse(await(await t.getFile()).text());r&&typeof r==`object`&&r.entries&&(e=r)}catch{}e&&(await this.auditDirtyKindFlips(r,e,i,n),a=be(e,r,i))}let o=JSON.stringify(z(a)),s=await(await n.getFileHandle(`.metadata.json`,{create:!0})).createWritable();await s.write(o),await s.close(),i&&(i.paths.clear(),i.prefixes.clear())}async auditDirtyKindFlips(e,t,n,r){let i=ve(e,t,n.paths,n.prefixes);if(i.length===0)return;let a=G(r),o=this.opfsBackendFs;for(let n of i){let r=await a(n.path).catch(()=>null);if(r!==null&&r.kind!==`missing`&&r.kind===`directory`===n.ownIsDirectory)continue;let i=t.entries?.[n.path];e.entries&&i!==void 0&&(e.entries[n.path]=i);let s=r!==null&&r.kind!==`missing`;s&&(o?.index?.delete(n.path),o?._handles?.delete(n.path)),console.warn(`[virtual-fs] refused to flush in-memory kind flip over sidecar record (#2006)`,{path:n.path,reality:r?.kind??`unverifiable`,evicted:s})}}markSidecarDirty(t,n=`path`){if(this.backend!==`opfs`)return;let r=e.opfsBackends.get(this.dbName)?.sidecarDirty;if(!r)return;let i=s(t);(n===`prefix`?r.prefixes:r.paths).add(i);let{dir:o}=a(i);for(;o!==`/`;)r.paths.add(o),o=a(o).dir}async forgetSidecarConsistency(){await this.dropSidecarConsistency()}sidecarConsistencyDrop=null;dropSidecarConsistency(){if(this.backend!==`opfs`||!this.opfsHandle)return Promise.resolve();if(!this.sidecarConsistencyDrop){let e=this.opfsHandle;this.sidecarConsistencyDrop=Ee(e).catch(e=>{throw this.sidecarConsistencyDrop=null,e})}return this.sidecarConsistencyDrop}invalidatePaths(e){if(this.backend!==`opfs`||!this.opfsBackendFs)return;e.length>0&&this.dropSidecarConsistency().catch(()=>void 0);let t=this.opfsBackendFs;for(let n of e){let e=s(n);t.index.delete(e),t._handles?.delete(e),this.markSidecarDirty(e)}}async withKindMismatchRetry(e,t){return this.withKindMismatchRetryPaths([e],t)}async withKindMismatchRetryPaths(e,t){try{return await t()}catch(n){let r=n?.code;if(r!==`EISDIR`&&r!==`ENOTDIR`&&r!==`EINVAL`)throw n;for(let n of e)if(await this.reconcileKindMismatch(n).catch(()=>!1))return await t();throw n}}async reconcileKindMismatch(e){if(this.backend!==`opfs`)return!1;let t=this.opfsBackendFs,n=this.opfsHandle;if(!t?.index||!n)return!1;let r=s(e),i=r;try{i=await this.resolveSymlinks(r)}catch{}let a=await G(n)(i),o=A(t.index.get(i)?.mode),c=t._handles?.get(i),l=c?.kind===`directory`?`directory`:c?.kind===`file`?`file`:`absent`,u=j(a,o),d=j(a,l);if(!u&&!d)return!1;if(t.index.delete(i),t._handles?.delete(i),o===`directory`||l===`directory`){let e=`${i}/`;for(let n of[...t.index.keys()])n.startsWith(e)&&t.index.delete(n);if(t._handles)for(let n of[...t._handles.keys()])n.startsWith(e)&&t._handles.delete(n)}return this.markSidecarDirty(i),console.warn(`[virtual-fs] reconciled in-memory kind mismatch (#2006)`,{path:i,reality:a.kind,indexHeld:o,handleHeld:l}),!0}localIdentity(e){return X(`zenfs:${this.backend}:${this.dbName}`,e)}canWrite(e){return!0}setWatcher(e){this.watcher=e}getWatcher(){return this.watcher}async watch(e,t){let n=this.watcher;if(!n)throw new i(`ENOSYS`,`no FsWatcher attached to this VirtualFS`);let r=e.map(e=>n.watch(e,()=>!0,t));return()=>{for(let e of r)e()}}async dispose(){if(this.mountSyncChannel?.close(),this.mountSyncChannel=null,this.watcher?.dispose(),this.watcher=null,this.mountIndex.dispose(),await this.writeOpfsMetadataSidecar(),this.mountRoot){let n=this.backend===`opfs`?e.opfsBackends:e.memoryBackends,r=n.get(this.dbName);if(r&&(--r.refs,r.refs<=0)){n.delete(this.dbName);try{(await t(()=>import(`./dist-b828m-Si.js`),__vite__mapDeps([0,1,2]))).umount(this.mountRoot)}catch{}}}}readDirSync(e){let t=s(e);if(this.findMount(t))return null;let n=this.lfsSync;if(typeof n.readdirSync!=`function`||typeof n.lstatSync!=`function`)return null;try{let e=n.readdirSync(t),r=[];for(let i of e){let e=t===`/`?`/${i}`:`${t}/${i}`;try{let t=n.lstatSync(e),a=t.isSymbolicLink()?`symlink`:t.isDirectory()?`directory`:`file`;r.push(a===`symlink`?{name:i,type:a}:{name:i,type:a,size:t.size,mtime:t.mtimeMs,ctime:t.ctimeMs,...t.ino===void 0?{}:{ino:t.ino,identity:this.localIdentity(t.ino),dev:t.dev},...t.uid===void 0?{}:{uid:t.uid},...t.gid===void 0?{}:{gid:t.gid},mode:t.mode})}catch{}}return r}catch{return null}}statSync(e){let t=s(e);if(this.findMount(t))return null;let n=this.lfsSync;if(typeof n.statSync!=`function`||typeof n.lstatSync!=`function`||typeof n.readlinkSync!=`function`)return null;if(t===`/`)try{let e=n.statSync(t);return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,ino:e.ino,identity:this.localIdentity(e.ino),dev:e.dev,mode:e.mode}}catch{return null}let r=t;for(let e=0;e<=10;e++){let e;try{e=n.lstatSync(r)}catch{return null}if(!e.isSymbolicLink())return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,ino:e.ino,identity:this.localIdentity(e.ino),dev:e.dev,mode:e.mode};let t;try{t=n.readlinkSync(r)}catch{return null}r=t.startsWith(`/`)?s(t):s(l(a(r).dir,t))}return null}lstatSync(e){let t=s(e);if(this.findMount(t))return null;let n=this.lfsSync;if(typeof n.lstatSync!=`function`)return null;if(t===`/`)return this.statSync(t);try{let e=n.lstatSync(t);if(e.isSymbolicLink()){let r=n.readlinkSync?n.readlinkSync(t):``;return{type:`symlink`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,isSymlink:!0,symlinkTarget:r,ino:e.ino,identity:this.localIdentity(e.ino),dev:e.dev,mode:e.mode}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,ino:e.ino,identity:this.localIdentity(e.ino),dev:e.dev,mode:e.mode}}catch{return null}}async mount(e,t,n){let r=s(e);if(this.mountPoints.has(r))throw new i(`EEXIST`,`mount point is already mounted`,r);try{if((await this.lstat(r)).type!==`directory`)throw new i(`ENOTDIR`,`mount point must be a directory`,r);if((await this.readDir(r)).length>0)throw new i(`ENOTEMPTY`,`mount point must be empty to avoid shadowing existing files`,r)}catch(e){if(!(e instanceof i)||e.code!==`ENOENT`)throw e}let{dir:o}=a(r);o!==`/`&&await this.mkdir(o,{recursive:!0}),await this.dropSidecarConsistency();try{await this.lfs.mkdir(r)}catch{}if(this.mountPoints.set(r,t),t.kind===`local`){let e=n?.limits??b(n?.env??{});this.mountIndex.registerMount(r,t.getHandle(),e)}let c=Ke(t,r);try{this.mountSyncChannel?.postMessage({type:`mount`,path:r,descriptor:c})}catch{}if(this.watcher?.notify([{type:`modify`,path:r,entryType:`directory`}]),t.kind!==`hostfs`)try{let e={targetPath:r,descriptor:c,createdAt:Date.now()},n=t.kind===`local`?t.getHandle():void 0;await ne(e,n)}catch{}}async unmount(e){let t=s(e),n=this.mountPoints.get(t);this.mountPoints.delete(t),this.mountIndex.unregisterMount(t);try{this.mountSyncChannel?.postMessage({type:`unmount`,path:t})}catch{}this.watcher?.notify([{type:`modify`,path:t,entryType:`directory`}]),await n?.close();try{await re(t)}catch{}}async reconstructBackendFromDescriptor(e,n){switch(e.kind){case`local`:{let t=await ie(e.idbHandleKey);if(!t)throw Error(`no handle stored for ${e.idbHandleKey}`);return P.fromHandle(t,{mountId:e.mountId})}case`hostfs`:{let{HostFsMountBackend:r}=await t(async()=>{let{HostFsMountBackend:e}=await import(`./backend-hostfs-DV8kfBUj.js`);return{HostFsMountBackend:e}},__vite__mapDeps([4,5,6,7,8]));return new r({targetPath:n,hostPath:e.hostPath,mountId:e.mountId})}case`s3`:{let{S3MountBackend:n,RemoteMountCache:r,makeSignedFetchS3:i}=await t(async()=>{let{S3MountBackend:e,RemoteMountCache:t,makeSignedFetchS3:n}=await import(`./mount-9N6h5nwh.js`);return{S3MountBackend:e,RemoteMountCache:t,makeSignedFetchS3:n}},__vite__mapDeps([9,10,11,12,7,13,1,8])),a=new r({mountId:e.mountId,ttlMs:3e4});return new n({source:e.source,profile:e.profile,cache:a,mountId:e.mountId,signedFetch:i(e.profile)})}case`da`:{let{DaMountBackend:n,RemoteMountCache:r,makeSignedFetchDa:i}=await t(async()=>{let{DaMountBackend:e,RemoteMountCache:t,makeSignedFetchDa:n}=await import(`./mount-9N6h5nwh.js`);return{DaMountBackend:e,RemoteMountCache:t,makeSignedFetchDa:n}},__vite__mapDeps([9,10,11,12,7,13,1,8])),a=new r({mountId:e.mountId,ttlMs:3e4});return new n({source:e.source,profile:e.profile,cache:a,mountId:e.mountId,signedFetch:i()})}case`aem`:{let{AemMountBackend:n,RemoteMountCache:r,makeSignedFetchDa:i}=await t(async()=>{let{AemMountBackend:e,RemoteMountCache:t,makeSignedFetchDa:n}=await import(`./mount-9N6h5nwh.js`);return{AemMountBackend:e,RemoteMountCache:t,makeSignedFetchDa:n}},__vite__mapDeps([9,10,11,12,7,13,1,8])),a=new r({mountId:e.mountId,ttlMs:3e4});return new n({source:e.source,profile:e.profile,cache:a,mountId:e.mountId,signedFetch:i()})}}}listMounts(){let e=[];for(let t of this.mountPoints.keys())this.internalMounts.has(t)||e.push(t);return e}listInternalMounts(){return[...this.internalMounts]}listMountPoints(){let e=[];for(let[t,n]of this.mountPoints)this.internalMounts.has(t)||e.push({path:t,kind:n.kind});return e}getMountBackend(e){let t=s(e);return this.mountPoints.get(t)??null}async mountInternal(e,t){let n=s(e);if(this.mountPoints.has(n))throw new i(`EEXIST`,`mount point is already mounted`,n);let{dir:r}=a(n);r!==`/`&&await this.mkdir(r,{recursive:!0}),await this.dropSidecarConsistency();try{await this.lfs.mkdir(n)}catch{}this.mountPoints.set(n,t),this.internalMounts.add(n),this.watcher?.notify([{type:`modify`,path:n,entryType:`directory`}])}async unmountInternal(e){let t=s(e);if(!this.internalMounts.has(t))throw new i(`ENOENT`,`not an internal mount point`,t);let n=this.mountPoints.get(t);this.mountPoints.delete(t),this.internalMounts.delete(t),this.watcher?.notify([{type:`modify`,path:t,entryType:`directory`}]),await n?.close()}getMountIndex(){return this.mountIndex}async refreshMount(e,t){let n=s(e),r=this.mountPoints.get(n);if(!r)throw new i(`ENOENT`,`not a mount point`,n);let a=await r.refresh(t);return r.kind===`local`&&await this.mountIndex.refreshMount(n,b(t?.env??{})),this.watcher?.notify([{type:`modify`,path:n,entryType:`directory`}]),a}isPathUnderMount(e){for(let t of this.mountPoints.keys())if(e===t||e.startsWith(t+`/`))return!0;return!1}findMount(e){let t=null;for(let[n,r]of this.mountPoints)(e===n||e.startsWith(n+`/`))&&(!t||n.length>t.mountPath.length)&&(t={mountPath:n,backend:r});return t?e===t.mountPath?{path:t.mountPath,backend:t.backend,relParts:[]}:{path:t.mountPath,backend:t.backend,relParts:e.slice(t.mountPath.length+1).split(`/`).filter(Boolean)}:null}async readFile(e,t){return this.withKindMismatchRetry(e,()=>this.readFileInner(e,t))}async readFileInner(e,t){let n=s(e),r=this.findMount(n);if(r){if(r.relParts.length===0)throw new i(`EISDIR`,`is a directory`,n);let e=r.relParts.join(`/`);try{let n=await r.backend.readFile(e);return(t?.encoding??`utf-8`)===`utf-8`?new TextDecoder(`utf-8`).decode(n):n}catch(e){O(e,n)}}let a=await this.resolveSymlinks(n);try{return(t?.encoding??`utf-8`)===`utf-8`?await this.lfs.readFile(a,{encoding:`utf8`}):await this.lfs.readFile(a)}catch(e){throw k(e,n)}}async readFileRange(e,t,n){let r=s(e);if(!Number.isInteger(t)||!Number.isInteger(n)||t<0||n<t)throw new i(`EINVAL`,`invalid byte range ${t}-${n}`,r);if(t===n)return new Uint8Array;let a=this.findMount(r),o=a?.backend.readFileRange;if(a&&o){if(a.relParts.length===0)throw new i(`EISDIR`,`is a directory`,r);try{return await o.call(a.backend,a.relParts.join(`/`),t,n)}catch(e){O(e,r)}}let c=await this.sliceNativeFile(r,t,n);if(c)return c;let l=await this.readFile(r,{encoding:`binary`});return new Uint8Array(l.subarray(t,Math.min(n,l.byteLength)))}async sliceNativeFile(e,t,n){try{let r=await this.getNativeFile(e);if(!r)return null;let i=r.slice(t,Math.min(n,r.size));return new Uint8Array(await i.arrayBuffer())}catch{return null}}async getNativeFile(e){let t=s(e),n=this.findMount(t);if(n){let e=n.backend.getNativeFile;if(!e||n.relParts.length===0)return null;try{return await e.call(n.backend,n.relParts.join(`/`))}catch{return null}}let r=this.opfsHandle;if(!r)return null;try{return await F(r,await this.resolveSymlinks(t))}catch{return null}}async writeFile(e,t,n){return this.withKindMismatchRetry(e,()=>this.writeFileInner(e,t,n))}async writeFileInner(e,t,n){let r=s(e),o=this.findMount(r);if(o){if(o.relParts.length===0)throw new i(`EISDIR`,`is a directory`,r);let e=o.relParts.join(`/`),n=!1;try{await this.stat(r),n=!0}catch{}let a=typeof t==`string`?new TextEncoder().encode(t):t instanceof Uint8Array?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t);try{await o.backend.writeFile(e,a)}catch(e){O(e,r)}this.watcher?.notify([{type:n?`modify`:`create`,path:r,entryType:`file`}]),this.mountIndex.notifyWrite(r);return}let c;try{c=await this.resolveSymlinks(r)}catch{c=r}let l=!1;try{await this.lfs.stat(c),l=!0}catch{}let{dir:u}=a(c);await this.withWriteLock(async()=>{await this.dropSidecarConsistency(),this.markSidecarDirty(c),u!==`/`&&await this.mkdirRecursiveUnlocked(u);let e=typeof t==`string`?new TextEncoder().encode(t).byteLength:(t instanceof Uint8Array,t.byteLength);try{await this.lfs.writeFile(c,t)}catch(e){if(u!==`/`&&e instanceof Error&&e.message.includes(`ENOENT`)){await this.mkdirRecursiveUnlocked(u);try{await this.lfs.writeFile(c,t)}catch(e){throw k(e,r)}}else throw k(e,r)}try{await this.lfs.truncate?.(c,e)}catch(e){throw k(e,r)}}),this.watcher?.notify([{type:l?`modify`:`create`,path:c,entryType:`file`}])}async appendFile(e,t){let n=s(e);await this.withKindMismatchRetry(n,()=>this.withWriteLock(async()=>{if(this.findMount(n)){await this.appendMounted(n,t);return}await this.dropSidecarConsistency();let e=n,r=!1;try{if(e=await this.resolveSymlinks(n),(await this.lfs.stat(e)).isDirectory())throw new i(`EISDIR`,`is a directory`,n);r=!0}catch(e){let t=k(e,n);if(t.code!==`ENOENT`)throw t}this.markSidecarDirty(e);let{dir:o}=a(e);await this.mkdirRecursiveUnlocked(o);try{await this.lfs.appendFile(e,t)}catch(e){throw k(e,n)}this.watcher?.notify([{type:r?`modify`:`create`,path:e,entryType:`file`}])}))}async appendMounted(e,t){let n=new Uint8Array;try{let t=await this.readFileInner(e,{encoding:`binary`});n=typeof t==`string`?new TextEncoder().encode(t):new Uint8Array(t)}catch(t){let n=k(t,e);if(n.code!==`ENOENT`)throw n}let r=typeof t==`string`?new TextEncoder().encode(t):t,i=new Uint8Array(n.length+r.length);i.set(n),i.set(r,n.length),await this.writeFileInner(e,i)}async chmod(e,t){if(!Number.isInteger(t)||t<0||t>4095)throw new i(`EINVAL`,`invalid file mode`,s(e));await this.changeMetadata(e,e=>this.lfs.chmod(e,t))}async utimes(e,t,n){if(!Number.isFinite(t.getTime())||!Number.isFinite(n.getTime()))throw new i(`EINVAL`,`invalid file time`,s(e));await this.changeMetadata(e,e=>this.lfs.utimes(e,t,n))}async changeMetadata(e,t){let n=s(e);if(this.findMount(n))throw await this.stat(n),new i(`ENOSYS`,`metadata changes are not supported by this mount`,n);await this.withKindMismatchRetry(n,()=>this.withWriteLock(async()=>{await this.dropSidecarConsistency();let e=await this.resolveSymlinks(n);try{let n=await this.lfs.stat(e);this.markSidecarDirty(e),await t(e),await this.writeOpfsMetadataSidecarUnlocked(),this.watcher?.notify([{type:`modify`,path:e,entryType:n.isDirectory()?`directory`:`file`}])}catch(e){throw k(e,n)}}))}async readDir(e,t){let n=s(e),r=this.findMount(n);return r?this.readDirMounted(n,r,t):this.readDirLocal(n)}async readDirMounted(e,t,n){let r=n?.includeStats===!0?void 0:this.mountIndex.getDirectoryEntries(t.path,e);if(r!==void 0){let t=new Map;for(let e of r)t.set(e.name,{name:e.name,type:e.type});return this.addNestedMountEntries(t,e),[...t.values()]}let i=t.relParts.join(`/`)||`/`,a;try{a=await t.backend.readDir(i,n)}catch(t){O(t,e)}let o=new Map,s=t.backend.listingStatsMatchStat===!0;for(let e of a)o.set(e.name,Ge(e,s));return this.addNestedMountEntries(o,e),[...o.values()]}async readDirLocal(e){return this.withKindMismatchRetry(e,()=>this.readDirLocalInner(e))}async readDirLocalInner(e){let t=await this.resolveSymlinks(e);try{let e=await this.lfs.readdir(t),n=[];for(let r of e){let e=await this.statDirEntry(t,r);e&&n.push(e)}return n}catch(t){throw k(t,e)}}async statDirEntry(e,t){let n=e===`/`?`/${t}`:`${e}/${t}`;try{let e=await this.lfs.lstat(n);return e.isSymbolicLink()?{name:t,type:`symlink`}:{name:t,type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,...e.ino===void 0?{}:{ino:e.ino,identity:this.localIdentity(e.ino),dev:e.dev},...e.uid===void 0?{}:{uid:e.uid},...e.gid===void 0?{}:{gid:e.gid},mode:e.mode}}catch{return null}}addNestedMountEntries(e,t){let n=t===`/`?`/`:`${t}/`;for(let r of this.mountPoints.keys()){if(r===t||!r.startsWith(n))continue;let i=r.slice(n.length);!i||i.includes(`/`)||e.has(i)||e.set(i,{name:i,type:`directory`})}}async withWriteLock(t){let n=this.dbName,r,i=new Promise(e=>{r=e}),a=e.writeChains.get(n)??Promise.resolve();e.writeChains.set(n,i),await a;try{let e=globalThis.navigator?.locks;return this.backend!==`opfs`||typeof e?.request!=`function`?await t():await e.request(`slicc-vfs:${n}`,()=>t())}finally{r(),e.writeChains.get(n)===i&&e.writeChains.delete(n)}}async mkdirRecursiveUnlocked(e){let t=e.split(`/`).filter(Boolean),n=[],r=``;for(let e of t){r+=`/`+e;try{await this.lfs.mkdir(r),n.push(r)}catch(e){if(e instanceof Error&&!e.message.includes(`EEXIST`))throw k(e,r);try{let e=await this.lfs.lstat(r);if(!e.isDirectory()&&!e.isSymbolicLink())throw new i(`ENOTDIR`,`not a directory`,r)}catch(e){if(e instanceof i&&e.code===`ENOTDIR`)throw e}}}return n}async mkdir(e,t){let n=s(e);if(n===`/`)return;let r=this.findMount(n);if(r){if(r.relParts.length===0)return;let e=r.relParts.join(`/`),t=await this.exists(n);try{await r.backend.mkdir(e)}catch(e){O(e,n)}t||this.watcher?.notify([{type:`create`,path:n,entryType:`directory`}]);return}if(t?.recursive){let e=await this.withWriteLock(async()=>(await this.dropSidecarConsistency(),this.markSidecarDirty(n),this.mkdirRecursiveUnlocked(n)));e.length>0&&this.watcher?.notify(e.map(e=>({type:`create`,path:e,entryType:`directory`})))}else await this.withWriteLock(async()=>{await this.dropSidecarConsistency(),this.markSidecarDirty(n);try{await this.lfs.mkdir(n)}catch(e){throw k(e,n)}}),this.watcher?.notify([{type:`create`,path:n,entryType:`directory`}])}async rm(e,t){return this.withKindMismatchRetry(s(e),()=>this.rmInner(e,t))}async rmInner(e,t){let n=s(e),r=this.findMount(n);if(r){if(r.relParts.length===0)throw new i(`EINVAL`,`cannot remove a mount point — use unmount`,n);let e;try{e=(await this.stat(n)).type}catch{}let a=r.relParts.join(`/`);try{await r.backend.remove(a,{recursive:t?.recursive})}catch(e){O(e,n)}this.watcher?.notify([{type:`delete`,path:n,entryType:e}]),this.mountIndex.notifyDelete(n);return}try{let e=await this.lfs.lstat(n);await this.withWriteLock(async()=>{await this.dropSidecarConsistency(),e.isSymbolicLink()?await this.lfs.unlink(n):e.isDirectory()?t?.recursive?await this.rmRecursiveUnlocked(n):await this.lfs.rmdir(n):await this.lfs.unlink(n),this.markSidecarDirty(n,`prefix`),await this.writeOpfsMetadataSidecarUnlocked()})}catch(e){throw k(e,n)}this.watcher?.notify([{type:`delete`,path:n}])}async rmRecursiveUnlocked(e){let t=await this.lfs.readdir(e);for(let n of t){let t=e===`/`?`/${n}`:`${e}/${n}`,r=await this.lfs.lstat(t);r.isSymbolicLink()?await this.lfs.unlink(t):r.isDirectory()?await this.rmRecursiveUnlocked(t):await this.lfs.unlink(t)}await this.lfs.rmdir(e)}async stat(e){return this.withKindMismatchRetry(e,()=>this.statInner(e))}async statInner(e){let t=s(e),n=this.findMount(t);if(n){if(n.relParts.length===0)try{let e=await this.lfs.stat(t);return{type:`directory`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch{return{type:`directory`,size:0,mtime:Date.now(),ctime:Date.now()}}let e=n.relParts.join(`/`);try{let t=await n.backend.stat(e);return{type:t.kind===`directory`?`directory`:`file`,size:t.size,mtime:t.mtime,ctime:t.ctime??t.mtime,...t.ino===void 0?{}:{ino:t.ino},...t.identity===void 0?{}:{identity:t.identity},...t.dev===void 0?{}:{dev:t.dev},...t.uid===void 0?{}:{uid:t.uid},...t.gid===void 0?{}:{gid:t.gid},...t.mode===void 0?{}:{mode:t.mode}}}catch(e){O(e,t)}}let r=await this.resolveSymlinks(t);try{let e=await this.lfs.stat(r);return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,ino:e.ino,dev:e.dev,identity:this.localIdentity(e.ino),uid:e.uid,gid:e.gid,mode:e.mode}}catch(e){throw k(e,t)}}async exists(e){let t=s(e),n=this.findMount(t);if(n){if(n.relParts.length===0)return!0;try{return await this.stat(t),!0}catch{return!1}}try{return await this.stat(t),!0}catch{try{return await this.lfs.lstat(t),!0}catch{return!1}}}async rename(e,t){return this.withKindMismatchRetryPaths([s(e),s(t)],()=>this.renameInner(e,t))}async renameInner(e,t){let n=s(e),r=s(t);if(n===r)return;let i;try{i=await this.lstat(n)}catch{}let a=i?.type,o=this.findMount(n);if(o?.backend.rename){let e=this.findMount(r);if(e&&e.backend===o.backend){let t=!1;try{t=(await o.backend.rename(o.relParts.join(`/`),e.relParts.join(`/`)))?.noop===!0}catch(e){O(e,n)}t||(this.watcher?.notify([{type:`delete`,path:n,entryType:a},{type:`create`,path:r,entryType:a}]),this.mountIndex.notifyRename(n,r));return}}if(i)try{let e=await this.lstat(r);if(f(i,e))return}catch{}try{await this.withWriteLock(async()=>{await this.dropSidecarConsistency(),this.markSidecarDirty(n,`prefix`),this.markSidecarDirty(r,`prefix`),await this.lfs.rename(n,r),await this.writeOpfsMetadataSidecarUnlocked()})}catch(e){throw k(e,n)}this.watcher?.notify([{type:`delete`,path:n,entryType:a},{type:`create`,path:r,entryType:a}]),this.mountIndex.notifyRename(n,r)}async readTextFile(e){return await this.readFile(e,{encoding:`utf-8`})}async*walk(e,t,n=0){yield*u({mountPoints:this.mountPoints,mountIndex:this.mountIndex,realpath:e=>this.realpath(e),readDir:e=>this.readDir(e),stat:e=>this.stat(e)},e,t,n)}async copyFile(e,t){let n=await this.stat(e);if(n.type===`directory`)throw new i(`EISDIR`,`is a directory`,e);try{let e=await this.stat(t);if(f(n,e))return}catch{}let r=await this.readFile(e,{encoding:`binary`});await this.writeFile(t,r)}dirname(e){return a(s(e)).dir}basename(e){return a(s(e)).base}resolveSymlinkTargetPath(e,t){return e.startsWith(`/`)?s(e):s(l(a(t).dir,e))}assertSymlinkCreateAllowed(e,t){if(this.findMount(t))throw new i(`EINVAL`,`symlinks not supported on mounted filesystems`,t);let n=this.resolveSymlinkTargetPath(e,t);if(this.findMount(n))throw new i(`EXDEV`,`cannot create a symlink across a mount boundary to '${n}'`,t)}async symlink(e,t){let n=s(t);this.assertSymlinkCreateAllowed(e,n);let{dir:r}=a(n);await this.withWriteLock(async()=>{await this.dropSidecarConsistency(),r!==`/`&&await this.mkdirRecursiveUnlocked(r);try{await this.lfs.symlink(e,n)}catch(t){if(r!==`/`&&t instanceof Error&&t.message.includes(`ENOENT`)){await this.mkdirRecursiveUnlocked(r);try{await this.lfs.symlink(e,n)}catch(e){throw k(e,n)}}else throw k(t,n)}this.markSidecarDirty(n),await this.writeOpfsMetadataSidecarUnlocked()}),this.watcher?.notify([{type:`create`,path:n,entryType:`symlink`}])}async readlink(e){let t=s(e);try{return await this.lfs.readlink(t)}catch(e){throw k(e,t)}}async lstat(e){let t=s(e);if(this.findMount(t)||t===`/`)return this.stat(t);try{let e=await this.lfs.lstat(t);if(e.isSymbolicLink()){let n=await this.lfs.readlink(t);return{type:`symlink`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,isSymlink:!0,symlinkTarget:n,ino:e.ino,dev:e.dev,identity:this.localIdentity(e.ino),uid:e.uid,gid:e.gid,mode:e.mode}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,ino:e.ino,dev:e.dev,identity:this.localIdentity(e.ino),uid:e.uid,gid:e.gid,mode:e.mode}}catch(e){throw k(e,t)}}async realpath(e){return Z(this.lfs,e=>this.findMount(e)!==null,e)}resolveSymlinks(e){return We(this.lfs,e=>this.findMount(e)!==null,e)}},qe=e({FsError:()=>i,FsWatcher:()=>h,MountIndex:()=>x,RestrictedFS:()=>D,VirtualFS:()=>$,joinPath:()=>l,normalizePath:()=>s,pathSegments:()=>o,resolveVfsBackendFromEnv:()=>Q,sameFileIdentity:()=>f,splitPath:()=>a,statsFromDirEntry:()=>r});export{i as FsError,h as FsWatcher,x as MountIndex,D as RestrictedFS,$ as VirtualFS,P as a,ze as i,l as joinPath,X as n,s as normalizePath,o as pathSegments,Be as r,Q as resolveVfsBackendFromEnv,f as sameFileIdentity,a as splitPath,r as statsFromDirEntry,qe as t};