sliccy 6.76.0 → 6.77.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.
- package/dist/ui/.vite/manifest.json +132 -132
- package/dist/ui/assets/{account-store-BxGdz4En.js → account-store-De_TsgNS.js} +1 -1
- package/dist/ui/assets/{account-store-BOO_CzoH.js → account-store-bVEfH-i1.js} +1 -1
- package/dist/ui/assets/{adobe-BS726v5F.js → adobe-CGqrUz1Y.js} +1 -1
- package/dist/ui/assets/{adobe-DRIeZ7SH.js → adobe-CsU1dmjd.js} +1 -1
- package/dist/ui/assets/{apply-layout-8FDKkAyS.js → apply-layout-CY5gbE-i.js} +1 -1
- package/dist/ui/assets/{apps-Dy99L1_j.js → apps-vs-BVQNd.js} +1 -1
- package/dist/ui/assets/{azure-openai-2PeEIEpE.js → azure-openai-DosGMzDb.js} +1 -1
- package/dist/ui/assets/{azure-openai-CSLwIPI9.js → azure-openai-DtTNvGOT.js} +1 -1
- package/dist/ui/assets/{cerebras-Ba7Z9duV.js → cerebras-BYO1lkzs.js} +1 -1
- package/dist/ui/assets/{cerebras-QV_fd2ps.js → cerebras-Bmyzp-zX.js} +1 -1
- package/dist/ui/assets/{connect-surface-CTu0wr2Y.js → connect-surface-B4rlBU-8.js} +1 -1
- package/dist/ui/assets/{dist-CbS97zBQ.js → dist-B49ZrWMI.js} +1 -1
- package/dist/ui/assets/{dist-BC2_PL11.js → dist-C9DoSbIs.js} +1 -1
- package/dist/ui/assets/{dist-lsxvfsEu.js → dist-DXFsi5vc.js} +1 -1
- package/dist/ui/assets/{dist-R_O83owj.js → dist-Dk3FjOeV.js} +1 -1
- package/dist/ui/assets/{fs-Boij2gPF.js → fs-BCHhJeBr.js} +1 -1
- package/dist/ui/assets/{fs-3kOP04jS.js → fs-C_rsgblo.js} +2 -2
- package/dist/ui/assets/{github-BjNCMOTH.js → github-UAVy7vuV.js} +1 -1
- package/dist/ui/assets/{github-copilot-DlzADrSr.js → github-copilot-DJaloPXe.js} +1 -1
- package/dist/ui/assets/{github-copilot-7vobYWUU.js → github-copilot-Dv6Tbnfe.js} +1 -1
- package/dist/ui/assets/{github-install-B8nRAI8z.js → github-install-D4ez_Fes.js} +1 -1
- package/dist/ui/assets/{github-DGwuCXij.js → github-lYedv6El.js} +2 -2
- package/dist/ui/assets/{github-zip-7k6aGRi5.js → github-zip-DhP92o0b.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-BH_Uhjou.js → js-realm-worker-jrHPVSxc.js} +1 -1
- package/dist/ui/assets/{kernel-worker-COfVGbIN.js → kernel-worker-CwMofD35.js} +546 -546
- package/dist/ui/assets/{local-llm-CDx8pQEL.js → local-llm-BIQIX2zz.js} +1 -1
- package/dist/ui/assets/{local-llm-Ca41QR9W.js → local-llm-CbcMvXaz.js} +1 -1
- package/dist/ui/assets/{main-CBjLDGjV.js → main-Bq1HBP85.js} +3 -3
- package/dist/ui/assets/{mount-BNWucV-S.js → mount-BbZCKptE.js} +2 -2
- package/dist/ui/assets/{mount-Dcl0CQrv.js → mount-DjyUp2dd.js} +1 -1
- package/dist/ui/assets/{mount-recovery-B1Eib3Wt.js → mount-recovery-BruKweZb.js} +1 -1
- package/dist/ui/assets/{new-session-CGv5e7P7.js → new-session-huVBjjzQ.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-DBbtYdzz.js → oauth-bootstrap-BmWuG2rE.js} +2 -2
- package/dist/ui/assets/{openai-codex-CZs8JRSw.js → openai-codex-BubNbqI-.js} +1 -1
- package/dist/ui/assets/{openai-codex-BTUlRTto.js → openai-codex-DHVs2Np8.js} +1 -1
- package/dist/ui/assets/{openrouter-DYhI1zom.js → openrouter-COJNpYJ7.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-DK-5hp2X.js → openrouter-oauth-DGyh6uTl.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-C6mgQiRV.js → openrouter-oauth-Dc4HIytd.js} +1 -1
- package/dist/ui/assets/{openrouter-Bvd2Eqif.js → openrouter-qx31i_3q.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-BXCRWF2E.js → panel-rpc-handlers-uTtbnQ-T.js} +2 -2
- package/dist/ui/assets/{provider-xByUgvpM.js → provider-B1ktTd1p.js} +1 -1
- package/dist/ui/assets/{provider-DxVWgpTU.js → provider-CLmpi6v_.js} +2 -2
- package/dist/ui/assets/{provider-settings-DByKbVop.js → provider-settings-BRDtbslv.js} +1 -1
- package/dist/ui/assets/{provider-settings-BWmqGvFK.js → provider-settings-BtqihEI0.js} +1 -1
- package/dist/ui/assets/provider-store-access-D8ImPUZ_.js +1 -0
- package/dist/ui/assets/{provider-store-access-BQfEu3u9.js → provider-store-access-Dodlst86.js} +2 -2
- package/dist/ui/assets/{providers-DH1Mhm__.js → providers-BwF5xVyN.js} +1 -1
- package/dist/ui/assets/{providers-Db_Doqrk.js → providers-C8tlUswj.js} +2 -2
- package/dist/ui/assets/{quick-llm-nv9Pz0pZ.js → quick-llm-BqTUJESa.js} +1 -1
- package/dist/ui/assets/{recovery-screen-0OnsBXuN.js → recovery-screen-Dy9kEn0F.js} +1 -1
- package/dist/ui/assets/{redirect-uri-DVwxCbAH.js → redirect-uri-PiFA5zYB.js} +1 -1
- package/dist/ui/assets/{session-freezer-BVmmPVzM.js → session-freezer-DapToxvf.js} +3 -3
- package/dist/ui/assets/{setup-feature-flags-remote-DCYtiT5O.js → setup-feature-flags-remote-BnkkTBSb.js} +1 -1
- package/dist/ui/assets/{setup-standalone-prelude-C89-5Dtf.js → setup-standalone-prelude-DG_T27N6.js} +1 -1
- package/dist/ui/assets/{setup-sudo-CHykhXbm.js → setup-sudo-Dl9iLnhq.js} +2 -2
- package/dist/ui/assets/{skills-BKsLImdA.js → skills-C7FEjIi4.js} +1 -1
- package/dist/ui/assets/slicc-version-prHqE09F.js +1 -0
- package/dist/ui/assets/{store-CgULlP3e.js → store-BaPf6KDU.js} +1 -1
- package/dist/ui/assets/{store-CEccVDd7.js → store-C5L7dcKq.js} +1 -1
- package/dist/ui/assets/{sudo-Bi--9XjE.js → sudo-Cv4CbvvB.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-Di65pY4y.js → upgrade-detection-Dy7iFYYj.js} +1 -1
- package/dist/ui/assets/{wc-extension-CwbvHOae.js → wc-extension-Bn3ds_hE.js} +2 -2
- package/dist/ui/assets/{wc-follower-DfFkmNjM.js → wc-follower-BE_rDo0n.js} +3 -3
- package/dist/ui/assets/{wc-live-C5Y8LMGm.js → wc-live-CgeW0gxt.js} +5 -5
- package/dist/ui/assets/{wc-nav-D4I71uQu.js → wc-nav-BWsK8yB4.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-UrMxL1c-.js → wc-onboarding-cK_1n2x5.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-zxd8RVYO.js → wc-placeholder-DIbjJjdZ.js} +2 -2
- package/dist/ui/assets/{wc-settings-BcpEli20.js → wc-settings-Dp0V4Xq-.js} +2 -2
- package/dist/ui/assets/{wc-shell-ClIw7Xp7.js → wc-shell-rDFZeAKy.js} +2 -2
- package/dist/ui/assets/{wc-sprinkles-DmaQ6PZC.js → wc-sprinkles-CGE3qrDA.js} +2 -2
- package/dist/ui/assets/{wc-tray-D8C4hzMc.js → wc-tray-CaGfG302.js} +2 -2
- package/dist/ui/assets/{xai-grok-C4yc6t0c.js → xai-grok-BukNgR1Z.js} +1 -1
- package/dist/ui/assets/{xai-grok-CTETAYca.js → xai-grok-C8CAvz9J.js} +1 -1
- package/dist/ui/index.html +6 -6
- package/dist/ui/packages/webapp/index.html +6 -6
- package/package.json +1 -1
- package/dist/ui/assets/provider-store-access-dlrRLglC.js +0 -1
- package/dist/ui/assets/slicc-version-DV1WF_eM.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as e,g as t}from"./account-store-BxGdz4En.js";import{a as n}from"./diagnostics-DN_idNHx.js";import{i as r,s as i,t as a}from"./transform-messages-N_eMsP2M.js";import{p as o}from"./bedrock-camp-C8bCNVSq.js";function s(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function c(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var l=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return l=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))};function u(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var d=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},f=class extends Error{},p=class e extends f{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new h({message:r,cause:d(n)});let a=n?.error;return t===400?new _(t,a,r,i):t===401?new v(t,a,r,i):t===403?new y(t,a,r,i):t===404?new b(t,a,r,i):t===409?new x(t,a,r,i):t===422?new ee(t,a,r,i):t===429?new te(t,a,r,i):t>=500?new ne(t,a,r,i):new e(t,a,r,i)}},m=class extends p{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},h=class extends p{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},g=class extends h{constructor({message:e}={}){super({message:e??`Request timed out.`})}},_=class extends p{},v=class extends p{},y=class extends p{},b=class extends p{},x=class extends p{},ee=class extends p{},te=class extends p{},ne=class extends p{},re=class extends f{constructor(){super(`Could not parse response content as the length limit was reached`)}},ie=class extends f{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},ae=class extends Error{constructor(e){super(e)}},oe=class extends p{constructor(e,t,n){let r=`OAuth2 authentication error`,i;if(t&&typeof t==`object`){let e=t;i=e.error;let n=e.error_description;n&&typeof n==`string`?r=n:i&&(r=i)}super(e,t,r,n),this.error_code=i}},se=class extends f{constructor(e,t,n){super(e),this.provider=t,this.cause=n}},ce=/^[a-z][a-z0-9+.-]*:/i,le=e=>ce.test(e),S=e=>(S=Array.isArray,S(e)),ue=S;function de(e){return typeof e==`object`?e??{}:{}}function fe(e){if(!e)return!0;for(let t in e)return!1;return!0}function pe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function me(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var he=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new f(`${e} must be an integer`);if(t<0)throw new f(`${e} must be a positive integer`);return t},ge=e=>{try{return JSON.parse(e)}catch{return}},_e=e=>new Promise(t=>setTimeout(t,e)),ve=`7.0.0`,ye=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`;function be(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}var xe=()=>{let e=be();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":ve,"X-Stainless-OS":we(Deno.build.os),"X-Stainless-Arch":Ce(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":ve,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":ve,"X-Stainless-OS":we(globalThis.process.platform??`unknown`),"X-Stainless-Arch":Ce(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=Se();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":ve,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":ve,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}};function Se(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var Ce=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,we=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),Te,Ee=()=>Te??=xe();function De(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Oe(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function ke(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Oe({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function Ae(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function je(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var Me=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)}),Ne=`RFC3986`,Pe=e=>String(e),Fe={RFC1738:e=>String(e).replace(/%20/g,`+`),RFC3986:Pe},Ie=(e,t)=>(Ie=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Ie(e,t)),C=(()=>{let e=[];for(let t=0;t<256;++t)e.push(`%`+((t<16?`0`:``)+t.toString(16)).toUpperCase());return e})(),Le=1024,Re=(e,t,n,r,i)=>{if(e.length===0)return e;let a=e;if(typeof e==`symbol`?a=Symbol.prototype.toString.call(e):typeof e!=`string`&&(a=String(e)),n===`iso-8859-1`)return escape(a).replace(/%u[0-9a-f]{4}/gi,function(e){return`%26%23`+parseInt(e.slice(2),16)+`%3B`});let o=``;for(let e=0;e<a.length;e+=Le){let t=a.length>=Le?a.slice(e,e+Le):a,n=[];for(let e=0;e<t.length;++e){let r=t.charCodeAt(e);if(r===45||r===46||r===95||r===126||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||i===`RFC1738`&&(r===40||r===41)){n[n.length]=t.charAt(e);continue}if(r<128){n[n.length]=C[r];continue}if(r<2048){n[n.length]=C[192|r>>6]+C[128|r&63];continue}if(r<55296||r>=57344){n[n.length]=C[224|r>>12]+C[128|r>>6&63]+C[128|r&63];continue}e+=1,r=65536+((r&1023)<<10|t.charCodeAt(e)&1023),n[n.length]=C[240|r>>18]+C[128|r>>12&63]+C[128|r>>6&63]+C[128|r&63]}o+=n.join(``)}return o};function ze(e){return!e||typeof e!=`object`?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function Be(e,t){if(S(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}var Ve={brackets(e){return String(e)+`[]`},comma:`comma`,indices(e,t){return String(e)+`[`+t+`]`},repeat(e){return String(e)}},He=function(e,t){Array.prototype.push.apply(e,S(t)?t:[t])},Ue,w={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:`indices`,charset:`utf-8`,charsetSentinel:!1,delimiter:`&`,encode:!0,encodeDotInKeys:!1,encoder:Re,encodeValuesOnly:!1,format:Ne,formatter:Pe,indices:!1,serializeDate(e){return(Ue??=Function.prototype.call.bind(Date.prototype.toISOString))(e)},skipNulls:!1,strictNullHandling:!1};function We(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`symbol`||typeof e==`bigint`}var Ge={};function Ke(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=e,y=_,b=0,x=!1;for(;(y=y.get(Ge))!==void 0&&!x;){let t=y.get(e);if(b+=1,t!==void 0){if(t===b)throw RangeError(`Cyclic object value`);x=!0}y.get(Ge)===void 0&&(b=0)}if(typeof l==`function`?v=l(t,v):v instanceof Date?v=f?.(v):n===`comma`&&S(v)&&(v=Be(v,function(e){return e instanceof Date?f?.(e):e})),v===null){if(a)return c&&!h?c(t,w.encoder,g,`key`,p):t;v=``}if(We(v)||ze(v)){if(c){let e=h?t:c(t,w.encoder,g,`key`,p);return[m?.(e)+`=`+m?.(c(v,w.encoder,g,`value`,p))]}return[m?.(t)+`=`+m?.(String(v))]}let ee=[];if(v===void 0)return ee;let te;if(n===`comma`&&S(v))h&&c&&(v=Be(v,c)),te=[{value:v.length>0?v.join(`,`)||null:void 0}];else if(S(l))te=l;else{let e=Object.keys(v);te=u?e.sort(u):e}let ne=s?String(t).replace(/\./g,`%2E`):String(t),re=r&&S(v)&&v.length===1?ne+`[]`:ne;if(i&&S(v)&&v.length===0)return re+`[]`;for(let t=0;t<te.length;++t){let y=te[t],x=typeof y==`object`&&y.value!==void 0?y.value:v[y];if(o&&x===null)continue;let ne=d&&s?y.replace(/\./g,`%2E`):y,ie=S(v)?typeof n==`function`?n(re,ne):re:re+(d?`.`+ne:`[`+ne+`]`);_.set(e,b);let ae=new WeakMap;ae.set(Ge,_),He(ee,Ke(x,ie,n,r,i,a,o,s,n===`comma`&&h&&S(v)?null:c,l,u,d,f,p,m,h,g,ae))}return ee}function qe(e=w){if(e.allowEmptyArrays!==void 0&&typeof e.allowEmptyArrays!=`boolean`)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(e.encodeDotInKeys!==void 0&&typeof e.encodeDotInKeys!=`boolean`)throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!=`function`)throw TypeError(`Encoder has to be a function.`);let t=e.charset||w.charset;if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);let n=Ne;if(e.format!==void 0){if(!Ie(Fe,e.format))throw TypeError(`Unknown format option provided.`);n=e.format}let r=Fe[n],i=w.filter;(typeof e.filter==`function`||S(e.filter))&&(i=e.filter);let a;if(a=e.arrayFormat&&e.arrayFormat in Ve?e.arrayFormat:`indices`in e?e.indices?`indices`:`repeat`:w.arrayFormat,`commaRoundTrip`in e&&typeof e.commaRoundTrip!=`boolean`)throw TypeError("`commaRoundTrip` must be a boolean, or absent");let o=e.allowDots===void 0?e.encodeDotInKeys?!0:w.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==`boolean`?e.addQueryPrefix:w.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays==`boolean`?!!e.allowEmptyArrays:w.allowEmptyArrays,arrayFormat:a,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:w.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:e.delimiter===void 0?w.delimiter:e.delimiter,encode:typeof e.encode==`boolean`?e.encode:w.encode,encodeDotInKeys:typeof e.encodeDotInKeys==`boolean`?e.encodeDotInKeys:w.encodeDotInKeys,encoder:typeof e.encoder==`function`?e.encoder:w.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==`boolean`?e.encodeValuesOnly:w.encodeValuesOnly,filter:i,format:n,formatter:r,serializeDate:typeof e.serializeDate==`function`?e.serializeDate:w.serializeDate,skipNulls:typeof e.skipNulls==`boolean`?e.skipNulls:w.skipNulls,sort:typeof e.sort==`function`?e.sort:null,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:w.strictNullHandling}}function Je(e,t={}){let n=e,r=qe(t),i,a;typeof r.filter==`function`?(a=r.filter,n=a(``,n)):S(r.filter)&&(a=r.filter,i=a);let o=[];if(typeof n!=`object`||!n)return``;let s=Ve[r.arrayFormat],c=s===`comma`&&r.commaRoundTrip;i||=Object.keys(n),r.sort&&i.sort(r.sort);let l=new WeakMap;for(let e=0;e<i.length;++e){let t=i[e];r.skipNulls&&n[t]===null||He(o,Ke(n[t],t,s,c,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}let u=o.join(r.delimiter),d=r.addQueryPrefix===!0?`?`:``;return r.charsetSentinel&&(r.charset===`iso-8859-1`?d+=`utf8=%26%2310003%3B&`:d+=`utf8=%E2%9C%93&`),u.length>0?d+u:``}function Ye(e){return Je(e,{arrayFormat:`brackets`})}function Xe(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}var Ze;function T(e){let t;return(Ze??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}var Qe;function $e(e){let t;return(Qe??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var E,D,et=class{constructor(){E.set(this,void 0),D.set(this,void 0),s(this,E,new Uint8Array,`f`),s(this,D,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?T(e):e;s(this,E,Xe([c(this,E,`f`),t]),`f`);let n=[],r;for(;(r=tt(c(this,E,`f`),c(this,D,`f`)))!=null;){if(r.carriage&&c(this,D,`f`)==null){s(this,D,r.index,`f`);continue}if(c(this,D,`f`)!=null&&(r.index!==c(this,D,`f`)+1||r.carriage)){n.push($e(c(this,E,`f`).subarray(0,c(this,D,`f`)-1))),s(this,E,c(this,E,`f`).subarray(c(this,D,`f`)),`f`),s(this,D,null,`f`);continue}let e=c(this,D,`f`)===null?r.preceding:r.preceding-1,t=$e(c(this,E,`f`).subarray(0,e));n.push(t),s(this,E,c(this,E,`f`).subarray(r.index),`f`),s(this,D,null,`f`)}return n}flush(){return c(this,E,`f`).length?this.decode(`
|
|
1
|
+
import{b as e,g as t}from"./account-store-De_TsgNS.js";import{a as n}from"./diagnostics-DN_idNHx.js";import{i as r,s as i,t as a}from"./transform-messages-N_eMsP2M.js";import{p as o}from"./bedrock-camp-C8bCNVSq.js";function s(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function c(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var l=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return l=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))};function u(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var d=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)},f=class extends Error{},p=class e extends f{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`x-request-id`),this.error=n;let a=n;this.code=a?.code,this.param=a?.param,this.type=a?.type}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new h({message:r,cause:d(n)});let a=n?.error;return t===400?new _(t,a,r,i):t===401?new v(t,a,r,i):t===403?new y(t,a,r,i):t===404?new b(t,a,r,i):t===409?new x(t,a,r,i):t===422?new ee(t,a,r,i):t===429?new te(t,a,r,i):t>=500?new ne(t,a,r,i):new e(t,a,r,i)}},m=class extends p{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},h=class extends p{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},g=class extends h{constructor({message:e}={}){super({message:e??`Request timed out.`})}},_=class extends p{},v=class extends p{},y=class extends p{},b=class extends p{},x=class extends p{},ee=class extends p{},te=class extends p{},ne=class extends p{},re=class extends f{constructor(){super(`Could not parse response content as the length limit was reached`)}},ie=class extends f{constructor(){super(`Could not parse response content as the request was rejected by the content filter`)}},ae=class extends Error{constructor(e){super(e)}},oe=class extends p{constructor(e,t,n){let r=`OAuth2 authentication error`,i;if(t&&typeof t==`object`){let e=t;i=e.error;let n=e.error_description;n&&typeof n==`string`?r=n:i&&(r=i)}super(e,t,r,n),this.error_code=i}},se=class extends f{constructor(e,t,n){super(e),this.provider=t,this.cause=n}},ce=/^[a-z][a-z0-9+.-]*:/i,le=e=>ce.test(e),S=e=>(S=Array.isArray,S(e)),ue=S;function de(e){return typeof e==`object`?e??{}:{}}function fe(e){if(!e)return!0;for(let t in e)return!1;return!0}function pe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function me(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var he=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new f(`${e} must be an integer`);if(t<0)throw new f(`${e} must be a positive integer`);return t},ge=e=>{try{return JSON.parse(e)}catch{return}},_e=e=>new Promise(t=>setTimeout(t,e)),ve=`7.0.0`,ye=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`;function be(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}var xe=()=>{let e=be();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":ve,"X-Stainless-OS":we(Deno.build.os),"X-Stainless-Arch":Ce(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":ve,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":ve,"X-Stainless-OS":we(globalThis.process.platform??`unknown`),"X-Stainless-Arch":Ce(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=Se();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":ve,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":ve,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}};function Se(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var Ce=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,we=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),Te,Ee=()=>Te??=xe();function De(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Oe(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function ke(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return Oe({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function Ae(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function je(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var Me=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)}),Ne=`RFC3986`,Pe=e=>String(e),Fe={RFC1738:e=>String(e).replace(/%20/g,`+`),RFC3986:Pe},Ie=(e,t)=>(Ie=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Ie(e,t)),C=(()=>{let e=[];for(let t=0;t<256;++t)e.push(`%`+((t<16?`0`:``)+t.toString(16)).toUpperCase());return e})(),Le=1024,Re=(e,t,n,r,i)=>{if(e.length===0)return e;let a=e;if(typeof e==`symbol`?a=Symbol.prototype.toString.call(e):typeof e!=`string`&&(a=String(e)),n===`iso-8859-1`)return escape(a).replace(/%u[0-9a-f]{4}/gi,function(e){return`%26%23`+parseInt(e.slice(2),16)+`%3B`});let o=``;for(let e=0;e<a.length;e+=Le){let t=a.length>=Le?a.slice(e,e+Le):a,n=[];for(let e=0;e<t.length;++e){let r=t.charCodeAt(e);if(r===45||r===46||r===95||r===126||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||i===`RFC1738`&&(r===40||r===41)){n[n.length]=t.charAt(e);continue}if(r<128){n[n.length]=C[r];continue}if(r<2048){n[n.length]=C[192|r>>6]+C[128|r&63];continue}if(r<55296||r>=57344){n[n.length]=C[224|r>>12]+C[128|r>>6&63]+C[128|r&63];continue}e+=1,r=65536+((r&1023)<<10|t.charCodeAt(e)&1023),n[n.length]=C[240|r>>18]+C[128|r>>12&63]+C[128|r>>6&63]+C[128|r&63]}o+=n.join(``)}return o};function ze(e){return!e||typeof e!=`object`?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}function Be(e,t){if(S(e)){let n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}var Ve={brackets(e){return String(e)+`[]`},comma:`comma`,indices(e,t){return String(e)+`[`+t+`]`},repeat(e){return String(e)}},He=function(e,t){Array.prototype.push.apply(e,S(t)?t:[t])},Ue,w={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:`indices`,charset:`utf-8`,charsetSentinel:!1,delimiter:`&`,encode:!0,encodeDotInKeys:!1,encoder:Re,encodeValuesOnly:!1,format:Ne,formatter:Pe,indices:!1,serializeDate(e){return(Ue??=Function.prototype.call.bind(Date.prototype.toISOString))(e)},skipNulls:!1,strictNullHandling:!1};function We(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`symbol`||typeof e==`bigint`}var Ge={};function Ke(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){let v=e,y=_,b=0,x=!1;for(;(y=y.get(Ge))!==void 0&&!x;){let t=y.get(e);if(b+=1,t!==void 0){if(t===b)throw RangeError(`Cyclic object value`);x=!0}y.get(Ge)===void 0&&(b=0)}if(typeof l==`function`?v=l(t,v):v instanceof Date?v=f?.(v):n===`comma`&&S(v)&&(v=Be(v,function(e){return e instanceof Date?f?.(e):e})),v===null){if(a)return c&&!h?c(t,w.encoder,g,`key`,p):t;v=``}if(We(v)||ze(v)){if(c){let e=h?t:c(t,w.encoder,g,`key`,p);return[m?.(e)+`=`+m?.(c(v,w.encoder,g,`value`,p))]}return[m?.(t)+`=`+m?.(String(v))]}let ee=[];if(v===void 0)return ee;let te;if(n===`comma`&&S(v))h&&c&&(v=Be(v,c)),te=[{value:v.length>0?v.join(`,`)||null:void 0}];else if(S(l))te=l;else{let e=Object.keys(v);te=u?e.sort(u):e}let ne=s?String(t).replace(/\./g,`%2E`):String(t),re=r&&S(v)&&v.length===1?ne+`[]`:ne;if(i&&S(v)&&v.length===0)return re+`[]`;for(let t=0;t<te.length;++t){let y=te[t],x=typeof y==`object`&&y.value!==void 0?y.value:v[y];if(o&&x===null)continue;let ne=d&&s?y.replace(/\./g,`%2E`):y,ie=S(v)?typeof n==`function`?n(re,ne):re:re+(d?`.`+ne:`[`+ne+`]`);_.set(e,b);let ae=new WeakMap;ae.set(Ge,_),He(ee,Ke(x,ie,n,r,i,a,o,s,n===`comma`&&h&&S(v)?null:c,l,u,d,f,p,m,h,g,ae))}return ee}function qe(e=w){if(e.allowEmptyArrays!==void 0&&typeof e.allowEmptyArrays!=`boolean`)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(e.encodeDotInKeys!==void 0&&typeof e.encodeDotInKeys!=`boolean`)throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!=`function`)throw TypeError(`Encoder has to be a function.`);let t=e.charset||w.charset;if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);let n=Ne;if(e.format!==void 0){if(!Ie(Fe,e.format))throw TypeError(`Unknown format option provided.`);n=e.format}let r=Fe[n],i=w.filter;(typeof e.filter==`function`||S(e.filter))&&(i=e.filter);let a;if(a=e.arrayFormat&&e.arrayFormat in Ve?e.arrayFormat:`indices`in e?e.indices?`indices`:`repeat`:w.arrayFormat,`commaRoundTrip`in e&&typeof e.commaRoundTrip!=`boolean`)throw TypeError("`commaRoundTrip` must be a boolean, or absent");let o=e.allowDots===void 0?e.encodeDotInKeys?!0:w.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==`boolean`?e.addQueryPrefix:w.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof e.allowEmptyArrays==`boolean`?!!e.allowEmptyArrays:w.allowEmptyArrays,arrayFormat:a,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:w.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:e.delimiter===void 0?w.delimiter:e.delimiter,encode:typeof e.encode==`boolean`?e.encode:w.encode,encodeDotInKeys:typeof e.encodeDotInKeys==`boolean`?e.encodeDotInKeys:w.encodeDotInKeys,encoder:typeof e.encoder==`function`?e.encoder:w.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==`boolean`?e.encodeValuesOnly:w.encodeValuesOnly,filter:i,format:n,formatter:r,serializeDate:typeof e.serializeDate==`function`?e.serializeDate:w.serializeDate,skipNulls:typeof e.skipNulls==`boolean`?e.skipNulls:w.skipNulls,sort:typeof e.sort==`function`?e.sort:null,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:w.strictNullHandling}}function Je(e,t={}){let n=e,r=qe(t),i,a;typeof r.filter==`function`?(a=r.filter,n=a(``,n)):S(r.filter)&&(a=r.filter,i=a);let o=[];if(typeof n!=`object`||!n)return``;let s=Ve[r.arrayFormat],c=s===`comma`&&r.commaRoundTrip;i||=Object.keys(n),r.sort&&i.sort(r.sort);let l=new WeakMap;for(let e=0;e<i.length;++e){let t=i[e];r.skipNulls&&n[t]===null||He(o,Ke(n[t],t,s,c,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}let u=o.join(r.delimiter),d=r.addQueryPrefix===!0?`?`:``;return r.charsetSentinel&&(r.charset===`iso-8859-1`?d+=`utf8=%26%2310003%3B&`:d+=`utf8=%E2%9C%93&`),u.length>0?d+u:``}function Ye(e){return Je(e,{arrayFormat:`brackets`})}function Xe(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}var Ze;function T(e){let t;return(Ze??=(t=new globalThis.TextEncoder,t.encode.bind(t)))(e)}var Qe;function $e(e){let t;return(Qe??=(t=new globalThis.TextDecoder,t.decode.bind(t)))(e)}var E,D,et=class{constructor(){E.set(this,void 0),D.set(this,void 0),s(this,E,new Uint8Array,`f`),s(this,D,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?T(e):e;s(this,E,Xe([c(this,E,`f`),t]),`f`);let n=[],r;for(;(r=tt(c(this,E,`f`),c(this,D,`f`)))!=null;){if(r.carriage&&c(this,D,`f`)==null){s(this,D,r.index,`f`);continue}if(c(this,D,`f`)!=null&&(r.index!==c(this,D,`f`)+1||r.carriage)){n.push($e(c(this,E,`f`).subarray(0,c(this,D,`f`)-1))),s(this,E,c(this,E,`f`).subarray(c(this,D,`f`)),`f`),s(this,D,null,`f`);continue}let e=c(this,D,`f`)===null?r.preceding:r.preceding-1,t=$e(c(this,E,`f`).subarray(0,e));n.push(t),s(this,E,c(this,E,`f`).subarray(r.index),`f`),s(this,D,null,`f`)}return n}flush(){return c(this,E,`f`).length?this.decode(`
|
|
2
2
|
`):[]}};E=new WeakMap,D=new WeakMap,et.NEWLINE_CHARS=new Set([`
|
|
3
3
|
`,`\r`]),et.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function tt(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function nt(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}var rt={off:0,error:200,warn:300,info:400,debug:500},it=(e,t,n)=>{if(e){if(pe(rt,e))return e;O(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(rt))}`)}};function at(){}function ot(e,t,n){return!t||rt[e]>rt[n]?at:t[e].bind(t)}var st={error:at,warn:at,info:at,debug:at},ct=new WeakMap;function O(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return st;let r=ct.get(t);if(r&&r[0]===n)return r[1];let i={error:ot(`error`,t,n),warn:ot(`warn`,t,n),info:ot(`info`,t,n),debug:ot(`debug`,t,n)};return ct.set(t,[n,i]),i}var lt=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`authorization`||e.toLowerCase()===`api-key`||e.toLowerCase()===`x-api-key`||e.toLowerCase()===`x-amz-security-token`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t])),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e),ut,dt=class e{constructor(e,t,n){this.iterator=e,ut.set(this,void 0),this.controller=t,s(this,ut,n,`f`)}static fromSSEResponse(t,n,r,i){let a=!1,o=r?O(r):console;async function*s(){if(a)throw new f("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1;try{for await(let r of ft(t,n))if(!e){if(r.data.startsWith(`[DONE]`)){e=!0;continue}if(r.event===null||!r.event.startsWith(`thread.`)){let e;try{e=JSON.parse(r.data)}catch(e){throw o.error(`Could not parse message into JSON:`,r.data),o.error(`From chunk:`,r.raw),e}if(e&&e.error)throw new p(void 0,e.error,void 0,t.headers);yield i?{event:r.event,data:e}:e}else{let e;try{e=JSON.parse(r.data)}catch(e){throw console.error(`Could not parse message into JSON:`,r.data),console.error(`From chunk:`,r.raw),e}if(r.event==`error`)throw new p(void 0,e.error,e.message,void 0);yield{event:r.event,data:e}}}e=!0}catch(e){if(u(e))return;throw e}finally{e||n.abort()}}return new e(s,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new et,r=t.getReader(),i=!1,a,o=()=>{a??=r.cancel(),a.catch(()=>{})};n.signal.addEventListener(`abort`,o,{once:!0});try{if(n.signal.aborted){o();return}for(;;){let{value:t,done:a}=await r.read();if(a){i=!0;break}if(n.signal.aborted)return;for(let r of e.decode(t)){if(n.signal.aborted)return;yield r}}if(n.signal.aborted)return;for(let t of e.flush()){if(n.signal.aborted)return;yield t}}finally{n.signal.removeEventListener(`abort`,o),i||o(),r.releaseLock()}}async function*o(){if(i)throw new f("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(n.signal.aborted||u(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(ut=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,c(this,ut,`f`)),new e(()=>i(n),this.controller,c(this,ut,`f`))]}toReadableStream(){let e=this,t;return Oe({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{let{value:n,done:r}=await t.next();if(r)return e.close();let i=T(JSON.stringify(n)+`
|
|
4
4
|
`);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}};async function*ft(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new f(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new f(`Attempted to iterate over a response with no body`);let n=new mt,r=new et,i=Ae(e.body);for await(let e of pt(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*pt(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let e=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==`string`?T(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=nt(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}var mt=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./account-store-
|
|
1
|
+
import{h as e}from"./account-store-bVEfH-i1.js";import{a as t}from"./diagnostics-DN_idNHx.js";import{p as n}from"./bedrock-camp-BfNg24Ce.js";import{r,s as i}from"./legacy-api-aliases-qI5FdR49.js";const a=`cerebras`,o=`https://api.cerebras.ai/v1`,s=`openai-completions`,c=`${a}-openai`,l=`slicc-cerebras-models`;let u=[];const d=[{id:`gpt-oss-120b`,name:`GPT OSS 120B`,api:`openai`,reasoning:!0,input:[`text`],context_window:131072,max_tokens:40960},{id:`gemma-4-31b`,name:`Gemma 4 31B`,api:`openai`,reasoning:!1,input:[`text`,`image`],context_window:131072,max_tokens:40960},{id:`zai-glm-4.7`,name:`Z.AI GLM-4.7`,api:`openai`,reasoning:!1,input:[`text`],context_window:131072,max_tokens:40960}];function f(e){try{localStorage.setItem(l,JSON.stringify(e))}catch{}}function p(){try{let e=localStorage.getItem(l);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)&&t.length>0?t:[]}catch{return[]}}function m(e){let t=e.id??``,n=d.find(e=>e.id===t);return{id:t,name:e.name??n?.name??t,api:`openai`,reasoning:e.capabilities?.reasoning??n?.reasoning??!1,input:e.capabilities?.vision?[`text`,`image`]:n?.input??[`text`],context_window:e.limits?.max_context_length??n?.context_window??8192,max_tokens:e.limits?.max_completion_tokens??n?.max_tokens??4096}}async function h(e){let t=await fetch(`${o}/models`,{headers:{Authorization:`Bearer ${e}`}});if(!t.ok)throw Error(`GET /v1/models → ${t.status} ${t.statusText}`);let n=((await t.json()).data??[]).map(m).filter(e=>e.id.length>0);n.length>0&&(u=n,f(n))}function g(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:c,provider:a,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()}}}const _=(e,n,i={})=>{let a=t();return(async()=>{try{let t={...e,baseUrl:o,api:s},c=r(t,n,i);for await(let e of c)a.push(e);a.end()}catch(t){console.error(`[cerebras] Stream error:`,t instanceof Error?t.message:String(t)),a.push(g(e,t)),a.end()}})(),a},v=(e,n,r)=>{let a=t();return(async()=>{try{let t={...e,baseUrl:o,api:s},c=i(t,n,r);for await(let e of c)a.push(e);a.end()}catch(t){console.error(`[cerebras] Stream error:`,t instanceof Error?t.message:String(t)),a.push(g(e,t)),a.end()}})(),a},y={id:a,name:`Cerebras`,description:`Ultra-fast inference on Cerebras hardware. Get an API key at cloud.cerebras.ai.`,requiresApiKey:!0,requiresBaseUrl:!1,getModelIds:()=>{if(u.length>0)return u;let e=p();return e.length>0?e:d},refreshModels:async t=>{let n=t??e(a)??``;if(n)try{await h(n)}catch(e){console.warn(`[cerebras] Failed to refresh model list:`,e instanceof Error?e.message:String(e))}}};function b(){n({api:c,stream:_,streamSimple:v})}export{y as config,b as register};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./account-store-
|
|
1
|
+
import{h as e}from"./account-store-De_TsgNS.js";import{a as t}from"./diagnostics-DN_idNHx.js";import{p as n}from"./bedrock-camp-C8bCNVSq.js";import{r,s as i}from"./legacy-api-aliases-C2CCsk4u.js";var a=`cerebras`,o=`https://api.cerebras.ai/v1`,s=`openai-completions`,c=`${a}-openai`,l=`slicc-cerebras-models`,u=[],d=[{id:`gpt-oss-120b`,name:`GPT OSS 120B`,api:`openai`,reasoning:!0,input:[`text`],context_window:131072,max_tokens:40960},{id:`gemma-4-31b`,name:`Gemma 4 31B`,api:`openai`,reasoning:!1,input:[`text`,`image`],context_window:131072,max_tokens:40960},{id:`zai-glm-4.7`,name:`Z.AI GLM-4.7`,api:`openai`,reasoning:!1,input:[`text`],context_window:131072,max_tokens:40960}];function f(e){try{localStorage.setItem(l,JSON.stringify(e))}catch{}}function p(){try{let e=localStorage.getItem(l);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)&&t.length>0?t:[]}catch{return[]}}function m(e){let t=e.id??``,n=d.find(e=>e.id===t);return{id:t,name:e.name??n?.name??t,api:`openai`,reasoning:e.capabilities?.reasoning??n?.reasoning??!1,input:e.capabilities?.vision?[`text`,`image`]:n?.input??[`text`],context_window:e.limits?.max_context_length??n?.context_window??8192,max_tokens:e.limits?.max_completion_tokens??n?.max_tokens??4096}}async function h(e){let t=await fetch(`${o}/models`,{headers:{Authorization:`Bearer ${e}`}});if(!t.ok)throw Error(`GET /v1/models → ${t.status} ${t.statusText}`);let n=((await t.json()).data??[]).map(m).filter(e=>e.id.length>0);n.length>0&&(u=n,f(n))}function g(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:c,provider:a,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()}}}var _=(e,n,i={})=>{let a=t();return(async()=>{try{let t={...e,baseUrl:o,api:s},c=r(t,n,i);for await(let e of c)a.push(e);a.end()}catch(t){console.error(`[cerebras] Stream error:`,t instanceof Error?t.message:String(t)),a.push(g(e,t)),a.end()}})(),a},v=(e,n,r)=>{let a=t();return(async()=>{try{let t={...e,baseUrl:o,api:s},c=i(t,n,r);for await(let e of c)a.push(e);a.end()}catch(t){console.error(`[cerebras] Stream error:`,t instanceof Error?t.message:String(t)),a.push(g(e,t)),a.end()}})(),a},y={id:a,name:`Cerebras`,description:`Ultra-fast inference on Cerebras hardware. Get an API key at cloud.cerebras.ai.`,requiresApiKey:!0,requiresBaseUrl:!1,getModelIds:()=>{if(u.length>0)return u;let e=p();return e.length>0?e:d},refreshModels:async t=>{let n=t??e(a)??``;if(n)try{await h(n)}catch(e){console.warn(`[cerebras] Failed to refresh model list:`,e instanceof Error?e.message:String(e))}}};function b(){n({api:c,stream:_,streamSimple:v})}export{y as config,b as register};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,I as t,d as n,f as r}from"./account-store-
|
|
1
|
+
import{C as e,I as t,d as n,f as r}from"./account-store-De_TsgNS.js";import{n as i}from"./provider-settings-BRDtbslv.js";var a=`slicc_cloud_model_catalog`,o=`adobe`;function s(t){if(t===o)return!1;let n=e(t);return!(n.hidden||n.onOAuthLoginIntercepted)}function c(){try{let e=r().map(e=>({providerId:e.providerId,providerName:e.providerName,models:e.models.map(e=>({id:e.id,name:e.name}))}));localStorage.setItem(a,JSON.stringify(e))}catch{}}async function l(r){for(;r.firstChild;)r.removeChild(r.firstChild);r.className=`connect-surface`;let a=document.createElement(`h1`);a.className=`connect-surface__title`,a.textContent=`Connect providers`,r.appendChild(a);let l=document.createElement(`p`);l.className=`connect-surface__desc`,l.textContent=`Log in or add API keys for the providers your cone should use, then click Done to return to the dashboard.`,r.appendChild(l);let u=document.createElement(`div`);u.className=`connect-surface__accounts`,r.appendChild(u);function d(){for(;u.firstChild;)u.removeChild(u.firstChild);let r=n().filter(e=>e.providerId!==o);if(r.length===0){let e=document.createElement(`div`);e.className=`connect-surface__empty`,e.textContent=`No providers connected yet.`,u.appendChild(e)}else{let n=document.createElement(`div`);n.className=`connect-surface__accounts-list`;for(let i of r){let r=e(i.providerId),a=document.createElement(`div`);a.className=`connect-surface__account-row`;let o=document.createElement(`div`);o.className=`connect-surface__account-info`;let s=document.createElement(`div`);s.className=`connect-surface__account-name`,s.textContent=r.name,o.appendChild(s);let l=document.createElement(`div`);l.className=`connect-surface__account-detail`,l.textContent=i.userName?i.userName:i.accessToken?`Logged in`:i.apiKey?`API key set`:`No credentials`,o.appendChild(l),a.appendChild(o);let u=document.createElement(`button`);u.className=`connect-surface__remove-btn`,u.textContent=`Remove`,u.onclick=async()=>{await t(i.providerId),c(),d()},a.appendChild(u),n.appendChild(a)}u.appendChild(n)}let a=document.createElement(`button`);a.className=`connect-surface__add-btn`,a.textContent=r.length===0?`Add provider`:`Manage providers`,a.onclick=async()=>{await i({startInAddAccount:!0,providerFilter:s})&&(c(),d())},u.appendChild(a)}d(),c();let f=document.createElement(`div`);f.className=`connect-surface__footer`;let p=document.createElement(`button`);if(p.className=`connect-surface__done-btn`,p.textContent=`Done — return to dashboard`,p.onclick=()=>{c(),window.close()},f.appendChild(p),r.appendChild(f),!document.getElementById(`connect-surface-style`)){let e=document.createElement(`style`);e.id=`connect-surface-style`,e.textContent=`
|
|
2
2
|
.connect-surface {
|
|
3
3
|
padding: 2rem;
|
|
4
4
|
max-width: 560px;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{C as e,D as t,E as n,O as r,S as i,T as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,k as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,u as C,w,x as T}from"./dist-
|
|
1
|
+
import{C as e,D as t,E as n,O as r,S as i,T as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,k as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,u as C,w,x as T}from"./dist-Dk3FjOeV.js";function E(e){switch(e.name){case`TypeMismatchError`:return`EPERM`;case`IndexSizeError`:case`HierarchyRequestError`:case`InvalidCharacterError`:case`InvalidStateError`:case`SyntaxError`:case`NamespaceError`:case`ConstraintError`:case`VersionError`:case`URLMismatchError`:case`InvalidNodeTypeError`:return`EINVAL`;case`WrongDocumentError`:return`EXDEV`;case`NoModificationAllowedError`:case`InvalidModificationError`:case`InvalidAccessError`:case`SecurityError`:case`NotAllowedError`:return`EACCES`;case`NotFoundError`:return`ENOENT`;case`NotSupportedError`:return`ENOTSUP`;case`InUseAttributeError`:return`EBUSY`;case`NetworkError`:return`ENETDOWN`;case`AbortError`:return`EINTR`;case`QuotaExceededError`:return`ENOSPC`;case`TimeoutError`:return`ETIMEDOUT`;case`ReadOnlyError`:return`EROFS`;default:return`EIO`}}function D(e,t){if(e instanceof a)return e;let n=e instanceof DOMException?w[E(e)]:w.EIO,r=new a(n,e.message);return r.stack=e.stack,Error.captureStackTrace?.(r,D),r.cause=e.cause,r}function O(e){return typeof e==`object`&&!!e&&e.constructor.name==`SharedArrayBuffer`}function k(e){return e instanceof ArrayBuffer?e.resizable:O(e)?e.growable:!1}function A(e,t){return e.kind==t}var j=class extends x(m){async _loadHandles(e,t){for await(let[n,r]of t.entries()){let t=_(e,n);this._handles.set(t,r),A(r,`directory`)&&await this._loadHandles(t,r)}}async _loadMetadata(e){if(this._handles.set(`/`,this.root),await this._loadHandles(`/`,this.root),e){let t=await(await(await this.get(`file`,e)).getFile()).text(),n=JSON.parse(t);this.index.fromJSON(n);return}let t=1;for(let[e,r]of this._handles){if(A(r,`file`)){let{lastModified:n,size:i}=await r.getFile();this.index.set(e,new C({ino:t,data:t+1,nlink:1,mode:420|o,size:i,mtimeMs:n})),t+=2;continue}if(!A(r,`directory`))throw n(`EIO`,`Invalid handle`);this.index.set(e,new C({ino:t,data:t+1,nlink:1,mode:511|p,size:0})),t+=2}}constructor(e,t=!1){super(2003133025,`webaccessfs`),this.root=e,this.disableHandleCache=t,this._handles=new Map,this._sync=s.create({label:`accessfs-cache`}),this.attributes.set(`no_buffer_resize`,!0),t&&this.attributes.set(`no_handle_cache`,!0)}async stat(e){try{return await super.stat(e)}catch(t){if(t.code!=`ENOENT`)throw t;let n=await this.get(null,e),r=this.index._alloc(),i=new C({ino:r,data:r+1,nlink:1});if(A(n,`file`)){let e=await n.getFile();i.update({mode:420|o,size:e.size,mtimeMs:e.lastModified})}else i.update({mode:p|511,size:0});return this.index.set(e,i),i}}async readdir(e){let t=await this.get(`directory`,e);return await Array.fromAsync(t.keys())}async createFile(e,t){let n=await super.createFile(e,t);try{let t=await(await this.get(`directory`,b(e))).getFileHandle(d(e),{create:!0});this.disableHandleCache||this._handles.set(e,t)}catch(t){this.index.delete(e),this._handles.delete(e),h(D(t,e))}return n}async remove(e){let t=await this.get(`directory`,b(e));for(let t of this._handles.keys())b(t)==e&&this._handles.delete(t);this._handles.delete(e),await t.removeEntry(d(e),{recursive:!0}).catch(t=>{let n=D(t,e);n.code!=`ENOENT`&&h(n)})}removeSync(){throw T(n(`ENOSYS`))}async read(e,t,r,i){if(i<=r)return;let a=await(await(await this.get(`file`,e)).getFile()).arrayBuffer();if(a.byteLength<i-r)throw c(n(`EIO`,[`Unexpected mismatch in file data size. This should not happen.`,`tried to read ${i-r} bytes but the file is ${a.byteLength} bytes.`,`path: ${e}`].join(`
|
|
2
2
|
`+` `.repeat(24))));t.set(new Uint8Array(a,r,i-r))}async write(e,t,r){if(k(t.buffer)||O(t.buffer)){let e=new Uint8Array(new ArrayBuffer(t.byteLength),t.byteOffset,t.byteLength);e.set(t),t=e}let i=this.index.get(e);if(!i)throw n(`ENOENT`);let a=(i.mode&f)==p,o;try{o=await this.get(a?`directory`:`file`,e)}catch{o=await(await this.get(`directory`,b(e)))[a?`getDirectoryHandle`:`getFileHandle`](d(e),{create:!0}).catch(t=>h(D(t,e))),this.disableHandleCache||this._handles.set(e,o)}if(a)return;if(A(o,`directory`)){T(n(`EIO`,`Mismatch in entry kind on write`));return}let s=!r&&t.byteLength>=i.size,c=await o.createWritable({keepExistingData:!s});if(r)try{await c.seek(r)}catch{await c.write({type:`seek`,position:r})}await c.write(t),await c.close();let{size:l,lastModified:u}=await o.getFile();i.update({size:l,mtimeMs:u}),this.index.set(e,i)}async writeFile(e,t){return this.write(e,t,0)}async _mkdir(e){let t=await(await this.get(`directory`,b(e))).getDirectoryHandle(d(e),{create:!0}).catch(t=>h(D(t,e)));this.disableHandleCache||this._handles.set(e,t)}async get(e=null,t){let r=this._handles.get(t);if(!this.disableHandleCache&&r){if(e&&!A(r,e))throw n(e==`directory`?`ENOTDIR`:`EISDIR`);return r}if(t==`/`)return this.root;let i=t.slice(1).split(`/`),a=this.root;for(let e=0;e<i.length-1;++e)a=await a.getDirectoryHandle(i[e]).catch(e=>h(D(e,t)));try{let n=await a[e==`file`?`getFileHandle`:`getDirectoryHandle`](i.at(-1));return this.disableHandleCache||this._handles.set(t,n),n}catch(r){if(r.name!=`TypeMismatchError`)throw D(r,t);if(e===null){let e=await a.getFileHandle(i.at(-1)).catch(e=>h(D(e,t)));return this.disableHandleCache||this._handles.set(t,e),e}throw n(e==`file`?`EISDIR`:`ENOTDIR`)}}},M={name:`WebAccess`,options:{handle:{type:`object`,required:!0},metadata:{type:`string`,required:!1},disableHandleCache:{type:`boolean`,required:!1}},async create(e){let t=new j(e.handle,e.disableHandleCache);return await t._loadMetadata(e.metadata),t}};function N(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=t=>{t.preventDefault(),n(D(e.error))}})}var P=class extends l{async(e){this.asyncDone=this.asyncDone.then(()=>e)}constructor(e,t){super(t),this.tx=e,this.store=t,this.asyncDone=Promise.resolve(),this._idb=e.objectStore(t.name)}async keys(){return(await N(this._idb.getAllKeys())).map(Number)}async get(e){let t=await N(this._idb.get(e));return t&&this.store.cache.set(e,new Uint8Array(t)),t}getSync(e,t,n){if(!this.store.cache.has(e))return;let r=new Uint8Array(this.store.cache.get(e));return n??=r.byteLength,r.subarray(t,n)}async set(e,t){this.store.cache.set(e,new Uint8Array(t)),await N(this._idb.put(t,e))}setSync(e,t){this.async(this.set(e,t))}remove(e){return this.store.cache.delete(e),N(this._idb.delete(e))}removeSync(e){this.store.cache.delete(e),this.async(this.remove(e))}async commit(){await this.asyncDone;let{promise:e,resolve:t,reject:n}=Promise.withResolvers();return this.tx.oncomplete=()=>t(),this.tx.onerror=()=>n(D(this.tx.error)),this.tx.commit(),e}async abort(){await this.asyncDone;let{promise:e,resolve:t,reject:n}=Promise.withResolvers();return this.tx.onabort=()=>t(),this.tx.onerror=()=>n(D(this.tx.error)),this.tx.abort(),e}};async function F(t,n=globalThis.indexedDB){let r=n.open(t);return r.onupgradeneeded=()=>{let n=r.result;n.objectStoreNames.contains(t)&&(e(`Found unexpected object store: `+t),n.deleteObjectStore(t)),n.createObjectStore(t)},await N(r)}var I=class{constructor(e){this.db=e,this.cache=new Map}sync(){return Promise.resolve()}get name(){return this.db.name}transaction(){return new P(this.db.transaction(this.name,`readwrite`),this)}},L=new WeakMap;async function R(e){if(!(e instanceof IDBFactory))return!1;try{return(await N(e.open(`__zenfs_test`))).close(),!0}catch{return!1}finally{e?.deleteDatabase(`__zenfs_test`)}}var z={name:`IndexedDB`,options:{storeName:{type:`string`,required:!1},idbFactory:{type:`object`,required:!1}},async isAvailable({idbFactory:e=globalThis.indexedDB}){if(L.has(e))return L.get(e);let t=R(e);return L.set(e,t),t},async create(e){let t=new I(await F(e.storeName||`zenfs`,e.idbFactory)),n=new S(t);if(e?.disableAsyncCache)return i(`Async preloading disabled for IndexedDB`),n;let r=t.transaction();for(let e of await r.keys())await r.get(e);return n}},B=class{get name(){return V.name}constructor(e){this.storage=e}clear(){this.storage.clear()}clearSync(){this.storage.clear()}async sync(){}transaction(){return new y(this)}keys(){return Object.keys(this.storage).map(e=>Number(e))}get(e){let t=this.storage.getItem(e.toString());if(typeof t==`string`)return r(t)}set(e,r){try{this.storage.setItem(e.toString(),t(r))}catch{throw n(`ENOSPC`)}}delete(e){try{this.storage.removeItem(e.toString())}catch(t){throw n(`EIO`,`Unable to delete '${e}': ${t}`)}}},V={name:`WebStorage`,options:{storage:{type:`object`,required:!1}},isAvailable(e){return(e?.storage??globalThis.localStorage)instanceof globalThis.Storage},create({storage:e=globalThis.localStorage}){return new S(new B(e))}};function H(e){let t={};for(let n of u){let r=e.getAttribute(n);r!=null&&(t[n]=parseInt(r,16))}return new C(t)}function U(e,t){for(let n of Object.keys(t))!(n in u)||t[n]===void 0||e.setAttribute(n,t[n].toString(16))}function W(e,t=!1){let n;try{let r=t?e.textContent:e.getAttribute(`paths`);n=JSON.parse(r||`[]`)}catch{n=[]}return n}var G=class extends v(g){constructor(e=new DOMParser().parseFromString(`<fs></fs>`,`application/xml`).documentElement){super(544763244,`xmltmpfs`),this.root=e;try{this.mkdirSync(`/`,{uid:0,gid:0,mode:511})}catch(e){let t=e;if(t.code!=`EEXIST`)throw t}}renameSync(e,t){let n=this.get(`rename`,e);this.remove(`rename`,n,e),this.add(`rename`,n,t)}statSync(e){return H(this.get(`stat`,e))}createFileSync(e,t){let n=this.statSync(b(e)),r=new C({mode:t.mode|o,uid:n.mode&2048?n.uid:t.uid,gid:n.mode&1024?n.gid:t.gid});return this.create(`createFile`,e,r),r}unlinkSync(e){let t=this.get(`unlink`,e);if(H(t).mode&16384)throw n(`EISDIR`);this.remove(`unlink`,t,e)}rmdirSync(e){let t=this.get(`rmdir`,e);if(t.textContent?.length)throw n(`ENOTEMPTY`);if(!(H(t).mode&16384))throw n(`ENOTDIR`);this.remove(`rmdir`,t,e)}mkdirSync(e,t){let n=this.statSync(b(e)),r=new C({mode:t.mode|p,uid:n.mode&2048?n.uid:t.uid,gid:n.mode&1024?n.gid:t.gid});return this.create(`mkdir`,e,r).textContent=`[]`,r}readdirSync(e){let t=this.get(`readdir`,e);if(!(H(t).mode&16384))throw n(`ENOTDIR`);try{return JSON.parse(t.textContent)}catch(e){throw n(`EIO`,`Invalid directory listing: `+e)}}linkSync(e,t){let n=this.get(`link`,e);this.add(`link`,n,t)}touchSync(e,t){U(this.get(`touch`,e),t)}syncSync(){}readSync(e,t,n,i){let a=this.get(`read`,e),o=r(a.textContent.slice(n,i));t.set(o)}writeSync(e,n,r){let i=this.get(`write`,e),a=t(n),o=i.textContent.slice(r+a.length);i.textContent=i.textContent.slice(0,r)+a+o}toString(){return new XMLSerializer().serializeToString(this.root)}get(e,t){let r=this.root.children;if(!r)throw n(`EIO`);for(let e=0;e<r.length;e++)if(W(r[e]).includes(t))return r[e];throw n(`ENOENT`)}create(e,t,r){if(this.existsSync(t))throw n(`EEXIST`);let i=document.createElement(`file`);return this.add(e,i,t),U(i,new C({...r,uid:r.mode})),this.root.append(i),i}add(e,t,n,r=!1){let i=W(t,r);if(i.push(n),r){t.textContent=JSON.stringify(i);return}if(t.setAttribute(`paths`,JSON.stringify(i)),t.setAttribute(`nlink`,i.length.toString(16)),n!=`/`){let t=this.get(e,b(n));this.add(e,t,d(n),!0)}}remove(e,t,n,r=!1){let i=W(t,r),a=i.indexOf(n);if(a!=-1){if(i.splice(a,1),r){t.textContent=JSON.stringify(i);return}if(i.length?(t.setAttribute(`paths`,JSON.stringify(i)),t.setAttribute(`nlink`,i.length.toString(16))):t.remove(),n!=`/`){let t=this.get(e,b(n));this.remove(e,t,d(n),!0)}}}},K={name:`XML`,options:{root:{type:`object`,required:!1}},isAvailable(){return!0},create(e){return new G(e.root)}};export{z as IndexedDB,I as IndexedDBStore,P as IndexedDBTransaction,M as WebAccess,j as WebAccessFS,V as WebStorage,B as WebStorageStore,K as XML,G as XMLFS};
|
|
@@ -15,4 +15,4 @@ import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{n as r,t
|
|
|
15
15
|
* Copyright © James Prevett and other ZenFS contributors.
|
|
16
16
|
* SPDX-License-Identifier: LGPL-3.0-or-later
|
|
17
17
|
*/
|
|
18
|
-
;globalThis.__zenfs__=Object.
|
|
18
|
+
;globalThis.__zenfs__=Object.create(Ml);export{B as C,ne as D,P as E,te as O,ue as S,M as T,Qe as _,Zn as a,ce as b,Vn as c,kn as d,pn as f,Ye as g,et as h,fs as i,y as k,Bn as l,W as m,xl as n,Jn as o,G as p,zs as r,qn as s,Fl as t,q as u,it as v,k as w,le as x,rt as y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{C as e,D as t,E as n,O as r,S as i,T as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,k as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,u as C,w,x as T}from"./dist-
|
|
1
|
+
import{C as e,D as t,E as n,O as r,S as i,T as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,k as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,u as C,w,x as T}from"./dist-C9DoSbIs.js";function E(e){switch(e.name){case`TypeMismatchError`:return`EPERM`;case`IndexSizeError`:case`HierarchyRequestError`:case`InvalidCharacterError`:case`InvalidStateError`:case`SyntaxError`:case`NamespaceError`:case`ConstraintError`:case`VersionError`:case`URLMismatchError`:case`InvalidNodeTypeError`:return`EINVAL`;case`WrongDocumentError`:return`EXDEV`;case`NoModificationAllowedError`:case`InvalidModificationError`:case`InvalidAccessError`:case`SecurityError`:case`NotAllowedError`:return`EACCES`;case`NotFoundError`:return`ENOENT`;case`NotSupportedError`:return`ENOTSUP`;case`InUseAttributeError`:return`EBUSY`;case`NetworkError`:return`ENETDOWN`;case`AbortError`:return`EINTR`;case`QuotaExceededError`:return`ENOSPC`;case`TimeoutError`:return`ETIMEDOUT`;case`ReadOnlyError`:return`EROFS`;default:return`EIO`}}function D(e,t){if(e instanceof a)return e;let n=e instanceof DOMException?w[E(e)]:w.EIO,r=new a(n,e.message);return r.stack=e.stack,Error.captureStackTrace?.(r,D),r.cause=e.cause,r}function O(e){return typeof e==`object`&&!!e&&e.constructor.name==`SharedArrayBuffer`}function k(e){return e instanceof ArrayBuffer?e.resizable:O(e)?e.growable:!1}function A(e,t){return e.kind==t}var j=class extends x(m){async _loadHandles(e,t){for await(let[n,r]of t.entries()){let t=_(e,n);this._handles.set(t,r),A(r,`directory`)&&await this._loadHandles(t,r)}}async _loadMetadata(e){if(this._handles.set(`/`,this.root),await this._loadHandles(`/`,this.root),e){let t=await(await(await this.get(`file`,e)).getFile()).text(),n=JSON.parse(t);this.index.fromJSON(n);return}let t=1;for(let[e,r]of this._handles){if(A(r,`file`)){let{lastModified:n,size:i}=await r.getFile();this.index.set(e,new C({ino:t,data:t+1,nlink:1,mode:420|o,size:i,mtimeMs:n})),t+=2;continue}if(!A(r,`directory`))throw n(`EIO`,`Invalid handle`);this.index.set(e,new C({ino:t,data:t+1,nlink:1,mode:511|p,size:0})),t+=2}}constructor(e,t=!1){super(2003133025,`webaccessfs`),this.root=e,this.disableHandleCache=t,this._handles=new Map,this._sync=s.create({label:`accessfs-cache`}),this.attributes.set(`no_buffer_resize`,!0),t&&this.attributes.set(`no_handle_cache`,!0)}async stat(e){try{return await super.stat(e)}catch(t){if(t.code!=`ENOENT`)throw t;let n=await this.get(null,e),r=this.index._alloc(),i=new C({ino:r,data:r+1,nlink:1});if(A(n,`file`)){let e=await n.getFile();i.update({mode:420|o,size:e.size,mtimeMs:e.lastModified})}else i.update({mode:p|511,size:0});return this.index.set(e,i),i}}async readdir(e){let t=await this.get(`directory`,e);return await Array.fromAsync(t.keys())}async createFile(e,t){let n=await super.createFile(e,t);try{let t=await(await this.get(`directory`,b(e))).getFileHandle(d(e),{create:!0});this.disableHandleCache||this._handles.set(e,t)}catch(t){this.index.delete(e),this._handles.delete(e),h(D(t,e))}return n}async remove(e){let t=await this.get(`directory`,b(e));for(let t of this._handles.keys())b(t)==e&&this._handles.delete(t);this._handles.delete(e),await t.removeEntry(d(e),{recursive:!0}).catch(t=>{let n=D(t,e);n.code!=`ENOENT`&&h(n)})}removeSync(){throw T(n(`ENOSYS`))}async read(e,t,r,i){if(i<=r)return;let a=await(await(await this.get(`file`,e)).getFile()).arrayBuffer();if(a.byteLength<i-r)throw c(n(`EIO`,[`Unexpected mismatch in file data size. This should not happen.`,`tried to read ${i-r} bytes but the file is ${a.byteLength} bytes.`,`path: ${e}`].join(`
|
|
2
2
|
`+` `.repeat(24))));t.set(new Uint8Array(a,r,i-r))}async write(e,t,r){if(k(t.buffer)||O(t.buffer)){let e=new Uint8Array(new ArrayBuffer(t.byteLength),t.byteOffset,t.byteLength);e.set(t),t=e}let i=this.index.get(e);if(!i)throw n(`ENOENT`);let a=(i.mode&f)==p,o;try{o=await this.get(a?`directory`:`file`,e)}catch{o=await(await this.get(`directory`,b(e)))[a?`getDirectoryHandle`:`getFileHandle`](d(e),{create:!0}).catch(t=>h(D(t,e))),this.disableHandleCache||this._handles.set(e,o)}if(a)return;if(A(o,`directory`)){T(n(`EIO`,`Mismatch in entry kind on write`));return}let s=!r&&t.byteLength>=i.size,c=await o.createWritable({keepExistingData:!s});if(r)try{await c.seek(r)}catch{await c.write({type:`seek`,position:r})}await c.write(t),await c.close();let{size:l,lastModified:u}=await o.getFile();i.update({size:l,mtimeMs:u}),this.index.set(e,i)}async writeFile(e,t){return this.write(e,t,0)}async _mkdir(e){let t=await(await this.get(`directory`,b(e))).getDirectoryHandle(d(e),{create:!0}).catch(t=>h(D(t,e)));this.disableHandleCache||this._handles.set(e,t)}async get(e=null,t){let r=this._handles.get(t);if(!this.disableHandleCache&&r){if(e&&!A(r,e))throw n(e==`directory`?`ENOTDIR`:`EISDIR`);return r}if(t==`/`)return this.root;let i=t.slice(1).split(`/`),a=this.root;for(let e=0;e<i.length-1;++e)a=await a.getDirectoryHandle(i[e]).catch(e=>h(D(e,t)));try{let n=await a[e==`file`?`getFileHandle`:`getDirectoryHandle`](i.at(-1));return this.disableHandleCache||this._handles.set(t,n),n}catch(r){if(r.name!=`TypeMismatchError`)throw D(r,t);if(e===null){let e=await a.getFileHandle(i.at(-1)).catch(e=>h(D(e,t)));return this.disableHandleCache||this._handles.set(t,e),e}throw n(e==`file`?`EISDIR`:`ENOTDIR`)}}};const M={name:`WebAccess`,options:{handle:{type:`object`,required:!0},metadata:{type:`string`,required:!1},disableHandleCache:{type:`boolean`,required:!1}},async create(e){let t=new j(e.handle,e.disableHandleCache);return await t._loadMetadata(e.metadata),t}};function N(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=t=>{t.preventDefault(),n(D(e.error))}})}var P=class extends l{async(e){this.asyncDone=this.asyncDone.then(()=>e)}constructor(e,t){super(t),this.tx=e,this.store=t,this.asyncDone=Promise.resolve(),this._idb=e.objectStore(t.name)}async keys(){return(await N(this._idb.getAllKeys())).map(Number)}async get(e){let t=await N(this._idb.get(e));return t&&this.store.cache.set(e,new Uint8Array(t)),t}getSync(e,t,n){if(!this.store.cache.has(e))return;let r=new Uint8Array(this.store.cache.get(e));return n??=r.byteLength,r.subarray(t,n)}async set(e,t){this.store.cache.set(e,new Uint8Array(t)),await N(this._idb.put(t,e))}setSync(e,t){this.async(this.set(e,t))}remove(e){return this.store.cache.delete(e),N(this._idb.delete(e))}removeSync(e){this.store.cache.delete(e),this.async(this.remove(e))}async commit(){await this.asyncDone;let{promise:e,resolve:t,reject:n}=Promise.withResolvers();return this.tx.oncomplete=()=>t(),this.tx.onerror=()=>n(D(this.tx.error)),this.tx.commit(),e}async abort(){await this.asyncDone;let{promise:e,resolve:t,reject:n}=Promise.withResolvers();return this.tx.onabort=()=>t(),this.tx.onerror=()=>n(D(this.tx.error)),this.tx.abort(),e}};async function F(t,n=globalThis.indexedDB){let r=n.open(t);return r.onupgradeneeded=()=>{let n=r.result;n.objectStoreNames.contains(t)&&(e(`Found unexpected object store: `+t),n.deleteObjectStore(t)),n.createObjectStore(t)},await N(r)}var I=class{constructor(e){this.db=e,this.cache=new Map}sync(){return Promise.resolve()}get name(){return this.db.name}transaction(){return new P(this.db.transaction(this.name,`readwrite`),this)}};const L=new WeakMap;async function R(e){if(!(e instanceof IDBFactory))return!1;try{return(await N(e.open(`__zenfs_test`))).close(),!0}catch{return!1}finally{e?.deleteDatabase(`__zenfs_test`)}}const z={name:`IndexedDB`,options:{storeName:{type:`string`,required:!1},idbFactory:{type:`object`,required:!1}},async isAvailable({idbFactory:e=globalThis.indexedDB}){if(L.has(e))return L.get(e);let t=R(e);return L.set(e,t),t},async create(e){let t=new I(await F(e.storeName||`zenfs`,e.idbFactory)),n=new S(t);if(e?.disableAsyncCache)return i(`Async preloading disabled for IndexedDB`),n;let r=t.transaction();for(let e of await r.keys())await r.get(e);return n}};var B=class{get name(){return V.name}constructor(e){this.storage=e}clear(){this.storage.clear()}clearSync(){this.storage.clear()}async sync(){}transaction(){return new y(this)}keys(){return Object.keys(this.storage).map(e=>Number(e))}get(e){let t=this.storage.getItem(e.toString());if(typeof t==`string`)return r(t)}set(e,r){try{this.storage.setItem(e.toString(),t(r))}catch{throw n(`ENOSPC`)}}delete(e){try{this.storage.removeItem(e.toString())}catch(t){throw n(`EIO`,`Unable to delete '${e}': ${t}`)}}};const V={name:`WebStorage`,options:{storage:{type:`object`,required:!1}},isAvailable(e){return(e?.storage??globalThis.localStorage)instanceof globalThis.Storage},create({storage:e=globalThis.localStorage}){return new S(new B(e))}};function H(e){let t={};for(let n of u){let r=e.getAttribute(n);r!=null&&(t[n]=parseInt(r,16))}return new C(t)}function U(e,t){for(let n of Object.keys(t))!(n in u)||t[n]===void 0||e.setAttribute(n,t[n].toString(16))}function W(e,t=!1){let n;try{let r=t?e.textContent:e.getAttribute(`paths`);n=JSON.parse(r||`[]`)}catch{n=[]}return n}var G=class extends v(g){constructor(e=new DOMParser().parseFromString(`<fs></fs>`,`application/xml`).documentElement){super(544763244,`xmltmpfs`),this.root=e;try{this.mkdirSync(`/`,{uid:0,gid:0,mode:511})}catch(e){let t=e;if(t.code!=`EEXIST`)throw t}}renameSync(e,t){let n=this.get(`rename`,e);this.remove(`rename`,n,e),this.add(`rename`,n,t)}statSync(e){return H(this.get(`stat`,e))}createFileSync(e,t){let n=this.statSync(b(e)),r=new C({mode:t.mode|o,uid:n.mode&2048?n.uid:t.uid,gid:n.mode&1024?n.gid:t.gid});return this.create(`createFile`,e,r),r}unlinkSync(e){let t=this.get(`unlink`,e);if(H(t).mode&16384)throw n(`EISDIR`);this.remove(`unlink`,t,e)}rmdirSync(e){let t=this.get(`rmdir`,e);if(t.textContent?.length)throw n(`ENOTEMPTY`);if(!(H(t).mode&16384))throw n(`ENOTDIR`);this.remove(`rmdir`,t,e)}mkdirSync(e,t){let n=this.statSync(b(e)),r=new C({mode:t.mode|p,uid:n.mode&2048?n.uid:t.uid,gid:n.mode&1024?n.gid:t.gid});return this.create(`mkdir`,e,r).textContent=`[]`,r}readdirSync(e){let t=this.get(`readdir`,e);if(!(H(t).mode&16384))throw n(`ENOTDIR`);try{return JSON.parse(t.textContent)}catch(e){throw n(`EIO`,`Invalid directory listing: `+e)}}linkSync(e,t){let n=this.get(`link`,e);this.add(`link`,n,t)}touchSync(e,t){U(this.get(`touch`,e),t)}syncSync(){}readSync(e,t,n,i){let a=this.get(`read`,e),o=r(a.textContent.slice(n,i));t.set(o)}writeSync(e,n,r){let i=this.get(`write`,e),a=t(n),o=i.textContent.slice(r+a.length);i.textContent=i.textContent.slice(0,r)+a+o}toString(){return new XMLSerializer().serializeToString(this.root)}get(e,t){let r=this.root.children;if(!r)throw n(`EIO`);for(let e=0;e<r.length;e++)if(W(r[e]).includes(t))return r[e];throw n(`ENOENT`)}create(e,t,r){if(this.existsSync(t))throw n(`EEXIST`);let i=document.createElement(`file`);return this.add(e,i,t),U(i,new C({...r,uid:r.mode})),this.root.append(i),i}add(e,t,n,r=!1){let i=W(t,r);if(i.push(n),r){t.textContent=JSON.stringify(i);return}if(t.setAttribute(`paths`,JSON.stringify(i)),t.setAttribute(`nlink`,i.length.toString(16)),n!=`/`){let t=this.get(e,b(n));this.add(e,t,d(n),!0)}}remove(e,t,n,r=!1){let i=W(t,r),a=i.indexOf(n);if(a!=-1){if(i.splice(a,1),r){t.textContent=JSON.stringify(i);return}if(i.length?(t.setAttribute(`paths`,JSON.stringify(i)),t.setAttribute(`nlink`,i.length.toString(16))):t.remove(),n!=`/`){let t=this.get(e,b(n));this.remove(e,t,d(n),!0)}}}};const K={name:`XML`,options:{root:{type:`object`,required:!1}},isAvailable(){return!0},create(e){return new G(e.root)}};export{z as IndexedDB,I as IndexedDBStore,P as IndexedDBTransaction,M as WebAccess,j as WebAccessFS,V as WebStorage,B as WebStorageStore,K as XML,G as XMLFS};
|
|
@@ -9,4 +9,4 @@ import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{n as r,t
|
|
|
9
9
|
`+Error().stack.slice(6);if(!t)throw L(P(`EINVAL`,`Can not make an RPC request without a port`));let{resolve:a,reject:o,promise:s}=Promise.withResolvers(),c=Math.random().toString(16).slice(5),l={resolve:a,reject:o,promise:s,fs:r,timeout:setTimeout(()=>{let e=L(P(`ETIMEDOUT`,`RPC request timed out`));e.stack+=i,Ns(c),o(e)},n)};return Ps.set(c,l),t.send({...e,_zenfs:!0,id:c,stack:i}),s}function Is(e,...t){return t.includes(e.method)}function Ls(e){if(!Ms(e))return;if(!Ps.has(e.id)){let t=L(P(`EIO`,`Invalid RPC id: `+e.id));throw t.stack+=e.stack,t}let{resolve:t,reject:n}=Ps.get(e.id);if(e.error){let t=M.fromJSON({code:`EIO`,errno:k.EIO,...e.error});t.stack+=e.stack,Ns(e.id),n(t);return}Ns(e.id),t(Is(e,`stat`,`createFile`,`mkdir`)?new K(e.value):e.value)}function Rs(e,t){if(!e)throw L(P(`EINVAL`,`Cannot attach to non-existent port`));pe(`Attached handler to port: `+t.name),e.addHandler(t)}function zs(e,t){if(!e)throw L(P(`EINVAL`,`Cannot detach from non-existent port`));pe(`Detached handler from port: `+t.name),e.removeHandler(t)}function Bs(e){let t=[],n=t.push.bind(t);return Rs(e,n),async function(r){zs(e,n);for(let n of t)await Vs(e,r,`data`in n?n.data:n)}}async function Vs(e,t,n){if(!Ms(n))return;let r,i,a=[];try{switch(n.method){case`read`:{let[e,i,a,o]=n.args;await t.read(e,i,a,o),r=i;break}case`stat`:case`createFile`:case`mkdir`:{let e=await t[n.method](...n.args),i=e instanceof K?e:new K(e);r=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);break}case`touch`:{let[e,i]=n.args;await t.touch(e,new K(i)),r=void 0;break}default:r=await t[n.method](...n.args)}}catch(e){i=e instanceof M?e.toJSON():p(e,`message`,`stack`)}e.send({_zenfs:!0,...p(n,`id`,`method`,`stack`),error:i,value:r},a)}var Hs=[`rename`,`stat`,`touch`,`createFile`,`unlink`,`rmdir`,`mkdir`,`readdir`,`exists`,`link`,`sync`,`read`,`write`];function Us(e){class t extends e{async done(){return this.sync()}queueDone(){return this.sync()}_promise=Promise.resolve();_async(e){this._promise=this._promise.finally(()=>e())}_isInitialized=!1;_skippedCacheUpdates=0;constructor(...e){super(...e),this._patchAsync()}async ready(){if(await super.ready(),!(this._isInitialized||this.attributes.has(`no_async_preload`))){if(await this._promise,this.checkSync(),await this._sync.ready(),this._sync instanceof Xn&&this instanceof Xn){let e=this._sync.transaction(),t=this.transaction(),n=[];for(let r of await t.keys())n.push(t.get(r).then(t=>e.setSync(r,t)));await Promise.all(n),this._isInitialized=!0;return}try{await this.crossCopy(`/`),me(`Skipped ${this._skippedCacheUpdates} updates to the sync cache during initialization`),this._isInitialized=!0}catch(e){throw this._isInitialized=!1,de(e)}}}checkSync(){if(this.attributes.has(`no_async_preload`))throw P(`ENOTSUP`,`Sync preloading has been disabled for this async file system`);if(!this._sync)throw de(P(`ENOTSUP`,`No sync cache is attached to this async file system`))}renameSync(e,t){this.checkSync(),this._sync.renameSync(e,t),this._async(()=>this.rename(e,t))}statSync(e){return this.checkSync(),this._sync.statSync(e)}touchSync(e,t){this.checkSync(),this._sync.touchSync(e,t),this._async(()=>this.touch(e,t))}createFileSync(e,t){this.checkSync();let n=this._sync.createFileSync(e,t);return this._async(()=>this.createFile(e,t)),n}unlinkSync(e){this.checkSync(),this._sync.unlinkSync(e),this._async(()=>this.unlink(e))}rmdirSync(e){this.checkSync(),this._sync.rmdirSync(e),this._async(()=>this.rmdir(e))}mkdirSync(e,t){this.checkSync();let n=this._sync.mkdirSync(e,t);return this._async(()=>this.mkdir(e,t)),n}readdirSync(e){return this.checkSync(),this._sync.readdirSync(e)}linkSync(e,t){this.checkSync(),this._sync.linkSync(e,t),this._async(()=>this.link(e,t))}async sync(){!this.attributes.has(`no_async_preload`)&&this._sync&&this._sync.syncSync(),await this._promise.catch(()=>{})}syncSync(){this.checkSync(),this._sync.syncSync()}existsSync(e){return this.checkSync(),this._sync.existsSync(e)}readSync(e,t,n,r){this.checkSync(),this._sync.readSync(e,t,n,r)}writeSync(e,t,n){this.checkSync(),this._sync.writeSync(e,t,n),this._async(()=>this.write(e,t,n))}streamWrite(e,t){this.checkSync();let n=this._sync.streamWrite(e,t).getWriter(),r=super.streamWrite(e,t).getWriter();return new WritableStream({async write(e,t){await Promise.all([n.write(e),r.write(e)]).catch(t.error.bind(t))},async close(){await Promise.all([n.close(),r.close()])},async abort(e){await Promise.all([n.abort(e),r.abort(e)])}})}async crossCopy(e){this.checkSync();let t=await this.stat(e);if(!q(t)){this._sync.createFileSync(e,t);let n=new Uint8Array(t.size);await this.read(e,n,0,t.size),this._sync.writeSync(e,n,0),this._sync.touchSync(e,t);return}e!==`/`&&(this._sync.mkdirSync(e,t),this._sync.touchSync(e,t));let n=[];for(let t of await this.readdir(e))n.push(this.crossCopy(U(e,t)));await Promise.all(n)}_patchAsync(){let e=[`read`,`readdir`,`stat`,`exists`],t=Hs.filter(t=>!e.includes(t));for(let e of t){let t=this[e].bind(this);function n(t,r){if(r||(r=Error(),Error.captureStackTrace(r,n)),!r.stack)return!1;let i=r.stack.split(`
|
|
10
10
|
`).slice(t).join(`
|
|
11
11
|
`);return i.includes(`at <computed> [as ${e}]`)||i.includes(`at async <computed> [as ${e}]`)||i.includes(`${e}Sync `)}this[e]=async(...r)=>{let i=await t(...r);if(n(2))return i;if(!this._isInitialized)return this._skippedCacheUpdates++,i;try{this._sync?.[`${e}Sync`]?.(...r)}catch(e){if(n(3,e))return i;throw e.message+=` (Out of sync!)`,L(e)}return i}}me(`Async: patched ${t.length} methods`)}}return t}var Ws=class extends Us(Un){channel;timeout;port;_sync=er.create({label:`tmpfs:port`});constructor(e,t=250){super(1886351988,`portfs`),this.channel=e,this.timeout=t,this.port=Os(e),Rs(this.port,Ls)}rpc(e,...t){return Fs({method:e,args:t},{port:this.port,timeout:this.timeout,fs:this})}async ready(){await this.rpc(`ready`),await super.ready()}rename(e,t){return this.rpc(`rename`,e,t)}async stat(e){let t=await this.rpc(`stat`,e);return t instanceof K?t:new K(t)}async touch(e,t){let n=t instanceof K?t:new K(t);await this.rpc(`touch`,e,new Uint8Array(n.buffer,n.byteOffset,n.byteLength))}async sync(){await super.sync(),await this.rpc(`sync`)}async createFile(e,t){t instanceof K&&(t=t.toJSON());let n=await this.rpc(`createFile`,e,t);return n instanceof K?n:new K(n)}unlink(e){return this.rpc(`unlink`,e)}rmdir(e){return this.rpc(`rmdir`,e)}async mkdir(e,t){t instanceof K&&(t=t.toJSON());let n=await this.rpc(`mkdir`,e,t);return n instanceof K?n:new K(n)}readdir(e){return this.rpc(`readdir`,e)}exists(e){return this.rpc(`exists`,e)}link(e,t){return this.rpc(`link`,e,t)}async read(e,t,n,r){t.set(await this.rpc(`read`,e,t,n,r))}write(e,t,n){return this.rpc(`write`,e,t,n)}};function Gs(e,t){let n=Os(e);Rs(n,e=>Vs(n,t,e))}function Ks(e,t){let n=Os(e);zs(n,e=>Vs(n,t,e))}var qs={name:`Port`,options:{port:{type:[EventTarget,function(e){return typeof e==`object`&&`on`in e}],required:!0},timeout:{type:`number`,required:!1}},create(e){return new Ws(e.port,e.timeout)}};async function Js(e,t,n=0){let r=Os(e),i=Bs(r),a=await Go(t,n);return Gs(r,a),await i(a),pe(`Resolved remote mount: `+a.toString()),a}var Ys=function(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else(d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0},Z=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},Xs=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},Zs=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),Qs=e=>`0x`+e.toString(16).padStart(8,`0`),{format:$s}=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:2,unit:`byte`,unitDisplay:`narrow`}),ec=(()=>{var e,t,n,r;let i=[Ht.packed()],a,s=[],c,l=Gt(o),u,d=[],f=[],p,m=[],h=[],g,_=[],v=[],y,b=[],x=[];var S=class extends l{static{c=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;u=[(e=V).uint32.bind(e)],p=[(t=V).uint32.bind(t)],g=[(n=V).uint32.bind(n)],y=[(r=V).uint32.bind(r)],Ys(this,null,u,{kind:`accessor`,name:`id`,static:!1,private:!1,access:{has:e=>`id`in e,get:e=>e.id,set:(e,t)=>{e.id=t}},metadata:o},d,f),Ys(this,null,p,{kind:`accessor`,name:`offset_`,static:!1,private:!1,access:{has:e=>`offset_`in e,get:e=>e.offset_,set:(e,t)=>{e.offset_=t}},metadata:o},m,h),Ys(this,null,g,{kind:`accessor`,name:`offset`,static:!1,private:!1,access:{has:e=>`offset`in e,get:e=>e.offset,set:(e,t)=>{e.offset=t}},metadata:o},_,v),Ys(this,null,y,{kind:`accessor`,name:`size`,static:!1,private:!1,access:{has:e=>`size`in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:o},b,x),Ys(null,a={value:c},i,{kind:`class`,name:c.name,metadata:o},null,s),S=c=a.value,o&&Object.defineProperty(c,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`MetadataEntry`;#e=Z(this,d,void 0);get id(){return this.#e}set id(e){this.#e=e}#t=(Z(this,f),Z(this,m,void 0));get offset_(){return this.#t}set offset_(e){this.#t=e}#n=(Z(this,h),Z(this,_,void 0));get offset(){return this.#n}set offset(e){this.#n=e}#r=(Z(this,v),Z(this,b,void 0));get size(){return this.#r}set size(e){this.#r=e}toString(){return`<MetadataEntry @ ${Qs(this.byteOffset)}>`}constructor(){super(...arguments),Z(this,x)}static{Z(c,s)}};return c})(),tc=255,nc=5,rc=(()=>{var e,t,n,r;let i=[Ht.packed()],a,o=[],s,c=Gt.typed(Int32Array),l,u=[],d=[],f,p=[],m=[],h,g=[],_=[],v,y=[],b=[],x,S=[],C=[];var w=class extends c{static{s=this}static{let T=typeof Symbol==`function`&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;l=[(e=V).uint32.bind(e)],f=[(t=V).uint64.bind(t)],h=[(n=V).uint32.bind(n)],v=[Ut(qt(ec,tc))],x=[(r=V).int32.bind(r)],Ys(this,null,l,{kind:`accessor`,name:`checksum`,static:!1,private:!1,access:{has:e=>`checksum`in e,get:e=>e.checksum,set:(e,t)=>{e.checksum=t}},metadata:T},u,d),Ys(this,null,f,{kind:`accessor`,name:`timestamp`,static:!1,private:!1,access:{has:e=>`timestamp`in e,get:e=>e.timestamp,set:(e,t)=>{e.timestamp=t}},metadata:T},p,m),Ys(this,null,h,{kind:`accessor`,name:`previous_offset`,static:!1,private:!1,access:{has:e=>`previous_offset`in e,get:e=>e.previous_offset,set:(e,t)=>{e.previous_offset=t}},metadata:T},g,_),Ys(this,null,v,{kind:`accessor`,name:`items`,static:!1,private:!1,access:{has:e=>`items`in e,get:e=>e.items,set:(e,t)=>{e.items=t}},metadata:T},y,b),Ys(this,null,x,{kind:`accessor`,name:`locked`,static:!1,private:!1,access:{has:e=>`locked`in e,get:e=>e.locked,set:(e,t)=>{e.locked=t}},metadata:T},S,C),Ys(null,a={value:s},i,{kind:`class`,name:s.name,metadata:T},null,o),w=s=a.value,T&&Object.defineProperty(s,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:T})}static name=`MetadataBlock`;static lockIndex;#e=Z(this,u,void 0);get checksum(){return this.#e}set checksum(e){this.#e=e}#t=(Z(this,d),Z(this,p,BigInt(Date.now())));get timestamp(){return this.#t}set timestamp(e){this.#t=e}#n=(Z(this,m),Z(this,g,void 0));get previous_offset(){return this.#n}set previous_offset(e){this.#n=e}_previous=Z(this,_);get previous(){if(this.previous_offset)return this._previous??=new w(this.buffer,this.previous_offset),this._previous}#r=Z(this,y,void 0);get items(){return this.#r}set items(e){this.#r=e}toString(e=!1){if(!e)return`<MetadataBlock @ ${Qs(this.byteOffset)}>`;let t=[`---- Metadata block at ${Qs(this.byteOffset)} ----`,`Checksum: ${Qs(this.checksum)}`,`Last updated: ${new Date(Number(this.timestamp)).toLocaleString()}`,`Previous block: ${Qs(this.previous_offset)}`,`Entries:`].join(`
|
|
12
|
-
`);for(let e of this.items)e.offset&&(t+=`\n\t${Qs(e.id)}: ${$s(e.size).padStart(5)} at ${Qs(e.offset)}`);return t}#i=(Z(this,b),Z(this,S,void 0));get locked(){return this.#i}set locked(e){this.#i=e}waitUnlocked(e=0){if(e>nc)throw de(P(`EBUSY`,`sbfs: exceeded max attempts waiting for metadata block at ${Qs(this.byteOffset)} to be unlocked`));if(Atomics.load(this,w.lockIndex))switch(Atomics.wait(this,w.lockIndex,1)){case`ok`:break;case`not-equal`:return e++,L(`sbfs: waiting for metadata block at ${Qs(this.byteOffset)} to be unlocked (${e}/${nc})`),this.waitUnlocked(e);case`timed-out`:throw de(P(`EBUSY`,`sbfs: timed out waiting for metadata block at ${Qs(this.byteOffset)} to be unlocked`))}}lock(){this.waitUnlocked(),Atomics.store(this,w.lockIndex,1);let e=()=>{Atomics.store(this,w.lockIndex,0),Atomics.notify(this,w.lockIndex,1)};return e[Symbol.dispose]=e,e}constructor(){super(...arguments),Z(this,C)}static{Z(s,o)}};return w=s})();Object.assign(rc,{lockIndex:Lt(rc,`locked`)/Int32Array.BYTES_PER_ELEMENT});var ic=1651715706,ac=2,oc=(()=>{var e,t,n,r,i,a,o,s,c,l;let u=[Ht.packed()],d,f=[],p,m=Gt.typed(BigUint64Array),h,g=[],_=[],v,y=[],b=[],x,S=[],C=[],w,T=[],ee=[],E,te=[],ne=[],D,k=[],A=[],j,M=[],N=[],F,re=[],I=[],ie,ae=[],oe=[],se,ce=[],le=[],ue,L=[],fe=[],pe,he=[],ge=[],_e,ve=[],ye=[];var be=class extends m{static{p=this}static{let O=typeof Symbol==`function`&&Symbol.metadata?Object.create(m[Symbol.metadata]??null):void 0;h=[(e=V).uint32.bind(e)],v=[(t=V).uint32.bind(t)],x=[(n=V).uint16.bind(n)],w=[(r=V).uint16.bind(r)],E=[(i=V).uint32.bind(i)],D=[(a=V).uint64.bind(a)],j=[(o=V).uint64.bind(o)],F=[V.uint8(16)],ie=[(s=V).uint32.bind(s)],se=[(c=V).uint32.bind(c)],ue=[(l=V).uint32.bind(l)],pe=[V.char(64)],_e=[V.char(132)],Ys(this,null,h,{kind:`accessor`,name:`checksum`,static:!1,private:!1,access:{has:e=>`checksum`in e,get:e=>e.checksum,set:(e,t)=>{e.checksum=t}},metadata:O},g,_),Ys(this,null,v,{kind:`accessor`,name:`magic`,static:!1,private:!1,access:{has:e=>`magic`in e,get:e=>e.magic,set:(e,t)=>{e.magic=t}},metadata:O},y,b),Ys(this,null,x,{kind:`accessor`,name:`version`,static:!1,private:!1,access:{has:e=>`version`in e,get:e=>e.version,set:(e,t)=>{e.version=t}},metadata:O},S,C),Ys(this,null,w,{kind:`accessor`,name:`inode_format`,static:!1,private:!1,access:{has:e=>`inode_format`in e,get:e=>e.inode_format,set:(e,t)=>{e.inode_format=t}},metadata:O},T,ee),Ys(this,null,E,{kind:`accessor`,name:`flags`,static:!1,private:!1,access:{has:e=>`flags`in e,get:e=>e.flags,set:(e,t)=>{e.flags=t}},metadata:O},te,ne),Ys(this,null,D,{kind:`accessor`,name:`used_bytes`,static:!1,private:!1,access:{has:e=>`used_bytes`in e,get:e=>e.used_bytes,set:(e,t)=>{e.used_bytes=t}},metadata:O},k,A),Ys(this,null,j,{kind:`accessor`,name:`total_bytes`,static:!1,private:!1,access:{has:e=>`total_bytes`in e,get:e=>e.total_bytes,set:(e,t)=>{e.total_bytes=t}},metadata:O},M,N),Ys(this,null,F,{kind:`accessor`,name:`uuid`,static:!1,private:!1,access:{has:e=>`uuid`in e,get:e=>e.uuid,set:(e,t)=>{e.uuid=t}},metadata:O},re,I),Ys(this,null,ie,{kind:`accessor`,name:`metadata_block_size`,static:!1,private:!1,access:{has:e=>`metadata_block_size`in e,get:e=>e.metadata_block_size,set:(e,t)=>{e.metadata_block_size=t}},metadata:O},ae,oe),Ys(this,null,se,{kind:`accessor`,name:`metadata_offset_`,static:!1,private:!1,access:{has:e=>`metadata_offset_`in e,get:e=>e.metadata_offset_,set:(e,t)=>{e.metadata_offset_=t}},metadata:O},ce,le),Ys(this,null,ue,{kind:`accessor`,name:`metadata_offset`,static:!1,private:!1,access:{has:e=>`metadata_offset`in e,get:e=>e.metadata_offset,set:(e,t)=>{e.metadata_offset=t}},metadata:O},L,fe),Ys(this,null,pe,{kind:`accessor`,name:`label`,static:!1,private:!1,access:{has:e=>`label`in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:O},he,ge),Ys(this,null,_e,{kind:`accessor`,name:`_padding`,static:!1,private:!1,access:{has:e=>`_padding`in e,get:e=>e._padding,set:(e,t)=>{e._padding=t}},metadata:O},ve,ye),Ys(null,d={value:p},u,{kind:`class`,name:p.name,metadata:O},null,f),be=p=d.value,O&&Object.defineProperty(p,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:O})}static name=`SuperBlock`;constructor(...e){if(super(...e),Z(this,ye),this.magic!=ic){R(`sbfs: Invalid magic value, assuming this is a fresh super block`);let e=new rc(this.buffer,B(be));Object.assign(this,{metadata:e,metadata_offset:e.byteOffset,used_bytes:BigInt(B(be)+B(rc)),total_bytes:BigInt(this.buffer.byteLength),magic:ic,version:1,inode_format:5,metadata_block_size:B(rc),uuid:O(crypto.randomUUID())}),cc(this),cc(e);return}if(this.checksum!==sc(this))throw de(P(`EIO`,`sbfs: checksum mismatch for super block`));if(this.metadata=new rc(this.buffer,this.metadata_offset),this.metadata.checksum!==sc(this.metadata))throw de(P(`EIO`,`sbfs: checksum mismatch for metadata block (saved ${Qs(this.metadata.checksum)}, computed ${Qs(sc(this.metadata))})`));if(this.inode_format!=5)throw de(P(`EIO`,`sbfs: inode format mismatch`));if(this.metadata_block_size!=B(rc))throw de(P(`EIO`,`sbfs: metadata block size mismatch`))}#e=Z(this,g,void 0);get checksum(){return this.#e}set checksum(e){this.#e=e}#t=(Z(this,_),Z(this,y,void 0));get magic(){return this.#t}set magic(e){this.#t=e}#n=(Z(this,b),Z(this,S,void 0));get version(){return this.#n}set version(e){this.#n=e}#r=(Z(this,C),Z(this,T,void 0));get inode_format(){return this.#r}set inode_format(e){this.#r=e}#i=(Z(this,ee),Z(this,te,void 0));get flags(){return this.#i}set flags(e){this.#i=e}#a=(Z(this,ne),Z(this,k,void 0));get used_bytes(){return this.#a}set used_bytes(e){this.#a=e}#o=(Z(this,A),Z(this,M,void 0));get total_bytes(){return this.#o}set total_bytes(e){this.#o=e}#s=(Z(this,N),Z(this,re,void 0));get uuid(){return this.#s}set uuid(e){this.#s=e}#c=(Z(this,I),Z(this,ae,void 0));get metadata_block_size(){return this.#c}set metadata_block_size(e){this.#c=e}#l=(Z(this,oe),Z(this,ce,void 0));get metadata_offset_(){return this.#l}set metadata_offset_(e){this.#l=e}#u=(Z(this,le),Z(this,L,void 0));get metadata_offset(){return this.#u}set metadata_offset(e){this.#u=e}metadata=Z(this,fe);#d=Z(this,he,void 0);get label(){return this.#d}set label(e){this.#d=e}#f=(Z(this,ge),Z(this,ve,void 0));get _padding(){return this.#f}set _padding(e){this.#f=e}rotateMetadata(){let e=this.used_bytes%BigInt(4);Atomics.add(this,ac,e);let t=Number(Atomics.add(this,ac,BigInt(B(rc)))),n=new rc(this.buffer,t);return n.previous_offset=this.metadata_offset,this.metadata=n,this.metadata_offset=n.byteOffset,cc(n),cc(this),me(`sbfs: rotated metadata block at ${Qs(n.previous_offset)} with new block at ${Qs(t)}`),n}isUnused(e,t){if(!t)return!0;if(e+t>this.total_bytes||e<B(be))return!1;for(let n=this.metadata;n;n=n.previous){if(e<n.byteOffset+B(rc)&&e+t>n.byteOffset)return!1;for(let r of n.items)if(r.offset&&(e>=r.offset&&e<r.offset+r.size||e+t>r.offset&&e+t<=r.offset+r.size||e<=r.offset&&e+t>=r.offset+r.size))return!1}return!0}static{Z(p,f)}};return be=p})();function sc(e){let t=B(e)-4;return e instanceof rc&&(t-=Int32Array.BYTES_PER_ELEMENT),l(new Uint8Array(e.buffer,e.byteOffset+4,t))}function cc(e){e instanceof rc&&(e.timestamp=BigInt(Date.now())),e.checksum=sc(e)}var lc=class extends o{flags=[];name=`sbfs`;type=1935828595;get uuid(){return D(this.superblock.uuid)}superblock;_view;_u8;constructor(...e){if(super(...e),this.byteLength<B(oc)+B(rc))throw de(P(`EINVAL`,`sbfs: Buffer is too small for a file system`));this._view=new DataView(this.buffer,this.byteOffset,this.byteLength),this._u8=new Uint8Array(this.buffer,this.byteOffset,this.byteLength),this.superblock=new oc(this.buffer,this.byteOffset)}*keys(){let e=new Set;for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items)!n.offset||e.has(n.id)||(e.add(n.id),yield n.id)}}get(e){for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items){if(!n.offset||n.id!=e)continue;let t=this.byteOffset+n.offset;return new Uint8Array(this.buffer.slice(t,t+n.size))}}}set(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(e===0&&t.length<B(K))throw ue(P(`EIO`,`sbfs: tried to set ${t.length} bytes for id 0!`));for(let n=this.superblock.metadata;n;n=n.previous){n.waitUnlocked();for(let r of n.items){let i={stack:[],error:void 0,hasError:!1};try{if(!r.offset||r.id!=e)continue;if(Xs(i,n.lock(),!1),t.length==r.size){this._u8.set(t,r.offset);return}if(t.length<r.size||this.superblock.isUnused(r.offset,t.length)){this._u8.set(t,r.offset),r.size=t.length,cc(n);return}r.offset=Number(Atomics.add(this.superblock,ac,BigInt(t.length))),r.size=t.length,this._u8.set(t,r.offset),cc(n),cc(this.superblock);return}catch(e){i.error=e,i.hasError=!0}finally{Zs(i)}}}let r=Array.from(this.superblock.metadata.items).find(e=>!e.offset);r||=(this.superblock.rotateMetadata(),this.superblock.metadata.items[0]),Xs(n,this.superblock.metadata.lock(),!1);let i=Number(Atomics.add(this.superblock,ac,BigInt(t.length)));r.id=e,r.offset=i,r.size=t.length,this._u8.set(t,i),cc(this.superblock.metadata),cc(this.superblock)}catch(e){n.error=e,n.hasError=!0}finally{Zs(n)}}delete(e){for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items)if(n.id==e){n.offset=0,n.size=0,n.id=0,cc(t);return}}}_fs;get fs(){return this._fs}set fs(e){this.buffer.constructor.name===`SharedArrayBuffer`&&e?.attributes.set(`no_id_tables`,!0),this._fs=e}sync(){return Promise.resolve()}usage(){return{totalSpace:Number(this.superblock.total_bytes),freeSpace:Number(this.superblock.total_bytes-this.superblock.used_bytes)}}transaction(){return new Zn(this)}},uc={name:`SingleBuffer`,options:{buffer:{type:`object`,required:!0}},create(e){let t=new Xn(ArrayBuffer.isView(e.buffer)?new lc(e.buffer.buffer,e.buffer.byteOffset,e.buffer.byteLength):new lc(e.buffer));return t.checkRootSync(),t}},Q=()=>{};async function dc(e){let t=[];for await(let n of e)t.push(n);return t}function fc(e,t,n=Q){co.call(this,e,t).then(()=>n(null)).catch(n)}function pc(e,t=Q){lo.call(this,e).then(t).catch(()=>t(!1))}function mc(e,t,n=Q){n=typeof t==`function`?t:n,uo.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function hc(e,t,n=Q){n=typeof t==`function`?t:n,fo.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function gc(e,t=0,n=Q){n=typeof t==`function`?t:n;let r=typeof t==`number`?t:0;po.call(this,e,r).then(()=>n(null)).catch(n)}function _c(e,t=Q){mo.call(this,e).then(()=>t(null)).catch(t)}function vc(e,t,n,r=Q){let i=Zt(n,420);r=typeof n==`function`?n:r,ho.call(this,e,t,i).then(e=>r(null,e.fd)).catch(r)}function yc(e,t,n=Q){n=typeof t==`function`?t:n,go.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function bc(e,t,n,r=Q){r=typeof n==`function`?n:r,_o.call(this,e,t,typeof n==`function`?null:n).then(()=>r(null)).catch(r)}function xc(e,t,n,r=Q){let i=typeof n==`function`?void 0:n;r=typeof n==`function`?n:r,vo.call(this,e,t,i).then(()=>r(null)).catch(r)}function Sc(e,t,n=Q){n=typeof t==`function`?t:n,new so(this,e).stat().then(e=>n(null,typeof t==`object`&&t?.bigint?new Sn(e):e)).catch(n)}function Cc(e,t=Q){new so(this,e).close().then(()=>t(null)).catch(t)}function wc(e,t,n=Q){let r=typeof t==`number`?t:0;n=typeof t==`function`?t:n;let i=new so(this,e);if(r<0)throw P(`EINVAL`);i.truncate(r).then(()=>n(null)).catch(n)}function Tc(e,t=Q){new so(this,e).sync().then(()=>t(null)).catch(t)}function Ec(e,t=Q){new so(this,e).datasync().then(()=>t(null)).catch(t)}function Dc(e,t,n,r,i,a=Q){let o,s,c,l,u,d=new so(this,e);if(typeof t==`string`){switch(u=`utf8`,typeof n){case`function`:a=n;break;case`number`:l=n,u=typeof r==`string`?r:`utf8`,a=typeof i==`function`?i:a;break;default:a=typeof r==`function`?r:typeof i==`function`?i:a,a(P(`EINVAL`));return}o=lr.Buffer.from(t),s=0,c=o.length;let e=a;d.write(o,s,c,l).then(({bytesWritten:t})=>e(null,t,o.toString(u))).catch(e)}else{o=lr.Buffer.from(t.buffer),s=n,c=r,l=typeof i==`number`?i:null;let e=typeof i==`function`?i:a;d.write(o,s,c,l).then(({bytesWritten:t})=>e(null,t,o)).catch(e)}}function Oc(e,t,n,r,i,a=Q){new so(this,e).read(t,n,r,i).then(({bytesRead:e,buffer:t})=>a(null,e,t)).catch(a)}function kc(e,t,n,r=Q){new so(this,e).chown(t,n).then(()=>r(null)).catch(r)}function Ac(e,t,n){new so(this,e).chmod(t).then(()=>n(null)).catch(n)}function jc(e,t,n,r=Q){new so(this,e).utimes(t,n).then(()=>r(null)).catch(r)}function Mc(e,t=Q){yo.call(this,e).then(()=>t(null)).catch(t)}function Nc(e,t,n=Q){bo.call(this,e,t).then(()=>n(null)).catch(n)}function Pc(e,t,n=Q){n=typeof t==`function`?t:n;let r=typeof t==`function`?{}:t;xo.call(this,e,r).then(e=>n(null,e)).catch(n)}function Fc(e,t,n=Q){So.call(this,e,t).then(()=>n(null)).catch(n)}function Ic(e,t,n,r=Q){let i=typeof n==`string`?n:`file`;r=typeof n==`function`?n:r,Co.call(this,e,t,i).then(()=>r(null)).catch(r)}function Lc(e,t,n=Q){n=typeof t==`function`?t:n,wo.call(this,e).then(e=>n(null,e)).catch(n)}function Rc(e,t,n,r=Q){To.call(this,e,t,n).then(()=>r(null)).catch(r)}function zc(e,t,n,r=Q){Eo.call(this,e,t,n).then(()=>r(null)).catch(r)}function Bc(e,t,n=Q){Do.call(this,e,t).then(()=>n(null)).catch(n)}function Vc(e,t,n=Q){Oo.call(this,e,t).then(()=>n(null)).catch(n)}function Hc(e,t,n,r=Q){ko.call(this,e,t,n).then(()=>r(null)).catch(r)}function Uc(e,t,n,r=Q){Ao.call(this,e,t,n).then(()=>r(null)).catch(r)}function Wc(e,t,n=Q){n=typeof t==`function`?t:n,jo.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function Gc(e,t,n=Q){let r=typeof t==`number`?t:4;n=typeof t==`function`?t:n,No.call(this,e,r).then(()=>n(null)).catch(n)}var Kc=new Map;function qc(e,t,n){let r=H(e),i=typeof t==`function`?{}:t;if(typeof t==`function`&&(n=t),!n)throw N(`EINVAL`,`watch`,e.toString());if(Kc.has(r)){let e=Kc.get(r);e&&e.listeners.add(n);return}let a=new oa(this,r,i);a.on(`change`,(e,t)=>{let n=Kc.get(r);if(n)for(let r of n.listeners)r(e,t)}),Kc.set(r,{watcher:a,listeners:new Set([n])})}function Jc(e,t=Q){let n=H(e),r=Kc.get(n);r&&(t&&t!==Q?r.listeners.delete(t):r.listeners.clear(),r.listeners.size===0&&(r.watcher.stop(),Kc.delete(n)))}function Yc(e,t,n){let r=new aa(this,H(e),typeof t==`object`?t:{});return n=typeof t==`function`?t:n,r.on(`change`,n||Q),r}function Xc(e,t){t=typeof t==`object`?t:{encoding:t};let n=ho.call(this,e,`r`,t?.mode);return new eo({...t,autoClose:!0},n)}function Zc(e,t){t=typeof t==`object`?t:{encoding:t};let n=ho.call(this,e,`w`,t?.mode);return new to(t,n)}function Qc(e,t,n=Q){n=typeof t==`function`?t:n,Po.call(this,e,typeof t==`function`?void 0:t).then(()=>n(null)).catch(n)}function $c(e,t,n=Q){n=typeof t==`function`?t:n,Fo.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function el(e,t,n,r=Q){r=typeof n==`function`?n:r,Lo.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function tl(e,t,n,r=Q){r=typeof n==`function`?n:r,new so(this,e).readv(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesRead:t})=>r(null,t,e)).catch(r)}function nl(e,t,n,r=Q){r=typeof n==`function`?n:r,new so(this,e).writev(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesWritten:t})=>r(null,t,e)).catch(r)}function rl(e,t,n=Q){n=typeof t==`function`?t:n,Ro.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}function il(e,t,n,r=Q){r=typeof n==`function`?n:r,zo.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function al(e,t,n=Q){n=typeof t==`function`?t:n,Bo.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}async function ol(e,t){let n=await ho.call(this,e.toString(),`r`),r=await n.readFile();return await n.close(),new Blob([r],t)}function sl(e,t,n=Q){n=typeof t==`function`?t:n,dc(Vo.call(this,e,typeof t==`function`?void 0:t)).then(e=>n(null,e??[])).catch(e=>n(e))}var cl=t({BigIntStatsFs:()=>Tn,Dir:()=>li,Dirent:()=>si,ReadStream:()=>eo,Stats:()=>xn,StatsFs:()=>wn,WriteStream:()=>to,access:()=>Gc,accessSync:()=>Ki,appendFile:()=>xc,appendFileSync:()=>Si,chmod:()=>Bc,chmodSync:()=>Vi,chown:()=>Rc,chownSync:()=>zi,close:()=>Cc,closeSync:()=>wi,constants:()=>Be,copyFile:()=>el,copyFileSync:()=>Xi,cp:()=>il,cpSync:()=>ea,createReadStream:()=>Xc,createWriteStream:()=>Zc,exists:()=>pc,existsSync:()=>pi,fchmod:()=>Ac,fchmodSync:()=>ji,fchown:()=>kc,fchownSync:()=>Ai,fdatasync:()=>Ec,fdatasyncSync:()=>Di,fstat:()=>Sc,fstatSync:()=>Ci,fsync:()=>Tc,fsyncSync:()=>Ei,ftruncate:()=>wc,ftruncateSync:()=>Ti,futimes:()=>jc,futimesSync:()=>Mi,glob:()=>sl,globSync:()=>na,lchmod:()=>Vc,lchmodSync:()=>Hi,lchown:()=>zc,lchownSync:()=>Bi,link:()=>Fc,linkSync:()=>Ii,lopenSync:()=>yi,lstat:()=>hc,lstatSync:()=>hi,lutimes:()=>Uc,lutimesSync:()=>Wi,mkdir:()=>Nc,mkdirSync:()=>Pi,mkdtemp:()=>$c,mkdtempDisposableSync:()=>Yi,mkdtempSync:()=>Ji,open:()=>vc,openAsBlob:()=>ol,openSync:()=>vi,opendir:()=>rl,opendirSync:()=>$i,promises:()=>no,read:()=>Oc,readFile:()=>yc,readFileSync:()=>bi,readSync:()=>ki,readdir:()=>Pc,readdirSync:()=>Fi,readlink:()=>Lc,readlinkSync:()=>Ri,readv:()=>tl,readvSync:()=>Zi,realpath:()=>Wc,realpathSync:()=>Gi,rename:()=>fc,renameSync:()=>fi,rm:()=>Qc,rmSync:()=>qi,rmdir:()=>Mc,rmdirSync:()=>Ni,stat:()=>mc,statSync:()=>mi,statfs:()=>al,statfsSync:()=>ta,symlink:()=>Ic,symlinkSync:()=>Li,truncate:()=>gc,truncateSync:()=>gi,unlink:()=>_c,unlinkSync:()=>_i,unwatchFile:()=>Jc,utimes:()=>Hc,utimesSync:()=>Ui,watch:()=>Yc,watchFile:()=>qc,write:()=>Dc,writeFile:()=>bc,writeFileSync:()=>xi,writeSync:()=>Oi,writev:()=>nl,writevSync:()=>Qi}),ll=t({get:()=>fl,getSync:()=>pl,list:()=>vl,listSync:()=>yl,remove:()=>gl,removeSync:()=>_l,set:()=>ml,setSync:()=>hl}),ul=[];function dl(e,t,n,r){if(!t.startsWith(`user.`)&&!ul.includes(t))throw N(`ENOTSUP`,r,n)}async function fl(e,t,n={}){e=H(e);let{fs:r,path:i}=X(e,this);dl(this,t,e,`xattr.get`);let a=await r.stat(i).catch(F(`xattr.get`,e));if(Y&&!J(this,a,4))throw N(`EACCES`,`xattr.get`,e);a.attributes??=new kn;let o=a.attributes.get(t);if(!o)throw N(`ENODATA`,`xattr.get`,e);let s=lr.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}function pl(e,t,n={}){e=H(e),dl(this,t,e,`xattr.get`);let{fs:r,path:i}=X(e,this),a;try{a=r.statSync(i)}catch(t){throw j(Object.assign(t,{path:e}))}if(Y&&!J(this,a,4))throw N(`EACCES`,`xattr.get`,e);a.attributes??=new kn;let o=a.attributes.get(t);if(!o)throw N(`ENODATA`,`xattr.get`,e);let s=lr.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}async function ml(e,t,n,r={}){e=H(e);let{fs:i,path:a}=X(e,this);dl(this,t,e,`xattr.set`);let o=await i.stat(a).catch(F(`xattr.set`,e));if(Y&&!J(this,o,2))throw N(`EACCES`,`xattr.set`,e);o.attributes??=new kn;let s=o.attributes.get(t);if(r.create&&s)throw N(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw N(`ENODATA`,`xattr.set`,e);o.attributes.set(t,lr.Buffer.from(n)),await i.touch(a,o).catch(F(`xattr.set`,e))}function hl(e,t,n,r={}){e=H(e);let{fs:i,path:a}=X(e,this);dl(this,t,e,`xattr.set`);let o;try{o=i.statSync(a)}catch(t){throw j(Object.assign(t,{path:e}))}if(Y&&!J(this,o,2))throw N(`EACCES`,`xattr.set`,e);o.attributes??=new kn;let s=o.attributes.get(t);if(r.create&&s)throw N(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw N(`ENODATA`,`xattr.set`,e);o.attributes.set(t,lr.Buffer.from(n));try{i.touchSync(a,o)}catch(t){throw j(Object.assign(t,{path:e}))}}async function gl(e,t){e=H(e);let{fs:n,path:r}=X(e,this);dl(this,t,e,`xattr.remove`);let i=await n.stat(r).catch(F(`xattr.remove`,e));if(Y&&!J(this,i,2))throw N(`EACCES`,`xattr.remove`,e);if(i.attributes??=new kn,!i.attributes.get(t))throw N(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t),await n.touch(r,i)}function _l(e,t){e=H(e);let{fs:n,path:r}=X(e,this);dl(this,t,e,`xattr.remove`);let i;try{i=n.statSync(r)}catch(t){throw j(Object.assign(t,{path:e}))}if(Y&&!J(this,i,2))throw N(`EACCES`,`xattr.remove`,e);if(i.attributes??=new kn,!i.attributes.get(t))throw N(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t);try{n.touchSync(r,i)}catch(t){throw j(Object.assign(t,{path:e}))}}async function vl(e){e=H(e);let{fs:t,path:n}=X(e,this),r=await t.stat(n).catch(F(`xattr.list`,e));return r.attributes?[...r.attributes.keys()]:[]}function yl(e){e=H(e);let{fs:t,path:n}=X(e,this),r;try{r=t.statSync(n)}catch(t){throw j(Object.assign(t,{path:e}))}return r.attributes?[...r.attributes.keys()]:[]}var bl=new Map;function xl(e={}){let t=Le(this);if(!mi.call(this,t.root).isDirectory())throw N(`ENOTDIR`,{syscall:`chroot`,path:t.root});let n=ze(t,e),r=Object.assign(n,{fs:{..._(cl,n),promises:_(no,n),xattr:_(ll,n)},path:_(on,n),bind:e=>{let t=xl.call(n,e);return n.children.push(t),t}});return bl.set(n.id,r),r}var $=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},Sl=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),Cl=class{previous;current=Promise.withResolvers();_isLocked=!0;get isLocked(){return this._isLocked}constructor(e){this.previous=e}async done(){await this.previous?.done(),await this.current.promise}unlock(){this.current.resolve(),this._isLocked=!1}[Symbol.dispose](){this.unlock()}},wl=class{_fs;get type(){return this._fs.type}get name(){return this._fs.name}get label(){return this._fs.label}set label(e){this._fs.label=e}get attributes(){return this._fs.attributes}get _uuid(){return this._fs._uuid}set _uuid(e){this._fs._uuid=e}get uuid(){return this._fs.uuid}async ready(){return await this._fs.ready()}readySync(){return this._fs.readySync()}usage(){return this._fs.usage()}currentLock;addLock(){let e=new Cl(this.currentLock);return this.currentLock=e,e}async lock(e=5e3){let t=this.currentLock,n=this.addLock(),r=Error().stack;return setTimeout(()=>{if(n.isLocked){let e=P(`EDEADLK`);throw e.stack+=r?.slice(5),L(e)}},e),await t?.done(),n}lockSync(){if(this.currentLock?.isLocked)throw L(P(`EBUSY`));return this.addLock()}get isLocked(){return!!this.currentLock?.isLocked}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.rename(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.renameSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.stat(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.statSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.touch(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,this.lockSync(),!1),this._fs.touchSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}async createFile(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,await this.lock(),!1),await this._fs.createFile(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}createFileSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.createFileSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}async unlink(e){let t={stack:[],error:void 0,hasError:!1};try{$(t,await this.lock(),!1),await this._fs.unlink(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}unlinkSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.unlinkSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}async rmdir(e){let t={stack:[],error:void 0,hasError:!1};try{$(t,await this.lock(),!1),await this._fs.rmdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}rmdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.rmdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}async mkdir(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,await this.lock(),!1),await this._fs.mkdir(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}mkdirSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.mkdirSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.readdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.readdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}async exists(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.exists(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}existsSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.existsSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.link(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.linkSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}async sync(){let e={stack:[],error:void 0,hasError:!1};try{$(e,await this.lock(),!1),await this._fs.sync()}catch(t){e.error=t,e.hasError=!0}finally{Sl(e)}}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{return $(e,this.lockSync(),!1),this._fs.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{Sl(e)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return $(i,await this.lock(),!1),await this._fs.read(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Sl(i)}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return $(i,this.lockSync(),!1),this._fs.readSync(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Sl(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return $(r,await this.lock(),!1),await this._fs.write(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Sl(r)}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return $(r,this.lockSync(),!1),this._fs.writeSync(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Sl(r)}}streamRead(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.streamRead(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}streamWrite(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.streamWrite(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}};function Tl(e){class t extends wl{constructor(...t){super(),this._fs=new e(...t)}}return t}function El(e){class t extends e{constructor(...e){super(...e),this.attributes.set(`no_write`)}async rename(){throw P(`EROFS`)}renameSync(){throw P(`EROFS`)}async createFile(){throw P(`EROFS`)}createFileSync(){throw P(`EROFS`)}async unlink(){throw P(`EROFS`)}unlinkSync(){throw P(`EROFS`)}async rmdir(){throw P(`EROFS`)}rmdirSync(){throw P(`EROFS`)}async mkdir(){throw P(`EROFS`)}mkdirSync(){throw P(`EROFS`)}async link(){throw P(`EROFS`)}linkSync(){throw P(`EROFS`)}async touch(){throw P(`EROFS`)}touchSync(){throw P(`EROFS`)}async sync(){throw P(`EROFS`)}syncSync(){throw P(`EROFS`)}async write(){throw P(`EROFS`)}writeSync(){throw P(`EROFS`)}streamWrite(){throw P(`EROFS`)}}return t}function Dl(e){class t extends e{async exists(e){return this.existsSync(e)}async rename(e,t){return this.renameSync(e,t)}async stat(e){return this.statSync(e)}async touch(e,t){return this.touchSync(e,t)}async createFile(e,t){return this.createFileSync(e,t)}async unlink(e){return this.unlinkSync(e)}async rmdir(e){return this.rmdirSync(e)}async mkdir(e,t){return this.mkdirSync(e,t)}async readdir(e){return this.readdirSync(e)}async link(e,t){return this.linkSync(e,t)}async sync(){return this.syncSync()}async read(e,t,n,r){return this.readSync(e,t,n,r)}async write(e,t,n){return this.writeSync(e,t,n)}}return t}var Ol=function(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else(d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0},kl=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},Al;(function(e){e[e.RealTime=1]=`RealTime`,e[e.PreAlloc=2]=`PreAlloc`,e[e.Immutable=8]=`Immutable`,e[e.Append=16]=`Append`,e[e.Sync=32]=`Sync`,e[e.NoAtime=64]=`NoAtime`,e[e.NoDump=128]=`NoDump`,e[e.RtInherit=256]=`RtInherit`,e[e.ProjInherit=512]=`ProjInherit`,e[e.NoSymlinks=1024]=`NoSymlinks`,e[e.ExtSize=2048]=`ExtSize`,e[e.ExtSzInherit=4096]=`ExtSzInherit`,e[e.NoDefrag=8192]=`NoDefrag`,e[e.FileStream=16384]=`FileStream`,e[e.Dax=32768]=`Dax`,e[e.CowExtSize=65536]=`CowExtSize`,e[e.HasAttr=2147483648]=`HasAttr`})(Al||={});var jl=(()=>{var e,t,n,r,i;let a=[Ht()],s,c=[],l,u=Gt(o),d,f=[],p=[],m,h=[],g=[],_,v=[],b=[],x,S=[],C=[],w,T=[],ee=[],E,te=[],ne=[];var D=class extends u{static{l=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;d=[(e=V).uint32.bind(e)],m=[(t=V).uint32.bind(t)],_=[(n=V).uint32.bind(n)],x=[(r=V).uint32.bind(r)],w=[(i=V).uint32.bind(i)],E=[V.char(8)],Ol(this,null,d,{kind:`accessor`,name:`xflags`,static:!1,private:!1,access:{has:e=>`xflags`in e,get:e=>e.xflags,set:(e,t)=>{e.xflags=t}},metadata:o},f,p),Ol(this,null,m,{kind:`accessor`,name:`extsize`,static:!1,private:!1,access:{has:e=>`extsize`in e,get:e=>e.extsize,set:(e,t)=>{e.extsize=t}},metadata:o},h,g),Ol(this,null,_,{kind:`accessor`,name:`nextents`,static:!1,private:!1,access:{has:e=>`nextents`in e,get:e=>e.nextents,set:(e,t)=>{e.nextents=t}},metadata:o},v,b),Ol(this,null,x,{kind:`accessor`,name:`projid`,static:!1,private:!1,access:{has:e=>`projid`in e,get:e=>e.projid,set:(e,t)=>{e.projid=t}},metadata:o},S,C),Ol(this,null,w,{kind:`accessor`,name:`cowextsize`,static:!1,private:!1,access:{has:e=>`cowextsize`in e,get:e=>e.cowextsize,set:(e,t)=>{e.cowextsize=t}},metadata:o},T,ee),Ol(this,null,E,{kind:`accessor`,name:`pad`,static:!1,private:!1,access:{has:e=>`pad`in e,get:e=>e.pad,set:(e,t)=>{e.pad=t}},metadata:o},te,ne),Ol(null,s={value:l},a,{kind:`class`,name:l.name,metadata:o},null,c),D=l=s.value,o&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`fsxattr`;#e=kl(this,f,void 0);get xflags(){return this.#e}set xflags(e){this.#e=e}#t=(kl(this,p),kl(this,h,void 0));get extsize(){return this.#t}set extsize(e){this.#t=e}#n=(kl(this,g),kl(this,v,void 0));get nextents(){return this.#n}set nextents(e){this.#n=e}#r=(kl(this,b),kl(this,S,void 0));get projid(){return this.#r}set projid(e){this.#r=e}#i=(kl(this,C),kl(this,T,void 0));get cowextsize(){return this.#i}set cowextsize(e){this.#i=e}#a=(kl(this,ee),kl(this,te,[]));get pad(){return this.#a}set pad(e){this.#a=e}constructor(e=y(new M(k.EINVAL,`fsxattr must be initialized with an inode`))){super(new ArrayBuffer(B(D))),kl(this,ne),this.extsize=e.size,this.nextents=1,this.projid=e.uid,this.cowextsize=e.size;for(let t of Object.keys(jn))e.flags&jn[t]&&t in Al&&(this.xflags|=Al[t])}static{kl(l,c)}};return D=l})(),Ml;(function(e){e[e.SecureRm=1]=`SecureRm`,e[e.Undelete=2]=`Undelete`,e[e.Compress=4]=`Compress`,e[e.Sync=8]=`Sync`,e[e.Immutable=16]=`Immutable`,e[e.Append=32]=`Append`,e[e.NoDump=64]=`NoDump`,e[e.NoAtime=128]=`NoAtime`,e[e.Dirty=256]=`Dirty`,e[e.CompressBlk=512]=`CompressBlk`,e[e.NoCompress=1024]=`NoCompress`,e[e.Encrypt=2048]=`Encrypt`,e[e.Btree=4096]=`Btree`,e[e.Index=4096]=`Index`,e[e.IMagic=8192]=`IMagic`,e[e.JournalData=16384]=`JournalData`,e[e.NoTail=32768]=`NoTail`,e[e.DirSync=65536]=`DirSync`,e[e.TopDir=131072]=`TopDir`,e[e.HugeFile=262144]=`HugeFile`,e[e.Extent=524288]=`Extent`,e[e.Verity=1048576]=`Verity`,e[e.EaInode=2097152]=`EaInode`,e[e.EofBlocks=4194304]=`EofBlocks`,e[e.NoCow=8388608]=`NoCow`,e[e.Dax=33554432]=`Dax`,e[e.InlineData=268435456]=`InlineData`,e[e.ProjInherit=536870912]=`ProjInherit`,e[e.CaseFold=1073741824]=`CaseFold`,e[e.Reserved=2147483648]=`Reserved`})(Ml||={});var Nl;(function(e){e[e.GetFlags=2148034049]=`GetFlags`,e[e.SetFlags=1074292226]=`SetFlags`,e[e.GetVersion=2148038145]=`GetVersion`,e[e.SetVersion=1074296322]=`SetVersion`,e[e.Fiemap=3223348747]=`Fiemap`,e[e.GetXattr=2149341215]=`GetXattr`,e[e.SetXattr=1075599392]=`SetXattr`,e[e.GetLabel=2164298801]=`GetLabel`,e[e.SetLabel=1090556978]=`SetLabel`,e[e.GetUUID=2148603136]=`GetUUID`,e[e.GetSysfsPath=2155943169]=`GetSysfsPath`})(Nl||={});var Pl;(function(e){e[e.GetFlags=2147771905]=`GetFlags`,e[e.SetFlags=1074030082]=`SetFlags`,e[e.GetVersion=2147776001]=`GetVersion`,e[e.SetVersion=1074034178]=`SetVersion`})(Pl||={});async function Fl(e,t,...n){e=H(e);let{fs:r,path:i}=X(e,this);try{let e=new K(await r.stat(i));switch(t){case Nl.GetFlags:case Pl.GetFlags:return e.flags;case Nl.SetFlags:case Pl.SetFlags:e.flags=n[0],await r.touch(i,e);return;case Nl.GetVersion:case Pl.GetVersion:return e.version;case Nl.SetVersion:case Pl.SetVersion:e.version=n[0],await r.touch(i,e);return;case Nl.Fiemap:break;case Nl.GetXattr:return new jl(e);case Nl.SetXattr:break;case Nl.GetLabel:return r.label;case Nl.SetLabel:r.label=n[0];return;case Nl.GetUUID:return r.uuid;case Nl.GetSysfsPath:return`/sys/fs/${r.name}/${r.uuid}`}}catch(t){throw j(Object.assign(t,{syscall:`ioctl`,path:e}))}throw N(`ENOTSUP`,`ioctl`,e)}function Il(e,t,...n){e=H(e);let{fs:r,path:i}=X(e,this);try{let e=new K(r.statSync(i));switch(t){case Nl.GetFlags:case Pl.GetFlags:return e.flags;case Nl.SetFlags:case Pl.SetFlags:e.flags=n[0],r.touchSync(i,e);return;case Nl.GetVersion:case Pl.GetVersion:return e.version;case Nl.SetVersion:case Pl.SetVersion:e.version=n[0],r.touchSync(i,e);return;case Nl.Fiemap:break;case Nl.GetXattr:return new jl(e);case Nl.SetXattr:break;case Nl.GetLabel:return r.label;case Nl.SetLabel:r.label=n[0];return;case Nl.GetUUID:return r.uuid;case Nl.GetSysfsPath:return`/sys/fs/${r.name}/${r.uuid}`}}catch(t){throw j(Object.assign(t,{syscall:`ioctl`,path:e}))}throw N(`ENOTSUP`,`ioctl`,e)}var Ll={name:`@zenfs/core`,version:`2.6.2`,description:`A filesystem, anywhere`,funding:{type:`individual`,url:`https://github.com/sponsors/james-pre`},main:`dist/index.js`,types:`dist/index.d.ts`,keywords:[`filesystem`,`node`,`storage`],bin:{"make-index":`scripts/make-index.js`,"zenfs-test":`scripts/test.js`,zci:`scripts/ci-cli.js`},files:[`dist`,`tests`,`types`,`license.md`,`eslint.shared.js`],type:`module`,homepage:`https://zenfs.dev/core`,author:`James Prevett <jp@jamespre.dev> (https://jamespre.dev)`,contributors:[`John Vilk <jvilk@cs.umass.edu>`],license:`LGPL-3.0-or-later`,repository:{type:`git`,url:`git+https://github.com/zen-fs/core.git`},bugs:{url:`https://github.com/zen-fs/core/issues`},engines:{node:`>= 18`},exports:{".":`./dist/index.js`,"./*":`./dist/*`,"./emulation/*":`./dist/node/*`,"./promises":`./dist/node/promises.js`,"./readline":`./dist/node/readline.js`,"./constants":`./dist/constants.js`,"./path":`./dist/path.js`,"./eslint":`./eslint.shared.js`,"./tests/*":`./tests/*`,"./types/*":`./types/*`},publishConfig:{access:`public`,provenance:!0},scripts:{format:`prettier --write .`,"format:check":`prettier --check .`,"spdx:check":`npx lice -a src tests/*.ts tests/**/*.test.ts`,"spdx:fix":`npx lice -aw src tests/*.ts tests/**/*.test.ts`,lint:`eslint src tests`,test:`npx --silent zenfs-test --clean; npx --silent zenfs-test -abcp; tests/fetch/run.sh; npx --silent zenfs-test --report`,build:`tsc -p tsconfig.json`,"build:docs":`typedoc`,dev:`tsc -p tsconfig.json --watch`,prepublishOnly:`npm run build`},dependencies:{"@types/node":`^25.2.0`,buffer:`^6.0.3`,eventemitter3:`^5.0.1`,kerium:`^1.4.2`,memium:`^0.4.0`,"readable-stream":`^4.5.2`,utilium:`^3.0.0`},devDependencies:{"@eslint/js":`^10.0.1`,"@octokit/action":`^8.0.4`,c8:`^11.0.0`,eslint:`^10.1.0`,globals:`^17.3.0`,prettier:`^3.2.5`,tsx:`^4.19.1`,typedoc:`^0.28.18`,typescript:`^6.0.0`,"typescript-eslint":`^8.58.0`},allowScripts:{esbuild:!0}},Rl=t({BigIntStatsFs:()=>Tn,Dir:()=>li,Dirent:()=>si,IOC:()=>Nl,IOC32:()=>Pl,ReadStream:()=>eo,Stats:()=>xn,StatsFs:()=>wn,WriteStream:()=>to,_version:()=>zl,access:()=>Gc,accessSync:()=>Ki,appendFile:()=>xc,appendFileSync:()=>Si,chmod:()=>Bc,chmodSync:()=>Vi,chown:()=>Rc,chownSync:()=>zi,chroot:()=>Jr,close:()=>Cc,closeSync:()=>wi,constants:()=>Be,copyFile:()=>el,copyFileSync:()=>Xi,cp:()=>il,cpSync:()=>ea,createReadStream:()=>Xc,createWriteStream:()=>Zc,exists:()=>pc,existsSync:()=>pi,fchmod:()=>Ac,fchmodSync:()=>ji,fchown:()=>kc,fchownSync:()=>Ai,fdatasync:()=>Ec,fdatasyncSync:()=>Di,fstat:()=>Sc,fstatSync:()=>Ci,fsync:()=>Tc,fsyncSync:()=>Ei,ftruncate:()=>wc,ftruncateSync:()=>Ti,futimes:()=>jc,futimesSync:()=>Mi,glob:()=>sl,globSync:()=>na,ioctl:()=>Fl,ioctlSync:()=>Il,lchmod:()=>Vc,lchmodSync:()=>Hi,lchown:()=>zc,lchownSync:()=>Bi,link:()=>Fc,linkSync:()=>Ii,lopenSync:()=>yi,lstat:()=>hc,lstatSync:()=>hi,lutimes:()=>Uc,lutimesSync:()=>Wi,mkdir:()=>Nc,mkdirSync:()=>Pi,mkdtemp:()=>$c,mkdtempDisposableSync:()=>Yi,mkdtempSync:()=>Ji,mount:()=>Gr,open:()=>vc,openAsBlob:()=>ol,openSync:()=>vi,opendir:()=>rl,opendirSync:()=>$i,promises:()=>no,read:()=>Oc,readFile:()=>yc,readFileSync:()=>bi,readSync:()=>ki,readdir:()=>Pc,readdirSync:()=>Fi,readlink:()=>Lc,readlinkSync:()=>Ri,readv:()=>tl,readvSync:()=>Zi,realpath:()=>Wc,realpathSync:()=>Gi,rename:()=>fc,renameSync:()=>fi,rm:()=>Qc,rmSync:()=>qi,rmdir:()=>Mc,rmdirSync:()=>Ni,stat:()=>mc,statSync:()=>mi,statfs:()=>al,statfsSync:()=>ta,symlink:()=>Ic,symlinkSync:()=>Li,truncate:()=>gc,truncateSync:()=>gi,umount:()=>Kr,unlink:()=>_c,unlinkSync:()=>_i,unwatchFile:()=>Jc,utimes:()=>Hc,utimesSync:()=>Ui,watch:()=>Yc,watchFile:()=>qc,write:()=>Dc,writeFile:()=>bc,writeFileSync:()=>xi,writeSync:()=>Oi,writev:()=>nl,writevSync:()=>Qi,xattr:()=>ll}),zl=Ll.version,Bl=t({DirType:()=>dr,Dirent:()=>mr,Handle:()=>Mr,IOC:()=>Nl,IOC32:()=>Pl,chroot:()=>Jr,deleteFD:()=>Fr,dtToIf:()=>pr,fromFD:()=>Pr,ifToDt:()=>fr,ioctl:()=>Fl,ioctlSync:()=>Il,link:()=>ya,mkdir:()=>ga,mount:()=>Gr,open:()=>ma,readdir:()=>_a,readlink:()=>ha,rename:()=>va,resolve:()=>pa,stat:()=>ba,sync:()=>Xr,toFD:()=>Nr,umount:()=>Kr,xattr:()=>ll}),Vl=t({Async:()=>Us,AsyncMapTransaction:()=>Qn,AsyncTransaction:()=>Kn,Attributes:()=>kn,BigIntStatsFs:()=>Tn,CopyOnWrite:()=>cs,CopyOnWriteFS:()=>ss,DeviceFS:()=>tr,Dir:()=>li,Dirent:()=>si,ErrnoError:()=>Br,Fetch:()=>vs,FetchFS:()=>_s,FileSystem:()=>Un,IOC:()=>Nl,IOC32:()=>Pl,InMemory:()=>er,InMemoryStore:()=>$n,Index:()=>Vn,IndexFS:()=>hs,Inode:()=>K,InodeFlags:()=>jn,Journal:()=>os,MetadataBlock:()=>rc,MutexLock:()=>Cl,Mutexed:()=>Tl,Passthrough:()=>Ss,PassthroughFS:()=>xs,Port:()=>qs,PortFS:()=>Ws,RPC:()=>Cs,ReadStream:()=>eo,Readonly:()=>El,SingleBuffer:()=>uc,SingleBufferStore:()=>lc,Stats:()=>xn,StatsFs:()=>wn,StoreFS:()=>Xn,SuperBlock:()=>oc,Sync:()=>Dl,SyncMapTransaction:()=>Zn,SyncTransaction:()=>Gn,Transaction:()=>Wn,WrappedTransaction:()=>qn,WriteStream:()=>to,_MutexedFS:()=>wl,_asyncFSKeys:()=>Hs,_chown:()=>Bn,_fnOpt:()=>ke,_inode_fields:()=>An,_inode_version:()=>5,_tempDirName:()=>an,_version:()=>zl,access:()=>Gc,accessSync:()=>Ki,addDevice:()=>Zo,appendFile:()=>xc,appendFileSync:()=>Si,attachFS:()=>Gs,bindContext:()=>xl,boundContexts:()=>bl,checkOptions:()=>je,chmod:()=>Bc,chmodSync:()=>Vi,chown:()=>Rc,chownSync:()=>zi,chroot:()=>Jr,close:()=>Cc,closeSync:()=>wi,configure:()=>$o,configureFileSystem:()=>Ho,configureSingle:()=>qo,configureSingleSync:()=>Jo,configureSync:()=>es,constants:()=>Be,contextOf:()=>Le,copyFile:()=>el,copyFileSync:()=>Xi,cp:()=>il,cpSync:()=>ea,createChildContext:()=>ze,createCredentials:()=>Ne,createReadStream:()=>Xc,createWriteStream:()=>Zc,credentialsAllowRoot:()=>Pe,decodeDirListing:()=>Yt,default:()=>Hl,defaultContext:()=>Ie,detachFS:()=>Ks,devices:()=>cr,encodeDirListing:()=>Xt,exists:()=>pc,existsSync:()=>pi,fchmod:()=>Ac,fchmodSync:()=>ji,fchown:()=>kc,fchownSync:()=>Ai,fdatasync:()=>Ec,fdatasyncSync:()=>Di,fs:()=>Rl,fstat:()=>Sc,fstatSync:()=>Ci,fsync:()=>Tc,fsyncSync:()=>Ei,ftruncate:()=>wc,ftruncateSync:()=>Ti,fullDevice:()=>ar,futimes:()=>jc,futimesSync:()=>Mi,glob:()=>sl,globSync:()=>na,globToRegex:()=>nn,hasAccess:()=>J,ioctl:()=>Fl,ioctlSync:()=>Il,isBackend:()=>Oe,isBackendConfig:()=>Me,isBlockDevice:()=>Ln,isCharacterDevice:()=>Rn,isDirectory:()=>q,isFIFO:()=>zn,isFile:()=>Pn,isSocket:()=>In,isSymbolicLink:()=>Fn,lchmod:()=>Vc,lchmodSync:()=>Hi,lchown:()=>zc,lchownSync:()=>Bi,link:()=>Fc,linkSync:()=>Ii,log:()=>re,lopenSync:()=>yi,lstat:()=>hc,lstatSync:()=>hi,lutimes:()=>Uc,lutimesSync:()=>Wi,mkdir:()=>Nc,mkdirSync:()=>Pi,mkdtemp:()=>$c,mkdtempDisposableSync:()=>Yi,mkdtempSync:()=>Ji,mount:()=>Gr,mounts:()=>Wr,normalizeMode:()=>Zt,normalizeOptions:()=>tn,normalizePath:()=>H,normalizeTime:()=>en,nullDevice:()=>rr,open:()=>vc,openAsBlob:()=>ol,openSync:()=>vi,opendir:()=>rl,opendirSync:()=>$i,promises:()=>no,randomDevice:()=>or,read:()=>Oc,readFile:()=>yc,readFileSync:()=>bi,readSync:()=>ki,readdir:()=>Pc,readdirSync:()=>Fi,readlink:()=>Lc,readlinkSync:()=>Ri,readv:()=>tl,readvSync:()=>Zi,realpath:()=>Wc,realpathSync:()=>Gi,rename:()=>fc,renameSync:()=>fi,resolveMountConfig:()=>Go,resolveMountConfigSync:()=>Ko,resolveRemoteMount:()=>Js,rm:()=>Qc,rmSync:()=>qi,rmdir:()=>Mc,rmdirSync:()=>Ni,rootIno:()=>0,stat:()=>mc,statSync:()=>mi,statfs:()=>al,statfsSync:()=>ta,symlink:()=>Ic,symlinkSync:()=>Li,sync:()=>ts,truncate:()=>gc,truncateSync:()=>gi,umount:()=>Kr,unlink:()=>_c,unlinkSync:()=>_i,unwatchFile:()=>Jc,userModifiableFlags:()=>Nn,userVisibleFlags:()=>Mn,utimes:()=>Hc,utimesSync:()=>Ui,validateFD:()=>$t,version:()=>1,vfs:()=>Bl,waitOnline:()=>rn,watch:()=>Yc,watchFile:()=>qc,withExceptionContext:()=>Ur,withPath:()=>Vr,wrap:()=>Hr,write:()=>Dc,writeFile:()=>bc,writeFileSync:()=>xi,writeSync:()=>Oi,writev:()=>nl,writevSync:()=>Qi,xattr:()=>ll,zeroDevice:()=>ir}),Hl=Rl;globalThis.__zenfs__=Object.assign(Object.create(null),Rl);export{R as C,ne as D,P as E,te as O,fe as S,M as T,$e as _,er as a,ue as b,Wn as c,An as d,mn as f,Xe as g,tt as h,hs as i,y as k,Un as l,U as m,Dl as n,Zn as o,W as p,Us as r,Xn as s,Vl as t,K as u,at as v,k as w,de as x,it as y};
|
|
12
|
+
`);for(let e of this.items)e.offset&&(t+=`\n\t${Qs(e.id)}: ${$s(e.size).padStart(5)} at ${Qs(e.offset)}`);return t}#i=(Z(this,b),Z(this,S,void 0));get locked(){return this.#i}set locked(e){this.#i=e}waitUnlocked(e=0){if(e>nc)throw de(P(`EBUSY`,`sbfs: exceeded max attempts waiting for metadata block at ${Qs(this.byteOffset)} to be unlocked`));if(Atomics.load(this,w.lockIndex))switch(Atomics.wait(this,w.lockIndex,1)){case`ok`:break;case`not-equal`:return e++,L(`sbfs: waiting for metadata block at ${Qs(this.byteOffset)} to be unlocked (${e}/${nc})`),this.waitUnlocked(e);case`timed-out`:throw de(P(`EBUSY`,`sbfs: timed out waiting for metadata block at ${Qs(this.byteOffset)} to be unlocked`))}}lock(){this.waitUnlocked(),Atomics.store(this,w.lockIndex,1);let e=()=>{Atomics.store(this,w.lockIndex,0),Atomics.notify(this,w.lockIndex,1)};return e[Symbol.dispose]=e,e}constructor(){super(...arguments),Z(this,C)}static{Z(s,o)}};return w=s})();Object.assign(rc,{lockIndex:Lt(rc,`locked`)/Int32Array.BYTES_PER_ELEMENT});var ic=1651715706,ac=2,oc=(()=>{var e,t,n,r,i,a,o,s,c,l;let u=[Ht.packed()],d,f=[],p,m=Gt.typed(BigUint64Array),h,g=[],_=[],v,y=[],b=[],x,S=[],C=[],w,T=[],ee=[],E,te=[],ne=[],D,k=[],A=[],j,M=[],N=[],F,re=[],I=[],ie,ae=[],oe=[],se,ce=[],le=[],ue,L=[],fe=[],pe,he=[],ge=[],_e,ve=[],ye=[];var be=class extends m{static{p=this}static{let O=typeof Symbol==`function`&&Symbol.metadata?Object.create(m[Symbol.metadata]??null):void 0;h=[(e=V).uint32.bind(e)],v=[(t=V).uint32.bind(t)],x=[(n=V).uint16.bind(n)],w=[(r=V).uint16.bind(r)],E=[(i=V).uint32.bind(i)],D=[(a=V).uint64.bind(a)],j=[(o=V).uint64.bind(o)],F=[V.uint8(16)],ie=[(s=V).uint32.bind(s)],se=[(c=V).uint32.bind(c)],ue=[(l=V).uint32.bind(l)],pe=[V.char(64)],_e=[V.char(132)],Ys(this,null,h,{kind:`accessor`,name:`checksum`,static:!1,private:!1,access:{has:e=>`checksum`in e,get:e=>e.checksum,set:(e,t)=>{e.checksum=t}},metadata:O},g,_),Ys(this,null,v,{kind:`accessor`,name:`magic`,static:!1,private:!1,access:{has:e=>`magic`in e,get:e=>e.magic,set:(e,t)=>{e.magic=t}},metadata:O},y,b),Ys(this,null,x,{kind:`accessor`,name:`version`,static:!1,private:!1,access:{has:e=>`version`in e,get:e=>e.version,set:(e,t)=>{e.version=t}},metadata:O},S,C),Ys(this,null,w,{kind:`accessor`,name:`inode_format`,static:!1,private:!1,access:{has:e=>`inode_format`in e,get:e=>e.inode_format,set:(e,t)=>{e.inode_format=t}},metadata:O},T,ee),Ys(this,null,E,{kind:`accessor`,name:`flags`,static:!1,private:!1,access:{has:e=>`flags`in e,get:e=>e.flags,set:(e,t)=>{e.flags=t}},metadata:O},te,ne),Ys(this,null,D,{kind:`accessor`,name:`used_bytes`,static:!1,private:!1,access:{has:e=>`used_bytes`in e,get:e=>e.used_bytes,set:(e,t)=>{e.used_bytes=t}},metadata:O},k,A),Ys(this,null,j,{kind:`accessor`,name:`total_bytes`,static:!1,private:!1,access:{has:e=>`total_bytes`in e,get:e=>e.total_bytes,set:(e,t)=>{e.total_bytes=t}},metadata:O},M,N),Ys(this,null,F,{kind:`accessor`,name:`uuid`,static:!1,private:!1,access:{has:e=>`uuid`in e,get:e=>e.uuid,set:(e,t)=>{e.uuid=t}},metadata:O},re,I),Ys(this,null,ie,{kind:`accessor`,name:`metadata_block_size`,static:!1,private:!1,access:{has:e=>`metadata_block_size`in e,get:e=>e.metadata_block_size,set:(e,t)=>{e.metadata_block_size=t}},metadata:O},ae,oe),Ys(this,null,se,{kind:`accessor`,name:`metadata_offset_`,static:!1,private:!1,access:{has:e=>`metadata_offset_`in e,get:e=>e.metadata_offset_,set:(e,t)=>{e.metadata_offset_=t}},metadata:O},ce,le),Ys(this,null,ue,{kind:`accessor`,name:`metadata_offset`,static:!1,private:!1,access:{has:e=>`metadata_offset`in e,get:e=>e.metadata_offset,set:(e,t)=>{e.metadata_offset=t}},metadata:O},L,fe),Ys(this,null,pe,{kind:`accessor`,name:`label`,static:!1,private:!1,access:{has:e=>`label`in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:O},he,ge),Ys(this,null,_e,{kind:`accessor`,name:`_padding`,static:!1,private:!1,access:{has:e=>`_padding`in e,get:e=>e._padding,set:(e,t)=>{e._padding=t}},metadata:O},ve,ye),Ys(null,d={value:p},u,{kind:`class`,name:p.name,metadata:O},null,f),be=p=d.value,O&&Object.defineProperty(p,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:O})}static name=`SuperBlock`;constructor(...e){if(super(...e),Z(this,ye),this.magic!=ic){R(`sbfs: Invalid magic value, assuming this is a fresh super block`);let e=new rc(this.buffer,B(be));Object.assign(this,{metadata:e,metadata_offset:e.byteOffset,used_bytes:BigInt(B(be)+B(rc)),total_bytes:BigInt(this.buffer.byteLength),magic:ic,version:1,inode_format:5,metadata_block_size:B(rc),uuid:O(crypto.randomUUID())}),cc(this),cc(e);return}if(this.checksum!==sc(this))throw de(P(`EIO`,`sbfs: checksum mismatch for super block`));if(this.metadata=new rc(this.buffer,this.metadata_offset),this.metadata.checksum!==sc(this.metadata))throw de(P(`EIO`,`sbfs: checksum mismatch for metadata block (saved ${Qs(this.metadata.checksum)}, computed ${Qs(sc(this.metadata))})`));if(this.inode_format!=5)throw de(P(`EIO`,`sbfs: inode format mismatch`));if(this.metadata_block_size!=B(rc))throw de(P(`EIO`,`sbfs: metadata block size mismatch`))}#e=Z(this,g,void 0);get checksum(){return this.#e}set checksum(e){this.#e=e}#t=(Z(this,_),Z(this,y,void 0));get magic(){return this.#t}set magic(e){this.#t=e}#n=(Z(this,b),Z(this,S,void 0));get version(){return this.#n}set version(e){this.#n=e}#r=(Z(this,C),Z(this,T,void 0));get inode_format(){return this.#r}set inode_format(e){this.#r=e}#i=(Z(this,ee),Z(this,te,void 0));get flags(){return this.#i}set flags(e){this.#i=e}#a=(Z(this,ne),Z(this,k,void 0));get used_bytes(){return this.#a}set used_bytes(e){this.#a=e}#o=(Z(this,A),Z(this,M,void 0));get total_bytes(){return this.#o}set total_bytes(e){this.#o=e}#s=(Z(this,N),Z(this,re,void 0));get uuid(){return this.#s}set uuid(e){this.#s=e}#c=(Z(this,I),Z(this,ae,void 0));get metadata_block_size(){return this.#c}set metadata_block_size(e){this.#c=e}#l=(Z(this,oe),Z(this,ce,void 0));get metadata_offset_(){return this.#l}set metadata_offset_(e){this.#l=e}#u=(Z(this,le),Z(this,L,void 0));get metadata_offset(){return this.#u}set metadata_offset(e){this.#u=e}metadata=Z(this,fe);#d=Z(this,he,void 0);get label(){return this.#d}set label(e){this.#d=e}#f=(Z(this,ge),Z(this,ve,void 0));get _padding(){return this.#f}set _padding(e){this.#f=e}rotateMetadata(){let e=this.used_bytes%BigInt(4);Atomics.add(this,ac,e);let t=Number(Atomics.add(this,ac,BigInt(B(rc)))),n=new rc(this.buffer,t);return n.previous_offset=this.metadata_offset,this.metadata=n,this.metadata_offset=n.byteOffset,cc(n),cc(this),me(`sbfs: rotated metadata block at ${Qs(n.previous_offset)} with new block at ${Qs(t)}`),n}isUnused(e,t){if(!t)return!0;if(e+t>this.total_bytes||e<B(be))return!1;for(let n=this.metadata;n;n=n.previous){if(e<n.byteOffset+B(rc)&&e+t>n.byteOffset)return!1;for(let r of n.items)if(r.offset&&(e>=r.offset&&e<r.offset+r.size||e+t>r.offset&&e+t<=r.offset+r.size||e<=r.offset&&e+t>=r.offset+r.size))return!1}return!0}static{Z(p,f)}};return be=p})();function sc(e){let t=B(e)-4;return e instanceof rc&&(t-=Int32Array.BYTES_PER_ELEMENT),l(new Uint8Array(e.buffer,e.byteOffset+4,t))}function cc(e){e instanceof rc&&(e.timestamp=BigInt(Date.now())),e.checksum=sc(e)}var lc=class extends o{flags=[];name=`sbfs`;type=1935828595;get uuid(){return D(this.superblock.uuid)}superblock;_view;_u8;constructor(...e){if(super(...e),this.byteLength<B(oc)+B(rc))throw de(P(`EINVAL`,`sbfs: Buffer is too small for a file system`));this._view=new DataView(this.buffer,this.byteOffset,this.byteLength),this._u8=new Uint8Array(this.buffer,this.byteOffset,this.byteLength),this.superblock=new oc(this.buffer,this.byteOffset)}*keys(){let e=new Set;for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items)!n.offset||e.has(n.id)||(e.add(n.id),yield n.id)}}get(e){for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items){if(!n.offset||n.id!=e)continue;let t=this.byteOffset+n.offset;return new Uint8Array(this.buffer.slice(t,t+n.size))}}}set(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(e===0&&t.length<B(K))throw ue(P(`EIO`,`sbfs: tried to set ${t.length} bytes for id 0!`));for(let n=this.superblock.metadata;n;n=n.previous){n.waitUnlocked();for(let r of n.items){let i={stack:[],error:void 0,hasError:!1};try{if(!r.offset||r.id!=e)continue;if(Xs(i,n.lock(),!1),t.length==r.size){this._u8.set(t,r.offset);return}if(t.length<r.size||this.superblock.isUnused(r.offset,t.length)){this._u8.set(t,r.offset),r.size=t.length,cc(n);return}r.offset=Number(Atomics.add(this.superblock,ac,BigInt(t.length))),r.size=t.length,this._u8.set(t,r.offset),cc(n),cc(this.superblock);return}catch(e){i.error=e,i.hasError=!0}finally{Zs(i)}}}let r=Array.from(this.superblock.metadata.items).find(e=>!e.offset);r||=(this.superblock.rotateMetadata(),this.superblock.metadata.items[0]),Xs(n,this.superblock.metadata.lock(),!1);let i=Number(Atomics.add(this.superblock,ac,BigInt(t.length)));r.id=e,r.offset=i,r.size=t.length,this._u8.set(t,i),cc(this.superblock.metadata),cc(this.superblock)}catch(e){n.error=e,n.hasError=!0}finally{Zs(n)}}delete(e){for(let t=this.superblock.metadata;t;t=t.previous){t.waitUnlocked();for(let n of t.items)if(n.id==e){n.offset=0,n.size=0,n.id=0,cc(t);return}}}_fs;get fs(){return this._fs}set fs(e){this.buffer.constructor.name===`SharedArrayBuffer`&&e?.attributes.set(`no_id_tables`,!0),this._fs=e}sync(){return Promise.resolve()}usage(){return{totalSpace:Number(this.superblock.total_bytes),freeSpace:Number(this.superblock.total_bytes-this.superblock.used_bytes)}}transaction(){return new Zn(this)}},uc={name:`SingleBuffer`,options:{buffer:{type:`object`,required:!0}},create(e){let t=new Xn(ArrayBuffer.isView(e.buffer)?new lc(e.buffer.buffer,e.buffer.byteOffset,e.buffer.byteLength):new lc(e.buffer));return t.checkRootSync(),t}},Q=()=>{};async function dc(e){let t=[];for await(let n of e)t.push(n);return t}function fc(e,t,n=Q){co.call(this,e,t).then(()=>n(null)).catch(n)}function pc(e,t=Q){lo.call(this,e).then(t).catch(()=>t(!1))}function mc(e,t,n=Q){n=typeof t==`function`?t:n,uo.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function hc(e,t,n=Q){n=typeof t==`function`?t:n,fo.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function gc(e,t=0,n=Q){n=typeof t==`function`?t:n;let r=typeof t==`number`?t:0;po.call(this,e,r).then(()=>n(null)).catch(n)}function _c(e,t=Q){mo.call(this,e).then(()=>t(null)).catch(t)}function vc(e,t,n,r=Q){let i=Zt(n,420);r=typeof n==`function`?n:r,ho.call(this,e,t,i).then(e=>r(null,e.fd)).catch(r)}function yc(e,t,n=Q){n=typeof t==`function`?t:n,go.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function bc(e,t,n,r=Q){r=typeof n==`function`?n:r,_o.call(this,e,t,typeof n==`function`?null:n).then(()=>r(null)).catch(r)}function xc(e,t,n,r=Q){let i=typeof n==`function`?void 0:n;r=typeof n==`function`?n:r,vo.call(this,e,t,i).then(()=>r(null)).catch(r)}function Sc(e,t,n=Q){n=typeof t==`function`?t:n,new so(this,e).stat().then(e=>n(null,typeof t==`object`&&t?.bigint?new Sn(e):e)).catch(n)}function Cc(e,t=Q){new so(this,e).close().then(()=>t(null)).catch(t)}function wc(e,t,n=Q){let r=typeof t==`number`?t:0;n=typeof t==`function`?t:n;let i=new so(this,e);if(r<0)throw P(`EINVAL`);i.truncate(r).then(()=>n(null)).catch(n)}function Tc(e,t=Q){new so(this,e).sync().then(()=>t(null)).catch(t)}function Ec(e,t=Q){new so(this,e).datasync().then(()=>t(null)).catch(t)}function Dc(e,t,n,r,i,a=Q){let o,s,c,l,u,d=new so(this,e);if(typeof t==`string`){switch(u=`utf8`,typeof n){case`function`:a=n;break;case`number`:l=n,u=typeof r==`string`?r:`utf8`,a=typeof i==`function`?i:a;break;default:a=typeof r==`function`?r:typeof i==`function`?i:a,a(P(`EINVAL`));return}o=lr.Buffer.from(t),s=0,c=o.length;let e=a;d.write(o,s,c,l).then(({bytesWritten:t})=>e(null,t,o.toString(u))).catch(e)}else{o=lr.Buffer.from(t.buffer),s=n,c=r,l=typeof i==`number`?i:null;let e=typeof i==`function`?i:a;d.write(o,s,c,l).then(({bytesWritten:t})=>e(null,t,o)).catch(e)}}function Oc(e,t,n,r,i,a=Q){new so(this,e).read(t,n,r,i).then(({bytesRead:e,buffer:t})=>a(null,e,t)).catch(a)}function kc(e,t,n,r=Q){new so(this,e).chown(t,n).then(()=>r(null)).catch(r)}function Ac(e,t,n){new so(this,e).chmod(t).then(()=>n(null)).catch(n)}function jc(e,t,n,r=Q){new so(this,e).utimes(t,n).then(()=>r(null)).catch(r)}function Mc(e,t=Q){yo.call(this,e).then(()=>t(null)).catch(t)}function Nc(e,t,n=Q){bo.call(this,e,t).then(()=>n(null)).catch(n)}function Pc(e,t,n=Q){n=typeof t==`function`?t:n;let r=typeof t==`function`?{}:t;xo.call(this,e,r).then(e=>n(null,e)).catch(n)}function Fc(e,t,n=Q){So.call(this,e,t).then(()=>n(null)).catch(n)}function Ic(e,t,n,r=Q){let i=typeof n==`string`?n:`file`;r=typeof n==`function`?n:r,Co.call(this,e,t,i).then(()=>r(null)).catch(r)}function Lc(e,t,n=Q){n=typeof t==`function`?t:n,wo.call(this,e).then(e=>n(null,e)).catch(n)}function Rc(e,t,n,r=Q){To.call(this,e,t,n).then(()=>r(null)).catch(r)}function zc(e,t,n,r=Q){Eo.call(this,e,t,n).then(()=>r(null)).catch(r)}function Bc(e,t,n=Q){Do.call(this,e,t).then(()=>n(null)).catch(n)}function Vc(e,t,n=Q){Oo.call(this,e,t).then(()=>n(null)).catch(n)}function Hc(e,t,n,r=Q){ko.call(this,e,t,n).then(()=>r(null)).catch(r)}function Uc(e,t,n,r=Q){Ao.call(this,e,t,n).then(()=>r(null)).catch(r)}function Wc(e,t,n=Q){n=typeof t==`function`?t:n,jo.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function Gc(e,t,n=Q){let r=typeof t==`number`?t:4;n=typeof t==`function`?t:n,No.call(this,e,r).then(()=>n(null)).catch(n)}var Kc=new Map;function qc(e,t,n){let r=H(e),i=typeof t==`function`?{}:t;if(typeof t==`function`&&(n=t),!n)throw N(`EINVAL`,`watch`,e.toString());if(Kc.has(r)){let e=Kc.get(r);e&&e.listeners.add(n);return}let a=new oa(this,r,i);a.on(`change`,(e,t)=>{let n=Kc.get(r);if(n)for(let r of n.listeners)r(e,t)}),Kc.set(r,{watcher:a,listeners:new Set([n])})}function Jc(e,t=Q){let n=H(e),r=Kc.get(n);r&&(t&&t!==Q?r.listeners.delete(t):r.listeners.clear(),r.listeners.size===0&&(r.watcher.stop(),Kc.delete(n)))}function Yc(e,t,n){let r=new aa(this,H(e),typeof t==`object`?t:{});return n=typeof t==`function`?t:n,r.on(`change`,n||Q),r}function Xc(e,t){t=typeof t==`object`?t:{encoding:t};let n=ho.call(this,e,`r`,t?.mode);return new eo({...t,autoClose:!0},n)}function Zc(e,t){t=typeof t==`object`?t:{encoding:t};let n=ho.call(this,e,`w`,t?.mode);return new to(t,n)}function Qc(e,t,n=Q){n=typeof t==`function`?t:n,Po.call(this,e,typeof t==`function`?void 0:t).then(()=>n(null)).catch(n)}function $c(e,t,n=Q){n=typeof t==`function`?t:n,Fo.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function el(e,t,n,r=Q){r=typeof n==`function`?n:r,Lo.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function tl(e,t,n,r=Q){r=typeof n==`function`?n:r,new so(this,e).readv(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesRead:t})=>r(null,t,e)).catch(r)}function nl(e,t,n,r=Q){r=typeof n==`function`?n:r,new so(this,e).writev(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesWritten:t})=>r(null,t,e)).catch(r)}function rl(e,t,n=Q){n=typeof t==`function`?t:n,Ro.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}function il(e,t,n,r=Q){r=typeof n==`function`?n:r,zo.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function al(e,t,n=Q){n=typeof t==`function`?t:n,Bo.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}async function ol(e,t){let n=await ho.call(this,e.toString(),`r`),r=await n.readFile();return await n.close(),new Blob([r],t)}function sl(e,t,n=Q){n=typeof t==`function`?t:n,dc(Vo.call(this,e,typeof t==`function`?void 0:t)).then(e=>n(null,e??[])).catch(e=>n(e))}var cl=t({BigIntStatsFs:()=>Tn,Dir:()=>li,Dirent:()=>si,ReadStream:()=>eo,Stats:()=>xn,StatsFs:()=>wn,WriteStream:()=>to,access:()=>Gc,accessSync:()=>Ki,appendFile:()=>xc,appendFileSync:()=>Si,chmod:()=>Bc,chmodSync:()=>Vi,chown:()=>Rc,chownSync:()=>zi,close:()=>Cc,closeSync:()=>wi,constants:()=>Be,copyFile:()=>el,copyFileSync:()=>Xi,cp:()=>il,cpSync:()=>ea,createReadStream:()=>Xc,createWriteStream:()=>Zc,exists:()=>pc,existsSync:()=>pi,fchmod:()=>Ac,fchmodSync:()=>ji,fchown:()=>kc,fchownSync:()=>Ai,fdatasync:()=>Ec,fdatasyncSync:()=>Di,fstat:()=>Sc,fstatSync:()=>Ci,fsync:()=>Tc,fsyncSync:()=>Ei,ftruncate:()=>wc,ftruncateSync:()=>Ti,futimes:()=>jc,futimesSync:()=>Mi,glob:()=>sl,globSync:()=>na,lchmod:()=>Vc,lchmodSync:()=>Hi,lchown:()=>zc,lchownSync:()=>Bi,link:()=>Fc,linkSync:()=>Ii,lopenSync:()=>yi,lstat:()=>hc,lstatSync:()=>hi,lutimes:()=>Uc,lutimesSync:()=>Wi,mkdir:()=>Nc,mkdirSync:()=>Pi,mkdtemp:()=>$c,mkdtempDisposableSync:()=>Yi,mkdtempSync:()=>Ji,open:()=>vc,openAsBlob:()=>ol,openSync:()=>vi,opendir:()=>rl,opendirSync:()=>$i,promises:()=>no,read:()=>Oc,readFile:()=>yc,readFileSync:()=>bi,readSync:()=>ki,readdir:()=>Pc,readdirSync:()=>Fi,readlink:()=>Lc,readlinkSync:()=>Ri,readv:()=>tl,readvSync:()=>Zi,realpath:()=>Wc,realpathSync:()=>Gi,rename:()=>fc,renameSync:()=>fi,rm:()=>Qc,rmSync:()=>qi,rmdir:()=>Mc,rmdirSync:()=>Ni,stat:()=>mc,statSync:()=>mi,statfs:()=>al,statfsSync:()=>ta,symlink:()=>Ic,symlinkSync:()=>Li,truncate:()=>gc,truncateSync:()=>gi,unlink:()=>_c,unlinkSync:()=>_i,unwatchFile:()=>Jc,utimes:()=>Hc,utimesSync:()=>Ui,watch:()=>Yc,watchFile:()=>qc,write:()=>Dc,writeFile:()=>bc,writeFileSync:()=>xi,writeSync:()=>Oi,writev:()=>nl,writevSync:()=>Qi}),ll=t({get:()=>fl,getSync:()=>pl,list:()=>vl,listSync:()=>yl,remove:()=>gl,removeSync:()=>_l,set:()=>ml,setSync:()=>hl}),ul=[];function dl(e,t,n,r){if(!t.startsWith(`user.`)&&!ul.includes(t))throw N(`ENOTSUP`,r,n)}async function fl(e,t,n={}){e=H(e);let{fs:r,path:i}=X(e,this);dl(this,t,e,`xattr.get`);let a=await r.stat(i).catch(F(`xattr.get`,e));if(Y&&!J(this,a,4))throw N(`EACCES`,`xattr.get`,e);a.attributes??=new kn;let o=a.attributes.get(t);if(!o)throw N(`ENODATA`,`xattr.get`,e);let s=lr.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}function pl(e,t,n={}){e=H(e),dl(this,t,e,`xattr.get`);let{fs:r,path:i}=X(e,this),a;try{a=r.statSync(i)}catch(t){throw j(Object.assign(t,{path:e}))}if(Y&&!J(this,a,4))throw N(`EACCES`,`xattr.get`,e);a.attributes??=new kn;let o=a.attributes.get(t);if(!o)throw N(`ENODATA`,`xattr.get`,e);let s=lr.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}async function ml(e,t,n,r={}){e=H(e);let{fs:i,path:a}=X(e,this);dl(this,t,e,`xattr.set`);let o=await i.stat(a).catch(F(`xattr.set`,e));if(Y&&!J(this,o,2))throw N(`EACCES`,`xattr.set`,e);o.attributes??=new kn;let s=o.attributes.get(t);if(r.create&&s)throw N(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw N(`ENODATA`,`xattr.set`,e);o.attributes.set(t,lr.Buffer.from(n)),await i.touch(a,o).catch(F(`xattr.set`,e))}function hl(e,t,n,r={}){e=H(e);let{fs:i,path:a}=X(e,this);dl(this,t,e,`xattr.set`);let o;try{o=i.statSync(a)}catch(t){throw j(Object.assign(t,{path:e}))}if(Y&&!J(this,o,2))throw N(`EACCES`,`xattr.set`,e);o.attributes??=new kn;let s=o.attributes.get(t);if(r.create&&s)throw N(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw N(`ENODATA`,`xattr.set`,e);o.attributes.set(t,lr.Buffer.from(n));try{i.touchSync(a,o)}catch(t){throw j(Object.assign(t,{path:e}))}}async function gl(e,t){e=H(e);let{fs:n,path:r}=X(e,this);dl(this,t,e,`xattr.remove`);let i=await n.stat(r).catch(F(`xattr.remove`,e));if(Y&&!J(this,i,2))throw N(`EACCES`,`xattr.remove`,e);if(i.attributes??=new kn,!i.attributes.get(t))throw N(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t),await n.touch(r,i)}function _l(e,t){e=H(e);let{fs:n,path:r}=X(e,this);dl(this,t,e,`xattr.remove`);let i;try{i=n.statSync(r)}catch(t){throw j(Object.assign(t,{path:e}))}if(Y&&!J(this,i,2))throw N(`EACCES`,`xattr.remove`,e);if(i.attributes??=new kn,!i.attributes.get(t))throw N(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t);try{n.touchSync(r,i)}catch(t){throw j(Object.assign(t,{path:e}))}}async function vl(e){e=H(e);let{fs:t,path:n}=X(e,this),r=await t.stat(n).catch(F(`xattr.list`,e));return r.attributes?[...r.attributes.keys()]:[]}function yl(e){e=H(e);let{fs:t,path:n}=X(e,this),r;try{r=t.statSync(n)}catch(t){throw j(Object.assign(t,{path:e}))}return r.attributes?[...r.attributes.keys()]:[]}var bl=new Map;function xl(e={}){let t=Le(this);if(!mi.call(this,t.root).isDirectory())throw N(`ENOTDIR`,{syscall:`chroot`,path:t.root});let n=ze(t,e),r=Object.assign(n,{fs:{..._(cl,n),promises:_(no,n),xattr:_(ll,n)},path:_(on,n),bind:e=>{let t=xl.call(n,e);return n.children.push(t),t}});return bl.set(n.id,r),r}var $=function(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t},Sl=(function(e){return function(t){function n(n){t.error=t.hasError?new e(n,t.error,`An error was suppressed during disposal.`):n,t.hasError=!0}var r,i=0;function a(){for(;r=t.stack.pop();)try{if(!r.async&&i===1)return i=0,t.stack.push(r),Promise.resolve().then(a);if(r.dispose){var e=r.dispose.call(r.value);if(r.async)return i|=2,Promise.resolve(e).then(a,function(e){return n(e),a()})}else i|=1}catch(e){n(e)}if(i===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return a()}})(typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r}),Cl=class{previous;current=Promise.withResolvers();_isLocked=!0;get isLocked(){return this._isLocked}constructor(e){this.previous=e}async done(){await this.previous?.done(),await this.current.promise}unlock(){this.current.resolve(),this._isLocked=!1}[Symbol.dispose](){this.unlock()}},wl=class{_fs;get type(){return this._fs.type}get name(){return this._fs.name}get label(){return this._fs.label}set label(e){this._fs.label=e}get attributes(){return this._fs.attributes}get _uuid(){return this._fs._uuid}set _uuid(e){this._fs._uuid=e}get uuid(){return this._fs.uuid}async ready(){return await this._fs.ready()}readySync(){return this._fs.readySync()}usage(){return this._fs.usage()}currentLock;addLock(){let e=new Cl(this.currentLock);return this.currentLock=e,e}async lock(e=5e3){let t=this.currentLock,n=this.addLock(),r=Error().stack;return setTimeout(()=>{if(n.isLocked){let e=P(`EDEADLK`);throw e.stack+=r?.slice(5),L(e)}},e),await t?.done(),n}lockSync(){if(this.currentLock?.isLocked)throw L(P(`EBUSY`));return this.addLock()}get isLocked(){return!!this.currentLock?.isLocked}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.rename(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.renameSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.stat(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.statSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.touch(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,this.lockSync(),!1),this._fs.touchSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}async createFile(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,await this.lock(),!1),await this._fs.createFile(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}createFileSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.createFileSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}async unlink(e){let t={stack:[],error:void 0,hasError:!1};try{$(t,await this.lock(),!1),await this._fs.unlink(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}unlinkSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.unlinkSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}async rmdir(e){let t={stack:[],error:void 0,hasError:!1};try{$(t,await this.lock(),!1),await this._fs.rmdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}rmdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.rmdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}async mkdir(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,await this.lock(),!1),await this._fs.mkdir(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}mkdirSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.mkdirSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.readdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.readdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}async exists(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,await this.lock(),!1),await this._fs.exists(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}existsSync(e){let t={stack:[],error:void 0,hasError:!1};try{return $(t,this.lockSync(),!1),this._fs.existsSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Sl(t)}}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{$(n,await this.lock(),!1),await this._fs.link(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.linkSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}async sync(){let e={stack:[],error:void 0,hasError:!1};try{$(e,await this.lock(),!1),await this._fs.sync()}catch(t){e.error=t,e.hasError=!0}finally{Sl(e)}}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{return $(e,this.lockSync(),!1),this._fs.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{Sl(e)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return $(i,await this.lock(),!1),await this._fs.read(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Sl(i)}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return $(i,this.lockSync(),!1),this._fs.readSync(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Sl(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return $(r,await this.lock(),!1),await this._fs.write(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Sl(r)}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return $(r,this.lockSync(),!1),this._fs.writeSync(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Sl(r)}}streamRead(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.streamRead(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}streamWrite(e,t){let n={stack:[],error:void 0,hasError:!1};try{return $(n,this.lockSync(),!1),this._fs.streamWrite(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Sl(n)}}};function Tl(e){class t extends wl{constructor(...t){super(),this._fs=new e(...t)}}return t}function El(e){class t extends e{constructor(...e){super(...e),this.attributes.set(`no_write`)}async rename(){throw P(`EROFS`)}renameSync(){throw P(`EROFS`)}async createFile(){throw P(`EROFS`)}createFileSync(){throw P(`EROFS`)}async unlink(){throw P(`EROFS`)}unlinkSync(){throw P(`EROFS`)}async rmdir(){throw P(`EROFS`)}rmdirSync(){throw P(`EROFS`)}async mkdir(){throw P(`EROFS`)}mkdirSync(){throw P(`EROFS`)}async link(){throw P(`EROFS`)}linkSync(){throw P(`EROFS`)}async touch(){throw P(`EROFS`)}touchSync(){throw P(`EROFS`)}async sync(){throw P(`EROFS`)}syncSync(){throw P(`EROFS`)}async write(){throw P(`EROFS`)}writeSync(){throw P(`EROFS`)}streamWrite(){throw P(`EROFS`)}}return t}function Dl(e){class t extends e{async exists(e){return this.existsSync(e)}async rename(e,t){return this.renameSync(e,t)}async stat(e){return this.statSync(e)}async touch(e,t){return this.touchSync(e,t)}async createFile(e,t){return this.createFileSync(e,t)}async unlink(e){return this.unlinkSync(e)}async rmdir(e){return this.rmdirSync(e)}async mkdir(e,t){return this.mkdirSync(e,t)}async readdir(e){return this.readdirSync(e)}async link(e,t){return this.linkSync(e,t)}async sync(){return this.syncSync()}async read(e,t,n,r){return this.readSync(e,t,n,r)}async write(e,t,n){return this.writeSync(e,t,n)}}return t}var Ol=function(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else(d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0},kl=function(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0},Al;(function(e){e[e.RealTime=1]=`RealTime`,e[e.PreAlloc=2]=`PreAlloc`,e[e.Immutable=8]=`Immutable`,e[e.Append=16]=`Append`,e[e.Sync=32]=`Sync`,e[e.NoAtime=64]=`NoAtime`,e[e.NoDump=128]=`NoDump`,e[e.RtInherit=256]=`RtInherit`,e[e.ProjInherit=512]=`ProjInherit`,e[e.NoSymlinks=1024]=`NoSymlinks`,e[e.ExtSize=2048]=`ExtSize`,e[e.ExtSzInherit=4096]=`ExtSzInherit`,e[e.NoDefrag=8192]=`NoDefrag`,e[e.FileStream=16384]=`FileStream`,e[e.Dax=32768]=`Dax`,e[e.CowExtSize=65536]=`CowExtSize`,e[e.HasAttr=2147483648]=`HasAttr`})(Al||={});var jl=(()=>{var e,t,n,r,i;let a=[Ht()],s,c=[],l,u=Gt(o),d,f=[],p=[],m,h=[],g=[],_,v=[],b=[],x,S=[],C=[],w,T=[],ee=[],E,te=[],ne=[];var D=class extends u{static{l=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;d=[(e=V).uint32.bind(e)],m=[(t=V).uint32.bind(t)],_=[(n=V).uint32.bind(n)],x=[(r=V).uint32.bind(r)],w=[(i=V).uint32.bind(i)],E=[V.char(8)],Ol(this,null,d,{kind:`accessor`,name:`xflags`,static:!1,private:!1,access:{has:e=>`xflags`in e,get:e=>e.xflags,set:(e,t)=>{e.xflags=t}},metadata:o},f,p),Ol(this,null,m,{kind:`accessor`,name:`extsize`,static:!1,private:!1,access:{has:e=>`extsize`in e,get:e=>e.extsize,set:(e,t)=>{e.extsize=t}},metadata:o},h,g),Ol(this,null,_,{kind:`accessor`,name:`nextents`,static:!1,private:!1,access:{has:e=>`nextents`in e,get:e=>e.nextents,set:(e,t)=>{e.nextents=t}},metadata:o},v,b),Ol(this,null,x,{kind:`accessor`,name:`projid`,static:!1,private:!1,access:{has:e=>`projid`in e,get:e=>e.projid,set:(e,t)=>{e.projid=t}},metadata:o},S,C),Ol(this,null,w,{kind:`accessor`,name:`cowextsize`,static:!1,private:!1,access:{has:e=>`cowextsize`in e,get:e=>e.cowextsize,set:(e,t)=>{e.cowextsize=t}},metadata:o},T,ee),Ol(this,null,E,{kind:`accessor`,name:`pad`,static:!1,private:!1,access:{has:e=>`pad`in e,get:e=>e.pad,set:(e,t)=>{e.pad=t}},metadata:o},te,ne),Ol(null,s={value:l},a,{kind:`class`,name:l.name,metadata:o},null,c),D=l=s.value,o&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`fsxattr`;#e=kl(this,f,void 0);get xflags(){return this.#e}set xflags(e){this.#e=e}#t=(kl(this,p),kl(this,h,void 0));get extsize(){return this.#t}set extsize(e){this.#t=e}#n=(kl(this,g),kl(this,v,void 0));get nextents(){return this.#n}set nextents(e){this.#n=e}#r=(kl(this,b),kl(this,S,void 0));get projid(){return this.#r}set projid(e){this.#r=e}#i=(kl(this,C),kl(this,T,void 0));get cowextsize(){return this.#i}set cowextsize(e){this.#i=e}#a=(kl(this,ee),kl(this,te,[]));get pad(){return this.#a}set pad(e){this.#a=e}constructor(e=y(new M(k.EINVAL,`fsxattr must be initialized with an inode`))){super(new ArrayBuffer(B(D))),kl(this,ne),this.extsize=e.size,this.nextents=1,this.projid=e.uid,this.cowextsize=e.size;for(let t of Object.keys(jn))e.flags&jn[t]&&t in Al&&(this.xflags|=Al[t])}static{kl(l,c)}};return D=l})(),Ml;(function(e){e[e.SecureRm=1]=`SecureRm`,e[e.Undelete=2]=`Undelete`,e[e.Compress=4]=`Compress`,e[e.Sync=8]=`Sync`,e[e.Immutable=16]=`Immutable`,e[e.Append=32]=`Append`,e[e.NoDump=64]=`NoDump`,e[e.NoAtime=128]=`NoAtime`,e[e.Dirty=256]=`Dirty`,e[e.CompressBlk=512]=`CompressBlk`,e[e.NoCompress=1024]=`NoCompress`,e[e.Encrypt=2048]=`Encrypt`,e[e.Btree=4096]=`Btree`,e[e.Index=4096]=`Index`,e[e.IMagic=8192]=`IMagic`,e[e.JournalData=16384]=`JournalData`,e[e.NoTail=32768]=`NoTail`,e[e.DirSync=65536]=`DirSync`,e[e.TopDir=131072]=`TopDir`,e[e.HugeFile=262144]=`HugeFile`,e[e.Extent=524288]=`Extent`,e[e.Verity=1048576]=`Verity`,e[e.EaInode=2097152]=`EaInode`,e[e.EofBlocks=4194304]=`EofBlocks`,e[e.NoCow=8388608]=`NoCow`,e[e.Dax=33554432]=`Dax`,e[e.InlineData=268435456]=`InlineData`,e[e.ProjInherit=536870912]=`ProjInherit`,e[e.CaseFold=1073741824]=`CaseFold`,e[e.Reserved=2147483648]=`Reserved`})(Ml||={});var Nl;(function(e){e[e.GetFlags=2148034049]=`GetFlags`,e[e.SetFlags=1074292226]=`SetFlags`,e[e.GetVersion=2148038145]=`GetVersion`,e[e.SetVersion=1074296322]=`SetVersion`,e[e.Fiemap=3223348747]=`Fiemap`,e[e.GetXattr=2149341215]=`GetXattr`,e[e.SetXattr=1075599392]=`SetXattr`,e[e.GetLabel=2164298801]=`GetLabel`,e[e.SetLabel=1090556978]=`SetLabel`,e[e.GetUUID=2148603136]=`GetUUID`,e[e.GetSysfsPath=2155943169]=`GetSysfsPath`})(Nl||={});var Pl;(function(e){e[e.GetFlags=2147771905]=`GetFlags`,e[e.SetFlags=1074030082]=`SetFlags`,e[e.GetVersion=2147776001]=`GetVersion`,e[e.SetVersion=1074034178]=`SetVersion`})(Pl||={});async function Fl(e,t,...n){e=H(e);let{fs:r,path:i}=X(e,this);try{let e=new K(await r.stat(i));switch(t){case Nl.GetFlags:case Pl.GetFlags:return e.flags;case Nl.SetFlags:case Pl.SetFlags:e.flags=n[0],await r.touch(i,e);return;case Nl.GetVersion:case Pl.GetVersion:return e.version;case Nl.SetVersion:case Pl.SetVersion:e.version=n[0],await r.touch(i,e);return;case Nl.Fiemap:break;case Nl.GetXattr:return new jl(e);case Nl.SetXattr:break;case Nl.GetLabel:return r.label;case Nl.SetLabel:r.label=n[0];return;case Nl.GetUUID:return r.uuid;case Nl.GetSysfsPath:return`/sys/fs/${r.name}/${r.uuid}`}}catch(t){throw j(Object.assign(t,{syscall:`ioctl`,path:e}))}throw N(`ENOTSUP`,`ioctl`,e)}function Il(e,t,...n){e=H(e);let{fs:r,path:i}=X(e,this);try{let e=new K(r.statSync(i));switch(t){case Nl.GetFlags:case Pl.GetFlags:return e.flags;case Nl.SetFlags:case Pl.SetFlags:e.flags=n[0],r.touchSync(i,e);return;case Nl.GetVersion:case Pl.GetVersion:return e.version;case Nl.SetVersion:case Pl.SetVersion:e.version=n[0],r.touchSync(i,e);return;case Nl.Fiemap:break;case Nl.GetXattr:return new jl(e);case Nl.SetXattr:break;case Nl.GetLabel:return r.label;case Nl.SetLabel:r.label=n[0];return;case Nl.GetUUID:return r.uuid;case Nl.GetSysfsPath:return`/sys/fs/${r.name}/${r.uuid}`}}catch(t){throw j(Object.assign(t,{syscall:`ioctl`,path:e}))}throw N(`ENOTSUP`,`ioctl`,e)}var Ll={name:`@zenfs/core`,version:`2.6.2`,description:`A filesystem, anywhere`,funding:{type:`individual`,url:`https://github.com/sponsors/james-pre`},main:`dist/index.js`,types:`dist/index.d.ts`,keywords:[`filesystem`,`node`,`storage`],bin:{"make-index":`scripts/make-index.js`,"zenfs-test":`scripts/test.js`,zci:`scripts/ci-cli.js`},files:[`dist`,`tests`,`types`,`license.md`,`eslint.shared.js`],type:`module`,homepage:`https://zenfs.dev/core`,author:`James Prevett <jp@jamespre.dev> (https://jamespre.dev)`,contributors:[`John Vilk <jvilk@cs.umass.edu>`],license:`LGPL-3.0-or-later`,repository:{type:`git`,url:`git+https://github.com/zen-fs/core.git`},bugs:{url:`https://github.com/zen-fs/core/issues`},engines:{node:`>= 18`},exports:{".":`./dist/index.js`,"./*":`./dist/*`,"./emulation/*":`./dist/node/*`,"./promises":`./dist/node/promises.js`,"./readline":`./dist/node/readline.js`,"./constants":`./dist/constants.js`,"./path":`./dist/path.js`,"./eslint":`./eslint.shared.js`,"./tests/*":`./tests/*`,"./types/*":`./types/*`},publishConfig:{access:`public`,provenance:!0},scripts:{format:`prettier --write .`,"format:check":`prettier --check .`,"spdx:check":`npx lice -a src tests/*.ts tests/**/*.test.ts`,"spdx:fix":`npx lice -aw src tests/*.ts tests/**/*.test.ts`,lint:`eslint src tests`,test:`npx --silent zenfs-test --clean; npx --silent zenfs-test -abcp; tests/fetch/run.sh; npx --silent zenfs-test --report`,build:`tsc -p tsconfig.json`,"build:docs":`typedoc`,dev:`tsc -p tsconfig.json --watch`,prepublishOnly:`npm run build`},dependencies:{"@types/node":`^25.2.0`,buffer:`^6.0.3`,eventemitter3:`^5.0.1`,kerium:`^1.4.2`,memium:`^0.4.0`,"readable-stream":`^4.5.2`,utilium:`^3.0.0`},devDependencies:{"@eslint/js":`^10.0.1`,"@octokit/action":`^8.0.4`,c8:`^11.0.0`,eslint:`^10.1.0`,globals:`^17.3.0`,prettier:`^3.2.5`,tsx:`^4.19.1`,typedoc:`^0.28.18`,typescript:`^6.0.0`,"typescript-eslint":`^8.58.0`},allowScripts:{esbuild:!0}},Rl=t({BigIntStatsFs:()=>Tn,Dir:()=>li,Dirent:()=>si,IOC:()=>Nl,IOC32:()=>Pl,ReadStream:()=>eo,Stats:()=>xn,StatsFs:()=>wn,WriteStream:()=>to,_version:()=>zl,access:()=>Gc,accessSync:()=>Ki,appendFile:()=>xc,appendFileSync:()=>Si,chmod:()=>Bc,chmodSync:()=>Vi,chown:()=>Rc,chownSync:()=>zi,chroot:()=>Jr,close:()=>Cc,closeSync:()=>wi,constants:()=>Be,copyFile:()=>el,copyFileSync:()=>Xi,cp:()=>il,cpSync:()=>ea,createReadStream:()=>Xc,createWriteStream:()=>Zc,exists:()=>pc,existsSync:()=>pi,fchmod:()=>Ac,fchmodSync:()=>ji,fchown:()=>kc,fchownSync:()=>Ai,fdatasync:()=>Ec,fdatasyncSync:()=>Di,fstat:()=>Sc,fstatSync:()=>Ci,fsync:()=>Tc,fsyncSync:()=>Ei,ftruncate:()=>wc,ftruncateSync:()=>Ti,futimes:()=>jc,futimesSync:()=>Mi,glob:()=>sl,globSync:()=>na,ioctl:()=>Fl,ioctlSync:()=>Il,lchmod:()=>Vc,lchmodSync:()=>Hi,lchown:()=>zc,lchownSync:()=>Bi,link:()=>Fc,linkSync:()=>Ii,lopenSync:()=>yi,lstat:()=>hc,lstatSync:()=>hi,lutimes:()=>Uc,lutimesSync:()=>Wi,mkdir:()=>Nc,mkdirSync:()=>Pi,mkdtemp:()=>$c,mkdtempDisposableSync:()=>Yi,mkdtempSync:()=>Ji,mount:()=>Gr,open:()=>vc,openAsBlob:()=>ol,openSync:()=>vi,opendir:()=>rl,opendirSync:()=>$i,promises:()=>no,read:()=>Oc,readFile:()=>yc,readFileSync:()=>bi,readSync:()=>ki,readdir:()=>Pc,readdirSync:()=>Fi,readlink:()=>Lc,readlinkSync:()=>Ri,readv:()=>tl,readvSync:()=>Zi,realpath:()=>Wc,realpathSync:()=>Gi,rename:()=>fc,renameSync:()=>fi,rm:()=>Qc,rmSync:()=>qi,rmdir:()=>Mc,rmdirSync:()=>Ni,stat:()=>mc,statSync:()=>mi,statfs:()=>al,statfsSync:()=>ta,symlink:()=>Ic,symlinkSync:()=>Li,truncate:()=>gc,truncateSync:()=>gi,umount:()=>Kr,unlink:()=>_c,unlinkSync:()=>_i,unwatchFile:()=>Jc,utimes:()=>Hc,utimesSync:()=>Ui,watch:()=>Yc,watchFile:()=>qc,write:()=>Dc,writeFile:()=>bc,writeFileSync:()=>xi,writeSync:()=>Oi,writev:()=>nl,writevSync:()=>Qi,xattr:()=>ll}),zl=Ll.version,Bl=t({DirType:()=>dr,Dirent:()=>mr,Handle:()=>Mr,IOC:()=>Nl,IOC32:()=>Pl,chroot:()=>Jr,deleteFD:()=>Fr,dtToIf:()=>pr,fromFD:()=>Pr,ifToDt:()=>fr,ioctl:()=>Fl,ioctlSync:()=>Il,link:()=>ya,mkdir:()=>ga,mount:()=>Gr,open:()=>ma,readdir:()=>_a,readlink:()=>ha,rename:()=>va,resolve:()=>pa,stat:()=>ba,sync:()=>Xr,toFD:()=>Nr,umount:()=>Kr,xattr:()=>ll}),Vl=t({Async:()=>Us,AsyncMapTransaction:()=>Qn,AsyncTransaction:()=>Kn,Attributes:()=>kn,BigIntStatsFs:()=>Tn,CopyOnWrite:()=>cs,CopyOnWriteFS:()=>ss,DeviceFS:()=>tr,Dir:()=>li,Dirent:()=>si,ErrnoError:()=>Br,Fetch:()=>vs,FetchFS:()=>_s,FileSystem:()=>Un,IOC:()=>Nl,IOC32:()=>Pl,InMemory:()=>er,InMemoryStore:()=>$n,Index:()=>Vn,IndexFS:()=>hs,Inode:()=>K,InodeFlags:()=>jn,Journal:()=>os,MetadataBlock:()=>rc,MutexLock:()=>Cl,Mutexed:()=>Tl,Passthrough:()=>Ss,PassthroughFS:()=>xs,Port:()=>qs,PortFS:()=>Ws,RPC:()=>Cs,ReadStream:()=>eo,Readonly:()=>El,SingleBuffer:()=>uc,SingleBufferStore:()=>lc,Stats:()=>xn,StatsFs:()=>wn,StoreFS:()=>Xn,SuperBlock:()=>oc,Sync:()=>Dl,SyncMapTransaction:()=>Zn,SyncTransaction:()=>Gn,Transaction:()=>Wn,WrappedTransaction:()=>qn,WriteStream:()=>to,_MutexedFS:()=>wl,_asyncFSKeys:()=>Hs,_chown:()=>Bn,_fnOpt:()=>ke,_inode_fields:()=>An,_inode_version:()=>5,_tempDirName:()=>an,_version:()=>zl,access:()=>Gc,accessSync:()=>Ki,addDevice:()=>Zo,appendFile:()=>xc,appendFileSync:()=>Si,attachFS:()=>Gs,bindContext:()=>xl,boundContexts:()=>bl,checkOptions:()=>je,chmod:()=>Bc,chmodSync:()=>Vi,chown:()=>Rc,chownSync:()=>zi,chroot:()=>Jr,close:()=>Cc,closeSync:()=>wi,configure:()=>$o,configureFileSystem:()=>Ho,configureSingle:()=>qo,configureSingleSync:()=>Jo,configureSync:()=>es,constants:()=>Be,contextOf:()=>Le,copyFile:()=>el,copyFileSync:()=>Xi,cp:()=>il,cpSync:()=>ea,createChildContext:()=>ze,createCredentials:()=>Ne,createReadStream:()=>Xc,createWriteStream:()=>Zc,credentialsAllowRoot:()=>Pe,decodeDirListing:()=>Yt,default:()=>Hl,defaultContext:()=>Ie,detachFS:()=>Ks,devices:()=>cr,encodeDirListing:()=>Xt,exists:()=>pc,existsSync:()=>pi,fchmod:()=>Ac,fchmodSync:()=>ji,fchown:()=>kc,fchownSync:()=>Ai,fdatasync:()=>Ec,fdatasyncSync:()=>Di,fs:()=>Rl,fstat:()=>Sc,fstatSync:()=>Ci,fsync:()=>Tc,fsyncSync:()=>Ei,ftruncate:()=>wc,ftruncateSync:()=>Ti,fullDevice:()=>ar,futimes:()=>jc,futimesSync:()=>Mi,glob:()=>sl,globSync:()=>na,globToRegex:()=>nn,hasAccess:()=>J,ioctl:()=>Fl,ioctlSync:()=>Il,isBackend:()=>Oe,isBackendConfig:()=>Me,isBlockDevice:()=>Ln,isCharacterDevice:()=>Rn,isDirectory:()=>q,isFIFO:()=>zn,isFile:()=>Pn,isSocket:()=>In,isSymbolicLink:()=>Fn,lchmod:()=>Vc,lchmodSync:()=>Hi,lchown:()=>zc,lchownSync:()=>Bi,link:()=>Fc,linkSync:()=>Ii,log:()=>re,lopenSync:()=>yi,lstat:()=>hc,lstatSync:()=>hi,lutimes:()=>Uc,lutimesSync:()=>Wi,mkdir:()=>Nc,mkdirSync:()=>Pi,mkdtemp:()=>$c,mkdtempDisposableSync:()=>Yi,mkdtempSync:()=>Ji,mount:()=>Gr,mounts:()=>Wr,normalizeMode:()=>Zt,normalizeOptions:()=>tn,normalizePath:()=>H,normalizeTime:()=>en,nullDevice:()=>rr,open:()=>vc,openAsBlob:()=>ol,openSync:()=>vi,opendir:()=>rl,opendirSync:()=>$i,promises:()=>no,randomDevice:()=>or,read:()=>Oc,readFile:()=>yc,readFileSync:()=>bi,readSync:()=>ki,readdir:()=>Pc,readdirSync:()=>Fi,readlink:()=>Lc,readlinkSync:()=>Ri,readv:()=>tl,readvSync:()=>Zi,realpath:()=>Wc,realpathSync:()=>Gi,rename:()=>fc,renameSync:()=>fi,resolveMountConfig:()=>Go,resolveMountConfigSync:()=>Ko,resolveRemoteMount:()=>Js,rm:()=>Qc,rmSync:()=>qi,rmdir:()=>Mc,rmdirSync:()=>Ni,rootIno:()=>0,stat:()=>mc,statSync:()=>mi,statfs:()=>al,statfsSync:()=>ta,symlink:()=>Ic,symlinkSync:()=>Li,sync:()=>ts,truncate:()=>gc,truncateSync:()=>gi,umount:()=>Kr,unlink:()=>_c,unlinkSync:()=>_i,unwatchFile:()=>Jc,userModifiableFlags:()=>Nn,userVisibleFlags:()=>Mn,utimes:()=>Hc,utimesSync:()=>Ui,validateFD:()=>$t,version:()=>1,vfs:()=>Bl,waitOnline:()=>rn,watch:()=>Yc,watchFile:()=>qc,withExceptionContext:()=>Ur,withPath:()=>Vr,wrap:()=>Hr,write:()=>Dc,writeFile:()=>bc,writeFileSync:()=>xi,writeSync:()=>Oi,writev:()=>nl,writevSync:()=>Qi,xattr:()=>ll,zeroDevice:()=>ir}),Hl=Rl;globalThis.__zenfs__=Object.create(Rl);export{R as C,ne as D,P as E,te as O,fe as S,M as T,$e as _,er as a,ue as b,Wn as c,An as d,mn as f,Xe as g,tt as h,hs as i,y as k,Un as l,U as m,Dl as n,Zn as o,W as p,Us as r,Xn as s,Vl as t,K as u,at as v,k as w,de as x,it as y};
|