sliccy 6.157.2 → 6.157.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/ui/.vite/manifest.json +188 -187
- package/dist/ui/assets/{CLAUDE-D8aRy6Y3.js → CLAUDE-I9G_dHp6.js} +1 -1
- package/dist/ui/assets/{SKILL-B--riEXN.js → SKILL-COPOzXIi.js} +1 -1
- package/dist/ui/assets/{account-store-CSIzWxmB.js → account-store-CSEqTHkT.js} +1 -1
- package/dist/ui/assets/{account-store-BC3vyGu2.js → account-store-CqdJ90Jw.js} +1 -1
- package/dist/ui/assets/{adobe-BShHOhCr.js → adobe-9SGO99Fw.js} +1 -1
- package/dist/ui/assets/{adobe-drXcmB3D.js → adobe-BdtGwUvC.js} +1 -1
- package/dist/ui/assets/{agent-bridge-DV0Ede0v.js → agent-bridge-CcH0BVOV.js} +1 -1
- package/dist/ui/assets/{agent-panels-CbV2fqtR.js → agent-panels-OmWUx717.js} +1 -1
- package/dist/ui/assets/{apply-layout-DoLGuPG5.js → apply-layout-Syx9BFJp.js} +1 -1
- package/dist/ui/assets/{apps-BaZHe_M7.js → apps-B0yqKhrn.js} +1 -1
- package/dist/ui/assets/{auto-mount-table-Bj59hmjV.js → auto-mount-table-rytW5wPV.js} +1 -1
- package/dist/ui/assets/{azure-openai-CJhvr0v9.js → azure-openai-B4_efJl9.js} +1 -1
- package/dist/ui/assets/{azure-openai-BYkj_1AG.js → azure-openai-ltnwJkEf.js} +1 -1
- package/dist/ui/assets/backend-hostfs-CsCDQ3wI.js +1 -0
- package/dist/ui/assets/backend-hostfs-uVodZ7BH.js +1 -0
- package/dist/ui/assets/{browser-CyOAI9cj.js → browser-fOe3v0iv.js} +5 -4
- package/dist/ui/assets/{budget-usage-source-GfigCN_s.js → budget-usage-source-Bn77rVDQ.js} +1 -1
- package/dist/ui/assets/{cdp-Cv1mvXfR.js → cdp-DXbCwMoy.js} +1 -1
- package/dist/ui/assets/{cerebras-CiQJfJJX.js → cerebras-CI9K82XN.js} +1 -1
- package/dist/ui/assets/{cerebras-CuthuK8O.js → cerebras-h3fxsfG0.js} +1 -1
- package/dist/ui/assets/{composer-speech-DwILw4Uk.js → composer-speech-Bbm_ersE.js} +1 -1
- package/dist/ui/assets/{connect-surface-DTIBD6Ob.js → connect-surface-C_DxrsVE.js} +1 -1
- package/dist/ui/assets/{cost-command-XzcQb5EI.js → cost-command-DlIH8zCh.js} +1 -1
- package/dist/ui/assets/{directed-approval-BP6ATlEl.js → directed-approval-BAf9LCvw.js} +1 -1
- package/dist/ui/assets/{ensure-speech-assets-9dACm1ao.js → ensure-speech-assets-CM9UIjYP.js} +1 -1
- package/dist/ui/assets/{es-BLFevQz4.js → es-DwGGEZle.js} +1 -1
- package/dist/ui/assets/{extension-ops-DcLzcAwt.js → extension-ops-BsnpYY6f.js} +1 -1
- package/dist/ui/assets/{frozen-archive-writer-Df5805od.js → frozen-archive-writer-B1ANvJgT.js} +1 -1
- package/dist/ui/assets/fs-DOVNjYzW.js +1 -0
- package/dist/ui/assets/fs-DeoWfjqK.js +2 -0
- package/dist/ui/assets/{github-B3_eljiu.js → github-5_M49ks6.js} +2 -2
- package/dist/ui/assets/{github-auth-CupULCYI.js → github-auth-D0c9XbZW.js} +1 -1
- package/dist/ui/assets/{github-copilot-CobpFty3.js → github-copilot-CbHP_7f7.js} +1 -1
- package/dist/ui/assets/{github-copilot-BY8oTZco.js → github-copilot-cLgpjg5w.js} +1 -1
- package/dist/ui/assets/{github-install-BaIiZrtX.js → github-install-CjamDBEc.js} +1 -1
- package/dist/ui/assets/{github-Cp55AC26.js → github-uVNm2183.js} +1 -1
- package/dist/ui/assets/{github-zip-1MOen3FO.js → github-zip-GTCDf9Pl.js} +1 -1
- package/dist/ui/assets/{hear-DuapGolr.js → hear-CACqXgt7.js} +1 -1
- package/dist/ui/assets/{help-CZtVVXe0.js → help-Cb17SAQB.js} +1 -1
- package/dist/ui/assets/{installer-Bu4t0i5V.js → installer-CdpRb7j4.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-CqXsEURO.js → js-realm-worker-C0v3jW8W.js} +1 -1
- package/dist/ui/assets/{kernel-worker-8p_5PNiV.js → kernel-worker-BaPYUQFl.js} +396 -396
- package/dist/ui/assets/{live-session-snapshot-BP6rxBrE.js → live-session-snapshot-Dv20JKP2.js} +1 -1
- package/dist/ui/assets/{local-llm-C2DAhBTd.js → local-llm-ChF3sfFU.js} +1 -1
- package/dist/ui/assets/{local-llm-fDq0b6CI.js → local-llm-URbqXRLX.js} +1 -1
- package/dist/ui/assets/{main-D_jxpmRL.js → main-BUCKgxtj.js} +3 -3
- package/dist/ui/assets/{main-cherry-CBhHAcdr.js → main-cherry-cXhRyJ7g.js} +1 -1
- package/dist/ui/assets/{memory-curation-seam-Ce6Ezpr5.js → memory-curation-seam-CiWcyajY.js} +1 -1
- package/dist/ui/assets/{mount-BsWlp4Ng.js → mount-BCEqbn4e.js} +2 -2
- package/dist/ui/assets/{mount-eD6bH6K8.js → mount-BRhJGlzu.js} +3 -3
- package/dist/ui/assets/{mount-bridge-client-wfM0sGs5.js → mount-bridge-client-3a86Q6J0.js} +1 -1
- package/dist/ui/assets/{mount-bridge-client-DphjpUJQ.js → mount-bridge-client-CO2HxXrT.js} +1 -1
- package/dist/ui/assets/{mount-index-DLLlduW0.js → mount-index-CQfmUPuZ.js} +1 -1
- package/dist/ui/assets/{mount-recovery-B5MZkPeO.js → mount-recovery-WpiM9Tnw.js} +1 -1
- package/dist/ui/assets/{mv-DUh51uEl.js → mv-B4NndPT_.js} +1 -1
- package/dist/ui/assets/{new-session-bRM5-MPu.js → new-session-DCeZV5Qn.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-BJE__KK2.js → oauth-bootstrap-GUmmkRNC.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-DsXw6KR0.js → onboarding-orchestrator-EshoJnan.js} +1 -1
- package/dist/ui/assets/{openai-codex-BUoctFvK.js → openai-codex-Clwxcnim.js} +1 -1
- package/dist/ui/assets/{openai-codex-qthQGD_3.js → openai-codex-CpD3alJG.js} +1 -1
- package/dist/ui/assets/{openrouter-Cpmx4KLh.js → openrouter-B3EcxWYC.js} +1 -1
- package/dist/ui/assets/{openrouter-Cght8V8I.js → openrouter-BJJuTqTn.js} +1 -1
- package/dist/ui/assets/{openrouter-free-BTrY4vQK.js → openrouter-free-CMmhJff_.js} +1 -1
- package/dist/ui/assets/{openrouter-free-BimK34SP.js → openrouter-free-CT6NoM8K.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-CslVWaaw.js → openrouter-oauth-BWxs3Im8.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-loMdP_Ba.js → openrouter-oauth-DxhLM4nB.js} +1 -1
- package/dist/ui/assets/{opfs-mount-C4HqOQiQ.js → opfs-mount-CUyTRUoC.js} +2 -2
- package/dist/ui/assets/{panel-rpc-handlers-DK5Cp4r1.js → panel-rpc-handlers-B-cyOhMA.js} +2 -2
- package/dist/ui/assets/{panelize-shell-48amUtWb.js → panelize-shell-WVaBYulZ.js} +1 -1
- package/dist/ui/assets/{pi-edit-execution-qzUIBN9h.js → pi-edit-execution-xi7NpQBJ.js} +1 -1
- package/dist/ui/assets/{probe-info-CjsoArwT.js → probe-info-Cfr3jYru.js} +1 -1
- package/dist/ui/assets/{provider-Olg-xwpR.js → provider-CHCDCsU8.js} +2 -2
- package/dist/ui/assets/{provider-CdC_p8nT.js → provider-CedRx4y3.js} +1 -1
- package/dist/ui/assets/provider-settings-DdBW0Ptt.js +1 -0
- package/dist/ui/assets/provider-store-access-CYzJeT_d.js +1 -0
- package/dist/ui/assets/provider-store-access-DV3KkNjH.js +1 -0
- package/dist/ui/assets/{providers-CVVJIPNh.js → providers-CVkGTQVH.js} +2 -2
- package/dist/ui/assets/{providers-DZ_vxDsI.js → providers-DIQE7sHO.js} +1 -1
- package/dist/ui/assets/{quick-llm-D1KZssbX.js → quick-llm-IsSRlIE_.js} +1 -1
- package/dist/ui/assets/{recovery-screen-CflDQ34Q.js → recovery-screen-DKyeQ9eS.js} +1 -1
- package/dist/ui/assets/{remote-sprinkle-vfs-C_-TfGu3.js → remote-sprinkle-vfs-D-Wz5t8k.js} +1 -1
- package/dist/ui/assets/{remote-vfs-client-CEL8mUQ9.js → remote-vfs-client-Dhv8nI7h.js} +1 -1
- package/dist/ui/assets/{run-ChkY2Agc.js → run-B-t7kWH3.js} +1 -1
- package/dist/ui/assets/{run-C6flLZUb.js → run-B4mjoang.js} +2 -2
- package/dist/ui/assets/{run-BcQ-akMi.js → run-BI_A77E-.js} +1 -1
- package/dist/ui/assets/{run-CWenWZRy.js → run-CrPSdmNd.js} +2 -2
- package/dist/ui/assets/{run-CPPMIJVq.js → run-D_KcnB9d.js} +1 -1
- package/dist/ui/assets/{run-BAXE1Fgn.js → run-EhsZ6l-Q.js} +1 -1
- package/dist/ui/assets/{run-B7bNDge8.js → run-dAJe7sKp.js} +3 -3
- package/dist/ui/assets/same-file-identity-DuEcSmPX.js +1 -0
- package/dist/ui/assets/{session-command-memory-CzJDf01Z.js → session-command-memory-Bbguzf_6.js} +2 -2
- package/dist/ui/assets/{session-jsonl-Dhs3IqoC.js → session-jsonl-BFu5rblv.js} +1 -1
- package/dist/ui/assets/{session-jsonl-BwqaD3jQ.js → session-jsonl-f7vG8uaN.js} +1 -1
- package/dist/ui/assets/{session-search-index-D6zcG95Z.js → session-search-index-BQmbRVuk.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-CtllC58Y.js → setup-feature-flags-remote-Dg3f2VpS.js} +1 -1
- package/dist/ui/assets/{silent-renew-backoff-BazAPVJH.js → silent-renew-backoff-GiTNC81O.js} +1 -1
- package/dist/ui/assets/{skills-CJEFZrsl.js → skills-DPuIJKlr.js} +1 -1
- package/dist/ui/assets/slicc-version-CzaFZgjY.js +1 -0
- package/dist/ui/assets/{snapshot-DiBZ889S.js → snapshot-BJQuS7fA.js} +1 -1
- package/dist/ui/assets/{snapshot-features-BDbZinQm.js → snapshot-features-CMwKwxVx.js} +1 -1
- package/dist/ui/assets/{soundscape-p_17gIkK.js → soundscape-C1yxoOFL.js} +1 -1
- package/dist/ui/assets/{speak-DcePTkTJ.js → speak-DFvuiFDU.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-B2l4yjDJ.js → sprinkle-manager-3RaGBEHV.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-DGajwT-R.js → sprinkle-renderer-B1_bb422.js} +1 -1
- package/dist/ui/assets/stat-identity-BaU9yoai.js +1 -0
- package/dist/ui/assets/{state-Bg47hoJC.js → state-BPeFjtS_.js} +1 -1
- package/dist/ui/assets/{store-BrTdyYCw.js → store-bo0cdr2u.js} +1 -1
- package/dist/ui/assets/{store-B2phX_J_.js → store-epwD1PSG.js} +1 -1
- package/dist/ui/assets/{sudo-_YMo1g3C.js → sudo-RJfzy7Bg.js} +1 -1
- package/dist/ui/assets/{sync-dialog-Dz1u2hc1.js → sync-dialog-BkW4NuN6.js} +1 -1
- package/dist/ui/assets/{transformers-env-C3uTEvuB.js → transformers-env-BduCpFI6.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-DOxjhs0P.js → tray-sidecar-DAA3oOmd.js} +1 -1
- package/dist/ui/assets/types-D8gIX-W-.js +1 -0
- package/dist/ui/assets/{upgrade-detection-Q2YZEIZs.js → upgrade-detection-COCVR6QP.js} +1 -1
- package/dist/ui/assets/{upskill-lick-skip-I6gJYNyz.js → upskill-lick-skip-JXrZcdQ3.js} +1 -1
- package/dist/ui/assets/{voice-reply-DbakEYjK.js → voice-reply-B4LTaZql.js} +1 -1
- package/dist/ui/assets/{wc-attach-IO5dUOGT.js → wc-attach-DYc8_iLB.js} +2 -2
- package/dist/ui/assets/{wc-extension-BCd1YyiK.js → wc-extension-C04GxChh.js} +2 -2
- package/dist/ui/assets/{wc-follower-DVItvuN7.js → wc-follower-BxAVqwt0.js} +3 -3
- package/dist/ui/assets/{wc-follower-oauth-CJcwG3ac.js → wc-follower-oauth-DAnIlg5g.js} +1 -1
- package/dist/ui/assets/{wc-gelatiere-B5J_Tbl4.js → wc-gelatiere-BubMhY6t.js} +1 -1
- package/dist/ui/assets/{wc-live-_MvHDENH.js → wc-live-BIprYztk.js} +5 -5
- package/dist/ui/assets/{wc-nav-BmMZ5hQ1.js → wc-nav-Di5RqNCi.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-DUNMmoBo.js → wc-onboarding-BEMDMj2c.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-C9PK4xP8.js → wc-placeholder-iEg4KBf_.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-DDRmWja3.js → wc-secret-request-B1d6ZKAt.js} +1 -1
- package/dist/ui/assets/{wc-settings-Ca55PEn7.js → wc-settings-BgJoC4xY.js} +3 -3
- package/dist/ui/assets/{wc-shell-DVzCxzim.js → wc-shell-DIbmkLIE.js} +3 -3
- package/dist/ui/assets/{wc-shortcut-config-BKx0dmhX.js → wc-shortcut-config-EgHIF0kf.js} +1 -1
- package/dist/ui/assets/{wc-shortcuts-GZPnxY8C.js → wc-shortcuts-Doc9BdfE.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-DDvNfcRr.js → wc-sprinkles-D_ll3NyX.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-Nr-iLkgU.js → wc-transcript-export-CI50FMkd.js} +2 -2
- package/dist/ui/assets/{wc-tray-DtMFbq5v.js → wc-tray-BtZtrgMg.js} +4 -4
- package/dist/ui/assets/welcome-detection-BZV5ML4Q.js +1 -0
- package/dist/ui/assets/{whisper-session-CpNs8SQu.js → whisper-session-CMxHvrw8.js} +2 -2
- package/dist/ui/assets/{writable-vfs-client-CuLQlJK0.js → writable-vfs-client-pZwewNEw.js} +1 -1
- package/dist/ui/assets/{xai-grok-CrtZWfSb.js → xai-grok-BR5St0Jm.js} +1 -1
- package/dist/ui/assets/{xai-grok-lAapgYEW.js → xai-grok-DNI0j0Aj.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/ui/packages/webapp/index.html +3 -3
- package/package.json +1 -1
- package/dist/ui/assets/backend-hostfs-De2Zrx7a.js +0 -1
- package/dist/ui/assets/backend-hostfs-n_0O1LVt.js +0 -1
- package/dist/ui/assets/fs-B8bgTSap.js +0 -2
- package/dist/ui/assets/fs-lOoWMJlR.js +0 -1
- package/dist/ui/assets/provider-settings-CGklQOX-.js +0 -1
- package/dist/ui/assets/provider-store-access-Bm_tTRMF.js +0 -1
- package/dist/ui/assets/provider-store-access-bxo2oSpb.js +0 -1
- package/dist/ui/assets/run-BbzzVjlq.js +0 -13
- package/dist/ui/assets/same-file-identity-C_JKwIh_.js +0 -1
- package/dist/ui/assets/slicc-version-BXeATbjt.js +0 -1
- package/dist/ui/assets/types-Bgy4zvr3.js +0 -1
- package/dist/ui/assets/welcome-detection-CwYj20Sf.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./wc-onboarding-BEMDMj2c.js";export{e as hasOnboardingFinalLickInHistory};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/speak-
|
|
2
|
-
import{t as e}from"./preload-helper-Czpn1I53.js";import{t}from"./logger-DDBAeTLF.js";import{a as n,n as r,o as i,r as a,t as o}from"./transformers-env-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/speak-DFvuiFDU.js","assets/preload-helper-Czpn1I53.js","assets/logger-DDBAeTLF.js","assets/runtime-env-Dlaokqg1.js","assets/speech-assets-bridge-CFYafE89.js","assets/transformers-env-BduCpFI6.js","assets/wc-shortcuts-Doc9BdfE.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/account-store-CqdJ90Jw.js","assets/claude-model-version-CSATLzrT.js","assets/models-BSkXF4T6.js","assets/diagnostics-DN_idNHx.js","assets/provider-env-CTOcDKrQ.js","assets/__vite-browser-external-5eBdwsFd.js","assets/openrouter.models-B-zmcypy.js","assets/libesm-BypnjKEL.js","assets/base64-DJRlyqZu.js","assets/proxied-fetch-DyBveeCl.js","assets/fetch-body-1l9I58Vk.js","assets/api-endpoint-DGxXvrur.js","assets/float-topology-YtctpJaG.js","assets/secret-topology-DLJBhHOi.js","assets/secrets-bridge-client--VZ3E0yk.js","assets/port-bridge-client-Dn8JtUyP.js","assets/tool-ui-eSQ1g2I1.js","assets/providers-CVkGTQVH.js","assets/panel-rpc-B3MSVImO.js","assets/bedrock-camp-compat-BeCSBUrZ.js","assets/icons-Ce7Vz89o.js","assets/shared-mBEktoxE.js","assets/mime-types-D0xZwlMO.js","assets/transformers.web-B0gi9Hor.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./preload-helper-Czpn1I53.js";import{t}from"./logger-DDBAeTLF.js";import{a as n,n as r,o as i,r as a,t as o}from"./transformers-env-BduCpFI6.js";var s=t(`speech:whisper`),c=null,l=`idle`,u=null,d=new Set;function f(){return l}function p(){return u}function m(e){return e&&d.add(e),c||=(l=`loading`,g().then(e=>(l=`ready`,h(),e),e=>{throw l=`failed`,c=null,s.error(`whisper load failed`,e),e})),c}function h(){e(async()=>{let{kokoroWarmup:e}=await import(`./speak-DFvuiFDU.js`);return{kokoroWarmup:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30])).then(({kokoroWarmup:e})=>e()).catch(e=>s.warn(`kokoro warmup (chained after whisper) failed`,e))}async function g(){let{pipeline:t,env:c}=await e(async()=>{let{pipeline:e,env:t}=await import(`./transformers.web-B0gi9Hor.js`);return{pipeline:e,env:t}},__vite__mapDeps([31,7,1]));r(c),await o(n),await a();let l=i(),f=e=>{if(e?.file){if(e.status===`progress`)l.update(e.file,e.loaded??0,e.total??0);else if(e.status===`done`)l.complete(e.file);else return;u=l.snapshot();for(let e of d)e(u)}},p=async e=>await t(`automatic-speech-recognition`,n,{device:e,dtype:e===`webgpu`?`fp32`:`q8`,progress_callback:f}),m=typeof navigator<`u`&&`gpu`in navigator,h;if(m)try{h=await p(`webgpu`)}catch(e){s.warn(`whisper webgpu init failed; retrying on wasm`,e),h=await p(`wasm`)}else h=await p(`wasm`);return s.info(`whisper ready`,{model:n,device:m?`webgpu`:`wasm`}),{async transcribe(e,t){let n=performance.now(),r=await h(e,{chunk_length_s:30,task:`transcribe`,...t?.language?{language:t.language}:{}}),i=Array.isArray(r)?r.map(e=>e.text??``).join(` `):r.text??``;return s.info(`whisper transcribe`,{elapsedMs:Math.round(performance.now()-n),audioSeconds:Math.round(e.length/160)/100,numThreads:c.backends?.onnx?.wasm?.numThreads,device:m?`webgpu`:`wasm`}),i.trim()}}}var _=16e3;async function v(e){if(typeof AudioContext>`u`||typeof OfflineAudioContext>`u`)throw Error(`audio decoding requires a window/page realm (AudioContext unavailable)`);let t=new AudioContext,n;try{n=await t.decodeAudioData(e.slice(0))}finally{await t.close().catch(()=>{})}let r=Math.max(1,Math.ceil(n.duration*_)),i=new OfflineAudioContext(1,r,_),a=i.createBufferSource();return a.buffer=n,a.connect(i.destination),a.start(),(await i.startRendering()).getChannelData(0).slice(0)}var y=t(`speech:whisper-session`),b=2e3,x=500,S=5e3,C=3e4,w=(e,t,n)=>new Promise((r,i)=>{let a=setTimeout(()=>i(Error(`${n} timed out after ${t}ms`)),t);e.then(e=>{clearTimeout(a),r(e)},e=>{clearTimeout(a),i(e)})});function T(e){return e?.split(`-`)[0]?.toLowerCase()||void 0}async function E(e,t){let n;if(t.stream)n=t.stream;else{if(!navigator.mediaDevices?.getUserMedia)throw Error(`microphone capture unavailable in this realm`);n=await navigator.mediaDevices.getUserMedia({audio:t.deviceId&&t.deviceId!=="default"?{deviceId:{exact:t.deviceId}}:!0})}let r=new MediaRecorder(n),i=[],a=T(t.lang),o=!1,s=!1;r.ondataavailable=e=>{e.data.size>0&&i.push(e.data)};let c=async()=>{if(i.length===0)return``;let t=await v(await new Blob(i,{type:r.mimeType||`audio/webm`}).arrayBuffer());return e.transcribe(t,{language:a})},l=Promise.resolve(``),u=()=>{let e=l.catch(()=>``).then(()=>c());return l=e.catch(()=>``),e},d=setInterval(()=>{o||s||i.length===0||(o=!0,u().then(e=>{!s&&e&&t.onPartial?.(e)}).catch(e=>{y.warn(`partial transcription failed`,e)}).finally(()=>{o=!1}))},b),f=()=>{if(clearInterval(d),r.state!==`inactive`)try{r.stop()}catch{}for(let e of n.getTracks())e.stop()},p=()=>new Promise(e=>{if(r.state===`inactive`){e();return}r.onstop=()=>e();try{r.stop()}catch{e()}});return r.start(x),{async stop(){if(s)return``;s=!0,clearInterval(d);try{await w(p(),S,`recorder flush`);for(let e of n.getTracks())e.stop();return await w(u(),C,`transcription`)}catch(e){for(let e of n.getTracks())e.stop();let r=e instanceof Error?e.message:String(e);return t.onError?.(`transcription failed: ${r}`),``}},cancel(){s||(s=!0,f())}}}export{p as a,m as i,T as n,f as o,v as r,E as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./types-
|
|
1
|
+
import{t as e}from"./types-D8gIX-W-.js";function t(e){return new r(e)}var n=`vfs-w-`,r=class{transport;log;genId;pending=new Map;unsubscribe=null;counter=0;constructor(e){this.transport=e.transport,this.log=e.logger??console,this.genId=e.generateRequestId??(()=>{this.counter=this.counter+1>>>0;let e=Math.random().toString(36).slice(2,8);return`${n}${this.counter.toString(36)}-${e}`}),this.unsubscribe=this.transport.onMessage(e=>{if(!i(e)||e.source!==`offscreen`)return;let t=e.payload;a(t)&&this.handleResult(t)})}readDir(e,t){let n=this.genId(),r={type:`vfs-read-dir`,requestId:n,path:e,...t?.includeStats===!0?{includeStats:!0}:{}};return this.request(n,`vfs-read-dir-result`,e,r)}readFile(e,t){let n=this.genId(),r={type:`vfs-read-file`,requestId:n,path:e,encoding:t?.encoding??`utf-8`};return this.request(n,`vfs-read-file-result`,e,r)}readFileRange(e,t,n){let r=this.genId(),i={type:`vfs-read-file`,requestId:r,path:e,encoding:`binary`,start:t,end:n};return this.request(r,`vfs-read-file-result`,e,i)}stat(e){let t=this.genId(),n={type:`vfs-stat`,requestId:t,path:e};return this.request(t,`vfs-stat-result`,e,n)}writeFile(t,n,r){let i=this.genId(),a=r?.recursive;if(n instanceof Uint8Array){let e={type:`vfs-write-file`,requestId:i,path:t,encoding:`binary`,data:n,...a===void 0?{}:{recursive:a}},r=n.buffer,o=typeof ArrayBuffer<`u`&&r instanceof ArrayBuffer?[r]:void 0;return this.request(i,`vfs-write-file-result`,t,e,o)}if(typeof n!=`string`)return Promise.reject(new e(`EINVAL`,`writeFile content must be string or Uint8Array`,t));let o={type:`vfs-write-file`,requestId:i,path:t,encoding:`utf-8`,data:n,...a===void 0?{}:{recursive:a}};return this.request(i,`vfs-write-file-result`,t,o)}mkdir(e,t){let n=this.genId(),r=t?.recursive,i={type:`vfs-mkdir`,requestId:n,path:e,...r===void 0?{}:{recursive:r}};return this.request(n,`vfs-mkdir-result`,e,i)}rm(e,t){let n=this.genId(),r=t?.recursive,i={type:`vfs-rm`,requestId:n,path:e,...r===void 0?{}:{recursive:r}};return this.request(n,`vfs-rm-result`,e,i)}flush(){let e=this.genId(),t={type:`vfs-flush`,requestId:e};return this.request(e,`vfs-flush-result`,``,t)}listMountPoints(){let e=this.genId(),t={type:`vfs-list-mount-points`,requestId:e};return this.request(e,`vfs-list-mount-points-result`,``,t)}dispose(){this.unsubscribe?.(),this.unsubscribe=null;for(let[,t]of this.pending)t.reject(new e(`EBADF`,`RemoteWritableVfsClient disposed`,t.path));this.pending.clear()}request(e,t,n,r,i){return new Promise((a,o)=>{this.pending.set(e,{resolve:a,reject:o,expect:t,path:n});try{this.transport.send(r,i)}catch(t){this.pending.delete(e),o(t)}})}handleResult(t){let r=this.pending.get(t.requestId);if(!r){t.requestId.startsWith(n)&&this.log.debug?.(`[remote-writable-vfs-client] drop unmatched response`,{type:t.type,requestId:t.requestId});return}if(r.expect!==t.type){this.pending.delete(t.requestId),r.reject(new e(`EIO`,`vfs-rpc response type mismatch (got ${t.type})`,r.path));return}if(this.pending.delete(t.requestId),t.ok===!1){r.reject(o(t.error.code,t.error.message,t.error.path??r.path));return}switch(t.type){case`vfs-read-dir-result`:r.resolve(t.entries);return;case`vfs-read-file-result`:r.resolve(t.data);return;case`vfs-stat-result`:r.resolve(t.stats);return;case`vfs-list-mount-points-result`:r.resolve(t.mountPoints);return;case`vfs-write-file-result`:case`vfs-mkdir-result`:case`vfs-rm-result`:case`vfs-flush-result`:r.resolve(void 0);return}}};function i(e){return typeof e==`object`&&!!e&&`source`in e&&`payload`in e}function a(e){if(typeof e.requestId!=`string`)return!1;let t=e.type;return t===`vfs-read-dir-result`||t===`vfs-read-file-result`||t===`vfs-stat-result`||t===`vfs-write-file-result`||t===`vfs-mkdir-result`||t===`vfs-rm-result`||t===`vfs-flush-result`||t===`vfs-list-mount-points-result`}function o(t,n,r){let i=[`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`ENOSYS`,`EOPNOTSUPP`,`EIO`].includes(t)?t:`EIO`;return new e(i,n,r)}export{t as createRemoteWritableVfsClient};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as e,f as t}from"./account-store-
|
|
1
|
+
import{G as e,f as t}from"./account-store-CqdJ90Jw.js";import{a as n}from"./diagnostics-DN_idNHx.js";import{d as r,l as i}from"./claude-model-version-CSATLzrT.js";import{c as a,i as o,r as s,s as c}from"./legacy-api-aliases-bAJ0Klzq.js";import"./main-BUCKgxtj.js";import{n as l,r as u,t as d}from"./pkce-hGf_TEnP.js";import{XaiErrorCode as f,XaiOAuthError as p}from"./xai-grok-errors-bnlIBeu-.js";var m=`https://cli-chat-proxy.grok.com/v1/billing?format=credits`,h=8e3,g=65536,_=1e3;function v(e){return typeof e==`object`&&!!e}function y(e){if(!v(e))return null;let t=v(e.config)?e.config:e,n=t.creditUsagePercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=Math.min(_,Math.max(0,n)),i=v(t.currentPeriod)?t.currentPeriod:{},a=i.type,o=typeof a==`string`?a.replace(`USAGE_PERIOD_TYPE_`,``).toLowerCase():``,s=i.end??t.billingPeriodEnd,c=typeof s==`string`&&Number.isFinite(Date.parse(s))?s:void 0;return{percent:r,status:`ok`,window:o&&o!==`unspecified`?o:`billing`,...c?{resetsAt:c}:{}}}async function b(e,t,n={}){let r=new AbortController,i=setTimeout(()=>r.abort(),n.timeoutMs??h);try{let n=await t(m,{headers:{Authorization:`Bearer ${e}`},signal:r.signal}),{status:i}=n;if(i===404||i===501)return null;if(!n.ok)throw Error(`xAI Grok usage: ${i===401||i===403?`re-login required`:`failed`} (${i})`);let a=await n.text();if(a.length>g)return null;try{return y(JSON.parse(a))}catch{return null}}finally{clearTimeout(i)}}var x=`xai-grok`,S=`https://auth.x.ai`,C=`${S}/oauth2/authorize`,w=`${S}/oauth2/token`,T=`b1a00492-073a-47ea-816f-4c329264a828`,E=`openid profile email offline_access grok-cli:access api:access`,D=`http://127.0.0.1:56121/callback`,O=`http://127.0.0.1:56121/*`,k=`https://api.x.ai/v1`,A=`grok-4.5`,j=`${x}-openai`;function M(){return i(`xai`)}function N(e){return{id:e.id,name:e.name,api:`openai`,reasoning:e.reasoning,input:e.input,context_window:e.contextWindow,max_tokens:e.maxTokens,compat:e.compat,thinkingLevelMap:e.thinkingLevelMap}}function P(e){let t=M(),n=t.find(t=>t.id===e.id);if(!n&&(console.warn(`xAI model "${e.id}" is no longer in the pi-ai catalog; falling back to default "${A}"`),n=t.find(e=>e.id===A),!n))throw Error(`xAI default model "${A}" is not registered by pi-ai`);if(n.api!==`openai-responses`&&n.api!==`openai-completions`)throw Error(`Unsupported pi-ai API "${n.api}" for xAI model "${e.id}"`);return{...e,...n,baseUrl:k}}async function F(e,t){let n=new URLSearchParams({grant_type:`authorization_code`,code:e,redirect_uri:D,client_id:T,code_verifier:t}),r=await fetch(w,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:n});if(!r.ok)throw new p(`xAI token exchange failed: ${r.status} ${await r.text()}`,f.TOKEN_EXCHANGE_FAILED);let i=await r.json();if(!i.access_token)throw new p(`xAI token exchange did not return access_token.`,f.TOKEN_EXCHANGE_INVALID);return i}async function I(e){try{let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:T}),n=await fetch(w,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t});return n.ok?await n.json():(console.error(`[xai-grok] refresh failed:`,n.status,await n.text()),null)}catch(e){return console.error(`[xai-grok] refresh error:`,e instanceof Error?e.message:String(e)),null}}function L(){return t().find(e=>e.providerId===x)}async function R(){let t=L();if(!t?.accessToken)throw new p("Not signed in to xAI Grok — run /login or `oauth-token xai-grok`",f.AUTH_MISSING,!0);let n=t.tokenExpiresAt??0;if(n&&Date.now()+6e4<n)return t.accessToken;if(t.refreshToken){let n=await I(t.refreshToken);if(n?.access_token)return await e({providerId:x,accessToken:n.access_token,refreshToken:n.refresh_token??t.refreshToken,tokenExpiresAt:Date.now()+(n.expires_in??21600)*1e3,scopes:n.scope??t.scopes}),n.access_token}return t.accessToken}async function z(){if(!L()?.accessToken)throw Error(`xAI Grok budget: not signed in`);return b(await R(),fetch)}function B(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:j,provider:x,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}function V(e,t){return t?{...e??{},"x-grok-conv-id":t}:e}function H(e){console.error(`[xai-grok] Stream error:`,e instanceof Error?e.message:String(e))}async function U(e,t,n,r){try{let i=await R(),a=r.sessionId,c=P(t),l={...r,apiKey:i,headers:V(r.headers,a)},u=c.api===`openai-responses`?o(c,n,l):s(c,n,l);for await(let t of u)e.push(t);e.end()}catch(n){H(n),e.push(B(t,n)),e.end()}}async function W(e,t,n,r){try{let i=await R(),o=r?.sessionId,s=P(t),l={...r,apiKey:i,headers:V(r?.headers,o)},u=s.api===`openai-responses`?a(s,n,l):c(s,n,l);for await(let t of u)e.push(t);e.end()}catch(n){H(n),e.push(B(t,n)),e.end()}}var G=(e,t,r={})=>{let i=n();return U(i,e,t,r).catch(H),i},K=(e,t,r)=>{let i=n();return W(i,e,t,r).catch(H),i},q={id:x,name:`xAI Grok (SuperGrok OAuth)`,description:`Grok via xAI OAuth — uses your SuperGrok subscription, no API key needed. Default model is Grok 4.5.`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:A,oauthTokenDomains:[`api.x.ai`,`*.x.ai`,`auth.x.ai`,`accounts.x.ai`,`cli-chat-proxy.grok.com`],getModelIds:()=>M().map(N),getBudgetUsage:z,onOAuthLoginIntercepted:async(t,n,r)=>{let i=l(),a=await d(i),o=u(),s=u(),c=new URL(C);c.searchParams.set(`response_type`,`code`),c.searchParams.set(`client_id`,T),c.searchParams.set(`redirect_uri`,D),c.searchParams.set(`scope`,r?.scopes??E),c.searchParams.set(`code_challenge`,a),c.searchParams.set(`code_challenge_method`,`S256`),c.searchParams.set(`state`,o),c.searchParams.set(`nonce`,s),c.searchParams.set(`plan`,`generic`),c.searchParams.set(`referrer`,`slicc`);let m=await t({authorizeUrl:c.toString(),redirectUriPattern:O,onCapture:`close`});if(!m)throw new p(`xAI OAuth login was cancelled or timed out`,f.CALLBACK_TIMEOUT);let h=new URL(m),g=h.searchParams.get(`code`),_=h.searchParams.get(`state`);if(!g)throw new p(`xAI OAuth redirect did not include a code`,f.CODE_MISSING);if(_!==o)throw new p(`xAI OAuth state mismatch — possible CSRF, aborting`,f.STATE_MISMATCH);let v=await F(g,i);await e({providerId:x,accessToken:v.access_token,refreshToken:v.refresh_token,tokenExpiresAt:Date.now()+(v.expires_in??21600)*1e3,baseUrl:k,scopes:v.scope}),n()},onOAuthLogout:async()=>{await e({providerId:x,accessToken:``})},onSilentRenew:async()=>{let t=L();if(!t?.refreshToken)return null;let n=await I(t.refreshToken);return n?.access_token?(await e({providerId:x,accessToken:n.access_token,refreshToken:n.refresh_token??t.refreshToken,tokenExpiresAt:Date.now()+(n.expires_in??21600)*1e3,scopes:n.scope??t.scopes}),n.access_token):null}};function J(){r({api:j,stream:G,streamSimple:K})}export{f as XaiErrorCode,p as XaiOAuthError,q as config,J as register};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,r as t}from"./account-store-
|
|
1
|
+
import{_ as e,r as t}from"./account-store-CSEqTHkT.js";import{a as n}from"./diagnostics-DN_idNHx.js";import{a as r,r as i}from"./compat-uEPf6-XW.js";import{c as a,i as o,r as s,s as c}from"./legacy-api-aliases-jKEvBgOL.js";import"./provider-settings-DdBW0Ptt.js";import{n as l,r as u,t as d}from"./pkce-hGf_TEnP.js";import{XaiErrorCode as f,XaiOAuthError as p}from"./xai-grok-errors-ByEMMSoz.js";function m(e){return typeof e==`object`&&!!e}function h(e){if(!m(e))return null;let t=m(e.config)?e.config:e,n=t.creditUsagePercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=Math.min(1e3,Math.max(0,n)),i=m(t.currentPeriod)?t.currentPeriod:{},a=i.type,o=typeof a==`string`?a.replace(`USAGE_PERIOD_TYPE_`,``).toLowerCase():``,s=i.end??t.billingPeriodEnd,c=typeof s==`string`&&Number.isFinite(Date.parse(s))?s:void 0;return{percent:r,status:`ok`,window:o&&o!==`unspecified`?o:`billing`,...c?{resetsAt:c}:{}}}async function g(e,t,n={}){let r=new AbortController,i=setTimeout(()=>r.abort(),n.timeoutMs??8e3);try{let n=await t(`https://cli-chat-proxy.grok.com/v1/billing?format=credits`,{headers:{Authorization:`Bearer ${e}`},signal:r.signal}),{status:i}=n;if(i===404||i===501)return null;if(!n.ok)throw Error(`xAI Grok usage: ${i===401||i===403?`re-login required`:`failed`} (${i})`);let a=await n.text();if(a.length>65536)return null;try{return h(JSON.parse(a))}catch{return null}}finally{clearTimeout(i)}}const _=`xai-grok`,v=`https://auth.x.ai`,y=`${v}/oauth2/authorize`,b=`${v}/oauth2/token`,x=`b1a00492-073a-47ea-816f-4c329264a828`,S=`http://127.0.0.1:56121/callback`,C=`https://api.x.ai/v1`,w=`grok-4.5`,T=`${_}-openai`;function E(){return i(`xai`)}function D(e){return{id:e.id,name:e.name,api:`openai`,reasoning:e.reasoning,input:e.input,context_window:e.contextWindow,max_tokens:e.maxTokens,compat:e.compat,thinkingLevelMap:e.thinkingLevelMap}}function O(e){let t=E(),n=t.find(t=>t.id===e.id);if(!n&&(console.warn(`xAI model "${e.id}" is no longer in the pi-ai catalog; falling back to default "${w}"`),n=t.find(e=>e.id===w),!n))throw Error(`xAI default model "${w}" is not registered by pi-ai`);if(n.api!==`openai-responses`&&n.api!==`openai-completions`)throw Error(`Unsupported pi-ai API "${n.api}" for xAI model "${e.id}"`);return{...e,...n,baseUrl:C}}async function k(e,t){let n=new URLSearchParams({grant_type:`authorization_code`,code:e,redirect_uri:S,client_id:x,code_verifier:t}),r=await fetch(b,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:n});if(!r.ok)throw new p(`xAI token exchange failed: ${r.status} ${await r.text()}`,f.TOKEN_EXCHANGE_FAILED);let i=await r.json();if(!i.access_token)throw new p(`xAI token exchange did not return access_token.`,f.TOKEN_EXCHANGE_INVALID);return i}async function A(e){try{let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:x}),n=await fetch(b,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t});return n.ok?await n.json():(console.error(`[xai-grok] refresh failed:`,n.status,await n.text()),null)}catch(e){return console.error(`[xai-grok] refresh error:`,e instanceof Error?e.message:String(e)),null}}function j(){return t().find(e=>e.providerId===_)}async function M(){let t=j();if(!t?.accessToken)throw new p("Not signed in to xAI Grok — run /login or `oauth-token xai-grok`",f.AUTH_MISSING,!0);let n=t.tokenExpiresAt??0;if(n&&Date.now()+6e4<n)return t.accessToken;if(t.refreshToken){let n=await A(t.refreshToken);if(n?.access_token)return await e({providerId:_,accessToken:n.access_token,refreshToken:n.refresh_token??t.refreshToken,tokenExpiresAt:Date.now()+(n.expires_in??21600)*1e3,scopes:n.scope??t.scopes}),n.access_token}return t.accessToken}async function N(){if(!j()?.accessToken)throw Error(`xAI Grok budget: not signed in`);return g(await M(),fetch)}function P(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:T,provider:_,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}function F(e,t){return t?{...e??{},"x-grok-conv-id":t}:e}function I(e){console.error(`[xai-grok] Stream error:`,e instanceof Error?e.message:String(e))}async function L(e,t,n,r){try{let i=await M(),a=r.sessionId,c=O(t),l={...r,apiKey:i,headers:F(r.headers,a)},u=c.api===`openai-responses`?o(c,n,l):s(c,n,l);for await(let t of u)e.push(t);e.end()}catch(n){I(n),e.push(P(t,n)),e.end()}}async function R(e,t,n,r){try{let i=await M(),o=r?.sessionId,s=O(t),l={...r,apiKey:i,headers:F(r?.headers,o)},u=s.api===`openai-responses`?a(s,n,l):c(s,n,l);for await(let t of u)e.push(t);e.end()}catch(n){I(n),e.push(P(t,n)),e.end()}}const z=(e,t,r={})=>{let i=n();return L(i,e,t,r).catch(I),i},B=(e,t,r)=>{let i=n();return R(i,e,t,r).catch(I),i},V={id:_,name:`xAI Grok (SuperGrok OAuth)`,description:`Grok via xAI OAuth — uses your SuperGrok subscription, no API key needed. Default model is Grok 4.5.`,requiresApiKey:!1,requiresBaseUrl:!1,isOAuth:!0,defaultModelId:w,oauthTokenDomains:[`api.x.ai`,`*.x.ai`,`auth.x.ai`,`accounts.x.ai`,`cli-chat-proxy.grok.com`],getModelIds:()=>E().map(D),getBudgetUsage:N,onOAuthLoginIntercepted:async(t,n,r)=>{let i=l(),a=await d(i),o=u(),s=u(),c=new URL(y);c.searchParams.set(`response_type`,`code`),c.searchParams.set(`client_id`,x),c.searchParams.set(`redirect_uri`,S),c.searchParams.set(`scope`,r?.scopes??`openid profile email offline_access grok-cli:access api:access`),c.searchParams.set(`code_challenge`,a),c.searchParams.set(`code_challenge_method`,`S256`),c.searchParams.set(`state`,o),c.searchParams.set(`nonce`,s),c.searchParams.set(`plan`,`generic`),c.searchParams.set(`referrer`,`slicc`);let m=await t({authorizeUrl:c.toString(),redirectUriPattern:`http://127.0.0.1:56121/*`,onCapture:`close`});if(!m)throw new p(`xAI OAuth login was cancelled or timed out`,f.CALLBACK_TIMEOUT);let h=new URL(m),g=h.searchParams.get(`code`),v=h.searchParams.get(`state`);if(!g)throw new p(`xAI OAuth redirect did not include a code`,f.CODE_MISSING);if(v!==o)throw new p(`xAI OAuth state mismatch — possible CSRF, aborting`,f.STATE_MISMATCH);let b=await k(g,i);await e({providerId:_,accessToken:b.access_token,refreshToken:b.refresh_token,tokenExpiresAt:Date.now()+(b.expires_in??21600)*1e3,baseUrl:C,scopes:b.scope}),n()},onOAuthLogout:async()=>{await e({providerId:_,accessToken:``})},onSilentRenew:async()=>{let t=j();if(!t?.refreshToken)return null;let n=await A(t.refreshToken);return n?.access_token?(await e({providerId:_,accessToken:n.access_token,refreshToken:n.refresh_token??t.refreshToken,tokenExpiresAt:Date.now()+(n.expires_in??21600)*1e3,scopes:n.scope??t.scopes}),n.access_token):null}};function H(){r({api:T,stream:z,streamSimple:B})}export{f as XaiErrorCode,p as XaiOAuthError,V as config,H as register};
|
package/dist/ui/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>slicc</title>
|
|
7
7
|
<link rel="icon" type="image/png" href="/logos/sliccy-color-1scoops-32x32.png" />
|
|
8
|
-
<script type="module" crossorigin src="/assets/main-
|
|
8
|
+
<script type="module" crossorigin src="/assets/main-BUCKgxtj.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Dd_uD5pT.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-P2Xu9kJm.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/port-bridge-client-Dn8JtUyP.js">
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/secrets-bridge-client--VZ3E0yk.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/tool-ui-eSQ1g2I1.js">
|
|
30
|
-
<link rel="modulepreload" crossorigin href="/assets/providers-
|
|
30
|
+
<link rel="modulepreload" crossorigin href="/assets/providers-CVkGTQVH.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/panel-rpc-B3MSVImO.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/assets/bedrock-camp-compat-BeCSBUrZ.js">
|
|
33
|
-
<link rel="modulepreload" crossorigin href="/assets/account-store-
|
|
33
|
+
<link rel="modulepreload" crossorigin href="/assets/account-store-CqdJ90Jw.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/bridge-protocol-06nbmp2X.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/messages-zAgr7E2T.js">
|
|
36
36
|
<link rel="modulepreload" crossorigin href="/assets/tray-runtime-config-B9jN9kUJ.js">
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>slicc</title>
|
|
7
7
|
<link rel="icon" type="image/png" href="/logos/sliccy-color-1scoops-32x32.png" />
|
|
8
|
-
<script type="module" crossorigin src="/assets/main-
|
|
8
|
+
<script type="module" crossorigin src="/assets/main-BUCKgxtj.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Dd_uD5pT.js">
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-P2Xu9kJm.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/port-bridge-client-Dn8JtUyP.js">
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/secrets-bridge-client--VZ3E0yk.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/tool-ui-eSQ1g2I1.js">
|
|
30
|
-
<link rel="modulepreload" crossorigin href="/assets/providers-
|
|
30
|
+
<link rel="modulepreload" crossorigin href="/assets/providers-CVkGTQVH.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/panel-rpc-B3MSVImO.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/assets/bedrock-camp-compat-BeCSBUrZ.js">
|
|
33
|
-
<link rel="modulepreload" crossorigin href="/assets/account-store-
|
|
33
|
+
<link rel="modulepreload" crossorigin href="/assets/account-store-CqdJ90Jw.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="/assets/bridge-protocol-06nbmp2X.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/messages-zAgr7E2T.js">
|
|
36
36
|
<link rel="modulepreload" crossorigin href="/assets/tray-runtime-config-B9jN9kUJ.js">
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./api-endpoint-DGxXvrur.js";import{t as n}from"./types-Bgy4zvr3.js";import{t as r}from"./remote-cache-3KNT1gsp.js";function i(e){if(!Number.isFinite(e))return{run:e=>e(),get active(){return 0}};let t=Math.max(1,Math.floor(e)),n=[],r=0,i=()=>{let e=n.shift();if(e){e();return}--r};return{async run(e){r>=t?await new Promise(e=>n.push(e)):r+=1;try{return await e()}finally{i()}},get active(){return r}}}var a=104857600,o=new Set([`list`,`stat`,`mkdir`,`rename`,`remove`]),s=`/api/hostfs`,c=new Set([`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`EIO`]),l=new Set([`list`,`stat`,`read`,`mkdir`]),u=3,d=25,f=24,p=3e4,m=4194304,h=`no-store`;function g(e,t){return`hostfs:${encodeURIComponent(e)}:${encodeURIComponent(t)}`}var _=e=>e.json(),v=async e=>({partial:e.status===206,body:await e.arrayBuffer()}),y=async e=>{await e.arrayBuffer()},b=e=>e>0?new Promise(t=>setTimeout(t,e)):Promise.resolve();function x(e,t,r,i,a){let o=r instanceof Error?r.message:String(r),s=a?` after ${i} attempt${i===1?``:`s`}`:` (not retried: non-idempotent op)`;return new n(`EIO`,`hostfs ${e} failed${s}: transient bridge error: ${o}`,t)}function S(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function C(e){let t={},n=S(e.ctime);n!==void 0&&(t.ctime=n);let r=S(e.ino);r!==void 0&&(t.ino=r);let i=S(e.dev);i!==void 0&&(t.dev=i);let a=S(e.uid);a!==void 0&&(t.uid=a);let o=S(e.gid);o!==void 0&&(t.gid=o);let s=S(e.mode);return s!==void 0&&(t.mode=s),t}var w=class{kind=`hostfs`;listingStatsMatchStat=!0;source;mountId;targetPath;hostPath;fetchImpl;limiter;maxAttempts;retryDelayMs;cache;maxCachedBodyBytes;cacheGeneration=0;closed=!1;stableEndpoint=!0;constructor(e){this.targetPath=e.targetPath,this.hostPath=e.hostPath,this.source=`hostfs://${e.hostPath}`,this.mountId=e.mountId??g(e.targetPath,e.hostPath),this.fetchImpl=e.fetchImpl??fetch,this.limiter=i(e.maxInflight??f),this.maxAttempts=Math.max(1,e.maxAttempts??u),this.retryDelayMs=e.retryDelayMs??d,this.maxCachedBodyBytes=Math.max(0,e.maxCachedBodyBytes??m),this.cache=e.cache??new r({mountId:this.mountId,ttlMs:e.cacheTtlMs??p})}assertOpen(e){if(this.closed)throw new n(`EBADF`,`mount closed`,e)}bodyKey(e){return e.replace(/^\/+/,``)}async invalidateCachePrefixes(e){this.cacheGeneration+=1,await this.cache.invalidatePrefixes(e)}async cacheBodyIfCurrent(e,t,n,r){e!==this.cacheGeneration||n.byteLength>this.maxCachedBodyBytes||(await this.cache.putBody(t,n,r),e!==this.cacheGeneration&&await this.cache.invalidateBody(t))}async applyHostInvalidation(e){if(e.length===0){await this.invalidateCachePrefixes([]);return}let t=e.map(e=>e.replace(/^\/+/,``));if(t.some(e=>e.length===0||e===`.`)){await this.invalidateCachePrefixes([]);return}await this.invalidateCachePrefixes(t)}getCache(){return this.cache}url(t,n,r){let i=new URLSearchParams({mount:this.targetPath,path:n.replace(/^\/+/,``)});for(let[e,t]of Object.entries(r??{}))i.set(e,t);return e(`/api/hostfs/${t}?${i.toString()}`)}buildRequest(n,r,i){let a=t(i?.headers);if(this.stableEndpoint&&o.has(n))return{url:e(s),init:{method:`POST`,headers:{...a,"Content-Type":`application/json`},body:JSON.stringify({op:n,mount:this.targetPath,path:r.replace(/^\/+/,``),...i?.extra??{}})}};let{extra:c,...l}=i??{};return{url:this.url(n,r,i?.extra),init:{...l,headers:a}}}async request(e,t,n,r){return this.assertOpen(t),this.limiter.run(()=>this.attemptRequest(e,t,n,r))}async attemptRequest(e,t,r,i){let a=l.has(e)?this.maxAttempts:1,o=0,s;for(;o<a;){o+=1;try{return await this.routeAndConsume(e,t,r,i)}catch(e){if(e instanceof n)throw e;if(s=e,this.closed)break;o<a&&await b(this.retryDelayMs*o)}}throw x(e,t,s,o,a>1)}async routeAndConsume(e,t,n,r){let i=this.stableEndpoint&&o.has(e),a=this.buildRequest(e,t,r),s=await this.fetchImpl(a.url,a.init);if(s.ok||s.status===304)return await n(s);let{error:c,rawCode:l}=await this.errorFromResponse(e,t,s);if(i&&l===null&&(s.status===404||s.status===405))return this.stableEndpoint=!1,await this.routeAndConsume(e,t,n,r);throw c}async errorFromResponse(e,t,r){let i=`EIO`,a=null,o=`hostfs ${e} failed with HTTP ${r.status}`;try{let e=await r.json();typeof e.code==`string`&&(a=e.code,c.has(e.code)&&(i=e.code)),typeof e.message==`string`&&(o=e.message)}catch{}return{error:new n(i,o,t),rawCode:a}}async readDir(e){let t=await this.request(`list`,e,_);if(!Array.isArray(t.entries))return[];let n=[];for(let e of t.entries){let t=e;typeof t.name!=`string`||t.kind!==`file`&&t.kind!==`directory`||n.push({name:t.name,kind:t.kind,...typeof t.size==`number`?{size:t.size}:{},...typeof t.lastModified==`number`?{lastModified:t.lastModified}:{},...C(t)})}return n}async readFile(e){this.assertOpen(e);let t=this.cacheGeneration,r=this.bodyKey(e),i=await this.cache.getBody(r);if(i&&!this.cache.isStale(i.cachedAt))return i.body;let o={};i?.etag&&(o[`If-None-Match`]=i.etag);let s=await this.request(`read`,e,async e=>e.status===304?{kind:`not-modified`}:{kind:`body`,bytes:new Uint8Array(await e.arrayBuffer()),etag:e.headers.get(`etag`)??``},{cache:h,headers:o});if(s.kind===`not-modified`){if(!i)throw new n(`EIO`,`hostfs read got 304 without a cached body`,e);return await this.cacheBodyIfCurrent(t,r,i.body,i.etag),i.body}if(s.bytes.byteLength>a)throw new n(`EFBIG`,`file exceeds the hostfs body cap`,e);return await this.cacheBodyIfCurrent(t,r,s.bytes,s.etag),s.bytes}async readFileRange(e,t,r){if(!Number.isInteger(t)||!Number.isInteger(r)||t<0||r<t)throw new n(`EINVAL`,`invalid byte range ${t}-${r}`,e);if(r===t)return new Uint8Array;if(r-t>a)throw new n(`EFBIG`,`byte range exceeds the hostfs body cap`,e);let{partial:i,body:o}=await this.request(`read`,e,v,{cache:h,headers:{Range:`bytes=${t}-${r-1}`}});return i?new Uint8Array(o):new Uint8Array(o).slice(t,r)}async writeFile(e,t){if(t.byteLength>a)throw new n(`EFBIG`,`body exceeds the hostfs body cap`,e);await this.request(`write`,e,y,{method:`PUT`,headers:{"Content-Type":`application/octet-stream`},body:new Uint8Array(t)});let r=this.bodyKey(e),i=++this.cacheGeneration;t.byteLength<=this.maxCachedBodyBytes?await this.cacheBodyIfCurrent(i,r,new Uint8Array(t),``):await this.cache.invalidateBody(r)}async stat(e){let t=await this.request(`stat`,e,_);return{kind:t.kind===`directory`?`directory`:`file`,size:typeof t.size==`number`?t.size:0,mtime:typeof t.mtime==`number`?t.mtime:0,...C(t)}}async mkdir(e){await this.request(`mkdir`,e,y,{method:`POST`})}async rename(e,t){let n=await this.request(`rename`,e,_,{method:`POST`,extra:{to:t.replace(/^\/+/,``)}}),r=this.bodyKey(e),i=this.bodyKey(t);return await this.invalidateCachePrefixes([r,i]),n.noop===!0?{noop:!0}:{}}async remove(e,t){await this.request(`remove`,e,y,{method:`DELETE`,extra:t?.recursive?{recursive:`1`}:void 0});let n=this.bodyKey(e);t?.recursive?await this.invalidateCachePrefixes([n]):(this.cacheGeneration+=1,await this.cache.invalidateBody(n))}async refresh(e){return this.assertOpen(this.targetPath),await this.invalidateCachePrefixes([]),{added:[],removed:[],changed:e?.bodies?[`*`]:[],unchanged:0,errors:[]}}describe(){return{displayName:this.hostPath.split(`/`).filter(Boolean).at(-1)??this.hostPath,source:this.source,extra:`configured via mount table (auto-mounted, live host view)`}}async close(){this.closed=!0}getHostPath(){return this.hostPath}getTargetPath(){return this.targetPath}};export{w as HostFsMountBackend};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,t}from"./api-endpoint-3qEcn7BY.js";import{t as n}from"./types-Bgy4zvr3.js";import{t as r}from"./remote-cache-BE5T1-53.js";function i(e){if(!Number.isFinite(e))return{run:e=>e(),get active(){return 0}};let t=Math.max(1,Math.floor(e)),n=[],r=0,i=()=>{let e=n.shift();if(e){e();return}--r};return{async run(e){r>=t?await new Promise(e=>n.push(e)):r+=1;try{return await e()}finally{i()}},get active(){return r}}}const a=104857600,o=new Set([`list`,`stat`,`mkdir`,`rename`,`remove`]),s=new Set([`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`EIO`]),c=new Set([`list`,`stat`,`read`,`mkdir`]),l=`no-store`;function u(e,t){return`hostfs:${encodeURIComponent(e)}:${encodeURIComponent(t)}`}const d=e=>e.json(),f=async e=>({partial:e.status===206,body:await e.arrayBuffer()}),p=async e=>{await e.arrayBuffer()},m=e=>e>0?new Promise(t=>setTimeout(t,e)):Promise.resolve();function h(e,t,r,i,a){let o=r instanceof Error?r.message:String(r),s=a?` after ${i} attempt${i===1?``:`s`}`:` (not retried: non-idempotent op)`;return new n(`EIO`,`hostfs ${e} failed${s}: transient bridge error: ${o}`,t)}function g(e){return typeof e==`number`&&Number.isFinite(e)?e:void 0}function _(e){let t={},n=g(e.ctime);n!==void 0&&(t.ctime=n);let r=g(e.ino);r!==void 0&&(t.ino=r);let i=g(e.dev);i!==void 0&&(t.dev=i);let a=g(e.uid);a!==void 0&&(t.uid=a);let o=g(e.gid);o!==void 0&&(t.gid=o);let s=g(e.mode);return s!==void 0&&(t.mode=s),t}var v=class{kind=`hostfs`;listingStatsMatchStat=!0;source;mountId;targetPath;hostPath;fetchImpl;limiter;maxAttempts;retryDelayMs;cache;maxCachedBodyBytes;cacheGeneration=0;closed=!1;stableEndpoint=!0;constructor(e){this.targetPath=e.targetPath,this.hostPath=e.hostPath,this.source=`hostfs://${e.hostPath}`,this.mountId=e.mountId??u(e.targetPath,e.hostPath),this.fetchImpl=e.fetchImpl??fetch,this.limiter=i(e.maxInflight??24),this.maxAttempts=Math.max(1,e.maxAttempts??3),this.retryDelayMs=e.retryDelayMs??25,this.maxCachedBodyBytes=Math.max(0,e.maxCachedBodyBytes??4194304),this.cache=e.cache??new r({mountId:this.mountId,ttlMs:e.cacheTtlMs??3e4})}assertOpen(e){if(this.closed)throw new n(`EBADF`,`mount closed`,e)}bodyKey(e){return e.replace(/^\/+/,``)}async invalidateCachePrefixes(e){this.cacheGeneration+=1,await this.cache.invalidatePrefixes(e)}async cacheBodyIfCurrent(e,t,n,r){e!==this.cacheGeneration||n.byteLength>this.maxCachedBodyBytes||(await this.cache.putBody(t,n,r),e!==this.cacheGeneration&&await this.cache.invalidateBody(t))}async applyHostInvalidation(e){if(e.length===0){await this.invalidateCachePrefixes([]);return}let t=e.map(e=>e.replace(/^\/+/,``));if(t.some(e=>e.length===0||e===`.`)){await this.invalidateCachePrefixes([]);return}await this.invalidateCachePrefixes(t)}getCache(){return this.cache}url(t,n,r){let i=new URLSearchParams({mount:this.targetPath,path:n.replace(/^\/+/,``)});for(let[e,t]of Object.entries(r??{}))i.set(e,t);return e(`/api/hostfs/${t}?${i.toString()}`)}buildRequest(n,r,i){let a=t(i?.headers);if(this.stableEndpoint&&o.has(n))return{url:e(`/api/hostfs`),init:{method:`POST`,headers:{...a,"Content-Type":`application/json`},body:JSON.stringify({op:n,mount:this.targetPath,path:r.replace(/^\/+/,``),...i?.extra??{}})}};let{extra:s,...c}=i??{};return{url:this.url(n,r,i?.extra),init:{...c,headers:a}}}async request(e,t,n,r){return this.assertOpen(t),this.limiter.run(()=>this.attemptRequest(e,t,n,r))}async attemptRequest(e,t,r,i){let a=c.has(e)?this.maxAttempts:1,o=0,s;for(;o<a;){o+=1;try{return await this.routeAndConsume(e,t,r,i)}catch(e){if(e instanceof n)throw e;if(s=e,this.closed)break;o<a&&await m(this.retryDelayMs*o)}}throw h(e,t,s,o,a>1)}async routeAndConsume(e,t,n,r){let i=this.stableEndpoint&&o.has(e),a=this.buildRequest(e,t,r),s=await this.fetchImpl(a.url,a.init);if(s.ok||s.status===304)return await n(s);let{error:c,rawCode:l}=await this.errorFromResponse(e,t,s);if(i&&l===null&&(s.status===404||s.status===405))return this.stableEndpoint=!1,await this.routeAndConsume(e,t,n,r);throw c}async errorFromResponse(e,t,r){let i=`EIO`,a=null,o=`hostfs ${e} failed with HTTP ${r.status}`;try{let e=await r.json();typeof e.code==`string`&&(a=e.code,s.has(e.code)&&(i=e.code)),typeof e.message==`string`&&(o=e.message)}catch{}return{error:new n(i,o,t),rawCode:a}}async readDir(e){let t=await this.request(`list`,e,d);if(!Array.isArray(t.entries))return[];let n=[];for(let e of t.entries){let t=e;typeof t.name!=`string`||t.kind!==`file`&&t.kind!==`directory`||n.push({name:t.name,kind:t.kind,...typeof t.size==`number`?{size:t.size}:{},...typeof t.lastModified==`number`?{lastModified:t.lastModified}:{},..._(t)})}return n}async readFile(e){this.assertOpen(e);let t=this.cacheGeneration,r=this.bodyKey(e),i=await this.cache.getBody(r);if(i&&!this.cache.isStale(i.cachedAt))return i.body;let o={};i?.etag&&(o[`If-None-Match`]=i.etag);let s=await this.request(`read`,e,async e=>e.status===304?{kind:`not-modified`}:{kind:`body`,bytes:new Uint8Array(await e.arrayBuffer()),etag:e.headers.get(`etag`)??``},{cache:l,headers:o});if(s.kind===`not-modified`){if(!i)throw new n(`EIO`,`hostfs read got 304 without a cached body`,e);return await this.cacheBodyIfCurrent(t,r,i.body,i.etag),i.body}if(s.bytes.byteLength>a)throw new n(`EFBIG`,`file exceeds the hostfs body cap`,e);return await this.cacheBodyIfCurrent(t,r,s.bytes,s.etag),s.bytes}async readFileRange(e,t,r){if(!Number.isInteger(t)||!Number.isInteger(r)||t<0||r<t)throw new n(`EINVAL`,`invalid byte range ${t}-${r}`,e);if(r===t)return new Uint8Array;if(r-t>a)throw new n(`EFBIG`,`byte range exceeds the hostfs body cap`,e);let{partial:i,body:o}=await this.request(`read`,e,f,{cache:l,headers:{Range:`bytes=${t}-${r-1}`}});return i?new Uint8Array(o):new Uint8Array(o).slice(t,r)}async writeFile(e,t){if(t.byteLength>a)throw new n(`EFBIG`,`body exceeds the hostfs body cap`,e);await this.request(`write`,e,p,{method:`PUT`,headers:{"Content-Type":`application/octet-stream`},body:new Uint8Array(t)});let r=this.bodyKey(e),i=++this.cacheGeneration;t.byteLength<=this.maxCachedBodyBytes?await this.cacheBodyIfCurrent(i,r,new Uint8Array(t),``):await this.cache.invalidateBody(r)}async stat(e){let t=await this.request(`stat`,e,d);return{kind:t.kind===`directory`?`directory`:`file`,size:typeof t.size==`number`?t.size:0,mtime:typeof t.mtime==`number`?t.mtime:0,..._(t)}}async mkdir(e){await this.request(`mkdir`,e,p,{method:`POST`})}async rename(e,t){let n=await this.request(`rename`,e,d,{method:`POST`,extra:{to:t.replace(/^\/+/,``)}}),r=this.bodyKey(e),i=this.bodyKey(t);return await this.invalidateCachePrefixes([r,i]),n.noop===!0?{noop:!0}:{}}async remove(e,t){await this.request(`remove`,e,p,{method:`DELETE`,extra:t?.recursive?{recursive:`1`}:void 0});let n=this.bodyKey(e);t?.recursive?await this.invalidateCachePrefixes([n]):(this.cacheGeneration+=1,await this.cache.invalidateBody(n))}async refresh(e){return this.assertOpen(this.targetPath),await this.invalidateCachePrefixes([]),{added:[],removed:[],changed:e?.bodies?[`*`]:[],unchanged:0,errors:[]}}describe(){return{displayName:this.hostPath.split(`/`).filter(Boolean).at(-1)??this.hostPath,source:this.source,extra:`configured via mount table (auto-mounted, live host view)`}}async close(){this.closed=!0}getHostPath(){return this.hostPath}getTargetPath(){return this.targetPath}};export{v as HostFsMountBackend};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-0AIPb7H_.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/safe-buffer-iah92gQe.js","assets/opfs-mount-C4HqOQiQ.js","assets/backend-hostfs-De2Zrx7a.js","assets/api-endpoint-DGxXvrur.js","assets/runtime-env-Dlaokqg1.js","assets/types-Bgy4zvr3.js","assets/remote-cache-3KNT1gsp.js","assets/mount-eD6bH6K8.js","assets/preload-helper-Czpn1I53.js","assets/mime-types-D0xZwlMO.js","assets/base64-DJRlyqZu.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{a as r,i,n as a,r as o,t as s}from"./path-utils-DNJG-zQf.js";import{r as c,t as l}from"./bounded-walk-BjxKWNqp.js";import{n as u,t as d}from"./types-Bgy4zvr3.js";import{n as ee,t as te}from"./virtual-device-paths-D45tpPP6.js";import{t as f}from"./same-file-identity-C_JKwIh_.js";import{a as ne,i as p,n as m,t as re}from"./mount-table-store-dY2IfQ5S.js";var h=n(`fs-watcher`),ie=0;function ae(e,t){return t===`/`||e===t||e.startsWith(t+`/`)}var g=class{registrations=new Map;watch(e,t,n){let r=`fsw-${++ie}`;return this.registrations.set(r,{id:r,basePath:e,filter:t,callback:n}),h.debug(`Watch registered`,{id:r,basePath:e}),()=>{this.registrations.delete(r),h.debug(`Watch unregistered`,{id:r})}}notify(e){if(e.length!==0)for(let[,t]of this.registrations){let n=e.filter(e=>ae(e.path,t.basePath)&&t.filter(e.path));if(n.length>0)try{t.callback(n)}catch(e){h.error(`Watch callback error`,{id:t.id,error:e instanceof Error?e.message:String(e)})}}}dispose(){this.registrations.clear(),h.debug(`All watchers disposed`)}get size(){return this.registrations.size}},_=n(`mount-index`),oe=400,se=2e6,v=`SLICC_MOUNT_INDEX_MAX_DEPTH`,y=`SLICC_MOUNT_INDEX_MAX_ENTRIES`,b=256,x=class extends Error{cause;constructor(e,t){super(e),this.name=`MountIndexAbortError`,this.cause=t}};function S(e){let t=e.map(([e,t])=>`${e}\u0000${t.kind}`).sort(),n=t.length>b?t.slice(0,b):t;return`${t.length}\u0001${n.join(``)}`}async function C(e,t){let n=e.isSameEntry;if(typeof n!=`function`)return!1;try{return await n.call(e,t)}catch{return!1}}function ce(e,t){return e instanceof Map?e.get(t):e[t]}function le(e){let t=e.trim();if(t===``)return;let n=Number(t);if(!(!Number.isInteger(n)||n<=0))return n}function w(e,t,n){let r=ce(e,t);if(r===void 0||r.trim()===``)return n;let i=le(r);return i===void 0?(_.warn(`Ignoring invalid ${t}; expected a positive integer, using default`,{value:r,fallback:n}),n):i}function T(e){return{maxDepth:w(e,v,oe),maxEntries:w(e,y,se),skipNoiseDirs:!0}}var E=class{mounts=new Map;listeners=new Set;registerMount(e,t,n=T({})){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`&&!l(i[e]))&&l(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,_.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 x?r.cause:`indexing-error`;t.state={status:`error`,indexed:0,error:i,abortCause:a},_.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 x(`mount indexing aborted: directory nesting exceeded ${t.limits.maxDepth} levels`,`depth-exceeded`);if(t.directories.size+t.files.size>=t.limits.maxEntries)throw new x(`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 x(`mount indexing aborted: exceeded ${n.limits.maxEntries} entries`,`entries-exceeded`);i.push(e)}return i}async confirmNoCycle(e,t,n,r){let i=S(n),a=r.get(i);if(a){for(let n of a)if(await C(n.handle,t))throw new x(`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&&l(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)))}}},ue=new TextEncoder,D=new TextDecoder(`utf-8`,{fatal:!1}),O=class{entries=new Map;static handles(e){return ee(a(e))}has(e){return this.entries.has(a(e))}write(e,t){let n=a(e),r=typeof t==`string`?ue.encode(t):new Uint8Array(t),i=Date.now(),o=this.entries.get(n);this.entries.set(n,{bytes:r,mtime:i,ctime:o?.ctime??i})}read(e,t){let n=this.require(e);return(t?.encoding??`utf-8`)===`utf-8`?D.decode(n.bytes):new Uint8Array(n.bytes)}readText(e){return D.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(a(e))}require(e){let t=a(e),n=this.entries.get(t);if(!n)throw new d(`ENOENT`,`no such file or directory`,t);return n}},k={[te]:{stat:()=>({type:`file`,size:0,mtime:0,ctime:0}),read:e=>(e?.encoding??`utf-8`)===`utf-8`?``:new Uint8Array,readText:()=>``,write:()=>{}}},A=[`/tmp/`],j=class{ephemeralFds=new O;vfs;allowedPrefixes;readOnlyPrefixes;readGrantPatterns=[];writeEnforcement;includeMounts;constructor(e,t,n=[],r=`hard`,i={}){this.vfs=e;let o=e=>{let t=a(e);return t.endsWith(`/`)?t:t+`/`};this.allowedPrefixes=t.map(o),this.readOnlyPrefixes=n.map(o),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,...A]}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(o(t.slice(0,e).join(`/`)||`/`));this.readGrantPatterns.push({pattern:e,regex:o(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=a(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=a(e),n=this.getAllPrefixes();return this.matchesReadGrant(t)||n.some(e=>t===e.slice(0,-1)||t.startsWith(e))}isWritable(e){let t=a(e);return[...this.allowedPrefixes,...A].some(e=>t===e.slice(0,-1)||t.startsWith(e))}canWrite(e){return O.handles(e)||this.isWritable(e)}checkWrite(e){if(this.writeEnforcement!==`sudo-delegated`&&!this.isWritable(e))throw new d(`EACCES`,`permission denied`,a(e))}async resolveAndCheckRead(e){try{let t=await this.vfs.realpath(e);if(!this.isAllowedStrict(t))throw new d(`ENOENT`,`no such file or directory`,a(e));return t}catch(t){throw t instanceof d?t:new d(`ENOENT`,`no such file or directory`,a(e))}}async resolveAndCheckWrite(e){try{let t=await this.vfs.realpath(e);if(!this.isWritable(t)&&!this.isSymlinkEscapeAllowed(t))throw new d(`EACCES`,`permission denied`,a(e));return t}catch(t){throw t instanceof d?t:new d(`EACCES`,`permission denied`,a(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 d&&e.code===`EACCES`)throw e;return}let i=r+`/`+n;if(this.isWritable(i))return;let o=a(r)!==a(t);if(!(this.writeEnforcement===`sudo-delegated`&&!o))throw new d(`EACCES`,`permission denied`,a(e))}getUnderlyingFS(){return this.vfs}invalidatePaths(e){this.vfs.invalidatePaths(e)}async flush(){await this.vfs.flush()}isPathUnderMount(e){return this.vfs.isPathUnderMount(e)}async readFile(e,t){let n=k[a(e)];if(n)return n.read(t);if(O.handles(e))return this.ephemeralFds.read(e,t);if(!this.isAllowedStrict(e))throw new d(`ENOENT`,`no such file or directory`,a(e));let r=await this.resolveAndCheckRead(e);return this.vfs.readFile(r,t)}async readFileRange(e,t,n){if(!this.isAllowedStrict(e))throw new d(`ENOENT`,`no such file or directory`,a(e));let r=await this.resolveAndCheckRead(e);return this.vfs.readFileRange(r,t,n)}async getNativeFile(e){if(k[a(e)]||O.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=a(e);return r.filter(e=>{let n=t===`/`?`/${e.name}`:`${t}/${e.name}`;return this.isAllowed(n)})}return r}async stat(e){let t=k[a(e)];if(t)return t.stat();if(O.handles(e))return this.ephemeralFds.stat(e);if(!this.isAllowed(e))throw new d(`ENOENT`,`no such file or directory`,a(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=a(e);if(n===`/`)return!1;let r=n.slice(1).split(`/`),i=t?r.length:r.length-1,o=``;for(let e=0;e<i;e++){o=o+`/`+r[e];let t=this.vfs.lstatSync(o);if(t===null)return null;if(t.type===`symlink`)return!0}return!1}statSync(e){let t=k[a(e)];return t?t.stat():O.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=k[a(e)];return t?t.stat():O.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=a(e);return t.filter(e=>{let t=n===`/`?`/${e.name}`:`${n}/${e.name}`;return this.isAllowed(t)})}async realpath(e){if(O.handles(e)){let t=a(e);if(!this.ephemeralFds.has(t))throw new d(`ENOENT`,`no such file or directory`,t);return t}let t;try{t=await this.vfs.realpath(e)}catch(t){throw t instanceof d?t:new d(`ENOENT`,`no such file or directory`,a(e))}if(!this.isAllowedStrict(t))throw new d(`ENOENT`,`no such file or directory`,a(e));return t}async exists(e){if(k[a(e)])return!0;if(O.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=k[a(e)];if(t)return t.readText();if(O.handles(e))return this.ephemeralFds.readText(e);if(!this.isAllowedStrict(e))throw new d(`ENOENT`,`no such file or directory`,a(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=k[a(e)];if(r){r.write(t);return}if(O.handles(e)){this.ephemeralFds.write(e,t);return}this.checkWrite(e),await this.checkParentRealpathEscape(e);try{(await this.vfs.lstat(e)).type===`symlink`&&await this.resolveAndCheckWrite(e)}catch(e){if(e instanceof d&&e.code===`EACCES`)throw e}return this.vfs.writeFile(e,t,n)}refuseDescriptorTreeOp(e){if(O.handles(e))throw new d(`EACCES`,`permission denied`,a(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(O.handles(e)){if(!this.ephemeralFds.remove(e))throw new d(`ENOENT`,`no such file or directory`,a(e));return}this.checkWrite(e);try{(await this.vfs.lstat(e)).type===`symlink`||await this.resolveAndCheckWrite(e)}catch(e){if(e instanceof d&&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(O.handles(e)){let n=this.ephemeralFds.read(e,{encoding:`binary`});await this.writeFile(t,n);return}if(O.handles(t)){if(!this.isAllowed(e))throw new d(`ENOENT`,`no such file or directory`,a(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 d(`ENOENT`,`no such file or directory`,a(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 d&&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 d(`ENOENT`,`no such file or directory`,a(e));let t=await this.vfs.readlink(e),n;if(t.startsWith(`/`))n=a(t);else{let r=this.vfs.dirname(e);n=a(r+`/`+t)}if(!this.isAllowedStrict(n))throw new d(`ENOENT`,`no such file or directory`,a(e));return t}async lstat(e){let t=k[a(e)];if(t)return t.stat();if(O.handles(e))return this.ephemeralFds.stat(e);if(!this.isAllowed(e))throw new d(`ENOENT`,`no such file or directory`,a(e));let n=a(e),r=this.vfs.dirname(n),i=this.vfs.basename(n),o;if(r===n)o=r;else try{o=await this.vfs.realpath(r)}catch{throw new d(`ENOENT`,`no such file or directory`,n)}let s=o===`/`?`/${i}`:`${o}/${i}`;if(!this.isAllowed(s))throw new d(`ENOENT`,`no such file or directory`,n);return this.vfs.lstat(s)}watch(e,t,n){if(!this.isAllowed(e))throw new d(`EACCES`,`permission denied`,a(e));let r=this.vfs.getWatcher();if(!r)throw new d(`EINVAL`,`no watcher configured`);return r.watch(a(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))}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 M(e,t){if(e instanceof d){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 d(e.code,r,t)}throw e}var N=[`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`ENOSYS`,`EOPNOTSUPP`,`EIO`];function P(e,t){if(e instanceof d)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 d(`EIO`,`internal overflow, not storage: ${n} — reload the session`,t)}let n=e?.code;if(typeof n==`string`){let r=n;if(N.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 d(r,n||r,t)}}let r=e instanceof Error?e.message:String(e);return r.includes(`ENOENT`)?new d(`ENOENT`,`no such file or directory`,t):r.includes(`EEXIST`)?new d(`EEXIST`,`file already exists`,t):r.includes(`ENOTDIR`)?new d(`ENOTDIR`,`not a directory`,t):r.includes(`EISDIR`)?new d(`EISDIR`,`is a directory`,t):r.includes(`ENOTEMPTY`)?new d(`ENOTEMPTY`,`directory not empty`,t):r.includes(`ELOOP`)?new d(`ELOOP`,`too many levels of symbolic links`,t):r.includes(`EOPNOTSUPP`)||r.includes(`ENOTSUP`)?new d(`EOPNOTSUPP`,`operation not supported`,t):new d(`EINVAL`,r,t)}var F=61440,I=16384;function L(e){return e===void 0?`absent`:(e&F)===I?`directory`:`file`}function R(e,t){return t===`absent`?!1:e.kind===`missing`||e.kind!==t}function z(e){let t=e?.mode;return typeof t==`number`?t:void 0}function B(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=L(z(r));o!==L(z(i))&&a.push({path:n,ownIsDirectory:o===`directory`})}return a}var V=512,H=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??V}static fromHandle(t,n){return new e(t,n)}getHandle(){return this.handle}assertOpen(e){if(this.closed)throw new d(`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 d(`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 d)return e;if(e instanceof DOMException){if(e.name===`NotFoundError`)return new d(`ENOENT`,`no such file or directory`,t);if(e.name===`TypeMismatchError`)return new d(`ENOTDIR`,`not a directory`,t);if(e.name===`NotAllowedError`)return new d(`EACCES`,`permission denied`,t);if(e.name===`InvalidModificationError`)return new d(`ENOTEMPTY`,`directory not empty`,t)}if(e instanceof Error){if(e.name===`NotFound`||e.name===`NotFoundError`)return new d(`ENOENT`,`no such file or directory`,t);if(e.name===`TypeMismatch`||e.name===`TypeMismatchError`)return new d(`ENOTDIR`,`not a directory`,t);if(e.name===`InvalidModification`||e.name===`InvalidModificationError`)return new d(`ENOTEMPTY`,`directory not empty`,t)}return new d(`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 d(`EINVAL`,`cannot remove mount root`,e);let r=n.pop(),i=await this.resolveDirFrom(n,e,!1);try{await i.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 U(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 W(e,t){return e===t||e.startsWith(t===`/`?`/`:`${t}/`)}var de=`/.metadata.json`;function G(e){return e.entries&&delete e.entries[de],e}function fe(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))W(t,e)&&delete i[t];for(let t of Object.keys(r))W(t,e)&&(i[t]=r[t])}let{entries:a,...o}=t;return G({...o,entries:i})}var pe=61440,K=16384,q=32768,me=40960;async function he(e,t,n){let r={kindFixed:[],sizesFixed:0,dropped:0,selfEntryDropped:!1,inosReassigned:0,nlinksFixed:0,changed:!1},i=e.entries??{};for(let[e,a]of Object.entries(i)){if(n?.(),e===`/`||typeof a!=`object`||!a)continue;if(e===`/.metadata.json`){delete i[e],r.selfEntryDropped=!0,r.changed=!0;continue}let o=a,s=(o.mode??0)&pe;if(s===me){J(o,r);continue}let c=await t(e);if(c.kind===`missing`){delete i[e],r.dropped+=1,r.changed=!0;continue}J(o,r),_e(e,o,s,c,r)}return ge(i,r),r}function ge(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 J(e,t){e.nlink||(e.nlink=1,t.nlinksFixed+=1,t.changed=!0)}function _e(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)}function Y(e){return async t=>{let n=t.split(`/`).filter(Boolean),r=e;for(let e=0;e<n.length-1;e+=1)try{r=await r.getDirectoryHandle(n[e])}catch{return{kind:`missing`}}let i=n[n.length-1];if(i===void 0)return{kind:`directory`};try{return{kind:`file`,size:(await(await r.getFileHandle(i)).getFile()).size}}catch{}try{return await r.getDirectoryHandle(i),{kind:`directory`}}catch{return{kind:`missing`}}}}async function ve(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 ye(e,t){let n;try{let t=await e.getFileHandle(`.metadata.json`),r=JSON.parse(await(await t.getFile()).text());if(!r||typeof r!=`object`||!r.entries)return null;n=r}catch{return null}let r=await he(n,Y(e),t);if(!r.changed)return r;let i=await(await e.getFileHandle(`.metadata.json`,{create:!0})).createWritable();return await i.write(JSON.stringify(n)),await i.close(),r}async function be(e,t,n,r){try{return await e.lstat(t)}catch(e){let t=P(e,r);if(t.code===`ENOENT`&&n)return null;throw t}}async function xe(e,t,n){let i;try{i=await e.readlink(t)}catch(e){throw P(e,n)}return i.startsWith(`/`)?a(i):a(s(r(t).dir,i))}async function Se(e,t,n,r,i,a){let o=t===`/`?`/${n}`:`${t}/${n}`;for(;;){let t=await be(e,o,r,i);if(t===null||!t.isSymbolicLink())return{resolved:o,hops:a};if(++a>10)throw new d(`ELOOP`,`too many symbolic links encountered`,i);o=await xe(e,o,i)}}async function X(e,t,n){let r=a(n);if(t(r))return r;let i=r.split(`/`).filter(Boolean),o=`/`,s=0;for(let t=0;t<i.length;t++){let n=await Se(e,o,i[t],t===i.length-1,r,s);o=n.resolved,s=n.hops}return o}async function Z(e,t,n){return t(n)?n:X(e,t,n)}function Q(){try{if(typeof globalThis.navigator?.storage?.getDirectory==`function`)return`opfs`}catch{}return`memory`}function Ce(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.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 we(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 E;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,i,a){let o=e.opfsBackends.get(n.dbName);if(o&&i)throw new d(`EBUSY`,`Cannot wipe an OPFS backend with live holders`,n.dbName);if(o&&a!==void 0&&o.asyncCache!==a)throw new d(`EBUSY`,`OPFS async cache setting conflicts with the live backend`,n.dbName);let s=r??await e.acquireOpfsHandle(n.dbName,i);await n.withWriteLock(()=>e.seedOpfsMetadataSidecarIfMissing(s));let c=await t(()=>import(`./dist-0AIPb7H_.js`),__vite__mapDeps([0,1,2]));await e.ensureRootMount(c);let l=`/__opfs__/${n.dbName}`,u=e.opfsBackends.get(n.dbName);if(!u){let{resolveOpfsMount:r}=await t(async()=>{let{resolveOpfsMount:e}=await import(`./opfs-mount-C4HqOQiQ.js`);return{resolveOpfsMount:e}},__vite__mapDeps([3,0,1,2])),i=await r({handle:s,dbName:n.dbName,asyncCache:a,onRepairProgress:n.onRepairProgress,withWriteLock:e=>n.withWriteLock(e)});try{c.mount(l,i)}catch{}u={backendFs:i,refs:0,asyncCache:a!==!1,sidecarDirty:{paths:new Set,prefixes:new Set}},e.opfsBackends.set(n.dbName,u)}u.refs+=1,n.opfsBackendFs=u.backendFs.index?u.backendFs:null,n.opfsHandle=s,n.mountRoot=l,n.rawLfs=c.promises,n.rawLfsSync=c}static async initMemoryBackend(n,r,i){let a=await t(()=>import(`./dist-0AIPb7H_.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)),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 d(`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 re().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=fe(e,r,i))}let o=JSON.stringify(G(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=B(e,t,n.paths,n.prefixes);if(i.length===0)return;let a=Y(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 i=e.opfsBackends.get(this.dbName)?.sidecarDirty;if(!i)return;let o=a(t);(n===`prefix`?i.prefixes:i.paths).add(o);let{dir:s}=r(o);for(;s!==`/`;)i.paths.add(s),s=r(s).dir}invalidatePaths(e){if(this.backend!==`opfs`||!this.opfsBackendFs)return;let t=this.opfsBackendFs;for(let n of e){let e=a(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=a(e),i=r;try{i=await this.resolveSymlinks(r)}catch{}let o=await Y(n)(i),s=L(t.index.get(i)?.mode),c=t._handles?.get(i),l=c?.kind===`directory`?`directory`:c?.kind===`file`?`file`:`absent`,u=R(o,s),d=R(o,l);if(!u&&!d)return!1;if(t.index.delete(i),t._handles?.delete(i),s===`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:o.kind,indexHeld:s,handleHeld:l}),!0}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 d(`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-0AIPb7H_.js`),__vite__mapDeps([0,1,2]))).umount(this.mountRoot)}catch{}}}}readDirSync(e){let t=a(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},...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=a(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}}catch{return null}let i=t;for(let e=0;e<=10;e++){let e;try{e=n.lstatSync(i)}catch{return null}if(!e.isSymbolicLink())return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,ino:e.ino};let t;try{t=n.readlinkSync(i)}catch{return null}i=t.startsWith(`/`)?a(t):a(s(r(i).dir,t))}return null}lstatSync(e){let t=a(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}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,ino:e.ino}}catch{return null}}async mount(e,t,n){let i=a(e);if(this.mountPoints.has(i))throw new d(`EEXIST`,`mount point is already mounted`,i);try{if((await this.lstat(i)).type!==`directory`)throw new d(`ENOTDIR`,`mount point must be a directory`,i);if((await this.readDir(i)).length>0)throw new d(`ENOTEMPTY`,`mount point must be empty to avoid shadowing existing files`,i)}catch(e){if(!(e instanceof d)||e.code!==`ENOENT`)throw e}let{dir:o}=r(i);o!==`/`&&await this.mkdir(o,{recursive:!0});try{await this.lfs.mkdir(i)}catch{}if(this.mountPoints.set(i,t),t.kind===`local`){let e=n?.limits??T(n?.env??{});this.mountIndex.registerMount(i,t.getHandle(),e)}let s=we(t,i);try{this.mountSyncChannel?.postMessage({type:`mount`,path:i,descriptor:s})}catch{}if(this.watcher?.notify([{type:`modify`,path:i,entryType:`directory`}]),t.kind!==`hostfs`)try{let e={targetPath:i,descriptor:s,createdAt:Date.now()},n=t.kind===`local`?t.getHandle():void 0;await ne(e,n)}catch{}}async unmount(e){let t=a(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 p(t)}catch{}}async reconstructBackendFromDescriptor(e,n){switch(e.kind){case`local`:{let t=await m(e.idbHandleKey);if(!t)throw Error(`no handle stored for ${e.idbHandleKey}`);return H.fromHandle(t,{mountId:e.mountId})}case`hostfs`:{let{HostFsMountBackend:r}=await t(async()=>{let{HostFsMountBackend:e}=await import(`./backend-hostfs-De2Zrx7a.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-eD6bH6K8.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-eD6bH6K8.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-eD6bH6K8.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=a(e);return this.mountPoints.get(t)??null}async mountInternal(e,t){let n=a(e);if(this.mountPoints.has(n))throw new d(`EEXIST`,`mount point is already mounted`,n);let{dir:i}=r(n);i!==`/`&&await this.mkdir(i,{recursive:!0});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=a(e);if(!this.internalMounts.has(t))throw new d(`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=a(e),r=this.mountPoints.get(n);if(!r)throw new d(`ENOENT`,`not a mount point`,n);let i=await r.refresh(t);return r.kind===`local`&&await this.mountIndex.refreshMount(n,T(t?.env??{})),this.watcher?.notify([{type:`modify`,path:n,entryType:`directory`}]),i}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=a(e),r=this.findMount(n);if(r){if(r.relParts.length===0)throw new d(`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){M(e,n)}}let i=await this.resolveSymlinks(n);try{return(t?.encoding??`utf-8`)===`utf-8`?await this.lfs.readFile(i,{encoding:`utf8`}):await this.lfs.readFile(i)}catch(e){throw P(e,n)}}async readFileRange(e,t,n){let r=a(e);if(!Number.isInteger(t)||!Number.isInteger(n)||t<0||n<t)throw new d(`EINVAL`,`invalid byte range ${t}-${n}`,r);if(t===n)return new Uint8Array;let i=this.findMount(r),o=i?.backend.readFileRange;if(i&&o){if(i.relParts.length===0)throw new d(`EISDIR`,`is a directory`,r);try{return await o.call(i.backend,i.relParts.join(`/`),t,n)}catch(e){M(e,r)}}let s=await this.sliceNativeFile(r,t,n);if(s)return s;let c=await this.readFile(r,{encoding:`binary`});return new Uint8Array(c.subarray(t,Math.min(n,c.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=a(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 U(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 i=a(e),o=this.findMount(i);if(o){if(o.relParts.length===0)throw new d(`EISDIR`,`is a directory`,i);let e=o.relParts.join(`/`),n=!1;try{await this.stat(i),n=!0}catch{}let r=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,r)}catch(e){M(e,i)}this.watcher?.notify([{type:n?`modify`:`create`,path:i,entryType:`file`}]),this.mountIndex.notifyWrite(i);return}let s;try{s=await this.resolveSymlinks(i)}catch{s=i}let c=!1;try{await this.lfs.stat(s),c=!0}catch{}let{dir:l}=r(s);await this.withWriteLock(async()=>{this.markSidecarDirty(s),l!==`/`&&await this.mkdirRecursiveUnlocked(l);let e=typeof t==`string`?new TextEncoder().encode(t).byteLength:(t instanceof Uint8Array,t.byteLength);try{await this.lfs.writeFile(s,t)}catch(e){if(l!==`/`&&e instanceof Error&&e.message.includes(`ENOENT`)){await this.mkdirRecursiveUnlocked(l);try{await this.lfs.writeFile(s,t)}catch(e){throw P(e,i)}}else throw P(e,i)}try{await this.lfs.truncate?.(s,e)}catch(e){throw P(e,i)}}),this.watcher?.notify([{type:c?`modify`:`create`,path:s,entryType:`file`}])}async readDir(e,t){let n=a(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){M(t,e)}let o=new Map,s=t.backend.listingStatsMatchStat===!0;for(let e of a)o.set(e.name,Ce(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 P(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},...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 P(e,r);try{let e=await this.lfs.lstat(r);if(!e.isDirectory()&&!e.isSymbolicLink())throw new d(`ENOTDIR`,`not a directory`,r)}catch(e){if(e instanceof d&&e.code===`ENOTDIR`)throw e}}}return n}async mkdir(e,t){let n=a(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){M(e,n)}t||this.watcher?.notify([{type:`create`,path:n,entryType:`directory`}]);return}if(t?.recursive){let e=await this.withWriteLock(()=>(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()=>{this.markSidecarDirty(n);try{await this.lfs.mkdir(n)}catch(e){throw P(e,n)}}),this.watcher?.notify([{type:`create`,path:n,entryType:`directory`}])}async rm(e,t){return this.withKindMismatchRetry(a(e),()=>this.rmInner(e,t))}async rmInner(e,t){let n=a(e),r=this.findMount(n);if(r){if(r.relParts.length===0)throw new d(`EINVAL`,`cannot remove a mount point — use unmount`,n);let e;try{e=(await this.stat(n)).type}catch{}let i=r.relParts.join(`/`);try{await r.backend.remove(i,{recursive:t?.recursive})}catch(e){M(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()=>{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 P(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=a(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.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){M(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,...typeof e.dev==`number`?{dev:e.dev}:{},uid:e.uid,gid:e.gid,mode:e.mode}}catch(e){throw P(e,t)}}async exists(e){let t=a(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([a(e),a(t)],()=>this.renameInner(e,t))}async renameInner(e,t){let n=a(e),r=a(t);if(n===r)return;let i;try{i=await this.lstat(n)}catch{}let o=i?.type,s=this.findMount(n);if(s?.backend.rename){let e=this.findMount(r);if(e&&e.backend===s.backend){let t=!1;try{t=(await s.backend.rename(s.relParts.join(`/`),e.relParts.join(`/`)))?.noop===!0}catch(e){M(e,n)}t||(this.watcher?.notify([{type:`delete`,path:n,entryType:o},{type:`create`,path:r,entryType:o}]),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()=>{this.markSidecarDirty(n,`prefix`),this.markSidecarDirty(r,`prefix`),await this.lfs.rename(n,r),await this.writeOpfsMetadataSidecarUnlocked()})}catch(e){throw P(e,n)}this.watcher?.notify([{type:`delete`,path:n,entryType:o},{type:`create`,path:r,entryType:o}]),this.mountIndex.notifyRename(n,r)}async readTextFile(e){return await this.readFile(e,{encoding:`utf-8`})}async*walk(e,t,n=0){yield*c({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 d(`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 r(a(e)).dir}basename(e){return r(a(e)).base}async symlink(e,t){let n=a(t);if(this.findMount(n))throw new d(`EINVAL`,`symlinks not supported on mounted filesystems`,n);let{dir:i}=r(n);await this.withWriteLock(async()=>{i!==`/`&&await this.mkdirRecursiveUnlocked(i);try{await this.lfs.symlink(e,n)}catch(t){if(i!==`/`&&t instanceof Error&&t.message.includes(`ENOENT`)){await this.mkdirRecursiveUnlocked(i);try{await this.lfs.symlink(e,n)}catch(e){throw P(e,n)}}else throw P(t,n)}this.markSidecarDirty(n),await this.writeOpfsMetadataSidecarUnlocked()}),this.watcher?.notify([{type:`create`,path:n,entryType:`symlink`}])}async readlink(e){let t=a(e);try{return await this.lfs.readlink(t)}catch(e){throw P(e,t)}}async lstat(e){let t=a(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,...typeof e.dev==`number`?{dev:e.dev}:{},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,...typeof e.dev==`number`?{dev:e.dev}:{},uid:e.uid,gid:e.gid,mode:e.mode}}catch(e){throw P(e,t)}}async realpath(e){return X(this.lfs,e=>this.findMount(e)!==null,e)}resolveSymlinks(e){return Z(this.lfs,e=>this.findMount(e)!==null,e)}},Te=e({FsError:()=>d,FsWatcher:()=>g,MountIndex:()=>E,RestrictedFS:()=>j,VirtualFS:()=>$,joinPath:()=>s,normalizePath:()=>a,pathSegments:()=>i,resolveVfsBackendFromEnv:()=>Q,sameFileIdentity:()=>f,splitPath:()=>r,statsFromDirEntry:()=>u});export{d as FsError,g as FsWatcher,E as MountIndex,j as RestrictedFS,$ as VirtualFS,H as i,s as joinPath,ye as n,a as normalizePath,i as pathSegments,ve as r,Q as resolveVfsBackendFromEnv,f as sameFileIdentity,r as splitPath,u as statsFromDirEntry,Te as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./logger-LESFN7Hj.js";import{a as n,i as r,n as i,r as a,t as o}from"./path-utils-DNJG-zQf.js";import{n as s,t as c}from"./types-Bgy4zvr3.js";import{i as l,r as u,t as d}from"./mount-index-DLLlduW0.js";import{a as f,i as p,n as m,t as h}from"./mount-table-store-DrF_Ifaz.js";import{n as g,t as _}from"./virtual-device-paths-CS5o4QVz.js";import{t as v}from"./same-file-identity-C_JKwIh_.js";import{a as y,i as b,t as x}from"./sidecar-repair-CWpX6fJD.js";function S(e,t,n){return e.size===0||!e.has(n)||!t.isReady(n)?!1:!Array.from(e.keys()).some(e=>e!==n&&e.startsWith(n+`/`))}async function C(e,t){try{return await e(t)}catch{return t}}async function*w(e,t,n,r=0){let a=i(t);if(S(e.mountPoints,e.mountIndex,a)){let t=e.mountIndex.getFiles(a);if(t){for(let e of t)yield e;return}}let o=n??new Set;if(r>64||o.size>=1e5)return;let s=await C(t=>e.realpath(t),a);if(o.has(s))return;o.add(s);let c=await e.readDir(a);for(let t of c)yield*T(e,t,a===`/`?`/${t.name}`:`${a}/${t.name}`,o,r+1)}async function*T(e,t,n,r,i){if(t.type===`file`){yield n;return}if(t.type===`symlink`){yield*E(e,n,r,i);return}yield*w(e,n,r,i)}async function*E(e,t,n,r){try{let i=await e.stat(t);i.type===`file`?yield t:i.type===`directory`&&(yield*w(e,t,n,r))}catch{}}const D=t(`fs-watcher`);let O=0;function k(e,t){return t===`/`||e===t||e.startsWith(t+`/`)}var A=class{registrations=new Map;watch(e,t,n){let r=`fsw-${++O}`;return this.registrations.set(r,{id:r,basePath:e,filter:t,callback:n}),D.debug(`Watch registered`,{id:r,basePath:e}),()=>{this.registrations.delete(r),D.debug(`Watch unregistered`,{id:r})}}notify(e){if(e.length!==0)for(let[,t]of this.registrations){let n=e.filter(e=>k(e.path,t.basePath)&&t.filter(e.path));if(n.length>0)try{t.callback(n)}catch(e){D.error(`Watch callback error`,{id:t.id,error:e instanceof Error?e.message:String(e)})}}}dispose(){this.registrations.clear(),D.debug(`All watchers disposed`)}get size(){return this.registrations.size}};const j=new TextEncoder,M=new TextDecoder(`utf-8`,{fatal:!1});var N=class{entries=new Map;static handles(e){return g(i(e))}has(e){return this.entries.has(i(e))}write(e,t){let n=i(e),r=typeof t==`string`?j.encode(t):new Uint8Array(t),a=Date.now(),o=this.entries.get(n);this.entries.set(n,{bytes:r,mtime:a,ctime:o?.ctime??a})}read(e,t){let n=this.require(e);return(t?.encoding??`utf-8`)===`utf-8`?M.decode(n.bytes):new Uint8Array(n.bytes)}readText(e){return M.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(i(e))}require(e){let t=i(e),n=this.entries.get(t);if(!n)throw new c(`ENOENT`,`no such file or directory`,t);return n}};const P={[_]:{stat:()=>({type:`file`,size:0,mtime:0,ctime:0}),read:e=>(e?.encoding??`utf-8`)===`utf-8`?``:new Uint8Array,readText:()=>``,write:()=>{}}},F=[`/tmp/`];var I=class{ephemeralFds=new N;vfs;allowedPrefixes;readOnlyPrefixes;readGrantPatterns=[];writeEnforcement;includeMounts;constructor(e,t,n=[],r=`hard`,a={}){this.vfs=e;let o=e=>{let t=i(e);return t.endsWith(`/`)?t:t+`/`};this.allowedPrefixes=t.map(o),this.readOnlyPrefixes=n.map(o),this.writeEnforcement=r,this.includeMounts=a.includeMounts!==!1}getAllPrefixes(){let e=this.includeMounts?this.vfs.listMounts().map(e=>e.endsWith(`/`)?e:e+`/`):[];return[...this.allowedPrefixes,...this.readOnlyPrefixes,...e,...F]}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(a(t.slice(0,e).join(`/`)||`/`));this.readGrantPatterns.push({pattern:e,regex:a(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=i(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=i(e),n=this.getAllPrefixes();return this.matchesReadGrant(t)||n.some(e=>t===e.slice(0,-1)||t.startsWith(e))}isWritable(e){let t=i(e);return[...this.allowedPrefixes,...F].some(e=>t===e.slice(0,-1)||t.startsWith(e))}canWrite(e){return N.handles(e)||this.isWritable(e)}checkWrite(e){if(this.writeEnforcement!==`sudo-delegated`&&!this.isWritable(e))throw new c(`EACCES`,`permission denied`,i(e))}async resolveAndCheckRead(e){try{let t=await this.vfs.realpath(e);if(!this.isAllowedStrict(t))throw new c(`ENOENT`,`no such file or directory`,i(e));return t}catch(t){throw t instanceof c?t:new c(`ENOENT`,`no such file or directory`,i(e))}}async resolveAndCheckWrite(e){try{let t=await this.vfs.realpath(e);if(!this.isWritable(t)&&!this.isSymlinkEscapeAllowed(t))throw new c(`EACCES`,`permission denied`,i(e));return t}catch(t){throw t instanceof c?t:new c(`EACCES`,`permission denied`,i(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 c&&e.code===`EACCES`)throw e;return}let a=r+`/`+n;if(this.isWritable(a))return;let o=i(r)!==i(t);if(!(this.writeEnforcement===`sudo-delegated`&&!o))throw new c(`EACCES`,`permission denied`,i(e))}getUnderlyingFS(){return this.vfs}invalidatePaths(e){this.vfs.invalidatePaths(e)}async flush(){await this.vfs.flush()}isPathUnderMount(e){return this.vfs.isPathUnderMount(e)}async readFile(e,t){let n=P[i(e)];if(n)return n.read(t);if(N.handles(e))return this.ephemeralFds.read(e,t);if(!this.isAllowedStrict(e))throw new c(`ENOENT`,`no such file or directory`,i(e));let r=await this.resolveAndCheckRead(e);return this.vfs.readFile(r,t)}async readFileRange(e,t,n){if(!this.isAllowedStrict(e))throw new c(`ENOENT`,`no such file or directory`,i(e));let r=await this.resolveAndCheckRead(e);return this.vfs.readFileRange(r,t,n)}async getNativeFile(e){if(P[i(e)]||N.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=i(e);return r.filter(e=>{let n=t===`/`?`/${e.name}`:`${t}/${e.name}`;return this.isAllowed(n)})}return r}async stat(e){let t=P[i(e)];if(t)return t.stat();if(N.handles(e))return this.ephemeralFds.stat(e);if(!this.isAllowed(e))throw new c(`ENOENT`,`no such file or directory`,i(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=i(e);if(n===`/`)return!1;let r=n.slice(1).split(`/`),a=t?r.length:r.length-1,o=``;for(let e=0;e<a;e++){o=o+`/`+r[e];let t=this.vfs.lstatSync(o);if(t===null)return null;if(t.type===`symlink`)return!0}return!1}statSync(e){let t=P[i(e)];return t?t.stat():N.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=P[i(e)];return t?t.stat():N.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=i(e);return t.filter(e=>{let t=n===`/`?`/${e.name}`:`${n}/${e.name}`;return this.isAllowed(t)})}async realpath(e){if(N.handles(e)){let t=i(e);if(!this.ephemeralFds.has(t))throw new c(`ENOENT`,`no such file or directory`,t);return t}let t;try{t=await this.vfs.realpath(e)}catch(t){throw t instanceof c?t:new c(`ENOENT`,`no such file or directory`,i(e))}if(!this.isAllowedStrict(t))throw new c(`ENOENT`,`no such file or directory`,i(e));return t}async exists(e){if(P[i(e)])return!0;if(N.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=P[i(e)];if(t)return t.readText();if(N.handles(e))return this.ephemeralFds.readText(e);if(!this.isAllowedStrict(e))throw new c(`ENOENT`,`no such file or directory`,i(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=P[i(e)];if(r){r.write(t);return}if(N.handles(e)){this.ephemeralFds.write(e,t);return}this.checkWrite(e),await this.checkParentRealpathEscape(e);try{(await this.vfs.lstat(e)).type===`symlink`&&await this.resolveAndCheckWrite(e)}catch(e){if(e instanceof c&&e.code===`EACCES`)throw e}return this.vfs.writeFile(e,t,n)}refuseDescriptorTreeOp(e){if(N.handles(e))throw new c(`EACCES`,`permission denied`,i(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(N.handles(e)){if(!this.ephemeralFds.remove(e))throw new c(`ENOENT`,`no such file or directory`,i(e));return}this.checkWrite(e);try{(await this.vfs.lstat(e)).type===`symlink`||await this.resolveAndCheckWrite(e)}catch(e){if(e instanceof c&&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(N.handles(e)){let n=this.ephemeralFds.read(e,{encoding:`binary`});await this.writeFile(t,n);return}if(N.handles(t)){if(!this.isAllowed(e))throw new c(`ENOENT`,`no such file or directory`,i(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 c(`ENOENT`,`no such file or directory`,i(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 c&&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 c(`ENOENT`,`no such file or directory`,i(e));let t=await this.vfs.readlink(e),n;if(t.startsWith(`/`))n=i(t);else{let r=this.vfs.dirname(e);n=i(r+`/`+t)}if(!this.isAllowedStrict(n))throw new c(`ENOENT`,`no such file or directory`,i(e));return t}async lstat(e){let t=P[i(e)];if(t)return t.stat();if(N.handles(e))return this.ephemeralFds.stat(e);if(!this.isAllowed(e))throw new c(`ENOENT`,`no such file or directory`,i(e));let n=i(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 c(`ENOENT`,`no such file or directory`,n)}let s=o===`/`?`/${a}`:`${o}/${a}`;if(!this.isAllowed(s))throw new c(`ENOENT`,`no such file or directory`,n);return this.vfs.lstat(s)}watch(e,t,n){if(!this.isAllowed(e))throw new c(`EACCES`,`permission denied`,i(e));let r=this.vfs.getWatcher();if(!r)throw new c(`EINVAL`,`no watcher configured`);return r.watch(i(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))}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 L(e,t){if(e instanceof c){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 c(e.code,r,t)}throw e}const R=[`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`ENOSYS`,`EOPNOTSUPP`,`EIO`];function z(e,t){if(e instanceof c)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 c(`EIO`,`internal overflow, not storage: ${n} — reload the session`,t)}let n=e?.code;if(typeof n==`string`){let r=n;if(R.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 c(r,n||r,t)}}let r=e instanceof Error?e.message:String(e);return r.includes(`ENOENT`)?new c(`ENOENT`,`no such file or directory`,t):r.includes(`EEXIST`)?new c(`EEXIST`,`file already exists`,t):r.includes(`ENOTDIR`)?new c(`ENOTDIR`,`not a directory`,t):r.includes(`EISDIR`)?new c(`EISDIR`,`is a directory`,t):r.includes(`ENOTEMPTY`)?new c(`ENOTEMPTY`,`directory not empty`,t):r.includes(`ELOOP`)?new c(`ELOOP`,`too many levels of symbolic links`,t):r.includes(`EOPNOTSUPP`)||r.includes(`ENOTSUP`)?new c(`EOPNOTSUPP`,`operation not supported`,t):new c(`EINVAL`,r,t)}function B(e){return e===void 0?`absent`:(e&61440)==16384?`directory`:`file`}function V(e,t){return t===`absent`?!1:e.kind===`missing`||e.kind!==t}function H(e){let t=e?.mode;return typeof t==`number`?t:void 0}function U(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=B(H(r));o!==B(H(i))&&a.push({path:n,ownIsDirectory:o===`directory`})}return a}async function W(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}}async function G(e,t,n,r){try{return await e.lstat(t)}catch(e){let t=z(e,r);if(t.code===`ENOENT`&&n)return null;throw t}}async function K(e,t,r){let a;try{a=await e.readlink(t)}catch(e){throw z(e,r)}return a.startsWith(`/`)?i(a):i(o(n(t).dir,a))}async function q(e,t,n,r,i,a){let o=t===`/`?`/${n}`:`${t}/${n}`;for(;;){let t=await G(e,o,r,i);if(t===null||!t.isSymbolicLink())return{resolved:o,hops:a};if(++a>10)throw new c(`ELOOP`,`too many symbolic links encountered`,i);o=await K(e,o,i)}}async function J(e,t,n){let r=i(n);if(t(r))return r;let a=r.split(`/`).filter(Boolean),o=`/`,s=0;for(let t=0;t<a.length;t++){let n=await q(e,o,a[t],t===a.length-1,r,s);o=n.resolved,s=n.hops}return o}async function Y(e,t,n){return t(n)?n:J(e,t,n)}function X(){try{if(typeof globalThis.navigator?.storage?.getDirectory==`function`)return`opfs`}catch{}return`memory`}function Z(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.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 Q(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 d;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(t,n,r,i){let a=e.opfsBackends.get(t.dbName);if(a&&r)throw new c(`EBUSY`,`Cannot wipe an OPFS backend with live holders`,t.dbName);if(a&&i!==void 0&&a.asyncCache!==i)throw new c(`EBUSY`,`OPFS async cache setting conflicts with the live backend`,t.dbName);let o=n??await e.acquireOpfsHandle(t.dbName,r);await t.withWriteLock(()=>e.seedOpfsMetadataSidecarIfMissing(o));let s=await import(`./dist-xOOa94QU.js`);await e.ensureRootMount(s);let l=`/__opfs__/${t.dbName}`,u=e.opfsBackends.get(t.dbName);if(!u){let{resolveOpfsMount:n}=await import(`./opfs-mount-BdgSw31f.js`),r=await n({handle:o,dbName:t.dbName,asyncCache:i,onRepairProgress:t.onRepairProgress,withWriteLock:e=>t.withWriteLock(e)});try{s.mount(l,r)}catch{}u={backendFs:r,refs:0,asyncCache:i!==!1,sidecarDirty:{paths:new Set,prefixes:new Set}},e.opfsBackends.set(t.dbName,u)}u.refs+=1,t.opfsBackendFs=u.backendFs.index?u.backendFs:null,t.opfsHandle=o,t.mountRoot=l,t.rawLfs=s.promises,t.rawLfsSync=s}static async initMemoryBackend(t,n,r){let i=await import(`./dist-xOOa94QU.js`);await e.ensureRootMount(i);let a=`/__zenfs__/${n}`,o=e.memoryBackends.get(n);if(o&&r){try{i.umount(a)}catch{}e.memoryBackends.delete(n),o=void 0}o||(o={store:i.InMemory.create({label:n}),refs:0},e.memoryBackends.set(n,o)),o.refs+=1;try{i.mount(a,o.store)}catch{}t.mountRoot=a,t.rawLfs=i.promises,t.rawLfsSync=i,t.opfsBackendFs=null,t.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)),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 c(`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??X(),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 h().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=b(e,r,i))}let o=JSON.stringify(y(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=U(e,t,n.paths,n.prefixes);if(i.length===0)return;let a=x(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,r=`path`){if(this.backend!==`opfs`)return;let a=e.opfsBackends.get(this.dbName)?.sidecarDirty;if(!a)return;let o=i(t);(r===`prefix`?a.prefixes:a.paths).add(o);let{dir:s}=n(o);for(;s!==`/`;)a.paths.add(s),s=n(s).dir}invalidatePaths(e){if(this.backend!==`opfs`||!this.opfsBackendFs)return;let t=this.opfsBackendFs;for(let n of e){let e=i(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=i(e),a=r;try{a=await this.resolveSymlinks(r)}catch{}let o=await x(n)(a),s=B(t.index.get(a)?.mode),c=t._handles?.get(a),l=c?.kind===`directory`?`directory`:c?.kind===`file`?`file`:`absent`,u=V(o,s),d=V(o,l);if(!u&&!d)return!1;if(t.index.delete(a),t._handles?.delete(a),s===`directory`||l===`directory`){let e=`${a}/`;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(a),console.warn(`[virtual-fs] reconciled in-memory kind mismatch (#2006)`,{path:a,reality:o.kind,indexHeld:s,handleHeld:l}),!0}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 c(`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 t=this.backend===`opfs`?e.opfsBackends:e.memoryBackends,n=t.get(this.dbName);if(n&&(--n.refs,n.refs<=0)){t.delete(this.dbName);try{(await import(`./dist-xOOa94QU.js`)).umount(this.mountRoot)}catch{}}}}readDirSync(e){let t=i(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},...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=i(e);if(this.findMount(t))return null;let r=this.lfsSync;if(typeof r.statSync!=`function`||typeof r.lstatSync!=`function`||typeof r.readlinkSync!=`function`)return null;if(t===`/`)try{let e=r.statSync(t);return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,ino:e.ino}}catch{return null}let a=t;for(let e=0;e<=10;e++){let e;try{e=r.lstatSync(a)}catch{return null}if(!e.isSymbolicLink())return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,ino:e.ino};let t;try{t=r.readlinkSync(a)}catch{return null}a=t.startsWith(`/`)?i(t):i(o(n(a).dir,t))}return null}lstatSync(e){let t=i(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}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs,ino:e.ino}}catch{return null}}async mount(e,t,r){let a=i(e);if(this.mountPoints.has(a))throw new c(`EEXIST`,`mount point is already mounted`,a);try{if((await this.lstat(a)).type!==`directory`)throw new c(`ENOTDIR`,`mount point must be a directory`,a);if((await this.readDir(a)).length>0)throw new c(`ENOTEMPTY`,`mount point must be empty to avoid shadowing existing files`,a)}catch(e){if(!(e instanceof c)||e.code!==`ENOENT`)throw e}let{dir:o}=n(a);o!==`/`&&await this.mkdir(o,{recursive:!0});try{await this.lfs.mkdir(a)}catch{}if(this.mountPoints.set(a,t),t.kind===`local`){let e=r?.limits??u(r?.env??{});this.mountIndex.registerMount(a,t.getHandle(),e)}let s=Q(t,a);try{this.mountSyncChannel?.postMessage({type:`mount`,path:a,descriptor:s})}catch{}if(this.watcher?.notify([{type:`modify`,path:a,entryType:`directory`}]),t.kind!==`hostfs`)try{let e={targetPath:a,descriptor:s,createdAt:Date.now()},n=t.kind===`local`?t.getHandle():void 0;await f(e,n)}catch{}}async unmount(e){let t=i(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 p(t)}catch{}}async reconstructBackendFromDescriptor(e,t){switch(e.kind){case`local`:{let t=await m(e.idbHandleKey);if(!t)throw Error(`no handle stored for ${e.idbHandleKey}`);return l.fromHandle(t,{mountId:e.mountId})}case`hostfs`:{let{HostFsMountBackend:n}=await import(`./backend-hostfs-n_0O1LVt.js`);return new n({targetPath:t,hostPath:e.hostPath,mountId:e.mountId})}case`s3`:{let{S3MountBackend:t,RemoteMountCache:n,makeSignedFetchS3:r}=await import(`./mount-BsWlp4Ng.js`).then(e=>e.t),i=new n({mountId:e.mountId,ttlMs:3e4});return new t({source:e.source,profile:e.profile,cache:i,mountId:e.mountId,signedFetch:r(e.profile)})}case`da`:{let{DaMountBackend:t,RemoteMountCache:n,makeSignedFetchDa:r}=await import(`./mount-BsWlp4Ng.js`).then(e=>e.t),i=new n({mountId:e.mountId,ttlMs:3e4});return new t({source:e.source,profile:e.profile,cache:i,mountId:e.mountId,signedFetch:r()})}case`aem`:{let{AemMountBackend:t,RemoteMountCache:n,makeSignedFetchDa:r}=await import(`./mount-BsWlp4Ng.js`).then(e=>e.t),i=new n({mountId:e.mountId,ttlMs:3e4});return new t({source:e.source,profile:e.profile,cache:i,mountId:e.mountId,signedFetch:r()})}}}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=i(e);return this.mountPoints.get(t)??null}async mountInternal(e,t){let r=i(e);if(this.mountPoints.has(r))throw new c(`EEXIST`,`mount point is already mounted`,r);let{dir:a}=n(r);a!==`/`&&await this.mkdir(a,{recursive:!0});try{await this.lfs.mkdir(r)}catch{}this.mountPoints.set(r,t),this.internalMounts.add(r),this.watcher?.notify([{type:`modify`,path:r,entryType:`directory`}])}async unmountInternal(e){let t=i(e);if(!this.internalMounts.has(t))throw new c(`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=i(e),r=this.mountPoints.get(n);if(!r)throw new c(`ENOENT`,`not a mount point`,n);let a=await r.refresh(t);return r.kind===`local`&&await this.mountIndex.refreshMount(n,u(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=i(e),r=this.findMount(n);if(r){if(r.relParts.length===0)throw new c(`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){L(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 z(e,n)}}async readFileRange(e,t,n){let r=i(e);if(!Number.isInteger(t)||!Number.isInteger(n)||t<0||n<t)throw new c(`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 c(`EISDIR`,`is a directory`,r);try{return await o.call(a.backend,a.relParts.join(`/`),t,n)}catch(e){L(e,r)}}let s=await this.sliceNativeFile(r,t,n);if(s)return s;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=i(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 W(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,r){let a=i(e),o=this.findMount(a);if(o){if(o.relParts.length===0)throw new c(`EISDIR`,`is a directory`,a);let e=o.relParts.join(`/`),n=!1;try{await this.stat(a),n=!0}catch{}let r=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,r)}catch(e){L(e,a)}this.watcher?.notify([{type:n?`modify`:`create`,path:a,entryType:`file`}]),this.mountIndex.notifyWrite(a);return}let s;try{s=await this.resolveSymlinks(a)}catch{s=a}let l=!1;try{await this.lfs.stat(s),l=!0}catch{}let{dir:u}=n(s);await this.withWriteLock(async()=>{this.markSidecarDirty(s),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(s,t)}catch(e){if(u!==`/`&&e instanceof Error&&e.message.includes(`ENOENT`)){await this.mkdirRecursiveUnlocked(u);try{await this.lfs.writeFile(s,t)}catch(e){throw z(e,a)}}else throw z(e,a)}try{await this.lfs.truncate?.(s,e)}catch(e){throw z(e,a)}}),this.watcher?.notify([{type:l?`modify`:`create`,path:s,entryType:`file`}])}async readDir(e,t){let n=i(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){L(t,e)}let o=new Map,s=t.backend.listingStatsMatchStat===!0;for(let e of a)o.set(e.name,Z(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 z(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},...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 z(e,r);try{let e=await this.lfs.lstat(r);if(!e.isDirectory()&&!e.isSymbolicLink())throw new c(`ENOTDIR`,`not a directory`,r)}catch(e){if(e instanceof c&&e.code===`ENOTDIR`)throw e}}}return n}async mkdir(e,t){let n=i(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){L(e,n)}t||this.watcher?.notify([{type:`create`,path:n,entryType:`directory`}]);return}if(t?.recursive){let e=await this.withWriteLock(()=>(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()=>{this.markSidecarDirty(n);try{await this.lfs.mkdir(n)}catch(e){throw z(e,n)}}),this.watcher?.notify([{type:`create`,path:n,entryType:`directory`}])}async rm(e,t){return this.withKindMismatchRetry(i(e),()=>this.rmInner(e,t))}async rmInner(e,t){let n=i(e),r=this.findMount(n);if(r){if(r.relParts.length===0)throw new c(`EINVAL`,`cannot remove a mount point — use unmount`,n);let e;try{e=(await this.stat(n)).type}catch{}let i=r.relParts.join(`/`);try{await r.backend.remove(i,{recursive:t?.recursive})}catch(e){L(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()=>{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 z(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=i(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.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){L(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,...typeof e.dev==`number`?{dev:e.dev}:{},uid:e.uid,gid:e.gid,mode:e.mode}}catch(e){throw z(e,t)}}async exists(e){let t=i(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([i(e),i(t)],()=>this.renameInner(e,t))}async renameInner(e,t){let n=i(e),r=i(t);if(n===r)return;let a;try{a=await this.lstat(n)}catch{}let o=a?.type,s=this.findMount(n);if(s?.backend.rename){let e=this.findMount(r);if(e&&e.backend===s.backend){let t=!1;try{t=(await s.backend.rename(s.relParts.join(`/`),e.relParts.join(`/`)))?.noop===!0}catch(e){L(e,n)}t||(this.watcher?.notify([{type:`delete`,path:n,entryType:o},{type:`create`,path:r,entryType:o}]),this.mountIndex.notifyRename(n,r));return}}if(a)try{let e=await this.lstat(r);if(v(a,e))return}catch{}try{await this.withWriteLock(async()=>{this.markSidecarDirty(n,`prefix`),this.markSidecarDirty(r,`prefix`),await this.lfs.rename(n,r),await this.writeOpfsMetadataSidecarUnlocked()})}catch(e){throw z(e,n)}this.watcher?.notify([{type:`delete`,path:n,entryType:o},{type:`create`,path:r,entryType:o}]),this.mountIndex.notifyRename(n,r)}async readTextFile(e){return await this.readFile(e,{encoding:`utf-8`})}async*walk(e,t,n=0){yield*w({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 c(`EISDIR`,`is a directory`,e);try{let e=await this.stat(t);if(v(n,e))return}catch{}let r=await this.readFile(e,{encoding:`binary`});await this.writeFile(t,r)}dirname(e){return n(i(e)).dir}basename(e){return n(i(e)).base}async symlink(e,t){let r=i(t);if(this.findMount(r))throw new c(`EINVAL`,`symlinks not supported on mounted filesystems`,r);let{dir:a}=n(r);await this.withWriteLock(async()=>{a!==`/`&&await this.mkdirRecursiveUnlocked(a);try{await this.lfs.symlink(e,r)}catch(t){if(a!==`/`&&t instanceof Error&&t.message.includes(`ENOENT`)){await this.mkdirRecursiveUnlocked(a);try{await this.lfs.symlink(e,r)}catch(e){throw z(e,r)}}else throw z(t,r)}this.markSidecarDirty(r),await this.writeOpfsMetadataSidecarUnlocked()}),this.watcher?.notify([{type:`create`,path:r,entryType:`symlink`}])}async readlink(e){let t=i(e);try{return await this.lfs.readlink(t)}catch(e){throw z(e,t)}}async lstat(e){let t=i(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,...typeof e.dev==`number`?{dev:e.dev}:{},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,...typeof e.dev==`number`?{dev:e.dev}:{},uid:e.uid,gid:e.gid,mode:e.mode}}catch(e){throw z(e,t)}}async realpath(e){return J(this.lfs,e=>this.findMount(e)!==null,e)}resolveSymlinks(e){return Y(this.lfs,e=>this.findMount(e)!==null,e)}},ee=e({FsError:()=>c,FsWatcher:()=>A,MountIndex:()=>d,RestrictedFS:()=>I,VirtualFS:()=>$,joinPath:()=>o,normalizePath:()=>i,pathSegments:()=>r,resolveVfsBackendFromEnv:()=>X,sameFileIdentity:()=>v,splitPath:()=>n,statsFromDirEntry:()=>s});export{A as i,$ as n,I as r,ee as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./logger-LESFN7Hj.js";import"./account-store-CSIzWxmB.js";import"./core-DP-MJcag.js";import"./tray-runtime-config-CRZxBChd.js";e(`provider-settings`);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./provider-Olg-xwpR.js";export{e as readMcpAuthEntries};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./store-BrTdyYCw.js";export{e as readMcpAuthEntries};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const e=/^-R$|^--recursive$|^-v$|^--verbose$|^-[Rv]+$/;function t(e){return/^[0-7]+$/.test(e)||/^([ugoa]*[+\-=][rwxXst]*)(,([ugoa]*[+\-=][rwxXst]*))*$/.test(e)}function n(e,t){return/^[0-7]+$/.test(e)?parseInt(e,8):/x/i.test(e)&&!e.includes(`-`)?t|73:t}async function r(e,t,r){let i=e.fs.resolvePath(e.cwd,t),a=await e.fs.stat(i);await e.fs.chmod(i,n(r,a.mode))}async function i(n,i){let a=[],o=!1,s=!1;for(let t of n){if(!s&&t===`--`){s=!0;continue}if(!s&&t===`--help`){o=!0;continue}!s&&e.test(t)||a.push(t)}if(o)return{stdout:`Usage: chmod [OPTION]... MODE FILE...
|
|
2
|
-
Change the mode of each FILE to MODE.
|
|
3
|
-
|
|
4
|
-
-R, --recursive change files and directories recursively
|
|
5
|
-
-v, --verbose output a diagnostic for every file processed
|
|
6
|
-
--help display this help and exit
|
|
7
|
-
|
|
8
|
-
This VFS does not store permission bits. chmod exits non-zero with
|
|
9
|
-
EOPNOTSUPP rather than succeeding as a no-op. Run scripts with their
|
|
10
|
-
interpreter (e.g. bash FILE); ./FILE cannot work.
|
|
11
|
-
`,stderr:``,exitCode:0};let c=a[0],l=a.slice(1);if(!c||l.length===0)return{stdout:``,stderr:`chmod: missing operand
|
|
12
|
-
`,exitCode:1};if(!t(c))return{stdout:``,stderr:`chmod: invalid mode: '${c}'\n`,exitCode:1};let u=[];for(let e of l)try{await r(i,e,c)}catch(t){let n=t instanceof Error?t.message:String(t);u.push(`chmod: ${e}: ${n}`)}return{stdout:``,stderr:u.length===0?``:`${u.join(`
|
|
13
|
-
`)}\n`,exitCode:u.length===0?0:1}}export{i as runChmod};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e,t){return typeof e.ino!=`number`||e.ino<=0||e.ino!==t.ino?!1:e.dev===void 0&&t.dev===void 0?!0:typeof e.dev!=`number`||typeof t.dev!=`number`?!1:e.dev===t.dev}export{e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(){return{version:`6.157.2`,releasedAt:`2026-09-15T22:00:10Z`,buildId:`6.157.2-mu37ti6m`}}let t=null;function n(e){t=e}function r(){return t}export{e as n,n as r,r as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(e){if(e.type!==`symlink`&&e.size!==void 0&&e.mtime!==void 0)return{type:e.type,size:e.size,mtime:e.mtime,ctime:e.ctime??e.mtime,...e.ino===void 0?{}:{ino:e.ino},...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}}}var t=class extends Error{code;path;constructor(e,t,n){super(`${e}: ${t}${n?` '${n}'`:``}`),this.code=e,this.path=n,this.name=`FsError`}};export{e as n,t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./wc-onboarding-DUNMmoBo.js";export{e as hasOnboardingFinalLickInHistory};
|