sliccy 6.98.0 → 6.99.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/ui/.vite/manifest.json +145 -145
  2. package/dist/ui/assets/{SKILL-Ckg2XbSL.js → SKILL-BTVvFyRd.js} +3 -0
  3. package/dist/ui/assets/{SKILL-BdkyF8EU.js → SKILL-BpeW5CoS.js} +34 -0
  4. package/dist/ui/assets/{account-store-Cf8iMGfy.js → account-store-PGhT8u8K.js} +1 -1
  5. package/dist/ui/assets/{account-store-D7g1Bdw8.js → account-store-UhvCpVi5.js} +1 -1
  6. package/dist/ui/assets/{adobe-DNNUBh3x.js → adobe-B0t9xpao.js} +1 -1
  7. package/dist/ui/assets/{adobe-DtJvQwHY.js → adobe-CbQx7GGT.js} +1 -1
  8. package/dist/ui/assets/{apply-layout-BgzN8gol.js → apply-layout-DesK_rTC.js} +1 -1
  9. package/dist/ui/assets/{apps-Dn7sapm-.js → apps-D-cDcEBd.js} +1 -1
  10. package/dist/ui/assets/{azure-openai-DR5cxGbz.js → azure-openai-tjg_Jac-.js} +1 -1
  11. package/dist/ui/assets/{azure-openai-CzONySQD.js → azure-openai-tx7uteql.js} +1 -1
  12. package/dist/ui/assets/{cerebras-BHX1SLU8.js → cerebras-DHTBGb5d.js} +1 -1
  13. package/dist/ui/assets/{cerebras-DAlr-AJ6.js → cerebras-E43VFxsv.js} +1 -1
  14. package/dist/ui/assets/{connect-surface-DIQx0XOT.js → connect-surface-DBraaKfB.js} +1 -1
  15. package/dist/ui/assets/fs-5TZPzTFc.js +1 -0
  16. package/dist/ui/assets/fs-fHIHSoGm.js +2 -0
  17. package/dist/ui/assets/{github-CpDaopVL.js → github-CW-SPSdU.js} +2 -2
  18. package/dist/ui/assets/{github-copilot-afm1DP6J.js → github-copilot-B2uCXhTH.js} +1 -1
  19. package/dist/ui/assets/{github-copilot-Ae4je0Hg.js → github-copilot-DmnUQ1GA.js} +1 -1
  20. package/dist/ui/assets/{github-install-B6XHf3XU.js → github-install-oNYELWrF.js} +1 -1
  21. package/dist/ui/assets/{github-C7f4ESNS.js → github-olMzIeFS.js} +1 -1
  22. package/dist/ui/assets/{github-zip-DkCz9CrP.js → github-zip-D48f7PNt.js} +1 -1
  23. package/dist/ui/assets/{js-realm-worker-C311zKaM.js → js-realm-worker-BXYcQvVa.js} +1 -1
  24. package/dist/ui/assets/{kernel-worker-CHKPxEsu.js → kernel-worker-CDlC4Khp.js} +434 -434
  25. package/dist/ui/assets/{local-llm-ABJVsqSc.js → local-llm-Da-S9Rwh.js} +1 -1
  26. package/dist/ui/assets/{local-llm-ylsnVaPg.js → local-llm-yAuiAi8x.js} +1 -1
  27. package/dist/ui/assets/{main-LJJqhB-c.js → main-CjVUpZQF.js} +3 -3
  28. package/dist/ui/assets/{mount-Cf2lkfPp.js → mount-CElAhSXQ.js} +2 -2
  29. package/dist/ui/assets/{mount-Dd6uEK1p.js → mount-NuIgZQ5K.js} +1 -1
  30. package/dist/ui/assets/{mount-recovery-BW8WjTzp.js → mount-recovery-CPdlB14n.js} +1 -1
  31. package/dist/ui/assets/{new-session-D46qc6CQ.js → new-session-CzJbuo5H.js} +2 -2
  32. package/dist/ui/assets/{oauth-bootstrap-D_QEYd93.js → oauth-bootstrap-CyJ1t1fx.js} +2 -2
  33. package/dist/ui/assets/{openai-codex-CrdgZRxg.js → openai-codex-B-dbXWiv.js} +1 -1
  34. package/dist/ui/assets/{openai-codex-pSHshocD.js → openai-codex-s9z4Oe5H.js} +1 -1
  35. package/dist/ui/assets/{openrouter-DIz0uTW5.js → openrouter-BYtnhBPk.js} +1 -1
  36. package/dist/ui/assets/{openrouter-xp0po2aT.js → openrouter-JAWMEkX8.js} +1 -1
  37. package/dist/ui/assets/{openrouter-oauth-B7f9kR7g.js → openrouter-oauth-B2dqDEOw.js} +1 -1
  38. package/dist/ui/assets/{openrouter-oauth-3AYglM6P.js → openrouter-oauth-CcdLIqjS.js} +1 -1
  39. package/dist/ui/assets/{panel-rpc-handlers-DcbR7o84.js → panel-rpc-handlers-81nV4l2z.js} +2 -2
  40. package/dist/ui/assets/{panelize-shell-COz1Z7LB.js → panelize-shell-Dfx0Qk97.js} +1 -1
  41. package/dist/ui/assets/{provider-CUPM9Vcy.js → provider-5iXJYXIP.js} +1 -1
  42. package/dist/ui/assets/{provider-BZy-2el3.js → provider-BrGxm1af.js} +2 -2
  43. package/dist/ui/assets/{provider-settings-D6iP3vKT.js → provider-settings-BcDzUFLS.js} +1 -1
  44. package/dist/ui/assets/{provider-settings-BkYi4w2e.js → provider-settings-iKaSUXO2.js} +1 -1
  45. package/dist/ui/assets/{provider-store-access-CUfBnttY.js → provider-store-access-C0VGVu4i.js} +2 -2
  46. package/dist/ui/assets/provider-store-access-XG-jW25O.js +1 -0
  47. package/dist/ui/assets/{providers-DimtY5m6.js → providers-BEtOul-J.js} +1 -1
  48. package/dist/ui/assets/{providers-DHCoRo7D.js → providers-DePjGjI9.js} +2 -2
  49. package/dist/ui/assets/{quick-llm-_KRFaFH-.js → quick-llm-CA49HefL.js} +1 -1
  50. package/dist/ui/assets/{recovery-screen-Dah_0Jrp.js → recovery-screen-C820fnXa.js} +1 -1
  51. package/dist/ui/assets/{redirect-uri-CqB44XxF.js → redirect-uri-_DXXUb3_.js} +1 -1
  52. package/dist/ui/assets/remote-vfs-client-CN1pCs1m.js +1 -0
  53. package/dist/ui/assets/{run-DNC0sX1J.js → run-BtFwUHL1.js} +1 -1
  54. package/dist/ui/assets/{session-freezer-NDtE0LbM.js → session-freezer--jQwkHBW.js} +3 -3
  55. package/dist/ui/assets/{setup-feature-flags-remote-CuhErcfu.js → setup-feature-flags-remote-CemRpM4O.js} +1 -1
  56. package/dist/ui/assets/{setup-standalone-prelude-p1QRKqF-.js → setup-standalone-prelude-B_CwyTA7.js} +1 -1
  57. package/dist/ui/assets/{setup-sudo-BHhYjaWE.js → setup-sudo-B6DI1Any.js} +2 -2
  58. package/dist/ui/assets/{skills-6SqLzXWD.js → skills-OJDKT8VI.js} +1 -1
  59. package/dist/ui/assets/slicc-version-DJdeZSuo.js +1 -0
  60. package/dist/ui/assets/{src-CG9Sp0SZ.js → src-B-encLtu.js} +1 -1
  61. package/dist/ui/assets/{state-DtMOU9HA.js → state-DUdcCGso.js} +1 -1
  62. package/dist/ui/assets/{store-CUKRIVBd.js → store-Cxu67puX.js} +1 -1
  63. package/dist/ui/assets/{store-D_r1IcQo.js → store-WNZa0aQX.js} +1 -1
  64. package/dist/ui/assets/{sudo-CaGrLX11.js → sudo-w5yl__4P.js} +1 -1
  65. package/dist/ui/assets/{upgrade-detection-CAMAO4aR.js → upgrade-detection-BsjYW856.js} +1 -1
  66. package/dist/ui/assets/{wc-attach-BbEnzTrf.js → wc-attach-3I9pOCPA.js} +2 -2
  67. package/dist/ui/assets/{wc-extension-qCTDYfPs.js → wc-extension-CnWiY4XW.js} +2 -2
  68. package/dist/ui/assets/{wc-float-label-BATxvSb5.js → wc-float-label-CCMo81Ds.js} +1 -1
  69. package/dist/ui/assets/{wc-floatbar-online-Dogbrrqe.js → wc-floatbar-online-tsTifrU7.js} +1 -1
  70. package/dist/ui/assets/{wc-follower-BOy46F-v.js → wc-follower-BxgSEnFh.js} +3 -3
  71. package/dist/ui/assets/wc-live-C-Tc-fkR.js +8 -0
  72. package/dist/ui/assets/{wc-nav-dAmadq1m.js → wc-nav-4BWGTo3o.js} +2 -2
  73. package/dist/ui/assets/{wc-onboarding-DFwv70uq.js → wc-onboarding-C_K_bkLE.js} +2 -2
  74. package/dist/ui/assets/{wc-placeholder-DodMQmoH.js → wc-placeholder-BJUxgyv_.js} +2 -2
  75. package/dist/ui/assets/{wc-settings-N0CefD5n.js → wc-settings-vHpNnJj9.js} +2 -2
  76. package/dist/ui/assets/{wc-shell-C0FD7dQF.js → wc-shell-tlPtWG89.js} +3 -3
  77. package/dist/ui/assets/{wc-sprinkles-CIb1AGlY.js → wc-sprinkles-Mzuq6tXf.js} +2 -2
  78. package/dist/ui/assets/{wc-tray-CtA5ZhnN.js → wc-tray-CiN14R7Y.js} +2 -2
  79. package/dist/ui/assets/{writable-vfs-client-Dqrpx9iK.js → writable-vfs-client-CuBjWhy3.js} +1 -1
  80. package/dist/ui/assets/{xai-grok-CS_YOK7G.js → xai-grok-C3Cl0btv.js} +1 -1
  81. package/dist/ui/assets/{xai-grok-BQ42D3Yw.js → xai-grok-CDtgl5Ap.js} +1 -1
  82. package/dist/ui/index.html +6 -6
  83. package/dist/ui/llm-proxy-sw.js +1 -1
  84. package/dist/ui/packages/webapp/index.html +6 -6
  85. package/package.json +1 -1
  86. package/dist/ui/assets/fs-BQaFr4gO.js +0 -2
  87. package/dist/ui/assets/fs-DQ-2l68e.js +0 -1
  88. package/dist/ui/assets/provider-store-access-DHQYVvrk.js +0 -1
  89. package/dist/ui/assets/remote-vfs-client-5faRBsEi.js +0 -1
  90. package/dist/ui/assets/slicc-version-C1wgNgbn.js +0 -1
  91. package/dist/ui/assets/wc-live-U5WHc-UB.js +0 -8
@@ -1 +1 @@
1
- import{H as e,d as t}from"./account-store-D7g1Bdw8.js";import{a as n}from"./diagnostics-DN_idNHx.js";import{c as r,u as i}from"./claude-model-version-Csn7RPVg.js";import{c as a,i as o,r as s,s as c}from"./legacy-api-aliases-oJPAvhVV.js";import"./provider-settings-D6iP3vKT.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";const m=`xai-grok`,h=`https://auth.x.ai`,g=`${h}/oauth2/authorize`,_=`${h}/oauth2/token`,v=`b1a00492-073a-47ea-816f-4c329264a828`,y=`http://127.0.0.1:56121/callback`,b=`https://api.x.ai/v1`,x=`grok-4.5`,S=`${m}-openai`;function C(){return r(`xai`)}function w(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 T(e){let t=C(),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 "${x}"`),n=t.find(e=>e.id===x),!n))throw Error(`xAI default model "${x}" 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:b}}async function E(e,t){let n=new URLSearchParams({grant_type:`authorization_code`,code:e,redirect_uri:y,client_id:v,code_verifier:t}),r=await fetch(_,{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 D(e){try{let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:v}),n=await fetch(_,{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 O(){return t().find(e=>e.providerId===m)}async function k(){let t=O();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 D(t.refreshToken);if(n?.access_token)return await e({providerId:m,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}function A(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:S,provider:m,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 j(e,t){return t?{...e??{},"x-grok-conv-id":t}:e}const M=(e,t,r={})=>{let i=n();return(async()=>{try{let n=await k(),a=r.sessionId,c=T(e),l={...r,apiKey:n,headers:j(r.headers,a)},u=c.api===`openai-responses`?o(c,t,l):s(c,t,l);for await(let e of u)i.push(e);i.end()}catch(t){console.error(`[xai-grok] Stream error:`,t instanceof Error?t.message:String(t)),i.push(A(e,t)),i.end()}})(),i},N=(e,t,r)=>{let i=n();return(async()=>{try{let n=await k(),o=r?.sessionId,s=T(e),l={...r,apiKey:n,headers:j(r?.headers,o)},u=s.api===`openai-responses`?a(s,t,l):c(s,t,l);for await(let e of u)i.push(e);i.end()}catch(t){console.error(`[xai-grok] Stream error:`,t instanceof Error?t.message:String(t)),i.push(A(e,t)),i.end()}})(),i},P={id:m,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:x,oauthTokenDomains:[`api.x.ai`,`*.x.ai`,`auth.x.ai`,`accounts.x.ai`],getModelIds:()=>C().map(w),onOAuthLoginIntercepted:async(t,n,r)=>{let i=l(),a=await d(i),o=u(),s=u(),c=new URL(g);c.searchParams.set(`response_type`,`code`),c.searchParams.set(`client_id`,v),c.searchParams.set(`redirect_uri`,y),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 h=await t({authorizeUrl:c.toString(),redirectUriPattern:`http://127.0.0.1:56121/*`,onCapture:`close`});if(!h)throw new p(`xAI OAuth login was cancelled or timed out`,f.CALLBACK_TIMEOUT);let _=new URL(h),x=_.searchParams.get(`code`),S=_.searchParams.get(`state`);if(!x)throw new p(`xAI OAuth redirect did not include a code`,f.CODE_MISSING);if(S!==o)throw new p(`xAI OAuth state mismatch — possible CSRF, aborting`,f.STATE_MISMATCH);let C=await E(x,i);await e({providerId:m,accessToken:C.access_token,refreshToken:C.refresh_token,tokenExpiresAt:Date.now()+(C.expires_in??21600)*1e3,baseUrl:b,scopes:C.scope}),n()},onOAuthLogout:async()=>{await e({providerId:m,accessToken:``})},onSilentRenew:async()=>{let t=O();if(!t?.refreshToken)return null;let n=await D(t.refreshToken);return n?.access_token?(await e({providerId:m,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 F(){i({api:S,stream:M,streamSimple:N})}export{f as XaiErrorCode,p as XaiOAuthError,P as config,F as register};
1
+ import{H as e,d as t}from"./account-store-UhvCpVi5.js";import{a as n}from"./diagnostics-DN_idNHx.js";import{c as r,u as i}from"./claude-model-version-Csn7RPVg.js";import{c as a,i as o,r as s,s as c}from"./legacy-api-aliases-oJPAvhVV.js";import"./provider-settings-BcDzUFLS.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";const m=`xai-grok`,h=`https://auth.x.ai`,g=`${h}/oauth2/authorize`,_=`${h}/oauth2/token`,v=`b1a00492-073a-47ea-816f-4c329264a828`,y=`http://127.0.0.1:56121/callback`,b=`https://api.x.ai/v1`,x=`grok-4.5`,S=`${m}-openai`;function C(){return r(`xai`)}function w(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 T(e){let t=C(),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 "${x}"`),n=t.find(e=>e.id===x),!n))throw Error(`xAI default model "${x}" 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:b}}async function E(e,t){let n=new URLSearchParams({grant_type:`authorization_code`,code:e,redirect_uri:y,client_id:v,code_verifier:t}),r=await fetch(_,{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 D(e){try{let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e,client_id:v}),n=await fetch(_,{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 O(){return t().find(e=>e.providerId===m)}async function k(){let t=O();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 D(t.refreshToken);if(n?.access_token)return await e({providerId:m,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}function A(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:S,provider:m,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 j(e,t){return t?{...e??{},"x-grok-conv-id":t}:e}const M=(e,t,r={})=>{let i=n();return(async()=>{try{let n=await k(),a=r.sessionId,c=T(e),l={...r,apiKey:n,headers:j(r.headers,a)},u=c.api===`openai-responses`?o(c,t,l):s(c,t,l);for await(let e of u)i.push(e);i.end()}catch(t){console.error(`[xai-grok] Stream error:`,t instanceof Error?t.message:String(t)),i.push(A(e,t)),i.end()}})(),i},N=(e,t,r)=>{let i=n();return(async()=>{try{let n=await k(),o=r?.sessionId,s=T(e),l={...r,apiKey:n,headers:j(r?.headers,o)},u=s.api===`openai-responses`?a(s,t,l):c(s,t,l);for await(let e of u)i.push(e);i.end()}catch(t){console.error(`[xai-grok] Stream error:`,t instanceof Error?t.message:String(t)),i.push(A(e,t)),i.end()}})(),i},P={id:m,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:x,oauthTokenDomains:[`api.x.ai`,`*.x.ai`,`auth.x.ai`,`accounts.x.ai`],getModelIds:()=>C().map(w),onOAuthLoginIntercepted:async(t,n,r)=>{let i=l(),a=await d(i),o=u(),s=u(),c=new URL(g);c.searchParams.set(`response_type`,`code`),c.searchParams.set(`client_id`,v),c.searchParams.set(`redirect_uri`,y),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 h=await t({authorizeUrl:c.toString(),redirectUriPattern:`http://127.0.0.1:56121/*`,onCapture:`close`});if(!h)throw new p(`xAI OAuth login was cancelled or timed out`,f.CALLBACK_TIMEOUT);let _=new URL(h),x=_.searchParams.get(`code`),S=_.searchParams.get(`state`);if(!x)throw new p(`xAI OAuth redirect did not include a code`,f.CODE_MISSING);if(S!==o)throw new p(`xAI OAuth state mismatch — possible CSRF, aborting`,f.STATE_MISMATCH);let C=await E(x,i);await e({providerId:m,accessToken:C.access_token,refreshToken:C.refresh_token,tokenExpiresAt:Date.now()+(C.expires_in??21600)*1e3,baseUrl:b,scopes:C.scope}),n()},onOAuthLogout:async()=>{await e({providerId:m,accessToken:``})},onSilentRenew:async()=>{let t=O();if(!t?.refreshToken)return null;let n=await D(t.refreshToken);return n?.access_token?(await e({providerId:m,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 F(){i({api:S,stream:M,streamSimple:N})}export{f as XaiErrorCode,p as XaiOAuthError,P as config,F as register};
@@ -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-LJJqhB-c.js"></script>
8
+ <script type="module" crossorigin src="/assets/main-CjVUpZQF.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-P2Xu9kJm.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Dd_uD5pT.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
@@ -30,21 +30,21 @@
30
30
  <link rel="modulepreload" crossorigin href="/assets/secrets-bridge-client-DCQ44RyR.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/image-markers-BXtVm4og.js">
32
32
  <link rel="modulepreload" crossorigin href="/assets/tool-ui-DfXu6quJ.js">
33
- <link rel="modulepreload" crossorigin href="/assets/providers-DHCoRo7D.js">
33
+ <link rel="modulepreload" crossorigin href="/assets/providers-DePjGjI9.js">
34
34
  <link rel="modulepreload" crossorigin href="/assets/panel-rpc-B3MSVImO.js">
35
35
  <link rel="modulepreload" crossorigin href="/assets/bedrock-camp-compat-CgBMwna8.js">
36
- <link rel="modulepreload" crossorigin href="/assets/account-store-Cf8iMGfy.js">
36
+ <link rel="modulepreload" crossorigin href="/assets/account-store-PGhT8u8K.js">
37
37
  <link rel="modulepreload" crossorigin href="/assets/runtime-env-CgsZ7LTp.js">
38
38
  <link rel="modulepreload" crossorigin href="/assets/messages-BD4p8GuF.js">
39
39
  <link rel="modulepreload" crossorigin href="/assets/tray-runtime-config-D7cmCcHJ.js">
40
- <link rel="modulepreload" crossorigin href="/assets/setup-sudo-BHhYjaWE.js">
41
- <link rel="modulepreload" crossorigin href="/assets/setup-standalone-prelude-p1QRKqF-.js">
40
+ <link rel="modulepreload" crossorigin href="/assets/setup-sudo-B6DI1Any.js">
41
+ <link rel="modulepreload" crossorigin href="/assets/setup-standalone-prelude-B_CwyTA7.js">
42
42
  <link rel="modulepreload" crossorigin href="/assets/telemetry-BVzuNdvW.js">
43
43
  <link rel="modulepreload" crossorigin href="/assets/feature-flags-ByMXaIc4.js">
44
44
  <link rel="modulepreload" crossorigin href="/assets/tray-follower-status-BAjnN7Ar.js">
45
45
  <link rel="modulepreload" crossorigin href="/assets/clipboard-eqmn97SP.js">
46
46
  <link rel="modulepreload" crossorigin href="/assets/tray-join-url-BIvzbiFR.js">
47
- <link rel="modulepreload" crossorigin href="/assets/provider-settings-BkYi4w2e.js">
47
+ <link rel="modulepreload" crossorigin href="/assets/provider-settings-iKaSUXO2.js">
48
48
  </head>
49
49
  <body>
50
50
  <div id="app"></div>
@@ -1 +1 @@
1
- "use strict";(()=>{var v="https://www.sliccy.ai";var T="bridgeToken",I="bridge",B="X-Bridge-Token";var Ee=new URL(v).hostname,at={[Ee]:"sliccy.now","sliccy.ai":"sliccy.now","slicc-tray-hub-staging.minivelos.workers.dev":"sliccy.dev","localhost:8787":"localhost:8787"};var Re=["ghp_","gho_","ghu_","ghs_","ghr_","github_pat_","sk-","pk-","xoxb-","xoxp-","xoxa-","xoxs-","AKIA","ABIA","ACCA","ASIA","sk-ant-","Bearer "],dt=[...Re].sort((e,t)=>t.length-e.length);var Me=["canonical-agent-history-unavailable","tool-data-may-be-truncated","model-metadata-unavailable","scoop-history-unavailable","attachment-file-missing","attachment-association-unavailable","complete-snapshot-unavailable"];var It=new Set(Me);var Ft=[{category:"jwt",source:String.raw`ey[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+`,flags:"g"},{category:"private-key",source:"-----BEGIN [A-Z ]* PRIVATE KEY-----"+String.raw`[\s\S]*?`+"-----END [A-Z ]* PRIVATE KEY-----",flags:"g"},{category:"bearer-token",source:"Bearer [A-Za-z0-9._~+/=!-]+",flags:"gi"},{category:"api-key",source:"(?:sk-(?:live|test|prod|proj)-[A-Za-z0-9]{8,}|sk-ant-[A-Za-z0-9-]{8,}|xoxb-[A-Za-z0-9-]{10,}|xoxp-[A-Za-z0-9-]{10,}|AKIA[A-Z0-9]{16}|ghp_[A-Za-z0-9]{36}|hf_[A-Za-z0-9]{34})",flags:"g"},{category:"password",source:String.raw`\b(?:password|passwd|token|secret|api_key)\s*[=:]\s*\S+`,flags:"gi"}];var Ot=16*1024;var Dt=64*1024,Pt=32*1024;var _e="slicc-sync-fs-";function q(e){return _e+e}var H="sync-fs-nonce",V="sync-fs-need-nonce",E="/__slicc/fs-sync/";var R="/__slicc/exec-sync",N="x-slicc-fs-token",S="x-slicc-fs-errno",m="x-slicc-fs",M="x-slicc-fs-no-responder",j="sync-fs-req",Y="sync-fs-ack",G="sync-fs-res",W=25e3,z=2e3,K=12e4,F=6e5,X=2e3;function U(e){if(!e)return{};let t={};for(let[r,n]of Object.entries(e)){let s=r.toLowerCase();s==="cookie"?t["X-Proxy-Cookie"]=n:s==="origin"?t["X-Proxy-Origin"]=n:s==="referer"?t["X-Proxy-Referer"]=n:s.startsWith("proxy-")?t[`X-Proxy-${r}`]=n:t[r]=n}return t}function J(e){let t={};for(let[r,n]of Object.entries(e))r.toLowerCase()==="x-proxy-set-cookie"?t["set-cookie"]=n:t[r]=n;return t}var be=new Set([101,103,204,205,304]);function Ae(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Q(e){let t,r,n=new Promise((o,a)=>{t=o,r=a}),s=null,i=new ReadableStream({start(o){s=o}}),u=!1,p=!1,g=()=>{try{s?.close()}catch{}},y=o=>{try{s?.error(o)}catch{}},d=o=>{if(u)return;u=!0;let a=new Headers;for(let[k,x]of Object.entries(J(o.headers)))a.set(k,x);let h=be.has(o.status)?null:i;t(new Response(h,{status:o.status,statusText:o.statusText,headers:a}))},l=o=>{p=!0;let a=new Error(o.error);u?y(a):r(a),e.close?.()};return e.onmessage=o=>{let a=o.data;!a||typeof a.type!="string"||p||(a.type==="response-head"?d(a):a.type==="response-chunk"?s?.enqueue(Ae(a.dataBase64)):a.type==="response-end"?(p=!0,g(),e.close?.()):a.type==="response-error"&&l(a))},e.start?.(),{responsePromise:n}}var we=new Set([101,103,204,205,304]);function L(e){let t=we.has(e.status)?null:e.body;return new Response(t,{status:e.status,statusText:e.statusText,headers:e.headers})}var Z="slicc",ee="leader";function te(e){try{let t=new URL(e);return`${t.protocol==="wss:"?"https:":"http:"}//${t.host}`}catch{return null}}var ve="slicc:bridge-config";function re(e,t){if(e?.apiBaseUrl&&e.token)return{apiBaseUrl:e.apiBaseUrl.replace(/\/+$/,""),token:e.token};if(!t)return null;let r;try{r=new URL(t)}catch{return null}let n=r.searchParams.get(I),s=r.searchParams.get(T);if(!n||!s)return null;let i=te(n);return i?{apiBaseUrl:i.replace(/\/+$/,""),token:s}:null}function ne(e,t){if(e?.apiBaseUrl&&e.token)return re(e,null);for(let r of t){let n=re(null,r);if(n)return n}return null}function se(e,t){return t?`${t.apiBaseUrl}${e}`:e}function oe(e,t){let r,n;try{r=new URL(t),n=new URL(e)}catch{return!1}return n.origin===r.origin&&n.pathname.startsWith("/api/")}function ie(e){return!e||typeof e!="object"?!1:e.type===ve}var _=class{byClient=new Map;set(t,r){if(t){if(!r.apiBaseUrl||!r.token){this.byClient.delete(t);return}this.byClient.set(t,{apiBaseUrl:r.apiBaseUrl.replace(/\/+$/,""),token:r.token})}}get(t){return t?this.byClient.get(t)??null:null}delete(t){this.byClient.delete(t)}size(){return this.byClient.size}},Te="slicc:extension-delegate-config",ae="slicc:ext-fetch";function ce(e){return!e||typeof e!="object"?!1:e.type===Te}function O(e){if(!e)return null;let t;try{t=new URL(e)}catch{return null}if(t.searchParams.get(Z)!==ee)return null;let r=t.searchParams.get("ext");return r?{extensionId:r}:null}function ue(e,t){if(e?.extensionId)return{extensionId:e.extensionId};for(let r of t){let n=O(r);if(n)return n}return null}var b=class{byClient=new Map;set(t,r){if(t){if(!r.extensionId){this.byClient.delete(t);return}this.byClient.set(t,{extensionId:r.extensionId})}}get(t){return t?this.byClient.get(t)??null:null}delete(t){this.byClient.delete(t)}size(){return this.byClient.size}},Ie=new Set(["image","font","style","video","audio","track","iframe","object","embed"]);function le(e){return Ie.has(e)}function D(e){let t=e;return t?.type==="window"&&t.frameType==="top-level"}function A(e){return D(e)}function w(e){return e.filter(A)}function de(){let e=[];return{notify(){let t=e;e=[];for(let r of t)r()},wait(t){return new Promise(r=>{let n=!1,s=()=>{n||(n=!0,clearTimeout(i),e=e.filter(u=>u!==s),r())},i=setTimeout(s,t);e.push(s)})}}}var P="exec";function fe(e,t){return typeof e!="number"||!Number.isFinite(e)||e<=0?Math.min(t,F):Math.min(e,F)}var Fe=W,Ue=200,Le=1e4,Oe=new Set(["stat","lstat","readdir","exists"]),De=new Set(["mkdir","rm"]);function Pe(e){return $e(e)?fe(e.timeoutMs,K)+X:Fe}function $e(e){return e.channel===P}function Be(e){switch(e){case"ENOENT":return 404;case"EACCES":return 403;case"EISDIR":case"ENOTDIR":case"EINVAL":return 400;case"EIO":return 503;default:return 500}}async function qe(e){if(e.method!=="POST")return null;let t;try{let i=await e.arrayBuffer();t=JSON.parse(new TextDecoder().decode(new Uint8Array(i)))}catch{return null}if(!t||typeof t!="object")return null;let r=t,n=r.command;return typeof n=="string"||Array.isArray(n)&&n.every(i=>typeof i=="string")?{token:e.headers.get(N)??"",channel:P,command:n,...Array.isArray(r.args)&&r.args.every(i=>typeof i=="string")?{args:r.args}:{},...typeof r.stdin=="string"?{stdin:r.stdin}:{},...typeof r.timeoutMs=="number"?{timeoutMs:r.timeoutMs}:{}}:null}async function pe(e){let t=new URL(e.url);if(t.pathname===R)return qe(e);if(!t.pathname.startsWith(E))return null;let r=t.pathname.slice(E.length-1),n;try{n=r.split("/").map(decodeURIComponent).join("/")}catch{return null}let s=e.headers.get(N)??"",i=t.searchParams.get("op");if(e.method==="POST"){if(i&&De.has(i))return{token:s,op:i,path:n};let u=await e.arrayBuffer();return{token:s,op:"write",path:n,body:new Uint8Array(u)}}return i&&Oe.has(i)?{token:s,op:i,path:n}:{token:s,op:"read",path:n}}function He(e){if(!e.ok){let r=e.errno??"EIO";return new Response(e.message??r,{status:Be(r),headers:{[S]:r,[m]:"1"}})}if(e.kind==="json")return new Response(JSON.stringify(e.json??null),{status:200,headers:{"content-type":"application/json",[m]:"1"}});let t=e.kind==="bytes"?new Uint8Array(e.bytes):new Uint8Array(0);return new Response(t,{status:200,headers:{"content-type":"application/octet-stream",[m]:"1"}})}function ge(e,t,r={}){let n=r.timeoutMs??Pe(t),s=r.retryIntervalMs??Ue,i=Math.min(r.noResponderMs??Le,n),u=crypto.randomUUID();return new Promise(p=>{let g=!1,y=!1,d,l,o,a=()=>{for(let c of e)c.removeEventListener("message",k);d&&clearInterval(d),l&&clearTimeout(l),o&&clearTimeout(o)},h=c=>{y||(y=!0,a(),p(c))},k=c=>{let f=c.data;if(!(!f||f.id!==u)){if(f.type===Y){g=!0,d&&clearInterval(d),o&&clearTimeout(o);return}f.type===G&&h(He(f))}};for(let c of e)c.addEventListener("message",k);let x=()=>{for(let c of e)c.postMessage({type:j,id:u,...t})};x(),d=setInterval(()=>{g||x()},s),o=setTimeout(()=>{g||h(new Response("sync-fs bridge: no responder",{status:503,headers:{[S]:"EIO",[m]:"1",[M]:"1"}}))},i),l=setTimeout(()=>{h(new Response("sync-fs bridge timeout",{status:503,headers:{[S]:"EIO",[m]:"1"}}))},n)})}var Ve="/api/fetch-proxy",C="x-bypass-llm-proxy",Se=new _,ke=new b,je=32*1024*1024;self.importScripts("/preview-sw.js");self.addEventListener("install",e=>{e.waitUntil(self.skipWaiting())});self.addEventListener("activate",e=>{e.waitUntil(self.clients.claim())});self.addEventListener("message",e=>{let t=e.source;if(!t||!("id"in t)||typeof t.id!="string")return;if(ie(e.data)&&A(t)){Se.set(t.id,{apiBaseUrl:e.data.apiBaseUrl,token:e.data.token});return}if(ce(e.data)&&A(t)){ke.set(t.id,{extensionId:e.data.extensionId});return}let r=e.data;if(r?.type===H&&typeof r.nonce=="string"){D(t)&&Ye(r.nonce);return}});self.addEventListener("fetch",e=>{let t=e.request;if(t.headers.get(C)==="1"||le(t.destination))return;let r;try{r=new URL(t.url)}catch{return}r.origin!==self.location.origin&&(r.protocol!=="http:"&&r.protocol!=="https:"||e.respondWith(Ge(t,e.clientId||null)))});var $=new Map,xe=de();function me(){return[...$.values()]}function Ye(e){$.has(e)||($.set(e,new BroadcastChannel(q(e))),xe.notify())}async function ye(){let e=await self.clients.matchAll({type:"window"}),t={type:V};for(let r of e)r.postMessage(t)}self.addEventListener("fetch",e=>{let t=new URL(e.request.url);t.origin===self.location.origin&&(!t.pathname.startsWith(E)&&t.pathname!==R||e.respondWith((async()=>{let r=await pe(e.request);if(!r)return new Response("sync bridge: malformed request",{status:400,headers:{[S]:"EINVAL",[m]:"1"}});let n=me();if(n.length===0&&(ye(),await xe.wait(z),n=me(),n.length===0))return new Response("sync-fs bridge not ready",{status:503,headers:{[S]:"EIO",[m]:"1"}});let s=await ge(n,r);return s.headers.get(M)==="1"&&ye(),s})()))});async function Ge(e,t){let r=e.url,n={};e.headers.forEach((c,f)=>{f.toLowerCase()!==C&&(n[f]=c)});let s=U(n),i=new Headers;for(let[c,f]of Object.entries(s))i.set(c,f);i.set("X-Target-URL",r);let u=Se.get(t),p=ke.get(t),g=await We(t),y=u||p?[]:await ze(),d=[g,...y],l=ue(p,d);if(l){let c=await Ke();if(c)return Je(e,l,c,r)}let o=ne(u,d);if(o&&oe(e.url,o.apiBaseUrl)){let c=new Headers(e.headers);c.set(C,"1");let f={method:e.method,headers:c,cache:"no-store",credentials:e.credentials,redirect:"manual",signal:e.signal,body:await he(e)};return L(await fetch(e.url,f))}o&&i.set(B,o.token);let a=se(Ve,o),h=await he(e),k={method:e.method,headers:i,cache:"no-store",credentials:"omit",redirect:"manual",signal:e.signal,body:h},x=await fetch(a,k);return L(x)}async function he(e){if(e.method==="GET"||e.method==="HEAD")return;let t=await e.arrayBuffer();return t.byteLength>0?t:void 0}async function We(e){if(!e)return null;try{let t=await self.clients.get(e);return w(t?[t]:[])[0]?.url??null}catch{return null}}async function ze(){try{let e=await self.clients.matchAll({type:"window",includeUncontrolled:!0});return w(e).map(t=>t.url).filter(t=>!!t)}catch{return[]}}async function Ke(){try{let e=w(await self.clients.matchAll({type:"window",includeUncontrolled:!0}));return e.length===0?null:e.find(r=>O(r.url)!==null)??e[0]}catch{return null}}function Xe(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}async function Je(e,t,r,n){let s={};e.headers.forEach((l,o)=>{o.toLowerCase()!==C&&(s[o]=l)});let i=U(s),u,p=!1;if(e.method!=="GET"&&e.method!=="HEAD"){let l=await e.arrayBuffer();l.byteLength>je?p=!0:l.byteLength>0&&(u=Xe(new Uint8Array(l)))}let g=new MessageChannel,{responsePromise:y}=Q(g.port1),d={type:ae,requestId:Qe(),extensionId:t.extensionId,request:{url:n,method:e.method,headers:i,bodyBase64:u,requestBodyTooLarge:p}};return r.postMessage(d,[g.port2]),y}function Qe(){let e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}})();
1
+ "use strict";(()=>{var v="https://www.sliccy.ai";var T="bridgeToken",I="bridge",q="X-Bridge-Token";var Ee=new URL(v).hostname,at={[Ee]:"sliccy.now","sliccy.ai":"sliccy.now","slicc-tray-hub-staging.minivelos.workers.dev":"sliccy.dev","localhost:8787":"localhost:8787"};var Re=["ghp_","gho_","ghu_","ghs_","ghr_","github_pat_","sk-","pk-","xoxb-","xoxp-","xoxa-","xoxs-","AKIA","ABIA","ACCA","ASIA","sk-ant-","Bearer "],dt=[...Re].sort((e,t)=>t.length-e.length);var Me=["canonical-agent-history-unavailable","tool-data-may-be-truncated","model-metadata-unavailable","scoop-history-unavailable","attachment-file-missing","attachment-association-unavailable","complete-snapshot-unavailable"];var It=new Set(Me);var Ft=[{category:"jwt",source:String.raw`ey[A-Za-z0-9_-]{4,}\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+`,flags:"g"},{category:"private-key",source:"-----BEGIN [A-Z ]* PRIVATE KEY-----"+String.raw`[\s\S]*?`+"-----END [A-Z ]* PRIVATE KEY-----",flags:"g"},{category:"bearer-token",source:"Bearer [A-Za-z0-9._~+/=!-]+",flags:"gi"},{category:"api-key",source:"(?:sk-(?:live|test|prod|proj)-[A-Za-z0-9]{8,}|sk-ant-[A-Za-z0-9-]{8,}|xoxb-[A-Za-z0-9-]{10,}|xoxp-[A-Za-z0-9-]{10,}|AKIA[A-Z0-9]{16}|ghp_[A-Za-z0-9]{36}|hf_[A-Za-z0-9]{34})",flags:"g"},{category:"password",source:String.raw`\b(?:password|passwd|token|secret|api_key)\s*[=:]\s*\S+`,flags:"gi"}];var Ot=16*1024;var Pt=64*1024,Dt=32*1024;var _e="slicc-sync-fs-";function B(e){return _e+e}var H="sync-fs-nonce",V="sync-fs-need-nonce",E="/__slicc/fs-sync/";var R="/__slicc/exec-sync",N="x-slicc-fs-token",S="x-slicc-fs-errno",m="x-slicc-fs",M="x-slicc-fs-no-responder",j="sync-fs-req",Y="sync-fs-ack",W="sync-fs-res",G=25e3,z=2e3,K=12e4,F=6e5,X=2e3;function U(e){if(!e)return{};let t={};for(let[r,n]of Object.entries(e)){let s=r.toLowerCase();s==="cookie"?t["X-Proxy-Cookie"]=n:s==="origin"?t["X-Proxy-Origin"]=n:s==="referer"?t["X-Proxy-Referer"]=n:s.startsWith("proxy-")?t[`X-Proxy-${r}`]=n:t[r]=n}return t}function J(e){let t={};for(let[r,n]of Object.entries(e))r.toLowerCase()==="x-proxy-set-cookie"?t["set-cookie"]=n:t[r]=n;return t}var be=new Set([101,103,204,205,304]);function Ae(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Q(e){let t,r,n=new Promise((o,a)=>{t=o,r=a}),s=null,i=new ReadableStream({start(o){s=o}}),u=!1,p=!1,g=()=>{try{s?.close()}catch{}},y=o=>{try{s?.error(o)}catch{}},d=o=>{if(u)return;u=!0;let a=new Headers;for(let[k,x]of Object.entries(J(o.headers)))a.set(k,x);let h=be.has(o.status)?null:i;t(new Response(h,{status:o.status,statusText:o.statusText,headers:a}))},l=o=>{p=!0;let a=new Error(o.error);u?y(a):r(a),e.close?.()};return e.onmessage=o=>{let a=o.data;!a||typeof a.type!="string"||p||(a.type==="response-head"?d(a):a.type==="response-chunk"?s?.enqueue(Ae(a.dataBase64)):a.type==="response-end"?(p=!0,g(),e.close?.()):a.type==="response-error"&&l(a))},e.start?.(),{responsePromise:n}}var we=new Set([101,103,204,205,304]);function L(e){let t=we.has(e.status)?null:e.body;return new Response(t,{status:e.status,statusText:e.statusText,headers:e.headers})}var Z="slicc",ee="leader";function te(e){try{let t=new URL(e);return`${t.protocol==="wss:"?"https:":"http:"}//${t.host}`}catch{return null}}var ve="slicc:bridge-config";function re(e,t){if(e?.apiBaseUrl&&e.token)return{apiBaseUrl:e.apiBaseUrl.replace(/\/+$/,""),token:e.token};if(!t)return null;let r;try{r=new URL(t)}catch{return null}let n=r.searchParams.get(I),s=r.searchParams.get(T);if(!n||!s)return null;let i=te(n);return i?{apiBaseUrl:i.replace(/\/+$/,""),token:s}:null}function ne(e,t){if(e?.apiBaseUrl&&e.token)return re(e,null);for(let r of t){let n=re(null,r);if(n)return n}return null}function se(e,t){return t?`${t.apiBaseUrl}${e}`:e}function oe(e,t){let r,n;try{r=new URL(t),n=new URL(e)}catch{return!1}return n.origin===r.origin&&n.pathname.startsWith("/api/")}function ie(e){return!e||typeof e!="object"?!1:e.type===ve}var _=class{byClient=new Map;set(t,r){if(t){if(!r.apiBaseUrl||!r.token){this.byClient.delete(t);return}this.byClient.set(t,{apiBaseUrl:r.apiBaseUrl.replace(/\/+$/,""),token:r.token})}}get(t){return t?this.byClient.get(t)??null:null}delete(t){this.byClient.delete(t)}size(){return this.byClient.size}},Te="slicc:extension-delegate-config",ae="slicc:ext-fetch";function ce(e){return!e||typeof e!="object"?!1:e.type===Te}function O(e){if(!e)return null;let t;try{t=new URL(e)}catch{return null}if(t.searchParams.get(Z)!==ee)return null;let r=t.searchParams.get("ext");return r?{extensionId:r}:null}function ue(e,t){if(e?.extensionId)return{extensionId:e.extensionId};for(let r of t){let n=O(r);if(n)return n}return null}var b=class{byClient=new Map;set(t,r){if(t){if(!r.extensionId){this.byClient.delete(t);return}this.byClient.set(t,{extensionId:r.extensionId})}}get(t){return t?this.byClient.get(t)??null:null}delete(t){this.byClient.delete(t)}size(){return this.byClient.size}},Ie=new Set(["image","font","style","video","audio","track","iframe","object","embed"]);function le(e){return Ie.has(e)}function P(e){let t=e;return t?.type==="window"&&t.frameType==="top-level"}function A(e){return P(e)}function w(e){return e.filter(A)}function de(){let e=[];return{notify(){let t=e;e=[];for(let r of t)r()},wait(t){return new Promise(r=>{let n=!1,s=()=>{n||(n=!0,clearTimeout(i),e=e.filter(u=>u!==s),r())},i=setTimeout(s,t);e.push(s)})}}}var D="exec";function fe(e,t){return typeof e!="number"||!Number.isFinite(e)||e<=0?Math.min(t,F):Math.min(e,F)}var Fe=G,Ue=200,Le=1e4,Oe=new Set(["stat","lstat","readdir","exists"]),Pe=new Set(["mkdir","rm"]);function De(e){return $e(e)?fe(e.timeoutMs,K)+X:Fe}function $e(e){return e.channel===D}function qe(e){switch(e){case"ENOENT":return 404;case"EACCES":return 403;case"EISDIR":case"ENOTDIR":case"EINVAL":return 400;case"EIO":return 503;default:return 500}}async function Be(e){if(e.method!=="POST")return null;let t;try{let i=await e.arrayBuffer();t=JSON.parse(new TextDecoder().decode(new Uint8Array(i)))}catch{return null}if(!t||typeof t!="object")return null;let r=t,n=r.command;return typeof n=="string"||Array.isArray(n)&&n.every(i=>typeof i=="string")?{token:e.headers.get(N)??"",channel:D,command:n,...Array.isArray(r.args)&&r.args.every(i=>typeof i=="string")?{args:r.args}:{},...typeof r.stdin=="string"?{stdin:r.stdin}:{},...typeof r.timeoutMs=="number"?{timeoutMs:r.timeoutMs}:{}}:null}async function pe(e){let t=new URL(e.url);if(t.pathname===R)return Be(e);if(!t.pathname.startsWith(E))return null;let r=t.pathname.slice(E.length-1),n;try{n=r.split("/").map(decodeURIComponent).join("/")}catch{return null}let s=e.headers.get(N)??"",i=t.searchParams.get("op");if(e.method==="POST"){if(i&&Pe.has(i))return{token:s,op:i,path:n};let u=await e.arrayBuffer();return{token:s,op:"write",path:n,body:new Uint8Array(u)}}return i&&Oe.has(i)?{token:s,op:i,path:n}:{token:s,op:"read",path:n}}function He(e){if(!e.ok){let r=e.errno??"EIO";return new Response(e.message??r,{status:qe(r),headers:{[S]:r,[m]:"1"}})}if(e.kind==="json")return new Response(JSON.stringify(e.json??null),{status:200,headers:{"content-type":"application/json",[m]:"1"}});let t=e.kind==="bytes"?new Uint8Array(e.bytes):new Uint8Array(0);return new Response(t,{status:200,headers:{"content-type":"application/octet-stream",[m]:"1"}})}function ge(e,t,r={}){let n=r.timeoutMs??De(t),s=r.retryIntervalMs??Ue,i=Math.min(r.noResponderMs??Le,n),u=crypto.randomUUID();return new Promise(p=>{let g=!1,y=!1,d,l,o,a=()=>{for(let c of e)c.removeEventListener("message",k);d&&clearInterval(d),l&&clearTimeout(l),o&&clearTimeout(o)},h=c=>{y||(y=!0,a(),p(c))},k=c=>{let f=c.data;if(!(!f||f.id!==u)){if(f.type===Y){g=!0,d&&clearInterval(d),o&&clearTimeout(o);return}f.type===W&&h(He(f))}};for(let c of e)c.addEventListener("message",k);let x=()=>{for(let c of e)c.postMessage({type:j,id:u,...t})};x(),d=setInterval(()=>{g||x()},s),o=setTimeout(()=>{g||h(new Response("sync-fs bridge: no responder",{status:503,headers:{[S]:"EIO",[m]:"1",[M]:"1"}}))},i),l=setTimeout(()=>{h(new Response("sync-fs bridge timeout",{status:503,headers:{[S]:"EIO",[m]:"1"}}))},n)})}var Ve="/api/fetch-proxy",C="x-bypass-llm-proxy",Se=new _,ke=new b,je=32*1024*1024;self.importScripts("/preview-sw.js");self.addEventListener("install",e=>{e.waitUntil(self.skipWaiting())});self.addEventListener("activate",e=>{e.waitUntil(self.clients.claim())});self.addEventListener("message",e=>{let t=e.source;if(!t||!("id"in t)||typeof t.id!="string")return;if(ie(e.data)&&A(t)){Se.set(t.id,{apiBaseUrl:e.data.apiBaseUrl,token:e.data.token});return}if(ce(e.data)&&A(t)){ke.set(t.id,{extensionId:e.data.extensionId});return}let r=e.data;if(r?.type===H&&typeof r.nonce=="string"){P(t)&&Ye(r.nonce);return}});self.addEventListener("fetch",e=>{let t=e.request;if(t.headers.get(C)==="1"||le(t.destination))return;let r;try{r=new URL(t.url)}catch{return}r.origin!==self.location.origin&&(r.protocol!=="http:"&&r.protocol!=="https:"||e.respondWith(We(t,e.clientId||null)))});var $=new Map,xe=de();function me(){return[...$.values()]}function Ye(e){$.has(e)||($.set(e,new BroadcastChannel(B(e))),xe.notify())}async function ye(){let e=await self.clients.matchAll({type:"window"}),t={type:V};for(let r of e)r.postMessage(t)}self.addEventListener("fetch",e=>{let t=new URL(e.request.url);t.origin===self.location.origin&&(!t.pathname.startsWith(E)&&t.pathname!==R||e.respondWith((async()=>{let r=await pe(e.request);if(!r)return new Response("sync bridge: malformed request",{status:400,headers:{[S]:"EINVAL",[m]:"1"}});let n=me();if(n.length===0&&(ye(),await xe.wait(z),n=me(),n.length===0))return new Response("sync-fs bridge not ready",{status:503,headers:{[S]:"EIO",[m]:"1"}});let s=await ge(n,r);return s.headers.get(M)==="1"&&ye(),s})()))});async function We(e,t){let r=e.url,n={};e.headers.forEach((c,f)=>{f.toLowerCase()!==C&&(n[f]=c)});let s=U(n),i=new Headers;for(let[c,f]of Object.entries(s))i.set(c,f);i.set("X-Target-URL",r);let u=Se.get(t),p=ke.get(t),g=await Ge(t),y=u||p?[]:await ze(),d=[g,...y],l=ue(p,d);if(l){let c=await Ke();if(c)return Je(e,l,c,r)}let o=ne(u,d);if(o&&oe(e.url,o.apiBaseUrl)){let c=new Headers(e.headers);c.set(C,"1");let f={method:e.method,headers:c,cache:"no-store",credentials:e.credentials,redirect:"manual",signal:e.signal,body:await he(e)};return L(await fetch(e.url,f))}o&&i.set(q,o.token);let a=se(Ve,o),h=await he(e),k={method:e.method,headers:i,cache:"no-store",credentials:"omit",redirect:"manual",signal:e.signal,body:h},x=await fetch(a,k);return L(x)}async function he(e){if(e.method==="GET"||e.method==="HEAD")return;let t=await e.arrayBuffer();return t.byteLength>0?t:void 0}async function Ge(e){if(!e)return null;try{let t=await self.clients.get(e);return w(t?[t]:[])[0]?.url??null}catch{return null}}async function ze(){try{let e=await self.clients.matchAll({type:"window",includeUncontrolled:!0});return w(e).map(t=>t.url).filter(t=>!!t)}catch{return[]}}async function Ke(){try{let e=w(await self.clients.matchAll({type:"window",includeUncontrolled:!0}));return e.length===0?null:e.find(r=>O(r.url)!==null)??e[0]}catch{return null}}function Xe(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}async function Je(e,t,r,n){let s={};e.headers.forEach((l,o)=>{o.toLowerCase()!==C&&(s[o]=l)});let i=U(s),u,p=!1;if(e.method!=="GET"&&e.method!=="HEAD"){let l=await e.arrayBuffer();l.byteLength>je?p=!0:l.byteLength>0&&(u=Xe(new Uint8Array(l)))}let g=new MessageChannel,{responsePromise:y}=Q(g.port1),d={type:ae,requestId:Qe(),extensionId:t.extensionId,request:{url:n,method:e.method,headers:i,bodyBase64:u,requestBodyTooLarge:p}};return r.postMessage(d,[g.port2]),y}function Qe(){let e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`}})();
@@ -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-LJJqhB-c.js"></script>
8
+ <script type="module" crossorigin src="/assets/main-CjVUpZQF.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/modulepreload-polyfill-P2Xu9kJm.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Dd_uD5pT.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
@@ -30,21 +30,21 @@
30
30
  <link rel="modulepreload" crossorigin href="/assets/secrets-bridge-client-DCQ44RyR.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/image-markers-BXtVm4og.js">
32
32
  <link rel="modulepreload" crossorigin href="/assets/tool-ui-DfXu6quJ.js">
33
- <link rel="modulepreload" crossorigin href="/assets/providers-DHCoRo7D.js">
33
+ <link rel="modulepreload" crossorigin href="/assets/providers-DePjGjI9.js">
34
34
  <link rel="modulepreload" crossorigin href="/assets/panel-rpc-B3MSVImO.js">
35
35
  <link rel="modulepreload" crossorigin href="/assets/bedrock-camp-compat-CgBMwna8.js">
36
- <link rel="modulepreload" crossorigin href="/assets/account-store-Cf8iMGfy.js">
36
+ <link rel="modulepreload" crossorigin href="/assets/account-store-PGhT8u8K.js">
37
37
  <link rel="modulepreload" crossorigin href="/assets/runtime-env-CgsZ7LTp.js">
38
38
  <link rel="modulepreload" crossorigin href="/assets/messages-BD4p8GuF.js">
39
39
  <link rel="modulepreload" crossorigin href="/assets/tray-runtime-config-D7cmCcHJ.js">
40
- <link rel="modulepreload" crossorigin href="/assets/setup-sudo-BHhYjaWE.js">
41
- <link rel="modulepreload" crossorigin href="/assets/setup-standalone-prelude-p1QRKqF-.js">
40
+ <link rel="modulepreload" crossorigin href="/assets/setup-sudo-B6DI1Any.js">
41
+ <link rel="modulepreload" crossorigin href="/assets/setup-standalone-prelude-B_CwyTA7.js">
42
42
  <link rel="modulepreload" crossorigin href="/assets/telemetry-BVzuNdvW.js">
43
43
  <link rel="modulepreload" crossorigin href="/assets/feature-flags-ByMXaIc4.js">
44
44
  <link rel="modulepreload" crossorigin href="/assets/tray-follower-status-BAjnN7Ar.js">
45
45
  <link rel="modulepreload" crossorigin href="/assets/clipboard-eqmn97SP.js">
46
46
  <link rel="modulepreload" crossorigin href="/assets/tray-join-url-BIvzbiFR.js">
47
- <link rel="modulepreload" crossorigin href="/assets/provider-settings-BkYi4w2e.js">
47
+ <link rel="modulepreload" crossorigin href="/assets/provider-settings-iKaSUXO2.js">
48
48
  </head>
49
49
  <body>
50
50
  <div id="app"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sliccy",
3
- "version": "6.98.0",
3
+ "version": "6.99.0",
4
4
  "description": "Browser-based coding agent with thin CLI server",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-Cew647MY.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/safe-buffer-BwTVRVVo.js","assets/dist-_7dnux20.js","assets/sidecar-repair-431vRT2V.js","assets/backend-hostfs-Com-zF5W.js","assets/api-endpoint-GRCyib6X.js","assets/types-idfTVsM8.js","assets/mount-Cf2lkfPp.js","assets/preload-helper-Czpn1I53.js","assets/mime-types-ugOWOUZ9.js","assets/base64-DpPqYZJF.js","assets/src-CAWTvdAa.js","assets/proxied-fetch-BGeNrvQ4.js","assets/runtime-env-Dlaokqg1.js","assets/fetch-body-D2PwksUW.js","assets/runtime-env-E-i2SW1s.js","assets/backend-local-1YuE96fx.js","assets/tool-ui-DfXu6quJ.js","assets/logger-DDBAeTLF.js","assets/picker-approval-D89YhXsA.js","assets/html-B_Hg2WOy.js","assets/mount-picker-popup-Bc3ca2Vl.js","assets/logger-BoSvu4mW.js","assets/picker-popup-Bwcnocm6.js","assets/runtime-env-CgsZ7LTp.js","assets/mount-table-store-dY2IfQ5S.js","assets/mount-bridge-client-DZE6sHdr.js","assets/port-bridge-client-BhmNRlRv.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,i as r,n as i,r as a,t as o}from"./path-utils-DNJG-zQf.js";import{t as s}from"./types-idfTVsM8.js";import{t as c}from"./virtual-device-paths-9EXC9iPp.js";import{t as l}from"./backend-local-1YuE96fx.js";import{a as u,i as d,n as f,t as p}from"./mount-table-store-dY2IfQ5S.js";import{i as m,r as h,t as g}from"./sidecar-repair-431vRT2V.js";var _=t(`fs-watcher`),v=0;function y(e,t){return t===`/`||e===t||e.startsWith(t+`/`)}var b=class{registrations=new Map;watch(e,t,n){let r=`fsw-${++v}`;return this.registrations.set(r,{id:r,basePath:e,filter:t,callback:n}),_.debug(`Watch registered`,{id:r,basePath:e}),()=>{this.registrations.delete(r),_.debug(`Watch unregistered`,{id:r})}}notify(e){if(e.length!==0)for(let[,t]of this.registrations){let n=e.filter(e=>y(e.path,t.basePath)&&t.filter(e.path));if(n.length>0)try{t.callback(n)}catch(e){_.error(`Watch callback error`,{id:t.id,error:e instanceof Error?e.message:String(e)})}}}dispose(){this.registrations.clear(),_.debug(`All watchers disposed`)}get size(){return this.registrations.size}},x=t(`mount-index`),S=400,C=2e6,w=`SLICC_MOUNT_INDEX_MAX_DEPTH`,T=`SLICC_MOUNT_INDEX_MAX_ENTRIES`,E=256,D=class extends Error{cause;constructor(e,t){super(e),this.name=`MountIndexAbortError`,this.cause=t}};function O(e){let t=e.map(([e,t])=>`${e}\u0000${t.kind}`).sort(),n=t.length>E?t.slice(0,E):t;return`${t.length}\u0001${n.join(``)}`}async function ee(e,t){let n=e.isSameEntry;if(typeof n!=`function`)return!1;try{return await n.call(e,t)}catch{return!1}}function te(e,t){return e instanceof Map?e.get(t):e[t]}function k(e){let t=e.trim();if(t===``)return;let n=Number(t);if(!(!Number.isInteger(n)||n<=0))return n}function A(e,t,n){let r=te(e,t);if(r===void 0||r.trim()===``)return n;let i=k(r);return i===void 0?(x.warn(`Ignoring invalid ${t}; expected a positive integer, using default`,{value:r,fallback:n}),n):i}function j(e){return{maxDepth:A(e,w,S),maxEntries:A(e,T,C)}}var M=class{mounts=new Map;listeners=new Set;registerMount(e,t,n=j({})){this.mounts.get(e)?.abortController?.abort();let r=new AbortController,i={handle:t,state:{status:`pending`,indexed:0},files:new Set,directories:new Set,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(),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=t===`/`?`/`:t+`/`,i=new Map;for(let e of n.files){if(!e.startsWith(r))continue;let t=e.slice(r.length);t.includes(`/`)||i.set(t,`file`)}for(let e of n.directories){if(!e.startsWith(r))continue;let t=e.slice(r.length);t.includes(`/`)||i.set(t,`directory`)}return[...i.entries()].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`)return;n.files.add(e);let r=e;for(;r!==t;){let e=r.lastIndexOf(`/`);if(e<=0)break;r=r.slice(0,e)||`/`,r.length>=t.length&&n.directories.add(r)}}notifyDelete(e){let t=this.findMountForPath(e);if(!t)return;let n=this.mounts.get(t);if(n?.state.status!==`ready`)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)}notifyRename(e,t){let n=this.findMountForPath(e);if(!n)return;let r=this.mounts.get(n);if(r?.state.status===`ready`){if(r.files.has(e)){r.files.delete(e),r.files.add(t);return}if(r.directories.has(e)){r.directories.delete(e),r.directories.add(t);let n=e+`/`,i=t+`/`;for(let e of[...r.files])e.startsWith(n)&&(r.files.delete(e),r.files.add(i+e.slice(n.length)));for(let e of[...r.directories])e.startsWith(n)&&(r.directories.delete(e),r.directories.add(i+e.slice(n.length)))}}}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,x.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 D?r.cause:`indexing-error`;t.state={status:`error`,indexed:0,error:i,abortCause:a},x.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);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 D(`mount indexing aborted: directory nesting exceeded ${t.limits.maxDepth} levels`,`depth-exceeded`);if(t.directories.size+t.files.size>=t.limits.maxEntries)throw new D(`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 D(`mount indexing aborted: exceeded ${n.limits.maxEntries} entries`,`entries-exceeded`);i.push(e)}return i}async confirmNoCycle(e,t,n,r){let i=O(n),a=r.get(i);if(a){for(let n of a)if(await ee(n.handle,t))throw new D(`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}`;s.kind===`file`?(n.files.add(t),n.state.indexed++):s.kind===`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)))}}},N={[c]:{stat:()=>({type:`file`,size:0,mtime:0,ctime:0}),read:e=>(e?.encoding??`utf-8`)===`utf-8`?``:new Uint8Array,readText:()=>``,write:()=>{}}},P=[`/tmp/`],F=class{vfs;allowedPrefixes;readOnlyPrefixes;readGrantPatterns=[];writeEnforcement;constructor(e,t,n=[],r=`hard`){this.vfs=e;let a=e=>{let t=i(e);return t.endsWith(`/`)?t:t+`/`};this.allowedPrefixes=t.map(a),this.readOnlyPrefixes=n.map(a),this.writeEnforcement=r}getAllPrefixes(){let e=this.vfs.listMounts().map(e=>e.endsWith(`/`)?e:e+`/`);return[...this.allowedPrefixes,...this.readOnlyPrefixes,...e,...P]}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,...P].some(e=>t===e.slice(0,-1)||t.startsWith(e))}canWrite(e){return this.isWritable(e)}checkWrite(e){if(this.writeEnforcement!==`sudo-delegated`&&!this.isWritable(e))throw new s(`EACCES`,`permission denied`,i(e))}async resolveAndCheckRead(e){try{let t=await this.vfs.realpath(e);if(!this.isAllowedStrict(t))throw new s(`ENOENT`,`no such file or directory`,i(e));return t}catch(t){throw t instanceof s?t:new s(`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 s(`EACCES`,`permission denied`,i(e));return t}catch(t){throw t instanceof s?t:new s(`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 s&&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 s(`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=N[i(e)];if(n)return n.read(t);if(!this.isAllowedStrict(e))throw new s(`ENOENT`,`no such file or directory`,i(e));let r=await this.resolveAndCheckRead(e);return this.vfs.readFile(r,t)}async readDir(e){if(!this.isAllowed(e))return[];let t=e;if(this.isAllowedStrict(e))try{t=await this.resolveAndCheckRead(e)}catch{return[]}let n=await this.vfs.readDir(t);if(!this.isAllowedStrict(e)){let t=i(e);return n.filter(e=>{let n=t===`/`?`/${e.name}`:`${t}/${e.name}`;return this.isAllowed(n)})}return n}async stat(e){let t=N[i(e)];if(t)return t.stat();if(!this.isAllowed(e))throw new s(`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=N[i(e)];return t?t.stat():!this.isAllowedStrict(e)||this.scanPathForSymlinks(e,!0)!==!1?null:this.vfs.statSync(e)}lstatSync(e){let t=N[i(e)];return t?t.stat():!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){let t;try{t=await this.vfs.realpath(e)}catch(t){throw t instanceof s?t:new s(`ENOENT`,`no such file or directory`,i(e))}if(!this.isAllowedStrict(t))throw new s(`ENOENT`,`no such file or directory`,i(e));return t}async exists(e){if(N[i(e)])return!0;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=N[i(e)];if(t)return t.readText();if(!this.isAllowedStrict(e))throw new s(`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=N[i(e)];if(r){r.write(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 s&&e.code===`EACCES`)throw e}return this.vfs.writeFile(e,t,n)}async mkdir(e,t){return this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.mkdir(e,t)}async rm(e,t){this.checkWrite(e);try{(await this.vfs.lstat(e)).type===`symlink`||await this.resolveAndCheckWrite(e)}catch(e){if(e instanceof s&&e.code===`EACCES`)throw e}return this.vfs.rm(e,t)}async rename(e,t){return this.checkWrite(e),this.checkWrite(t),await this.resolveAndCheckWrite(e),await this.checkParentRealpathEscape(t),this.vfs.rename(e,t)}async copyFile(e,t){if(!this.isAllowed(e))throw new s(`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 s&&e.code===`EACCES`)throw e}return this.vfs.copyFile(n,t)}async symlink(e,t){return this.checkWrite(t),await this.checkParentRealpathEscape(t),this.vfs.symlink(e,t)}async readlink(e){if(!this.isAllowedStrict(e))throw new s(`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 s(`ENOENT`,`no such file or directory`,i(e));return t}async lstat(e){let t=N[i(e)];if(t)return t.stat();if(!this.isAllowed(e))throw new s(`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 s(`ENOENT`,`no such file or directory`,n)}let c=o===`/`?`/${a}`:`${o}/${a}`;if(!this.isAllowed(c))throw new s(`ENOENT`,`no such file or directory`,n);return this.vfs.lstat(c)}watch(e,t,n){if(!this.isAllowed(e))throw new s(`EACCES`,`permission denied`,i(e));let r=this.vfs.getWatcher();if(!r)throw new s(`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.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.mount(e,t,n)}async unmount(e){return this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.unmount(e)}listMounts(){return this.vfs.listMounts()}getMountIndex(){return this.vfs.getMountIndex()}async refreshMount(e,t){return this.checkWrite(e),this.vfs.refreshMount(e,t)}async dispose(){await this.vfs.dispose()}};function I(e,t){if(e instanceof s){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 s(e.code,r,t)}throw e}var L=[`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`EIO`];function R(e,t){if(e instanceof s)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 s(`EIO`,`internal overflow, not storage: ${n} — reload the session`,t)}let n=e?.code;if(typeof n==`string`){let r=n;if(L.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 s(r,n||r,t)}}let r=e instanceof Error?e.message:String(e);return r.includes(`ENOENT`)?new s(`ENOENT`,`no such file or directory`,t):r.includes(`EEXIST`)?new s(`EEXIST`,`file already exists`,t):r.includes(`ENOTDIR`)?new s(`ENOTDIR`,`not a directory`,t):r.includes(`EISDIR`)?new s(`EISDIR`,`is a directory`,t):r.includes(`ENOTEMPTY`)?new s(`ENOTEMPTY`,`directory not empty`,t):r.includes(`ELOOP`)?new s(`ELOOP`,`too many levels of symbolic links`,t):new s(`EINVAL`,r,t)}var z=61440,B=16384;function V(e){return e===void 0?`absent`:(e&z)===B?`directory`:`file`}function H(e,t){return t===`absent`?!1:e.kind===`missing`||e.kind!==t}function U(e){let t=e?.mode;return typeof t==`number`?t:void 0}function W(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=V(U(r));o!==V(U(i))&&a.push({path:n,ownIsDirectory:o===`directory`})}return a}async function G(e,t,n,r){try{return await e.lstat(t)}catch(e){let t=R(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 R(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 s(`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(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 Z(e,t){try{return await e(t)}catch{return t}}async function*Q(e,t,n,r=0){let a=i(t);if(X(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 Z(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*ne(e,t,a===`/`?`/${t.name}`:`${a}/${t.name}`,o,r+1)}async function*ne(e,t,n,r,i){if(t.type===`file`){yield n;return}if(t.type===`symlink`){yield*re(e,n,r,i);return}yield*Q(e,n,r,i)}async function*re(e,t,n,r){try{let i=await e.stat(t);i.type===`file`?yield t:i.type===`directory`&&(yield*Q(e,t,n,r))}catch{}}function $(){try{if(typeof globalThis.navigator?.storage?.getDirectory==`function`)return`opfs`}catch{}return`memory`}function ie(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 ae=class t{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 M;static writeChains=new Map;onRepairProgress;constructor(e,n,r,i,a){if(this.dbName=e,this.onRepairProgress=a,this.backend=r===`opfs`?`opfs`:`memory`,this.lfs=this.makeDeferredLfs(),this.lfsSync=this.makeDeferredLfsSync(),this._ready=this.backend===`opfs`?t.initOpfsBackend(this,i,n===!0):t.initMemoryBackend(this,e,n===!0),this._ready.then(()=>{this._readyResolved=!0},()=>{}),typeof BroadcastChannel<`u`)try{this.mountSyncChannel=new BroadcastChannel(`vfs-mount-sync:${e}`),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 async initOpfsBackend(n,r,i){let a=r??await t.acquireOpfsHandle(n.dbName,i);await t.seedOpfsMetadataSidecarIfMissing(a);let[o,{WebAccess:s}]=await Promise.all([e(()=>import(`./dist-Cew647MY.js`).then(e=>e.t),__vite__mapDeps([0,1,2])),e(()=>import(`./dist-_7dnux20.js`),__vite__mapDeps([3,0,1,2]))]);await t.ensureRootMount(o);let c=`/__opfs__/${n.dbName}`,l=t.opfsBackends.get(n.dbName);if(l&&i){try{o.umount(c)}catch{}t.opfsBackends.delete(n.dbName),l=void 0}if(!l){let r=()=>o.resolveMountConfig({backend:s,handle:a,metadata:`/.metadata.json`}),{resolveWithSidecarRepair:i,repairOpfsMetadataSidecar:u}=await e(async()=>{let{resolveWithSidecarRepair:e,repairOpfsMetadataSidecar:t}=await import(`./sidecar-repair-431vRT2V.js`).then(e=>e.n);return{resolveWithSidecarRepair:e,repairOpfsMetadataSidecar:t}},__vite__mapDeps([4,1]));try{let e=await n.withWriteLock(()=>u(a,n.onRepairProgress));e?.changed&&console.warn(`[virtual-fs] repaired metadata sidecar before mount (#2146)`,{dbName:n.dbName,kindFixed:e.kindFixed,sizesFixed:e.sizesFixed,dropped:e.dropped,inosReassigned:e.inosReassigned,nlinksFixed:e.nlinksFixed,selfEntryDropped:e.selfEntryDropped})}catch{}let d=await i(r,()=>n.withWriteLock(()=>u(a,n.onRepairProgress)),e=>console.warn(`[virtual-fs] repaired poisoned metadata sidecar; retrying mount`,{dbName:n.dbName,kindFixed:e.kindFixed,sizesFixed:e.sizesFixed,dropped:e.dropped,nlinksFixed:e.nlinksFixed,selfEntryDropped:e.selfEntryDropped}));try{o.mount(c,d)}catch{}l={backendFs:d,refs:0,sidecarDirty:{paths:new Set,prefixes:new Set}},t.opfsBackends.set(n.dbName,l)}l.refs+=1,n.opfsBackendFs=l.backendFs.index?l.backendFs:null,n.opfsHandle=a,n.mountRoot=c,n.rawLfs=o.promises,n.rawLfsSync=o}static async initMemoryBackend(n,r,i){let a=await e(()=>import(`./dist-Cew647MY.js`).then(e=>e.t),__vite__mapDeps([0,1,2]));await t.ensureRootMount(a);let o=`/__zenfs__/${r}`,s=t.memoryBackends.get(r);if(s&&i){try{a.umount(o)}catch{}t.memoryBackends.delete(r),s=void 0}s||(s={store:a.InMemory.create({label:r}),refs:0},t.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(e){return t.rootMountReady===null&&(t.rootMountReady=(async()=>{await e.configureSingle({backend:e.InMemory,label:`__vfs_root__`})})()),t.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(e){let t=`.metadata.json`;try{await e.getFileHandle(t);return}catch(e){if(e?.name!==`NotFoundError`)throw e}let n=await(await e.getFileHandle(t,{create:!0})).createWritable(),r=JSON.stringify({version:1,maxSize:4294967295,entries:{}});await n.write(r),await n.close()}static async acquireOpfsHandle(e,t){let n=navigator.storage;if(!n?.getDirectory)throw new s(`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(e){return new t(e)}static async create(e){let n=e?.dbName??`browser-fs`,r=e?.wipe===!0,i=e?.backend??$(),a=new t(n,r,i,void 0,e?.onRepairProgress);return await a._ready,r&&await p().catch(()=>{}),a}async flush(){await this.writeOpfsMetadataSidecar()}async writeOpfsMetadataSidecar(){this.backend===`opfs`&&await this.withWriteLock(()=>this.writeOpfsMetadataSidecarUnlocked())}async writeOpfsMetadataSidecarUnlocked(){if(this.backend!==`opfs`)return;let e=this.opfsBackendFs,n=this.opfsHandle;if(!e||!n)return;let r=e.index.toJSON(),i=t.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=h(e,r,i))}let o=JSON.stringify(m(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=W(e,t,n.paths,n.prefixes);if(i.length===0)return;let a=g(r),o=this.opfsBackendFs;for(let n of i){let r=await a(n.path).catch(()=>null);if(r!==null&&r.kind!==`missing`&&r.kind===`directory`===n.ownIsDirectory)continue;let i=t.entries?.[n.path];e.entries&&i!==void 0&&(e.entries[n.path]=i);let s=r!==null&&r.kind!==`missing`;s&&(o?.index?.delete(n.path),o?._handles?.delete(n.path)),console.warn(`[virtual-fs] refused to flush in-memory kind flip over sidecar record (#2006)`,{path:n.path,reality:r?.kind??`unverifiable`,evicted:s})}}markSidecarDirty(e,r=`path`){if(this.backend!==`opfs`)return;let a=t.opfsBackends.get(this.dbName)?.sidecarDirty;if(!a)return;let o=i(e);(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 g(n)(a),s=V(t.index.get(a)?.mode),c=t._handles?.get(a),l=c?.kind===`directory`?`directory`:c?.kind===`file`?`file`:`absent`,u=H(o,s),d=H(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 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`?t.opfsBackends:t.memoryBackends,r=n.get(this.dbName);if(r&&(--r.refs,r.refs<=0)){n.delete(this.dbName);try{(await e(()=>import(`./dist-Cew647MY.js`).then(e=>e.t),__vite__mapDeps([0,1,2]))).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({name:i,type:a})}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}}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};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}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch{return null}}async mount(e,t,r){let a=i(e);if(this.mountPoints.has(a))throw new s(`EEXIST`,`mount point is already mounted`,a);try{if((await this.lstat(a)).type!==`directory`)throw new s(`ENOTDIR`,`mount point must be a directory`,a);if((await this.readDir(a)).length>0)throw new s(`ENOTEMPTY`,`mount point must be empty to avoid shadowing existing files`,a)}catch(e){if(!(e instanceof s)||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??j(r?.env??{});this.mountIndex.registerMount(a,t.getHandle(),e)}let c=ie(t,a);try{this.mountSyncChannel?.postMessage({type:`mount`,path:a,descriptor:c})}catch{}if(this.watcher?.notify([{type:`modify`,path:a,entryType:`directory`}]),t.kind!==`hostfs`)try{let e={targetPath:a,descriptor:c,createdAt:Date.now()},n=t.kind===`local`?t.getHandle():void 0;await u(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 d(t)}catch{}}async reconstructBackendFromDescriptor(t,n){switch(t.kind){case`local`:{let e=await f(t.idbHandleKey);if(!e)throw Error(`no handle stored for ${t.idbHandleKey}`);return l.fromHandle(e,{mountId:t.mountId})}case`hostfs`:{let{HostFsMountBackend:r}=await e(async()=>{let{HostFsMountBackend:e}=await import(`./backend-hostfs-Com-zF5W.js`);return{HostFsMountBackend:e}},__vite__mapDeps([5,6,7]));return new r({targetPath:n,hostPath:t.hostPath,mountId:t.mountId})}case`s3`:{let{S3MountBackend:n,RemoteMountCache:r,makeSignedFetchS3:i}=await e(async()=>{let{S3MountBackend:e,RemoteMountCache:t,makeSignedFetchS3:n}=await import(`./mount-Cf2lkfPp.js`);return{S3MountBackend:e,RemoteMountCache:t,makeSignedFetchS3:n}},__vite__mapDeps([8,9,10,11,12,13,1,14,15,6,16,7,17,18,19,20,21,22,23,24,25,26,27,28])),a=new r({mountId:t.mountId,ttlMs:3e4});return new n({source:t.source,profile:t.profile,cache:a,mountId:t.mountId,signedFetch:i(t.profile)})}case`da`:{let{DaMountBackend:n,RemoteMountCache:r,makeSignedFetchDa:i}=await e(async()=>{let{DaMountBackend:e,RemoteMountCache:t,makeSignedFetchDa:n}=await import(`./mount-Cf2lkfPp.js`);return{DaMountBackend:e,RemoteMountCache:t,makeSignedFetchDa:n}},__vite__mapDeps([8,9,10,11,12,13,1,14,15,6,16,7,17,18,19,20,21,22,23,24,25,26,27,28])),a=new r({mountId:t.mountId,ttlMs:3e4});return new n({source:t.source,profile:t.profile,cache:a,mountId:t.mountId,signedFetch:i()})}case`aem`:{let{AemMountBackend:n,RemoteMountCache:r,makeSignedFetchDa:i}=await e(async()=>{let{AemMountBackend:e,RemoteMountCache:t,makeSignedFetchDa:n}=await import(`./mount-Cf2lkfPp.js`);return{AemMountBackend:e,RemoteMountCache:t,makeSignedFetchDa:n}},__vite__mapDeps([8,9,10,11,12,13,1,14,15,6,16,7,17,18,19,20,21,22,23,24,25,26,27,28])),a=new r({mountId:t.mountId,ttlMs:3e4});return new n({source:t.source,profile:t.profile,cache:a,mountId:t.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}async mountInternal(e,t){let r=i(e);if(this.mountPoints.has(r))throw new s(`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 s(`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 s(`ENOENT`,`not a mount point`,n);let a=await r.refresh(t);return r.kind===`local`&&await this.mountIndex.refreshMount(n,j(t?.env??{})),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 s(`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){I(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 R(e,n)}}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 s(`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){I(e,a)}this.watcher?.notify([{type:n?`modify`:`create`,path:a,entryType:`file`}]),this.mountIndex.notifyWrite(a);return}let c;try{c=await this.resolveSymlinks(a)}catch{c=a}let l=!1;try{await this.lfs.stat(c),l=!0}catch{}let{dir:u}=n(c);await this.withWriteLock(async()=>{this.markSidecarDirty(c),u!==`/`&&await this.mkdirRecursiveUnlocked(u);let e=typeof t==`string`?new TextEncoder().encode(t).byteLength:(t instanceof Uint8Array,t.byteLength);try{await this.lfs.writeFile(c,t)}catch(e){if(u!==`/`&&e instanceof Error&&e.message.includes(`ENOENT`)){await this.mkdirRecursiveUnlocked(u);try{await this.lfs.writeFile(c,t)}catch(e){throw R(e,a)}}else throw R(e,a)}try{await this.lfs.truncate?.(c,e)}catch(e){throw R(e,a)}}),this.watcher?.notify([{type:l?`modify`:`create`,path:c,entryType:`file`}])}async readDir(e){let t=i(e),n=this.findMount(t);return n?this.readDirMounted(t,n):this.readDirLocal(t)}async readDirMounted(e,t){let n=this.mountIndex.getDirectoryEntries(t.path,e);if(n!==void 0){let t=new Map;for(let e of n)t.set(e.name,{name:e.name,type:e.type});return this.addNestedMountEntries(t,e),[...t.values()]}let r=t.relParts.join(`/`)||`/`,i;try{i=await t.backend.readDir(r)}catch(t){I(t,e)}let a=new Map;for(let e of i)a.set(e.name,{name:e.name,type:e.kind===`directory`?`directory`:`file`});return this.addNestedMountEntries(a,e),[...a.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 R(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`}}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(e){let n=this.dbName,r,i=new Promise(e=>{r=e}),a=t.writeChains.get(n)??Promise.resolve();t.writeChains.set(n,i),await a;try{let t=globalThis.navigator?.locks;return this.backend!==`opfs`||typeof t?.request!=`function`?await e():await t.request(`slicc-vfs:${n}`,()=>e())}finally{r(),t.writeChains.get(n)===i&&t.writeChains.delete(n)}}async mkdirRecursiveUnlocked(e){let t=e.split(`/`).filter(Boolean),n=``;for(let e of t){n+=`/`+e;try{await this.lfs.mkdir(n)}catch(e){if(e instanceof Error&&!e.message.includes(`EEXIST`))throw R(e,n);try{let e=await this.lfs.lstat(n);if(!e.isDirectory()&&!e.isSymbolicLink())throw new s(`ENOTDIR`,`not a directory`,n)}catch(e){if(e instanceof s&&e.code===`ENOTDIR`)throw e}}}}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){I(e,n)}t||this.watcher?.notify([{type:`create`,path:n,entryType:`directory`}]);return}t?.recursive?await this.withWriteLock(()=>(this.markSidecarDirty(n),this.mkdirRecursiveUnlocked(n))):(await this.withWriteLock(async()=>{this.markSidecarDirty(n);try{await this.lfs.mkdir(n)}catch(e){throw R(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 s(`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){I(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 R(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.mtime}}catch(e){I(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}}catch(e){throw R(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),a;try{a=(await this.lstat(n)).type}catch{}let o=this.findMount(n);if(o?.backend.rename){let e=this.findMount(r);if(e&&e.backend===o.backend){try{await o.backend.rename(o.relParts.join(`/`),e.relParts.join(`/`))}catch(e){I(e,n)}this.watcher?.notify([{type:`delete`,path:n,entryType:a},{type:`create`,path:r,entryType:a}]),this.mountIndex.notifyRename(n,r);return}}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 R(e,n)}this.watcher?.notify([{type:`delete`,path:n,entryType:a},{type:`create`,path:r,entryType:a}]),this.mountIndex.notifyRename(n,r)}async readTextFile(e){return await this.readFile(e,{encoding:`utf-8`})}async*walk(e,t,n=0){yield*Q({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){if((await this.stat(e)).type===`directory`)throw new s(`EISDIR`,`is a directory`,e);let n=await this.readFile(e,{encoding:`binary`});await this.writeFile(t,n)}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 s(`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 R(e,r)}}else throw R(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 R(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}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch(e){throw R(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)}};export{s as FsError,b as FsWatcher,M as MountIndex,F as RestrictedFS,ae as VirtualFS,o as joinPath,i as normalizePath,r as pathSegments,$ as resolveVfsBackendFromEnv,n as splitPath};
@@ -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{t as s}from"./backend-local-B6kc_FvN.js";import{t as c}from"./types-idfTVsM8.js";import{a as l,i as u,n as d,t as f}from"./mount-table-store-DrF_Ifaz.js";import{r as p,t as m}from"./mount-index-CD1UKs2l.js";import{i as h,r as g,t as _}from"./sidecar-repair-CIHuOk7H.js";const v=t(`fs-watcher`);let y=0;function b(e,t){return t===`/`||e===t||e.startsWith(t+`/`)}var x=class{registrations=new Map;watch(e,t,n){let r=`fsw-${++y}`;return this.registrations.set(r,{id:r,basePath:e,filter:t,callback:n}),v.debug(`Watch registered`,{id:r,basePath:e}),()=>{this.registrations.delete(r),v.debug(`Watch unregistered`,{id:r})}}notify(e){if(e.length!==0)for(let[,t]of this.registrations){let n=e.filter(e=>b(e.path,t.basePath)&&t.filter(e.path));if(n.length>0)try{t.callback(n)}catch(e){v.error(`Watch callback error`,{id:t.id,error:e instanceof Error?e.message:String(e)})}}}dispose(){this.registrations.clear(),v.debug(`All watchers disposed`)}get size(){return this.registrations.size}};const S=`/dev/null`,C=new Set([S]);function w(e){return C.has(e)}const T={[S]:{stat:()=>({type:`file`,size:0,mtime:0,ctime:0}),read:e=>(e?.encoding??`utf-8`)===`utf-8`?``:new Uint8Array,readText:()=>``,write:()=>{}}},E=[`/tmp/`];var D=class{vfs;allowedPrefixes;readOnlyPrefixes;readGrantPatterns=[];writeEnforcement;constructor(e,t,n=[],r=`hard`){this.vfs=e;let a=e=>{let t=i(e);return t.endsWith(`/`)?t:t+`/`};this.allowedPrefixes=t.map(a),this.readOnlyPrefixes=n.map(a),this.writeEnforcement=r}getAllPrefixes(){let e=this.vfs.listMounts().map(e=>e.endsWith(`/`)?e:e+`/`);return[...this.allowedPrefixes,...this.readOnlyPrefixes,...e,...E]}setReadGrants(e){this.readGrantPatterns=[];for(let t of new Set(e))this.addReadGrant(t)}addReadGrant(e){let t=e.split(`/`),n=[];for(let e=1;e<t.length;e++)n.push(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,...E].some(e=>t===e.slice(0,-1)||t.startsWith(e))}canWrite(e){return 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=T[i(e)];if(n)return n.read(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 readDir(e){if(!this.isAllowed(e))return[];let t=e;if(this.isAllowedStrict(e))try{t=await this.resolveAndCheckRead(e)}catch{return[]}let n=await this.vfs.readDir(t);if(!this.isAllowedStrict(e)){let t=i(e);return n.filter(e=>{let n=t===`/`?`/${e.name}`:`${t}/${e.name}`;return this.isAllowed(n)})}return n}async stat(e){let t=T[i(e)];if(t)return t.stat();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=T[i(e)];return t?t.stat():!this.isAllowedStrict(e)||this.scanPathForSymlinks(e,!0)!==!1?null:this.vfs.statSync(e)}lstatSync(e){let t=T[i(e)];return t?t.stat():!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){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(T[i(e)])return!0;if(!this.isAllowed(e))return!1;if(this.isAllowedStrict(e))try{await this.resolveAndCheckRead(e)}catch{return!1}return this.vfs.exists(e)}async readTextFile(e){let t=T[i(e)];if(t)return t.readText();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=T[i(e)];if(r){r.write(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)}async mkdir(e,t){return this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.mkdir(e,t)}async rm(e,t){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.checkWrite(e),this.checkWrite(t),await this.resolveAndCheckWrite(e),await this.checkParentRealpathEscape(t),this.vfs.rename(e,t)}async copyFile(e,t){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.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=T[i(e)];if(t)return t.stat();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.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.mount(e,t,n)}async unmount(e){return this.checkWrite(e),await this.checkParentRealpathEscape(e),this.vfs.unmount(e)}listMounts(){return this.vfs.listMounts()}getMountIndex(){return this.vfs.getMountIndex()}async refreshMount(e,t){return this.checkWrite(e),this.vfs.refreshMount(e,t)}async dispose(){await this.vfs.dispose()}};function O(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 k=[`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`EIO`];function A(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(k.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):new c(`EINVAL`,r,t)}function j(e){return e===void 0?`absent`:(e&61440)==16384?`directory`:`file`}function M(e,t){return t===`absent`?!1:e.kind===`missing`||e.kind!==t}function N(e){let t=e?.mode;return typeof t==`number`?t:void 0}function P(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=j(N(r));o!==j(N(i))&&a.push({path:n,ownIsDirectory:o===`directory`})}return a}async function F(e,t,n,r){try{return await e.lstat(t)}catch(e){let t=A(e,r);if(t.code===`ENOENT`&&n)return null;throw t}}async function I(e,t,r){let a;try{a=await e.readlink(t)}catch(e){throw A(e,r)}return a.startsWith(`/`)?i(a):i(o(n(t).dir,a))}async function L(e,t,n,r,i,a){let o=t===`/`?`/${n}`:`${t}/${n}`;for(;;){let t=await F(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 I(e,o,i)}}async function R(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 L(e,o,a[t],t===a.length-1,r,s);o=n.resolved,s=n.hops}return o}async function z(e,t,n){return t(n)?n:R(e,t,n)}function B(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 V(e,t){try{return await e(t)}catch{return t}}async function*H(e,t,n,r=0){let a=i(t);if(B(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 V(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*U(e,t,a===`/`?`/${t.name}`:`${a}/${t.name}`,o,r+1)}async function*U(e,t,n,r,i){if(t.type===`file`){yield n;return}if(t.type===`symlink`){yield*W(e,n,r,i);return}yield*H(e,n,r,i)}async function*W(e,t,n,r){try{let i=await e.stat(t);i.type===`file`?yield t:i.type===`directory`&&(yield*H(e,t,n,r))}catch{}}function G(){try{if(typeof globalThis.navigator?.storage?.getDirectory==`function`)return`opfs`}catch{}return`memory`}function K(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 q=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 m;static writeChains=new Map;onRepairProgress;constructor(t,n,r,i,a){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):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 async initOpfsBackend(t,n,r){let i=n??await e.acquireOpfsHandle(t.dbName,r);await e.seedOpfsMetadataSidecarIfMissing(i);let[a,{WebAccess:o}]=await Promise.all([import(`./dist-C56QxoYU.js`).then(e=>e.t),import(`./dist-D7yTTAcb.js`)]);await e.ensureRootMount(a);let s=`/__opfs__/${t.dbName}`,c=e.opfsBackends.get(t.dbName);if(c&&r){try{a.umount(s)}catch{}e.opfsBackends.delete(t.dbName),c=void 0}if(!c){let n=()=>a.resolveMountConfig({backend:o,handle:i,metadata:`/.metadata.json`}),{resolveWithSidecarRepair:r,repairOpfsMetadataSidecar:l}=await import(`./sidecar-repair-CIHuOk7H.js`).then(e=>e.n);try{let e=await t.withWriteLock(()=>l(i,t.onRepairProgress));e?.changed&&console.warn(`[virtual-fs] repaired metadata sidecar before mount (#2146)`,{dbName:t.dbName,kindFixed:e.kindFixed,sizesFixed:e.sizesFixed,dropped:e.dropped,inosReassigned:e.inosReassigned,nlinksFixed:e.nlinksFixed,selfEntryDropped:e.selfEntryDropped})}catch{}let u=await r(n,()=>t.withWriteLock(()=>l(i,t.onRepairProgress)),e=>console.warn(`[virtual-fs] repaired poisoned metadata sidecar; retrying mount`,{dbName:t.dbName,kindFixed:e.kindFixed,sizesFixed:e.sizesFixed,dropped:e.dropped,nlinksFixed:e.nlinksFixed,selfEntryDropped:e.selfEntryDropped}));try{a.mount(s,u)}catch{}c={backendFs:u,refs:0,sidecarDirty:{paths:new Set,prefixes:new Set}},e.opfsBackends.set(t.dbName,c)}c.refs+=1,t.opfsBackendFs=c.backendFs.index?c.backendFs:null,t.opfsHandle=i,t.mountRoot=s,t.rawLfs=a.promises,t.rawLfsSync=a}static async initMemoryBackend(t,n,r){let i=await import(`./dist-C56QxoYU.js`).then(e=>e.t);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(e){let t=`.metadata.json`;try{await e.getFileHandle(t);return}catch(e){if(e?.name!==`NotFoundError`)throw e}let n=await(await e.getFileHandle(t,{create:!0})).createWritable(),r=JSON.stringify({version:1,maxSize:4294967295,entries:{}});await n.write(r),await n.close()}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??G(),a=new e(n,r,i,void 0,t?.onRepairProgress);return await a._ready,r&&await f().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=g(e,r,i))}let o=JSON.stringify(h(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=P(e,t,n.paths,n.prefixes);if(i.length===0)return;let a=_(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 _(n)(a),s=j(t.index.get(a)?.mode),c=t._handles?.get(a),l=c?.kind===`directory`?`directory`:c?.kind===`file`?`file`:`absent`,u=M(o,s),d=M(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 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-C56QxoYU.js`).then(e=>e.t)).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({name:i,type:a})}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}}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};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}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}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??p(r?.env??{});this.mountIndex.registerMount(a,t.getHandle(),e)}let s=K(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 l(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 u(t)}catch{}}async reconstructBackendFromDescriptor(e,t){switch(e.kind){case`local`:{let t=await d(e.idbHandleKey);if(!t)throw Error(`no handle stored for ${e.idbHandleKey}`);return s.fromHandle(t,{mountId:e.mountId})}case`hostfs`:{let{HostFsMountBackend:n}=await import(`./backend-hostfs-bQQx-S0W.js`);return new n({targetPath:t,hostPath:e.hostPath,mountId:e.mountId})}case`s3`:{let{S3MountBackend:t,RemoteMountCache:n,makeSignedFetchS3:r}=await import(`./mount-Dd6uEK1p.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-Dd6uEK1p.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-Dd6uEK1p.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}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,p(t?.env??{})),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){O(e,n)}}let a=await this.resolveSymlinks(n);try{return(t?.encoding??`utf-8`)===`utf-8`?await this.lfs.readFile(a,{encoding:`utf8`}):await this.lfs.readFile(a)}catch(e){throw A(e,n)}}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){O(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 A(e,a)}}else throw A(e,a)}try{await this.lfs.truncate?.(s,e)}catch(e){throw A(e,a)}}),this.watcher?.notify([{type:l?`modify`:`create`,path:s,entryType:`file`}])}async readDir(e){let t=i(e),n=this.findMount(t);return n?this.readDirMounted(t,n):this.readDirLocal(t)}async readDirMounted(e,t){let n=this.mountIndex.getDirectoryEntries(t.path,e);if(n!==void 0){let t=new Map;for(let e of n)t.set(e.name,{name:e.name,type:e.type});return this.addNestedMountEntries(t,e),[...t.values()]}let r=t.relParts.join(`/`)||`/`,i;try{i=await t.backend.readDir(r)}catch(t){O(t,e)}let a=new Map;for(let e of i)a.set(e.name,{name:e.name,type:e.kind===`directory`?`directory`:`file`});return this.addNestedMountEntries(a,e),[...a.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 A(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`}}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=``;for(let e of t){n+=`/`+e;try{await this.lfs.mkdir(n)}catch(e){if(e instanceof Error&&!e.message.includes(`EEXIST`))throw A(e,n);try{let e=await this.lfs.lstat(n);if(!e.isDirectory()&&!e.isSymbolicLink())throw new c(`ENOTDIR`,`not a directory`,n)}catch(e){if(e instanceof c&&e.code===`ENOTDIR`)throw e}}}}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){O(e,n)}t||this.watcher?.notify([{type:`create`,path:n,entryType:`directory`}]);return}t?.recursive?await this.withWriteLock(()=>(this.markSidecarDirty(n),this.mkdirRecursiveUnlocked(n))):(await this.withWriteLock(async()=>{this.markSidecarDirty(n);try{await this.lfs.mkdir(n)}catch(e){throw A(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){O(e,n)}this.watcher?.notify([{type:`delete`,path:n,entryType:e}]),this.mountIndex.notifyDelete(n);return}try{let e=await this.lfs.lstat(n);await this.withWriteLock(async()=>{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 A(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.mtime}}catch(e){O(e,t)}}let r=await this.resolveSymlinks(t);try{let e=await this.lfs.stat(r);return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch(e){throw A(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),a;try{a=(await this.lstat(n)).type}catch{}let o=this.findMount(n);if(o?.backend.rename){let e=this.findMount(r);if(e&&e.backend===o.backend){try{await o.backend.rename(o.relParts.join(`/`),e.relParts.join(`/`))}catch(e){O(e,n)}this.watcher?.notify([{type:`delete`,path:n,entryType:a},{type:`create`,path:r,entryType:a}]),this.mountIndex.notifyRename(n,r);return}}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 A(e,n)}this.watcher?.notify([{type:`delete`,path:n,entryType:a},{type:`create`,path:r,entryType:a}]),this.mountIndex.notifyRename(n,r)}async readTextFile(e){return await this.readFile(e,{encoding:`utf-8`})}async*walk(e,t,n=0){yield*H({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){if((await this.stat(e)).type===`directory`)throw new c(`EISDIR`,`is a directory`,e);let n=await this.readFile(e,{encoding:`binary`});await this.writeFile(t,n)}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 A(e,r)}}else throw A(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 A(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}}return{type:e.isDirectory()?`directory`:`file`,size:e.size,mtime:e.mtimeMs,ctime:e.ctimeMs}}catch(e){throw A(e,t)}}async realpath(e){return R(this.lfs,e=>this.findMount(e)!==null,e)}resolveSymlinks(e){return z(this.lfs,e=>this.findMount(e)!==null,e)}},J=e({FsError:()=>c,FsWatcher:()=>x,MountIndex:()=>m,RestrictedFS:()=>D,VirtualFS:()=>q,joinPath:()=>o,normalizePath:()=>i,pathSegments:()=>r,resolveVfsBackendFromEnv:()=>G,splitPath:()=>n});export{x as a,w as i,q as n,D as r,J as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./store-D_r1IcQo.js";export{e as readMcpAuthEntries};
@@ -1 +0,0 @@
1
- import{t as e}from"./types-idfTVsM8.js";function t(e){return new i(e)}var n=3e4,r=`vfs-r-`,i=class{transport;log;genId;requestTimeoutMs;pending=new Map;unsubscribe=null;counter=0;constructor(e){this.transport=e.transport,this.log=e.logger??console,this.requestTimeoutMs=e.requestTimeoutMs??n,this.genId=e.generateRequestId??(()=>{this.counter=this.counter+1>>>0;let e=Math.random().toString(36).slice(2,8);return`${r}${this.counter.toString(36)}-${e}`}),this.unsubscribe=this.transport.onMessage(e=>{if(!a(e)||e.source!==`offscreen`)return;let t=e.payload;o(t)&&this.handleResult(t)})}readDir(e){let t=this.genId(),n={type:`vfs-read-dir`,requestId:t,path:e};return this.request(t,`vfs-read-dir-result`,e,n)}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)}stat(e){let t=this.genId(),n={type:`vfs-stat`,requestId:t,path:e};return this.request(t,`vfs-stat-result`,e,n)}dispose(){this.unsubscribe?.(),this.unsubscribe=null;for(let[,t]of this.pending)t.timer!==null&&clearTimeout(t.timer),t.reject(new e(`EBADF`,`RemoteVfsClient disposed`,t.path));this.pending.clear()}request(t,n,r,i){return new Promise((a,o)=>{let s=null;this.requestTimeoutMs>0&&(s=setTimeout(()=>{this.pending.delete(t)&&o(new e(`EIO`,`vfs-rpc request timed out after ${this.requestTimeoutMs}ms (${n})`,r))},this.requestTimeoutMs)),this.pending.set(t,{resolve:a,reject:o,expect:n,path:r,timer:s});try{this.transport.send(i)}catch(e){this.pending.delete(t),s!==null&&clearTimeout(s),o(e)}})}handleResult(t){let n=this.pending.get(t.requestId);if(!n){t.requestId.startsWith(r)&&this.log.debug?.(`[remote-vfs-client] drop unmatched response`,{type:t.type,requestId:t.requestId});return}if(n.timer!==null&&clearTimeout(n.timer),n.expect!==t.type){this.pending.delete(t.requestId),n.reject(new e(`EIO`,`vfs-rpc response type mismatch (got ${t.type})`,n.path));return}if(this.pending.delete(t.requestId),t.ok===!1){n.reject(s(t.error.code,t.error.message,t.error.path??n.path));return}switch(t.type){case`vfs-read-dir-result`:n.resolve(t.entries);return;case`vfs-read-file-result`:n.resolve(t.data);return;case`vfs-stat-result`:n.resolve(t.stats);return}}};function a(e){return typeof e==`object`&&!!e&&`source`in e&&`payload`in e}function o(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`}function s(t,n,r){let i=[`ENOENT`,`EEXIST`,`ENOTDIR`,`EISDIR`,`ENOTEMPTY`,`EINVAL`,`EACCES`,`ELOOP`,`EBUSY`,`EFBIG`,`EBADF`,`EIO`].includes(t)?t:`EIO`;return new e(i,n,r)}export{t as createRemoteVfsClient};
@@ -1 +0,0 @@
1
- function e(){return{version:`6.98.0`,releasedAt:`2026-08-26T11:01:15Z`,buildId:`6.98.0-mt9zh3ma`}}let t=null;function n(e){t=e}function r(){return t}export{e as n,n as r,r as t};