sliccy 6.150.4 → 6.151.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 +176 -176
- package/dist/ui/assets/{account-store-D8e8oik0.js → account-store-CTHYx1eI.js} +1 -1
- package/dist/ui/assets/{account-store-CV9MqwUm.js → account-store-D-V2-7XB.js} +1 -1
- package/dist/ui/assets/{adobe-BVISN7vp.js → adobe-Bsgt8Bcd.js} +1 -1
- package/dist/ui/assets/{adobe-BxjyXT87.js → adobe-CX6A0hFV.js} +1 -1
- package/dist/ui/assets/{agent-bridge-BBkdIfsJ.js → agent-bridge-DTG2NGH_.js} +1 -1
- package/dist/ui/assets/{agent-panels-CjeQdy1Y.js → agent-panels-0jJcCBPw.js} +1 -1
- package/dist/ui/assets/{apply-layout-CvLXxRBE.js → apply-layout-BwJX_nzD.js} +1 -1
- package/dist/ui/assets/{apps-DxHLnxIs.js → apps-DFG-1Xre.js} +1 -1
- package/dist/ui/assets/{azure-openai-CeWhvhCg.js → azure-openai-Bp7Vwqy5.js} +1 -1
- package/dist/ui/assets/{azure-openai-CrXxL0yw.js → azure-openai-Cd4wkvbR.js} +1 -1
- package/dist/ui/assets/{budget-usage-source-DKTPDwsD.js → budget-usage-source-DZ6R9FxJ.js} +1 -1
- package/dist/ui/assets/{cdp-C6pQEDl7.js → cdp-D-wkO8sU.js} +1 -1
- package/dist/ui/assets/{cerebras-Dy4v03m_.js → cerebras-BLXGaqQ3.js} +1 -1
- package/dist/ui/assets/{cerebras-NYRgbfj7.js → cerebras-CwUAiXB7.js} +1 -1
- package/dist/ui/assets/{composer-speech-C_q-fKNK.js → composer-speech-BsHTt6sC.js} +1 -1
- package/dist/ui/assets/{connect-surface-DnqcwOmu.js → connect-surface-Krva590y.js} +1 -1
- package/dist/ui/assets/{directed-approval-FjkkjI1B.js → directed-approval-DjP8xeHL.js} +1 -1
- package/dist/ui/assets/{dist-jZ_-ZAfa.js → dist-B3W7EgGh.js} +2 -2
- package/dist/ui/assets/{dist-qS_JJrd_.js → dist-CmI2JIly.js} +2 -2
- package/dist/ui/assets/{dist-I9BhJxsi.js → dist-DCrgApJQ.js} +2 -2
- package/dist/ui/assets/{dist-BFKPJK-l.js → dist-UJah3hVh.js} +2 -2
- package/dist/ui/assets/{fs-cMwqXtFi.js → fs-BX5cyCWp.js} +2 -2
- package/dist/ui/assets/{fs-DtsuwDhC.js → fs-CYM-W3g0.js} +1 -1
- package/dist/ui/assets/{github-C9LAMuX2.js → github-D2YxBheg.js} +1 -1
- package/dist/ui/assets/{github-DMrOAHK5.js → github-DkSUF8FU.js} +2 -2
- package/dist/ui/assets/{github-copilot-CIlYMLNf.js → github-copilot-B6PmZsIl.js} +1 -1
- package/dist/ui/assets/{github-copilot-CMZIEIwW.js → github-copilot-BllywPNR.js} +1 -1
- package/dist/ui/assets/{github-install-Br7_N-Wz.js → github-install-Bhiod3SL.js} +1 -1
- package/dist/ui/assets/{github-zip-JuyNsUge.js → github-zip-B_KLPcT2.js} +1 -1
- package/dist/ui/assets/{hear-WpLAGmLj.js → hear-fF6imt7a.js} +1 -1
- package/dist/ui/assets/{help-DygoYzMM.js → help-CWxt3I4r.js} +1 -1
- package/dist/ui/assets/{js-realm-worker-B_adS-Xa.js → js-realm-worker-D35Rc4yg.js} +1 -1
- package/dist/ui/assets/{kernel-worker-D6QiQmF8.js → kernel-worker-1nSCk45b.js} +32 -32
- package/dist/ui/assets/{local-llm-CKk6H8PP.js → local-llm-CNIkuio4.js} +1 -1
- package/dist/ui/assets/{local-llm-BsNQFYst.js → local-llm-CVZ8Q-HQ.js} +1 -1
- package/dist/ui/assets/{main-D1uZduJD.js → main-B21vpjb7.js} +3 -3
- package/dist/ui/assets/{main-cherry-C309Ei0U.js → main-cherry-DRTAg65H.js} +1 -1
- package/dist/ui/assets/{memory-curation-seam-BHv-E0Wj.js → memory-curation-seam-DdbVR20I.js} +1 -1
- package/dist/ui/assets/{mount-CvYjFqV-.js → mount-6NvTEeb-.js} +1 -1
- package/dist/ui/assets/{mount-DEDbw6Zx.js → mount-iSuMeRla.js} +3 -3
- package/dist/ui/assets/{mount-recovery-fCH5-MTl.js → mount-recovery-1GUl7Kin.js} +1 -1
- package/dist/ui/assets/{new-session-B0QCLfxz.js → new-session-BEaS8t8K.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-CGkRhQ3S.js → oauth-bootstrap-Bnm9Hluc.js} +2 -2
- package/dist/ui/assets/{onboarding-orchestrator-CPTdYW2L.js → onboarding-orchestrator-DA3N8qLk.js} +1 -1
- package/dist/ui/assets/{openai-codex-DdHlWXt7.js → openai-codex-3ZFC7rYG.js} +1 -1
- package/dist/ui/assets/{openai-codex-DYK7kjvj.js → openai-codex-CT8XmTxY.js} +1 -1
- package/dist/ui/assets/{openrouter-BVTGfTQU.js → openrouter-U8nzdgSK.js} +1 -1
- package/dist/ui/assets/{openrouter-free-Ckpy86qX.js → openrouter-free-BHV75Chq.js} +1 -1
- package/dist/ui/assets/{openrouter-free-3AcyjDsF.js → openrouter-free-CuMpC2Ox.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-BgOHLX8g.js → openrouter-oauth-CE8wQbmk.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-Dg6fl3Oy.js → openrouter-oauth-nnp9s5f3.js} +1 -1
- package/dist/ui/assets/{openrouter-DIGFK8vL.js → openrouter-oqexrr6D.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-CTskO2UP.js → panel-rpc-handlers-COuAwAst.js} +2 -2
- package/dist/ui/assets/{panelize-shell-0NEazEbP.js → panelize-shell-C0T9I3vr.js} +1 -1
- package/dist/ui/assets/{provider-c_Gkn3pV.js → provider-BZ25nJvN.js} +1 -1
- package/dist/ui/assets/{provider-DZFS2iTq.js → provider-DhRt84O_.js} +2 -2
- package/dist/ui/assets/provider-settings-C7aETmT8.js +1 -0
- package/dist/ui/assets/provider-store-access-DbQbBLKv.js +1 -0
- package/dist/ui/assets/provider-store-access-Dgs9tUNQ.js +1 -0
- package/dist/ui/assets/{providers-CraHfd4c.js → providers-BUD-TOmG.js} +1 -1
- package/dist/ui/assets/{providers-CuieHopm.js → providers-DvfH77LU.js} +2 -2
- package/dist/ui/assets/{quick-llm-CFpL1uZA.js → quick-llm-BM48Uy17.js} +1 -1
- package/dist/ui/assets/{recovery-screen-CtXko1KE.js → recovery-screen-1DgWdLoJ.js} +1 -1
- package/dist/ui/assets/{run-5nsq-ysK.js → run-DkGMVntk.js} +2 -2
- package/dist/ui/assets/{run-ydpfdHvF.js → run-LBlXUT9g.js} +1 -1
- package/dist/ui/assets/{run-DGB0hXS2.js → run-sHVq3OqC.js} +1 -1
- package/dist/ui/assets/{session-jsonl-C1iwca-E.js → session-jsonl-C9ElI88i.js} +1 -1
- package/dist/ui/assets/{setup-feature-flags-remote-CbzffM1B.js → setup-feature-flags-remote-BSh_mU6y.js} +1 -1
- package/dist/ui/assets/sidecar-repair-6VtC2pRC.js +1 -0
- package/dist/ui/assets/{silent-renew-backoff-gBUL-f53.js → silent-renew-backoff-CjuekGO-.js} +1 -1
- package/dist/ui/assets/{skills-9NWZ7vcj.js → skills-CpYV01Jw.js} +1 -1
- package/dist/ui/assets/slicc-version-C2MGXZHy.js +1 -0
- package/dist/ui/assets/{snapshot-Czf24viR.js → snapshot-BgoHGdsr.js} +1 -1
- package/dist/ui/assets/{snapshot-features-DfvhK1Lt.js → snapshot-features-BsejqdNs.js} +1 -1
- package/dist/ui/assets/{soundscape-BLaJxYcC.js → soundscape-SdyQ7S6X.js} +1 -1
- package/dist/ui/assets/{speak-CAQFQMzh.js → speak-BNF149HW.js} +1 -1
- package/dist/ui/assets/{sprinkle-manager-Buwj_jkg.js → sprinkle-manager-BQ9bl-u3.js} +1 -1
- package/dist/ui/assets/{sprinkle-renderer-BUZzvREL.js → sprinkle-renderer-C2XgIknW.js} +1 -1
- package/dist/ui/assets/{state-MYRT4Xjf.js → state-CjjLrIML.js} +1 -1
- package/dist/ui/assets/{store-CB6g9ei3.js → store-BCLGrVX6.js} +1 -1
- package/dist/ui/assets/{store-BDq6OolL.js → store-CvihM7Jf.js} +1 -1
- package/dist/ui/assets/{sudo-3qFVn_jk.js → sudo-CP0WF_Dt.js} +1 -1
- package/dist/ui/assets/{sync-dialog-DLe5es1y.js → sync-dialog-CKn0kEW6.js} +1 -1
- package/dist/ui/assets/{transformers-env-DZUIAHH5.js → transformers-env--5SUxNdC.js} +1 -1
- package/dist/ui/assets/{tray-sidecar-C7ntovgd.js → tray-sidecar-C23TX8tB.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-D3hzscHI.js → upgrade-detection-D0fM5vOk.js} +1 -1
- package/dist/ui/assets/{voice-reply-g-JL5D2I.js → voice-reply-C3gizSsU.js} +1 -1
- package/dist/ui/assets/{wc-attach-KSgc0h1w.js → wc-attach-b-vJMDha.js} +2 -2
- package/dist/ui/assets/{wc-extension-bo5QJG1Y.js → wc-extension-wIkTNatM.js} +2 -2
- package/dist/ui/assets/{wc-follower-rNFcP2rQ.js → wc-follower-DT45jmiV.js} +3 -3
- package/dist/ui/assets/wc-follower-oauth-Csvs06nc.js +5 -0
- package/dist/ui/assets/{wc-gelatiere-GM9XFlw0.js → wc-gelatiere-CDDK_ZCr.js} +1 -1
- package/dist/ui/assets/{wc-live-DU8Ig125.js → wc-live-B1LBfNoB.js} +5 -5
- package/dist/ui/assets/{wc-nav-CjA4TRbH.js → wc-nav-BjCXV0QO.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-DHIjYBxt.js → wc-onboarding-CavxP4i5.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-B6MYdfoe.js → wc-placeholder-GV6fMR1V.js} +3 -3
- package/dist/ui/assets/{wc-secret-request-Cr4JjH2j.js → wc-secret-request-BxtjrJCp.js} +1 -1
- package/dist/ui/assets/{wc-settings-B0IuZcmh.js → wc-settings-CSc0UPJ_.js} +3 -3
- package/dist/ui/assets/{wc-shell-BxKrLKUy.js → wc-shell-CILjNftp.js} +3 -3
- package/dist/ui/assets/{wc-shortcut-config-VG4rRXQ0.js → wc-shortcut-config-DYsfQDKH.js} +1 -1
- package/dist/ui/assets/{wc-shortcuts-DqTUPTab.js → wc-shortcuts-DQqpU5D0.js} +1 -1
- package/dist/ui/assets/{wc-sprinkles-CJCiFv9X.js → wc-sprinkles-Vk9qAca5.js} +2 -2
- package/dist/ui/assets/{wc-transcript-export-BwmlRSNL.js → wc-transcript-export-BqJCJAA_.js} +2 -2
- package/dist/ui/assets/{wc-tray-Csk1-trz.js → wc-tray-BHCAAGcE.js} +4 -4
- package/dist/ui/assets/welcome-detection-C79dK7H1.js +1 -0
- package/dist/ui/assets/{whisper-session-CSoPKl8n.js → whisper-session-CakRRJzg.js} +2 -2
- package/dist/ui/assets/{xai-grok-DY1YCas3.js → xai-grok-BRFyVzNz.js} +1 -1
- package/dist/ui/assets/{xai-grok-CLJ0EDW2.js → xai-grok-CcjRP0UR.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/ui/packages/webapp/index.html +3 -3
- package/package.json +4 -3
- package/dist/ui/assets/provider-settings-CSEOVhGE.js +0 -1
- package/dist/ui/assets/provider-store-access-CVanUg7C.js +0 -1
- package/dist/ui/assets/provider-store-access-nMfbpDYJ.js +0 -1
- package/dist/ui/assets/sidecar-repair-CXNpjnvd.js +0 -1
- package/dist/ui/assets/slicc-version-uWYg_KNr.js +0 -1
- package/dist/ui/assets/wc-follower-oauth-DUFBBrud.js +0 -5
- package/dist/ui/assets/welcome-detection-CG-n5Lly.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{n as r,t as i}from"./safe-buffer-OLJ0qaLt.js";function a(e,t){if(e.byteLength>=t)return e;if(ArrayBuffer.isView(e)){let n=a(e.buffer,t);return new e.constructor(n,e.byteOffset,t)}let n=typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer;if(e.maxByteLength>t)return n?e.grow(t):e.resize(t),e;if(n){let n=new SharedArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}try{return e.transfer(t)}catch{let n=new ArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}}var o=class extends DataView{constructor(e,t,n){let{buffer:r,byteOffset:i,byteLength:a}=new Uint8Array(e,t,n);super(r,i,a)}};for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(o.prototype,e,{value:()=>{throw ReferenceError(`Do not use DataView methods on a BufferView.`)},writable:!1,enumerable:!1,configurable:!1});var s=class{id;_size;options;regions=[];get size(){return this._size}set size(e){if(e>=this._size){this._size=e;return}this._size=e;for(let t=this.regions.length-1;t>=0;t--){let n=this.regions[t];if(n.offset>=e){this.regions.splice(t,1);continue}let r=e-n.offset;n.data.byteLength>r&&(n.data=n.data.subarray(0,r)),n.ranges=n.ranges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t)}}constructor(e,t,n,r){this.id=e,this._size=t,this.options=n,n.sparse??=!0,n.sparse||this.regions.push({offset:0,data:new Uint8Array(t),ranges:[]}),r?.set(e,this)}collect(){if(!this.options.sparse)return;let{regionGapThreshold:e=4095}=this.options;for(let t=0;t<this.regions.length-1;){let n=this.regions[t],r=this.regions[t+1];if(r.offset-(n.offset+n.data.byteLength)>e){t++;continue}n.ranges.push(...r.ranges),n.ranges.sort((e,t)=>e.start-t.start),n.ranges=n.ranges.reduce((e,t)=>(!e.length||e.at(-1).end<t.start?e.push(t):e.at(-1).end=Math.max(e.at(-1).end,t.end),e),[]),n.data=a(n.data,r.offset+r.data.byteLength),n.data.set(r.data,r.offset-n.offset),this.regions.splice(t+1,1)}}missing(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)&&(i.start>=t||(i.start>e&&n.push({start:e,end:Math.min(i.start,t)}),i.end>e&&(e=Math.max(e,i.end)),e>=t)))break;if(e>=t)break}return e<t&&n.push({start:e,end:t}),n}cached(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)){if(i.start>=t)break;n.push({start:Math.max(e,i.start),end:Math.min(t,i.end)})}}n.sort((e,t)=>e.start-t.start);let r=[];for(let e of n){let t=r.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):r.push(e)}return r}regionAt(e){if(this.regions.length)for(let t of this.regions){if(t.offset>e)break;if(e>=t.offset&&e<t.offset+t.data.byteLength)return t}}add(e,t){let n=t+e.byteLength,r=this.regionAt(t);if(r)return r.data=a(r.data,n),r.data.set(e,t),r.ranges.push({start:t,end:n}),r.ranges.sort((e,t)=>e.start-t.start),this.collect(),this;let i={data:e,offset:t,ranges:[{start:t,end:n}]},o=this.regions.findIndex(e=>e.offset>t);return o==-1?this.regions.push(i):this.regions.splice(o,0,i),this.collect(),this}};const c=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?2197175160^t>>>1:t>>>1;c[e]=t}function l(e){let t=4294967295;for(let n=0;n<e.length;n++)t=t>>>8^c[(t^e[n])&255];return(t^4294967295)>>>0}var u=e(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1),d=class extends u.default{[Symbol.toStringTag]=`List`;constructor(e){super(),e&&this.push(...e)}data=new Set;toSet(){return new Set(this.data)}toArray(){return Array.from(this.data)}toJSON(){return Array.from(this.data)}toString(){return this.join(`,`)}_set(e,t,n=!1){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not set an element outside the bounds of the list`);let r=Array.from(this.data);r.splice(e,+n,t),this.data=new Set(r),this.emit(`update`)}set(e,t){this._set(e,t,!0)}deleteAt(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not delete an element outside the bounds of the list`);this.delete(Array.from(this.data).at(e))}insert(e,t=this.data.size){this._set(t,e,!1)}at(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not access an element outside the bounds of the list`);return Array.from(this.data).at(e)}pop(){let e=Array.from(this.data).pop();return e!==void 0&&this.delete(e),e}push(...e){for(let t of e)this.add(t);return this.data.size}join(e){return Array.from(this.data).join(e)}splice(e,t,...n){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not splice elements outside the bounds of the list`);let r=Array.from(this.data),i=r.splice(e,t,...n);return this.data=new Set(r),this.emit(`update`),i}add(e){return this.data.add(e),this.emit(`update`),this.emit(`add`,e),this}clear(){this.data.clear(),this.emit(`update`)}delete(e){let t=this.data.delete(e);return this.emit(`update`),t}has(e){return this.data.has(e)}get size(){return this.data.size}entries(){return this.toArray().entries()}keys(){return this.toArray().keys()}values(){return this.data.values()}[Symbol.iterator](){return this.data[Symbol.iterator]()}};function f(e,t){let n=Object.entries(e);return Object.fromEntries(n.filter(([e,n])=>t(e,n)))}function p(e,...t){let n={};for(let r of t.flat())n[r]=e[r];return n}function m(e,...t){return f(e,e=>!t.flat().includes(e))}function h(e){try{return JSON.parse(e),!0}catch{return!1}}function g(e){let t=[];for(let n=e;n&&![`Function`,`Object`].includes(n.constructor.name);n=Object.getPrototypeOf(n))t.push(n.constructor.name);return t}function _(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,typeof n==`function`?n.bind(t):n]))}function v(e=Error()){let t=setTimeout(()=>{throw e},5e3);return()=>clearTimeout(t)}function y(e){throw e&&typeof e==`object`&&g(e).includes(`Error`)&&Error?.captureStackTrace(e,y),e}function b(e,t){if(![`getter`,`accessor`].includes(t.kind))throw Error(`@memoize can only be used on getters and auto-accessors`);let n=new WeakMap;function r(){if(n.has(this))return n.get(this);let t=typeof e==`function`?e.call(this):e.get.call(this);return n.set(this,t),t}switch(t.kind){case`getter`:return r;case`accessor`:return{...e,get:r}}}const x=Intl.NumberFormat(`en`,{notation:`compact`});x.format.bind(x);function S(e=0,t=1){return Math.round(Math.random()*(t-e)+e)}function C(e){return e.at(0).toUpperCase()+e.slice(1)}const w=new TextEncoder;function T(e){return w.encode(e)}const ee=new TextDecoder;function te(e){if(!e)return``;if(e.buffer instanceof ArrayBuffer&&!e.buffer.resizable)return ee.decode(e);let t=new Uint8Array(e.byteLength);return t.set(e),ee.decode(t)}function ne(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function re(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function E(e){let t=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function D(e){let t=e.replace(/-/g,``),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return n}var O;(function(e){e[e.EPERM=1]=`EPERM`,e[e.ENOENT=2]=`ENOENT`,e[e.ESRCH=3]=`ESRCH`,e[e.EINTR=4]=`EINTR`,e[e.EIO=5]=`EIO`,e[e.ENXIO=6]=`ENXIO`,e[e.E2BIG=7]=`E2BIG`,e[e.ENOEXEC=8]=`ENOEXEC`,e[e.EBADF=9]=`EBADF`,e[e.ECHILD=10]=`ECHILD`,e[e.EAGAIN=11]=`EAGAIN`,e[e.ENOMEM=12]=`ENOMEM`,e[e.EACCES=13]=`EACCES`,e[e.EFAULT=14]=`EFAULT`,e[e.ENOTBLK=15]=`ENOTBLK`,e[e.EBUSY=16]=`EBUSY`,e[e.EEXIST=17]=`EEXIST`,e[e.EXDEV=18]=`EXDEV`,e[e.ENODEV=19]=`ENODEV`,e[e.ENOTDIR=20]=`ENOTDIR`,e[e.EISDIR=21]=`EISDIR`,e[e.EINVAL=22]=`EINVAL`,e[e.ENFILE=23]=`ENFILE`,e[e.EMFILE=24]=`EMFILE`,e[e.ETXTBSY=26]=`ETXTBSY`,e[e.EFBIG=27]=`EFBIG`,e[e.ENOSPC=28]=`ENOSPC`,e[e.ESPIPE=29]=`ESPIPE`,e[e.EROFS=30]=`EROFS`,e[e.EMLINK=31]=`EMLINK`,e[e.EPIPE=32]=`EPIPE`,e[e.EDOM=33]=`EDOM`,e[e.ERANGE=34]=`ERANGE`,e[e.EDEADLK=35]=`EDEADLK`,e[e.ENAMETOOLONG=36]=`ENAMETOOLONG`,e[e.ENOLCK=37]=`ENOLCK`,e[e.ENOSYS=38]=`ENOSYS`,e[e.ENOTEMPTY=39]=`ENOTEMPTY`,e[e.ELOOP=40]=`ELOOP`,e[e.ENOMSG=42]=`ENOMSG`,e[e.EIDRM=43]=`EIDRM`,e[e.ECHRNG=44]=`ECHRNG`,e[e.EL2NSYNC=45]=`EL2NSYNC`,e[e.EL3HLT=46]=`EL3HLT`,e[e.EL3RST=47]=`EL3RST`,e[e.ENRNG=48]=`ENRNG`,e[e.EUNATCH=49]=`EUNATCH`,e[e.ECSI=50]=`ECSI`,e[e.EL2HLT=51]=`EL2HLT`,e[e.EBADE=52]=`EBADE`,e[e.EBADR=53]=`EBADR`,e[e.EXFULL=54]=`EXFULL`,e[e.ENOANO=55]=`ENOANO`,e[e.EBADRQC=56]=`EBADRQC`,e[e.EBADSLT=57]=`EBADSLT`,e[e.EBFONT=59]=`EBFONT`,e[e.ENOSTR=60]=`ENOSTR`,e[e.ENODATA=61]=`ENODATA`,e[e.ETIME=62]=`ETIME`,e[e.ENOSR=63]=`ENOSR`,e[e.ENONET=64]=`ENONET`,e[e.ENOPKG=65]=`ENOPKG`,e[e.EREMOTE=66]=`EREMOTE`,e[e.ENOLINK=67]=`ENOLINK`,e[e.EADV=68]=`EADV`,e[e.ESRMNT=69]=`ESRMNT`,e[e.ECOMM=70]=`ECOMM`,e[e.EPROTO=71]=`EPROTO`,e[e.EMULTIHOP=72]=`EMULTIHOP`,e[e.EDOTDOT=73]=`EDOTDOT`,e[e.EBADMSG=74]=`EBADMSG`,e[e.EOVERFLOW=75]=`EOVERFLOW`,e[e.ENOTUNIQ=76]=`ENOTUNIQ`,e[e.EBADFD=77]=`EBADFD`,e[e.EREMCHG=78]=`EREMCHG`,e[e.ELIBACC=79]=`ELIBACC`,e[e.ELIBBAD=80]=`ELIBBAD`,e[e.ELIBSCN=81]=`ELIBSCN`,e[e.ELIBMAX=82]=`ELIBMAX`,e[e.ELIBEXEC=83]=`ELIBEXEC`,e[e.EILSEQ=84]=`EILSEQ`,e[e.ERESTART=85]=`ERESTART`,e[e.ESTRPIPE=86]=`ESTRPIPE`,e[e.EUSERS=87]=`EUSERS`,e[e.ENOTSOCK=88]=`ENOTSOCK`,e[e.EDESTADDRREQ=89]=`EDESTADDRREQ`,e[e.EMSGSIZE=90]=`EMSGSIZE`,e[e.EPROTOTYPE=91]=`EPROTOTYPE`,e[e.ENOPROTOOPT=92]=`ENOPROTOOPT`,e[e.EPROTONOSUPPORT=93]=`EPROTONOSUPPORT`,e[e.ESOCKTNOSUPPORT=94]=`ESOCKTNOSUPPORT`,e[e.ENOTSUP=95]=`ENOTSUP`,e[e.EPFNOSUPPORT=96]=`EPFNOSUPPORT`,e[e.EAFNOSUPPORT=97]=`EAFNOSUPPORT`,e[e.EADDRINUSE=98]=`EADDRINUSE`,e[e.EADDRNOTAVAIL=99]=`EADDRNOTAVAIL`,e[e.ENETDOWN=100]=`ENETDOWN`,e[e.ENETUNREACH=101]=`ENETUNREACH`,e[e.ENETRESET=102]=`ENETRESET`,e[e.ECONNABORTED=103]=`ECONNABORTED`,e[e.ECONNRESET=104]=`ECONNRESET`,e[e.ENOBUFS=105]=`ENOBUFS`,e[e.EISCONN=106]=`EISCONN`,e[e.ENOTCONN=107]=`ENOTCONN`,e[e.ESHUTDOWN=108]=`ESHUTDOWN`,e[e.ETOOMANYREFS=109]=`ETOOMANYREFS`,e[e.ETIMEDOUT=110]=`ETIMEDOUT`,e[e.ECONNREFUSED=111]=`ECONNREFUSED`,e[e.EHOSTDOWN=112]=`EHOSTDOWN`,e[e.EHOSTUNREACH=113]=`EHOSTUNREACH`,e[e.EALREADY=114]=`EALREADY`,e[e.EINPROGRESS=115]=`EINPROGRESS`,e[e.ESTALE=116]=`ESTALE`,e[e.EEUCLEAN=117]=`EEUCLEAN`,e[e.ENOTNAM=118]=`ENOTNAM`,e[e.ENAVAIL=119]=`ENAVAIL`,e[e.EISNAM=120]=`EISNAM`,e[e.EREMOTEIO=121]=`EREMOTEIO`,e[e.EDQUOT=122]=`EDQUOT`,e[e.ENOMEDIUM=123]=`ENOMEDIUM`,e[e.EMEDIUMTYPE=124]=`EMEDIUMTYPE`,e[e.ECANCELED=125]=`ECANCELED`,e[e.ENOKEY=126]=`ENOKEY`,e[e.EKEYEXPIRED=127]=`EKEYEXPIRED`,e[e.EKEYREVOKED=128]=`EKEYREVOKED`,e[e.EKEYREJECTED=129]=`EKEYREJECTED`,e[e.EOWNERDEAD=130]=`EOWNERDEAD`,e[e.ENOTRECOVERABLE=131]=`ENOTRECOVERABLE`,e[e.ERFKILL=132]=`ERFKILL`,e[e.EHWPOISON=133]=`EHWPOISON`})(O||={});const k={[O.EPERM]:`operation not permitted`,[O.ENOENT]:`no such file or directory`,[O.ESRCH]:`no such process`,[O.EINTR]:`interrupted system call`,[O.EIO]:`i/o error`,[O.ENXIO]:`no such device or address`,[O.E2BIG]:`argument list too long`,[O.ENOEXEC]:`exec format error`,[O.EBADF]:`bad file descriptor`,[O.ECHILD]:`no child processes`,[O.EAGAIN]:`resource temporarily unavailable`,[O.ENOMEM]:`not enough memory`,[O.EACCES]:`permission denied`,[O.EFAULT]:`bad address in system call argument`,[O.ENOTBLK]:`block device required`,[O.EBUSY]:`resource busy or locked`,[O.EEXIST]:`file already exists`,[O.EXDEV]:`cross-device link not permitted`,[O.ENODEV]:`no such device`,[O.ENOTDIR]:`not a directory`,[O.EISDIR]:`illegal operation on a directory`,[O.EINVAL]:`invalid argument`,[O.ENFILE]:`file table overflow`,[O.EMFILE]:`too many open files`,[O.ETXTBSY]:`text file is busy`,[O.EFBIG]:`file too large`,[O.ENOSPC]:`no space left on device`,[O.ESPIPE]:`invalid seek`,[O.EROFS]:`read-only file system`,[O.EMLINK]:`too many links`,[O.EPIPE]:`broken pipe`,[O.EDOM]:`numerical argument out of domain`,[O.ERANGE]:`result too large`,[O.EDEADLK]:`resource deadlock would occur`,[O.ENAMETOOLONG]:`name too long`,[O.ENOLCK]:`no locks available`,[O.ENOSYS]:`function not implemented`,[O.ENOTEMPTY]:`directory not empty`,[O.ELOOP]:`too many symbolic links encountered`,[O.ENOMSG]:`no message of desired type`,[O.EIDRM]:`identifier removed`,[O.ECHRNG]:`channel number out of range`,[O.EL2NSYNC]:`level 2 not synchronized`,[O.EL3HLT]:`level 3 halted`,[O.EL3RST]:`level 3 reset`,[O.ENRNG]:`link number out of range`,[O.EUNATCH]:`protocol driver not attached`,[O.ECSI]:`no CSI structure available`,[O.EL2HLT]:`level 2 halted`,[O.EBADE]:`invalid exchange`,[O.EBADR]:`invalid request descriptor`,[O.EXFULL]:`exchange full`,[O.ENOANO]:`no anode`,[O.EBADRQC]:`invalid request code`,[O.EBADSLT]:`invalid slot`,[O.EBFONT]:`bad font file format`,[O.ENOSTR]:`device not a stream`,[O.ENODATA]:`no data available`,[O.ETIME]:`timer expired`,[O.ENOSR]:`out of streams resources`,[O.ENONET]:`machine is not on the network`,[O.ENOPKG]:`package not installed`,[O.EREMOTE]:`object is remote`,[O.ENOLINK]:`link has been severed`,[O.EADV]:`advertise error`,[O.ESRMNT]:`srmount error`,[O.ECOMM]:`communication error on send`,[O.EPROTO]:`protocol error`,[O.EMULTIHOP]:`multihop attempted`,[O.EDOTDOT]:`rFS specific error`,[O.EBADMSG]:`bad message`,[O.EOVERFLOW]:`value too large for defined data type`,[O.ENOTUNIQ]:`name not unique on network`,[O.EBADFD]:`file descriptor in bad state`,[O.EREMCHG]:`remote address changed`,[O.ELIBACC]:`can not access a needed shared library`,[O.ELIBBAD]:`accessing a corrupted shared library`,[O.ELIBSCN]:`.lib section in a.out corrupted`,[O.ELIBMAX]:`attempting to link in too many shared libraries`,[O.ELIBEXEC]:`cannot exec a shared library directly`,[O.EILSEQ]:`illegal byte sequence`,[O.ERESTART]:`interrupted system call should be restarted`,[O.ESTRPIPE]:`streams pipe error`,[O.EUSERS]:`too many users`,[O.ENOTSOCK]:`socket operation on non-socket`,[O.EDESTADDRREQ]:`destination address required`,[O.EMSGSIZE]:`message too long`,[O.EPROTOTYPE]:`protocol wrong type for socket`,[O.ENOPROTOOPT]:`protocol not available`,[O.EPROTONOSUPPORT]:`protocol not supported`,[O.ESOCKTNOSUPPORT]:`socket type not supported`,[O.ENOTSUP]:`operation not supported on socket`,[O.EPFNOSUPPORT]:`protocol family not supported`,[O.EAFNOSUPPORT]:`address family not supported`,[O.EADDRINUSE]:`address already in use`,[O.EADDRNOTAVAIL]:`address not available`,[O.ENETDOWN]:`network is down`,[O.ENETUNREACH]:`network is unreachable`,[O.ENETRESET]:`network dropped connection on reset`,[O.ECONNABORTED]:`software caused connection abort`,[O.ECONNRESET]:`connection reset by peer`,[O.ENOBUFS]:`no buffer space available`,[O.EISCONN]:`socket is already connected`,[O.ENOTCONN]:`socket is not connected`,[O.ESHUTDOWN]:`cannot send after transport endpoint shutdown`,[O.ETOOMANYREFS]:`too many references: cannot splice`,[O.ETIMEDOUT]:`connection timed out`,[O.ECONNREFUSED]:`connection refused`,[O.EHOSTDOWN]:`host is down`,[O.EHOSTUNREACH]:`host is unreachable`,[O.EALREADY]:`connection already in progress`,[O.EINPROGRESS]:`operation now in progress`,[O.ESTALE]:`stale file handle`,[O.EEUCLEAN]:`structure needs cleaning`,[O.ENOTNAM]:`not a XENIX named type file`,[O.ENAVAIL]:`no XENIX semaphores available`,[O.EISNAM]:`is a named type file`,[O.EREMOTEIO]:`remote I/O error`,[O.EDQUOT]:`disk quota exceeded`,[O.ENOMEDIUM]:`no medium found`,[O.EMEDIUMTYPE]:`wrong medium type`,[O.ECANCELED]:`operation canceled`,[O.ENOKEY]:`required key not available`,[O.EKEYEXPIRED]:`key has expired`,[O.EKEYREVOKED]:`key has been revoked`,[O.EKEYREJECTED]:`key was rejected by service`,[O.EOWNERDEAD]:`owner died`,[O.ENOTRECOVERABLE]:`state not recoverable`,[O.ERFKILL]:`operation not possible due to RF-kill`,[O.EHWPOISON]:`memory page has hardware error`};function A(e){let t=`${e.code}: ${k[e.errno]}, ${e.syscall}`;e.path&&(t+=` '${e.path}'`),e.dest&&(t+=` -> '${e.dest}'`);let n=e.message.startsWith(k[e.errno])||/^E[A-Z0-9]+: /.test(e.message);return e.message&&!n&&(t+=` (${e.message})`),e.message=t,e}var j=class e extends Error{errno;code;path;dest;syscall;constructor(e,t,n={}){let r=O[e];super(t||``),this.errno=e,this.code=r,Object.assign(this,m(n,`message`)),t||A(this),Error.captureStackTrace?.(this,this.constructor)}toString(){return this.message}toJSON(){let e={errno:this.errno,code:this.code,stack:this.stack,message:this.message};return this.path&&(e.path=this.path),this.dest&&(e.dest=this.dest),this.syscall&&(e.syscall=this.syscall),e}static fromJSON(t){let n=t.syscall?new e(t.errno,!1,t):new e(t.errno,t.message);return n.stack=t.stack,n}};function M(e,t,n,r){typeof t==`string`&&(t={syscall:t,path:n,dest:r});let i=new j(O[e],!1,t??{});return Error.captureStackTrace?.(i,M),i}function N(e,t){let n=new j(O[e],t??k[O[e]]);return Error.captureStackTrace?.(n,N),n}function P(e,t,n){let r=typeof e==`string`?{syscall:e}:e;return t&&(r.path=t),n&&(r.dest=n),function(e){throw Object.assign(e,r),A(e),e}}var ie=t({Level:()=>F,alert:()=>le,configure:()=>De,crit:()=>ue,debug:()=>pe,deprecated:()=>me,emerg:()=>ce,entries:()=>L,err:()=>R,fancy:()=>ye,format:()=>xe,info:()=>fe,isEnabled:()=>Ee,levelOf:()=>ae,levels:()=>I,log:()=>oe,notice:()=>de,warn:()=>z}),F;(function(e){e[e.EMERG=0]=`EMERG`,e[e.ALERT=1]=`ALERT`,e[e.CRIT=2]=`CRIT`,e[e.ERR=3]=`ERR`,e[e.WARN=4]=`WARN`,e[e.NOTICE=5]=`NOTICE`,e[e.INFO=6]=`INFO`,e[e.DEBUG=7]=`DEBUG`})(F||={});const I=[`emergency`,`alert`,`critical`,`error`,`warning`,`notice`,`info`,`debug`];function ae(e){return I.indexOf(e)}const L=new d;function oe(e,t){if(!Ee)return;let n={level:e,message:t,timestamp:new Date,elapsedMs:performance.now()};if(L.size>=1e4){let e=L.values().next().value;e!==void 0&&L.delete(e)}L.add(n),Ce(n)}function se(e){return function(t){return oe(e,t.toString()),t}}const ce=se(F.EMERG),le=se(F.ALERT),ue=se(F.CRIT),R=se(F.ERR),z=se(F.WARN),de=se(F.NOTICE),fe=se(F.INFO),pe=se(F.DEBUG);function me(e){oe(F.WARN,e+` is deprecated and should not be used.`)}function he(e,t){return`\x1b[${t}m${e}\x1b[0m`}function ge(e){return`[`+(e.elapsedMs/1e3).toFixed(3).padStart(10)+`] `}const _e={ansi:{[F.EMERG]:`1;4;37;41`,[F.ALERT]:`1;37;41`,[F.CRIT]:`1;35`,[F.ERR]:`1;31`,[F.WARN]:`1;33`,[F.NOTICE]:`1;36`,[F.INFO]:`1;37`,[F.DEBUG]:`0;2;37`},css:{[F.EMERG]:`font-weight: bold; text-decoration: underline; color: white; background-color: red;`,[F.ALERT]:`font-weight: bold; color: white; background-color: red;`,[F.CRIT]:`font-weight: bold; color: magenta;`,[F.ERR]:`font-weight: bold; color: red;`,[F.WARN]:`font-weight: bold; color: yellow;`,[F.NOTICE]:`font-weight: bold; color: cyan;`,[F.INFO]:`font-weight: bold; color: white;`,[F.DEBUG]:`opacity: 0.8; color: white;`}},ve={ansi:{[F.EMERG]:`1;31`,[F.ALERT]:`1;31`,[F.CRIT]:`1;31`,[F.ERR]:`31`,[F.WARN]:`33`,[F.NOTICE]:`1;37`,[F.INFO]:`37`,[F.DEBUG]:`2;37`},css:{[F.EMERG]:`font-weight: bold; color: red;`,[F.ALERT]:`font-weight: bold; color: red;`,[F.CRIT]:`font-weight: bold; color: red;`,[F.ERR]:`color: red;`,[F.WARN]:`color: yellow;`,[F.NOTICE]:`font-weight: bold; color: white;`,[F.INFO]:`color: white;`,[F.DEBUG]:`opacity: 0.8; color: white;`}};function ye({style:e,colorize:t}){return function*(n){e==`css`&&(yield t==`level`?`%c%s %c%s`:`%c%s %c%s%s %c%s`),yield*e==`ansi`?[he(ge(n),`2;37`)]:[`opacity: 0.8; color: white;`,ge(n)];let r=e==`ansi`?[he(I[n.level].toUpperCase(),_e.ansi[n.level])]:[_e.css[n.level],I[n.level].toUpperCase()];if(t==`level`){yield*r,yield n.message;return}n.level<F.CRIT&&(yield*r),e==`ansi`?yield he(n.message,ve.ansi[n.level]):yield*[ve.css[n.level],n.message]}}let be=e=>[ge(e),e.message];function xe(e){let t=be(e);return typeof t==`string`?[t]:Array.from(t)}let Se=console.error;function Ce(e){e.level>we||Se(...xe(e))}let we=F.ALERT,Te=!1,Ee=!0;function De(e){if(be=e.format??be,Se=e.output??Se,we=typeof e.level==`string`?ae(e.level):e.level??we,Ee=e.enabled??Ee,Te=e.stack??Te,e.dumpBacklog)for(let e of L)Ce(e)}function Oe(e){return typeof e==`object`&&!!e&&`create`in e&&typeof e.create==`function`}function ke(e,t){return Object.defineProperty(t,"prototype",{value:void 0}),e&&Object.defineProperty(t,"name",{value:e}),t}function Ae(e){return!(e&&e.constructor===Function)||e.prototype===void 0?!1:Function.prototype!==Object.getPrototypeOf(e)||Object.getOwnPropertyNames(e.prototype).length>1}function je(e,t){if(typeof t!=`object`||!t)throw R(N(`EINVAL`,`Invalid options`));for(let[n,r]of Object.entries(e.options)){let e=t?.[n];if(e==null){if(!r.required){pe(`Using default for option: `+n);continue}throw R(N(`EINVAL`,`Missing required option: `+n))}let i=(t,n=e)=>typeof t==`function`?Ae(t)?e instanceof t:t(e):typeof e===t||e?.constructor?.name===t;if(Array.isArray(r.type)?r.type.some(e=>i(e)):i(r.type))continue;let a=typeof e==`object`&&`constructor`in e?e.constructor.name:typeof e,o=e=>typeof e==`function`?e.name==`type`?e.toString():e.name:e,s=Array.isArray(r.type)?`one of ${r.type.map(o).join(`, `)}`:o(r.type);throw R(N(`EINVAL`,`Incorrect type for "${n}": ${a} (expected ${s})`))}}function Me(e){return typeof e==`object`&&!!e&&`backend`in e&&Oe(e.backend)}function Ne(e){return{suid:e.uid,sgid:e.gid,euid:e.uid,egid:e.gid,groups:[],...e}}function Pe(e){return e?!e.uid||!e.gid||!e.euid||!e.egid||e.groups.some(e=>!e):!1}const Fe=Symbol(`ZenFSContext`);function Ie(e){return typeof e==`object`&&!!e&&Fe in e}function Le(e){if(!Ie(e))throw z(N(`EINVAL`,`Invalid context provided`))}const Re={[Fe]:!0,id:1,root:`/`,pwd:`/`,credentials:Ne({uid:0,gid:0}),descriptors:new Map,parent:null,children:[],mounts:new Map};function ze(e){return Ie(e)?e:Re}let Be=2;function Ve(e,t={}){Le(e);let{root:n=e.root,pwd:r=e.pwd,credentials:i=structuredClone(e.credentials),mounts:a=Object.fromEntries(e.mounts)}=t,o={[Fe]:!0,id:Be++,root:n,pwd:r,credentials:Ne(i),descriptors:new Map,parent:e,children:[],mounts:new Map(Object.entries(a))};return Object.defineProperties(o,{id:{configurable:!1,writable:!1},credentials:{configurable:!1,writable:!1},descriptors:{configurable:!1,writable:!1},parent:{configurable:!1,writable:!1},children:{configurable:!1,writable:!1}}),o}var He=t({COPYFILE_EXCL:()=>1,COPYFILE_FICLONE:()=>2,COPYFILE_FICLONE_FORCE:()=>4,F_OK:()=>0,O_APPEND:()=>Ue,O_CREAT:()=>64,O_DIRECT:()=>Xe,O_DIRECTORY:()=>We,O_DSYNC:()=>Je,O_EXCL:()=>128,O_NOATIME:()=>Ge,O_NOCTTY:()=>256,O_NOFOLLOW:()=>Ke,O_NONBLOCK:()=>Ze,O_RDONLY:()=>0,O_RDWR:()=>2,O_SYMLINK:()=>Ye,O_SYNC:()=>qe,O_TRUNC:()=>512,O_WRONLY:()=>1,R_OK:()=>4,S_IFBLK:()=>nt,S_IFCHR:()=>it,S_IFDIR:()=>rt,S_IFIFO:()=>at,S_IFLNK:()=>et,S_IFMT:()=>Qe,S_IFREG:()=>tt,S_IFSOCK:()=>$e,S_IRGRP:()=>32,S_IROTH:()=>4,S_IRUSR:()=>256,S_IRWXG:()=>56,S_IRWXO:()=>7,S_IRWXU:()=>448,S_ISGID:()=>st,S_ISUID:()=>ot,S_ISVTX:()=>512,S_IWGRP:()=>16,S_IWOTH:()=>2,S_IWUSR:()=>128,S_IXGRP:()=>8,S_IXOTH:()=>1,S_IXUSR:()=>64,UV_FS_O_FILEMAP:()=>0,W_OK:()=>2,X_OK:()=>1,size_max:()=>ct});const Ue=1024,We=65536,Ge=262144,Ke=131072,qe=1052672,Je=4096,Ye=32768,Xe=16384,Ze=2048,Qe=61440,$e=49152,et=40960,tt=32768,nt=24576,rt=16384,it=8192,at=4096,ot=2048,st=1024,ct=4294967295;function lt(e){return`__isArrayType`in e&&e.__isArrayType===!0}function ut(e){return typeof e!=`object`&&typeof e!=`function`||e==null?!1:lt(e)?ut(e.type):`name`in e&&`size`in e&&`get`in e&&`set`in e&&typeof e.name==`string`&&typeof e.size==`number`&&typeof e.get==`function`&&typeof e.set==`function`&&dt.has(e.name)&&dt.get(e.name)?.name===e.name}const dt=new Map;function ft(e){if(dt.has(e.name))throw ReferenceError(`Type is already registered: ${e.name}`);dt.set(e.name,e)}const pt=Symbol(`DataView`);function mt(e){return e[pt]??=new DataView(e),e[pt]}const ht={name:`int8`,size:1,array:Int8Array,get:(e,t)=>mt(e).getInt8(t),set:(e,t,n)=>mt(e).setInt8(t,n)},gt={name:`uint8`,size:1,array:Uint8Array,get:(e,t)=>mt(e).getUint8(t),set:(e,t,n)=>mt(e).setUint8(t,n)},_t={int8:ht,uint8:gt,int16:{name:`int16`,size:2,array:Int16Array,get:(e,t)=>mt(e).getInt16(t,!0),set:(e,t,n)=>mt(e).setInt16(t,n,!0)},uint16:{name:`uint16`,size:2,array:Uint16Array,get:(e,t)=>mt(e).getUint16(t,!0),set:(e,t,n)=>mt(e).setUint16(t,n,!0)},int32:{name:`int32`,size:4,array:Int32Array,get:(e,t)=>mt(e).getInt32(t,!0),set:(e,t,n)=>mt(e).setInt32(t,n,!0)},uint32:{name:`uint32`,size:4,array:Uint32Array,get:(e,t)=>mt(e).getUint32(t,!0),set:(e,t,n)=>mt(e).setUint32(t,n,!0)},int64:{name:`int64`,size:8,array:BigInt64Array,get:(e,t)=>mt(e).getBigInt64(t,!0),set:(e,t,n)=>mt(e).setBigInt64(t,n,!0)},uint64:{name:`uint64`,size:8,array:BigUint64Array,get:(e,t)=>mt(e).getBigUint64(t,!0),set:(e,t,n)=>mt(e).setBigUint64(t,n,!0)},float32:{name:`float32`,size:4,array:Float32Array,get:(e,t)=>mt(e).getFloat32(t,!0),set:(e,t,n)=>mt(e).setFloat32(t,n,!0)},float64:{name:`float64`,size:8,array:Float64Array,get:(e,t)=>mt(e).getFloat64(t,!0),set:(e,t,n)=>mt(e).setFloat64(t,n,!0)}},vt=Object.keys(_t);for(let e of Object.values(_t))ft(e);const yt={..._t,...Object.fromEntries(vt.map(e=>[C(e),_t[e]])),char:gt},bt=Object.keys(yt);function xt(e){return bt.includes(e.toString())}function St(e){if(!xt(e))throw N(`EINVAL`,`Not a valid primitive type: `+e)}function Ct(e){return e==`char`?`uint8`:e.toLowerCase()}function wt(e){return(typeof e==`object`||typeof e==`function`)&&e!==null&&`toInit`in e&&typeof e.toInit==`function`}function Tt(e){return wt(e)?e.toInit():ut(e)?{type:e}:e}function Et(e,t,n={}){if(!e)throw N(`EINVAL`,`Invalid name for struct field`);typeof e==`symbol`&&console.warn(`Symbol used for struct field name will be coerced to string: `+e.toString());let r=e.toString(),i=Object.assign(Tt(t),n);if(!ut(i.type))throw N(`EINVAL`,`Invalid type for struct field "${r}"`);let a=i.countedBy?` counted_by(${typeof i.countedBy==`string`?i.countedBy:`<function>`})`:``;return{name:r,offset:0,type:i.type,countedBy:i.countedBy,alignment:i.align??i.type.size,decl:i.type instanceof Jt?`${i.typeName??i.type.type.name} ${r}[${i.type.length}]${a}`:`${i.typeName??i.type.name} ${r}`,littleEndian:!i.bigEndian}}function Dt(e,t){if(!(e instanceof Error)||e.message.toLowerCase()!==`offset is outside the bounds of the dataview`)throw e;let n=N(`EFAULT`,`Segmentation fault (at 0x${t.toString(16)})`);throw Error.captureStackTrace(n,Dt),n}function Ot(e,t){return t.type instanceof Jt&&t.type.length==0&&!!t.countedBy?.length&&!!e.constructor.isDynamic}function kt(e,t){let n=typeof t.countedBy==`function`?t.countedBy(e):e[t.countedBy];if(typeof n==`bigint`){if(n>BigInt(2**53-1))throw N(`EOVERFLOW`,`countedBy field value exceeds max safe integer`);n=Number(n)}if(typeof n!=`number`)throw N(`EINVAL`,`countedBy field value is not a number`);return n}function At(e,t){let n=t.type.type.size*kt(e,t);if(Ht(t.type.type)&&t.type.type.isDynamic)for(let r of e[t.name])n+=Ut(r);return n}const jt=Symbol(`kOffsets`),Mt=Symbol(`kStaticLayout`);function Nt(e){if(e[Mt]!==void 0)return e[Mt];let t=!e.isDynamic;if(t)for(let n of e.fields){let e=n.type;for(;e instanceof Jt;)e=e.type;if(Ht(e)&&e.isDynamic){t=!1;break}}return Object.defineProperty(e,Mt,{value:t,configurable:!0}),t}function Pt(e,t,n){if(Nt(e.constructor))return t.offset;let{offset:r,name:i}=t;e[jt]||=Object.create(null);let a=e[jt];if(a[i]!==void 0){if(n)return a[i];delete a[i]}let{fields:o}=e.constructor,s=o.indexOf(t);for(let t of o.slice(0,s)){Ot(e,t)&&(r+=At(e,t));let n=e[t.name];Vt(n)&&n.constructor.isDynamic&&(r+=Ut(n))}if(n)a[i]=r;else for(let e of o.slice(s))a[e.name]!==void 0&&delete a[e.name];return r}function Ft(e,t,n,r){typeof n==`string`&&(n=n.charCodeAt(0));let i=e.byteOffset+Pt(e,t,!1)+(r??0)*t.type.size;try{t.type.set(e.buffer,i,n);return}catch(e){Dt(e,i)}}const It=Symbol(`kDescriptors`);function Lt(e){if(Object.hasOwn(e,It))return e[It];let t={};for(let n of e.fields)t[n.name]={enumerable:!0,configurable:!0,get(){return Bt(this,n)},set(e){Ft(this,n,e)}};return Object.defineProperty(e,It,{value:t,configurable:!0}),t}function Rt(e){Object.defineProperties(e.prototype,Lt(e))}const zt=Symbol(`kViews`);function Bt(e,t){let n=t.type,r=Ot(e,t);if(r){let r=t.type.type;n=new Jt(r,kt(e,t))}let i=!r&&(n instanceof Jt||Ht(n))&&Nt(e.constructor);if(i){let n=e[zt]??=Object.create(null);if(n[t.name]!==void 0)return n[t.name]}let a=e.byteOffset+Pt(e,t,!0);try{let r=n.get(e.buffer,a);return i&&(e[zt][t.name]=r),r}catch(e){Dt(e,a)}}function Vt(e){return typeof e==`object`&&!!e&&`constructor`in e&&Ht(e.constructor)}function Ht(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&ut(e)}function Ut(e){let t=0;for(let n of e.constructor.fields){let r=e[n.name];Ot(e,n)&&(t+=At(e,n)),Vt(r)&&r.constructor.isDynamic&&(t+=Ut(r))}return t}function Wt(e){if(ut(e))return e.size;if(e==null)return 0;if(typeof e==`object`&&ut(e.constructor))return e.constructor.size;if(Array.isArray(e)){let t=0;for(let n=0;n<e.length;n++)t+=Wt(e[n]);return t}if(typeof e==`string`)return St(e),_t[Ct(e)].size;throw TypeError(`Unable to resolve size of \`${e.toString()}\``)}function B(e){let t=Wt(e);return Vt(e)&&e.constructor.isDynamic?t+Ut(e):t}function Gt(e,t){let n;if(Ht(e)){if(e.isDynamic)throw N(`EINVAL`,`Cannot get offset of field in dynamic struct from the constructor`);n=e}else if(Vt(e))n=e.constructor;else throw N(`EINVAL`,`Type is not a struct or struct constructor`);let{fields:r}=n,i=r.find(e=>e.name===t);if(!i)throw N(`EINVAL`,`Struct does not have field: `+t);return Ht(e)?i.offset:Pt(e,i,!0)}function Kt(e,t){class n extends DataView{length;type=e;*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this[e]}_offsets=[0];offsetOf(t){if(!e.isDynamic)return t*e.size;if(t<this._offsets.length)return this._offsets[t];for(let n=this._offsets.length;n<=t;n++)this._offsets[n]=this._offsets[n-1]+B(e.get(this.buffer,this.byteOffset+this._offsets[n-1]));return this._offsets[t]}constructor(n,r,i){let a=typeof n==`object`?n:new ArrayBuffer((n??0)*e.size);super(a,r,i),this.length=typeof n==`number`?n:e.isDynamic?t??y(`Unknown length of StructArray<${e.name}>`):Math.floor(this.byteLength/e.size);let o=e=>this.byteOffset+this.offsetOf(e),s=qt(e)&&!e.isDynamic?[]:void 0;return new Proxy(this,{get(t,n){if(n in t)return t[n];let r=parseInt(n.toString());if(Number.isSafeInteger(r))return s?s[r]??=e.get(t.buffer,o(r)):e.get(t.buffer,o(r))},set(t,n,r){let i=parseInt(n.toString());return Number.isSafeInteger(i)?(e.set(t.buffer,o(i),r),!0):!1}})}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(n.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return n}function qt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&ut(e)}var Jt=class{type;length;name;size;__structArray;__arrayType;__isArrayType=!0;constructor(e,t){this.type=e,this.length=t,this.name=`${e.name}[${t}]`,this.size=e.size*t,this.array=Kt(this),this.__structArray=Kt(e,t),this.__arrayType=e.array?e.array:this.__structArray}get=(e,t)=>xt(this.type.name)&&t%this.type.size!==0?new this.__structArray(e,t,this.size):new this.__arrayType(e,t,this.size);set=(e,t,n)=>{if(this.length)for(let r=0;r<this.length;r++)this.type.set(e,t+r*this.type.size,n[r]);else{let r=t;for(let t=0;t<n.length;t++)this.type.set(e,r,n[t]),r+=qt(this.type)&&this.type.isDynamic?B(n[t]):this.type.size}};array};Symbol.metadata??=Symbol.for(`Symbol.metadata`);function Yt(e){e.metadata??={};let t=e.metadata.structInit??{};return e.metadata.structInit={fields:[...t.fields??[]]},e.metadata.structInit}function Xt(...e){let t=e.reduce((e,t)=>({...e,...t}),{});return typeof this==`object`&&Object.assign(t,this),function(e,n){let r=Yt(n),i=1,a=[],o=0,s=e=>{o=Math.ceil(o/e)*e};for(let e of r.fields)t.isPacked||s(e.alignment),t.isUnion?o=Math.max(o,e.type.size):(e.offset=o,o+=e.type.size),a.push(e),i=Math.max(i,e.alignment);t.alignment??=i,t.isPacked||s(t.alignment);class c extends e{static name=e.name;static size=o;static alignment=t.alignment;static isUnion=!!t.isUnion;static isDynamic=!!t.isDynamic;static fields=a;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e.name}]`;constructor(...e){e.length||(e=[new ArrayBuffer(o),0,o]),super(...e),t.fastFields||Object.defineProperties(this,Lt(this.constructor))}}return Rt(c),n.addInitializer(function(){Object.defineProperty(c,"name",{value:e.name}),ft(c)}),c}}Xt.packed=Xt.bind({isPacked:!0}),Xt.align=function(e){return Xt.bind({alignment:e})};function Zt(e,t={}){return function(n,r){if(r.kind!=`accessor`)throw N(`EINVAL`,`Field must be an accessor`);let i=Yt(r),a=Et(r.name,e,t);return i.fields.push(a),{get(){return Bt(this,a)},set(e){Ft(this,a,e)}}}}function Qt(e){let t=_t[Ct(e)];function n(n,r){return typeof n==`number`?Zt(new Jt(t,n),{typeName:e,...r}):Zt(t,{typeName:e})(n,r&&`name`in r?r:y(N(`EINVAL`,`Invalid decorator context object`)))}return n}const V=Object.fromEntries(bt.map(e=>[e,Qt(e)]));function $t(e){return e}$t.typed=function(e){return e};var en=class e{type;init;constructor(t,n){this.type=t,this.init=n;let r=(r=>new e(new Jt(t,r),n));return Object.setPrototypeOf(r,new.target.prototype),Object.assign(r,{type:t,init:n}),r}align(t){return new e(this.type,{...this.init,align:t})}countedBy(t){return new e(this.type,{...this.init,countedBy:t})}bigEndian(){return new e(this.type,{...this.init,bigEndian:!0})}toInit(){return{type:this.type,...this.init}}$type(){return new e(this.type,this.init)}};function tn(e,t=0){return new en(new Jt(e,t),{})}function nn(e,t,...n){let r=n.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(r,this);let i=1,a=0,o=e=>{a=Math.ceil(a/e)*e},s=[];for(let[e,n]of Object.entries(t)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let t=Et(e,n);r.isPacked||o(t.alignment),r.isUnion?a=Math.max(a,t.type.size):(t.offset=a,a+=t.type.size),s.push(t),i=Math.max(i,t.alignment)}r.alignment??=i,r.isPacked||o(r.alignment);class c extends DataView{static name=e;static size=a;static alignment=r.alignment;static isUnion=!!r.isUnion;static isDynamic=!!r.isDynamic;static fields=s;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e}]`;constructor(e=new ArrayBuffer(a),t,n){super(e,t,n??e.byteLength-(t??0)),r.fastFields||Object.defineProperties(this,Lt(this.constructor))}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(c.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return Rt(c),ft(c),c}nn.extend=function(e,t,n,...r){let i=r.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(i,this);let a=1,o=e.size,s=e=>{o=Math.ceil(o/e)*e},c=[...e.fields];for(let[e,t]of Object.entries(n)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let n=Et(e,t);i.isPacked||s(n.alignment),i.isUnion?o=Math.max(o,n.type.size):(n.offset=o,o+=n.type.size),c.push(n),a=Math.max(a,n.alignment)}i.alignment??=a,i.isPacked||s(i.alignment);class l extends e{static name=t;static size=o;static alignment=i.alignment;static isUnion=!!i.isUnion;static isDynamic=!!i.isDynamic;static fields=c;static[Symbol.toStringTag]=`[struct ${t}]`}return Rt(l),ft(l),l},nn.packed=nn.bind({isPacked:!0}),nn.align=function(e){return nn.bind({alignment:e})},nn.dynamic=nn.bind({isDynamic:!0}),Object.fromEntries(Object.entries(yt).map(([e,t])=>[e,new en(t,{typeName:e})]));function rn(e){return JSON.parse(te(e),(e,t)=>e==``?t:typeof t==`string`?BigInt(t).toString(16).slice(0,Math.min(t.length,8)):t)}function an(e){return T(JSON.stringify(e))}function on(e,t){if(typeof e==`number`)return e;if(typeof e==`string`){let t=parseInt(e,8);if(!isNaN(t))return t}if(typeof t==`number`)return t;throw N(`EINVAL`,`Invalid mode: `+e?.toString())}const sn=2147483647;function cn(e){if(!(Number.isInteger(e)&&e>=0&&e<=sn))throw Object.assign(RangeError(`The value of "fd" is out of range. It must be >= 0 && <= ${sn}. Received ${e}`),{code:`ERR_OUT_OF_RANGE`})}function ln(e){let{code:t}=e??{};return t==`ENOENT`||t==`ENOTDIR`}function un(e){if(e instanceof Date)return e.getTime();let t=Number(e);if(!Number.isFinite(t))throw N(`EINVAL`,`Invalid time.`);return t<0?Date.now():t*1e3}function H(e,t=!1){if(e instanceof URL){if(e.protocol!=`file:`)throw N(`EINVAL`,`URLs must use the file: protocol`);e=e.pathname}if(e=e.toString(),e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`\0`))throw N(`EINVAL`,`Path can not contain null character`);if(e.length==0)throw N(`EINVAL`,`Path can not be empty`);return e=e.replaceAll(/[/\\]+/g,`/`),t?e:bn.call(this,e)}function dn(e,t=`utf8`,n,r=0){return typeof e!=`object`||!e?{encoding:typeof e==`string`?e:t??null,flag:n,mode:r}:{encoding:typeof e?.encoding==`string`?e.encoding:t??null,flag:typeof e?.flag==`string`?e.flag:n,mode:on(`mode`in e?e?.mode:null,r)}}function fn(e){let t=`\0GS\0`;return e=e.replace(/\*\*/g,t).replace(/\*/g,`\0S\0`).replace(/[.+^$(){}|[\]\\]/g,`\\$&`).replace(/\?/g,`.`).replaceAll(`/\0GS\0/`,`(?:/.*)?/`).replaceAll(t,`.*`).replaceAll(`\0S\0`,`[^/]*`),RegExp(`^${e}$`)}async function pn(e){let t=Promise.withResolvers();setTimeout(()=>t.reject(N(`ETIMEDOUT`)),500),e.on(`online`,t.resolve),await t.promise}function mn(e){return`${H(e,!0)}${Date.now()}-${Math.random().toString(36).slice(2)}`}function hn(){if(`Temporal`in globalThis&&globalThis.Temporal!==void 0)return globalThis.Temporal;throw N(`ENOTSUP`,`Temporal is not supported by this runtime`)}var gn=t({basename:()=>wn,dirname:()=>W,extname:()=>Tn,format:()=>En,formatExt:()=>yn,isAbsolute:()=>Sn,join:()=>U,matchesGlob:()=>On,normalize:()=>xn,normalizeString:()=>vn,parse:()=>Dn,relative:()=>Cn,resolve:()=>bn,sep:()=>`/`});function _n(e,t){if(typeof e!=`object`)throw TypeError(`"${t}" is not an object`)}function vn(e,t){let n=``,r=0,i=-1,a=0,o=`\0`;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o==`/`)break;else o=`/`;if(o==`/`){if(i!==s-1&&a!==1){if(a===2){if(n.length<2||r!==2||n.at(-1)!==`.`||n.at(-2)!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}if(n.length!==0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1}i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function yn(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}function bn(...e){let t=``;for(let n of[...e.reverse(),ze(this).pwd])if(n?.length&&(t=`${n}/${t}`,n.startsWith(`/`)))break;let n=t.startsWith(`/`);return t=vn(t,!n),n?`/${t}`:t.length?t:`/`}function xn(e){if(!e.length)return`.`;let t=e[0]===`/`,n=e.at(-1)===`/`;return e=vn(e,!t),e.length?(n&&(e+=`/`),t?`/${e}`:e):t?`/`:n?`./`:`.`}function Sn(e){return e.startsWith(`/`)}function U(...e){if(!e.length)return`.`;let t=e.filter(e=>e).join(`/`);return t?.length?xn(t):`.`}function Cn(e,t){if(e===t||(e=bn.call(this,e),t=bn.call(this,t),e===t))return``;let n=e.length,r=n-1,i=t.length-1,a=r<i?r:i,o=-1,s=0;for(;s<a;s++){let n=e[1+s];if(n!==t[1+s])break;n===`/`&&(o=s)}if(s===a){if(i>a){if(t[1+s]===`/`)return t.slice(1+s+1);if(s===0)return t.slice(1+s)}else r>a&&(e[1+s]===`/`?o=s:s===0&&(o=0))}let c=``;for(s=1+o+1;s<=n;++s)(s===n||e[s]===`/`)&&(c+=c.length===0?`..`:`/..`);return`${c}${t.slice(1+o)}`}function W(e){if(e.length===0)return`.`;let t=e[0]===`/`,n=-1,r=!0;for(let t=e.length-1;t>=1;--t)if(e[t]===`/`){if(!r){n=t;break}}else r=!1;return n===-1?t?`/`:`.`:t&&n===1?`//`:e.slice(0,n)}function wn(e,t){let n=0,r=-1,i=!0;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t===e)return``;let a=t.length-1,o=-1;for(let s=e.length-1;s>=0;--s)if(e[s]===`/`){if(!i){n=s+1;break}}else o===-1&&(i=!1,o=s+1),a>=0&&(e[s]===t[a]?--a===-1&&(r=s):(a=-1,r=o));return n===r?r=o:r===-1&&(r=e.length),e.slice(n,r)}for(let t=e.length-1;t>=0;--t)if(e[t]===`/`){if(!i){n=t+1;break}}else r===-1&&(i=!1,r=t+1);return r===-1?``:e.slice(n,r)}function Tn(e){let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){if(e[o]===`/`){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),e[o]===`.`?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)}function En(e){_n(e,`pathObject`);let t=e.dir||e.root,n=e.base||`${e.name||``}${yn(e.ext)}`;return t?t===e.root?`${t}${n}`:`${t}/${n}`:n}function Dn(e){let t=e[0]===`/`,n={root:t?`/`:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return n;let r=+!!t,i=-1,a=0,o=-1,s=!0,c=e.length-1,l=0;for(;c>=r;--c){if(e[c]===`/`){if(!s){a=c+1;break}continue}o===-1&&(s=!1,o=c+1),e[c]===`.`?i===-1?i=c:l!==1&&(l=1):i!==-1&&(l=-1)}if(o!==-1){let r=a===0&&t?1:a;i===-1||l===0||l===1&&i===o-1&&i===a+1?n.base=n.name=e.slice(r,o):(n.name=e.slice(r,i),n.base=e.slice(r,o),n.ext=e.slice(i,o))}return a>0?n.dir=e.slice(0,a-1):t&&(n.dir=`/`),n}function On(e,t){return fn(e).test(t)}const kn=BigInt(1e6);var An=class{_convert(e){return this._isBigint?BigInt(e):Number(e)}get blocks(){return this._convert(Math.ceil(Number(this.size)/512))}set blocks(e){}mode;dev=this._convert(0);ino=this._convert(0);rdev=this._convert(0);nlink=this._convert(1);blksize=this._convert(4096);uid=this._convert(0);gid=this._convert(0);atimeMs;get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}get atimeInstant(){return hn().Instant.fromEpochMilliseconds(Number(this.atimeMs))}set atimeInstant(e){this.atimeMs=this._convert(e.epochMilliseconds)}mtimeMs;get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}get mtimeInstant(){return hn().Instant.fromEpochMilliseconds(Number(this.mtimeMs))}set mtimeInstant(e){this.mtimeMs=this._convert(e.epochMilliseconds)}ctimeMs;get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}get ctimeInstant(){return hn().Instant.fromEpochMilliseconds(Number(this.ctimeMs))}set ctimeInstant(e){this.ctimeMs=this._convert(e.epochMilliseconds)}birthtimeMs;get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}get birthtimeInstant(){return hn().Instant.fromEpochMilliseconds(Number(this.birthtimeMs))}set birthtimeInstant(e){this.birthtimeMs=this._convert(e.epochMilliseconds)}size;data;flags;version;constructor({atimeMs:e,mtimeMs:t,ctimeMs:n,birthtimeMs:r,uid:i,gid:a,size:o,mode:s,ino:c,...l}={}){let u=Date.now();this.atimeMs=this._convert(e??u),this.mtimeMs=this._convert(t??u),this.ctimeMs=this._convert(n??u),this.birthtimeMs=this._convert(r??u),this.uid=this._convert(i??0),this.gid=this._convert(a??0),this.size=this._convert(o??0),this.ino=this._convert(c??0),this.mode=this._convert(s??0),this.mode&61440||(this.mode|=this._convert(tt)),Object.assign(this,l)}isFile(){return(this.mode&Qe)==tt}isDirectory(){return(this.mode&Qe)==rt}isSymbolicLink(){return(this.mode&Qe)==et}isSocket(){return(this.mode&Qe)==$e}isBlockDevice(){return(this.mode&Qe)==nt}isCharacterDevice(){return(this.mode&Qe)==it}isFIFO(){return(this.mode&Qe)==at}toJSON(){return p(this,Bn)}hasAccess(e,t){return J(t,this._isBigint?new jn(this):this,e)}get atimeNs(){return BigInt(this.atimeMs)*kn}get mtimeNs(){return BigInt(this.mtimeMs)*kn}get ctimeNs(){return BigInt(this.ctimeMs)*kn}get birthtimeNs(){return BigInt(this.birthtimeMs)*kn}},jn=class extends An{_isBigint=!1},Mn=class extends An{_isBigint=!0};function Nn(e,t){return e.size==t.size&&+e.atime==+t.atime&&+e.mtime==+t.mtime&&+e.ctime==+t.ctime&&e.mode==t.mode}var Pn=class{type=525687744115;bsize=4096;blocks=0;bfree=0;bavail=0;files=ct;frsize=4096;ffree=ct},Fn=class{type=BigInt(`0x7a656e6673`);bsize=BigInt(4096);blocks=BigInt(0);bfree=BigInt(0);bavail=BigInt(0);files=BigInt(ct);frsize=BigInt(4096);ffree=BigInt(ct)},In=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},G=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};const Ln=3968;let Rn=(()=>{var e,t;let n=[Xt.packed()],r,i=[],a,o=$t.typed(Uint8Array),s,c=[],l=[],u,d=[],f=[];var p=class extends o{static{a=this}static{let m=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;s=[(e=V).uint32.bind(e)],u=[(t=V).uint32.bind(t)],In(this,null,s,{kind:`accessor`,name:`keySize`,static:!1,private:!1,access:{has:e=>`keySize`in e,get:e=>e.keySize,set:(e,t)=>{e.keySize=t}},metadata:m},c,l),In(this,null,u,{kind:`accessor`,name:`valueSize`,static:!1,private:!1,access:{has:e=>`valueSize`in e,get:e=>e.valueSize,set:(e,t)=>{e.valueSize=t}},metadata:m},d,f),In(null,r={value:a},n,{kind:`class`,name:a.name,metadata:m},null,i),p=a=r.value,m&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:m})}static name=`Attribute`;#e=G(this,c,void 0);get keySize(){return this.#e}set keySize(e){this.#e=e}#t=(G(this,l),G(this,d,void 0));get valueSize(){return this.#t}set valueSize(e){this.#t=e}get name(){return te(this.subarray(8,8+this.keySize))}set name(e){let t=T(e);if(8+t.length+this.valueSize>Ln)throw N(`EOVERFLOW`);this.set(t,8),this.keySize=t.length}get value(){return this.subarray(8+this.keySize,this.size)}set value(e){if(8+this.keySize+e.length>Ln)throw N(`EOVERFLOW`);this.valueSize=e.length,this.set(e,8+this.keySize)}get size(){return 8+this.keySize+this.valueSize}constructor(){super(...arguments),G(this,f)}static{G(a,i)}};return a})(),zn=(()=>{var e;let t=[Xt.packed()],n,r=[],i,a=$t(o),s,c=[],l=[];var u=class extends a{static{i=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;s=[(e=V).uint32.bind(e)],In(this,null,s,{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},c,l),In(null,n={value:i},t,{kind:`class`,name:i.name,metadata:o},null,r),u=i=n.value,o&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`Attributes`;#e=G(this,c,void 0);get size(){return this.#e}set size(e){this.#e=e}get byteSize(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new Rn(this.buffer,e);e+=t.size}return e}has(e){let t=this.byteOffset+B(this);for(let n=0;n<this.size;n++){let n=new Rn(this.buffer,t);if(n.name==e)return!0;t+=n.size}return!1}get(e){let t=this.byteOffset+B(this);for(let n=0;n<this.size;n++){let n=new Rn(this.buffer,t);if(n.name==e)return n.value;t+=n.size}}set(e,t){let n=this.byteOffset+B(this),r;for(let t=0;t<this.size;t++){let t=new Rn(this.buffer,n);t.name==e&&(r=[n,t.size]),n+=t.size}let i=new Uint8Array(this.buffer);if(r){let[e,t]=r;n-=t,i.copyWithin(e,e+t,n+t),i.fill(0,n,n+t),this.size--}let a=new Rn(this.buffer,n);a.name=e,a.value=t,this.size++}remove(e){let t=this.byteOffset+B(this),n;for(let r=0;r<this.size;r++){let r=new Rn(this.buffer,t);r.name==e&&(n=[t,r.size]),t+=r.size}if(!n)return!1;let[r,i]=n,a=new Uint8Array(this.buffer);return a.copyWithin(r,r+i,t),a.fill(0,t-i,t),this.size--,!0}copyFrom(e){let{byteSize:t}=e;new Uint8Array(this.buffer,this.byteOffset,t).set(new Uint8Array(e.buffer,e.byteOffset,t))}*keys(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new Rn(this.buffer,e);yield t.name,e+=t.size}}*values(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new Rn(this.buffer,e);yield t.value,e+=t.size}}*entries(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new Rn(this.buffer,e);yield[t.name,t.value],e+=t.size}}constructor(){super(...arguments),G(this,l)}static{G(i,r)}};return i})();const Bn=[`ino`,`data`,`size`,`mode`,`flags`,`nlink`,`uid`,`gid`,`atimeMs`,`birthtimeMs`,`mtimeMs`,`ctimeMs`,`version`,`rdev`];var Vn;(function(e){e[e.Sync=1]=`Sync`,e[e.NoAtime=2]=`NoAtime`,e[e.Append=4]=`Append`,e[e.Immutable=8]=`Immutable`,e[e.Dead=16]=`Dead`,e[e.NoQuota=32]=`NoQuota`,e[e.Dirsync=64]=`Dirsync`,e[e.NoCMtime=128]=`NoCMtime`,e[e.SwapFile=256]=`SwapFile`,e[e.Private=512]=`Private`,e[e.IMA=1024]=`IMA`,e[e.AutoMount=2048]=`AutoMount`,e[e.NoSec=4096]=`NoSec`,e[e.DAX=8192]=`DAX`,e[e.Encrypted=16384]=`Encrypted`,e[e.CaseFold=32768]=`CaseFold`,e[e.Verity=65536]=`Verity`,e[e.KernelFile=131072]=`KernelFile`})(Vn||={});let K=(()=>{var e,t,n,r,i,a,s,c,l,u,d,f,m,h,g,_,v;let y=[Xt.packed()],b,x=[],S,C=$t(o),w,T=[],ee=[],te,ne=[],re=[],E,D=[],O=[],k,A=[],j=[],M,P=[],ie=[],F,I=[],ae=[],L,oe=[],se=[],ce,le=[],R=[],de,fe=[],pe=[],me,he=[],ge=[],_e,ve=[],ye=[],be,xe=[],Se=[],Ce,we=[],Te=[],Ee,De=[],Oe=[],ke,Ae=[],je=[],Me,Ne=[],Pe=[],Fe,Ie=[],Le=[],Re,ze=[],Be=[],Ve,He=[],Ue=[],We,Ge=[],Ke=[];var qe=class extends C{static{S=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(C[Symbol.metadata]??null):void 0;w=[(e=V).uint32.bind(e)],te=[(t=V).uint32.bind(t)],E=[(n=V).uint32.bind(n)],k=[(r=V).uint16.bind(r)],M=[(i=V).uint32.bind(i)],F=[(a=V).uint32.bind(a)],L=[(s=V).uint32.bind(s)],ce=[(c=V).float64.bind(c)],de=[(l=V).float64.bind(l)],me=[(u=V).float64.bind(u)],_e=[(d=V).float64.bind(d)],be=[(f=V).uint32.bind(f)],Ce=[(m=V).uint32.bind(m)],Ee=[(h=V).uint32.bind(h)],ke=[(g=V).uint16.bind(g)],Me=[(_=V).uint32.bind(_)],Fe=[(v=V).uint32.bind(v)],Re=[V.uint8(44)],Ve=[Zt(zn)],We=[V.uint8(Ln)],In(this,null,w,{kind:`accessor`,name:`data`,static:!1,private:!1,access:{has:e=>`data`in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:o},T,ee),In(this,null,te,{kind:`accessor`,name:`__data_old`,static:!1,private:!1,access:{has:e=>`__data_old`in e,get:e=>e.__data_old,set:(e,t)=>{e.__data_old=t}},metadata:o},ne,re),In(this,null,E,{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},D,O),In(this,null,k,{kind:`accessor`,name:`mode`,static:!1,private:!1,access:{has:e=>`mode`in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:o},A,j),In(this,null,M,{kind:`accessor`,name:`nlink`,static:!1,private:!1,access:{has:e=>`nlink`in e,get:e=>e.nlink,set:(e,t)=>{e.nlink=t}},metadata:o},P,ie),In(this,null,F,{kind:`accessor`,name:`uid`,static:!1,private:!1,access:{has:e=>`uid`in e,get:e=>e.uid,set:(e,t)=>{e.uid=t}},metadata:o},I,ae),In(this,null,L,{kind:`accessor`,name:`gid`,static:!1,private:!1,access:{has:e=>`gid`in e,get:e=>e.gid,set:(e,t)=>{e.gid=t}},metadata:o},oe,se),In(this,null,ce,{kind:`accessor`,name:`atimeMs`,static:!1,private:!1,access:{has:e=>`atimeMs`in e,get:e=>e.atimeMs,set:(e,t)=>{e.atimeMs=t}},metadata:o},le,R),In(this,null,de,{kind:`accessor`,name:`birthtimeMs`,static:!1,private:!1,access:{has:e=>`birthtimeMs`in e,get:e=>e.birthtimeMs,set:(e,t)=>{e.birthtimeMs=t}},metadata:o},fe,pe),In(this,null,me,{kind:`accessor`,name:`mtimeMs`,static:!1,private:!1,access:{has:e=>`mtimeMs`in e,get:e=>e.mtimeMs,set:(e,t)=>{e.mtimeMs=t}},metadata:o},he,ge),In(this,null,_e,{kind:`accessor`,name:`ctimeMs`,static:!1,private:!1,access:{has:e=>`ctimeMs`in e,get:e=>e.ctimeMs,set:(e,t)=>{e.ctimeMs=t}},metadata:o},ve,ye),In(this,null,be,{kind:`accessor`,name:`ino`,static:!1,private:!1,access:{has:e=>`ino`in e,get:e=>e.ino,set:(e,t)=>{e.ino=t}},metadata:o},xe,Se),In(this,null,Ce,{kind:`accessor`,name:`__ino_old`,static:!1,private:!1,access:{has:e=>`__ino_old`in e,get:e=>e.__ino_old,set:(e,t)=>{e.__ino_old=t}},metadata:o},we,Te),In(this,null,Ee,{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},De,Oe),In(this,null,ke,{kind:`accessor`,name:`__after_flags`,static:!1,private:!1,access:{has:e=>`__after_flags`in e,get:e=>e.__after_flags,set:(e,t)=>{e.__after_flags=t}},metadata:o},Ae,je),In(this,null,Me,{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},Ne,Pe),In(this,null,Fe,{kind:`accessor`,name:`rdev`,static:!1,private:!1,access:{has:e=>`rdev`in e,get:e=>e.rdev,set:(e,t)=>{e.rdev=t}},metadata:o},Ie,Le),In(this,null,Re,{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},ze,Be),In(this,null,Ve,{kind:`accessor`,name:`attributes`,static:!1,private:!1,access:{has:e=>`attributes`in e,get:e=>e.attributes,set:(e,t)=>{e.attributes=t}},metadata:o},He,Ue),In(this,null,We,{kind:`accessor`,name:`__data`,static:!1,private:!1,access:{has:e=>`__data`in e,get:e=>e.__data,set:(e,t)=>{e.__data=t}},metadata:o},Ge,Ke),In(null,b={value:S},y,{kind:`class`,name:S.name,metadata:o},null,x),qe=S=b.value,o&&Object.defineProperty(S,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`Inode`;constructor(...e){let t={};if(typeof e[0]==`object`&&e[0]!==null&&!ArrayBuffer.isView(e[0])&&(t=e[0],e=[B(qe)]),e[0]instanceof qe&&(e=[new Uint8Array(e[0].buffer,e[0].byteOffset,e[0].byteLength)]),super(...e),G(this,Ke),this.byteLength<B(qe))throw ue(N(`EIO`,`Buffer is too small to create an inode (${this.byteLength} bytes)`));Object.assign(this,t),this.atimeMs||=Date.now(),this.mtimeMs||=Date.now(),this.ctimeMs||=Date.now(),this.birthtimeMs||=Date.now(),this.ino&&!this.nlink&&z(`Inode ${this.ino} has an nlink of 0`)}#e=G(this,T,void 0);get data(){return this.#e}set data(e){this.#e=e}#t=(G(this,ee),G(this,ne,void 0));get __data_old(){return this.#t}set __data_old(e){this.#t=e}#n=(G(this,re),G(this,D,void 0));get size(){return this.#n}set size(e){this.#n=e}#r=(G(this,O),G(this,A,void 0));get mode(){return this.#r}set mode(e){this.#r=e}#i=(G(this,j),G(this,P,void 0));get nlink(){return this.#i}set nlink(e){this.#i=e}#a=(G(this,ie),G(this,I,void 0));get uid(){return this.#a}set uid(e){this.#a=e}#o=(G(this,ae),G(this,oe,void 0));get gid(){return this.#o}set gid(e){this.#o=e}#s=(G(this,se),G(this,le,void 0));get atimeMs(){return this.#s}set atimeMs(e){this.#s=e}#c=(G(this,R),G(this,fe,void 0));get birthtimeMs(){return this.#c}set birthtimeMs(e){this.#c=e}#l=(G(this,pe),G(this,he,void 0));get mtimeMs(){return this.#l}set mtimeMs(e){this.#l=e}#u=(G(this,ge),G(this,ve,void 0));get ctimeMs(){return this.#u}set ctimeMs(e){this.#u=e}#d=(G(this,ye),G(this,xe,void 0));get ino(){return this.#d}set ino(e){this.#d=e}#f=(G(this,Se),G(this,we,void 0));get __ino_old(){return this.#f}set __ino_old(e){this.#f=e}#p=(G(this,Te),G(this,De,void 0));get flags(){return this.#p}set flags(e){this.#p=e}#m=(G(this,Oe),G(this,Ae,void 0));get __after_flags(){return this.#m}set __after_flags(e){this.#m=e}#h=(G(this,je),G(this,Ne,void 0));get version(){return this.#h}set version(e){this.#h=e}#g=(G(this,Pe),G(this,Ie,void 0));get rdev(){return this.#g}set rdev(e){this.#g=e}#_=(G(this,Le),G(this,ze,void 0));get __padding(){return this.#_}set __padding(e){this.#_=e}#v=(G(this,Be),G(this,He,void 0));get attributes(){return this.#v}set attributes(e){this.#v=e}#y=(G(this,Ue),G(this,Ge,void 0));get __data(){return this.#y}set __data(e){this.#y=e}toString(){return`<Inode ${this.ino}>`}toJSON(){return{...p(this,Bn),attributes:this.attributes}}toStats(){return new jn(this)}update(e){if(!e)return!1;let t=!1;for(let n of Bn)e[n]!==void 0&&n!=`ino`&&n!=`data`&&this[n]!==e[n]&&(n==`atimeMs`&&this.flags&Vn.NoAtime||(this[n]=e[n],t=!0));return e.attributes&&(this.attributes.copyFrom(e.attributes),t=!0),t&&(this.ctimeMs=Date.now()),t}static{G(S,x)}};return qe=S})();function Hn(e){return(e.mode&Qe)==tt}function q(e){return(e.mode&Qe)==rt}function Un(e){return(e.mode&Qe)==et}function Wn(e){return(e.mode&Qe)==$e}function Gn(e){return(e.mode&Qe)==nt}function Kn(e){return(e.mode&Qe)==it}function qn(e){return(e.mode&Qe)==at}function J(e,t,n){let{credentials:r}=ze(e);if(Un(t))return!0;if(r.euid===0||r.egid===0)return!(n&1)||q(t)||!!(t.mode&73);let i=0;return r.uid===t.uid&&(t.mode&256&&(i|=4),t.mode&128&&(i|=2),t.mode&64&&(i|=1)),(r.gid===t.gid||r.groups.includes(Number(t.gid)))&&(t.mode&32&&(i|=4),t.mode&16&&(i|=2),t.mode&8&&(i|=1)),t.mode&4&&(i|=4),t.mode&2&&(i|=2),t.mode&1&&(i|=1),(i&n)===n}function Jn(e,t,n){let r=!0;return!isNaN(t)&&t>=0&&t<4294967295?e.uid=t:r=!1,!isNaN(n)&&n>=0&&n<4294967295?e.gid=n:r=!1,r}var Yn=class e extends Map{maxSize=ct;toJSON(){return{version:1,maxSize:this.maxSize,entries:Object.fromEntries(Array.from(this).map(([e,t])=>[e,t.toJSON()]))}}toString(){return JSON.stringify(this.toJSON())}clear(){super.clear(),this.#e=0}get byteSize(){let e=this.size*B(K);for(let t of this.values())e+=t.size;return e}usage(){return{totalSpace:this.maxSize,freeSpace:this.maxSize-this.byteSize}}pathOf(e){for(let[t,n]of this)if(n.ino==e||n.data==e)return t}getByID(e){return this.entryByID(e)?.inode}entryByID(e){for(let[t,n]of this)if(n.ino==e||n.data==e)return{path:t,inode:n}}directoryEntries(e){let t=this.get(e);if(!t)throw N(`ENOENT`);if((t.mode&61440)!=16384)throw N(`ENOTDIR`);let n={};for(let t of this.keys())W(t)==e&&t!=e&&(n[wn(t)]=this.get(t).ino);return n}#e=0;_alloc(){return this.#e||=Array.from(this.values()).reduce((e,t)=>Math.max(e,t.ino,t.data),0),this.#e++,this.#e++}directories(){let e=new Map;for(let[t,n]of this){if((n.mode&61440)!=16384)continue;let r={};for(let e of this.keys())W(e)==t&&e!=t&&(r[wn(e)]=this.get(e).ino);e.set(t,r)}return e}fromJSON(e){if(e.version!=1)throw N(`EINVAL`,`Index version mismatch`);this.clear();for(let[t,n]of Object.entries(e.entries))n.data??=S(1,ct),t==`/`&&(n.ino=0),this.set(t,new K(n));return this}static parse(t){if(!h(t))throw N(`EINVAL`,`Invalid JSON`);let n=JSON.parse(t),r=new e;return r.fromJSON(n),r}},Xn=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},Zn=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},Qn;(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`})(Qn||={});let $n=(()=>{var e,t,n,r,i;let a=[Xt()],s,c=[],l,u=$t(o),d,f=[],p=[],m,h=[],g=[],_,v=[],b=[],x,S=[],C=[],w,T=[],ee=[],te,ne=[],re=[];var E=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)],te=[V.char(8)],Xn(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),Xn(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),Xn(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),Xn(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),Xn(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),Xn(this,null,te,{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},ne,re),Xn(null,s={value:l},a,{kind:`class`,name:l.name,metadata:o},null,c),E=l=s.value,o&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`fsxattr`;#e=Zn(this,f,void 0);get xflags(){return this.#e}set xflags(e){this.#e=e}#t=(Zn(this,p),Zn(this,h,void 0));get extsize(){return this.#t}set extsize(e){this.#t=e}#n=(Zn(this,g),Zn(this,v,void 0));get nextents(){return this.#n}set nextents(e){this.#n=e}#r=(Zn(this,b),Zn(this,S,void 0));get projid(){return this.#r}set projid(e){this.#r=e}#i=(Zn(this,C),Zn(this,T,void 0));get cowextsize(){return this.#i}set cowextsize(e){this.#i=e}#a=(Zn(this,ee),Zn(this,ne,[]));get pad(){return this.#a}set pad(e){this.#a=e}constructor(e=y(new j(O.EINVAL,`fsxattr must be initialized with an inode`))){super(new ArrayBuffer(B(E))),Zn(this,re),this.extsize=e.size,this.nextents=1,this.projid=e.uid,this.cowextsize=e.size;for(let t of Object.keys(Vn))(e.flags||0)&Vn[t]&&t in Qn&&(this.xflags|=Qn[t])}static{Zn(l,c)}};return E=l})();var er;(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`})(er||={});var tr;(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`})(tr||={});var nr;(function(e){e[e.GetFlags=2147771905]=`GetFlags`,e[e.SetFlags=1074030082]=`SetFlags`,e[e.GetVersion=2147776001]=`GetVersion`,e[e.SetVersion=1074034178]=`SetVersion`})(nr||={});const rr={[tr.GetFlags](e){if(typeof e.inode.flags!=`number`)throw N(`ENOTTY`);return e.inode.flags},[nr.GetFlags](e){if(typeof e.inode.flags!=`number`)throw N(`ENOTTY`);return e.inode.flags},[tr.GetVersion](e){if(typeof e.inode.version!=`number`)throw N(`ENOTTY`);return e.inode.version},[nr.GetVersion](e){if(typeof e.inode.version!=`number`)throw N(`ENOTTY`);return e.inode.version},[tr.Fiemap](){throw N(`ENOTSUP`)},[tr.GetXattr](e,t){return new $n(e.inode)},[tr.SetXattr](e,t,n){throw N(`ENOTSUP`)},[tr.GetLabel](e){return e.fs.label},[tr.SetLabel](e,t){e.fs.label=t},[tr.GetUUID](e){return e.fs.uuid},[tr.GetSysfsPath](e){return`/sys/fs/${e.fs.name}/${e.fs.uuid}`}},ir={...rr,async[tr.SetFlags](e,t){e.inode.flags=t,await e.fs.touch(e.path,e.inode)},async[nr.SetFlags](e,t){e.inode.flags=t,await e.fs.touch(e.path,e.inode)},async[tr.SetVersion](e,t){e.inode.version=t,await e.fs.touch(e.path,e.inode)},async[nr.SetVersion](e,t){e.inode.version=t,await e.fs.touch(e.path,e.inode)}},ar={...rr,[tr.SetFlags](e,t){e.inode.flags=t,e.fs.touchSync(e.path,e.inode)},[nr.SetFlags](e,t){e.inode.flags=t,e.fs.touchSync(e.path,e.inode)},[tr.SetVersion](e,t){e.inode.version=t,e.fs.touchSync(e.path,e.inode)},[nr.SetVersion](e,t){e.inode.version=t,e.fs.touchSync(e.path,e.inode)}},or=4096;var sr=class e{type;name;label;_mountPoint;_uuid=crypto.randomUUID();get uuid(){return this._uuid}attributes=new Map;constructor(t,n){this.type=t,this.name=n,this.streamRead===e.prototype.streamRead&&this.attributes.set(`default_stream_read`),this.streamWrite===e.prototype.streamWrite&&this.attributes.set(`default_stream_write`)}toString(){return`${this.name} ${this.label?JSON.stringify(this.label):``} (${this._mountPoint?`mounted on `+this._mountPoint:`unmounted`})`}usage(){return{totalSpace:0,freeSpace:0}}async ready(){}readySync(){if(this.ready!==e.prototype.ready)throw N(`EAGAIN`)}async exists(e){try{return await this.stat(e),!0}catch(e){return e.code!=`ENOENT`}}existsSync(e){try{return this.statSync(e),!0}catch(e){return e.code!=`ENOENT`}}streamRead(e,t){return new ReadableStream({start:async n=>{let{size:r}=await this.stat(e),{start:i=0,end:a=r}=t;for(let t=i;t<a;t+=or){let r=t+or>a?a-t:or,i=new Uint8Array(r);await this.read(e,i,t,t+r).catch(n.error.bind(n)),n.enqueue(i)}n.close()},type:`bytes`})}streamWrite(e,t){let n=t.start??0;return new WritableStream({write:async(t,r)=>{let i=!1,a=e=>{i=!0,r.error(e)},{size:o}=await this.stat(e);await this.write(e,t,n).catch(a),!i&&(n+=t.byteLength,await this.touch(e,{mtimeMs:Date.now(),size:Math.max(o,n)}).catch(a))}})}async ioctl(e,t,...n){let r=ir[t];if(!r)throw N(`ENOTTY`);return await r(this,e,...n)}ioctlSync(e,t,...n){let r=ar[t];if(!r)throw N(`ENOTTY`);return r(this,e,...n)}};Promise.withResolvers??=(z(`Using a polyfill of Promise.withResolvers`),function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}),Symbol.dispose??=(z(`Using a polyfill of Symbol.dispose`),Symbol(`Symbol.dispose`)),Symbol.asyncDispose??=(z(`Using a polyfill of Symbol.asyncDispose`),Symbol(`Symbol.asyncDispose`)),globalThis.crypto.randomUUID??=(z(`Using a polyfill of crypto.randomUUID`),function(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}),Uint8Array.prototype.toBase64??=(z(`Using a polyfill of Uint8Array.prototype.toBase64`),function(){return btoa(String.fromCharCode(...this))}),Uint8Array.fromBase64??=(z(`Using a polyfill of Uint8Array.fromBase64`),function(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}),Uint8Array.prototype.toHex??=(z(`Using a polyfill of Uint8Array.prototype.toHex`),function(){return Array.from(this).map(e=>e.toString(16).padStart(2,`0`)).join(``)}),Uint8Array.fromHex??=(z(`Using a polyfill of Uint8Array.fromHex`),function(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.slice(n,n+2),16);return t});var cr=class{store;constructor(e){this.store=e}},lr=class extends cr{async get(e,t,n){return this.getSync(e,t,n)}async set(e,t,n){return this.setSync(e,t,n)}async remove(e){return this.removeSync(e)}},ur=class extends cr{asyncDone=Promise.resolve();async(e){this.asyncDone=this.asyncDone.then(()=>e)}_cached(e,t){this.store.cache??=new Map;let n=this.store.cache.get(e);return n?(t&&(n.size=t.size),n):t?new s(e,t.size,{},this.store.cache):void 0}getSync(e,t,n){let r=this._cached(e);if(!r)return;n??=r.size;let i=r.missing(t,n);for(let{start:t,end:n}of i)this.async(this.get(e,t,n));if(i.length)throw N(`EAGAIN`);let a=r.regionAt(t);if(!a){z(`Missing cache region for `+e);return}return a.data.subarray(t-a.offset,n-a.offset)}setSync(e,t,n){this.async(this.set(e,t,n))}removeSync(e){this.async(this.remove(e)),this.store.cache?.delete(e)}},dr=class{raw;fs;done=!1;flag(e){return this.raw.store.flags?.includes(e)??!1}constructor(e,t){this.raw=e,this.fs=t}originalData=new Map;modifiedKeys=new Set;keys(){return this.raw.keys()}async get(e,t=0,n){let r=await this.raw.get(e,t,n);return this.stash(e),r}getSync(e,t=0,n){let r=this.raw.getSync(e,t,n);return this.stash(e),r}async set(e,t,n=0){await this.markModified(e,n,t.byteLength);let r=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength);await this.raw.set(e,r,n)}setSync(e,t,n=0){this.markModifiedSync(e,n,t.byteLength);let r=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength);this.raw.setSync(e,r,n)}async remove(e){await this.markModified(e,0,void 0),await this.raw.remove(e)}removeSync(e){this.markModifiedSync(e,0,void 0),this.raw.removeSync(e)}commit(){return this.done=!0,Promise.resolve()}commitSync(){this.done=!0}async abort(){if(!this.done){for(let[e,t]of this.originalData)if(this.modifiedKeys.has(e)){if(t.some(e=>!e.data)){await this.raw.remove(e),this.fs._remove(e);continue}for(let n of t.reverse())await this.raw.set(e,n.data,n.offset)}this.done=!0}}abortSync(){if(!this.done){for(let[e,t]of this.originalData)if(this.modifiedKeys.has(e)){if(t.some(e=>!e.data)){this.raw.removeSync(e),this.fs._remove(e);continue}for(let n of t.reverse())this.raw.setSync(e,n.data,n.offset)}this.done=!0}}async[Symbol.asyncDispose](){this.done||await this.abort()}[Symbol.dispose](){this.done||this.abortSync()}stash(e,t,n=0){this.originalData.has(e)||this.originalData.set(e,[]),this.originalData.get(e).push({data:t,offset:n})}async markModified(e,t,n){this.modifiedKeys.add(e);let r=n?t+n:void 0;try{this.stash(e,await this.raw.get(e,t,r),t)}catch(n){if(!(this.raw instanceof ur))throw n;let i=this.raw._cached(e);if(!i)throw n;for(let n of i.cached(t,r??t))this.stash(e,await this.raw.get(e,n.start,n.end),n.start)}}markModifiedSync(e,t,n){this.modifiedKeys.add(e);let r=n?t+n:void 0;try{this.stash(e,this.raw.getSync(e,t,r),t)}catch(n){if(!(this.raw instanceof ur))throw n;let i=this.raw._cached(e);if(!i)throw n;for(let n of i.cached(t,r??t))this.stash(e,this.raw.getSync(e,n.start,n.end),n.start)}}},fr=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},pr=(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}),mr=class extends sr{store;_ids=new Map([[`/`,0]]);_paths=new Map([[0,new Set(`/`)]]);_path(e){let[t]=this._paths.get(e)??[];return t}_add(e,t){this._paths.has(e)||this._paths.set(e,new Set),this._paths.get(e).add(t),this._ids.set(t,e)}_remove(e){for(let t of this._paths.get(e)??[])this._ids.delete(t);this._paths.delete(e)}_move(e,t){let n=[];for(let[r,i]of this._ids){let a=Cn(e,r);if(a.startsWith(`..`))continue;let o=U(t,a);o.endsWith(`/`)&&(o=o.slice(0,-1)),n.push({oldKey:r,newKey:o,ino:i})}for(let{oldKey:e,newKey:t,ino:r}of n){this._ids.delete(e),this._ids.set(t,r);let n=this._paths.get(r);if(!n){z(`Missing paths in table for ino `+r);continue}n.delete(e),n.add(t)}}_initialized=!1;async ready(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),await this.checkRoot(),await this._populate(),!0)}readySync(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),this.checkRootSync(),this._populateSync(),!0)}constructor(e){super(e.type??1802921587,e.name),this.store=e,e.fs=this,this._uuid=e.uuid??this.uuid,this.label=e.label,pe(this.name+`: supports features: `+this.store.flags?.join(`, `))}usage(){return this.store.usage?.()||{totalSpace:0,freeSpace:0}}async loadIndex(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!0),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),await n.set(i.ino,i),r.has(t)&&await n.set(i.data,an(r.get(t)));await n.commit()}catch(e){t.error=e,t.hasError=!0}finally{let e=pr(t);e&&await e}}loadIndexSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!1),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),n.setSync(i.ino,i),r.has(t)&&n.setSync(i.data,an(r.get(t)));n.commitSync()}catch(e){t.error=e,t.hasError=!0}finally{pr(t)}}async createIndex(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Yn,n=fr(e,this.transaction(),!0),r=[[`/`,0]],i=v(N(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new K(await n.get(i));if(t.set(e,a),q(a)){let t=rn(await n.get(a.data)??y(N(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([U(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{let t=pr(e);t&&await t}}createIndexSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Yn,n=fr(e,this.transaction(),!1),r=[[`/`,0]],i=v(N(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new K(n.getSync(i));if(t.set(e,a),q(a)){let t=rn(n.getSync(a.data)??y(N(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([U(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{pr(e)}}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!0),i=Dn(e),a=Dn(t),o=await this.findInode(r,i.dir),s=rn(await r.get(o.data)??y(N(`ENODATA`)));if(!s[i.base])throw N(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&R(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw N(`EBUSY`);let l=a.dir==i.dir,u=l?o:await this.findInode(r,a.dir),d=l?s:rn(await r.get(u.data)??y(N(`ENODATA`)));if(d[a.base]){let e=new K(await r.get(d[a.base])??y(N(`ENOENT`)));if(!Hn(e))throw N(`EISDIR`);await r.remove(e.data),await r.remove(d[a.base])}d[a.base]=c,await r.set(o.data,an(s)),await r.set(u.data,an(d)),await r.commit(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{let e=pr(n);e&&await e}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!1),i=Dn(e),a=Dn(t),o=this.findInodeSync(r,i.dir),s=rn(r.getSync(o.data)??y(N(`ENODATA`)));if(!s[i.base])throw N(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&R(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw N(`EBUSY`);let l=a.dir===i.dir,u=l?o:this.findInodeSync(r,a.dir),d=l?s:rn(r.getSync(u.data)??y(N(`ENODATA`)));if(d[a.base]){let e=new K(r.getSync(d[a.base])??y(N(`ENOENT`)));if(!Hn(e))throw N(`EISDIR`);r.removeSync(e.data),r.removeSync(d[a.base])}d[a.base]=c,r.setSync(o.data,an(s)),r.setSync(u.data,an(d)),r.commitSync(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{pr(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!0);return await this.findInode(n,e)}catch(e){t.error=e,t.hasError=!0}finally{let e=pr(t);e&&await e}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!1);return this.findInodeSync(n,e)}catch(e){t.error=e,t.hasError=!0}finally{pr(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!0),i=await this.findInode(r,e);if(!q(i)&&t.size!==void 0&&t.size!==i.size){let e=await r.get(i.data)??new Uint8Array;t.size<e.byteLength&&e.fill(0,t.size),await r.set(i.data,t.size<e.byteLength?e.subarray(0,t.size):a(e,t.size))}i.update(t)&&(this._add(i.ino,e),r.setSync(i.ino,i)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=pr(n);e&&await e}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!1),i=this.findInodeSync(r,e);if(!q(i)&&t.size!==void 0&&t.size!==i.size){let e=r.getSync(i.data)??new Uint8Array;t.size<e.byteLength&&e.fill(0,t.size),r.setSync(i.data,t.size<e.byteLength?e.subarray(0,t.size):a(e,t.size))}i.update(t)&&(this._add(i.ino,e),r.setSync(i.ino,i)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{pr(n)}}async createFile(e,t){return await this.commitNew(e,{...t,mode:t.mode|tt},new Uint8Array)}createFileSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|tt},new Uint8Array)}async unlink(e){return this.remove(e,!1)}unlinkSync(e){this.removeSync(e,!1)}async rmdir(e){if((await this.readdir(e)).length)throw N(`ENOTEMPTY`);await this.remove(e,!0)}rmdirSync(e){if(this.readdirSync(e).length)throw N(`ENOTEMPTY`);this.removeSync(e,!0)}async mkdir(e,t){return await this.commitNew(e,{...t,mode:t.mode|rt},T(`{}`))}mkdirSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|rt},T(`{}`))}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!0),r=await this.findInode(n,e);return Object.keys(rn(await n.get(r.data)??y(N(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{let e=pr(t);e&&await e}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!1),r=this.findInodeSync(n,e);return Object.keys(rn(n.getSync(r.data)??y(N(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{pr(t)}}async sync(){}syncSync(){}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!0),i=W(t),a=await this.findInode(r,i),o=rn(await r.get(a.data)??y(N(`ENOENT`))),s=await this.findInode(r,e);s.nlink++,o[wn(t)]=s.ino,this._add(s.ino,t),await r.set(s.ino,s),await r.set(a.data,an(o)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=pr(n);e&&await e}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!1),i=W(t),a=this.findInodeSync(r,i),o=rn(r.getSync(a.data)??y(N(`ENOENT`))),s=this.findInodeSync(r,e);s.nlink++,o[wn(t)]=s.ino,this._add(s.ino,t),r.setSync(s.ino,s),r.setSync(a.data,an(o)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{pr(n)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=fr(i,this.transaction(),!0),o=await this.findInode(a,e);if(o.size==0)return;let s=await a.get(o.data,n,r)??y(N(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&R(`Trying to place ${c.byteLength} bytes into a ${t.byteLength} byte buffer on read`),t.set(c)}catch(e){i.error=e,i.hasError=!0}finally{let e=pr(i);e&&await e}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=fr(i,this.transaction(),!1),o=this.findInodeSync(a,e);if(o.size==0)return;let s=a.getSync(o.data,n,r)??y(N(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&R(`Trying to place ${c.byteLength} bytes into a ${t.byteLength} byte buffer on read`),t.set(c)}catch(e){i.error=e,i.hasError=!0}finally{pr(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=fr(r,this.transaction(),!0),o=await this.findInode(i,e),s=n+t.byteLength,c=t;i.flag(`partial`)||(c=a(await i.get(o.data)??new Uint8Array,s),c.set(t,n),n=0),await i.set(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),await i.set(o.ino,o),this._add(o.ino,e),await i.commit()}catch(e){r.error=e,r.hasError=!0}finally{let e=pr(r);e&&await e}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=fr(r,this.transaction(),!1),o=this.findInodeSync(i,e),s=n+t.byteLength,c=t;i.flag(`partial`)||(c=a(i.getSync(o.data)??new Uint8Array,s),c.set(t,n),n=0),i.setSync(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),i.setSync(o.ino,o),this._add(o.ino,e),i.commitSync()}catch(e){r.error=e,r.hasError=!0}finally{pr(r)}}transaction(){return new dr(this.store.transaction(),this)}async checkRoot(){let e={stack:[],error:void 0,hasError:!1};try{let t=fr(e,this.transaction(),!0);if(await t.get(0))return;let n=new K({ino:0,data:1,mode:16895});await t.set(n.data,T(`{}`)),this._add(0,`/`),await t.set(0,n),await t.commit()}catch(t){e.error=t,e.hasError=!0}finally{let t=pr(e);t&&await t}}checkRootSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=fr(e,this.transaction(),!1);if(t.getSync(0))return;let n=new K({ino:0,data:1,mode:16895});t.setSync(n.data,T(`{}`)),this._add(0,`/`),t.setSync(0,n),t.commitSync()}catch(t){e.error=t,e.hasError=!0}finally{pr(e)}}async _populate(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){z(`Attempted to populate tables after initialization`);return}pe(`Populating tables with existing store metadata`);let t=fr(e,this.transaction(),!0),n=await t.get(0);if(!n){de(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:16895});await t.set(e.data,T(`{}`)),this._add(0,`/`),await t.set(0,e),await t.commit();return}if(n.length<B(K)){ue(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=await t.get(n);if(!o){z(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){z(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new K(o);if(!q(s)||r.has(n))continue;r.add(n);let c=await t.get(s.data);if(!c){z(`Store is missing directory data: `+s.data);continue}let l=rn(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}pe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{let t=pr(e);t&&await t}}_populateSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){z(`Attempted to populate tables after initialization`);return}pe(`Populating tables with existing store metadata`);let t=fr(e,this.transaction(),!1),n=t.getSync(0);if(!n){de(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:16895});t.setSync(e.data,T(`{}`)),this._add(0,`/`),t.setSync(0,e),t.commitSync();return}if(n.length<B(K)){ue(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=t.getSync(n);if(!o){z(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){z(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new K(o);if(!q(s)||r.has(n))continue;r.add(n);let c=t.getSync(s.data);if(!c){z(`Store is missing directory data: `+s.data);continue}let l=rn(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}pe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{pr(e)}}async _findInode(e,t,n=new Set){if(n.has(t))throw ue(N(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(await e.get(0)??y(N(`ENODATA`)));let{dir:r,base:i}=Dn(t),a=await this._findInode(e,r,n),o=rn(await e.get(a.data)??y(N(`ENODATA`)));if(!(i in o))throw N(`ENOENT`);return new K(await e.get(o[i])??y(N(`ENODATA`)))}_findInodeSync(e,t,n=new Set){if(n.has(t))throw ue(N(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(e.getSync(0)??y(N(`ENOENT`)));let{dir:r,base:i}=Dn(t),a=this._findInodeSync(e,r,n),o=rn(e.getSync(a.data)??y(N(`ENODATA`)));if(!(i in o))throw N(`ENOENT`);return new K(e.getSync(o[i])??y(N(`ENODATA`)))}async findInode(e,t){if(this.attributes.has(`no_id_tables`))return await this._findInode(e,t);let n=this._ids.get(t);if(n===void 0)throw N(`ENOENT`);return new K(await e.get(n)??y(N(`ENOENT`)))}findInodeSync(e,t){if(this.attributes.has(`no_id_tables`))return this._findInodeSync(e,t);let n=this._ids.get(t);if(n===void 0)throw N(`ENOENT`);return new K(e.getSync(n)??y(N(`ENOENT`)))}_lastID;allocNew(e){this._lastID||=Array.from(this._paths.keys()).reduce((e,t)=>Math.max(e,t),0),this._lastID+=2;let t=this._lastID;if(t>4294967295)throw R(N(`ENOSPC`,`No IDs available`));return this._add(t,e),t}async commitNew(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw N(`EEXIST`);let i=fr(r,this.transaction(),!0),{dir:a,base:o}=Dn(e),s=await this.findInode(i,a),c=rn(await i.get(s.data)??y(N(`ENOENT`)));if(c[o])throw N(`EEXIST`);let l=this.allocNew(e),u=new K({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return await i.set(u.ino,u),await i.set(u.data,n),c[o]=u.ino,await i.set(s.data,an(c)),await i.commit(),u}catch(e){r.error=e,r.hasError=!0}finally{let e=pr(r);e&&await e}}commitNewSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw N(`EEXIST`);let i=fr(r,this.transaction(),!1),{dir:a,base:o}=Dn(e),s=this.findInodeSync(i,a),c=rn(i.getSync(s.data)??y(N(`ENOENT`)));if(c[o])throw N(`EEXIST`);let l=this.allocNew(e),u=new K({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return i.setSync(u.ino,u),i.setSync(u.data,n),c[o]=u.ino,i.setSync(s.data,an(c)),i.commitSync(),u}catch(e){r.error=e,r.hasError=!0}finally{pr(r)}}async remove(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!0),{dir:i,base:a}=Dn(e),o=await this.findInode(r,i),s=rn(await r.get(o.data)??y(N(`ENOENT`)));if(!s[a])throw N(`ENOENT`);let c=s[a],l=new K(await r.get(c)??y(N(`ENOENT`)));if(delete s[a],!t&&q(l))throw N(`EISDIR`);await r.set(o.data,an(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),await r.set(l.ino,l)):(await r.remove(l.data),await r.remove(c),this._remove(c)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=pr(n);e&&await e}}removeSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!1),{dir:i,base:a}=Dn(e),o=this.findInodeSync(r,i),s=rn(r.getSync(o.data)??y(N(`ENOENT`))),c=s[a];if(!c)throw N(`ENOENT`);let l=new K(r.getSync(c)??y(N(`ENOENT`)));if(delete s[a],!t&&q(l))throw N(`EISDIR`);r.setSync(o.data,an(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),r.setSync(l.ino,l)):(r.removeSync(l.data),r.removeSync(c),this._remove(c)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{pr(n)}}},hr=class extends lr{async keys(){return this.store.keys()}async get(e){return await(this.store.getAsync?.(e)??this.store.get(e))}getSync(e){return this.store.get(e)}setSync(e,t){this.store.set(e,t)}removeSync(e){this.store.delete(e)}},gr=class extends ur{async keys(){return await this.asyncDone,this.store.keys()}async get(e,t,n){return await this.asyncDone,await this.store.get(e,t,n)}getSync(e,t,n){return this.store.cached(e,t,n)}async set(e,t,n=0){await this.asyncDone,await this.store.set(e,t,n)}async remove(e){await this.asyncDone,await this.store.delete(e)}},_r=class extends Map{maxSize;label;flags=[];name=`tmpfs`;constructor(e=ct,t){super(),this.maxSize=e,this.label=t}async sync(){}transaction(){return new hr(this)}get bytes(){let e=this.size*4;for(let t of this.values())e+=t.byteLength;return e}usage(){return{totalSpace:this.maxSize,freeSpace:this.maxSize-this.bytes}}};const vr={name:`InMemory`,options:{maxSize:{type:`number`,required:!1},label:{type:`string`,required:!1}},create({maxSize:e,label:t}){let n=new mr(new _r(e,t));return n.checkRootSync(),n}};var yr=class extends mr{devices=new Map;devicesWithDriver(e,t){if(t&&typeof e==`string`)throw R(N(`EINVAL`,`Can not fetch devices using only a driver name`));let n=[];for(let r of this.devices.values())t&&r.driver!=e||(typeof e==`string`?e:e.name)==r.driver.name&&n.push(r);return n}_createDevice(e,t={}){let n=1,r=Array.from(this.devices.values()).at(-1);for(;this.store.has(n)||r?.inode.ino==n;)n++;let i=e.init?.(n,t),a={data:{},minor:0,major:0,...m(i??{},`metadata`),driver:e,inode:new K({mode:8630,...i?.metadata})},o=`/`+(a.name||e.name)+(e.singleton?``:this.devicesWithDriver(e).length);if(this.existsSync(o))throw N(`EEXIST`);return this.devices.set(o,a),fe(`Initialized device: `+this._mountPoint+o),a}addDefaults(){this._createDevice(xr),this._createDevice(Sr),this._createDevice(Cr),this._createDevice(wr),this._createDevice(Tr),pe(`Added default devices`)}constructor(){super(new _r(16777216,`devfs`))}async rename(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.rename(e,t)}renameSync(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.renameSync(e,t)}async stat(e){let t=this.devices.get(e);return t?t.inode:super.stat(e)}statSync(e){let t=this.devices.get(e);return t?t.inode:super.statSync(e)}async touch(e,t){let n=this.devices.get(e);n?n.inode.update(t):await super.touch(e,t)}touchSync(e,t){let n=this.devices.get(e);n?n.inode.update(t):super.touchSync(e,t)}async createFile(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.createFile(e,t)}createFileSync(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.createFileSync(e,t)}async unlink(e){if(this.devices.has(e))throw N(`EPERM`);return super.unlink(e)}unlinkSync(e){if(this.devices.has(e))throw N(`EPERM`);return super.unlinkSync(e)}async rmdir(e){return super.rmdir(e)}rmdirSync(e){return super.rmdirSync(e)}async mkdir(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.mkdir(e,t)}mkdirSync(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.mkdirSync(e,t)}async readdir(e){let t=await super.readdir(e);for(let n of this.devices.keys())W(n)==e&&t.push(wn(n));return t}readdirSync(e){let t=super.readdirSync(e);for(let n of this.devices.keys())W(n)==e&&t.push(wn(n));return t}async link(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.link(e,t)}linkSync(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.linkSync(e,t)}async sync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.sync()}syncSync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.syncSync()}async read(e,t,n,r){let i=this.devices.get(e);if(!i){await super.read(e,t,n,r);return}i.driver.read(i,t,n,r)}readSync(e,t,n,r){let i=this.devices.get(e);if(!i){super.readSync(e,t,n,r);return}i.driver.read(i,t,n,r)}async write(e,t,n){let r=this.devices.get(e);if(!r)return await super.write(e,t,n);r.driver.write(r,t,n)}writeSync(e,t,n){let r=this.devices.get(e);if(!r)return super.writeSync(e,t,n);r.driver.write(r,t,n)}};const br=new Uint8Array,xr={name:`null`,singleton:!0,init(){return{major:1,minor:3}},read(){return br},write(){}},Sr={name:`zero`,singleton:!0,init(){return{major:1,minor:5}},read(e,t,n,r){t.fill(0,n,r)},write(){}},Cr={name:`full`,singleton:!0,init(){return{major:1,minor:7}},read(e,t,n,r){t.fill(0,n,r)},write(){throw N(`ENOSPC`)}},wr={name:`random`,singleton:!0,init(){return{major:1,minor:8}},read(e,t){for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256)},write(){}},Tr={name:`console`,singleton:!0,init(e,{output:t=e=>console.log(e)}={}){return{major:5,minor:1,data:{output:t}}},read(){return br},write(e,t,n){let r=te(t);e.data.output(r,n)}},Er={null:xr,zero:Sr,full:Cr,random:wr,console:Tr};var Y=r();let X=!0;function Dr(e){X=e}var Or;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.FIFO=1]=`FIFO`,e[e.CHR=2]=`CHR`,e[e.DIR=4]=`DIR`,e[e.BLK=6]=`BLK`,e[e.REG=8]=`REG`,e[e.LNK=10]=`LNK`,e[e.SOCK=12]=`SOCK`,e[e.WHT=14]=`WHT`})(Or||={});function kr(e){return(e&61440)>>12}function Ar(e){return e<<12}var jr=class{ino;type;path;name},Mr=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},Nr=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},Pr=class{pending=new Set;lastWriter;writeState=0;readers=0;syncReaders=0;take(e,t,n){e==`rw`?this.writeState=t?2:1:(this.readers++,t&&this.syncReaders++);let r=!1,i=()=>{r||(r=!0,e==`rw`?this.writeState=0:(this.readers--,t&&this.syncReaders--),n())};return i[Symbol.dispose]=i,i}queue(e){let{promise:t,resolve:n}=Promise.withResolvers();return this.pending.add(t),e==`rw`&&(this.lastWriter=t),t.then(()=>{this.pending.delete(t),this.lastWriter==t&&delete this.lastWriter}),n}async acquire(e){let t=e==`ro`?this.lastWriter:Promise.all(this.pending),n=this.queue(e);return await t,this.take(e,!1,n)}acquireSync(e){if(this.writeState==2||e==`rw`&&this.syncReaders)throw N(`EDEADLK`);if(this.writeState||e==`rw`&&this.readers)throw N(`EAGAIN`);return this.take(e,!0,this.queue(e))}isAvailable(e){return(e!=`rw`||!this.readers)&&!this.writeState}get isFree(){return!this.writeState&&!this.readers}get mode(){return this.writeState?`rw`:this.readers?`ro`:null}};let Fr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;t=[b],n=[b],Nr(this,null,t,{kind:`getter`,name:`lock`,static:!1,private:!1,access:{has:e=>`lock`in e,get:e=>e.lock},metadata:r},null,e),Nr(this,null,n,{kind:`getter`,name:`lockSync`,static:!1,private:!1,access:{has:e=>`lockSync`in e,get:e=>e.lockSync},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}_rwLock=(Mr(this,e),new Pr);get lock(){return this._rwLock.acquire.bind(this._rwLock)}get lockSync(){return this._rwLock.acquireSync.bind(this._rwLock)}get isLocked(){return!this._rwLock.isFree}get lockMode(){return this._rwLock.mode}}})();var Ir=class extends Fr{fs;inode;data;dirtyRanges=[];truncatedTo;metadataDirty=!1;refs=0;paths=new Set;_lastPath;constructor(e,t,n){super(),this.fs=e,this.inode=n,this.paths.add(t),this._lastPath=t,this.data=new s(n.ino,n.size,{sparse:!0})}get ino(){return this.inode.ino}get path(){let[e]=this.paths;return e!==void 0&&(this._lastPath=e),e??this._lastPath}get dirty(){return this.metadataDirty||this.dirtyRanges.length>0}get bypassCache(){return Kn(this.inode)||Gn(this.inode)||!!(this.inode.flags&Vn.DAX)}markDirty(e,t){this.dirtyRanges.push({start:e,end:t}),this.dirtyRanges.sort((e,t)=>e.start-t.start);let n=[];for(let e of this.dirtyRanges){let t=n.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):n.push(e)}this.dirtyRanges=n}copyFromCache(e,t,n){let r=t;for(let i of this.data.regions){let a=i.offset+i.data.byteLength;if(a<=r)continue;if(i.offset>=n)break;i.offset>r&&(e.fill(0,r-t,i.offset-t),r=i.offset);let o=Math.min(n,a);e.set(i.data.subarray(r-i.offset,o-i.offset),r-t),r=o}r<n&&e.fill(0,r-t,n-t)}async read(e,t,n){if(this.bypassCache)return await this.fs.read(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);await this.fs.read(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}readSync(e,t,n){if(this.bypassCache)return this.fs.readSync(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);this.fs.readSync(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}async write(e,t){this.bypassCache?await this.fs.write(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}writeSync(e,t){this.bypassCache?this.fs.writeSync(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}_writeCached(e,t){let n=t+e.byteLength;this.data.add(e.slice(),t),n>this.data.size&&(this.data.size=n),this.markDirty(t,n)}_writeMetadata(e){!this.bypassCache&&e>this.inode.size&&(this.inode.size=e),this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}truncate(e){this.truncatedTo=Math.min(this.truncatedTo??e,e),this.data.size=e,this.dirtyRanges=this.dirtyRanges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t),this.inode.size=e,this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}get needsPreTruncate(){return!this.bypassCache&&this.truncatedTo!==void 0&&this.truncatedTo<this.inode.size&&!this.fs.attributes.has(`no_write`)}async sync(){this.needsPreTruncate&&await this.fs.touch(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);await this.fs.write(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||await this.fs.touch(this.path,this.inode),!1)}syncSync(){this.needsPreTruncate&&this.fs.touchSync(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);this.fs.writeSync(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||this.fs.touchSync(this.path,this.inode),!1)}},Lr=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},Rr=(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}),zr=class{fs;byIno=new Map;byPath=new Map;constructor(e){this.fs=e}get(e){return this.byPath.get(e)}ref(e,t){let n=this.byIno.get(t.ino);return n&&n.inode.nlink===n.paths.size&&!n.paths.has(e)&&R(`vcache.ref: vnode for ${this.fs.label||this.fs.uuid}:${t.ino} has an nlink of ${n.inode.nlink} but referenced by more paths [#314]`),n&&!n.paths.has(e)&&(t.ino===0||t.nlink<=1||n.inode.nlink<=1||(n.inode.mode^t.mode)&61440)&&(n=this.byPath.get(e),n&&(n.inode.mode^t.mode)&61440&&(n=void 0)),n?(n.paths.add(e),!n.dirty&&t!==n.inode&&Object.assign(n.inode,t)):(n=new Ir(this.fs,e,t),this.byIno.set(t.ino,n)),this.byPath.set(e,n),n.refs++,n}unref(e){e.refs--,!(e.refs>0||e.dirty)&&this.evict(e)}evict(e){this.byIno.delete(e.ino);for(let t of e.paths)this.byPath.delete(t)}rename(e,t){for(let[n,r]of this.byPath){if(n!=e&&!n.startsWith(e+`/`))continue;let i=t+n.slice(e.length);this.byPath.delete(n),this.byPath.set(i,r),r.paths.delete(n),r.paths.add(i)}}link(e,t){let n=this.byPath.get(e);n&&(n.paths.add(t),this.byPath.set(t,n))}remove(e){let t=this.byPath.get(e);t&&(this.byPath.delete(e),t.paths.delete(e),!t.paths.size&&!t.refs&&this.evict(t))}async sync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;Lr(t,await e.lock(`rw`),!1),await e.sync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{Rr(t)}}}syncSync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;Lr(t,e.lockSync(`rw`),!1),e.syncSync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{Rr(t)}}}};const Br=new Map;function Z(e){let t=Br.get(e.uuid);return t||(t=new zr(e),Br.set(e.uuid,t)),t}async function Vr(e,t,n,r){let i=Z(e);r??=i.get(t)?.inode??await e.stat(t);let a=i.ref(t,r),o=await a.lock(n),s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}function Hr(e,t,n,r){let i=Z(e);r??=i.get(t)?.inode??e.statSync(t);let a=i.ref(t,r),o;try{o=a.lockSync(n)}catch(e){throw i.unref(a),e}let s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}var Ur=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},Wr=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},Gr=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},Kr=(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});const qr=4096;let Jr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;Wr(this,null,t,{kind:`getter`,name:`inode`,static:!1,private:!1,access:{has:e=>`inode`in e,get:e=>e.inode},metadata:r},null,e),Wr(this,null,n,{kind:`getter`,name:`fs`,static:!1,private:!1,access:{has:e=>`fs`in e,get:e=>e.fs},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}context=Ur(this,e);path;internalPath;flag;vnode;_position=0;get position(){return this.flag&1024?this.inode.size:this._position}set position(e){this._position=e}get inode(){return this.vnode.inode}get fs(){return this.vnode.fs}get dirty(){return this.vnode.dirty}closed=!1;refs=1;ref(){if(this.closed)throw M(`EBADF`,`dup`,this.path);return this.refs++,this}get isClosed(){return this.closed}constructor(e,t,n,r,i){this.context=e,this.path=t,this.internalPath=n,this.flag=r,this.vnode=i}get _isSync(){return!!(this.flag&1052672||this.inode.flags&Vn.Sync||this.fs.attributes.has(`sync`))}[(t=[b],n=[b],Symbol.dispose)](){this.closeSync()}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`sync`,this.path);if(!this.dirty)return;Gr(e,this.vnode.lockSync(`rw`),!1),this.vnode.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{Kr(e)}}datasyncSync(){return this.syncSync()}closeSync(){if(this.closed)throw M(`EBADF`,`close`,this.path);this.syncSync(),!(--this.refs>0)&&this.disposeSync(!0)}disposeSync(e){if(this.closed)throw M(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw M(`EBUSY`,`close`,this.path);this.closed=!0,Z(this.fs).unref(this.vnode)}truncateSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw M(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`truncate`,this.path);if(this.inode.flags&Vn.Immutable)throw M(`EPERM`,`truncate`,this.path);Gr(t,this.vnode.lockSync(`rw`),!1),this.vnode.truncate(e),this._isSync&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{Kr(t)}}writeSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);if(this.inode.flags&Vn.Immutable)throw M(`EPERM`,`write`,this.path);Gr(i,this.vnode.lockSync(`rw`),!1);let a=e.subarray(t,t+n);return this.vnode.writeSync(a,r),this._position=r+a.byteLength,this._isSync&&this.vnode.syncSync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Kr(i)}}readSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw M(`EBADF`,`read`,this.path);Gr(i,this.vnode.lockSync(`ro`),!1),!(this.inode.flags&Vn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!Kn(this.inode)&&!Gn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return this.vnode.readSync(o.subarray(t,t+n),r,a),this._isSync&&this.vnode.syncSync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{Kr(i)}}chmodSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`chmod`,this.path);Gr(t,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Qe)|e,(this._isSync||e>61440)&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{Kr(t)}}chownSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`chmod`,this.path);Gr(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,Jn(this.inode,e,t),this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{Kr(n)}}utimesSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`utimes`,this.path);Gr(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{Kr(n)}}async[Symbol.asyncDispose](){await this.close()}async sync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`sync`,this.path);if(!this.dirty)return;Gr(e,await this.vnode.lock(`rw`),!1),await this.vnode.sync()}catch(t){e.error=t,e.hasError=!0}finally{Kr(e)}}datasync(){return this.sync()}async close(){if(this.closed)throw M(`EBADF`,`close`,this.path);await this.sync(),!(--this.refs>0)&&this.dispose(!0)}dispose(e){if(this.closed)throw M(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw M(`EBUSY`,`close`,this.path);this.closed=!0,Z(this.fs).unref(this.vnode)}stat(){if(this.closed)throw M(`EBADF`,`stat`,this.path);return this.inode}async truncate(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw M(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`truncate`,this.path);if(this.inode.flags&Vn.Immutable)throw M(`EPERM`,`truncate`,this.path);Gr(t,await this.vnode.lock(`rw`),!1),this.vnode.truncate(e),this._isSync&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{Kr(t)}}async write(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);if(this.inode.flags&Vn.Immutable)throw M(`EPERM`,`write`,this.path);Gr(i,await this.vnode.lock(`rw`),!1);let a=e.subarray(t,t+n);return await this.vnode.write(a,r),this._position=r+a.byteLength,this._isSync&&await this.vnode.sync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Kr(i)}}async read(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw M(`EBADF`,`read`,this.path);Gr(i,await this.vnode.lock(`ro`),!1),!(this.inode.flags&Vn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!Kn(this.inode)&&!Gn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return await this.vnode.read(o.subarray(t,t+n),r,a),this._isSync&&await this.vnode.sync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{Kr(i)}}async chmod(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`chmod`,this.path);Gr(t,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Qe)|e,(this._isSync||e>61440)&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{Kr(t)}}async chown(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`chown`,this.path);Gr(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,Jn(this.inode,e,t),this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{Kr(n)}}async utimes(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`utimes`,this.path);Gr(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{Kr(n)}}streamRead(e){if(this.closed)throw M(`EBADF`,`streamRead`,this.path);let{vnode:t}=this;return new ReadableStream({async start(n){let r={stack:[],error:void 0,hasError:!1};try{Gr(r,await t.lock(`ro`),!1);let{start:i=0,end:a=t.inode.size}=e;for(let e=i;e<a;e+=qr){let r=e+qr>a?a-e:qr,i=new Uint8Array(r);await t.read(i,e,e+r).catch(n.error.bind(n)),n.enqueue(i)}n.close()}catch(e){r.error=e,r.hasError=!0}finally{Kr(r)}},type:`bytes`})}streamWrite(e){if(this.closed)throw M(`EBADF`,`write`,this.path);if(this.inode.flags&Vn.Immutable)throw M(`EPERM`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);let{vnode:t}=this,n=e.start??0;return new WritableStream({async write(e,r){let i={stack:[],error:void 0,hasError:!1};try{Gr(i,await t.lock(`rw`),!1),await t.write(e,n).catch(r.error.bind(r)),n+=e.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Kr(i)}},async close(){let e={stack:[],error:void 0,hasError:!1};try{Gr(e,await t.lock(`rw`),!1),await t.sync()}catch(t){e.error=t,e.hasError=!0}finally{Kr(e)}}})}}})();function Yr(e,t=e.context){let n=ze(t).descriptors,r=0;for(;n.has(r);)r++;return n.set(r,e),r}function Xr(e,t){cn(t);let n=ze(e).descriptors.get(t);if(!n)throw N(`EBADF`);return n}function Zr(e,t){return ze(e).descriptors.delete(t)}function Qr(e,t){return Yr(Xr(e,t).ref(),e)}const $r=/[rwasx]{1,2}\+?/;function ei(e){if(typeof e==`number`)return e;if(!$r.test(e))throw N(`EINVAL`,`Invalid flag string: `+e);return ti(e)}function ti(e){if(!e.includes(`r`)&&!e.includes(`w`)&&!e.includes(`a`))throw N(`EINVAL`,`Invalid flag string: `+e);let t=e.includes(`r`)?0:64;return e.includes(`w`)&&(t|=512),e.includes(`a`)&&(t|=Ue),e.includes(`+`)?t|=2:e.includes(`r`)||(t|=1),e.includes(`s`)&&(t|=qe),e.includes(`x`)&&(t|=128),t}function ni(e){let t=0;return e&1||(t|=4),(e&1||e&2)&&(t|=2),t}const ri=j;function ii(e,t){return e.path=t,e}function ai(e,t,n,r){let i=typeof n==`string`?{path:n,dest:r,syscall:t.endsWith(`Sync`)?t.slice(0,-4):t}:n,a=e[t];if(typeof a!=`function`)throw TypeError(`${t} is not a function`);return function(...t){try{return a.call(e,...t)}catch(e){throw A(Object.assign(e,i))}}}function oi(e,t){return new Proxy(e,{get(e,n){let r=Reflect.get(e,n);return typeof r==`function`?function n(...i){try{let a=r.apply(e,i);return a instanceof Promise?a.catch(e=>{if(`code`in e)throw A(Object.assign(e,t));if(e in O){let r=M(e,t);Error.captureStackTrace(r,n)}throw e}):a}catch(e){throw A(Object.assign(e,t))}}:r}})}const si=Re.mounts;ci(`/`,vr.create({label:`root`}));function ci(e,t){let n=ze(this);if(e[0]!=`/`&&(e=`/`+e),e=bn.call(n,e),n.mounts.has(e))throw R(N(`EINVAL`,`Mount point is already in use: `+e));t._mountPoint=e,n.mounts.set(e,t),Br.has(t.uuid)||Br.set(t.uuid,new zr(t)),fe(`Mounted ${t.name} on ${e}`),pe(`${t.name} attributes: ${[...t.attributes].map(([e,t])=>t==null?e:e+`=`+t).join(`, `)}`)}function li(e){let t=ze(this);e[0]!=`/`&&(e=`/`+e),e=bn.call(this,e);let n=t.mounts.get(e);if(!n){z(e+` is already unmounted`);return}let r=()=>{Br.delete(n.uuid),fe(`Synced all changes to `+e)};try{Br.get(n.uuid)?.syncSync(),r()}catch{z(`Could not flush to ${e} synchronously.`),Br.get(n.uuid)?.sync().then(r)}t.mounts.delete(e),de(`Unmounted `+e)}function ui(e,t,n){let{root:r,mounts:i}=ze(t),a={path:e,...n};e=H(U(r,e),!0),e=bn.call(t,e);let o=[...i].sort((e,t)=>e[0].length>t[0].length?-1:1);for(let[t,n]of o){if(!pi(t,e))continue;e=e.slice(t.length>1?t.length:0),e===``&&(e=`/`);let i=n.attributes.get(`case_fold`);return i===`lower`&&(e=e.toLowerCase()),i===`upper`&&(e=e.toUpperCase()),{fs:oi(n,a),path:e,mountPoint:t,root:r}}throw le(new j(O.EIO,`No file system for `+e))}function di(e,t){let n=e.usage(),r=n.blockSize||4096,i=t?BigInt:Number;return{type:i(e.type),bsize:i(r),frsize:i(r),ffree:i(n.freeNodes||4294967295),files:i(n.totalNodes||4294967295),bavail:i(n.freeSpace/r),bfree:i(n.freeSpace/r),blocks:i(n.totalSpace/r)}}function fi(e){let t=ze(this);if(!Pe(t.credentials))throw N(`EPERM`,`Can not chroot() as non-root user`);t.root??=`/`;let n=U(t.root,e);for(let e of t.descriptors?.values()??[]){if(!e.path.startsWith(t.root))throw M(`EBUSY`,`chroot`,e.path);e.path=e.path.slice(t.root.length)}if(n.length>t.root.length)throw N(`EPERM`,`Can not chroot() outside of current root`);t.root=n}function pi(e,t){return e===`/`||e===t||(e.endsWith(`/`)||(e+=`/`),t.startsWith(e))}var mi=t({link:()=>Ci,mkdir:()=>bi,open:()=>vi,readdir:()=>xi,readlink:()=>yi,rename:()=>Si,resolve:()=>_i,stat:()=>wi}),hi=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},gi=(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});function _i(e,t,n,r){t=bn.call(e,t);try{let i=ui(t,e),a=Z(i.fs).get(i.path)?.inode??i.fs.statSync(i.path);return!Un(a)||n?{...i,fullPath:t,stats:a}:_i(e,bn.call(e,W(t),yi.call(e,t)),n,r)}catch(e){if(A(Object.assign(e,{syscall:`stat`,path:t,...r})),n)throw e}let{base:i,dir:a}=Dn(t),o=a==`/`?`/`:_i(e,a,!1,r).fullPath,s=U(o,i),c=ui(s,e),l;try{l=Z(c.fs).get(c.path)?.inode??c.fs.statSync(c.path)}catch(e){if(e.code===`ENOENT`)return{...c,fullPath:s};throw A(Object.assign(e,{syscall:`stat`,path:s,...r}))}return Un(l)?_i(e,bn.call(e,o,yi.call(e,s)),!1,r):{...c,fullPath:s,stats:l}}function vi(e,t,n){t=H.call(e,t);let r=on(n.mode,420),i=ei(n.flag);t=n.preserveSymlinks?t:_i(e,t).fullPath;let{fs:a,path:o}=ui(t,e),s;try{s=a.statSync(o)}catch{}if(!s){let s={stack:[],error:void 0,hasError:!1};try{if(!(i&64))throw M(`ENOENT`,`open`,t);let c=W(o),l=a.statSync(c);if(X&&!J(e,l,2))throw M(`EACCES`,`open`,t);if(!q(l))throw M(`ENOTDIR`,`open`,t);if(!n.allowDirectory&&q({mode:r}))throw M(`EISDIR`,`open`,t);hi(s,Hr(a,c,`rw`,l),!1);let{euid:u,egid:d}=ze(e).credentials,f=a.createFileSync(o,{mode:r,uid:l.mode&2048?l.uid:u,gid:l.mode&1024?l.gid:d});return Oa(e,`rename`,t),new Jr(e,t,o,i,Z(a).ref(o,f))}catch(e){s.error=e,s.hasError=!0}finally{gi(s)}}if(X&&(!J(e,s,r)||!J(e,s,ni(i))))throw M(`EACCES`,`open`,t);if(i&128)throw M(`EEXIST`,`open`,t);if(!n.allowDirectory&&q(s))throw M(`EISDIR`,`open`,t);let c=new Jr(e,t,o,i,Z(a).ref(o,s));return i&512&&c.truncateSync(0),c}function yi(e){e=H.call(this,e);let{fs:t,stats:n,path:r}=_i(this,e,!0,{syscall:`readlink`});if(!n)throw M(`ENOENT`,`readlink`,e);if(X&&!J(this,n,4))throw M(`EACCES`,`readlink`,e);if(!Un(n))throw M(`EINVAL`,`readlink`,e);let i=n.size,a=new Uint8Array(i);return t.readSync(r,a,0,i),te(a)}function bi(e,t={}){let n=H.call(this,e),r={syscall:`mkdir`,path:n},{fullPath:i}=_i(this,W(n),!1,r),{fs:a,path:o}=ui(U(i,wn(n)),this,r),s=i!=W(n),{euid:c,egid:l}=ze(this).credentials,{mode:u=511,recursive:d}=t,f,p=(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let i=W(t),m=d&&i!=`/`?p(W(e),i):a.statSync(i);if(d){let n;try{n=Z(a).get(t)?.inode??a.statSync(t)}catch{}if(n){let i=Un(n)?_i(this,e,!1,r).stats:n;if(!i)throw M(`ENOENT`,r);if(!q(i))throw M(t==o?`EEXIST`:`ENOTDIR`,r);return n}if(s&&a.existsSync(U(i,wn(e))))throw M(`ENOENT`,r)}if(X&&!J(this,m,2))throw M(`EACCES`,`mkdir`,e);hi(n,Hr(a,i,`rw`,m),!1);let h=ai(a,`mkdirSync`,{path:e,syscall:`mkdir`})(t,{mode:u,uid:m.mode&2048?m.uid:c,gid:m.mode&1024?m.gid:l});return d&&(f??=e),Oa(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{gi(n)}};return p(n,o),f}function xi(e,t={}){e=H.call(this,e);let{fs:n,path:r}=_i(this,e),i=Z(n).get(r)?.inode??ai(n,`statSync`,{path:e,syscall:`scandir`})(r);if(X&&!J(this,i,4))throw M(`EACCES`,`scandir`,e);if(!q(i))throw M(`ENOTDIR`,`scandir`,e);let a;{let e={stack:[],error:void 0,hasError:!1};try{hi(e,Hr(n,r,`ro`,i),!1),a=n.readdirSync(r)}catch(t){e.error=t,e.hasError=!0}finally{gi(e)}}let o=[],s=e=>{let i;try{i=n.statSync(U(r,e))}catch(e){if(e.code==`ENOENT`)return;throw e}let a=new jr;if(a.ino=i.ino,a.type=kr(i.mode),a.path=e,a.name=wn(e),o.push(a),!q(i)||!t?.recursive)return;let c=n.readdirSync(U(r,e));for(let t of c)s(U(e,t))};for(let e of a)s(e);return o}function Si(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H.call(this,e),t=H.call(this,t);let r={syscall:`rename`,path:e,dest:t},i=_i(this,e,!0,r),a=ui(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw M(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw M(`EINVAL`,r);if(!i.stats)throw M(`ENOENT`,r);let o=i.fs,s=o.statSync(W(i.path)),c=o.statSync(W(a.path)),l;try{l=o.statSync(a.path)}catch(e){if(e.code!=`ENOENT`)throw e}if(X&&(!J(this,s,4)||!J(this,c,2)))throw M(`EACCES`,r);if(l&&!q(i.stats)&&q(l))throw M(`EISDIR`,r);if(l&&q(i.stats)&&!q(l))throw M(`ENOTDIR`,r);let u=W(i.path),d=W(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),hi(n,Hr(o,f[0][0],`rw`,f[0][1]),!1),hi(n,s.ino==c.ino?null:Hr(o,f[1][0],`rw`,f[1][1]),!1),i.fs.renameSync(i.path,a.path),Z(o).rename(i.path,a.path),Oa(this,`rename`,e),Oa(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{gi(n)}}function Ci(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H.call(this,e),t=H.call(this,t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=ui(e,this,r),o=ui(t,this,r);if(i.uuid!==o.fs.uuid)throw M(`EXDEV`,r);let s=i.statSync(a);if(X){if(!J(this,s,4))throw M(`EACCES`,r);let e=i.statSync(W(a));if(!J(this,e,4))throw M(`EACCES`,r);let t=i.statSync(W(o.path));if(!J(this,t,2))throw M(`EACCES`,r)}hi(n,Hr(i,W(o.path),`rw`),!1),i.linkSync(a,o.path),Z(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{gi(n)}}function wi(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=_i(this,e,!1,n).stats;else{let{base:t,dir:i}=Dn(e),{fs:a,path:o}=_i(this,i,!1,n);try{let e=t?U(o,t):o;r=Z(a).get(e)?.inode??a.statSync(e)}catch(e){throw A(Object.assign(e,n)),e}}if(!r)throw M(`ENOENT`,n);if(X&&!J(this,r,4))throw M(`EACCES`,n);return r}var Ti=class e{ino;type;_name;get name(){let e=Y.Buffer.from(this._name);return this._encoding==`buffer`?e:e.toString(this._encoding)}_encoding;_parentPath;get parentPath(){return this._parentPath}get path(){return z(`Dirent.path was removed in Node v24, use parentPath instead`),this._parentPath}static from(t,n,r=`.`){let i=new e,{base:a,dir:o}=Dn(t.path);return i._parentPath=U(r,o),i._name=a,i.ino=t.ino,i.type=t.type,i._encoding=n,i}isFile(){return this.type===Or.REG}isDirectory(){return this.type===Or.DIR}isBlockDevice(){return this.type===Or.BLK}isCharacterDevice(){return this.type===Or.CHR}isSymbolicLink(){return this.type===Or.LNK}isFIFO(){return this.type===Or.FIFO}isSocket(){return this.type===Or.SOCK}};function Ei(){return Object.assign(Error(`Directory handle was closed`),{code:`ERR_DIR_CLOSED`})}var Di=class{path;context;closed=!1;checkClosed(){if(this.closed)throw Ei()}_entries;constructor(e,t){this.path=e,this.context=t}close(e){if(this.closed){let t=Ei();if(!e)return Promise.reject(t);e(t);return}if(this.closed=!0,!e)return Promise.resolve();e(null)}closeSync(){if(this.closed)throw Ei();this.closed=!0}async _read(){return this.checkClosed(),this._entries??=await zo.call(this.context,this.path,{withFileTypes:!0}),this._entries.length?this._entries.shift()??null:null}read(e){if(!e)return this._read();this._read().then(t=>e(null,t))}readSync(){return this.checkClosed(),this._entries??=$i.call(this.context,this.path,{withFileTypes:!0}),this._entries.length?this._entries.shift()??null:null}async next(){let e=await this._read();return e?{done:!1,value:e}:(await this.close(),{done:!0,value:void 0})}[Symbol.asyncIterator](){return this}[Symbol.dispose](){this.closed||this.closeSync()}async[Symbol.asyncDispose](){this.closed||await this.close()}},Oi=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},ki=(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});function Ai(e,t){return Si.call(this,e,t)}function ji(e){e=H.call(this,e);try{let{fs:t,path:n}=_i(this,e);return t.existsSync(n)}catch(e){if(e.errno==O.ENOENT)return!1;throw e}}function Mi(e,t){let n;try{n=wi.call(this,e,!1)}catch(e){if(t?.throwIfNoEntry===!1&&ln(e))return;throw e}return t?.bigint?new Mn(n):new jn(n)}function Ni(e,t){let n;try{n=wi.call(this,e,!0)}catch(e){if(t?.throwIfNoEntry===!1&&ln(e))return;throw e}return t?.bigint?new Mn(n):new jn(n)}function Pi(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{let r=Oi(n,vi(this,e,{flag:`r+`}),!1);if(t||=0,t<0)throw M(`EINVAL`,`truncate`,e.toString());r.truncateSync(t)}catch(e){n.error=e,n.hasError=!0}finally{ki(n)}}function Fi(e){e=H.call(this,e);let{fs:t,path:n}=ui(e,this);try{let e={stack:[],error:void 0,hasError:!1};try{if(X&&!J(this,t.statSync(n),2))throw M(`EACCES`,`unlink`);Oi(e,Hr(t,W(n),`rw`),!1),t.unlinkSync(n),Z(t).remove(n)}catch(t){e.error=t,e.hasError=!0}finally{ki(e)}}catch(t){throw A(Object.assign(t,{syscall:`unlink`,path:e}))}Oa(this,`rename`,e.toString())}function Ii(e,t,n=0){return Yr(vi(this,e,{flag:t,mode:n}))}function Li(e,t,n){return Yr(vi(this,e,{flag:t,mode:n,preserveSymlinks:!0}))}function Ri(e,t={}){let n={stack:[],error:void 0,hasError:!1};try{let r=dn(t,null,`r`,420);if(ei(r.flag)&1)throw M(`EBADF`,`read`,e.toString());let i=Oi(n,typeof e==`number`?Xr(this,e):vi(this,e.toString(),{flag:r.flag,mode:420,preserveSymlinks:!1}),!1),{size:a}=i.stat(),o=Y.Buffer.alloc(a);return i.readSync(o,0,a,0),r.encoding?o.toString(r.encoding):o}catch(e){n.error=e,n.hasError=!0}finally{ki(n)}}function zi(e,t,n={}){let r={stack:[],error:void 0,hasError:!1};try{let i=dn(n,`utf8`,`w+`,420),a=ei(i.flag);if(!(a&1||a&2))throw new j(O.EINVAL,`Flag passed to writeFile must allow for writing`);if(typeof t!=`string`&&!i.encoding)throw new j(O.EINVAL,`Encoding not specified`);let o=typeof t==`string`?Y.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(!o)throw new j(O.EINVAL,`Data not specified`);Oi(r,typeof e==`number`?Xr(this,e):vi(this,e.toString(),{flag:a,mode:i.mode}),!1).writeSync(o,0,o.byteLength,0),Oa(this,`change`,e.toString())}catch(e){r.error=e,r.hasError=!0}finally{ki(r)}}function Bi(e,t,n={}){let r=dn(n,`utf8`,`a+`,420),i=ei(r.flag);if(!(i&1024))throw new j(O.EINVAL,`Flag passed to appendFile must allow for appending`);if(typeof t!=`string`&&!r.encoding)throw new j(O.EINVAL,`Encoding not specified`);let a=typeof t==`string`?Y.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=typeof e==`number`?Xr(this,e):vi(this,H.call(this,e),{flag:i,mode:r.mode});o.writeSync(a,0,a.byteLength),typeof o!=`number`&&o.closeSync()}function Vi(e,t){let n=Xr(this,e).stat();return t?.bigint?new Mn(n):new jn(n)}function Hi(e){Xr(this,e).closeSync(),Zr(this,e)}function Ui(e,t=0){if(t||=0,t<0)throw new j(O.EINVAL);Xr(this,e).truncateSync(t)}function Wi(e){Xr(this,e).syncSync()}function Gi(e){Xr(this,e).datasyncSync()}function Ki(e,t,n,r,i){let a,o,s,c;if(typeof t==`string`){c=typeof n==`number`?n:null;let e=typeof r==`string`?r:`utf8`;o=0,a=Y.Buffer.from(t,e),s=a.byteLength}else a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=n,s=r,c=typeof i==`number`?i:null;let l=Xr(this,e);c??=l.position;let u=l.writeSync(a,o,s,c);return Oa(this,`change`,l.path),u}function qi(e,t,n,r,i){let a=Xr(this,e),o=typeof n==`object`?n.offset:n;if(typeof n==`object`&&(r=n.length,i=n.position),i&&i>2**53-1)throw M(`EINVAL`);return typeof i==`bigint`&&(i=Number(i)),i=Number.isSafeInteger(i)?i:a.position,a.readSync(t,o,r,i)}function Ji(e,t,n){Xr(this,e).chownSync(t,n)}function Yi(e,t){let n=on(t,-1);if(n<0)throw new j(O.EINVAL,`Invalid mode.`);Xr(this,e).chmodSync(n)}function Xi(e,t,n){Xr(this,e).utimesSync(un(t),un(n))}function Zi(e){let t={stack:[],error:void 0,hasError:!1};try{e=H.call(this,e);let{fs:n,path:r}=_i(this,e),i=ai(n,`statSync`,{path:e,syscall:`rmdir`})(r);if(!q(i))throw M(`ENOTDIR`,`rmdir`,e);if(X&&!J(this,i,2))throw M(`EACCES`,`rmdir`,e);Oi(t,Hr(n,W(r),`rw`),!1),ai(n,`rmdirSync`,e)(r),Z(n).remove(r),Oa(this,`rename`,e.toString())}catch(e){t.error=e,t.hasError=!0}finally{ki(t)}}function Qi(e,t){t=typeof t==`object`?t:{mode:t};let n=on(t?.mode,511);return bi.call(this,e,{...t,mode:n})}function $i(e,t){t=typeof t==`object`?t:{encoding:t},e=H.call(this,e);let n=[],r=xi.call(this,e,t??void 0);for(let i of r)t?.withFileTypes?n.push(Ti.from(i,t.encoding,e)):t?.encoding==`buffer`?n.push(Y.Buffer.from(i.path)):n.push(i.path);return n}function ea(e,t){return Ci.call(this,e,t)}function ta(e,t,n=`file`){let r={stack:[],error:void 0,hasError:!1};try{if(![`file`,`dir`,`junction`].includes(n))throw TypeError(`Invalid symlink type: `+n);t=H.call(this,t);let i=Oi(r,vi(this,t,{flag:`wx`,mode:420}),!1);i.writeSync(T(H.call(this,e,!0))),i.chmodSync(et)}catch(e){r.error=e,r.hasError=!0}finally{ki(r)}}function na(e,t){let n=Y.Buffer.from(yi.call(this,e)),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}function ra(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{Oi(r,vi(this,e,{flag:`r+`,mode:0}),!1).chownSync(t,n)}catch(e){r.error=e,r.hasError=!0}finally{ki(r)}}function ia(e,t,n){let r=Li.call(this,e,`r+`);Ji.call(this,r,t,n),Hi.call(this,r)}function aa(e,t){let n;try{n=Ii.call(this,e,`r+`)}catch(t){throw A(Object.assign(t,{syscall:`chmod`,path:H.call(this,e)}))}Yi.call(this,n,t),Hi.call(this,n)}function oa(e,t){let n=Li.call(this,e,`r+`);Yi.call(this,n,t),Hi.call(this,n)}function sa(e,t,n){let r=Ii.call(this,e,`r+`);Xi.call(this,r,t,n),Hi.call(this,r)}function ca(e,t,n){let r=Li.call(this,e,`r+`);Xi.call(this,r,t,n),Hi.call(this,r)}function la(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=H.call(this,e,!0);let{fullPath:r}=_i(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=Y.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function ua(e,t=384){if(X&&!J(this,Mi.call(this,e),t))throw new j(O.EACCES)}function da(e,t){e=H.call(this,e);let n;try{n=Ni.bind(this)(e)}catch(e){if(e.code!=`ENOENT`||!t?.force)throw e}if(n)switch(n.mode&Qe){case rt:if(t?.recursive)for(let n of $i.call(this,e))da.call(this,U(e,n),t);Zi.call(this,e);break;case tt:case et:case nt:case it:Fi.call(this,e);break;case at:case $e:default:throw M(`ENOSYS`,`rm`,e)}}function fa(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=mn(e);return Qi.call(this,r),n==`buffer`?Y.Buffer.from(r):r}function pa(e,t){let n=mn(e);Qi.call(this,n);let r=()=>da(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.dispose]:r}}function ma(e,t,n){if(e=H.call(this,e),t=H.call(this,t),n&&n&1&&ji.call(this,t))throw M(`EEXIST`,`copyFile`,t);zi.call(this,t,Ri.call(this,e)),Oa(this,`rename`,t.toString())}function ha(e,t,n){let r=Xr(this,e),i=0;for(let e of t)i+=r.readSync(e,0,e.byteLength,n+i);return i}function ga(e,t,n){let r=Xr(this,e),i=0;for(let e of t)i+=r.writeSync(new Uint8Array(e.buffer),0,e.byteLength,n+i);return i}function _a(e,t){return e=H.call(this,e),new Di(e,this)}function va(e,t,n){e=H.call(this,e),t=H.call(this,t);let r=Ni.call(this,e);if(n?.errorOnExist&&ji.call(this,t))throw M(`EEXIST`,`cp`,t);switch(r.mode&Qe){case rt:if(!n?.recursive)throw M(`EISDIR`,`cp`,e);Qi.call(this,t,{recursive:!0});for(let r of $i.call(this,e,{withFileTypes:!0}))n.filter&&!n.filter(U(e,r.name),U(t,r.name))||va.call(this,U(e,r.name),U(t,r.name),n);break;case et:if(n?.dereference)ma.call(this,e,t);else{let r=na.call(this,e,`utf8`);ta.call(this,n?.verbatimSymlinks?r:bn.call(this,W(e),r),t)}break;case tt:ma.call(this,e,t);break;case nt:case it:case at:case $e:default:throw M(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&sa.call(this,t,r.atime,r.mtime)}function ya(e,t){e=H.call(this,e);let{fs:n}=ui(e,this);return di(n,t?.bigint)}function ba(e,t={}){e=Array.isArray(e)?e:[e];let n=ze(this),{cwd:r=n.pwd,withFileTypes:i=!1,exclude:a=()=>!1,followSymlinks:o=!1}=t,s=bn.call(n,r instanceof URL?r.pathname:r),c=e.map(e=>e.startsWith(`/`)?Cn.call(n,s,e):e),l=c.some(e=>e.includes(`**`)),u=c.map(e=>{let t=e.search(/[*?[\]{]/);if(t===-1)return e;let n=e.lastIndexOf(`/`,t);return n===-1?``:e.slice(0,n)}),d=c.map(fn);function f(e,t){let r=u.some(e=>t===e||e.startsWith(t+`/`)),i=l||r,a=Ni.call(n,e);return a.isSymbolicLink()?i&&(o||r)&&!!Mi.call(n,e,{throwIfNoEntry:!1})?.isDirectory():i&&a.isDirectory()}let p=[];function m(e){let t=$i.call(n,e,{withFileTypes:i,encoding:`utf8`});for(let r of t){let t=U(e,i?r.name:r),o=Cn.call(n,s,t);(typeof a==`function`?a(i?r:o):a.some(e=>On(e,o)))||(f(t,o)&&m(t),d.some(e=>e.test(o))&&p.push(i?r:o))}}return m(s),p}const xa=Mi;var Sa=class extends u.default{_context;path;off(e,t,n,r){return super.off(e,t,n,r)}removeListener(e,t,n,r){return super.removeListener(e,t,n,r)}constructor(e,t){super(),this._context=e,this.path=t}setMaxListeners(){throw M(`ENOSYS`,`Watcher.setMaxListeners`)}getMaxListeners(){throw M(`ENOSYS`,`Watcher.getMaxListeners`)}prependListener(){throw M(`ENOSYS`,`Watcher.prependListener`)}prependOnceListener(){throw M(`ENOSYS`,`Watcher.prependOnceListener`)}rawListeners(){throw M(`ENOSYS`,`Watcher.rawListeners`)}ref(){return this}unref(){return this}},Ca=class extends Sa{options;realpath;constructor(e,t,n){let r=ze(e);super(r,t),this.options=n,this.realpath=U(r.root,t),Ea(this.realpath,this)}close(){super.emit(`close`),Da(this.realpath,this)}[Symbol.dispose](){this.close()}},wa=class extends Sa{options;intervalId;previous;constructor(e,t,n){super(e,t),this.options=n,this.start()}onInterval(){try{let e=xa.call(this._context,this.path);Nn(this.previous,e)||(this.emit(`change`,e,this.previous),this.previous=e)}catch(e){this.emit(`error`,e)}}start(){let e=this.options.interval||5e3;try{this.previous=xa.call(this._context,this.path)}catch(e){this.emit(`error`,e);return}this.intervalId=setInterval(this.onInterval.bind(this),e),!this.options.persistent&&typeof this.intervalId==`object`&&this.intervalId.unref()}stop(){this.intervalId&&=(clearInterval(this.intervalId),void 0),this.removeAllListeners()}};const Ta=new Map;function Ea(e,t){let n=H(e);Ta.has(n)||Ta.set(n,new Set),Ta.get(n).add(t)}function Da(e,t){let n=H(e);Ta.has(n)&&(Ta.get(n).delete(t),Ta.get(n).size===0&&Ta.delete(n))}function Oa(e,t,n){let r=ze(e);r&&(n=U(r.root??`/`,n)),n=H.call(e,n);for(let e=n;;e=W(e)){let r=Ta.get(e);if(r)for(let i of r)i.emit(`change`,t,Cn.call(i._context,e,n)||wn(n));if(e===`/`)break}}var ka=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},Aa=(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});async function ja(e,t,n,r){if(t=bn.call(e,t),n){let n=ui(t,e,r),i=Z(n.fs).get(n.path)?.inode??await n.fs.stat(n.path).catch(()=>void 0);return{...n,fullPath:t,stats:i}}try{let i=ui(t,e),a=Z(i.fs).get(i.path)?.inode??await i.fs.stat(i.path);return Un(a)?await ja(e,bn.call(e,W(t),await Na.call(e,t)),n,r):{...i,fullPath:t,stats:a}}catch{}let{base:i,dir:a}=Dn(t),o=a==`/`?`/`:(await ja(e,a,!1,r)).fullPath,s=U(o,i),c=ui(s,e),l=Z(c.fs).get(c.path)?.inode??await c.fs.stat(c.path).catch(e=>{if(e.code!=`ENOENT`)throw A(Object.assign(e,{syscall:`stat`,path:s,...r}))});return l?Un(l)?await ja(e,bn.call(e,o,await Na.call(e,s)),!1,r):{...c,fullPath:s,stats:l}:{...c,fullPath:s}}async function Ma(e,t,n){t=H.call(e,t);let r=on(n.mode,420),i=ei(n.flag),a={syscall:`open`,path:t},{fs:o,path:s,stats:c}=await ja(e,t,n.preserveSymlinks,a);if(!c){let l={stack:[],error:void 0,hasError:!1};try{if(!(i&64))throw M(`ENOENT`,a);let u=W(s),d=await o.stat(u);if(X&&!J(e,d,2))throw M(`EACCES`,`open`,W(t));if(!q(d))throw M(`ENOTDIR`,`open`,W(t));if(!n.allowDirectory&&q({mode:r}))throw M(`EISDIR`,`open`,t);if(ka(l,await Vr(o,u,`rw`,d),!1),c=Z(o).get(s)?.inode??await o.stat(s).catch(()=>void 0),!c){let{euid:n,egid:a}=ze(e).credentials,c=await o.createFile(s,{mode:r,uid:d.mode&2048?d.uid:n,gid:d.mode&1024?d.gid:a});return Oa(e,`rename`,t),new Jr(e,t,s,i,Z(o).ref(s,c))}}catch(e){l.error=e,l.hasError=!0}finally{Aa(l)}}if(X&&!J(e,c,ni(i)))throw M(`EACCES`,a);if(i&128)throw M(`EEXIST`,a);if(!n.allowDirectory&&q({mode:r}))throw M(`EISDIR`,`open`,t);let l=new Jr(e,t,s,i,Z(o).ref(s,c));return i&512&&await l.truncate(0),l}async function Na(e){e=H.call(this,e);let t={syscall:`readlink`,path:e},{fs:n,stats:r,path:i}=await ja(this,e,!0,t);if(!r)throw M(`ENOENT`,t);if(X&&!J(this,r,4))throw M(`EACCES`,t);if(!Un(r))throw M(`EINVAL`,t);let a=r.size,o=new Uint8Array(a);return await n.read(i,o,0,a),te(o)}async function Pa(e,t={}){let n=H.call(this,e),{euid:r,egid:i}=ze(this).credentials,{mode:a=511,recursive:o}=t,s={syscall:`mkdir`,path:n},{fullPath:c}=await ja(this,W(n),!1,s),{fs:l,path:u}=ui(U(c,wn(n)),this,s),d=c!=W(n),f,p=async(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let c=W(t),m=o&&c!=`/`?await p(W(e),c):await l.stat(c);if(ka(n,await Vr(l,c,`rw`,m),!1),o){let n=Z(l).get(t)?.inode??await l.stat(t).catch(()=>null);if(n){let r=Un(n)?(await ja(this,e,!1,s)).stats:n;if(!r)throw M(`ENOENT`,s);if(!q(r))throw M(t==u?`EEXIST`:`ENOTDIR`,s);return n}if(d&&await l.exists(U(c,wn(e))))throw M(`ENOTDIR`,`mkdir`,e)}if(X&&!J(this,m,2))throw M(`EACCES`,`mkdir`,e);let h=await l.mkdir(t,{mode:a,uid:m.mode&2048?m.uid:r,gid:m.mode&1024?m.gid:i}).catch(P({syscall:`mkdir`,path:e}));return o&&(f??=e),Oa(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{Aa(n)}};return await p(n,u),f}async function Fa(e,t={}){e=H.call(this,e);let n={syscall:`scandir`,path:e},{fs:r,path:i,stats:a}=await ja(this,e,!1,n);if(!a)throw M(`ENOENT`,n);if(X&&!J(this,a,4))throw M(`EACCES`,n);if(!q(a))throw M(`ENOTDIR`,n);let o;{let e={stack:[],error:void 0,hasError:!1};try{ka(e,await Vr(r,i,`ro`,a),!1),o=await r.readdir(i)}catch(t){e.error=t,e.hasError=!0}finally{Aa(e)}}let s=[],c=async e=>{let n=await r.stat(U(i,e)).catch(e=>{if(e.code!=`ENOENT`)throw e});if(!n)return;let a=new jr;if(a.ino=n.ino,a.type=kr(n.mode),a.path=e,a.name=wn(e),s.push(a),!t.recursive||!q(n))return;let o=await r.readdir(U(i,e));for(let t of o)await c(U(e,t))};return await Promise.all(o.map(c)),s}async function Ia(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H.call(this,e),t=H.call(this,t);let r={syscall:`rename`,path:e,dest:t},i=await ja(this,e,!0,r),a=ui(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw M(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw M(`EINVAL`,r);if(!i.stats)throw M(`ENOENT`,r);let o=i.fs,s=await o.stat(W(i.path)),c=await o.stat(W(a.path)),l=await o.stat(a.path).catch(e=>{if(e.code==`ENOENT`)return null;throw e});if(X&&(!J(this,s,4)||!J(this,c,2)))throw M(`EACCES`,r);if(l&&!q(i.stats)&&q(l))throw M(`EISDIR`,r);if(l&&q(i.stats)&&!q(l))throw M(`ENOTDIR`,r);let u=W(i.path),d=W(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),ka(n,await Vr(o,f[0][0],`rw`,f[0][1]),!1),ka(n,s.ino==c.ino?null:await Vr(o,f[1][0],`rw`,f[1][1]),!1),await i.fs.rename(i.path,a.path),Z(o).rename(i.path,a.path),Oa(this,`rename`,e),Oa(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{Aa(n)}}async function La(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H.call(this,e),t=H.call(this,t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=ui(e,this,r),o=ui(t,this,r);if(i.uuid!=o.fs.uuid)throw M(`EXDEV`,r);let s=await i.stat(a);if(X){if(!J(this,s,4))throw M(`EACCES`,r);let e=await i.stat(W(a));if(!J(this,e,4))throw M(`EACCES`,r);let t=await i.stat(W(o.path));if(!J(this,t,2))throw M(`EACCES`,r)}ka(n,await Vr(i,W(o.path),`rw`),!1),await i.link(a,o.path),Z(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{Aa(n)}}async function Ra(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=(await ja(this,e,!1,n)).stats;else{let{base:t,dir:i}=Dn(e),{fs:a,path:o}=await ja(this,i,!1,n),s=t?U(o,t):o;r=Z(a).get(s)?.inode??await a.stat(s).catch(P(n))}if(!r)throw M(`ENOENT`,n);if(X&&!J(this,r,4))throw M(`EACCES`,n);return r}var za=class extends u.default{input;output;terminal;line=``;_cursor=0;get cursor(){return this._cursor}_buffer=``;_closed=!1;_paused=!1;_prompt=``;_history=[];_historyIndex=-1;_currentLine=``;constructor(e,t,n,r=!1){super(),this.input=e,this.output=t,this.terminal=r,this.input.on(`data`,this._onData),this.input.on(`end`,this.close.bind(this)),this.input.on(`close`,this.close.bind(this))}_onData=e=>{if(!(this._paused||this._closed)){this._buffer+=typeof e==`string`?e:e.toString(`utf8`);for(let e=this._buffer.indexOf(`
|
|
1
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-Dd_uD5pT.js";import{n as r,t as i}from"./safe-buffer-OLJ0qaLt.js";function a(e,t){if(e.byteLength>=t)return e;if(ArrayBuffer.isView(e)){let n=a(e.buffer,t);return new e.constructor(n,e.byteOffset,t)}let n=typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer;if(e.maxByteLength>t)return n?e.grow(t):e.resize(t),e;if(n){let n=new SharedArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}try{return e.transfer(t)}catch{let n=new ArrayBuffer(t);return new Uint8Array(n).set(new Uint8Array(e)),n}}var o=class extends DataView{constructor(e,t,n){let{buffer:r,byteOffset:i,byteLength:a}=new Uint8Array(e,t,n);super(r,i,a)}};for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(o.prototype,e,{value:()=>{throw ReferenceError(`Do not use DataView methods on a BufferView.`)},writable:!1,enumerable:!1,configurable:!1});var s=class{id;_size;options;regions=[];get size(){return this._size}set size(e){if(e>=this._size){this._size=e;return}this._size=e;for(let t=this.regions.length-1;t>=0;t--){let n=this.regions[t];if(n.offset>=e){this.regions.splice(t,1);continue}let r=e-n.offset;n.data.byteLength>r&&(n.data=n.data.subarray(0,r)),n.ranges=n.ranges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t)}}constructor(e,t,n,r){this.id=e,this._size=t,this.options=n,n.sparse??=!0,n.sparse||this.regions.push({offset:0,data:new Uint8Array(t),ranges:[]}),r?.set(e,this)}collect(){if(!this.options.sparse)return;let{regionGapThreshold:e=4095}=this.options;for(let t=0;t<this.regions.length-1;){let n=this.regions[t],r=this.regions[t+1];if(r.offset-(n.offset+n.data.byteLength)>e){t++;continue}n.ranges.push(...r.ranges),n.ranges.sort((e,t)=>e.start-t.start),n.ranges=n.ranges.reduce((e,t)=>(!e.length||e.at(-1).end<t.start?e.push(t):e.at(-1).end=Math.max(e.at(-1).end,t.end),e),[]),n.data=a(n.data,r.offset+r.data.byteLength),n.data.set(r.data,r.offset-n.offset),this.regions.splice(t+1,1)}}missing(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)&&(i.start>=t||(i.start>e&&n.push({start:e,end:Math.min(i.start,t)}),i.end>e&&(e=Math.max(e,i.end)),e>=t)))break;if(e>=t)break}return e<t&&n.push({start:e,end:t}),n}cached(e,t){let n=[];for(let r of this.regions){if(r.offset>=t)break;for(let i of r.ranges)if(!(i.end<=e)){if(i.start>=t)break;n.push({start:Math.max(e,i.start),end:Math.min(t,i.end)})}}n.sort((e,t)=>e.start-t.start);let r=[];for(let e of n){let t=r.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):r.push(e)}return r}regionAt(e){if(this.regions.length)for(let t of this.regions){if(t.offset>e)break;if(e>=t.offset&&e<t.offset+t.data.byteLength)return t}}add(e,t){let n=t+e.byteLength,r=this.regionAt(t);if(r)return r.data=a(r.data,n),r.data.set(e,t),r.ranges.push({start:t,end:n}),r.ranges.sort((e,t)=>e.start-t.start),this.collect(),this;let i={data:e,offset:t,ranges:[{start:t,end:n}]},o=this.regions.findIndex(e=>e.offset>t);return o==-1?this.regions.push(i):this.regions.splice(o,0,i),this.collect(),this}};const c=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?2197175160^t>>>1:t>>>1;c[e]=t}function l(e){let t=4294967295;for(let n=0;n<e.length;n++)t=t>>>8^c[(t^e[n])&255];return(t^4294967295)>>>0}var u=e(n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)}))(),1),d=class extends u.default{[Symbol.toStringTag]=`List`;constructor(e){super(),e&&this.push(...e)}data=new Set;toSet(){return new Set(this.data)}toArray(){return Array.from(this.data)}toJSON(){return Array.from(this.data)}toString(){return this.join(`,`)}_set(e,t,n=!1){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not set an element outside the bounds of the list`);let r=Array.from(this.data);r.splice(e,+n,t),this.data=new Set(r),this.emit(`update`)}set(e,t){this._set(e,t,!0)}deleteAt(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not delete an element outside the bounds of the list`);this.delete(Array.from(this.data).at(e))}insert(e,t=this.data.size){this._set(t,e,!1)}at(e){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not access an element outside the bounds of the list`);return Array.from(this.data).at(e)}pop(){let e=Array.from(this.data).pop();return e!==void 0&&this.delete(e),e}push(...e){for(let t of e)this.add(t);return this.data.size}join(e){return Array.from(this.data).join(e)}splice(e,t,...n){if(Math.abs(e)>this.data.size)throw ReferenceError(`Can not splice elements outside the bounds of the list`);let r=Array.from(this.data),i=r.splice(e,t,...n);return this.data=new Set(r),this.emit(`update`),i}add(e){return this.data.add(e),this.emit(`update`),this.emit(`add`,e),this}clear(){this.data.clear(),this.emit(`update`)}delete(e){let t=this.data.delete(e);return this.emit(`update`),t}has(e){return this.data.has(e)}get size(){return this.data.size}entries(){return this.toArray().entries()}keys(){return this.toArray().keys()}values(){return this.data.values()}[Symbol.iterator](){return this.data[Symbol.iterator]()}};function f(e,t){let n=Object.entries(e);return Object.fromEntries(n.filter(([e,n])=>t(e,n)))}function p(e,...t){let n={};for(let r of t.flat())n[r]=e[r];return n}function m(e,...t){return f(e,e=>!t.flat().includes(e))}function h(e){try{return JSON.parse(e),!0}catch{return!1}}function g(e){let t=[];for(let n=e;n&&![`Function`,`Object`].includes(n.constructor.name);n=Object.getPrototypeOf(n))t.push(n.constructor.name);return t}function _(e,t){return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,typeof n==`function`?n.bind(t):n]))}function v(e=Error()){let t=setTimeout(()=>{throw e},5e3);return()=>clearTimeout(t)}function y(e){throw e&&typeof e==`object`&&g(e).includes(`Error`)&&Error?.captureStackTrace(e,y),e}function b(e,t){if(![`getter`,`accessor`].includes(t.kind))throw Error(`@memoize can only be used on getters and auto-accessors`);let n=new WeakMap;function r(){if(n.has(this))return n.get(this);let t=typeof e==`function`?e.call(this):e.get.call(this);return n.set(this,t),t}switch(t.kind){case`getter`:return r;case`accessor`:return{...e,get:r}}}const x=Intl.NumberFormat(`en`,{notation:`compact`});x.format.bind(x);function S(e=0,t=1){return Math.round(Math.random()*(t-e)+e)}function C(e){return e.at(0).toUpperCase()+e.slice(1)}const w=new TextEncoder;function T(e){return w.encode(e)}const ee=new TextDecoder;function te(e){if(!e)return``;if(e.buffer instanceof ArrayBuffer&&!e.buffer.resizable)return ee.decode(e);let t=new Uint8Array(e.byteLength);return t.set(e),ee.decode(t)}function ne(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function re(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function E(e){let t=Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function D(e){let t=e.replace(/-/g,``),n=new Uint8Array(16);for(let e=0;e<16;e++)n[e]=parseInt(t.slice(e*2,e*2+2),16);return n}var O;(function(e){e[e.EPERM=1]=`EPERM`,e[e.ENOENT=2]=`ENOENT`,e[e.ESRCH=3]=`ESRCH`,e[e.EINTR=4]=`EINTR`,e[e.EIO=5]=`EIO`,e[e.ENXIO=6]=`ENXIO`,e[e.E2BIG=7]=`E2BIG`,e[e.ENOEXEC=8]=`ENOEXEC`,e[e.EBADF=9]=`EBADF`,e[e.ECHILD=10]=`ECHILD`,e[e.EAGAIN=11]=`EAGAIN`,e[e.ENOMEM=12]=`ENOMEM`,e[e.EACCES=13]=`EACCES`,e[e.EFAULT=14]=`EFAULT`,e[e.ENOTBLK=15]=`ENOTBLK`,e[e.EBUSY=16]=`EBUSY`,e[e.EEXIST=17]=`EEXIST`,e[e.EXDEV=18]=`EXDEV`,e[e.ENODEV=19]=`ENODEV`,e[e.ENOTDIR=20]=`ENOTDIR`,e[e.EISDIR=21]=`EISDIR`,e[e.EINVAL=22]=`EINVAL`,e[e.ENFILE=23]=`ENFILE`,e[e.EMFILE=24]=`EMFILE`,e[e.ETXTBSY=26]=`ETXTBSY`,e[e.EFBIG=27]=`EFBIG`,e[e.ENOSPC=28]=`ENOSPC`,e[e.ESPIPE=29]=`ESPIPE`,e[e.EROFS=30]=`EROFS`,e[e.EMLINK=31]=`EMLINK`,e[e.EPIPE=32]=`EPIPE`,e[e.EDOM=33]=`EDOM`,e[e.ERANGE=34]=`ERANGE`,e[e.EDEADLK=35]=`EDEADLK`,e[e.ENAMETOOLONG=36]=`ENAMETOOLONG`,e[e.ENOLCK=37]=`ENOLCK`,e[e.ENOSYS=38]=`ENOSYS`,e[e.ENOTEMPTY=39]=`ENOTEMPTY`,e[e.ELOOP=40]=`ELOOP`,e[e.ENOMSG=42]=`ENOMSG`,e[e.EIDRM=43]=`EIDRM`,e[e.ECHRNG=44]=`ECHRNG`,e[e.EL2NSYNC=45]=`EL2NSYNC`,e[e.EL3HLT=46]=`EL3HLT`,e[e.EL3RST=47]=`EL3RST`,e[e.ENRNG=48]=`ENRNG`,e[e.EUNATCH=49]=`EUNATCH`,e[e.ECSI=50]=`ECSI`,e[e.EL2HLT=51]=`EL2HLT`,e[e.EBADE=52]=`EBADE`,e[e.EBADR=53]=`EBADR`,e[e.EXFULL=54]=`EXFULL`,e[e.ENOANO=55]=`ENOANO`,e[e.EBADRQC=56]=`EBADRQC`,e[e.EBADSLT=57]=`EBADSLT`,e[e.EBFONT=59]=`EBFONT`,e[e.ENOSTR=60]=`ENOSTR`,e[e.ENODATA=61]=`ENODATA`,e[e.ETIME=62]=`ETIME`,e[e.ENOSR=63]=`ENOSR`,e[e.ENONET=64]=`ENONET`,e[e.ENOPKG=65]=`ENOPKG`,e[e.EREMOTE=66]=`EREMOTE`,e[e.ENOLINK=67]=`ENOLINK`,e[e.EADV=68]=`EADV`,e[e.ESRMNT=69]=`ESRMNT`,e[e.ECOMM=70]=`ECOMM`,e[e.EPROTO=71]=`EPROTO`,e[e.EMULTIHOP=72]=`EMULTIHOP`,e[e.EDOTDOT=73]=`EDOTDOT`,e[e.EBADMSG=74]=`EBADMSG`,e[e.EOVERFLOW=75]=`EOVERFLOW`,e[e.ENOTUNIQ=76]=`ENOTUNIQ`,e[e.EBADFD=77]=`EBADFD`,e[e.EREMCHG=78]=`EREMCHG`,e[e.ELIBACC=79]=`ELIBACC`,e[e.ELIBBAD=80]=`ELIBBAD`,e[e.ELIBSCN=81]=`ELIBSCN`,e[e.ELIBMAX=82]=`ELIBMAX`,e[e.ELIBEXEC=83]=`ELIBEXEC`,e[e.EILSEQ=84]=`EILSEQ`,e[e.ERESTART=85]=`ERESTART`,e[e.ESTRPIPE=86]=`ESTRPIPE`,e[e.EUSERS=87]=`EUSERS`,e[e.ENOTSOCK=88]=`ENOTSOCK`,e[e.EDESTADDRREQ=89]=`EDESTADDRREQ`,e[e.EMSGSIZE=90]=`EMSGSIZE`,e[e.EPROTOTYPE=91]=`EPROTOTYPE`,e[e.ENOPROTOOPT=92]=`ENOPROTOOPT`,e[e.EPROTONOSUPPORT=93]=`EPROTONOSUPPORT`,e[e.ESOCKTNOSUPPORT=94]=`ESOCKTNOSUPPORT`,e[e.ENOTSUP=95]=`ENOTSUP`,e[e.EPFNOSUPPORT=96]=`EPFNOSUPPORT`,e[e.EAFNOSUPPORT=97]=`EAFNOSUPPORT`,e[e.EADDRINUSE=98]=`EADDRINUSE`,e[e.EADDRNOTAVAIL=99]=`EADDRNOTAVAIL`,e[e.ENETDOWN=100]=`ENETDOWN`,e[e.ENETUNREACH=101]=`ENETUNREACH`,e[e.ENETRESET=102]=`ENETRESET`,e[e.ECONNABORTED=103]=`ECONNABORTED`,e[e.ECONNRESET=104]=`ECONNRESET`,e[e.ENOBUFS=105]=`ENOBUFS`,e[e.EISCONN=106]=`EISCONN`,e[e.ENOTCONN=107]=`ENOTCONN`,e[e.ESHUTDOWN=108]=`ESHUTDOWN`,e[e.ETOOMANYREFS=109]=`ETOOMANYREFS`,e[e.ETIMEDOUT=110]=`ETIMEDOUT`,e[e.ECONNREFUSED=111]=`ECONNREFUSED`,e[e.EHOSTDOWN=112]=`EHOSTDOWN`,e[e.EHOSTUNREACH=113]=`EHOSTUNREACH`,e[e.EALREADY=114]=`EALREADY`,e[e.EINPROGRESS=115]=`EINPROGRESS`,e[e.ESTALE=116]=`ESTALE`,e[e.EEUCLEAN=117]=`EEUCLEAN`,e[e.ENOTNAM=118]=`ENOTNAM`,e[e.ENAVAIL=119]=`ENAVAIL`,e[e.EISNAM=120]=`EISNAM`,e[e.EREMOTEIO=121]=`EREMOTEIO`,e[e.EDQUOT=122]=`EDQUOT`,e[e.ENOMEDIUM=123]=`ENOMEDIUM`,e[e.EMEDIUMTYPE=124]=`EMEDIUMTYPE`,e[e.ECANCELED=125]=`ECANCELED`,e[e.ENOKEY=126]=`ENOKEY`,e[e.EKEYEXPIRED=127]=`EKEYEXPIRED`,e[e.EKEYREVOKED=128]=`EKEYREVOKED`,e[e.EKEYREJECTED=129]=`EKEYREJECTED`,e[e.EOWNERDEAD=130]=`EOWNERDEAD`,e[e.ENOTRECOVERABLE=131]=`ENOTRECOVERABLE`,e[e.ERFKILL=132]=`ERFKILL`,e[e.EHWPOISON=133]=`EHWPOISON`})(O||={});const k={[O.EPERM]:`operation not permitted`,[O.ENOENT]:`no such file or directory`,[O.ESRCH]:`no such process`,[O.EINTR]:`interrupted system call`,[O.EIO]:`i/o error`,[O.ENXIO]:`no such device or address`,[O.E2BIG]:`argument list too long`,[O.ENOEXEC]:`exec format error`,[O.EBADF]:`bad file descriptor`,[O.ECHILD]:`no child processes`,[O.EAGAIN]:`resource temporarily unavailable`,[O.ENOMEM]:`not enough memory`,[O.EACCES]:`permission denied`,[O.EFAULT]:`bad address in system call argument`,[O.ENOTBLK]:`block device required`,[O.EBUSY]:`resource busy or locked`,[O.EEXIST]:`file already exists`,[O.EXDEV]:`cross-device link not permitted`,[O.ENODEV]:`no such device`,[O.ENOTDIR]:`not a directory`,[O.EISDIR]:`illegal operation on a directory`,[O.EINVAL]:`invalid argument`,[O.ENFILE]:`file table overflow`,[O.EMFILE]:`too many open files`,[O.ETXTBSY]:`text file is busy`,[O.EFBIG]:`file too large`,[O.ENOSPC]:`no space left on device`,[O.ESPIPE]:`invalid seek`,[O.EROFS]:`read-only file system`,[O.EMLINK]:`too many links`,[O.EPIPE]:`broken pipe`,[O.EDOM]:`numerical argument out of domain`,[O.ERANGE]:`result too large`,[O.EDEADLK]:`resource deadlock would occur`,[O.ENAMETOOLONG]:`name too long`,[O.ENOLCK]:`no locks available`,[O.ENOSYS]:`function not implemented`,[O.ENOTEMPTY]:`directory not empty`,[O.ELOOP]:`too many symbolic links encountered`,[O.ENOMSG]:`no message of desired type`,[O.EIDRM]:`identifier removed`,[O.ECHRNG]:`channel number out of range`,[O.EL2NSYNC]:`level 2 not synchronized`,[O.EL3HLT]:`level 3 halted`,[O.EL3RST]:`level 3 reset`,[O.ENRNG]:`link number out of range`,[O.EUNATCH]:`protocol driver not attached`,[O.ECSI]:`no CSI structure available`,[O.EL2HLT]:`level 2 halted`,[O.EBADE]:`invalid exchange`,[O.EBADR]:`invalid request descriptor`,[O.EXFULL]:`exchange full`,[O.ENOANO]:`no anode`,[O.EBADRQC]:`invalid request code`,[O.EBADSLT]:`invalid slot`,[O.EBFONT]:`bad font file format`,[O.ENOSTR]:`device not a stream`,[O.ENODATA]:`no data available`,[O.ETIME]:`timer expired`,[O.ENOSR]:`out of streams resources`,[O.ENONET]:`machine is not on the network`,[O.ENOPKG]:`package not installed`,[O.EREMOTE]:`object is remote`,[O.ENOLINK]:`link has been severed`,[O.EADV]:`advertise error`,[O.ESRMNT]:`srmount error`,[O.ECOMM]:`communication error on send`,[O.EPROTO]:`protocol error`,[O.EMULTIHOP]:`multihop attempted`,[O.EDOTDOT]:`rFS specific error`,[O.EBADMSG]:`bad message`,[O.EOVERFLOW]:`value too large for defined data type`,[O.ENOTUNIQ]:`name not unique on network`,[O.EBADFD]:`file descriptor in bad state`,[O.EREMCHG]:`remote address changed`,[O.ELIBACC]:`can not access a needed shared library`,[O.ELIBBAD]:`accessing a corrupted shared library`,[O.ELIBSCN]:`.lib section in a.out corrupted`,[O.ELIBMAX]:`attempting to link in too many shared libraries`,[O.ELIBEXEC]:`cannot exec a shared library directly`,[O.EILSEQ]:`illegal byte sequence`,[O.ERESTART]:`interrupted system call should be restarted`,[O.ESTRPIPE]:`streams pipe error`,[O.EUSERS]:`too many users`,[O.ENOTSOCK]:`socket operation on non-socket`,[O.EDESTADDRREQ]:`destination address required`,[O.EMSGSIZE]:`message too long`,[O.EPROTOTYPE]:`protocol wrong type for socket`,[O.ENOPROTOOPT]:`protocol not available`,[O.EPROTONOSUPPORT]:`protocol not supported`,[O.ESOCKTNOSUPPORT]:`socket type not supported`,[O.ENOTSUP]:`operation not supported on socket`,[O.EPFNOSUPPORT]:`protocol family not supported`,[O.EAFNOSUPPORT]:`address family not supported`,[O.EADDRINUSE]:`address already in use`,[O.EADDRNOTAVAIL]:`address not available`,[O.ENETDOWN]:`network is down`,[O.ENETUNREACH]:`network is unreachable`,[O.ENETRESET]:`network dropped connection on reset`,[O.ECONNABORTED]:`software caused connection abort`,[O.ECONNRESET]:`connection reset by peer`,[O.ENOBUFS]:`no buffer space available`,[O.EISCONN]:`socket is already connected`,[O.ENOTCONN]:`socket is not connected`,[O.ESHUTDOWN]:`cannot send after transport endpoint shutdown`,[O.ETOOMANYREFS]:`too many references: cannot splice`,[O.ETIMEDOUT]:`connection timed out`,[O.ECONNREFUSED]:`connection refused`,[O.EHOSTDOWN]:`host is down`,[O.EHOSTUNREACH]:`host is unreachable`,[O.EALREADY]:`connection already in progress`,[O.EINPROGRESS]:`operation now in progress`,[O.ESTALE]:`stale file handle`,[O.EEUCLEAN]:`structure needs cleaning`,[O.ENOTNAM]:`not a XENIX named type file`,[O.ENAVAIL]:`no XENIX semaphores available`,[O.EISNAM]:`is a named type file`,[O.EREMOTEIO]:`remote I/O error`,[O.EDQUOT]:`disk quota exceeded`,[O.ENOMEDIUM]:`no medium found`,[O.EMEDIUMTYPE]:`wrong medium type`,[O.ECANCELED]:`operation canceled`,[O.ENOKEY]:`required key not available`,[O.EKEYEXPIRED]:`key has expired`,[O.EKEYREVOKED]:`key has been revoked`,[O.EKEYREJECTED]:`key was rejected by service`,[O.EOWNERDEAD]:`owner died`,[O.ENOTRECOVERABLE]:`state not recoverable`,[O.ERFKILL]:`operation not possible due to RF-kill`,[O.EHWPOISON]:`memory page has hardware error`};function A(e){let t=`${e.code}: ${k[e.errno]}, ${e.syscall}`;e.path&&(t+=` '${e.path}'`),e.dest&&(t+=` -> '${e.dest}'`);let n=e.message.startsWith(k[e.errno])||/^E[A-Z0-9]+: /.test(e.message);return e.message&&!n&&(t+=` (${e.message})`),e.message=t,e}var j=class e extends Error{errno;code;path;dest;syscall;constructor(e,t,n={}){let r=O[e];super(t||``),this.errno=e,this.code=r,Object.assign(this,m(n,`message`)),t||A(this),Error.captureStackTrace?.(this,this.constructor)}toString(){return this.message}toJSON(){let e={errno:this.errno,code:this.code,stack:this.stack,message:this.message};return this.path&&(e.path=this.path),this.dest&&(e.dest=this.dest),this.syscall&&(e.syscall=this.syscall),e}static fromJSON(t){let n=t.syscall?new e(t.errno,!1,t):new e(t.errno,t.message);return n.stack=t.stack,n}};function M(e,t,n,r){typeof t==`string`&&(t={syscall:t,path:n,dest:r});let i=new j(O[e],!1,t??{});return Error.captureStackTrace?.(i,M),i}function N(e,t){let n=new j(O[e],t??k[O[e]]);return Error.captureStackTrace?.(n,N),n}function P(e,t,n){let r=typeof e==`string`?{syscall:e}:e;return t&&(r.path=t),n&&(r.dest=n),function(e){throw Object.assign(e,r),A(e),e}}var ie=t({Level:()=>F,alert:()=>le,configure:()=>De,crit:()=>ue,debug:()=>pe,deprecated:()=>me,emerg:()=>ce,entries:()=>L,err:()=>R,fancy:()=>ye,format:()=>xe,info:()=>fe,isEnabled:()=>Ee,levelOf:()=>ae,levels:()=>I,log:()=>oe,notice:()=>de,warn:()=>z}),F;(function(e){e[e.EMERG=0]=`EMERG`,e[e.ALERT=1]=`ALERT`,e[e.CRIT=2]=`CRIT`,e[e.ERR=3]=`ERR`,e[e.WARN=4]=`WARN`,e[e.NOTICE=5]=`NOTICE`,e[e.INFO=6]=`INFO`,e[e.DEBUG=7]=`DEBUG`})(F||={});const I=[`emergency`,`alert`,`critical`,`error`,`warning`,`notice`,`info`,`debug`];function ae(e){return I.indexOf(e)}const L=new d;function oe(e,t){if(!Ee)return;let n={level:e,message:t,timestamp:new Date,elapsedMs:performance.now()};if(L.size>=1e4){let e=L.values().next().value;e!==void 0&&L.delete(e)}L.add(n),Ce(n)}function se(e){return function(t){return oe(e,t.toString()),t}}const ce=se(F.EMERG),le=se(F.ALERT),ue=se(F.CRIT),R=se(F.ERR),z=se(F.WARN),de=se(F.NOTICE),fe=se(F.INFO),pe=se(F.DEBUG);function me(e){oe(F.WARN,e+` is deprecated and should not be used.`)}function he(e,t){return`\x1b[${t}m${e}\x1b[0m`}function ge(e){return`[`+(e.elapsedMs/1e3).toFixed(3).padStart(10)+`] `}const _e={ansi:{[F.EMERG]:`1;4;37;41`,[F.ALERT]:`1;37;41`,[F.CRIT]:`1;35`,[F.ERR]:`1;31`,[F.WARN]:`1;33`,[F.NOTICE]:`1;36`,[F.INFO]:`1;37`,[F.DEBUG]:`0;2;37`},css:{[F.EMERG]:`font-weight: bold; text-decoration: underline; color: white; background-color: red;`,[F.ALERT]:`font-weight: bold; color: white; background-color: red;`,[F.CRIT]:`font-weight: bold; color: magenta;`,[F.ERR]:`font-weight: bold; color: red;`,[F.WARN]:`font-weight: bold; color: yellow;`,[F.NOTICE]:`font-weight: bold; color: cyan;`,[F.INFO]:`font-weight: bold; color: white;`,[F.DEBUG]:`opacity: 0.8; color: white;`}},ve={ansi:{[F.EMERG]:`1;31`,[F.ALERT]:`1;31`,[F.CRIT]:`1;31`,[F.ERR]:`31`,[F.WARN]:`33`,[F.NOTICE]:`1;37`,[F.INFO]:`37`,[F.DEBUG]:`2;37`},css:{[F.EMERG]:`font-weight: bold; color: red;`,[F.ALERT]:`font-weight: bold; color: red;`,[F.CRIT]:`font-weight: bold; color: red;`,[F.ERR]:`color: red;`,[F.WARN]:`color: yellow;`,[F.NOTICE]:`font-weight: bold; color: white;`,[F.INFO]:`color: white;`,[F.DEBUG]:`opacity: 0.8; color: white;`}};function ye({style:e,colorize:t}){return function*(n){e==`css`&&(yield t==`level`?`%c%s %c%s`:`%c%s %c%s%s %c%s`),yield*e==`ansi`?[he(ge(n),`2;37`)]:[`opacity: 0.8; color: white;`,ge(n)];let r=e==`ansi`?[he(I[n.level].toUpperCase(),_e.ansi[n.level])]:[_e.css[n.level],I[n.level].toUpperCase()];if(t==`level`){yield*r,yield n.message;return}n.level<F.CRIT&&(yield*r),e==`ansi`?yield he(n.message,ve.ansi[n.level]):yield*[ve.css[n.level],n.message]}}let be=e=>[ge(e),e.message];function xe(e){let t=be(e);return typeof t==`string`?[t]:Array.from(t)}let Se=console.error;function Ce(e){e.level>we||Se(...xe(e))}let we=F.ALERT,Te=!1,Ee=!0;function De(e){if(be=e.format??be,Se=e.output??Se,we=typeof e.level==`string`?ae(e.level):e.level??we,Ee=e.enabled??Ee,Te=e.stack??Te,e.dumpBacklog)for(let e of L)Ce(e)}function Oe(e){return typeof e==`object`&&!!e&&`create`in e&&typeof e.create==`function`}function ke(e,t){return Object.defineProperty(t,"prototype",{value:void 0}),e&&Object.defineProperty(t,"name",{value:e}),t}function Ae(e){return!(e&&e.constructor===Function)||e.prototype===void 0?!1:Function.prototype!==Object.getPrototypeOf(e)||Object.getOwnPropertyNames(e.prototype).length>1}function je(e,t){if(typeof t!=`object`||!t)throw R(N(`EINVAL`,`Invalid options`));for(let[n,r]of Object.entries(e.options)){let e=t?.[n];if(e==null){if(!r.required){pe(`Using default for option: `+n);continue}throw R(N(`EINVAL`,`Missing required option: `+n))}let i=(t,n=e)=>typeof t==`function`?Ae(t)?e instanceof t:t(e):typeof e===t||e?.constructor?.name===t;if(Array.isArray(r.type)?r.type.some(e=>i(e)):i(r.type))continue;let a=typeof e==`object`&&`constructor`in e?e.constructor.name:typeof e,o=e=>typeof e==`function`?e.name==`type`?e.toString():e.name:e,s=Array.isArray(r.type)?`one of ${r.type.map(o).join(`, `)}`:o(r.type);throw R(N(`EINVAL`,`Incorrect type for "${n}": ${a} (expected ${s})`))}}function Me(e){return typeof e==`object`&&!!e&&`backend`in e&&Oe(e.backend)}function Ne(e){return{suid:e.uid,sgid:e.gid,euid:e.uid,egid:e.gid,groups:[],...e}}function Pe(e){return e?!e.uid||!e.gid||!e.euid||!e.egid||e.groups.some(e=>!e):!1}const Fe=Symbol(`ZenFSContext`);function Ie(e){return typeof e==`object`&&!!e&&Fe in e}function Le(e){if(!Ie(e))throw z(N(`EINVAL`,`Invalid context provided`))}const Re={[Fe]:!0,id:1,root:`/`,pwd:`/`,credentials:Ne({uid:0,gid:0}),descriptors:new Map,parent:null,children:[],mounts:new Map};function ze(e){return Ie(e)?e:Re}let Be=2;function Ve(e,t={}){Le(e);let{root:n=e.root,pwd:r=e.pwd,credentials:i=structuredClone(e.credentials),mounts:a}=t,o={[Fe]:!0,id:Be++,root:n,pwd:r,credentials:Ne(i),descriptors:new Map,parent:e,children:[],mounts:a?new Map(Object.entries(a)):e.mounts};return Object.defineProperties(o,{id:{configurable:!1,writable:!1},credentials:{configurable:!1,writable:!1},descriptors:{configurable:!1,writable:!1},parent:{configurable:!1,writable:!1},children:{configurable:!1,writable:!1}}),o}var He=t({COPYFILE_EXCL:()=>1,COPYFILE_FICLONE:()=>2,COPYFILE_FICLONE_FORCE:()=>4,F_OK:()=>0,O_APPEND:()=>Ue,O_CREAT:()=>64,O_DIRECT:()=>Xe,O_DIRECTORY:()=>We,O_DSYNC:()=>Je,O_EXCL:()=>128,O_NOATIME:()=>Ge,O_NOCTTY:()=>256,O_NOFOLLOW:()=>Ke,O_NONBLOCK:()=>Ze,O_RDONLY:()=>0,O_RDWR:()=>2,O_SYMLINK:()=>Ye,O_SYNC:()=>qe,O_TRUNC:()=>512,O_WRONLY:()=>1,R_OK:()=>4,S_IFBLK:()=>nt,S_IFCHR:()=>it,S_IFDIR:()=>rt,S_IFIFO:()=>at,S_IFLNK:()=>et,S_IFMT:()=>Qe,S_IFREG:()=>tt,S_IFSOCK:()=>$e,S_IRGRP:()=>32,S_IROTH:()=>4,S_IRUSR:()=>256,S_IRWXG:()=>56,S_IRWXO:()=>7,S_IRWXU:()=>448,S_ISGID:()=>st,S_ISUID:()=>ot,S_ISVTX:()=>512,S_IWGRP:()=>16,S_IWOTH:()=>2,S_IWUSR:()=>128,S_IXGRP:()=>8,S_IXOTH:()=>1,S_IXUSR:()=>64,UV_FS_O_FILEMAP:()=>0,W_OK:()=>2,X_OK:()=>1,size_max:()=>ct});const Ue=1024,We=65536,Ge=262144,Ke=131072,qe=1052672,Je=4096,Ye=32768,Xe=16384,Ze=2048,Qe=61440,$e=49152,et=40960,tt=32768,nt=24576,rt=16384,it=8192,at=4096,ot=2048,st=1024,ct=4294967295;function lt(e){return`__isArrayType`in e&&e.__isArrayType===!0}function ut(e){return typeof e!=`object`&&typeof e!=`function`||e==null?!1:lt(e)?ut(e.type):`name`in e&&`size`in e&&`get`in e&&`set`in e&&typeof e.name==`string`&&typeof e.size==`number`&&typeof e.get==`function`&&typeof e.set==`function`&&dt.has(e.name)&&dt.get(e.name)?.name===e.name}const dt=new Map;function ft(e){if(dt.has(e.name))throw ReferenceError(`Type is already registered: ${e.name}`);dt.set(e.name,e)}const pt=Symbol(`DataView`);function mt(e){return e[pt]??=new DataView(e),e[pt]}const ht={name:`int8`,size:1,array:Int8Array,get:(e,t)=>mt(e).getInt8(t),set:(e,t,n)=>mt(e).setInt8(t,n)},gt={name:`uint8`,size:1,array:Uint8Array,get:(e,t)=>mt(e).getUint8(t),set:(e,t,n)=>mt(e).setUint8(t,n)},_t={int8:ht,uint8:gt,int16:{name:`int16`,size:2,array:Int16Array,get:(e,t)=>mt(e).getInt16(t,!0),set:(e,t,n)=>mt(e).setInt16(t,n,!0)},uint16:{name:`uint16`,size:2,array:Uint16Array,get:(e,t)=>mt(e).getUint16(t,!0),set:(e,t,n)=>mt(e).setUint16(t,n,!0)},int32:{name:`int32`,size:4,array:Int32Array,get:(e,t)=>mt(e).getInt32(t,!0),set:(e,t,n)=>mt(e).setInt32(t,n,!0)},uint32:{name:`uint32`,size:4,array:Uint32Array,get:(e,t)=>mt(e).getUint32(t,!0),set:(e,t,n)=>mt(e).setUint32(t,n,!0)},int64:{name:`int64`,size:8,array:BigInt64Array,get:(e,t)=>mt(e).getBigInt64(t,!0),set:(e,t,n)=>mt(e).setBigInt64(t,n,!0)},uint64:{name:`uint64`,size:8,array:BigUint64Array,get:(e,t)=>mt(e).getBigUint64(t,!0),set:(e,t,n)=>mt(e).setBigUint64(t,n,!0)},float32:{name:`float32`,size:4,array:Float32Array,get:(e,t)=>mt(e).getFloat32(t,!0),set:(e,t,n)=>mt(e).setFloat32(t,n,!0)},float64:{name:`float64`,size:8,array:Float64Array,get:(e,t)=>mt(e).getFloat64(t,!0),set:(e,t,n)=>mt(e).setFloat64(t,n,!0)}},vt=Object.keys(_t);for(let e of Object.values(_t))ft(e);const yt={..._t,...Object.fromEntries(vt.map(e=>[C(e),_t[e]])),char:gt},bt=Object.keys(yt);function xt(e){return bt.includes(e.toString())}function St(e){if(!xt(e))throw N(`EINVAL`,`Not a valid primitive type: `+e)}function Ct(e){return e==`char`?`uint8`:e.toLowerCase()}function wt(e){return(typeof e==`object`||typeof e==`function`)&&e!==null&&`toInit`in e&&typeof e.toInit==`function`}function Tt(e){return wt(e)?e.toInit():ut(e)?{type:e}:e}function Et(e,t,n={}){if(!e)throw N(`EINVAL`,`Invalid name for struct field`);typeof e==`symbol`&&console.warn(`Symbol used for struct field name will be coerced to string: `+e.toString());let r=e.toString(),i=Object.assign(Tt(t),n);if(!ut(i.type))throw N(`EINVAL`,`Invalid type for struct field "${r}"`);let a=i.countedBy?` counted_by(${typeof i.countedBy==`string`?i.countedBy:`<function>`})`:``;return{name:r,offset:0,type:i.type,countedBy:i.countedBy,alignment:i.align??i.type.size,decl:i.type instanceof Jt?`${i.typeName??i.type.type.name} ${r}[${i.type.length}]${a}`:`${i.typeName??i.type.name} ${r}`,littleEndian:!i.bigEndian}}function Dt(e,t){if(!(e instanceof Error)||e.message.toLowerCase()!==`offset is outside the bounds of the dataview`)throw e;let n=N(`EFAULT`,`Segmentation fault (at 0x${t.toString(16)})`);throw Error.captureStackTrace(n,Dt),n}function Ot(e,t){return t.type instanceof Jt&&t.type.length==0&&!!t.countedBy?.length&&!!e.constructor.isDynamic}function kt(e,t){let n=typeof t.countedBy==`function`?t.countedBy(e):e[t.countedBy];if(typeof n==`bigint`){if(n>BigInt(2**53-1))throw N(`EOVERFLOW`,`countedBy field value exceeds max safe integer`);n=Number(n)}if(typeof n!=`number`)throw N(`EINVAL`,`countedBy field value is not a number`);return n}function At(e,t){let n=t.type.type.size*kt(e,t);if(Ht(t.type.type)&&t.type.type.isDynamic)for(let r of e[t.name])n+=Ut(r);return n}const jt=Symbol(`kOffsets`),Mt=Symbol(`kStaticLayout`);function Nt(e){if(e[Mt]!==void 0)return e[Mt];let t=!e.isDynamic;if(t)for(let n of e.fields){let e=n.type;for(;e instanceof Jt;)e=e.type;if(Ht(e)&&e.isDynamic){t=!1;break}}return Object.defineProperty(e,Mt,{value:t,configurable:!0}),t}function Pt(e,t,n){if(Nt(e.constructor))return t.offset;let{offset:r,name:i}=t;e[jt]||=Object.create(null);let a=e[jt];if(a[i]!==void 0){if(n)return a[i];delete a[i]}let{fields:o}=e.constructor,s=o.indexOf(t);for(let t of o.slice(0,s)){Ot(e,t)&&(r+=At(e,t));let n=e[t.name];Vt(n)&&n.constructor.isDynamic&&(r+=Ut(n))}if(n)a[i]=r;else for(let e of o.slice(s))a[e.name]!==void 0&&delete a[e.name];return r}function Ft(e,t,n,r){typeof n==`string`&&(n=n.charCodeAt(0));let i=e.byteOffset+Pt(e,t,!1)+(r??0)*t.type.size;try{t.type.set(e.buffer,i,n);return}catch(e){Dt(e,i)}}const It=Symbol(`kDescriptors`);function Lt(e){if(Object.hasOwn(e,It))return e[It];let t={};for(let n of e.fields)t[n.name]={enumerable:!0,configurable:!0,get(){return Bt(this,n)},set(e){Ft(this,n,e)}};return Object.defineProperty(e,It,{value:t,configurable:!0}),t}function Rt(e){Object.defineProperties(e.prototype,Lt(e))}const zt=Symbol(`kViews`);function Bt(e,t){let n=t.type,r=Ot(e,t);if(r){let r=t.type.type;n=new Jt(r,kt(e,t))}let i=!r&&(n instanceof Jt||Ht(n))&&Nt(e.constructor);if(i){let n=e[zt]??=Object.create(null);if(n[t.name]!==void 0)return n[t.name]}let a=e.byteOffset+Pt(e,t,!0);try{let r=n.get(e.buffer,a);return i&&(e[zt][t.name]=r),r}catch(e){Dt(e,a)}}function Vt(e){return typeof e==`object`&&!!e&&`constructor`in e&&Ht(e.constructor)}function Ht(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&ut(e)}function Ut(e){let t=0;for(let n of e.constructor.fields){let r=e[n.name];Ot(e,n)&&(t+=At(e,n)),Vt(r)&&r.constructor.isDynamic&&(t+=Ut(r))}return t}function Wt(e){if(ut(e))return e.size;if(e==null)return 0;if(typeof e==`object`&&ut(e.constructor))return e.constructor.size;if(Array.isArray(e)){let t=0;for(let n=0;n<e.length;n++)t+=Wt(e[n]);return t}if(typeof e==`string`)return St(e),_t[Ct(e)].size;throw TypeError(`Unable to resolve size of \`${e.toString()}\``)}function B(e){let t=Wt(e);return Vt(e)&&e.constructor.isDynamic?t+Ut(e):t}function Gt(e,t){let n;if(Ht(e)){if(e.isDynamic)throw N(`EINVAL`,`Cannot get offset of field in dynamic struct from the constructor`);n=e}else if(Vt(e))n=e.constructor;else throw N(`EINVAL`,`Type is not a struct or struct constructor`);let{fields:r}=n,i=r.find(e=>e.name===t);if(!i)throw N(`EINVAL`,`Struct does not have field: `+t);return Ht(e)?i.offset:Pt(e,i,!0)}function Kt(e,t){class n extends DataView{length;type=e;*[Symbol.iterator](){for(let e=0;e<this.length;e++)yield this[e]}_offsets=[0];offsetOf(t){if(!e.isDynamic)return t*e.size;if(t<this._offsets.length)return this._offsets[t];for(let n=this._offsets.length;n<=t;n++)this._offsets[n]=this._offsets[n-1]+B(e.get(this.buffer,this.byteOffset+this._offsets[n-1]));return this._offsets[t]}constructor(n,r,i){let a=typeof n==`object`?n:new ArrayBuffer((n??0)*e.size);super(a,r,i),this.length=typeof n==`number`?n:e.isDynamic?t??y(`Unknown length of StructArray<${e.name}>`):Math.floor(this.byteLength/e.size);let o=e=>this.byteOffset+this.offsetOf(e),s=qt(e)&&!e.isDynamic?[]:void 0;return new Proxy(this,{get(t,n){if(n in t)return t[n];let r=parseInt(n.toString());if(Number.isSafeInteger(r))return s?s[r]??=e.get(t.buffer,o(r)):e.get(t.buffer,o(r))},set(t,n,r){let i=parseInt(n.toString());return Number.isSafeInteger(i)?(e.set(t.buffer,o(i),r),!0):!1}})}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(n.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return n}function qt(e){return typeof e==`function`&&`prototype`in e&&`fields`in e&&typeof e.fields==`object`&&ut(e)}var Jt=class{type;length;name;size;__structArray;__arrayType;__isArrayType=!0;constructor(e,t){this.type=e,this.length=t,this.name=`${e.name}[${t}]`,this.size=e.size*t,this.array=Kt(this),this.__structArray=Kt(e,t),this.__arrayType=e.array?e.array:this.__structArray}get=(e,t)=>xt(this.type.name)&&t%this.type.size!==0?new this.__structArray(e,t,this.size):new this.__arrayType(e,t,this.size);set=(e,t,n)=>{if(this.length)for(let r=0;r<this.length;r++)this.type.set(e,t+r*this.type.size,n[r]);else{let r=t;for(let t=0;t<n.length;t++)this.type.set(e,r,n[t]),r+=qt(this.type)&&this.type.isDynamic?B(n[t]):this.type.size}};array};Symbol.metadata??=Symbol.for(`Symbol.metadata`);function Yt(e){e.metadata??={};let t=e.metadata.structInit??{};return e.metadata.structInit={fields:[...t.fields??[]]},e.metadata.structInit}function Xt(...e){let t=e.reduce((e,t)=>({...e,...t}),{});return typeof this==`object`&&Object.assign(t,this),function(e,n){let r=Yt(n),i=1,a=[],o=0,s=e=>{o=Math.ceil(o/e)*e};for(let e of r.fields)t.isPacked||s(e.alignment),t.isUnion?o=Math.max(o,e.type.size):(e.offset=o,o+=e.type.size),a.push(e),i=Math.max(i,e.alignment);t.alignment??=i,t.isPacked||s(t.alignment);class c extends e{static name=e.name;static size=o;static alignment=t.alignment;static isUnion=!!t.isUnion;static isDynamic=!!t.isDynamic;static fields=a;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e.name}]`;constructor(...e){e.length||(e=[new ArrayBuffer(o),0,o]),super(...e),t.fastFields||Object.defineProperties(this,Lt(this.constructor))}}return Rt(c),n.addInitializer(function(){Object.defineProperty(c,"name",{value:e.name}),ft(c)}),c}}Xt.packed=Xt.bind({isPacked:!0}),Xt.align=function(e){return Xt.bind({alignment:e})};function Zt(e,t={}){return function(n,r){if(r.kind!=`accessor`)throw N(`EINVAL`,`Field must be an accessor`);let i=Yt(r),a=Et(r.name,e,t);return i.fields.push(a),{get(){return Bt(this,a)},set(e){Ft(this,a,e)}}}}function Qt(e){let t=_t[Ct(e)];function n(n,r){return typeof n==`number`?Zt(new Jt(t,n),{typeName:e,...r}):Zt(t,{typeName:e})(n,r&&`name`in r?r:y(N(`EINVAL`,`Invalid decorator context object`)))}return n}const V=Object.fromEntries(bt.map(e=>[e,Qt(e)]));function $t(e){return e}$t.typed=function(e){return e};var en=class e{type;init;constructor(t,n){this.type=t,this.init=n;let r=(r=>new e(new Jt(t,r),n));return Object.setPrototypeOf(r,new.target.prototype),Object.assign(r,{type:t,init:n}),r}align(t){return new e(this.type,{...this.init,align:t})}countedBy(t){return new e(this.type,{...this.init,countedBy:t})}bigEndian(){return new e(this.type,{...this.init,bigEndian:!0})}toInit(){return{type:this.type,...this.init}}$type(){return new e(this.type,this.init)}};function tn(e,t=0){return new en(new Jt(e,t),{})}function nn(e,t,...n){let r=n.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(r,this);let i=1,a=0,o=e=>{a=Math.ceil(a/e)*e},s=[];for(let[e,n]of Object.entries(t)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let t=Et(e,n);r.isPacked||o(t.alignment),r.isUnion?a=Math.max(a,t.type.size):(t.offset=a,a+=t.type.size),s.push(t),i=Math.max(i,t.alignment)}r.alignment??=i,r.isPacked||o(r.alignment);class c extends DataView{static name=e;static size=a;static alignment=r.alignment;static isUnion=!!r.isUnion;static isDynamic=!!r.isDynamic;static fields=s;static get(e,t){return new this(e,t)}static set(e,t,n){let r=new Uint8Array(n.buffer,n.byteOffset,this.size),i=new Uint8Array(e,t,this.size);if(n.buffer!==e||n.byteOffset!==t)for(let e=0;e<this.size;e++)i[e]=r[e]}static[Symbol.toStringTag]=`[struct ${e}]`;constructor(e=new ArrayBuffer(a),t,n){super(e,t,n??e.byteLength-(t??0)),r.fastFields||Object.defineProperties(this,Lt(this.constructor))}}for(let e of Object.getOwnPropertyNames(DataView.prototype))!e.startsWith(`get`)&&!e.startsWith(`set`)||Object.defineProperty(c.prototype,e,{enumerable:!1,configurable:!1,writable:!1,value:void 0});return Rt(c),ft(c),c}nn.extend=function(e,t,n,...r){let i=r.reduce((e,t)=>({...e,...t}),{});typeof this==`object`&&Object.assign(i,this);let a=1,o=e.size,s=e=>{o=Math.ceil(o/e)*e},c=[...e.fields];for(let[e,t]of Object.entries(n)){if(typeof e==`number`)throw TypeError(`Field names can not be numbers`);let n=Et(e,t);i.isPacked||s(n.alignment),i.isUnion?o=Math.max(o,n.type.size):(n.offset=o,o+=n.type.size),c.push(n),a=Math.max(a,n.alignment)}i.alignment??=a,i.isPacked||s(i.alignment);class l extends e{static name=t;static size=o;static alignment=i.alignment;static isUnion=!!i.isUnion;static isDynamic=!!i.isDynamic;static fields=c;static[Symbol.toStringTag]=`[struct ${t}]`}return Rt(l),ft(l),l},nn.packed=nn.bind({isPacked:!0}),nn.align=function(e){return nn.bind({alignment:e})},nn.dynamic=nn.bind({isDynamic:!0}),Object.fromEntries(Object.entries(yt).map(([e,t])=>[e,new en(t,{typeName:e})]));function rn(e){return JSON.parse(te(e),(e,t)=>e==``?t:typeof t==`string`?BigInt(t).toString(16).slice(0,Math.min(t.length,8)):t)}function an(e){return T(JSON.stringify(e))}function on(e,t){if(typeof e==`number`)return e;if(typeof e==`string`){let t=parseInt(e,8);if(!isNaN(t))return t}if(typeof t==`number`)return t;throw N(`EINVAL`,`Invalid mode: `+e?.toString())}const sn=2147483647;function cn(e){if(!(Number.isInteger(e)&&e>=0&&e<=sn))throw Object.assign(RangeError(`The value of "fd" is out of range. It must be >= 0 && <= ${sn}. Received ${e}`),{code:`ERR_OUT_OF_RANGE`})}function ln(e){let{code:t}=e??{};return t==`ENOENT`||t==`ENOTDIR`}function un(e){if(e instanceof Date)return e.getTime();let t=Number(e);if(!Number.isFinite(t))throw N(`EINVAL`,`Invalid time.`);return t<0?Date.now():t*1e3}function H(e,t=!1){if(e instanceof URL){if(e.protocol!=`file:`)throw N(`EINVAL`,`URLs must use the file: protocol`);e=e.pathname}if(e=e.toString(),e.startsWith(`file://`)&&(e=e.slice(7)),e.includes(`\0`))throw N(`EINVAL`,`Path can not contain null character`);if(e.length==0)throw N(`EINVAL`,`Path can not be empty`);return e=e.replaceAll(/[/\\]+/g,`/`),t?e:bn.call(this,e)}function dn(e,t=`utf8`,n,r=0){return typeof e!=`object`||!e?{encoding:typeof e==`string`?e:t??null,flag:n,mode:r}:{encoding:typeof e?.encoding==`string`?e.encoding:t??null,flag:typeof e?.flag==`string`?e.flag:n,mode:on(`mode`in e?e?.mode:null,r)}}function fn(e){let t=`\0GS\0`;return e=e.replace(/\*\*/g,t).replace(/\*/g,`\0S\0`).replace(/[.+^$(){}|[\]\\]/g,`\\$&`).replace(/\?/g,`.`).replaceAll(`/\0GS\0/`,`(?:/.*)?/`).replaceAll(t,`.*`).replaceAll(`\0S\0`,`[^/]*`),RegExp(`^${e}$`)}async function pn(e){let t=Promise.withResolvers();setTimeout(()=>t.reject(N(`ETIMEDOUT`)),500),e.on(`online`,t.resolve),await t.promise}function mn(e){return`${H(e,!0)}${Date.now()}-${Math.random().toString(36).slice(2)}`}function hn(){if(`Temporal`in globalThis&&globalThis.Temporal!==void 0)return globalThis.Temporal;throw N(`ENOTSUP`,`Temporal is not supported by this runtime`)}var gn=t({basename:()=>wn,dirname:()=>W,extname:()=>Tn,format:()=>En,formatExt:()=>yn,isAbsolute:()=>Sn,join:()=>U,matchesGlob:()=>On,normalize:()=>xn,normalizeString:()=>vn,parse:()=>Dn,relative:()=>Cn,resolve:()=>bn,sep:()=>`/`});function _n(e,t){if(typeof e!=`object`)throw TypeError(`"${t}" is not an object`)}function vn(e,t){let n=``,r=0,i=-1,a=0,o=`\0`;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o==`/`)break;else o=`/`;if(o==`/`){if(i!==s-1&&a!==1){if(a===2){if(n.length<2||r!==2||n.at(-1)!==`.`||n.at(-2)!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}if(n.length!==0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,s):n=e.slice(i+1,s),r=s-i-1}i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function yn(e){return e?`${e[0]===`.`?``:`.`}${e}`:``}function bn(...e){let t=``;for(let n of[...e.reverse(),ze(this).pwd])if(n?.length&&(t=`${n}/${t}`,n.startsWith(`/`)))break;let n=t.startsWith(`/`);return t=vn(t,!n),n?`/${t}`:t.length?t:`/`}function xn(e){if(!e.length)return`.`;let t=e[0]===`/`,n=e.at(-1)===`/`;return e=vn(e,!t),e.length?(n&&(e+=`/`),t?`/${e}`:e):t?`/`:n?`./`:`.`}function Sn(e){return e.startsWith(`/`)}function U(...e){if(!e.length)return`.`;let t=e.filter(e=>e).join(`/`);return t?.length?xn(t):`.`}function Cn(e,t){if(e===t||(e=bn.call(this,e),t=bn.call(this,t),e===t))return``;let n=e.length,r=n-1,i=t.length-1,a=r<i?r:i,o=-1,s=0;for(;s<a;s++){let n=e[1+s];if(n!==t[1+s])break;n===`/`&&(o=s)}if(s===a){if(i>a){if(t[1+s]===`/`)return t.slice(1+s+1);if(s===0)return t.slice(1+s)}else r>a&&(e[1+s]===`/`?o=s:s===0&&(o=0))}let c=``;for(s=1+o+1;s<=n;++s)(s===n||e[s]===`/`)&&(c+=c.length===0?`..`:`/..`);return`${c}${t.slice(1+o)}`}function W(e){if(e.length===0)return`.`;let t=e[0]===`/`,n=-1,r=!0;for(let t=e.length-1;t>=1;--t)if(e[t]===`/`){if(!r){n=t;break}}else r=!1;return n===-1?t?`/`:`.`:t&&n===1?`//`:e.slice(0,n)}function wn(e,t){let n=0,r=-1,i=!0;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t===e)return``;let a=t.length-1,o=-1;for(let s=e.length-1;s>=0;--s)if(e[s]===`/`){if(!i){n=s+1;break}}else o===-1&&(i=!1,o=s+1),a>=0&&(e[s]===t[a]?--a===-1&&(r=s):(a=-1,r=o));return n===r?r=o:r===-1&&(r=e.length),e.slice(n,r)}for(let t=e.length-1;t>=0;--t)if(e[t]===`/`){if(!i){n=t+1;break}}else r===-1&&(i=!1,r=t+1);return r===-1?``:e.slice(n,r)}function Tn(e){let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){if(e[o]===`/`){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),e[o]===`.`?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)}function En(e){_n(e,`pathObject`);let t=e.dir||e.root,n=e.base||`${e.name||``}${yn(e.ext)}`;return t?t===e.root?`${t}${n}`:`${t}/${n}`:n}function Dn(e){let t=e[0]===`/`,n={root:t?`/`:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return n;let r=+!!t,i=-1,a=0,o=-1,s=!0,c=e.length-1,l=0;for(;c>=r;--c){if(e[c]===`/`){if(!s){a=c+1;break}continue}o===-1&&(s=!1,o=c+1),e[c]===`.`?i===-1?i=c:l!==1&&(l=1):i!==-1&&(l=-1)}if(o!==-1){let r=a===0&&t?1:a;i===-1||l===0||l===1&&i===o-1&&i===a+1?n.base=n.name=e.slice(r,o):(n.name=e.slice(r,i),n.base=e.slice(r,o),n.ext=e.slice(i,o))}return a>0?n.dir=e.slice(0,a-1):t&&(n.dir=`/`),n}function On(e,t){return fn(e).test(t)}const kn=BigInt(1e6);var An=class{_convert(e){return this._isBigint?BigInt(e):Number(e)}get blocks(){return this._convert(Math.ceil(Number(this.size)/512))}set blocks(e){}mode;dev=this._convert(0);ino=this._convert(0);rdev=this._convert(0);nlink=this._convert(1);blksize=this._convert(4096);uid=this._convert(0);gid=this._convert(0);atimeMs;get atime(){return new Date(Number(this.atimeMs))}set atime(e){this.atimeMs=this._convert(e.getTime())}get atimeInstant(){return hn().Instant.fromEpochMilliseconds(Number(this.atimeMs))}set atimeInstant(e){this.atimeMs=this._convert(e.epochMilliseconds)}mtimeMs;get mtime(){return new Date(Number(this.mtimeMs))}set mtime(e){this.mtimeMs=this._convert(e.getTime())}get mtimeInstant(){return hn().Instant.fromEpochMilliseconds(Number(this.mtimeMs))}set mtimeInstant(e){this.mtimeMs=this._convert(e.epochMilliseconds)}ctimeMs;get ctime(){return new Date(Number(this.ctimeMs))}set ctime(e){this.ctimeMs=this._convert(e.getTime())}get ctimeInstant(){return hn().Instant.fromEpochMilliseconds(Number(this.ctimeMs))}set ctimeInstant(e){this.ctimeMs=this._convert(e.epochMilliseconds)}birthtimeMs;get birthtime(){return new Date(Number(this.birthtimeMs))}set birthtime(e){this.birthtimeMs=this._convert(e.getTime())}get birthtimeInstant(){return hn().Instant.fromEpochMilliseconds(Number(this.birthtimeMs))}set birthtimeInstant(e){this.birthtimeMs=this._convert(e.epochMilliseconds)}size;data;flags;version;constructor({atimeMs:e,mtimeMs:t,ctimeMs:n,birthtimeMs:r,uid:i,gid:a,size:o,mode:s,ino:c,...l}={}){let u=Date.now();this.atimeMs=this._convert(e??u),this.mtimeMs=this._convert(t??u),this.ctimeMs=this._convert(n??u),this.birthtimeMs=this._convert(r??u),this.uid=this._convert(i??0),this.gid=this._convert(a??0),this.size=this._convert(o??0),this.ino=this._convert(c??0),this.mode=this._convert(s??0),this.mode&61440||(this.mode|=this._convert(tt)),Object.assign(this,l)}isFile(){return(this.mode&Qe)==tt}isDirectory(){return(this.mode&Qe)==rt}isSymbolicLink(){return(this.mode&Qe)==et}isSocket(){return(this.mode&Qe)==$e}isBlockDevice(){return(this.mode&Qe)==nt}isCharacterDevice(){return(this.mode&Qe)==it}isFIFO(){return(this.mode&Qe)==at}toJSON(){return p(this,Bn)}hasAccess(e,t){return J(t,this._isBigint?new jn(this):this,e)}get atimeNs(){return BigInt(this.atimeMs)*kn}get mtimeNs(){return BigInt(this.mtimeMs)*kn}get ctimeNs(){return BigInt(this.ctimeMs)*kn}get birthtimeNs(){return BigInt(this.birthtimeMs)*kn}},jn=class extends An{_isBigint=!1},Mn=class extends An{_isBigint=!0};function Nn(e,t){return e.size==t.size&&+e.atime==+t.atime&&+e.mtime==+t.mtime&&+e.ctime==+t.ctime&&e.mode==t.mode}var Pn=class{type=525687744115;bsize=4096;blocks=0;bfree=0;bavail=0;files=ct;frsize=4096;ffree=ct},Fn=class{type=BigInt(`0x7a656e6673`);bsize=BigInt(4096);blocks=BigInt(0);bfree=BigInt(0);bavail=BigInt(0);files=BigInt(ct);frsize=BigInt(4096);ffree=BigInt(ct)},In=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},G=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};const Ln=3968;let Rn=(()=>{var e,t;let n=[Xt.packed()],r,i=[],a,o=$t.typed(Uint8Array),s,c=[],l=[],u,d=[],f=[];var p=class extends o{static{a=this}static{let m=typeof Symbol==`function`&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;s=[(e=V).uint32.bind(e)],u=[(t=V).uint32.bind(t)],In(this,null,s,{kind:`accessor`,name:`keySize`,static:!1,private:!1,access:{has:e=>`keySize`in e,get:e=>e.keySize,set:(e,t)=>{e.keySize=t}},metadata:m},c,l),In(this,null,u,{kind:`accessor`,name:`valueSize`,static:!1,private:!1,access:{has:e=>`valueSize`in e,get:e=>e.valueSize,set:(e,t)=>{e.valueSize=t}},metadata:m},d,f),In(null,r={value:a},n,{kind:`class`,name:a.name,metadata:m},null,i),p=a=r.value,m&&Object.defineProperty(a,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:m})}static name=`Attribute`;#e=G(this,c,void 0);get keySize(){return this.#e}set keySize(e){this.#e=e}#t=(G(this,l),G(this,d,void 0));get valueSize(){return this.#t}set valueSize(e){this.#t=e}get name(){return te(this.subarray(8,8+this.keySize))}set name(e){let t=T(e);if(8+t.length+this.valueSize>Ln)throw N(`EOVERFLOW`);this.set(t,8),this.keySize=t.length}get value(){return this.subarray(8+this.keySize,this.size)}set value(e){if(8+this.keySize+e.length>Ln)throw N(`EOVERFLOW`);this.valueSize=e.length,this.set(e,8+this.keySize)}get size(){return 8+this.keySize+this.valueSize}constructor(){super(...arguments),G(this,f)}static{G(a,i)}};return a})(),zn=(()=>{var e;let t=[Xt.packed()],n,r=[],i,a=$t(o),s,c=[],l=[];var u=class extends a{static{i=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;s=[(e=V).uint32.bind(e)],In(this,null,s,{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},c,l),In(null,n={value:i},t,{kind:`class`,name:i.name,metadata:o},null,r),u=i=n.value,o&&Object.defineProperty(i,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`Attributes`;#e=G(this,c,void 0);get size(){return this.#e}set size(e){this.#e=e}get byteSize(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new Rn(this.buffer,e);e+=t.size}return e}has(e){let t=this.byteOffset+B(this);for(let n=0;n<this.size;n++){let n=new Rn(this.buffer,t);if(n.name==e)return!0;t+=n.size}return!1}get(e){let t=this.byteOffset+B(this);for(let n=0;n<this.size;n++){let n=new Rn(this.buffer,t);if(n.name==e)return n.value;t+=n.size}}set(e,t){let n=this.byteOffset+B(this),r;for(let t=0;t<this.size;t++){let t=new Rn(this.buffer,n);t.name==e&&(r=[n,t.size]),n+=t.size}let i=new Uint8Array(this.buffer);if(r){let[e,t]=r;n-=t,i.copyWithin(e,e+t,n+t),i.fill(0,n,n+t),this.size--}let a=new Rn(this.buffer,n);a.name=e,a.value=t,this.size++}remove(e){let t=this.byteOffset+B(this),n;for(let r=0;r<this.size;r++){let r=new Rn(this.buffer,t);r.name==e&&(n=[t,r.size]),t+=r.size}if(!n)return!1;let[r,i]=n,a=new Uint8Array(this.buffer);return a.copyWithin(r,r+i,t),a.fill(0,t-i,t),this.size--,!0}copyFrom(e){let{byteSize:t}=e;new Uint8Array(this.buffer,this.byteOffset,t).set(new Uint8Array(e.buffer,e.byteOffset,t))}*keys(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new Rn(this.buffer,e);yield t.name,e+=t.size}}*values(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new Rn(this.buffer,e);yield t.value,e+=t.size}}*entries(){let e=this.byteOffset+B(this);for(let t=0;t<this.size;t++){let t=new Rn(this.buffer,e);yield[t.name,t.value],e+=t.size}}constructor(){super(...arguments),G(this,l)}static{G(i,r)}};return i})();const Bn=[`ino`,`data`,`size`,`mode`,`flags`,`nlink`,`uid`,`gid`,`atimeMs`,`birthtimeMs`,`mtimeMs`,`ctimeMs`,`version`,`rdev`];var Vn;(function(e){e[e.Sync=1]=`Sync`,e[e.NoAtime=2]=`NoAtime`,e[e.Append=4]=`Append`,e[e.Immutable=8]=`Immutable`,e[e.Dead=16]=`Dead`,e[e.NoQuota=32]=`NoQuota`,e[e.Dirsync=64]=`Dirsync`,e[e.NoCMtime=128]=`NoCMtime`,e[e.SwapFile=256]=`SwapFile`,e[e.Private=512]=`Private`,e[e.IMA=1024]=`IMA`,e[e.AutoMount=2048]=`AutoMount`,e[e.NoSec=4096]=`NoSec`,e[e.DAX=8192]=`DAX`,e[e.Encrypted=16384]=`Encrypted`,e[e.CaseFold=32768]=`CaseFold`,e[e.Verity=65536]=`Verity`,e[e.KernelFile=131072]=`KernelFile`})(Vn||={});let K=(()=>{var e,t,n,r,i,a,s,c,l,u,d,f,m,h,g,_,v;let y=[Xt.packed()],b,x=[],S,C=$t(o),w,T=[],ee=[],te,ne=[],re=[],E,D=[],O=[],k,A=[],j=[],M,P=[],ie=[],F,I=[],ae=[],L,oe=[],se=[],ce,le=[],R=[],de,fe=[],pe=[],me,he=[],ge=[],_e,ve=[],ye=[],be,xe=[],Se=[],Ce,we=[],Te=[],Ee,De=[],Oe=[],ke,Ae=[],je=[],Me,Ne=[],Pe=[],Fe,Ie=[],Le=[],Re,ze=[],Be=[],Ve,He=[],Ue=[],We,Ge=[],Ke=[];var qe=class extends C{static{S=this}static{let o=typeof Symbol==`function`&&Symbol.metadata?Object.create(C[Symbol.metadata]??null):void 0;w=[(e=V).uint32.bind(e)],te=[(t=V).uint32.bind(t)],E=[(n=V).uint32.bind(n)],k=[(r=V).uint16.bind(r)],M=[(i=V).uint32.bind(i)],F=[(a=V).uint32.bind(a)],L=[(s=V).uint32.bind(s)],ce=[(c=V).float64.bind(c)],de=[(l=V).float64.bind(l)],me=[(u=V).float64.bind(u)],_e=[(d=V).float64.bind(d)],be=[(f=V).uint32.bind(f)],Ce=[(m=V).uint32.bind(m)],Ee=[(h=V).uint32.bind(h)],ke=[(g=V).uint16.bind(g)],Me=[(_=V).uint32.bind(_)],Fe=[(v=V).uint32.bind(v)],Re=[V.uint8(44)],Ve=[Zt(zn)],We=[V.uint8(Ln)],In(this,null,w,{kind:`accessor`,name:`data`,static:!1,private:!1,access:{has:e=>`data`in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:o},T,ee),In(this,null,te,{kind:`accessor`,name:`__data_old`,static:!1,private:!1,access:{has:e=>`__data_old`in e,get:e=>e.__data_old,set:(e,t)=>{e.__data_old=t}},metadata:o},ne,re),In(this,null,E,{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},D,O),In(this,null,k,{kind:`accessor`,name:`mode`,static:!1,private:!1,access:{has:e=>`mode`in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:o},A,j),In(this,null,M,{kind:`accessor`,name:`nlink`,static:!1,private:!1,access:{has:e=>`nlink`in e,get:e=>e.nlink,set:(e,t)=>{e.nlink=t}},metadata:o},P,ie),In(this,null,F,{kind:`accessor`,name:`uid`,static:!1,private:!1,access:{has:e=>`uid`in e,get:e=>e.uid,set:(e,t)=>{e.uid=t}},metadata:o},I,ae),In(this,null,L,{kind:`accessor`,name:`gid`,static:!1,private:!1,access:{has:e=>`gid`in e,get:e=>e.gid,set:(e,t)=>{e.gid=t}},metadata:o},oe,se),In(this,null,ce,{kind:`accessor`,name:`atimeMs`,static:!1,private:!1,access:{has:e=>`atimeMs`in e,get:e=>e.atimeMs,set:(e,t)=>{e.atimeMs=t}},metadata:o},le,R),In(this,null,de,{kind:`accessor`,name:`birthtimeMs`,static:!1,private:!1,access:{has:e=>`birthtimeMs`in e,get:e=>e.birthtimeMs,set:(e,t)=>{e.birthtimeMs=t}},metadata:o},fe,pe),In(this,null,me,{kind:`accessor`,name:`mtimeMs`,static:!1,private:!1,access:{has:e=>`mtimeMs`in e,get:e=>e.mtimeMs,set:(e,t)=>{e.mtimeMs=t}},metadata:o},he,ge),In(this,null,_e,{kind:`accessor`,name:`ctimeMs`,static:!1,private:!1,access:{has:e=>`ctimeMs`in e,get:e=>e.ctimeMs,set:(e,t)=>{e.ctimeMs=t}},metadata:o},ve,ye),In(this,null,be,{kind:`accessor`,name:`ino`,static:!1,private:!1,access:{has:e=>`ino`in e,get:e=>e.ino,set:(e,t)=>{e.ino=t}},metadata:o},xe,Se),In(this,null,Ce,{kind:`accessor`,name:`__ino_old`,static:!1,private:!1,access:{has:e=>`__ino_old`in e,get:e=>e.__ino_old,set:(e,t)=>{e.__ino_old=t}},metadata:o},we,Te),In(this,null,Ee,{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},De,Oe),In(this,null,ke,{kind:`accessor`,name:`__after_flags`,static:!1,private:!1,access:{has:e=>`__after_flags`in e,get:e=>e.__after_flags,set:(e,t)=>{e.__after_flags=t}},metadata:o},Ae,je),In(this,null,Me,{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},Ne,Pe),In(this,null,Fe,{kind:`accessor`,name:`rdev`,static:!1,private:!1,access:{has:e=>`rdev`in e,get:e=>e.rdev,set:(e,t)=>{e.rdev=t}},metadata:o},Ie,Le),In(this,null,Re,{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},ze,Be),In(this,null,Ve,{kind:`accessor`,name:`attributes`,static:!1,private:!1,access:{has:e=>`attributes`in e,get:e=>e.attributes,set:(e,t)=>{e.attributes=t}},metadata:o},He,Ue),In(this,null,We,{kind:`accessor`,name:`__data`,static:!1,private:!1,access:{has:e=>`__data`in e,get:e=>e.__data,set:(e,t)=>{e.__data=t}},metadata:o},Ge,Ke),In(null,b={value:S},y,{kind:`class`,name:S.name,metadata:o},null,x),qe=S=b.value,o&&Object.defineProperty(S,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`Inode`;constructor(...e){let t={};if(typeof e[0]==`object`&&e[0]!==null&&!ArrayBuffer.isView(e[0])&&(t=e[0],e=[B(qe)]),e[0]instanceof qe&&(e=[new Uint8Array(e[0].buffer,e[0].byteOffset,e[0].byteLength)]),super(...e),G(this,Ke),this.byteLength<B(qe))throw ue(N(`EIO`,`Buffer is too small to create an inode (${this.byteLength} bytes)`));Object.assign(this,t),this.atimeMs||=Date.now(),this.mtimeMs||=Date.now(),this.ctimeMs||=Date.now(),this.birthtimeMs||=Date.now(),this.ino&&!this.nlink&&z(`Inode ${this.ino} has an nlink of 0`)}#e=G(this,T,void 0);get data(){return this.#e}set data(e){this.#e=e}#t=(G(this,ee),G(this,ne,void 0));get __data_old(){return this.#t}set __data_old(e){this.#t=e}#n=(G(this,re),G(this,D,void 0));get size(){return this.#n}set size(e){this.#n=e}#r=(G(this,O),G(this,A,void 0));get mode(){return this.#r}set mode(e){this.#r=e}#i=(G(this,j),G(this,P,void 0));get nlink(){return this.#i}set nlink(e){this.#i=e}#a=(G(this,ie),G(this,I,void 0));get uid(){return this.#a}set uid(e){this.#a=e}#o=(G(this,ae),G(this,oe,void 0));get gid(){return this.#o}set gid(e){this.#o=e}#s=(G(this,se),G(this,le,void 0));get atimeMs(){return this.#s}set atimeMs(e){this.#s=e}#c=(G(this,R),G(this,fe,void 0));get birthtimeMs(){return this.#c}set birthtimeMs(e){this.#c=e}#l=(G(this,pe),G(this,he,void 0));get mtimeMs(){return this.#l}set mtimeMs(e){this.#l=e}#u=(G(this,ge),G(this,ve,void 0));get ctimeMs(){return this.#u}set ctimeMs(e){this.#u=e}#d=(G(this,ye),G(this,xe,void 0));get ino(){return this.#d}set ino(e){this.#d=e}#f=(G(this,Se),G(this,we,void 0));get __ino_old(){return this.#f}set __ino_old(e){this.#f=e}#p=(G(this,Te),G(this,De,void 0));get flags(){return this.#p}set flags(e){this.#p=e}#m=(G(this,Oe),G(this,Ae,void 0));get __after_flags(){return this.#m}set __after_flags(e){this.#m=e}#h=(G(this,je),G(this,Ne,void 0));get version(){return this.#h}set version(e){this.#h=e}#g=(G(this,Pe),G(this,Ie,void 0));get rdev(){return this.#g}set rdev(e){this.#g=e}#_=(G(this,Le),G(this,ze,void 0));get __padding(){return this.#_}set __padding(e){this.#_=e}#v=(G(this,Be),G(this,He,void 0));get attributes(){return this.#v}set attributes(e){this.#v=e}#y=(G(this,Ue),G(this,Ge,void 0));get __data(){return this.#y}set __data(e){this.#y=e}toString(){return`<Inode ${this.ino}>`}toJSON(){return{...p(this,Bn),attributes:this.attributes}}toStats(){return new jn(this)}update(e){if(!e)return!1;let t=!1;for(let n of Bn)e[n]!==void 0&&n!=`ino`&&n!=`data`&&this[n]!==e[n]&&(n==`atimeMs`&&this.flags&Vn.NoAtime||(this[n]=e[n],t=!0));return e.attributes&&(this.attributes.copyFrom(e.attributes),t=!0),t&&(this.ctimeMs=Date.now()),t}static{G(S,x)}};return qe=S})();function Hn(e){return(e.mode&Qe)==tt}function q(e){return(e.mode&Qe)==rt}function Un(e){return(e.mode&Qe)==et}function Wn(e){return(e.mode&Qe)==$e}function Gn(e){return(e.mode&Qe)==nt}function Kn(e){return(e.mode&Qe)==it}function qn(e){return(e.mode&Qe)==at}function J(e,t,n){let{credentials:r}=ze(e);if(Un(t))return!0;if(r.euid===0||r.egid===0)return!(n&1)||q(t)||!!(t.mode&73);let i=0;return r.uid===t.uid&&(t.mode&256&&(i|=4),t.mode&128&&(i|=2),t.mode&64&&(i|=1)),(r.gid===t.gid||r.groups.includes(Number(t.gid)))&&(t.mode&32&&(i|=4),t.mode&16&&(i|=2),t.mode&8&&(i|=1)),t.mode&4&&(i|=4),t.mode&2&&(i|=2),t.mode&1&&(i|=1),(i&n)===n}function Jn(e,t,n){let r=!0;return!isNaN(t)&&t>=0&&t<4294967295?e.uid=t:r=!1,!isNaN(n)&&n>=0&&n<4294967295?e.gid=n:r=!1,r}var Yn=class e extends Map{maxSize=ct;toJSON(){return{version:1,maxSize:this.maxSize,entries:Object.fromEntries(Array.from(this).map(([e,t])=>[e,t.toJSON()]))}}toString(){return JSON.stringify(this.toJSON())}clear(){super.clear(),this.#e=0}get byteSize(){let e=this.size*B(K);for(let t of this.values())e+=t.size;return e}usage(){return{totalSpace:this.maxSize,freeSpace:this.maxSize-this.byteSize}}pathOf(e){for(let[t,n]of this)if(n.ino==e||n.data==e)return t}getByID(e){return this.entryByID(e)?.inode}entryByID(e){for(let[t,n]of this)if(n.ino==e||n.data==e)return{path:t,inode:n}}directoryEntries(e){let t=this.get(e);if(!t)throw N(`ENOENT`);if((t.mode&61440)!=16384)throw N(`ENOTDIR`);let n={};for(let t of this.keys())W(t)==e&&t!=e&&(n[wn(t)]=this.get(t).ino);return n}#e=0;_alloc(){return this.#e||=Array.from(this.values()).reduce((e,t)=>Math.max(e,t.ino,t.data),0),this.#e++,this.#e++}directories(){let e=new Map;for(let[t,n]of this){if((n.mode&61440)!=16384)continue;let r={};for(let e of this.keys())W(e)==t&&e!=t&&(r[wn(e)]=this.get(e).ino);e.set(t,r)}return e}fromJSON(e){if(e.version!=1)throw N(`EINVAL`,`Index version mismatch`);this.clear();for(let[t,n]of Object.entries(e.entries))n.data??=S(1,ct),t==`/`&&(n.ino=0),this.set(t,new K(n));return this}static parse(t){if(!h(t))throw N(`EINVAL`,`Invalid JSON`);let n=JSON.parse(t),r=new e;return r.fromJSON(n),r}},Xn=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},Zn=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},Qn;(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`})(Qn||={});let $n=(()=>{var e,t,n,r,i;let a=[Xt()],s,c=[],l,u=$t(o),d,f=[],p=[],m,h=[],g=[],_,v=[],b=[],x,S=[],C=[],w,T=[],ee=[],te,ne=[],re=[];var E=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)],te=[V.char(8)],Xn(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),Xn(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),Xn(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),Xn(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),Xn(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),Xn(this,null,te,{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},ne,re),Xn(null,s={value:l},a,{kind:`class`,name:l.name,metadata:o},null,c),E=l=s.value,o&&Object.defineProperty(l,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static name=`fsxattr`;#e=Zn(this,f,void 0);get xflags(){return this.#e}set xflags(e){this.#e=e}#t=(Zn(this,p),Zn(this,h,void 0));get extsize(){return this.#t}set extsize(e){this.#t=e}#n=(Zn(this,g),Zn(this,v,void 0));get nextents(){return this.#n}set nextents(e){this.#n=e}#r=(Zn(this,b),Zn(this,S,void 0));get projid(){return this.#r}set projid(e){this.#r=e}#i=(Zn(this,C),Zn(this,T,void 0));get cowextsize(){return this.#i}set cowextsize(e){this.#i=e}#a=(Zn(this,ee),Zn(this,ne,[]));get pad(){return this.#a}set pad(e){this.#a=e}constructor(e=y(new j(O.EINVAL,`fsxattr must be initialized with an inode`))){super(new ArrayBuffer(B(E))),Zn(this,re),this.extsize=e.size,this.nextents=1,this.projid=e.uid,this.cowextsize=e.size;for(let t of Object.keys(Vn))(e.flags||0)&Vn[t]&&t in Qn&&(this.xflags|=Qn[t])}static{Zn(l,c)}};return E=l})();var er;(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`})(er||={});var tr;(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`})(tr||={});var nr;(function(e){e[e.GetFlags=2147771905]=`GetFlags`,e[e.SetFlags=1074030082]=`SetFlags`,e[e.GetVersion=2147776001]=`GetVersion`,e[e.SetVersion=1074034178]=`SetVersion`})(nr||={});const rr={[tr.GetFlags](e){if(typeof e.inode.flags!=`number`)throw N(`ENOTTY`);return e.inode.flags},[nr.GetFlags](e){if(typeof e.inode.flags!=`number`)throw N(`ENOTTY`);return e.inode.flags},[tr.GetVersion](e){if(typeof e.inode.version!=`number`)throw N(`ENOTTY`);return e.inode.version},[nr.GetVersion](e){if(typeof e.inode.version!=`number`)throw N(`ENOTTY`);return e.inode.version},[tr.Fiemap](){throw N(`ENOTSUP`)},[tr.GetXattr](e,t){return new $n(e.inode)},[tr.SetXattr](e,t,n){throw N(`ENOTSUP`)},[tr.GetLabel](e){return e.fs.label},[tr.SetLabel](e,t){e.fs.label=t},[tr.GetUUID](e){return e.fs.uuid},[tr.GetSysfsPath](e){return`/sys/fs/${e.fs.name}/${e.fs.uuid}`}},ir={...rr,async[tr.SetFlags](e,t){e.inode.flags=t,await e.fs.touch(e.path,e.inode)},async[nr.SetFlags](e,t){e.inode.flags=t,await e.fs.touch(e.path,e.inode)},async[tr.SetVersion](e,t){e.inode.version=t,await e.fs.touch(e.path,e.inode)},async[nr.SetVersion](e,t){e.inode.version=t,await e.fs.touch(e.path,e.inode)}},ar={...rr,[tr.SetFlags](e,t){e.inode.flags=t,e.fs.touchSync(e.path,e.inode)},[nr.SetFlags](e,t){e.inode.flags=t,e.fs.touchSync(e.path,e.inode)},[tr.SetVersion](e,t){e.inode.version=t,e.fs.touchSync(e.path,e.inode)},[nr.SetVersion](e,t){e.inode.version=t,e.fs.touchSync(e.path,e.inode)}},or=4096;var sr=class e{type;name;label;_mountPoint;_uuid=crypto.randomUUID();get uuid(){return this._uuid}attributes=new Map;constructor(t,n){this.type=t,this.name=n,this.streamRead===e.prototype.streamRead&&this.attributes.set(`default_stream_read`),this.streamWrite===e.prototype.streamWrite&&this.attributes.set(`default_stream_write`)}toString(){return`${this.name} ${this.label?JSON.stringify(this.label):``} (${this._mountPoint?`mounted on `+this._mountPoint:`unmounted`})`}usage(){return{totalSpace:0,freeSpace:0}}async ready(){}readySync(){if(this.ready!==e.prototype.ready)throw N(`EAGAIN`)}async exists(e){try{return await this.stat(e),!0}catch(e){return e.code!=`ENOENT`}}existsSync(e){try{return this.statSync(e),!0}catch(e){return e.code!=`ENOENT`}}streamRead(e,t){return new ReadableStream({start:async n=>{let{size:r}=await this.stat(e),{start:i=0,end:a=r}=t;for(let t=i;t<a;t+=or){let r=t+or>a?a-t:or,i=new Uint8Array(r);await this.read(e,i,t,t+r).catch(n.error.bind(n)),n.enqueue(i)}n.close()},type:`bytes`})}streamWrite(e,t){let n=t.start??0;return new WritableStream({write:async(t,r)=>{let i=!1,a=e=>{i=!0,r.error(e)},{size:o}=await this.stat(e);await this.write(e,t,n).catch(a),!i&&(n+=t.byteLength,await this.touch(e,{mtimeMs:Date.now(),size:Math.max(o,n)}).catch(a))}})}async ioctl(e,t,...n){let r=ir[t];if(!r)throw N(`ENOTTY`);return await r(this,e,...n)}ioctlSync(e,t,...n){let r=ar[t];if(!r)throw N(`ENOTTY`);return r(this,e,...n)}};Promise.withResolvers??=(z(`Using a polyfill of Promise.withResolvers`),function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}),Symbol.dispose??=(z(`Using a polyfill of Symbol.dispose`),Symbol(`Symbol.dispose`)),Symbol.asyncDispose??=(z(`Using a polyfill of Symbol.asyncDispose`),Symbol(`Symbol.asyncDispose`)),globalThis.crypto.randomUUID??=(z(`Using a polyfill of crypto.randomUUID`),function(){let e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}),Uint8Array.prototype.toBase64??=(z(`Using a polyfill of Uint8Array.prototype.toBase64`),function(){return btoa(String.fromCharCode(...this))}),Uint8Array.fromBase64??=(z(`Using a polyfill of Uint8Array.fromBase64`),function(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}),Uint8Array.prototype.toHex??=(z(`Using a polyfill of Uint8Array.prototype.toHex`),function(){return Array.from(this).map(e=>e.toString(16).padStart(2,`0`)).join(``)}),Uint8Array.fromHex??=(z(`Using a polyfill of Uint8Array.fromHex`),function(e){let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.slice(n,n+2),16);return t});var cr=class{store;constructor(e){this.store=e}},lr=class extends cr{async get(e,t,n){return this.getSync(e,t,n)}async set(e,t,n){return this.setSync(e,t,n)}async remove(e){return this.removeSync(e)}},ur=class extends cr{asyncDone=Promise.resolve();async(e){this.asyncDone=this.asyncDone.then(()=>e)}_cached(e,t){this.store.cache??=new Map;let n=this.store.cache.get(e);return n?(t&&(n.size=t.size),n):t?new s(e,t.size,{},this.store.cache):void 0}getSync(e,t,n){let r=this._cached(e);if(!r)return;n??=r.size;let i=r.missing(t,n);for(let{start:t,end:n}of i)this.async(this.get(e,t,n));if(i.length)throw N(`EAGAIN`);let a=r.regionAt(t);if(!a){z(`Missing cache region for `+e);return}return a.data.subarray(t-a.offset,n-a.offset)}setSync(e,t,n){this.async(this.set(e,t,n))}removeSync(e){this.async(this.remove(e)),this.store.cache?.delete(e)}},dr=class{raw;fs;done=!1;flag(e){return this.raw.store.flags?.includes(e)??!1}constructor(e,t){this.raw=e,this.fs=t}originalData=new Map;modifiedKeys=new Set;keys(){return this.raw.keys()}async get(e,t=0,n){let r=await this.raw.get(e,t,n);return this.stash(e),r}getSync(e,t=0,n){let r=this.raw.getSync(e,t,n);return this.stash(e),r}async set(e,t,n=0){await this.markModified(e,n,t.byteLength);let r=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength);await this.raw.set(e,r,n)}setSync(e,t,n=0){this.markModifiedSync(e,n,t.byteLength);let r=t instanceof Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength);this.raw.setSync(e,r,n)}async remove(e){await this.markModified(e,0,void 0),await this.raw.remove(e)}removeSync(e){this.markModifiedSync(e,0,void 0),this.raw.removeSync(e)}commit(){return this.done=!0,Promise.resolve()}commitSync(){this.done=!0}async abort(){if(!this.done){for(let[e,t]of this.originalData)if(this.modifiedKeys.has(e)){if(t.some(e=>!e.data)){await this.raw.remove(e),this.fs._remove(e);continue}for(let n of t.reverse())await this.raw.set(e,n.data,n.offset)}this.done=!0}}abortSync(){if(!this.done){for(let[e,t]of this.originalData)if(this.modifiedKeys.has(e)){if(t.some(e=>!e.data)){this.raw.removeSync(e),this.fs._remove(e);continue}for(let n of t.reverse())this.raw.setSync(e,n.data,n.offset)}this.done=!0}}async[Symbol.asyncDispose](){this.done||await this.abort()}[Symbol.dispose](){this.done||this.abortSync()}stash(e,t,n=0){this.originalData.has(e)||this.originalData.set(e,[]),this.originalData.get(e).push({data:t,offset:n})}async markModified(e,t,n){this.modifiedKeys.add(e);let r=n?t+n:void 0;try{this.stash(e,await this.raw.get(e,t,r),t)}catch(n){if(!(this.raw instanceof ur))throw n;let i=this.raw._cached(e);if(!i)throw n;for(let n of i.cached(t,r??t))this.stash(e,await this.raw.get(e,n.start,n.end),n.start)}}markModifiedSync(e,t,n){this.modifiedKeys.add(e);let r=n?t+n:void 0;try{this.stash(e,this.raw.getSync(e,t,r),t)}catch(n){if(!(this.raw instanceof ur))throw n;let i=this.raw._cached(e);if(!i)throw n;for(let n of i.cached(t,r??t))this.stash(e,this.raw.getSync(e,n.start,n.end),n.start)}}},fr=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},pr=(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}),mr=class extends sr{store;_ids=new Map([[`/`,0]]);_paths=new Map([[0,new Set(`/`)]]);_path(e){let[t]=this._paths.get(e)??[];return t}_add(e,t){this._paths.has(e)||this._paths.set(e,new Set),this._paths.get(e).add(t),this._ids.set(t,e)}_remove(e){for(let t of this._paths.get(e)??[])this._ids.delete(t);this._paths.delete(e)}_move(e,t){let n=[];for(let[r,i]of this._ids){let a=Cn(e,r);if(a.startsWith(`..`))continue;let o=U(t,a);o.endsWith(`/`)&&(o=o.slice(0,-1)),n.push({oldKey:r,newKey:o,ino:i})}for(let{oldKey:e,newKey:t,ino:r}of n){this._ids.delete(e),this._ids.set(t,r);let n=this._paths.get(r);if(!n){z(`Missing paths in table for ino `+r);continue}n.delete(e),n.add(t)}}_initialized=!1;async ready(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),await this.checkRoot(),await this._populate(),!0)}readySync(){this._initialized||=(this.attributes.has(`no_async_preload`)||this.checkRootSync(),this.checkRootSync(),this._populateSync(),!0)}constructor(e){super(e.type??1802921587,e.name),this.store=e,e.fs=this,this._uuid=e.uuid??this.uuid,this.label=e.label,pe(this.name+`: supports features: `+this.store.flags?.join(`, `))}usage(){return this.store.usage?.()||{totalSpace:0,freeSpace:0}}async loadIndex(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!0),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),await n.set(i.ino,i),r.has(t)&&await n.set(i.data,an(r.get(t)));await n.commit()}catch(e){t.error=e,t.hasError=!0}finally{let e=pr(t);e&&await e}}loadIndexSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!1),r=e.directories();for(let[t,i]of e)this._add(i.ino,t),n.setSync(i.ino,i),r.has(t)&&n.setSync(i.data,an(r.get(t)));n.commitSync()}catch(e){t.error=e,t.hasError=!0}finally{pr(t)}}async createIndex(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Yn,n=fr(e,this.transaction(),!0),r=[[`/`,0]],i=v(N(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new K(await n.get(i));if(t.set(e,a),q(a)){let t=rn(await n.get(a.data)??y(N(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([U(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{let t=pr(e);t&&await t}}createIndexSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=new Yn,n=fr(e,this.transaction(),!1),r=[[`/`,0]],i=v(N(`EDEADLK`));for(;r.length;){let[e,i]=r.shift(),a=new K(n.getSync(i));if(t.set(e,a),q(a)){let t=rn(n.getSync(a.data)??y(N(`ENODATA`)));for(let[n,i]of Object.entries(t))r.push([U(e,n),i])}}return i(),t}catch(t){e.error=t,e.hasError=!0}finally{pr(e)}}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!0),i=Dn(e),a=Dn(t),o=await this.findInode(r,i.dir),s=rn(await r.get(o.data)??y(N(`ENODATA`)));if(!s[i.base])throw N(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&R(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw N(`EBUSY`);let l=a.dir==i.dir,u=l?o:await this.findInode(r,a.dir),d=l?s:rn(await r.get(u.data)??y(N(`ENODATA`)));if(d[a.base]){let e=new K(await r.get(d[a.base])??y(N(`ENOENT`)));if(!Hn(e))throw N(`EISDIR`);await r.remove(e.data),await r.remove(d[a.base])}d[a.base]=c,await r.set(o.data,an(s)),await r.set(u.data,an(d)),await r.commit(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{let e=pr(n);e&&await e}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!1),i=Dn(e),a=Dn(t),o=this.findInodeSync(r,i.dir),s=rn(r.getSync(o.data)??y(N(`ENODATA`)));if(!s[i.base])throw N(`ENOENT`);let c=s[i.base];if(c!=this._ids.get(e)&&R(`Ino mismatch while renaming ${e} to ${t}`),delete s[i.base],(a.dir+`/`).startsWith(e+`/`))throw N(`EBUSY`);let l=a.dir===i.dir,u=l?o:this.findInodeSync(r,a.dir),d=l?s:rn(r.getSync(u.data)??y(N(`ENODATA`)));if(d[a.base]){let e=new K(r.getSync(d[a.base])??y(N(`ENOENT`)));if(!Hn(e))throw N(`EISDIR`);r.removeSync(e.data),r.removeSync(d[a.base])}d[a.base]=c,r.setSync(o.data,an(s)),r.setSync(u.data,an(d)),r.commitSync(),this._move(e,t)}catch(e){n.error=e,n.hasError=!0}finally{pr(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!0);return await this.findInode(n,e)}catch(e){t.error=e,t.hasError=!0}finally{let e=pr(t);e&&await e}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!1);return this.findInodeSync(n,e)}catch(e){t.error=e,t.hasError=!0}finally{pr(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!0),i=await this.findInode(r,e);if(!q(i)&&t.size!==void 0&&t.size!==i.size){let e=await r.get(i.data)??new Uint8Array;t.size<e.byteLength&&e.fill(0,t.size),await r.set(i.data,t.size<e.byteLength?e.subarray(0,t.size):a(e,t.size))}i.update(t)&&(this._add(i.ino,e),r.setSync(i.ino,i)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=pr(n);e&&await e}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!1),i=this.findInodeSync(r,e);if(!q(i)&&t.size!==void 0&&t.size!==i.size){let e=r.getSync(i.data)??new Uint8Array;t.size<e.byteLength&&e.fill(0,t.size),r.setSync(i.data,t.size<e.byteLength?e.subarray(0,t.size):a(e,t.size))}i.update(t)&&(this._add(i.ino,e),r.setSync(i.ino,i)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{pr(n)}}async createFile(e,t){return await this.commitNew(e,{...t,mode:t.mode|tt},new Uint8Array)}createFileSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|tt},new Uint8Array)}async unlink(e){return this.remove(e,!1)}unlinkSync(e){this.removeSync(e,!1)}async rmdir(e){if((await this.readdir(e)).length)throw N(`ENOTEMPTY`);await this.remove(e,!0)}rmdirSync(e){if(this.readdirSync(e).length)throw N(`ENOTEMPTY`);this.removeSync(e,!0)}async mkdir(e,t){return await this.commitNew(e,{...t,mode:t.mode|rt},T(`{}`))}mkdirSync(e,t){return this.commitNewSync(e,{...t,mode:t.mode|rt},T(`{}`))}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!0),r=await this.findInode(n,e);return Object.keys(rn(await n.get(r.data)??y(N(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{let e=pr(t);e&&await e}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{let n=fr(t,this.transaction(),!1),r=this.findInodeSync(n,e);return Object.keys(rn(n.getSync(r.data)??y(N(`ENOENT`))))}catch(e){t.error=e,t.hasError=!0}finally{pr(t)}}async sync(){}syncSync(){}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!0),i=W(t),a=await this.findInode(r,i),o=rn(await r.get(a.data)??y(N(`ENOENT`))),s=await this.findInode(r,e);s.nlink++,o[wn(t)]=s.ino,this._add(s.ino,t),await r.set(s.ino,s),await r.set(a.data,an(o)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=pr(n);e&&await e}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!1),i=W(t),a=this.findInodeSync(r,i),o=rn(r.getSync(a.data)??y(N(`ENOENT`))),s=this.findInodeSync(r,e);s.nlink++,o[wn(t)]=s.ino,this._add(s.ino,t),r.setSync(s.ino,s),r.setSync(a.data,an(o)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{pr(n)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=fr(i,this.transaction(),!0),o=await this.findInode(a,e);if(o.size==0)return;let s=await a.get(o.data,n,r)??y(N(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&R(`Trying to place ${c.byteLength} bytes into a ${t.byteLength} byte buffer on read`),t.set(c)}catch(e){i.error=e,i.hasError=!0}finally{let e=pr(i);e&&await e}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{let a=fr(i,this.transaction(),!1),o=this.findInodeSync(a,e);if(o.size==0)return;let s=a.getSync(o.data,n,r)??y(N(`ENODATA`)),c=a.flag(`partial`)?s:s.subarray(n,r);c.byteLength>t.byteLength&&R(`Trying to place ${c.byteLength} bytes into a ${t.byteLength} byte buffer on read`),t.set(c)}catch(e){i.error=e,i.hasError=!0}finally{pr(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=fr(r,this.transaction(),!0),o=await this.findInode(i,e),s=n+t.byteLength,c=t;i.flag(`partial`)||(c=a(await i.get(o.data)??new Uint8Array,s),c.set(t,n),n=0),await i.set(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),await i.set(o.ino,o),this._add(o.ino,e),await i.commit()}catch(e){r.error=e,r.hasError=!0}finally{let e=pr(r);e&&await e}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{let i=fr(r,this.transaction(),!1),o=this.findInodeSync(i,e),s=n+t.byteLength,c=t;i.flag(`partial`)||(c=a(i.getSync(o.data)??new Uint8Array,s),c.set(t,n),n=0),i.setSync(o.data,c,n),o.update({size:Math.max(o.size,s),mtimeMs:Date.now()}),i.setSync(o.ino,o),this._add(o.ino,e),i.commitSync()}catch(e){r.error=e,r.hasError=!0}finally{pr(r)}}transaction(){return new dr(this.store.transaction(),this)}async checkRoot(){let e={stack:[],error:void 0,hasError:!1};try{let t=fr(e,this.transaction(),!0);if(await t.get(0))return;let n=new K({ino:0,data:1,mode:16895});await t.set(n.data,T(`{}`)),this._add(0,`/`),await t.set(0,n),await t.commit()}catch(t){e.error=t,e.hasError=!0}finally{let t=pr(e);t&&await t}}checkRootSync(){let e={stack:[],error:void 0,hasError:!1};try{let t=fr(e,this.transaction(),!1);if(t.getSync(0))return;let n=new K({ino:0,data:1,mode:16895});t.setSync(n.data,T(`{}`)),this._add(0,`/`),t.setSync(0,n),t.commitSync()}catch(t){e.error=t,e.hasError=!0}finally{pr(e)}}async _populate(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){z(`Attempted to populate tables after initialization`);return}pe(`Populating tables with existing store metadata`);let t=fr(e,this.transaction(),!0),n=await t.get(0);if(!n){de(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:16895});await t.set(e.data,T(`{}`)),this._add(0,`/`),await t.set(0,e),await t.commit();return}if(n.length<B(K)){ue(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=await t.get(n);if(!o){z(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){z(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new K(o);if(!q(s)||r.has(n))continue;r.add(n);let c=await t.get(s.data);if(!c){z(`Store is missing directory data: `+s.data);continue}let l=rn(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}pe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{let t=pr(e);t&&await t}}_populateSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this._initialized){z(`Attempted to populate tables after initialization`);return}pe(`Populating tables with existing store metadata`);let t=fr(e,this.transaction(),!1),n=t.getSync(0);if(!n){de(`Store does not have a root inode`);let e=new K({ino:0,data:1,mode:16895});t.setSync(e.data,T(`{}`)),this._add(0,`/`),t.setSync(0,e),t.commitSync();return}if(n.length<B(K)){ue(`Store contains an invalid root inode. Refusing to populate tables`);return}let r=new Set,i=0,a=[[`/`,0]];for(;a.length>0;){i++;let[e,n]=a.shift();this._add(n,e);let o=t.getSync(n);if(!o){z(`Store is missing data for inode: `+n);continue}if(o.length<B(K)){z(`Invalid inode size for ino ${n}: ${o.length}`);continue}let s=new K(o);if(!q(s)||r.has(n))continue;r.add(n);let c=t.getSync(s.data);if(!c){z(`Store is missing directory data: `+s.data);continue}let l=rn(c);for(let[t,n]of Object.entries(l))a.push([U(e,t),n])}pe(`Added ${i} existing inode(s) from store`)}catch(t){e.error=t,e.hasError=!0}finally{pr(e)}}async _findInode(e,t,n=new Set){if(n.has(t))throw ue(N(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(await e.get(0)??y(N(`ENODATA`)));let{dir:r,base:i}=Dn(t),a=await this._findInode(e,r,n),o=rn(await e.get(a.data)??y(N(`ENODATA`)));if(!(i in o))throw N(`ENOENT`);return new K(await e.get(o[i])??y(N(`ENODATA`)))}_findInodeSync(e,t,n=new Set){if(n.has(t))throw ue(N(`EIO`,`Infinite loop detected while finding inode`));if(n.add(t),t==`/`)return new K(e.getSync(0)??y(N(`ENOENT`)));let{dir:r,base:i}=Dn(t),a=this._findInodeSync(e,r,n),o=rn(e.getSync(a.data)??y(N(`ENODATA`)));if(!(i in o))throw N(`ENOENT`);return new K(e.getSync(o[i])??y(N(`ENODATA`)))}async findInode(e,t){if(this.attributes.has(`no_id_tables`))return await this._findInode(e,t);let n=this._ids.get(t);if(n===void 0)throw N(`ENOENT`);return new K(await e.get(n)??y(N(`ENOENT`)))}findInodeSync(e,t){if(this.attributes.has(`no_id_tables`))return this._findInodeSync(e,t);let n=this._ids.get(t);if(n===void 0)throw N(`ENOENT`);return new K(e.getSync(n)??y(N(`ENOENT`)))}_lastID;allocNew(e){this._lastID||=Array.from(this._paths.keys()).reduce((e,t)=>Math.max(e,t),0),this._lastID+=2;let t=this._lastID;if(t>4294967295)throw R(N(`ENOSPC`,`No IDs available`));return this._add(t,e),t}async commitNew(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw N(`EEXIST`);let i=fr(r,this.transaction(),!0),{dir:a,base:o}=Dn(e),s=await this.findInode(i,a),c=rn(await i.get(s.data)??y(N(`ENOENT`)));if(c[o])throw N(`EEXIST`);let l=this.allocNew(e),u=new K({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return await i.set(u.ino,u),await i.set(u.data,n),c[o]=u.ino,await i.set(s.data,an(c)),await i.commit(),u}catch(e){r.error=e,r.hasError=!0}finally{let e=pr(r);e&&await e}}commitNewSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{if(e==`/`)throw N(`EEXIST`);let i=fr(r,this.transaction(),!1),{dir:a,base:o}=Dn(e),s=this.findInodeSync(i,a),c=rn(i.getSync(s.data)??y(N(`ENOENT`)));if(c[o])throw N(`EEXIST`);let l=this.allocNew(e),u=new K({...t,ino:l,data:l+1,size:n.byteLength,nlink:1});return i.setSync(u.ino,u),i.setSync(u.data,n),c[o]=u.ino,i.setSync(s.data,an(c)),i.commitSync(),u}catch(e){r.error=e,r.hasError=!0}finally{pr(r)}}async remove(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!0),{dir:i,base:a}=Dn(e),o=await this.findInode(r,i),s=rn(await r.get(o.data)??y(N(`ENOENT`)));if(!s[a])throw N(`ENOENT`);let c=s[a],l=new K(await r.get(c)??y(N(`ENOENT`)));if(delete s[a],!t&&q(l))throw N(`EISDIR`);await r.set(o.data,an(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),await r.set(l.ino,l)):(await r.remove(l.data),await r.remove(c),this._remove(c)),await r.commit()}catch(e){n.error=e,n.hasError=!0}finally{let e=pr(n);e&&await e}}removeSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{let r=fr(n,this.transaction(),!1),{dir:i,base:a}=Dn(e),o=this.findInodeSync(r,i),s=rn(r.getSync(o.data)??y(N(`ENOENT`))),c=s[a];if(!c)throw N(`ENOENT`);let l=new K(r.getSync(c)??y(N(`ENOENT`)));if(delete s[a],!t&&q(l))throw N(`EISDIR`);r.setSync(o.data,an(s)),l.nlink>1?(l.update({nlink:l.nlink-1}),r.setSync(l.ino,l)):(r.removeSync(l.data),r.removeSync(c),this._remove(c)),r.commitSync()}catch(e){n.error=e,n.hasError=!0}finally{pr(n)}}},hr=class extends lr{async keys(){return this.store.keys()}async get(e){return await(this.store.getAsync?.(e)??this.store.get(e))}getSync(e){return this.store.get(e)}setSync(e,t){this.store.set(e,t)}removeSync(e){this.store.delete(e)}},gr=class extends ur{async keys(){return await this.asyncDone,this.store.keys()}async get(e,t,n){return await this.asyncDone,await this.store.get(e,t,n)}getSync(e,t,n){return this.store.cached(e,t,n)}async set(e,t,n=0){await this.asyncDone,await this.store.set(e,t,n)}async remove(e){await this.asyncDone,await this.store.delete(e)}},_r=class extends Map{maxSize;label;flags=[];name=`tmpfs`;constructor(e=ct,t){super(),this.maxSize=e,this.label=t}async sync(){}transaction(){return new hr(this)}get bytes(){let e=this.size*4;for(let t of this.values())e+=t.byteLength;return e}usage(){return{totalSpace:this.maxSize,freeSpace:this.maxSize-this.bytes}}};const vr={name:`InMemory`,options:{maxSize:{type:`number`,required:!1},label:{type:`string`,required:!1}},create({maxSize:e,label:t}){let n=new mr(new _r(e,t));return n.checkRootSync(),n}};var yr=class extends mr{devices=new Map;devicesWithDriver(e,t){if(t&&typeof e==`string`)throw R(N(`EINVAL`,`Can not fetch devices using only a driver name`));let n=[];for(let r of this.devices.values())t&&r.driver!=e||(typeof e==`string`?e:e.name)==r.driver.name&&n.push(r);return n}_createDevice(e,t={}){let n=1,r=Array.from(this.devices.values()).at(-1);for(;this.store.has(n)||r?.inode.ino==n;)n++;let i=e.init?.(n,t),a={data:{},minor:0,major:0,...m(i??{},`metadata`),driver:e,inode:new K({mode:8630,...i?.metadata})},o=`/`+(a.name||e.name)+(e.singleton?``:this.devicesWithDriver(e).length);if(this.existsSync(o))throw N(`EEXIST`);return this.devices.set(o,a),fe(`Initialized device: `+this._mountPoint+o),a}addDefaults(){this._createDevice(xr),this._createDevice(Sr),this._createDevice(Cr),this._createDevice(wr),this._createDevice(Tr),pe(`Added default devices`)}constructor(){super(new _r(16777216,`devfs`))}async rename(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.rename(e,t)}renameSync(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.renameSync(e,t)}async stat(e){let t=this.devices.get(e);return t?t.inode:super.stat(e)}statSync(e){let t=this.devices.get(e);return t?t.inode:super.statSync(e)}async touch(e,t){let n=this.devices.get(e);n?n.inode.update(t):await super.touch(e,t)}touchSync(e,t){let n=this.devices.get(e);n?n.inode.update(t):super.touchSync(e,t)}async createFile(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.createFile(e,t)}createFileSync(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.createFileSync(e,t)}async unlink(e){if(this.devices.has(e))throw N(`EPERM`);return super.unlink(e)}unlinkSync(e){if(this.devices.has(e))throw N(`EPERM`);return super.unlinkSync(e)}async rmdir(e){return super.rmdir(e)}rmdirSync(e){return super.rmdirSync(e)}async mkdir(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.mkdir(e,t)}mkdirSync(e,t){if(this.devices.has(e))throw N(`EEXIST`);return super.mkdirSync(e,t)}async readdir(e){let t=await super.readdir(e);for(let n of this.devices.keys())W(n)==e&&t.push(wn(n));return t}readdirSync(e){let t=super.readdirSync(e);for(let n of this.devices.keys())W(n)==e&&t.push(wn(n));return t}async link(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.link(e,t)}linkSync(e,t){if(this.devices.has(e))throw N(`EPERM`);if(this.devices.has(t))throw N(`EEXIST`);return super.linkSync(e,t)}async sync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.sync()}syncSync(){for(let e of this.devices.values())e.driver.sync?.(e);return super.syncSync()}async read(e,t,n,r){let i=this.devices.get(e);if(!i){await super.read(e,t,n,r);return}i.driver.read(i,t,n,r)}readSync(e,t,n,r){let i=this.devices.get(e);if(!i){super.readSync(e,t,n,r);return}i.driver.read(i,t,n,r)}async write(e,t,n){let r=this.devices.get(e);if(!r)return await super.write(e,t,n);r.driver.write(r,t,n)}writeSync(e,t,n){let r=this.devices.get(e);if(!r)return super.writeSync(e,t,n);r.driver.write(r,t,n)}};const br=new Uint8Array,xr={name:`null`,singleton:!0,init(){return{major:1,minor:3}},read(){return br},write(){}},Sr={name:`zero`,singleton:!0,init(){return{major:1,minor:5}},read(e,t,n,r){t.fill(0,n,r)},write(){}},Cr={name:`full`,singleton:!0,init(){return{major:1,minor:7}},read(e,t,n,r){t.fill(0,n,r)},write(){throw N(`ENOSPC`)}},wr={name:`random`,singleton:!0,init(){return{major:1,minor:8}},read(e,t){for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256)},write(){}},Tr={name:`console`,singleton:!0,init(e,{output:t=e=>console.log(e)}={}){return{major:5,minor:1,data:{output:t}}},read(){return br},write(e,t,n){let r=te(t);e.data.output(r,n)}},Er={null:xr,zero:Sr,full:Cr,random:wr,console:Tr};var Y=r();let X=!0;function Dr(e){X=e}var Or;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.FIFO=1]=`FIFO`,e[e.CHR=2]=`CHR`,e[e.DIR=4]=`DIR`,e[e.BLK=6]=`BLK`,e[e.REG=8]=`REG`,e[e.LNK=10]=`LNK`,e[e.SOCK=12]=`SOCK`,e[e.WHT=14]=`WHT`})(Or||={});function kr(e){return(e&61440)>>12}function Ar(e){return e<<12}var jr=class{ino;type;path;name},Mr=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},Nr=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},Pr=class{pending=new Set;lastWriter;writeState=0;readers=0;syncReaders=0;take(e,t,n){e==`rw`?this.writeState=t?2:1:(this.readers++,t&&this.syncReaders++);let r=!1,i=()=>{r||(r=!0,e==`rw`?this.writeState=0:(this.readers--,t&&this.syncReaders--),n())};return i[Symbol.dispose]=i,i}queue(e){let{promise:t,resolve:n}=Promise.withResolvers();return this.pending.add(t),e==`rw`&&(this.lastWriter=t),t.then(()=>{this.pending.delete(t),this.lastWriter==t&&delete this.lastWriter}),n}async acquire(e){let t=e==`ro`?this.lastWriter:Promise.all(this.pending),n=this.queue(e);return await t,this.take(e,!1,n)}acquireSync(e){if(this.writeState==2||e==`rw`&&this.syncReaders)throw N(`EDEADLK`);if(this.writeState||e==`rw`&&this.readers)throw N(`EAGAIN`);return this.take(e,!0,this.queue(e))}isAvailable(e){return(e!=`rw`||!this.readers)&&!this.writeState}get isFree(){return!this.writeState&&!this.readers}get mode(){return this.writeState?`rw`:this.readers?`ro`:null}};let Fr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;t=[b],n=[b],Nr(this,null,t,{kind:`getter`,name:`lock`,static:!1,private:!1,access:{has:e=>`lock`in e,get:e=>e.lock},metadata:r},null,e),Nr(this,null,n,{kind:`getter`,name:`lockSync`,static:!1,private:!1,access:{has:e=>`lockSync`in e,get:e=>e.lockSync},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}_rwLock=(Mr(this,e),new Pr);get lock(){return this._rwLock.acquire.bind(this._rwLock)}get lockSync(){return this._rwLock.acquireSync.bind(this._rwLock)}get isLocked(){return!this._rwLock.isFree}get lockMode(){return this._rwLock.mode}}})();var Ir=class extends Fr{fs;inode;data;dirtyRanges=[];truncatedTo;metadataDirty=!1;refs=0;paths=new Set;_lastPath;constructor(e,t,n){super(),this.fs=e,this.inode=n,this.paths.add(t),this._lastPath=t,this.data=new s(n.ino,n.size,{sparse:!0})}get ino(){return this.inode.ino}get path(){let[e]=this.paths;return e!==void 0&&(this._lastPath=e),e??this._lastPath}get dirty(){return this.metadataDirty||this.dirtyRanges.length>0}get bypassCache(){return Kn(this.inode)||Gn(this.inode)||!!(this.inode.flags&Vn.DAX)}markDirty(e,t){this.dirtyRanges.push({start:e,end:t}),this.dirtyRanges.sort((e,t)=>e.start-t.start);let n=[];for(let e of this.dirtyRanges){let t=n.at(-1);t&&e.start<=t.end?t.end=Math.max(t.end,e.end):n.push(e)}this.dirtyRanges=n}copyFromCache(e,t,n){let r=t;for(let i of this.data.regions){let a=i.offset+i.data.byteLength;if(a<=r)continue;if(i.offset>=n)break;i.offset>r&&(e.fill(0,r-t,i.offset-t),r=i.offset);let o=Math.min(n,a);e.set(i.data.subarray(r-i.offset,o-i.offset),r-t),r=o}r<n&&e.fill(0,r-t,n-t)}async read(e,t,n){if(this.bypassCache)return await this.fs.read(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);await this.fs.read(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}readSync(e,t,n){if(this.bypassCache)return this.fs.readSync(this.path,e,t,n);for(let{start:e,end:r}of this.data.missing(t,n)){let t=new Uint8Array(r-e);this.fs.readSync(this.path,t,e,r),this.data.add(t,e)}this.copyFromCache(e,t,n)}async write(e,t){this.bypassCache?await this.fs.write(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}writeSync(e,t){this.bypassCache?this.fs.writeSync(this.path,e,t):this._writeCached(e,t),this._writeMetadata(t+e.byteLength)}_writeCached(e,t){let n=t+e.byteLength;this.data.add(e.slice(),t),n>this.data.size&&(this.data.size=n),this.markDirty(t,n)}_writeMetadata(e){!this.bypassCache&&e>this.inode.size&&(this.inode.size=e),this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}truncate(e){this.truncatedTo=Math.min(this.truncatedTo??e,e),this.data.size=e,this.dirtyRanges=this.dirtyRanges.filter(t=>t.start<e).map(t=>t.end>e?{start:t.start,end:e}:t),this.inode.size=e,this.inode.mtimeMs=Date.now(),this.inode.ctimeMs=Date.now(),this.metadataDirty=!0}get needsPreTruncate(){return!this.bypassCache&&this.truncatedTo!==void 0&&this.truncatedTo<this.inode.size&&!this.fs.attributes.has(`no_write`)}async sync(){this.needsPreTruncate&&await this.fs.touch(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);await this.fs.write(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||await this.fs.touch(this.path,this.inode),!1)}syncSync(){this.needsPreTruncate&&this.fs.touchSync(this.path,{size:this.truncatedTo}),this.truncatedTo=void 0;for(let e of this.dirtyRanges)for(let t=e.start;t<e.end;){let n=this.data.regionAt(t);if(!n)break;let r=Math.min(e.end,n.offset+n.data.byteLength);this.fs.writeSync(this.path,n.data.subarray(t-n.offset,r-n.offset),t),t=r}this.dirtyRanges=[],this.metadataDirty&&=(this.fs.attributes.has(`no_write`)||this.fs.touchSync(this.path,this.inode),!1)}},Lr=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},Rr=(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}),zr=class{fs;byIno=new Map;byPath=new Map;constructor(e){this.fs=e}get(e){return this.byPath.get(e)}ref(e,t){let n=this.byIno.get(t.ino);return n&&n.inode.nlink===n.paths.size&&!n.paths.has(e)&&R(`vcache.ref: vnode for ${this.fs.label||this.fs.uuid}:${t.ino} has an nlink of ${n.inode.nlink} but referenced by more paths [#314]`),n&&!n.paths.has(e)&&(t.ino===0||t.nlink<=1||n.inode.nlink<=1||(n.inode.mode^t.mode)&61440)&&(n=this.byPath.get(e),n&&(n.inode.mode^t.mode)&61440&&(n=void 0)),n?(n.paths.add(e),!n.dirty&&t!==n.inode&&Object.assign(n.inode,t)):(n=new Ir(this.fs,e,t),this.byIno.set(t.ino,n)),this.byPath.set(e,n),n.refs++,n}unref(e){e.refs--,!(e.refs>0||e.dirty)&&this.evict(e)}evict(e){this.byIno.delete(e.ino);for(let t of e.paths)this.byPath.delete(t)}rename(e,t){for(let[n,r]of this.byPath){if(n!=e&&!n.startsWith(e+`/`))continue;let i=t+n.slice(e.length);this.byPath.delete(n),this.byPath.set(i,r),r.paths.delete(n),r.paths.add(i)}}link(e,t){let n=this.byPath.get(e);n&&(n.paths.add(t),this.byPath.set(t,n))}remove(e){let t=this.byPath.get(e);t&&(this.byPath.delete(e),t.paths.delete(e),!t.paths.size&&!t.refs&&this.evict(t))}async sync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;Lr(t,await e.lock(`rw`),!1),await e.sync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{Rr(t)}}}syncSync(){for(let e of this.byIno.values()){let t={stack:[],error:void 0,hasError:!1};try{if(!e.dirty)continue;Lr(t,e.lockSync(`rw`),!1),e.syncSync(),e.refs||this.evict(e)}catch(e){t.error=e,t.hasError=!0}finally{Rr(t)}}}};const Br=new Map;function Z(e){let t=Br.get(e.uuid);return t||(t=new zr(e),Br.set(e.uuid,t)),t}async function Vr(e,t,n,r){let i=Z(e);r??=i.get(t)?.inode??await e.stat(t);let a=i.ref(t,r),o=await a.lock(n),s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}function Hr(e,t,n,r){let i=Z(e);r??=i.get(t)?.inode??e.statSync(t);let a=i.ref(t,r),o;try{o=a.lockSync(n)}catch(e){throw i.unref(a),e}let s=!1,c=()=>{s||(s=!0,o(),i.unref(a))};return c[Symbol.dispose]=c,c}var Ur=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},Wr=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},Gr=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},Kr=(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});const qr=4096;let Jr=(()=>{let e=[],t,n;return class{static{let r=typeof Symbol==`function`&&Symbol.metadata?Object.create(null):void 0;Wr(this,null,t,{kind:`getter`,name:`inode`,static:!1,private:!1,access:{has:e=>`inode`in e,get:e=>e.inode},metadata:r},null,e),Wr(this,null,n,{kind:`getter`,name:`fs`,static:!1,private:!1,access:{has:e=>`fs`in e,get:e=>e.fs},metadata:r},null,e),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}context=Ur(this,e);path;internalPath;flag;vnode;_position=0;get position(){return this.flag&1024?this.inode.size:this._position}set position(e){this._position=e}get inode(){return this.vnode.inode}get fs(){return this.vnode.fs}get dirty(){return this.vnode.dirty}closed=!1;refs=1;ref(){if(this.closed)throw M(`EBADF`,`dup`,this.path);return this.refs++,this}get isClosed(){return this.closed}constructor(e,t,n,r,i){this.context=e,this.path=t,this.internalPath=n,this.flag=r,this.vnode=i}get _isSync(){return!!(this.flag&1052672||this.inode.flags&Vn.Sync||this.fs.attributes.has(`sync`))}[(t=[b],n=[b],Symbol.dispose)](){this.closeSync()}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`sync`,this.path);if(!this.dirty)return;Gr(e,this.vnode.lockSync(`rw`),!1),this.vnode.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{Kr(e)}}datasyncSync(){return this.syncSync()}closeSync(){if(this.closed)throw M(`EBADF`,`close`,this.path);this.syncSync(),!(--this.refs>0)&&this.disposeSync(!0)}disposeSync(e){if(this.closed)throw M(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw M(`EBUSY`,`close`,this.path);this.closed=!0,Z(this.fs).unref(this.vnode)}truncateSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw M(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`truncate`,this.path);if(this.inode.flags&Vn.Immutable)throw M(`EPERM`,`truncate`,this.path);Gr(t,this.vnode.lockSync(`rw`),!1),this.vnode.truncate(e),this._isSync&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{Kr(t)}}writeSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);if(this.inode.flags&Vn.Immutable)throw M(`EPERM`,`write`,this.path);Gr(i,this.vnode.lockSync(`rw`),!1);let a=e.subarray(t,t+n);return this.vnode.writeSync(a,r),this._position=r+a.byteLength,this._isSync&&this.vnode.syncSync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Kr(i)}}readSync(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw M(`EBADF`,`read`,this.path);Gr(i,this.vnode.lockSync(`ro`),!1),!(this.inode.flags&Vn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!Kn(this.inode)&&!Gn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return this.vnode.readSync(o.subarray(t,t+n),r,a),this._isSync&&this.vnode.syncSync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{Kr(i)}}chmodSync(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`chmod`,this.path);Gr(t,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Qe)|e,(this._isSync||e>61440)&&this.vnode.syncSync()}catch(e){t.error=e,t.hasError=!0}finally{Kr(t)}}chownSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`chmod`,this.path);Gr(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,Jn(this.inode,e,t),this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{Kr(n)}}utimesSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`utimes`,this.path);Gr(n,this.vnode.lockSync(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&this.vnode.syncSync()}catch(e){n.error=e,n.hasError=!0}finally{Kr(n)}}async[Symbol.asyncDispose](){await this.close()}async sync(){let e={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`sync`,this.path);if(!this.dirty)return;Gr(e,await this.vnode.lock(`rw`),!1),await this.vnode.sync()}catch(t){e.error=t,e.hasError=!0}finally{Kr(e)}}datasync(){return this.sync()}async close(){if(this.closed)throw M(`EBADF`,`close`,this.path);await this.sync(),!(--this.refs>0)&&this.dispose(!0)}dispose(e){if(this.closed)throw M(`EBADF`,`close`,this.path);if(this.dirty&&!e)throw M(`EBUSY`,`close`,this.path);this.closed=!0,Z(this.fs).unref(this.vnode)}stat(){if(this.closed)throw M(`EBADF`,`stat`,this.path);return this.inode}async truncate(e){let t={stack:[],error:void 0,hasError:!1};try{if(e<0)throw M(`EINVAL`,`truncate`,this.path);if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`truncate`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`truncate`,this.path);if(this.inode.flags&Vn.Immutable)throw M(`EPERM`,`truncate`,this.path);Gr(t,await this.vnode.lock(`rw`),!1),this.vnode.truncate(e),this._isSync&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{Kr(t)}}async write(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||!(this.flag&1||this.flag&2))throw M(`EBADF`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);if(this.inode.flags&Vn.Immutable)throw M(`EPERM`,`write`,this.path);Gr(i,await this.vnode.lock(`rw`),!1);let a=e.subarray(t,t+n);return await this.vnode.write(a,r),this._position=r+a.byteLength,this._isSync&&await this.vnode.sync(),a.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Kr(i)}}async read(e,t=0,n=e.byteLength-t,r=this.position){let i={stack:[],error:void 0,hasError:!1};try{if(this.closed||this.flag&1)throw M(`EBADF`,`read`,this.path);Gr(i,await this.vnode.lock(`ro`),!1),!(this.inode.flags&Vn.NoAtime)&&!this.fs.attributes.has(`no_atime`)&&(this.vnode.metadataDirty=!0,this.inode.atimeMs=Date.now());let a=r+n;!Kn(this.inode)&&!Gn(this.inode)&&a>this.inode.size&&(a=r+Math.max(this.inode.size-r,0)),this._position=a;let o=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);return await this.vnode.read(o.subarray(t,t+n),r,a),this._isSync&&await this.vnode.sync(),a-r}catch(e){i.error=e,i.hasError=!0}finally{Kr(i)}}async chmod(e){let t={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`chmod`,this.path);Gr(t,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.mode=this.inode.mode&(e>61440?-61441:Qe)|e,(this._isSync||e>61440)&&await this.vnode.sync()}catch(e){t.error=e,t.hasError=!0}finally{Kr(t)}}async chown(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`chown`,this.path);Gr(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,Jn(this.inode,e,t),this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{Kr(n)}}async utimes(e,t){let n={stack:[],error:void 0,hasError:!1};try{if(this.closed)throw M(`EBADF`,`utimes`,this.path);Gr(n,await this.vnode.lock(`rw`),!1),this.vnode.metadataDirty=!0,this.inode.atimeMs=e,this.inode.mtimeMs=t,this._isSync&&await this.vnode.sync()}catch(e){n.error=e,n.hasError=!0}finally{Kr(n)}}streamRead(e){if(this.closed)throw M(`EBADF`,`streamRead`,this.path);let{vnode:t}=this;return new ReadableStream({async start(n){let r={stack:[],error:void 0,hasError:!1};try{Gr(r,await t.lock(`ro`),!1);let{start:i=0,end:a=t.inode.size}=e;for(let e=i;e<a;e+=qr){let r=e+qr>a?a-e:qr,i=new Uint8Array(r);await t.read(i,e,e+r).catch(n.error.bind(n)),n.enqueue(i)}n.close()}catch(e){r.error=e,r.hasError=!0}finally{Kr(r)}},type:`bytes`})}streamWrite(e){if(this.closed)throw M(`EBADF`,`write`,this.path);if(this.inode.flags&Vn.Immutable)throw M(`EPERM`,`write`,this.path);if(this.fs.attributes.has(`readonly`))throw M(`EROFS`,`write`,this.path);let{vnode:t}=this,n=e.start??0;return new WritableStream({async write(e,r){let i={stack:[],error:void 0,hasError:!1};try{Gr(i,await t.lock(`rw`),!1),await t.write(e,n).catch(r.error.bind(r)),n+=e.byteLength}catch(e){i.error=e,i.hasError=!0}finally{Kr(i)}},async close(){let e={stack:[],error:void 0,hasError:!1};try{Gr(e,await t.lock(`rw`),!1),await t.sync()}catch(t){e.error=t,e.hasError=!0}finally{Kr(e)}}})}}})();function Yr(e,t=e.context){let n=ze(t).descriptors,r=0;for(;n.has(r);)r++;return n.set(r,e),r}function Xr(e,t){cn(t);let n=ze(e).descriptors.get(t);if(!n)throw N(`EBADF`);return n}function Zr(e,t){return ze(e).descriptors.delete(t)}function Qr(e,t){return Yr(Xr(e,t).ref(),e)}const $r=/[rwasx]{1,2}\+?/;function ei(e){if(typeof e==`number`)return e;if(!$r.test(e))throw N(`EINVAL`,`Invalid flag string: `+e);return ti(e)}function ti(e){if(!e.includes(`r`)&&!e.includes(`w`)&&!e.includes(`a`))throw N(`EINVAL`,`Invalid flag string: `+e);let t=e.includes(`r`)?0:64;return e.includes(`w`)&&(t|=512),e.includes(`a`)&&(t|=Ue),e.includes(`+`)?t|=2:e.includes(`r`)||(t|=1),e.includes(`s`)&&(t|=qe),e.includes(`x`)&&(t|=128),t}function ni(e){let t=0;return e&1||(t|=4),(e&1||e&2)&&(t|=2),t}const ri=j;function ii(e,t){return e.path=t,e}function ai(e,t,n,r){let i=typeof n==`string`?{path:n,dest:r,syscall:t.endsWith(`Sync`)?t.slice(0,-4):t}:n,a=e[t];if(typeof a!=`function`)throw TypeError(`${t} is not a function`);return function(...t){try{return a.call(e,...t)}catch(e){throw A(Object.assign(e,i))}}}function oi(e,t){return new Proxy(e,{get(e,n){let r=Reflect.get(e,n);return typeof r==`function`?function n(...i){try{let a=r.apply(e,i);return a instanceof Promise?a.catch(e=>{if(`code`in e)throw A(Object.assign(e,t));if(e in O){let r=M(e,t);Error.captureStackTrace(r,n)}throw e}):a}catch(e){throw A(Object.assign(e,t))}}:r}})}const si=Re.mounts;ci(`/`,vr.create({label:`root`}));function ci(e,t){let n=ze(this);if(e[0]!=`/`&&(e=`/`+e),e=bn.call(n,e),n.mounts.has(e))throw R(N(`EINVAL`,`Mount point is already in use: `+e));t._mountPoint=e,n.mounts.set(e,t),Br.has(t.uuid)||Br.set(t.uuid,new zr(t)),fe(`Mounted ${t.name} on ${e}`),pe(`${t.name} attributes: ${[...t.attributes].map(([e,t])=>t==null?e:e+`=`+t).join(`, `)}`)}function li(e){let t=ze(this);e[0]!=`/`&&(e=`/`+e),e=bn.call(this,e);let n=t.mounts.get(e);if(!n){z(e+` is already unmounted`);return}let r=()=>{Br.delete(n.uuid),fe(`Synced all changes to `+e)};try{Br.get(n.uuid)?.syncSync(),r()}catch{z(`Could not flush to ${e} synchronously.`),Br.get(n.uuid)?.sync().then(r)}t.mounts.delete(e),de(`Unmounted `+e)}function ui(e,t,n){let{root:r,mounts:i}=ze(t),a={path:e,...n};e=H(U(r,e),!0),e=bn.call(t,e);let o=[...i].sort((e,t)=>e[0].length>t[0].length?-1:1);for(let[t,n]of o){if(!pi(t,e))continue;e=e.slice(t.length>1?t.length:0),e===``&&(e=`/`);let i=n.attributes.get(`case_fold`);return i===`lower`&&(e=e.toLowerCase()),i===`upper`&&(e=e.toUpperCase()),{fs:oi(n,a),path:e,mountPoint:t,root:r}}throw le(new j(O.EIO,`No file system for `+e))}function di(e,t){let n=e.usage(),r=n.blockSize||4096,i=t?BigInt:Number;return{type:i(e.type),bsize:i(r),frsize:i(r),ffree:i(n.freeNodes||4294967295),files:i(n.totalNodes||4294967295),bavail:i(n.freeSpace/r),bfree:i(n.freeSpace/r),blocks:i(n.totalSpace/r)}}function fi(e){let t=ze(this);if(!Pe(t.credentials))throw N(`EPERM`,`Can not chroot() as non-root user`);t.root??=`/`;let n=U(t.root,e);for(let e of t.descriptors?.values()??[]){if(!e.path.startsWith(t.root))throw M(`EBUSY`,`chroot`,e.path);e.path=e.path.slice(t.root.length)}if(n.length<t.root.length)throw N(`EPERM`,`Can not chroot() outside of current root`);t.root=n}function pi(e,t){return e===`/`||e===t||(e.endsWith(`/`)||(e+=`/`),t.startsWith(e))}var mi=t({link:()=>Ci,mkdir:()=>bi,open:()=>vi,readdir:()=>xi,readlink:()=>yi,rename:()=>Si,resolve:()=>_i,stat:()=>wi}),hi=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},gi=(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});function _i(e,t,n,r){t=bn.call(e,t);try{let i=ui(t,e),a=Z(i.fs).get(i.path)?.inode??i.fs.statSync(i.path);return!Un(a)||n?{...i,fullPath:t,stats:a}:_i(e,bn.call(e,W(t),yi.call(e,t)),n,r)}catch(e){if(A(Object.assign(e,{syscall:`stat`,path:t,...r})),n)throw e}let{base:i,dir:a}=Dn(t),o=a==`/`?`/`:_i(e,a,!1,r).fullPath,s=U(o,i),c=ui(s,e),l;try{l=Z(c.fs).get(c.path)?.inode??c.fs.statSync(c.path)}catch(e){if(e.code===`ENOENT`)return{...c,fullPath:s};throw A(Object.assign(e,{syscall:`stat`,path:s,...r}))}return Un(l)?_i(e,bn.call(e,o,yi.call(e,s)),!1,r):{...c,fullPath:s,stats:l}}function vi(e,t,n){t=H.call(e,t);let r=on(n.mode,420),i=ei(n.flag);t=n.preserveSymlinks?t:_i(e,t).fullPath;let{fs:a,path:o}=ui(t,e),s;try{s=a.statSync(o)}catch{}if(!s){let s={stack:[],error:void 0,hasError:!1};try{if(!(i&64))throw M(`ENOENT`,`open`,t);let c=W(o),l=a.statSync(c);if(X&&!J(e,l,2))throw M(`EACCES`,`open`,t);if(!q(l))throw M(`ENOTDIR`,`open`,t);if(!n.allowDirectory&&q({mode:r}))throw M(`EISDIR`,`open`,t);hi(s,Hr(a,c,`rw`,l),!1);let{euid:u,egid:d}=ze(e).credentials,f=a.createFileSync(o,{mode:r,uid:l.mode&2048?l.uid:u,gid:l.mode&1024?l.gid:d});return Oa(e,`rename`,t),new Jr(e,t,o,i,Z(a).ref(o,f))}catch(e){s.error=e,s.hasError=!0}finally{gi(s)}}if(X&&(!J(e,s,r)||!J(e,s,ni(i))))throw M(`EACCES`,`open`,t);if(i&128)throw M(`EEXIST`,`open`,t);if(!n.allowDirectory&&q(s))throw M(`EISDIR`,`open`,t);let c=new Jr(e,t,o,i,Z(a).ref(o,s));return i&512&&c.truncateSync(0),c}function yi(e){e=H.call(this,e);let{fs:t,stats:n,path:r}=_i(this,e,!0,{syscall:`readlink`});if(!n)throw M(`ENOENT`,`readlink`,e);if(X&&!J(this,n,4))throw M(`EACCES`,`readlink`,e);if(!Un(n))throw M(`EINVAL`,`readlink`,e);let i=n.size,a=new Uint8Array(i);return t.readSync(r,a,0,i),te(a)}function bi(e,t={}){let n=H.call(this,e),r={syscall:`mkdir`,path:n},{fullPath:i}=_i(this,W(n),!1,r),{fs:a,path:o}=ui(U(i,wn(n)),this,r),s=i!=W(n),{euid:c,egid:l}=ze(this).credentials,{mode:u=511,recursive:d}=t,f,p=(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let i=W(t),m=d&&i!=`/`?p(W(e),i):a.statSync(i);if(d){let n;try{n=Z(a).get(t)?.inode??a.statSync(t)}catch{}if(n){let i=Un(n)?_i(this,e,!1,r).stats:n;if(!i)throw M(`ENOENT`,r);if(!q(i))throw M(t==o?`EEXIST`:`ENOTDIR`,r);return n}if(s&&a.existsSync(U(i,wn(e))))throw M(`ENOENT`,r)}if(X&&!J(this,m,2))throw M(`EACCES`,`mkdir`,e);hi(n,Hr(a,i,`rw`,m),!1);let h=ai(a,`mkdirSync`,{path:e,syscall:`mkdir`})(t,{mode:u,uid:m.mode&2048?m.uid:c,gid:m.mode&1024?m.gid:l});return d&&(f??=e),Oa(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{gi(n)}};return p(n,o),f}function xi(e,t={}){e=H.call(this,e);let{fs:n,path:r}=_i(this,e),i=Z(n).get(r)?.inode??ai(n,`statSync`,{path:e,syscall:`scandir`})(r);if(X&&!J(this,i,4))throw M(`EACCES`,`scandir`,e);if(!q(i))throw M(`ENOTDIR`,`scandir`,e);let a;{let e={stack:[],error:void 0,hasError:!1};try{hi(e,Hr(n,r,`ro`,i),!1),a=n.readdirSync(r)}catch(t){e.error=t,e.hasError=!0}finally{gi(e)}}let o=[],s=e=>{let i;try{i=n.statSync(U(r,e))}catch(e){if(e.code==`ENOENT`)return;throw e}let a=new jr;if(a.ino=i.ino,a.type=kr(i.mode),a.path=e,a.name=wn(e),o.push(a),!q(i)||!t?.recursive)return;let c=n.readdirSync(U(r,e));for(let t of c)s(U(e,t))};for(let e of a)s(e);return o}function Si(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H.call(this,e),t=H.call(this,t);let r={syscall:`rename`,path:e,dest:t},i=_i(this,e,!0,r),a=ui(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw M(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw M(`EINVAL`,r);if(!i.stats)throw M(`ENOENT`,r);let o=i.fs,s=o.statSync(W(i.path)),c=o.statSync(W(a.path)),l;try{l=o.statSync(a.path)}catch(e){if(e.code!=`ENOENT`)throw e}if(X&&(!J(this,s,4)||!J(this,c,2)))throw M(`EACCES`,r);if(l&&!q(i.stats)&&q(l))throw M(`EISDIR`,r);if(l&&q(i.stats)&&!q(l))throw M(`ENOTDIR`,r);let u=W(i.path),d=W(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),hi(n,Hr(o,f[0][0],`rw`,f[0][1]),!1),hi(n,s.ino==c.ino?null:Hr(o,f[1][0],`rw`,f[1][1]),!1),i.fs.renameSync(i.path,a.path),Z(o).rename(i.path,a.path),Oa(this,`rename`,e),Oa(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{gi(n)}}function Ci(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H.call(this,e),t=H.call(this,t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=ui(e,this,r),o=ui(t,this,r);if(i.uuid!==o.fs.uuid)throw M(`EXDEV`,r);let s=i.statSync(a);if(X){if(!J(this,s,4))throw M(`EACCES`,r);let e=i.statSync(W(a));if(!J(this,e,4))throw M(`EACCES`,r);let t=i.statSync(W(o.path));if(!J(this,t,2))throw M(`EACCES`,r)}hi(n,Hr(i,W(o.path),`rw`),!1),i.linkSync(a,o.path),Z(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{gi(n)}}function wi(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=_i(this,e,!1,n).stats;else{let{base:t,dir:i}=Dn(e),{fs:a,path:o}=_i(this,i,!1,n);try{let e=t?U(o,t):o;r=Z(a).get(e)?.inode??a.statSync(e)}catch(e){throw A(Object.assign(e,n)),e}}if(!r)throw M(`ENOENT`,n);if(X&&!J(this,r,4))throw M(`EACCES`,n);return r}var Ti=class e{ino;type;_name;get name(){let e=Y.Buffer.from(this._name);return this._encoding==`buffer`?e:e.toString(this._encoding)}_encoding;_parentPath;get parentPath(){return this._parentPath}get path(){return z(`Dirent.path was removed in Node v24, use parentPath instead`),this._parentPath}static from(t,n,r=`.`){let i=new e,{base:a,dir:o}=Dn(t.path);return i._parentPath=U(r,o),i._name=a,i.ino=t.ino,i.type=t.type,i._encoding=n,i}isFile(){return this.type===Or.REG}isDirectory(){return this.type===Or.DIR}isBlockDevice(){return this.type===Or.BLK}isCharacterDevice(){return this.type===Or.CHR}isSymbolicLink(){return this.type===Or.LNK}isFIFO(){return this.type===Or.FIFO}isSocket(){return this.type===Or.SOCK}};function Ei(){return Object.assign(Error(`Directory handle was closed`),{code:`ERR_DIR_CLOSED`})}var Di=class{path;context;closed=!1;checkClosed(){if(this.closed)throw Ei()}_entries;constructor(e,t){this.path=e,this.context=t}close(e){if(this.closed){let t=Ei();if(!e)return Promise.reject(t);e(t);return}if(this.closed=!0,!e)return Promise.resolve();e(null)}closeSync(){if(this.closed)throw Ei();this.closed=!0}async _read(){return this.checkClosed(),this._entries??=await zo.call(this.context,this.path,{withFileTypes:!0}),this._entries.length?this._entries.shift()??null:null}read(e){if(!e)return this._read();this._read().then(t=>e(null,t))}readSync(){return this.checkClosed(),this._entries??=$i.call(this.context,this.path,{withFileTypes:!0}),this._entries.length?this._entries.shift()??null:null}async next(){let e=await this._read();return e?{done:!1,value:e}:(await this.close(),{done:!0,value:void 0})}[Symbol.asyncIterator](){return this}[Symbol.dispose](){this.closed||this.closeSync()}async[Symbol.asyncDispose](){this.closed||await this.close()}},Oi=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},ki=(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});function Ai(e,t){return Si.call(this,e,t)}function ji(e){e=H.call(this,e);try{let{fs:t,path:n}=_i(this,e);return t.existsSync(n)}catch(e){if(e.errno==O.ENOENT)return!1;throw e}}function Mi(e,t){let n;try{n=wi.call(this,e,!1)}catch(e){if(t?.throwIfNoEntry===!1&&ln(e))return;throw e}return t?.bigint?new Mn(n):new jn(n)}function Ni(e,t){let n;try{n=wi.call(this,e,!0)}catch(e){if(t?.throwIfNoEntry===!1&&ln(e))return;throw e}return t?.bigint?new Mn(n):new jn(n)}function Pi(e,t=0){let n={stack:[],error:void 0,hasError:!1};try{let r=Oi(n,vi(this,e,{flag:`r+`}),!1);if(t||=0,t<0)throw M(`EINVAL`,`truncate`,e.toString());r.truncateSync(t)}catch(e){n.error=e,n.hasError=!0}finally{ki(n)}}function Fi(e){e=H.call(this,e);let{fs:t,path:n}=ui(e,this);try{let e={stack:[],error:void 0,hasError:!1};try{if(X&&!J(this,t.statSync(n),2))throw M(`EACCES`,`unlink`);Oi(e,Hr(t,W(n),`rw`),!1),t.unlinkSync(n),Z(t).remove(n)}catch(t){e.error=t,e.hasError=!0}finally{ki(e)}}catch(t){throw A(Object.assign(t,{syscall:`unlink`,path:e}))}Oa(this,`rename`,e.toString())}function Ii(e,t,n=0){return Yr(vi(this,e,{flag:t,mode:n}))}function Li(e,t,n){return Yr(vi(this,e,{flag:t,mode:n,preserveSymlinks:!0}))}function Ri(e,t={}){let n={stack:[],error:void 0,hasError:!1};try{let r=dn(t,null,`r`,420);if(ei(r.flag)&1)throw M(`EBADF`,`read`,e.toString());let i=Oi(n,typeof e==`number`?Xr(this,e):vi(this,e.toString(),{flag:r.flag,mode:420,preserveSymlinks:!1}),!1),{size:a}=i.stat(),o=Y.Buffer.alloc(a);return i.readSync(o,0,a,0),r.encoding?o.toString(r.encoding):o}catch(e){n.error=e,n.hasError=!0}finally{ki(n)}}function zi(e,t,n={}){let r={stack:[],error:void 0,hasError:!1};try{let i=dn(n,`utf8`,`w+`,420),a=ei(i.flag);if(!(a&1||a&2))throw new j(O.EINVAL,`Flag passed to writeFile must allow for writing`);if(typeof t!=`string`&&!i.encoding)throw new j(O.EINVAL,`Encoding not specified`);let o=typeof t==`string`?Y.Buffer.from(t,i.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);if(!o)throw new j(O.EINVAL,`Data not specified`);Oi(r,typeof e==`number`?Xr(this,e):vi(this,e.toString(),{flag:a,mode:i.mode}),!1).writeSync(o,0,o.byteLength,0),Oa(this,`change`,e.toString())}catch(e){r.error=e,r.hasError=!0}finally{ki(r)}}function Bi(e,t,n={}){let r=dn(n,`utf8`,`a+`,420),i=ei(r.flag);if(!(i&1024))throw new j(O.EINVAL,`Flag passed to appendFile must allow for appending`);if(typeof t!=`string`&&!r.encoding)throw new j(O.EINVAL,`Encoding not specified`);let a=typeof t==`string`?Y.Buffer.from(t,r.encoding):new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=typeof e==`number`?Xr(this,e):vi(this,H.call(this,e),{flag:i,mode:r.mode});o.writeSync(a,0,a.byteLength),typeof o!=`number`&&o.closeSync()}function Vi(e,t){let n=Xr(this,e).stat();return t?.bigint?new Mn(n):new jn(n)}function Hi(e){Xr(this,e).closeSync(),Zr(this,e)}function Ui(e,t=0){if(t||=0,t<0)throw new j(O.EINVAL);Xr(this,e).truncateSync(t)}function Wi(e){Xr(this,e).syncSync()}function Gi(e){Xr(this,e).datasyncSync()}function Ki(e,t,n,r,i){let a,o,s,c;if(typeof t==`string`){c=typeof n==`number`?n:null;let e=typeof r==`string`?r:`utf8`;o=0,a=Y.Buffer.from(t,e),s=a.byteLength}else a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),o=n,s=r,c=typeof i==`number`?i:null;let l=Xr(this,e);c??=l.position;let u=l.writeSync(a,o,s,c);return Oa(this,`change`,l.path),u}function qi(e,t,n,r,i){let a=Xr(this,e),o=typeof n==`object`?n.offset:n;if(typeof n==`object`&&(r=n.length,i=n.position),i&&i>2**53-1)throw M(`EINVAL`);return typeof i==`bigint`&&(i=Number(i)),i=Number.isSafeInteger(i)?i:a.position,a.readSync(t,o,r,i)}function Ji(e,t,n){Xr(this,e).chownSync(t,n)}function Yi(e,t){let n=on(t,-1);if(n<0)throw new j(O.EINVAL,`Invalid mode.`);Xr(this,e).chmodSync(n)}function Xi(e,t,n){Xr(this,e).utimesSync(un(t),un(n))}function Zi(e){let t={stack:[],error:void 0,hasError:!1};try{e=H.call(this,e);let{fs:n,path:r}=_i(this,e),i=ai(n,`statSync`,{path:e,syscall:`rmdir`})(r);if(!q(i))throw M(`ENOTDIR`,`rmdir`,e);if(X&&!J(this,i,2))throw M(`EACCES`,`rmdir`,e);Oi(t,Hr(n,W(r),`rw`),!1),ai(n,`rmdirSync`,e)(r),Z(n).remove(r),Oa(this,`rename`,e.toString())}catch(e){t.error=e,t.hasError=!0}finally{ki(t)}}function Qi(e,t){t=typeof t==`object`?t:{mode:t};let n=on(t?.mode,511);return bi.call(this,e,{...t,mode:n})}function $i(e,t){t=typeof t==`object`?t:{encoding:t},e=H.call(this,e);let n=[],r=xi.call(this,e,t??void 0);for(let i of r)t?.withFileTypes?n.push(Ti.from(i,t.encoding,e)):t?.encoding==`buffer`?n.push(Y.Buffer.from(i.path)):n.push(i.path);return n}function ea(e,t){return Ci.call(this,e,t)}function ta(e,t,n=`file`){let r={stack:[],error:void 0,hasError:!1};try{if(![`file`,`dir`,`junction`].includes(n))throw TypeError(`Invalid symlink type: `+n);t=H.call(this,t);let i=Oi(r,vi(this,t,{flag:`wx`,mode:420}),!1);i.writeSync(T(H.call(this,e,!0))),i.chmodSync(et)}catch(e){r.error=e,r.hasError=!0}finally{ki(r)}}function na(e,t){let n=Y.Buffer.from(yi.call(this,e)),r=typeof t==`object`?t?.encoding:t;return r==`buffer`?n:n.toString(r??`utf-8`)}function ra(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{Oi(r,vi(this,e,{flag:`r+`,mode:0}),!1).chownSync(t,n)}catch(e){r.error=e,r.hasError=!0}finally{ki(r)}}function ia(e,t,n){let r=Li.call(this,e,`r+`);Ji.call(this,r,t,n),Hi.call(this,r)}function aa(e,t){let n;try{n=Ii.call(this,e,`r+`)}catch(t){throw A(Object.assign(t,{syscall:`chmod`,path:H.call(this,e)}))}Yi.call(this,n,t),Hi.call(this,n)}function oa(e,t){let n=Li.call(this,e,`r+`);Yi.call(this,n,t),Hi.call(this,n)}function sa(e,t,n){let r=Ii.call(this,e,`r+`);Xi.call(this,r,t,n),Hi.call(this,r)}function ca(e,t,n){let r=Li.call(this,e,`r+`);Xi.call(this,r,t,n),Hi.call(this,r)}function la(e,t){let n=typeof t==`string`?t:t?.encoding??`utf8`;e=H.call(this,e,!0);let{fullPath:r}=_i(this,e);if(n==`utf8`||n==`utf-8`)return r;let i=Y.Buffer.from(r,`utf-8`);return n==`buffer`?i:i.toString(n)}function ua(e,t=384){if(X&&!J(this,Mi.call(this,e),t))throw new j(O.EACCES)}function da(e,t){e=H.call(this,e);let n;try{n=Ni.bind(this)(e)}catch(e){if(e.code!=`ENOENT`||!t?.force)throw e}if(n)switch(n.mode&Qe){case rt:if(t?.recursive)for(let n of $i.call(this,e))da.call(this,U(e,n),t);Zi.call(this,e);break;case tt:case et:case nt:case it:Fi.call(this,e);break;case at:case $e:default:throw M(`ENOSYS`,`rm`,e)}}function fa(e,t){let n=typeof t==`object`?t?.encoding:t||`utf8`,r=mn(e);return Qi.call(this,r),n==`buffer`?Y.Buffer.from(r):r}function pa(e,t){let n=mn(e);Qi.call(this,n);let r=()=>da(n,{recursive:!0,force:!0});return{path:n,remove:r,[Symbol.dispose]:r}}function ma(e,t,n){if(e=H.call(this,e),t=H.call(this,t),n&&n&1&&ji.call(this,t))throw M(`EEXIST`,`copyFile`,t);zi.call(this,t,Ri.call(this,e)),Oa(this,`rename`,t.toString())}function ha(e,t,n){let r=Xr(this,e),i=0;for(let e of t)i+=r.readSync(e,0,e.byteLength,n+i);return i}function ga(e,t,n){let r=Xr(this,e),i=0;for(let e of t)i+=r.writeSync(new Uint8Array(e.buffer),0,e.byteLength,n+i);return i}function _a(e,t){return e=H.call(this,e),new Di(e,this)}function va(e,t,n){e=H.call(this,e),t=H.call(this,t);let r=Ni.call(this,e);if(n?.errorOnExist&&ji.call(this,t))throw M(`EEXIST`,`cp`,t);switch(r.mode&Qe){case rt:if(!n?.recursive)throw M(`EISDIR`,`cp`,e);Qi.call(this,t,{recursive:!0});for(let r of $i.call(this,e,{withFileTypes:!0}))n.filter&&!n.filter(U(e,r.name),U(t,r.name))||va.call(this,U(e,r.name),U(t,r.name),n);break;case et:if(n?.dereference)ma.call(this,e,t);else{let r=na.call(this,e,`utf8`);ta.call(this,n?.verbatimSymlinks?r:bn.call(this,W(e),r),t)}break;case tt:ma.call(this,e,t);break;case nt:case it:case at:case $e:default:throw M(`ENOSYS`,`cp`,e)}n?.preserveTimestamps&&sa.call(this,t,r.atime,r.mtime)}function ya(e,t){e=H.call(this,e);let{fs:n}=ui(e,this);return di(n,t?.bigint)}function ba(e,t={}){e=Array.isArray(e)?e:[e];let n=ze(this),{cwd:r=n.pwd,withFileTypes:i=!1,exclude:a=()=>!1,followSymlinks:o=!1}=t,s=bn.call(n,r instanceof URL?r.pathname:r),c=e.map(e=>e.startsWith(`/`)?Cn.call(n,s,e):e),l=c.some(e=>e.includes(`**`)),u=c.map(e=>{let t=e.search(/[*?[\]{]/);if(t===-1)return e;let n=e.lastIndexOf(`/`,t);return n===-1?``:e.slice(0,n)}),d=c.map(fn);function f(e,t){let r=u.some(e=>t===e||e.startsWith(t+`/`)),i=l||r,a=Ni.call(n,e);return a.isSymbolicLink()?i&&(o||r)&&!!Mi.call(n,e,{throwIfNoEntry:!1})?.isDirectory():i&&a.isDirectory()}let p=[];function m(e){let t=$i.call(n,e,{withFileTypes:i,encoding:`utf8`});for(let r of t){let t=U(e,i?r.name:r),o=Cn.call(n,s,t);(typeof a==`function`?a(i?r:o):a.some(e=>On(e,o)))||(f(t,o)&&m(t),d.some(e=>e.test(o))&&p.push(i?r:o))}}return m(s),p}const xa=Mi;var Sa=class extends u.default{_context;path;off(e,t,n,r){return super.off(e,t,n,r)}removeListener(e,t,n,r){return super.removeListener(e,t,n,r)}constructor(e,t){super(),this._context=e,this.path=t}setMaxListeners(){throw M(`ENOSYS`,`Watcher.setMaxListeners`)}getMaxListeners(){throw M(`ENOSYS`,`Watcher.getMaxListeners`)}prependListener(){throw M(`ENOSYS`,`Watcher.prependListener`)}prependOnceListener(){throw M(`ENOSYS`,`Watcher.prependOnceListener`)}rawListeners(){throw M(`ENOSYS`,`Watcher.rawListeners`)}ref(){return this}unref(){return this}},Ca=class extends Sa{options;realpath;constructor(e,t,n){let r=ze(e);super(r,t),this.options=n,this.realpath=U(r.root,t),Ea(this.realpath,this)}close(){super.emit(`close`),Da(this.realpath,this)}[Symbol.dispose](){this.close()}},wa=class extends Sa{options;intervalId;previous;constructor(e,t,n){super(e,t),this.options=n,this.start()}onInterval(){try{let e=xa.call(this._context,this.path);Nn(this.previous,e)||(this.emit(`change`,e,this.previous),this.previous=e)}catch(e){this.emit(`error`,e)}}start(){let e=this.options.interval||5e3;try{this.previous=xa.call(this._context,this.path)}catch(e){this.emit(`error`,e);return}this.intervalId=setInterval(this.onInterval.bind(this),e),!this.options.persistent&&typeof this.intervalId==`object`&&this.intervalId.unref()}stop(){this.intervalId&&=(clearInterval(this.intervalId),void 0),this.removeAllListeners()}};const Ta=new Map;function Ea(e,t){let n=H(e);Ta.has(n)||Ta.set(n,new Set),Ta.get(n).add(t)}function Da(e,t){let n=H(e);Ta.has(n)&&(Ta.get(n).delete(t),Ta.get(n).size===0&&Ta.delete(n))}function Oa(e,t,n){let r=ze(e);r&&(n=U(r.root??`/`,n)),n=H.call(e,n);for(let e=n;;e=W(e)){let r=Ta.get(e);if(r)for(let i of r)i.emit(`change`,t,Cn.call(i._context,e,n)||wn(n));if(e===`/`)break}}var ka=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},Aa=(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});async function ja(e,t,n,r){if(t=bn.call(e,t),n){let n=ui(t,e,r),i=Z(n.fs).get(n.path)?.inode??await n.fs.stat(n.path).catch(()=>void 0);return{...n,fullPath:t,stats:i}}try{let i=ui(t,e),a=Z(i.fs).get(i.path)?.inode??await i.fs.stat(i.path);return Un(a)?await ja(e,bn.call(e,W(t),await Na.call(e,t)),n,r):{...i,fullPath:t,stats:a}}catch{}let{base:i,dir:a}=Dn(t),o=a==`/`?`/`:(await ja(e,a,!1,r)).fullPath,s=U(o,i),c=ui(s,e),l=Z(c.fs).get(c.path)?.inode??await c.fs.stat(c.path).catch(e=>{if(e.code!=`ENOENT`)throw A(Object.assign(e,{syscall:`stat`,path:s,...r}))});return l?Un(l)?await ja(e,bn.call(e,o,await Na.call(e,s)),!1,r):{...c,fullPath:s,stats:l}:{...c,fullPath:s}}async function Ma(e,t,n){t=H.call(e,t);let r=on(n.mode,420),i=ei(n.flag),a={syscall:`open`,path:t},{fs:o,path:s,stats:c}=await ja(e,t,n.preserveSymlinks,a);if(!c){let l={stack:[],error:void 0,hasError:!1};try{if(!(i&64))throw M(`ENOENT`,a);let u=W(s),d=await o.stat(u);if(X&&!J(e,d,2))throw M(`EACCES`,`open`,W(t));if(!q(d))throw M(`ENOTDIR`,`open`,W(t));if(!n.allowDirectory&&q({mode:r}))throw M(`EISDIR`,`open`,t);if(ka(l,await Vr(o,u,`rw`,d),!1),c=Z(o).get(s)?.inode??await o.stat(s).catch(()=>void 0),!c){let{euid:n,egid:a}=ze(e).credentials,c=await o.createFile(s,{mode:r,uid:d.mode&2048?d.uid:n,gid:d.mode&1024?d.gid:a});return Oa(e,`rename`,t),new Jr(e,t,s,i,Z(o).ref(s,c))}}catch(e){l.error=e,l.hasError=!0}finally{Aa(l)}}if(X&&!J(e,c,ni(i)))throw M(`EACCES`,a);if(i&128)throw M(`EEXIST`,a);if(!n.allowDirectory&&q({mode:r}))throw M(`EISDIR`,`open`,t);let l=new Jr(e,t,s,i,Z(o).ref(s,c));return i&512&&await l.truncate(0),l}async function Na(e){e=H.call(this,e);let t={syscall:`readlink`,path:e},{fs:n,stats:r,path:i}=await ja(this,e,!0,t);if(!r)throw M(`ENOENT`,t);if(X&&!J(this,r,4))throw M(`EACCES`,t);if(!Un(r))throw M(`EINVAL`,t);let a=r.size,o=new Uint8Array(a);return await n.read(i,o,0,a),te(o)}async function Pa(e,t={}){let n=H.call(this,e),{euid:r,egid:i}=ze(this).credentials,{mode:a=511,recursive:o}=t,s={syscall:`mkdir`,path:n},{fullPath:c}=await ja(this,W(n),!1,s),{fs:l,path:u}=ui(U(c,wn(n)),this,s),d=c!=W(n),f,p=async(e,t)=>{let n={stack:[],error:void 0,hasError:!1};try{let c=W(t),m=o&&c!=`/`?await p(W(e),c):await l.stat(c);if(ka(n,await Vr(l,c,`rw`,m),!1),o){let n=Z(l).get(t)?.inode??await l.stat(t).catch(()=>null);if(n){let r=Un(n)?(await ja(this,e,!1,s)).stats:n;if(!r)throw M(`ENOENT`,s);if(!q(r))throw M(t==u?`EEXIST`:`ENOTDIR`,s);return n}if(d&&await l.exists(U(c,wn(e))))throw M(`ENOTDIR`,`mkdir`,e)}if(X&&!J(this,m,2))throw M(`EACCES`,`mkdir`,e);let h=await l.mkdir(t,{mode:a,uid:m.mode&2048?m.uid:r,gid:m.mode&1024?m.gid:i}).catch(P({syscall:`mkdir`,path:e}));return o&&(f??=e),Oa(this,`rename`,e),h}catch(e){n.error=e,n.hasError=!0}finally{Aa(n)}};return await p(n,u),f}async function Fa(e,t={}){e=H.call(this,e);let n={syscall:`scandir`,path:e},{fs:r,path:i,stats:a}=await ja(this,e,!1,n);if(!a)throw M(`ENOENT`,n);if(X&&!J(this,a,4))throw M(`EACCES`,n);if(!q(a))throw M(`ENOTDIR`,n);let o;{let e={stack:[],error:void 0,hasError:!1};try{ka(e,await Vr(r,i,`ro`,a),!1),o=await r.readdir(i)}catch(t){e.error=t,e.hasError=!0}finally{Aa(e)}}let s=[],c=async e=>{let n=await r.stat(U(i,e)).catch(e=>{if(e.code!=`ENOENT`)throw e});if(!n)return;let a=new jr;if(a.ino=n.ino,a.type=kr(n.mode),a.path=e,a.name=wn(e),s.push(a),!t.recursive||!q(n))return;let o=await r.readdir(U(i,e));for(let t of o)await c(U(e,t))};return await Promise.all(o.map(c)),s}async function Ia(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H.call(this,e),t=H.call(this,t);let r={syscall:`rename`,path:e,dest:t},i=await ja(this,e,!0,r),a=ui(t,this,r);if(i.fs.uuid!==a.fs.uuid)throw M(`EXDEV`,r);if(a.path.startsWith(i.path+`/`))throw M(`EINVAL`,r);if(!i.stats)throw M(`ENOENT`,r);let o=i.fs,s=await o.stat(W(i.path)),c=await o.stat(W(a.path)),l=await o.stat(a.path).catch(e=>{if(e.code==`ENOENT`)return null;throw e});if(X&&(!J(this,s,4)||!J(this,c,2)))throw M(`EACCES`,r);if(l&&!q(i.stats)&&q(l))throw M(`EISDIR`,r);if(l&&q(i.stats)&&!q(l))throw M(`ENOTDIR`,r);let u=W(i.path),d=W(a.path),f=[[u,s],[d,c]];s.ino>c.ino&&f.reverse(),ka(n,await Vr(o,f[0][0],`rw`,f[0][1]),!1),ka(n,s.ino==c.ino?null:await Vr(o,f[1][0],`rw`,f[1][1]),!1),await i.fs.rename(i.path,a.path),Z(o).rename(i.path,a.path),Oa(this,`rename`,e),Oa(this,`rename`,t)}catch(e){n.error=e,n.hasError=!0}finally{Aa(n)}}async function La(e,t){let n={stack:[],error:void 0,hasError:!1};try{e=H.call(this,e),t=H.call(this,t);let r={syscall:`link`,path:e,dest:t},{fs:i,path:a}=ui(e,this,r),o=ui(t,this,r);if(i.uuid!=o.fs.uuid)throw M(`EXDEV`,r);let s=await i.stat(a);if(X){if(!J(this,s,4))throw M(`EACCES`,r);let e=await i.stat(W(a));if(!J(this,e,4))throw M(`EACCES`,r);let t=await i.stat(W(o.path));if(!J(this,t,2))throw M(`EACCES`,r)}ka(n,await Vr(i,W(o.path),`rw`),!1),await i.link(a,o.path),Z(i).link(a,o.path)}catch(e){n.error=e,n.hasError=!0}finally{Aa(n)}}async function Ra(e,t){e=H.call(this,e);let n={syscall:t?`lstat`:`stat`,path:e},r;if(!t)r=(await ja(this,e,!1,n)).stats;else{let{base:t,dir:i}=Dn(e),{fs:a,path:o}=await ja(this,i,!1,n),s=t?U(o,t):o;r=Z(a).get(s)?.inode??await a.stat(s).catch(P(n))}if(!r)throw M(`ENOENT`,n);if(X&&!J(this,r,4))throw M(`EACCES`,n);return r}var za=class extends u.default{input;output;terminal;line=``;_cursor=0;get cursor(){return this._cursor}_buffer=``;_closed=!1;_paused=!1;_prompt=``;_history=[];_historyIndex=-1;_currentLine=``;constructor(e,t,n,r=!1){super(),this.input=e,this.output=t,this.terminal=r,this.input.on(`data`,this._onData),this.input.on(`end`,this.close.bind(this)),this.input.on(`close`,this.close.bind(this))}_onData=e=>{if(!(this._paused||this._closed)){this._buffer+=typeof e==`string`?e:e.toString(`utf8`);for(let e=this._buffer.indexOf(`
|
|
2
2
|
`);e>=0;e=this._buffer.indexOf(`
|
|
3
3
|
`)){let t=this._buffer.substring(0,e);t.endsWith(`\r`)&&(t=t.substring(0,t.length-1)),this._buffer=this._buffer.substring(e+1),this.line=t,t.trim()&&!t.trim().match(/^\s*$/)&&this._history.at(-1)!=t&&(this._history.push(t),this._historyIndex=this._history.length,this.emit(`history`,this._history)),this.emit(`line`,t)}}};close(){if(!this._closed){if(this._closed=!0,this.input?.removeAllListeners?.(),this._buffer.length){let e=this._buffer;this._buffer=``,this.line=e,this.emit(`line`,e)}this.emit(`history`,this._history),this.emit(`close`),this.removeAllListeners()}}pause(){return this._paused?this:(this._paused=!0,`pause`in this.input&&this.input.pause(),this.emit(`pause`),this)}resume(){return this._paused?(this._paused=!1,`resume`in this.input&&this.input.resume(),this.emit(`resume`),this):this}setPrompt(e){this._prompt=e}getPrompt(){return this._prompt}prompt(e){if(!this.output)return;if(!e){this.output.write(this._prompt);return}let{cols:t}=this.getCursorPos();this.output.write(this._prompt),this._cursor=t}write(e,t){if(!this._closed){if(e){let t=typeof e==`string`?e:e.toString(`utf8`);this._onData(t)}if(!(!t||!this.terminal))switch((t.ctrl?`^`:``)+t.name){case`^c`:this.emit(`SIGINT`);break;case`^z`:this.emit(`SIGTSTP`);break;case`^q`:this.emit(`SIGCONT`);break;case`home`:case`^a`:if(!this.output)return;Ha(this.output,-this._cursor,0),this._cursor=0,this._cursor=0;break;case`^e`:case`end`:{if(!this.output)return;let e=this.line.length-this._cursor;if(!e)return;Ha(this.output,e,0),this._cursor=this.line.length,this._cursor=this.line.length;break}case`^k`:{if(!this.output||this._cursor>=this.line.length)return;let e=this.line.slice(0,this._cursor);Va(this.output,1),this.line=e;break}case`^u`:{if(!this.output||!this._cursor)return;let e=this.line.slice(this._cursor);Va(this.output,0),Ha(this.output,0,0),this.output.write(this._prompt+e),this.line=e,this._cursor=0,this._cursor=0;break}case`^w`:{if(!this.output||!this._cursor)return;let e=this._cursor-1;for(;e>=0&&this.line[e]===` `;)e--;for(;e>=0&&this.line[e]!==` `;)e--;let t=this.line.slice(0,e+1)+this.line.slice(this._cursor),n=e+1;this._renderLine(t),this._cursor=n,this._cursor=n,Ha(this.output,-t.length,0),Ha(this.output,n,0);break}case`^return`:case`^enter`:this._onData(`
|
|
4
4
|
`);break;case`return`:case`enter`:this._onData((e?typeof e==`string`?e:e.toString(`utf8`):``)+`
|
|
@@ -9,7 +9,7 @@ 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 R(N(`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=R(N(`ETIMEDOUT`,`RPC request timed out`));e.stack+=i,Xs(c),o(e)},n)};return Zs.set(c,l),t.send({...e,_zenfs:!0,id:c,stack:i}),s}function $s(e,...t){return t.includes(e.method)}function ec(e){if(!Ys(e))return;if(!Zs.has(e.id)){let t=R(N(`EIO`,`Invalid RPC id: `+e.id));throw t.stack+=e.stack,t}let{resolve:t,reject:n}=Zs.get(e.id);if(e.error){let t=j.fromJSON({code:`EIO`,errno:O.EIO,...e.error});t.stack+=e.stack,Xs(e.id),n(t);return}Xs(e.id),t($s(e,`stat`,`createFile`,`mkdir`)?new K(e.value):e.value)}function tc(e,t){if(!e)throw R(N(`EINVAL`,`Cannot attach to non-existent port`));fe(`Attached handler to port: `+t.name),e.addHandler(t)}function nc(e,t){if(!e)throw R(N(`EINVAL`,`Cannot detach from non-existent port`));fe(`Detached handler from port: `+t.name),e.removeHandler(t)}function rc(e){let t=[],n=t.push.bind(t);return tc(e,n),async function(r){nc(e,n);for(let n of t)await ic(e,r,`data`in n?n.data:n)}}async function ic(e,t,n){if(!Ys(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 j?e.toJSON():p(e,`message`,`stack`)}e.send({_zenfs:!0,...p(n,`id`,`method`,`stack`),error:i,value:r},a)}const ac=[`rename`,`stat`,`touch`,`createFile`,`unlink`,`rmdir`,`mkdir`,`readdir`,`exists`,`link`,`sync`,`read`,`write`,`ioctl`];function oc(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 mr&&this instanceof mr){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(`/`),pe(`Skipped ${this._skippedCacheUpdates} updates to the sync cache during initialization`),this._isInitialized=!0}catch(e){throw this._isInitialized=!1,ue(e)}}}checkSync(){if(this.attributes.has(`no_async_preload`))throw N(`ENOTSUP`,`Sync preloading has been disabled for this async file system`);if(!this._sync)throw ue(N(`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))}ioctlSync(e,t,...n){return this.checkSync(),this._sync.ioctlSync(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,t={active:0,waiters:[],failure:null}){try{if(t.failure)throw t.failure.error;this.checkSync();let n=await this.stat(e);if(t.failure)throw t.failure.error;if(!q(n)){t.active>=16?await new Promise((e,n)=>t.waiters.push({resolve:e,reject:n})):t.active++;try{if(t.failure)throw t.failure.error;this._sync.createFileSync(e,n);let r=new Uint8Array(n.size);await this.read(e,r,0,n.size),this._sync.writeSync(e,r,0),this._sync.touchSync(e,n)}catch(e){throw t.failure??={error:e},t.failure.error}finally{let e=!t.failure&&t.waiters.shift();e?e.resolve():t.active--}return}e!==`/`&&(this._sync.mkdirSync(e,n),this._sync.touchSync(e,n));let r=[];for(let n of await this.readdir(e)){if(t.failure)break;r.push(this.crossCopy(U(e,n),t))}if(await Promise.allSettled(r),t.failure)throw t.failure.error}catch(e){t.failure??={error:e};for(let e of t.waiters.splice(0))e.reject(t.failure.error);throw t.failure.error}}_patchAsync(){let e=[`read`,`readdir`,`stat`,`exists`],t=ac.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!)`,R(e)}return i}}pe(`Async: patched ${t.length} methods`)}}return t}var sc=class extends oc(sr){channel;timeout;port;_sync=vr.create({label:`tmpfs:port`});constructor(e,t=250){super(1886351988,`portfs`),this.channel=e,this.timeout=t,this.port=Ks(e),tc(this.port,ec)}rpc(e,...t){return Qs({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 cc(e,t){let n=Ks(e);tc(n,e=>ic(n,t,e))}function lc(e,t){let n=Ks(e);nc(n,e=>ic(n,t,e))}const uc={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 sc(e.port,e.timeout)}};async function dc(e,t,n=0){let r=Ks(e),i=rc(r),a=await ls(t,n);return cc(r,a),await i(a),fe(`Resolved remote mount: `+a.toString()),a}var fc=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},Q=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},pc=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},mc=(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});const hc=e=>`0x`+e.toString(16).padStart(8,`0`),{format:gc}=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:2,unit:`byte`,unitDisplay:`narrow`});let _c=(()=>{var e,t,n,r;let i=[Xt.packed()],a,s=[],c,l=$t(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)],fc(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),fc(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),fc(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),fc(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),fc(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=Q(this,d,void 0);get id(){return this.#e}set id(e){this.#e=e}#t=(Q(this,f),Q(this,m,void 0));get offset_(){return this.#t}set offset_(e){this.#t=e}#n=(Q(this,h),Q(this,_,void 0));get offset(){return this.#n}set offset(e){this.#n=e}#r=(Q(this,v),Q(this,b,void 0));get size(){return this.#r}set size(e){this.#r=e}toString(){return`<MetadataEntry @ ${hc(this.byteOffset)}>`}constructor(){super(...arguments),Q(this,x)}static{Q(c,s)}};return c})(),vc=(()=>{var e,t,n,r;let i=[Xt.packed()],a,o=[],s,c=$t.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=[Zt(tn(_c,255))],x=[(r=V).int32.bind(r)],fc(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),fc(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),fc(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,_),fc(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),fc(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),fc(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=Q(this,u,void 0);get checksum(){return this.#e}set checksum(e){this.#e=e}#t=(Q(this,d),Q(this,p,BigInt(Date.now())));get timestamp(){return this.#t}set timestamp(e){this.#t=e}#n=(Q(this,m),Q(this,g,void 0));get previous_offset(){return this.#n}set previous_offset(e){this.#n=e}_previous=Q(this,_);get previous(){if(this.previous_offset)return this._previous??=new w(this.buffer,this.previous_offset),this._previous}#r=Q(this,y,void 0);get items(){return this.#r}set items(e){this.#r=e}toString(e=!1){if(!e)return`<MetadataBlock @ ${hc(this.byteOffset)}>`;let t=[`---- Metadata block at ${hc(this.byteOffset)} ----`,`Checksum: ${hc(this.checksum)}`,`Last updated: ${new Date(Number(this.timestamp)).toLocaleString()}`,`Previous block: ${hc(this.previous_offset)}`,`Entries:`].join(`
|
|
12
|
-
`);for(let e of this.items)e.offset&&(t+=`\n\t${hc(e.id)}: ${gc(e.size).padStart(5)} at ${hc(e.offset)}`);return t}#i=(Q(this,b),Q(this,S,void 0));get locked(){return this.#i}set locked(e){this.#i=e}waitUnlocked(e=0){if(e>5)throw ue(N(`EBUSY`,`sbfs: exceeded max attempts waiting for metadata block at ${hc(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++,R(`sbfs: waiting for metadata block at ${hc(this.byteOffset)} to be unlocked (${e}/5)`),this.waitUnlocked(e);case`timed-out`:throw ue(N(`EBUSY`,`sbfs: timed out waiting for metadata block at ${hc(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),Q(this,C)}static{Q(s,o)}};return w=s})();Object.assign(vc,{lockIndex:Gt(vc,`locked`)/Int32Array.BYTES_PER_ELEMENT});const yc=1651715706;let bc=(()=>{var e,t,n,r,i,a,o,s,c,l;let u=[Xt.packed()],d,f=[],p,m=$t.typed(BigUint64Array),h,g=[],_=[],v,y=[],b=[],x,S=[],C=[],w,T=[],ee=[],te,ne=[],re=[],E,O=[],k=[],A,j=[],M=[],P,ie=[],F=[],I,ae=[],L=[],oe,se=[],ce=[],le,de=[],fe=[],me,he=[],ge=[],_e,ve=[],ye=[];var be=class extends m{static{p=this}static{let D=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)],te=[(i=V).uint32.bind(i)],E=[(a=V).uint64.bind(a)],A=[(o=V).uint64.bind(o)],P=[V.uint8(16)],I=[(s=V).uint32.bind(s)],oe=[(c=V).uint32.bind(c)],le=[(l=V).uint32.bind(l)],me=[V.char(64)],_e=[V.char(132)],fc(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:D},g,_),fc(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:D},y,b),fc(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:D},S,C),fc(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:D},T,ee),fc(this,null,te,{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:D},ne,re),fc(this,null,E,{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:D},O,k),fc(this,null,A,{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:D},j,M),fc(this,null,P,{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:D},ie,F),fc(this,null,I,{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:D},ae,L),fc(this,null,oe,{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:D},se,ce),fc(this,null,le,{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:D},de,fe),fc(this,null,me,{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:D},he,ge),fc(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:D},ve,ye),fc(null,d={value:p},u,{kind:`class`,name:p.name,metadata:D},null,f),be=p=d.value,D&&Object.defineProperty(p,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:D})}static name=`SuperBlock`;constructor(...e){if(super(...e),Q(this,ye),this.magic!=yc){z(`sbfs: Invalid magic value, assuming this is a fresh super block`);let e=new vc(this.buffer,B(be));Object.assign(this,{metadata:e,metadata_offset:e.byteOffset,used_bytes:BigInt(B(be)+B(vc)),total_bytes:BigInt(this.buffer.byteLength),magic:yc,version:1,inode_format:5,metadata_block_size:B(vc),uuid:D(crypto.randomUUID())}),Cc(this),Cc(e);return}if(this.checksum!==Sc(this))throw ue(N(`EIO`,`sbfs: checksum mismatch for super block`));if(this.metadata=new vc(this.buffer,this.metadata_offset),this.metadata.checksum!==Sc(this.metadata))throw ue(N(`EIO`,`sbfs: checksum mismatch for metadata block (saved ${hc(this.metadata.checksum)}, computed ${hc(Sc(this.metadata))})`));if(this.inode_format!=5)throw ue(N(`EIO`,`sbfs: inode format mismatch`));if(this.metadata_block_size!=B(vc))throw ue(N(`EIO`,`sbfs: metadata block size mismatch`))}#e=Q(this,g,void 0);get checksum(){return this.#e}set checksum(e){this.#e=e}#t=(Q(this,_),Q(this,y,void 0));get magic(){return this.#t}set magic(e){this.#t=e}#n=(Q(this,b),Q(this,S,void 0));get version(){return this.#n}set version(e){this.#n=e}#r=(Q(this,C),Q(this,T,void 0));get inode_format(){return this.#r}set inode_format(e){this.#r=e}#i=(Q(this,ee),Q(this,ne,void 0));get flags(){return this.#i}set flags(e){this.#i=e}#a=(Q(this,re),Q(this,O,void 0));get used_bytes(){return this.#a}set used_bytes(e){this.#a=e}#o=(Q(this,k),Q(this,j,void 0));get total_bytes(){return this.#o}set total_bytes(e){this.#o=e}#s=(Q(this,M),Q(this,ie,void 0));get uuid(){return this.#s}set uuid(e){this.#s=e}#c=(Q(this,F),Q(this,ae,void 0));get metadata_block_size(){return this.#c}set metadata_block_size(e){this.#c=e}#l=(Q(this,L),Q(this,se,void 0));get metadata_offset_(){return this.#l}set metadata_offset_(e){this.#l=e}#u=(Q(this,ce),Q(this,de,void 0));get metadata_offset(){return this.#u}set metadata_offset(e){this.#u=e}metadata=Q(this,fe);#d=Q(this,he,void 0);get label(){return this.#d}set label(e){this.#d=e}#f=(Q(this,ge),Q(this,ve,void 0));get _padding(){return this.#f}set _padding(e){this.#f=e}rotateMetadata(){let e=BigInt(Int32Array.BYTES_PER_ELEMENT),t=BigInt(B(vc)),n=Atomics.load(this,2),r;for(;;){let i=(e-n%e)%e;r=n+i;let a=r+t;if(a>this.total_bytes)throw R(N(`ENOSPC`,`sbfs: not enough space for a new metadata block`));let o=Atomics.compareExchange(this,2,n,a);if(o===n)break;n=o}let i=new vc(this.buffer,Number(r)),a=new Uint32Array(this.buffer,this.byteOffset,B(be)/Uint32Array.BYTES_PER_ELEMENT),o=Atomics.load(a,xc);for(;;){i.previous_offset=o,Cc(i);let e=Atomics.compareExchange(a,xc,o,i.byteOffset);if(e===o)break;o=e}return this.metadata=i,Cc(this),pe(`sbfs: rotated metadata block at ${hc(i.previous_offset)} with new block at ${hc(i.byteOffset)}`),i}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(vc)&&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{Q(p,f)}};return be=p})();const xc=Gt(bc,`metadata_offset`)/Uint32Array.BYTES_PER_ELEMENT;function Sc(e){let t=B(e)-4;return e instanceof vc&&(t-=Int32Array.BYTES_PER_ELEMENT),l(new Uint8Array(e.buffer,e.byteOffset+4,t))}function Cc(e){e instanceof vc&&(e.timestamp=BigInt(Date.now())),e.checksum=Sc(e)}var wc=class extends o{flags=[];name=`sbfs`;type=1935828595;get uuid(){return E(this.superblock.uuid)}superblock;_view;_u8;constructor(...e){if(super(...e),this.byteLength<B(bc)+B(vc))throw ue(N(`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 bc(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 le(N(`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(pc(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,2,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{mc(i)}}}let r=Array.from(this.superblock.metadata.items).find(e=>!e.offset);r||=(this.superblock.rotateMetadata(),this.superblock.metadata.items[0]),pc(n,this.superblock.metadata.lock(),!1);let i=Number(Atomics.add(this.superblock,2,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{mc(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 hr(this)}};const Tc={name:`SingleBuffer`,options:{buffer:{type:`object`,required:!0}},create(e){let t=new mr(ArrayBuffer.isView(e.buffer)?new wc(e.buffer.buffer,e.buffer.byteOffset,e.buffer.byteLength):new wc(e.buffer));return t.checkRootSync(),t}},$=()=>{};async function Ec(e){let t=[];for await(let n of e)t.push(n);return t}function Dc(e,t,n=$){Do.call(this,e,t).then(()=>n(null)).catch(n)}function Oc(e,t=$){Oo.call(this,e).then(t).catch(()=>t(!1))}function kc(e,t,n=$){n=typeof t==`function`?t:n,ko.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function Ac(e,t,n=$){n=typeof t==`function`?t:n,Ao.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function jc(e,t=0,n=$){n=typeof t==`function`?t:n;let r=typeof t==`number`?t:0;jo.call(this,e,r).then(()=>n(null)).catch(n)}function Mc(e,t=$){Mo.call(this,e).then(()=>t(null)).catch(t)}function Nc(e,t,n,r=$){let i=on(n,420);r=typeof n==`function`?n:r,No.call(this,e,t,i).then(e=>r(null,e.fd)).catch(r)}function Pc(e,t,n=$){n=typeof t==`function`?t:n,Po.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function Fc(e,t,n,r=$){r=typeof n==`function`?n:r,Fo.call(this,e,t,typeof n==`function`?null:n).then(()=>r(null)).catch(r)}function Ic(e,t,n,r=$){let i=typeof n==`function`?void 0:n;r=typeof n==`function`?n:r,Io.call(this,e,t,i).then(()=>r(null)).catch(r)}function Lc(e,t,n=$){n=typeof t==`function`?t:n,new Eo(this,e).stat().then(e=>n(null,typeof t==`object`&&t?.bigint?new Mn(e):e)).catch(n)}function Rc(e,t=$){new Eo(this,e).close().then(()=>t(null)).catch(t)}function zc(e,t,n=$){let r=typeof t==`number`?t:0;n=typeof t==`function`?t:n;let i=new Eo(this,e);if(r<0)throw N(`EINVAL`);i.truncate(r).then(()=>n(null)).catch(n)}function Bc(e,t=$){new Eo(this,e).sync().then(()=>t(null)).catch(t)}function Vc(e,t=$){new Eo(this,e).datasync().then(()=>t(null)).catch(t)}function Hc(e,t,n,r,i,a=$){let o,s,c,l,u,d=new Eo(this,e),f=[n,r,i].find(e=>typeof e==`function`)??a;typeof t==`string`?(l=typeof n==`number`?n:null,u=typeof r==`string`?r:`utf8`,o=Y.Buffer.from(t,u),s=0,c=o.byteLength):(o=Y.Buffer.from(t.buffer,t.byteOffset,t.byteLength),s=typeof n==`number`?n:0,c=typeof r==`number`?r:o.byteLength-s,l=typeof i==`number`?i:null),d.write(o,s,c,l).then(({bytesWritten:e})=>f(null,e,typeof t==`string`?t:o)).catch(f)}function Uc(e,t,n,r,i,a=$){new Eo(this,e).read(t,n,r,i).then(({bytesRead:e,buffer:t})=>a(null,e,t)).catch(a)}function Wc(e,t,n,r=$){new Eo(this,e).chown(t,n).then(()=>r(null)).catch(r)}function Gc(e,t,n){new Eo(this,e).chmod(t).then(()=>n(null)).catch(n)}function Kc(e,t,n,r=$){new Eo(this,e).utimes(t,n).then(()=>r(null)).catch(r)}function qc(e,t=$){Lo.call(this,e).then(()=>t(null)).catch(t)}function Jc(e,t,n=$){Ro.call(this,e,t).then(()=>n(null)).catch(n)}function Yc(e,t,n=$){n=typeof t==`function`?t:n;let r=typeof t==`function`?{}:t;zo.call(this,e,r).then(e=>n(null,e)).catch(n)}function Xc(e,t,n=$){Bo.call(this,e,t).then(()=>n(null)).catch(n)}function Zc(e,t,n,r=$){let i=typeof n==`string`?n:`file`;r=typeof n==`function`?n:r,Vo.call(this,e,t,i).then(()=>r(null)).catch(r)}function Qc(e,t,n=$){n=typeof t==`function`?t:n,Ho.call(this,e).then(e=>n(null,e)).catch(n)}function $c(e,t,n,r=$){Uo.call(this,e,t,n).then(()=>r(null)).catch(r)}function el(e,t,n,r=$){Wo.call(this,e,t,n).then(()=>r(null)).catch(r)}function tl(e,t,n=$){Go.call(this,e,t).then(()=>n(null)).catch(n)}function nl(e,t,n=$){Ko.call(this,e,t).then(()=>n(null)).catch(n)}function rl(e,t,n,r=$){qo.call(this,e,t,n).then(()=>r(null)).catch(r)}function il(e,t,n,r=$){Jo.call(this,e,t,n).then(()=>r(null)).catch(r)}function al(e,t,n=$){n=typeof t==`function`?t:n,Yo.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function ol(e,t,n=$){let r=typeof t==`number`?t:4;n=typeof t==`function`?t:n,Zo.call(this,e,r).then(()=>n(null)).catch(n)}const sl=new Map;function cl(e,t,n){let r=H.call(this,e),i=typeof t==`function`?{}:t;if(typeof t==`function`&&(n=t),!n)throw M(`EINVAL`,`watch`,e.toString());if(sl.has(r)){let e=sl.get(r);e&&e.listeners.add(n);return}let a=new wa(this,r,i);a.on(`change`,(e,t)=>{let n=sl.get(r);if(n)for(let r of n.listeners)r(e,t)}),sl.set(r,{watcher:a,listeners:new Set([n])})}function ll(e,t=$){let n=H.call(this,e),r=sl.get(n);r&&(t&&t!==$?r.listeners.delete(t):r.listeners.clear(),r.listeners.size===0&&(r.watcher.stop(),sl.delete(n)))}function ul(e,t,n){let r=new Ca(this,H.call(this,e),typeof t==`object`?t:{});return n=typeof t==`function`?t:n,r.on(`change`,n||$),r}function dl(e,t){t=typeof t==`object`?t:{encoding:t};let n=No.call(this,e,`r`,t?.mode);return new yo({...t,autoClose:!0},n)}function fl(e,t){t=typeof t==`object`?t:{encoding:t};let n=No.call(this,e,`w`,t?.mode);return new bo(t,n)}function pl(e,t,n=$){n=typeof t==`function`?t:n,Qo.call(this,e,typeof t==`function`?void 0:t).then(()=>n(null)).catch(n)}function ml(e,t,n=$){n=typeof t==`function`?t:n,$o.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function hl(e,t,n,r=$){r=typeof n==`function`?n:r,ts.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function gl(e,t,n,r=$){r=typeof n==`function`?n:r,new Eo(this,e).readv(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesRead:t})=>r(null,t,e)).catch(r)}function _l(e,t,n,r=$){r=typeof n==`function`?n:r,new Eo(this,e).writev(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesWritten:t})=>r(null,t,e)).catch(r)}function vl(e,t,n=$){n=typeof t==`function`?t:n,ns.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}function yl(e,t,n,r=$){r=typeof n==`function`?n:r,rs.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function bl(e,t,n=$){n=typeof t==`function`?t:n,is.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}async function xl(e,t){let n=await No.call(this,e.toString(),`r`),r=await n.readFile();return await n.close(),new Blob([r],t)}function Sl(e,t,n=$){n=typeof t==`function`?t:n,Ec(as.call(this,e,typeof t==`function`?void 0:t)).then(e=>n(null,e??[])).catch(e=>n(e))}function Cl(e,t){return Object.assign(Error(t),{code:e})}function wl(e,t,n){return Cl(`ERR_INVALID_ARG_TYPE`,`The "${e}" argument must be of type ${t}. Received ${typeof n}`)}function Tl(e){return Cl(`ERR_INVALID_STATE`,`Invalid state: `+e)}function El(e,t){if(typeof e!=`number`)throw wl(t,`number`,e);if(!Number.isInteger(e)||e<0||e>4294967295)throw Cl(`ERR_OUT_OF_RANGE`,`The value of "${t}" is out of range. It must be an integer >= 0 and <= 4294967295. Received ${e}`)}const Dl=16384,Ol=Y.Buffer.alloc(0),kl={open:Nc,openSync:Ii,close:Rc,write:Hc,writeSync:Ki,fsync:Bc,fsyncSync:Wi,mkdir:Jc,mkdirSync:Qi};function Al(e,t,n){if(typeof e==`string`){if(Y.Buffer.byteLength(e)===n)n=e.length;else{let t=Y.Buffer.from(e);for(;n>0&&(t[n]&192)==128;)n--;n=t.subarray(0,n).toString().length}}return{writingBuf:e.slice(n),len:Math.max(t-n,0)}}function jl(e,t){return e.length?e.length==1?e[0]:Y.Buffer.concat(e,t):Ol}const Ml=Symbol(`Utf8StreamFS`);var Nl=class extends u.default{#e=0;#t=-1;#n=[];#r=[];#i=!1;#a=!1;#o=!1;#s=!1;#c=!1;#l=16387;#u=null;#d=!1;#f=0;#p=0;#m=Dl;#h=!1;#g=0;#_;#v=!1;#y=!1;#b=!0;#x;#S=()=>!0;#C=!1;#w;#T=``;#E;static[Ml]=kl;static _withContext(e){Le(e);class t extends Nl{static[Ml]=_(kl,e)}return t}constructor(e={}){if(typeof e!=`object`||!e)throw wl(`options`,`object`,e);let{dest:t,minLength:n,maxLength:r,maxWrite:i,periodicFlush:a,sync:o,append:s=!0,mkdir:c,retryEAGAIN:l,fsync:u,contentMode:d=`utf8`,mode:f,fs:p={}}=e;super();let m=e.fd??t;if(typeof p!=`object`||!p)throw wl(`options.fs`,`object`,p);this.#E={...this.constructor[Ml],...p};let h=this.#E;for(let e of[`write`,`writeSync`,`fsync`,`fsyncSync`,`close`,`open`,`mkdir`,`mkdirSync`])if(typeof h[e]!=`function`)throw wl(`options.fs.${e}`,`function`,h[e]);this.#l=Math.max(n||0,this.#l),this.#f=n||0,this.#p=r||0,this.#m=i||Dl,this.#g=a||0,this.#v=o||!1,this.#y=u||!1,this.#b=s||!1,this.#x=f,this.#S=l||(()=>!0),this.#C=c||!1,El(this.#l,`options.hwm`),El(this.#f,`options.minLength`),El(this.#p,`options.maxLength`),El(this.#m,`options.maxWrite`),El(this.#g,`options.periodicFlush`);for(let[e,t]of[[`sync`,this.#v],[`fsync`,this.#y],[`append`,this.#b],[`mkdir`,this.#C]])if(typeof t!=`boolean`)throw wl(`options.${e}`,`boolean`,t);if(typeof this.#S!=`function`)throw wl(`options.retryEAGAIN`,`function`,this.#S);if(d!=`buffer`&&d!=`utf8`)throw Cl(`ERR_INVALID_ARG_VALUE`,`The property 'options.contentMode' must be one of: 'buffer', 'utf8'. Received ${JSON.stringify(d)}`);if(this.#w=d,this.#T=d==`buffer`?Ol:``,typeof m==`number`)this.#t=m,queueMicrotask(()=>this.emit(`ready`));else if(typeof m==`string`)this.#N(m);else throw wl(`fd`,`number or string`,m);if(this.#f>=this.#m)throw Cl(`ERR_INVALID_ARG_VALUE`,`The argument 'minLength' should be smaller than maxWrite (${this.#m}). Received ${this.#f}`);this.#g!==0&&(this.#_=setInterval(()=>this.flush(),this.#g),this.#_.unref?.())}write(e){if(this.#d)throw Tl(`Utf8Stream is destroyed`);if(this.#w==`buffer`){if(!Y.Buffer.isBuffer(e))throw wl(`data`,`Buffer`,e)}else if(typeof e!=`string`)throw wl(`data`,`string`,e);let t=this.#e+e.length;if(this.#p&&t>this.#p)return this.emit(`drop`,e),this.#e<this.#l;let n=this.#n.length-1;if(this.#w==`buffer`){let t=this.#n;!t.length||this.#r[n]+e.length>this.#m?(t.push([e]),this.#r.push(e.length)):(t[n].push(e),this.#r[n]+=e.length)}else{let t=this.#n;!t.length||t[n].length+e.length>this.#m?t.push(e):t[n]+=e}return this.#e=t,!this.#i&&this.#e>=this.#f&&this.#F(),this.#e<this.#l}flush(e){if(e!=null&&typeof e!=`function`)throw wl(`cb`,`function`,e);if(this.#d){let t=Tl(`Utf8Stream is destroyed`);if(!e)throw t;e(t);return}if(this.#f<=0){e?.(null);return}e&&this.#I(e),!this.#i&&(this.#n.length||(this.#n.push(this.#w==`buffer`?[]:``),this.#w==`buffer`&&this.#r.push(0)),this.#F())}flushSync(){if(this.#d)throw Tl(`Utf8Stream is destroyed`);if(this.#t<0)throw Tl(`Invalid file descriptor`);this.#w==`buffer`?this.#D():this.#O()}#D(){let e=this.#n;!this.#i&&this.#T.length>0&&(e.unshift([this.#T]),this.#T=Ol);let t=Ol;for(;e.length||t.length;){t.length<=0&&(t=jl(e[0],this.#r[0]));let n=this.#E.writeSync(this.#t,t);t=t.subarray(n),this.#e=Math.max(this.#e-n,0),t.length<=0&&(e.shift(),this.#r.shift())}}#O(){let e=this.#n;!this.#i&&this.#T.length>0&&(e.unshift(this.#T),this.#T=``);let t=``;for(;e.length||t;){t.length<=0&&(t=e[0]);let n=this.#E.writeSync(this.#t,t,`utf8`),r=Al(t,this.#e,n);t=r.writingBuf,this.#e=r.len,t.length<=0&&e.shift()}try{this.#E.fsyncSync(this.#t)}catch{}}reopen(e){if(this.#d)throw Tl(`Utf8Stream is destroyed`);if(this.#h){this.once(`ready`,()=>this.reopen(e));return}if(this.#a)return;if(!this.#u)throw Cl(`ERR_OPERATION_FAILED`,`Unable to reopen a file descriptor, you must pass a file to Utf8Stream`);if(e&&(this.#u=e.toString()),this.#o=!0,this.#i)return;let t=this.#t;this.once(`ready`,()=>{t!==this.#t&&this.#E.close(t,e=>{e&&this.emit(`error`,e)})}),this.#N(this.#u)}end(){if(this.#d)throw Tl(`Utf8Stream is destroyed`);if(this.#h){this.once(`ready`,()=>this.end());return}this.#a||(this.#a=!0,!this.#i&&(this.#e>0&&this.#t>=0?this.#F():this.#P()))}destroy(){this.#d||this.#P()}get mode(){return this.#x}get file(){return this.#u}get fd(){return this.#t}get minLength(){return this.#f}get maxLength(){return this.#p}get writing(){return this.#i}get sync(){return this.#v}get fsync(){return this.#y}get append(){return this.#b}get periodicFlush(){return this.#g}get contentMode(){return this.#w}get mkdir(){return this.#C}[Symbol.dispose](){this.destroy()}#k(){this.listenerCount(`drain`)&&(this.#s=!1,this.emit(`drain`))}#A(e,t=0){if(e){!this.#v&&(e.code===`EAGAIN`||e.code===`EBUSY`)&&this.#S(e,this.#T.length,this.#e-this.#T.length)?setTimeout(()=>this.#j(),100):(this.#i=!1,this.emit(`error`,e));return}this.emit(`write`,t);let n=Al(this.#T,this.#e,t);if(this.#e=n.len,this.#T=n.writingBuf,this.#T.length){if(!this.#v){this.#j();return}try{do{let e=this.#M(),t=Al(this.#T,this.#e,e);this.#e=t.len,this.#T=t.writingBuf}while(this.#T.length)}catch(e){this.#A(e);return}}this.#y&&this.#E.fsyncSync(this.#t);let r=this.#e;this.#o?(this.#i=!1,this.#o=!1,this.reopen()):r>this.#f?this.#F():this.#a?r>0?this.#F():(this.#i=!1,this.#P()):(this.#i=!1,this.#v?this.#s||(this.#s=!0,queueMicrotask(()=>this.#k())):this.emit(`drain`))}#j(){this.#w==`buffer`?this.#E.write(this.#t,this.#T,(e,t)=>this.#A(e,t)):this.#E.write(this.#t,this.#T,`utf8`,(e,t)=>this.#A(e,t))}#M(){return this.#w==`buffer`?this.#E.writeSync(this.#t,this.#T):this.#E.writeSync(this.#t,this.#T,`utf8`)}#N(e){this.#h=!0,this.#i=!0,this.#s=!1;let t=(t,n=-1)=>{if(t){this.#o=!1,this.#i=!1,this.#h=!1,this.#v?queueMicrotask(()=>void(this.listenerCount(`error`)&&this.emit(`error`,t))):this.emit(`error`,t);return}let r=this.#o;this.#t=n,this.#u=e,this.#o=!1,this.#h=!1,this.#i=!1,this.#v?queueMicrotask(()=>this.emit(`ready`)):this.emit(`ready`),!this.#d&&(!this.#i&&this.#e>this.#f||this.#c?this.#F():r&&queueMicrotask(()=>this.emit(`drain`)))},n=this.#b?`a`:`w`,r=this.#x??438;if(this.#v)try{this.#C&&this.#E.mkdirSync(W(e),{recursive:!0}),t(null,this.#E.openSync(e,n,r))}catch(e){throw t(e),e}else this.#C?this.#E.mkdir(W(e),{recursive:!0},i=>{if(i)return t(i);this.#E.open(e,n,r,t)}):this.#E.open(e,n,r,t)}#P(){if(this.#t===-1){this.once(`ready`,()=>this.#P());return}this.#_!==void 0&&clearInterval(this.#_),this.#d=!0,this.#n=[],this.#r=[];let e=e=>{if(e){this.emit(`error`,e);return}this.#a&&!this.#i&&this.emit(`finish`),this.emit(`close`)},t=()=>{this.#t!==1&&this.#t!==2?this.#E.close(this.#t,e):e(null)};try{this.#E.fsync(this.#t,t)}catch{}}#F(){if(this.#i=!0,this.#w==`buffer`?this.#T=this.#T.length?this.#T:jl(this.#n.shift()??[],this.#r.shift()??0):this.#T||=this.#n.shift()||``,!this.#v){this.#j();return}try{this.#A(null,this.#M())}catch(e){this.#A(e)}}#I(e){this.#c=!0;let t=()=>{if(this.#y||this.#d)this.#c=!1,e(null);else try{this.#E.fsync(this.#t,t=>{this.#c=!1,e(t?.code==`EBADF`?null:t)})}catch(t){this.#c=!1,e(t)}this.off(`error`,n)},n=n=>{this.#c=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,n)}on(e,t,n){return e===`drain`&&(this.#s=!1),super.on(e,t,n)}addListener(e,t,n){return this.on(e,t,n)}once(e,t,n){return e===`drain`&&(this.#s=!1),super.once(e,t,n)}off(e,t,n,r){return super.off(e,t,n,r)}removeListener(e,t,n,r){return super.removeListener(e,t,n,r)}setMaxListeners(){throw M(`ENOSYS`,`Utf8Stream.setMaxListeners`)}getMaxListeners(){throw M(`ENOSYS`,`Utf8Stream.getMaxListeners`)}prependListener(){throw M(`ENOSYS`,`Utf8Stream.prependListener`)}prependOnceListener(){throw M(`ENOSYS`,`Utf8Stream.prependOnceListener`)}rawListeners(){throw M(`ENOSYS`,`Utf8Stream.rawListeners`)}},Pl=t({BigIntStatsFs:()=>Fn,Dir:()=>Di,Dirent:()=>Ti,ReadStream:()=>yo,Stats:()=>jn,StatsFs:()=>Pn,Utf8Stream:()=>Nl,WriteStream:()=>bo,access:()=>ol,accessSync:()=>ua,appendFile:()=>Ic,appendFileSync:()=>Bi,chmod:()=>tl,chmodSync:()=>aa,chown:()=>$c,chownSync:()=>ra,close:()=>Rc,closeSync:()=>Hi,constants:()=>He,copyFile:()=>hl,copyFileSync:()=>ma,cp:()=>yl,cpSync:()=>va,createReadStream:()=>dl,createWriteStream:()=>fl,exists:()=>Oc,existsSync:()=>ji,fchmod:()=>Gc,fchmodSync:()=>Yi,fchown:()=>Wc,fchownSync:()=>Ji,fdatasync:()=>Vc,fdatasyncSync:()=>Gi,fstat:()=>Lc,fstatSync:()=>Vi,fsync:()=>Bc,fsyncSync:()=>Wi,ftruncate:()=>zc,ftruncateSync:()=>Ui,futimes:()=>Kc,futimesSync:()=>Xi,glob:()=>Sl,globSync:()=>ba,lchmod:()=>nl,lchmodSync:()=>oa,lchown:()=>el,lchownSync:()=>ia,link:()=>Xc,linkSync:()=>ea,lopenSync:()=>Li,lstat:()=>Ac,lstatSync:()=>Ni,lutimes:()=>il,lutimesSync:()=>ca,mkdir:()=>Jc,mkdirSync:()=>Qi,mkdtemp:()=>ml,mkdtempDisposableSync:()=>pa,mkdtempSync:()=>fa,open:()=>Nc,openAsBlob:()=>xl,openSync:()=>Ii,opendir:()=>vl,opendirSync:()=>_a,promises:()=>xo,read:()=>Uc,readFile:()=>Pc,readFileSync:()=>Ri,readSync:()=>qi,readdir:()=>Yc,readdirSync:()=>$i,readlink:()=>Qc,readlinkSync:()=>na,readv:()=>gl,readvSync:()=>ha,realpath:()=>al,realpathSync:()=>la,rename:()=>Dc,renameSync:()=>Ai,rm:()=>pl,rmSync:()=>da,rmdir:()=>qc,rmdirSync:()=>Zi,stat:()=>kc,statSync:()=>Mi,statfs:()=>bl,statfsSync:()=>ya,symlink:()=>Zc,symlinkSync:()=>ta,truncate:()=>jc,truncateSync:()=>Pi,unlink:()=>Mc,unlinkSync:()=>Fi,unwatchFile:()=>ll,utimes:()=>rl,utimesSync:()=>sa,watch:()=>ul,watchFile:()=>cl,write:()=>Hc,writeFile:()=>Fc,writeFileSync:()=>zi,writeSync:()=>Ki,writev:()=>_l,writevSync:()=>ga}),Fl=t({get:()=>Rl,getSync:()=>zl,list:()=>Wl,listSync:()=>Gl,remove:()=>Hl,removeSync:()=>Ul,set:()=>Bl,setSync:()=>Vl});const Il=[];function Ll(e,t,n,r){if(!t.startsWith(`user.`)&&!Il.includes(t))throw M(`ENOTSUP`,r,n)}async function Rl(e,t,n={}){e=H.call(this,e);let{fs:r,path:i}=ui(e,this);Ll(this,t,e,`xattr.get`);let a=await r.stat(i).catch(P(`xattr.get`,e));if(X&&!J(this,a,4))throw M(`EACCES`,`xattr.get`,e);a.attributes??=new zn;let o=a.attributes.get(t);if(!o)throw M(`ENODATA`,`xattr.get`,e);let s=Y.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}function zl(e,t,n={}){e=H.call(this,e),Ll(this,t,e,`xattr.get`);let{fs:r,path:i}=ui(e,this),a;try{a=r.statSync(i)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!J(this,a,4))throw M(`EACCES`,`xattr.get`,e);a.attributes??=new zn;let o=a.attributes.get(t);if(!o)throw M(`ENODATA`,`xattr.get`,e);let s=Y.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}async function Bl(e,t,n,r={}){e=H.call(this,e);let{fs:i,path:a}=ui(e,this);Ll(this,t,e,`xattr.set`);let o=await i.stat(a).catch(P(`xattr.set`,e));if(X&&!J(this,o,2))throw M(`EACCES`,`xattr.set`,e);o.attributes??=new zn;let s=o.attributes.get(t);if(r.create&&s)throw M(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw M(`ENODATA`,`xattr.set`,e);o.attributes.set(t,Y.Buffer.from(n)),await i.touch(a,o).catch(P(`xattr.set`,e))}function Vl(e,t,n,r={}){e=H.call(this,e);let{fs:i,path:a}=ui(e,this);Ll(this,t,e,`xattr.set`);let o;try{o=i.statSync(a)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!J(this,o,2))throw M(`EACCES`,`xattr.set`,e);o.attributes??=new zn;let s=o.attributes.get(t);if(r.create&&s)throw M(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw M(`ENODATA`,`xattr.set`,e);o.attributes.set(t,Y.Buffer.from(n));try{i.touchSync(a,o)}catch(t){throw A(Object.assign(t,{path:e}))}}async function Hl(e,t){e=H.call(this,e);let{fs:n,path:r}=ui(e,this);Ll(this,t,e,`xattr.remove`);let i=await n.stat(r).catch(P(`xattr.remove`,e));if(X&&!J(this,i,2))throw M(`EACCES`,`xattr.remove`,e);if(i.attributes??=new zn,!i.attributes.get(t))throw M(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t),await n.touch(r,i)}function Ul(e,t){e=H.call(this,e);let{fs:n,path:r}=ui(e,this);Ll(this,t,e,`xattr.remove`);let i;try{i=n.statSync(r)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!J(this,i,2))throw M(`EACCES`,`xattr.remove`,e);if(i.attributes??=new zn,!i.attributes.get(t))throw M(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t);try{n.touchSync(r,i)}catch(t){throw A(Object.assign(t,{path:e}))}}async function Wl(e){e=H.call(this,e);let{fs:t,path:n}=ui(e,this),r=await t.stat(n).catch(P(`xattr.list`,e));return r.attributes?[...r.attributes.keys()]:[]}function Gl(e){e=H.call(this,e);let{fs:t,path:n}=ui(e,this),r;try{r=t.statSync(n)}catch(t){throw A(Object.assign(t,{path:e}))}return r.attributes?[...r.attributes.keys()]:[]}const Kl=new Map;function ql(e={}){let t=ze(this);if(!Mi.call(this,t.root).isDirectory())throw M(`ENOTDIR`,{syscall:`chroot`,path:t.root});let n=Ve(t,e),r=Object.assign(n,{fs:{..._(Pl,n),Utf8Stream:Nl._withContext(n),promises:_(xo,n),xattr:_(Fl,n)},path:_(gn,n),bind:e=>{let t=ql.call(n,e);return n.children.push(t),t}});return Kl.set(n.id,r),r}var Jl=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},Yl=(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}),Xl=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()}},Zl=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 Xl(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=N(`EDEADLK`);throw e.stack+=r?.slice(5),R(e)}},e),await t?.done(),n}lockSync(){if(this.currentLock?.isLocked)throw R(N(`EBUSY`));return this.addLock()}get isLocked(){return!!this.currentLock?.isLocked}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{Jl(n,await this.lock(),!1),await this._fs.rename(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.renameSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,await this.lock(),!1),await this._fs.stat(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,this.lockSync(),!1),this._fs.statSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{Jl(n,await this.lock(),!1),await this._fs.touch(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{Jl(n,this.lockSync(),!1),this._fs.touchSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async createFile(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,await this.lock(),!1),await this._fs.createFile(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}createFileSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.createFileSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async unlink(e){let t={stack:[],error:void 0,hasError:!1};try{Jl(t,await this.lock(),!1),await this._fs.unlink(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}unlinkSync(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,this.lockSync(),!1),this._fs.unlinkSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}async rmdir(e){let t={stack:[],error:void 0,hasError:!1};try{Jl(t,await this.lock(),!1),await this._fs.rmdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}rmdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,this.lockSync(),!1),this._fs.rmdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}async mkdir(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,await this.lock(),!1),await this._fs.mkdir(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}mkdirSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.mkdirSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,await this.lock(),!1),await this._fs.readdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,this.lockSync(),!1),this._fs.readdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}async exists(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,await this.lock(),!1),await this._fs.exists(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}existsSync(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,this.lockSync(),!1),this._fs.existsSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{Jl(n,await this.lock(),!1),await this._fs.link(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.linkSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async sync(){let e={stack:[],error:void 0,hasError:!1};try{Jl(e,await this.lock(),!1),await this._fs.sync()}catch(t){e.error=t,e.hasError=!0}finally{Yl(e)}}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{return Jl(e,this.lockSync(),!1),this._fs.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{Yl(e)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return Jl(i,await this.lock(),!1),await this._fs.read(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Yl(i)}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return Jl(i,this.lockSync(),!1),this._fs.readSync(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Yl(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return Jl(r,await this.lock(),!1),await this._fs.write(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Yl(r)}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return Jl(r,this.lockSync(),!1),this._fs.writeSync(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Yl(r)}}streamRead(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.streamRead(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}streamWrite(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.streamWrite(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async ioctl(e,t,...n){let r={stack:[],error:void 0,hasError:!1};try{return Jl(r,await this.lock(),!1),await this._fs.ioctl({...e,fs:this._fs},t,...n)}catch(e){r.error=e,r.hasError=!0}finally{Yl(r)}}ioctlSync(e,t,...n){let r={stack:[],error:void 0,hasError:!1};try{return Jl(r,this.lockSync(),!1),this._fs.ioctlSync({...e,fs:this._fs},t,...n)}catch(e){r.error=e,r.hasError=!0}finally{Yl(r)}}};function Ql(e){class t extends Zl{constructor(...t){super(),this._fs=new e(...t)}}return t}function $l(e){class t extends e{constructor(...e){super(...e),this.attributes.set(`no_write`)}async rename(){throw N(`EROFS`)}renameSync(){throw N(`EROFS`)}async createFile(){throw N(`EROFS`)}createFileSync(){throw N(`EROFS`)}async unlink(){throw N(`EROFS`)}unlinkSync(){throw N(`EROFS`)}async rmdir(){throw N(`EROFS`)}rmdirSync(){throw N(`EROFS`)}async mkdir(){throw N(`EROFS`)}mkdirSync(){throw N(`EROFS`)}async link(){throw N(`EROFS`)}linkSync(){throw N(`EROFS`)}async touch(){throw N(`EROFS`)}touchSync(){throw N(`EROFS`)}async sync(){throw N(`EROFS`)}syncSync(){throw N(`EROFS`)}async write(){throw N(`EROFS`)}writeSync(){throw N(`EROFS`)}streamWrite(){throw N(`EROFS`)}}return t}function eu(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)}async ioctl(e,t,...n){return this.ioctlSync(e,t,...n)}}return t}async function tu(e,t,...n){let r,i,a;if(typeof e==`number`)a=Xr(this,e),r=Z(a.fs),i=a.vnode,i.refs++;else{e=H.call(this,e);let t=await ja(this,e,!1,{syscall:`ioctl`,path:e});if(!t.stats)throw M(`ENOENT`,{syscall:`ioctl`,path:e});r=Z(t.fs),i=r.ref(t.path,r.get(t.path)?.inode??t.stats)}let o={fs:i.fs,inode:i.inode,path:i.path,file:a};try{return await i.fs.ioctl(o,t,...n)}catch(t){throw A(Object.assign(t,{syscall:`ioctl`,path:e}))}finally{r.unref(i)}}function nu(e,t,...n){let r,i,a;if(typeof e==`number`)a=Xr(this,e),r=Z(a.fs),i=a.vnode,i.refs++;else{e=H.call(this,e);let t=_i(this,e,!1,{syscall:`ioctl`,path:e});if(!t.stats)throw M(`ENOENT`,{syscall:`ioctl`,path:e});r=Z(t.fs),i=r.ref(t.path,r.get(t.path)?.inode??t.stats)}let o={fs:i.fs,inode:i.inode,path:i.path,file:a};try{return i.fs.ioctlSync(o,t,...n)}catch(t){throw A(Object.assign(t,{syscall:`ioctl`,path:e}))}finally{r.unref(i)}}var ru={name:`@zenfs/core`,version:`2.7.1`,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`,`fs`,`browser`],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`,"./*.js":`./dist/*.js`,"./*":`./dist/*.js`,"./emulation/*":`./dist/node/*`,"./promises":`./dist/node/promises.js`,"./readline":`./dist/node/readline.js`,"./eslint":`./eslint.shared.js`,"./tests/*.ts":`./tests/*.ts`,"./tests/*.js":`./tests/*.js`,"./tests/*":`./tests/*.js`,"./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 -s zenfs-test --clean; npx -s zenfs-test -abcpn; tests/fetch/run.sh; npx -s zenfs-test --report-only`,"test:native":`npx -s zenfs-test tests/native-setup.ts --verbose`,build:`tsc -p tsconfig.json`,"build:docs":`typedoc`,dev:`tsc -p tsconfig.json --watch`,prepublishOnly:`npm run build`},dependencies:{"@types/node":`^26.0.0`,buffer:`^6.0.3`,eventemitter3:`^5.0.1`,kerium:`^1.4.2`,memium:`^1.0.0`,"readable-stream":`^4.5.2`,utilium:`^3.0.0`},devDependencies:{"@eslint/js":`^10.0.1`,"@octokit/action":`^8.0.4`,c8:`^12.0.0`,eslint:`^10.1.0`,globals:`^17.3.0`,prettier:`^3.2.5`,typedoc:`^0.28.18`,typescript:`^6.0.0`,"typescript-eslint":`^8.58.0`},prettier:{singleQuote:!0,useTabs:!0,trailingComma:`es5`,tabWidth:4,printWidth:150,arrowParens:`avoid`,experimentalOperatorPosition:`start`}},iu=t({BigIntStatsFs:()=>Fn,Dir:()=>Di,Dirent:()=>Ti,ReadStream:()=>yo,Stats:()=>jn,StatsFs:()=>Pn,Utf8Stream:()=>Nl,WriteStream:()=>bo,_version:()=>au,access:()=>ol,accessSync:()=>ua,appendFile:()=>Ic,appendFileSync:()=>Bi,chmod:()=>tl,chmodSync:()=>aa,chown:()=>$c,chownSync:()=>ra,chroot:()=>fi,close:()=>Rc,closeSync:()=>Hi,constants:()=>He,copyFile:()=>hl,copyFileSync:()=>ma,cp:()=>yl,cpSync:()=>va,createReadStream:()=>dl,createWriteStream:()=>fl,exists:()=>Oc,existsSync:()=>ji,fchmod:()=>Gc,fchmodSync:()=>Yi,fchown:()=>Wc,fchownSync:()=>Ji,fdatasync:()=>Vc,fdatasyncSync:()=>Gi,fstat:()=>Lc,fstatSync:()=>Vi,fsync:()=>Bc,fsyncSync:()=>Wi,ftruncate:()=>zc,ftruncateSync:()=>Ui,futimes:()=>Kc,futimesSync:()=>Xi,glob:()=>Sl,globSync:()=>ba,ioctl:()=>tu,ioctlSync:()=>nu,lchmod:()=>nl,lchmodSync:()=>oa,lchown:()=>el,lchownSync:()=>ia,link:()=>Xc,linkSync:()=>ea,lopenSync:()=>Li,lstat:()=>Ac,lstatSync:()=>Ni,lutimes:()=>il,lutimesSync:()=>ca,mkdir:()=>Jc,mkdirSync:()=>Qi,mkdtemp:()=>ml,mkdtempDisposableSync:()=>pa,mkdtempSync:()=>fa,mount:()=>ci,open:()=>Nc,openAsBlob:()=>xl,openSync:()=>Ii,opendir:()=>vl,opendirSync:()=>_a,promises:()=>xo,read:()=>Uc,readFile:()=>Pc,readFileSync:()=>Ri,readSync:()=>qi,readdir:()=>Yc,readdirSync:()=>$i,readlink:()=>Qc,readlinkSync:()=>na,readv:()=>gl,readvSync:()=>ha,realpath:()=>al,realpathSync:()=>la,rename:()=>Dc,renameSync:()=>Ai,rm:()=>pl,rmSync:()=>da,rmdir:()=>qc,rmdirSync:()=>Zi,stat:()=>kc,statSync:()=>Mi,statfs:()=>bl,statfsSync:()=>ya,symlink:()=>Zc,symlinkSync:()=>ta,truncate:()=>jc,truncateSync:()=>Pi,umount:()=>li,unlink:()=>Mc,unlinkSync:()=>Fi,unwatchFile:()=>ll,utimes:()=>rl,utimesSync:()=>sa,watch:()=>ul,watchFile:()=>cl,write:()=>Hc,writeFile:()=>Fc,writeFileSync:()=>zi,writeSync:()=>Ki,writev:()=>_l,writevSync:()=>ga,xattr:()=>Fl});const au=ru.version;var ou=t({DirType:()=>Or,Dirent:()=>jr,Handle:()=>Jr,chroot:()=>fi,deleteFD:()=>Zr,dtToIf:()=>Ar,dupFD:()=>Qr,fromFD:()=>Xr,ifToDt:()=>kr,ioctl:()=>tu,ioctlSync:()=>nu,link:()=>La,mkdir:()=>Pa,mount:()=>ci,open:()=>Ma,readdir:()=>Fa,readlink:()=>Na,rename:()=>Ia,resolve:()=>ja,stat:()=>Ra,sync:()=>mi,toFD:()=>Yr,umount:()=>li,xattr:()=>Fl}),su=t({Async:()=>oc,AsyncMapTransaction:()=>gr,AsyncTransaction:()=>ur,Attributes:()=>zn,BigIntStatsFs:()=>Fn,CopyOnWrite:()=>Es,CopyOnWriteFS:()=>Ts,DeviceFS:()=>yr,Dir:()=>Di,Dirent:()=>Ti,ErrnoError:()=>ri,Fetch:()=>Is,FetchFS:()=>Fs,FileSystem:()=>sr,InMemory:()=>vr,InMemoryStore:()=>_r,Index:()=>Yn,IndexFS:()=>Ns,Inode:()=>K,InodeFlags:()=>Vn,Journal:()=>ws,MetadataBlock:()=>vc,MutexLock:()=>Xl,Mutexed:()=>Ql,Passthrough:()=>Bs,PassthroughFS:()=>zs,Port:()=>uc,PortFS:()=>sc,RPC:()=>Vs,ReadStream:()=>yo,Readonly:()=>$l,SingleBuffer:()=>Tc,SingleBufferStore:()=>wc,Stats:()=>jn,StatsFs:()=>Pn,StoreFS:()=>mr,SuperBlock:()=>bc,Sync:()=>eu,SyncMapTransaction:()=>hr,SyncTransaction:()=>lr,Transaction:()=>cr,Utf8Stream:()=>Nl,WrappedTransaction:()=>dr,WriteStream:()=>bo,_MutexedFS:()=>Zl,_asyncFSKeys:()=>ac,_chown:()=>Jn,_fnOpt:()=>ke,_inode_fields:()=>Bn,_inode_version:()=>5,_isNoEntry:()=>ln,_tempDirName:()=>mn,_temporal:()=>hn,_version:()=>au,access:()=>ol,accessSync:()=>ua,addDevice:()=>hs,appendFile:()=>Ic,appendFileSync:()=>Bi,assertContext:()=>Le,attachFS:()=>cc,bindContext:()=>ql,boundContexts:()=>Kl,checkOptions:()=>je,chmod:()=>tl,chmodSync:()=>aa,chown:()=>$c,chownSync:()=>ra,chroot:()=>fi,close:()=>Rc,closeSync:()=>Hi,configure:()=>_s,configureFileSystem:()=>os,configureSingle:()=>ds,configureSingleSync:()=>fs,configureSync:()=>vs,constants:()=>He,contextOf:()=>ze,copyFile:()=>hl,copyFileSync:()=>ma,cp:()=>yl,cpSync:()=>va,createChildContext:()=>Ve,createCredentials:()=>Ne,createReadStream:()=>dl,createWriteStream:()=>fl,credentialsAllowRoot:()=>Pe,decodeDirListing:()=>rn,default:()=>cu,defaultContext:()=>Re,detachFS:()=>lc,devices:()=>Er,encodeDirListing:()=>an,exists:()=>Oc,existsSync:()=>ji,fchmod:()=>Gc,fchmodSync:()=>Yi,fchown:()=>Wc,fchownSync:()=>Ji,fdatasync:()=>Vc,fdatasyncSync:()=>Gi,fs:()=>iu,fstat:()=>Lc,fstatSync:()=>Vi,fsync:()=>Bc,fsyncSync:()=>Wi,ftruncate:()=>zc,ftruncateSync:()=>Ui,fullDevice:()=>Cr,futimes:()=>Kc,futimesSync:()=>Xi,glob:()=>Sl,globSync:()=>ba,globToRegex:()=>fn,hasAccess:()=>J,ioctl:()=>tu,ioctlSync:()=>nu,isBackend:()=>Oe,isBackendConfig:()=>Me,isBlockDevice:()=>Gn,isCharacterDevice:()=>Kn,isContext:()=>Ie,isDirectory:()=>q,isFIFO:()=>qn,isFile:()=>Hn,isSocket:()=>Wn,isSymbolicLink:()=>Un,lchmod:()=>nl,lchmodSync:()=>oa,lchown:()=>el,lchownSync:()=>ia,link:()=>Xc,linkSync:()=>ea,log:()=>ie,lopenSync:()=>Li,lstat:()=>Ac,lstatSync:()=>Ni,lutimes:()=>il,lutimesSync:()=>ca,mkdir:()=>Jc,mkdirSync:()=>Qi,mkdtemp:()=>ml,mkdtempDisposableSync:()=>pa,mkdtempSync:()=>fa,mount:()=>ci,mounts:()=>si,normalizeMode:()=>on,normalizeOptions:()=>dn,normalizePath:()=>H,normalizeTime:()=>un,nullDevice:()=>xr,open:()=>Nc,openAsBlob:()=>xl,openSync:()=>Ii,opendir:()=>vl,opendirSync:()=>_a,promises:()=>xo,randomDevice:()=>wr,read:()=>Uc,readFile:()=>Pc,readFileSync:()=>Ri,readSync:()=>qi,readdir:()=>Yc,readdirSync:()=>$i,readlink:()=>Qc,readlinkSync:()=>na,readv:()=>gl,readvSync:()=>ha,realpath:()=>al,realpathSync:()=>la,rename:()=>Dc,renameSync:()=>Ai,resolveMountConfig:()=>ls,resolveMountConfigSync:()=>us,resolveRemoteMount:()=>dc,rm:()=>pl,rmSync:()=>da,rmdir:()=>qc,rmdirSync:()=>Zi,rootIno:()=>0,stat:()=>kc,statSync:()=>Mi,statfs:()=>bl,statfsSync:()=>ya,symlink:()=>Zc,symlinkSync:()=>ta,sync:()=>ys,truncate:()=>jc,truncateSync:()=>Pi,umount:()=>li,unlink:()=>Mc,unlinkSync:()=>Fi,unwatchFile:()=>ll,userModifiableFlags:()=>229631,userVisibleFlags:()=>253951,utimes:()=>rl,utimesSync:()=>sa,validateFD:()=>cn,version:()=>1,vfs:()=>ou,waitOnline:()=>pn,watch:()=>ul,watchFile:()=>cl,withExceptionContext:()=>oi,withPath:()=>ii,wrap:()=>ai,write:()=>Hc,writeFile:()=>Fc,writeFileSync:()=>zi,writeSync:()=>Ki,writev:()=>_l,writevSync:()=>ga,xattr:()=>Fl,zeroDevice:()=>Sr}),cu=iu
|
|
12
|
+
`);for(let e of this.items)e.offset&&(t+=`\n\t${hc(e.id)}: ${gc(e.size).padStart(5)} at ${hc(e.offset)}`);return t}#i=(Q(this,b),Q(this,S,void 0));get locked(){return this.#i}set locked(e){this.#i=e}waitUnlocked(e=0){if(e>5)throw ue(N(`EBUSY`,`sbfs: exceeded max attempts waiting for metadata block at ${hc(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++,R(`sbfs: waiting for metadata block at ${hc(this.byteOffset)} to be unlocked (${e}/5)`),this.waitUnlocked(e);case`timed-out`:throw ue(N(`EBUSY`,`sbfs: timed out waiting for metadata block at ${hc(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),Q(this,C)}static{Q(s,o)}};return w=s})();Object.assign(vc,{lockIndex:Gt(vc,`locked`)/Int32Array.BYTES_PER_ELEMENT});const yc=1651715706;let bc=(()=>{var e,t,n,r,i,a,o,s,c,l;let u=[Xt.packed()],d,f=[],p,m=$t.typed(BigUint64Array),h,g=[],_=[],v,y=[],b=[],x,S=[],C=[],w,T=[],ee=[],te,ne=[],re=[],E,O=[],k=[],A,j=[],M=[],P,ie=[],F=[],I,ae=[],L=[],oe,se=[],ce=[],le,de=[],fe=[],me,he=[],ge=[],_e,ve=[],ye=[];var be=class extends m{static{p=this}static{let D=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)],te=[(i=V).uint32.bind(i)],E=[(a=V).uint64.bind(a)],A=[(o=V).uint64.bind(o)],P=[V.uint8(16)],I=[(s=V).uint32.bind(s)],oe=[(c=V).uint32.bind(c)],le=[(l=V).uint32.bind(l)],me=[V.char(64)],_e=[V.char(132)],fc(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:D},g,_),fc(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:D},y,b),fc(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:D},S,C),fc(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:D},T,ee),fc(this,null,te,{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:D},ne,re),fc(this,null,E,{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:D},O,k),fc(this,null,A,{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:D},j,M),fc(this,null,P,{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:D},ie,F),fc(this,null,I,{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:D},ae,L),fc(this,null,oe,{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:D},se,ce),fc(this,null,le,{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:D},de,fe),fc(this,null,me,{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:D},he,ge),fc(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:D},ve,ye),fc(null,d={value:p},u,{kind:`class`,name:p.name,metadata:D},null,f),be=p=d.value,D&&Object.defineProperty(p,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:D})}static name=`SuperBlock`;constructor(...e){if(super(...e),Q(this,ye),this.magic!=yc){z(`sbfs: Invalid magic value, assuming this is a fresh super block`);let e=new vc(this.buffer,B(be));Object.assign(this,{metadata:e,metadata_offset:e.byteOffset,used_bytes:BigInt(B(be)+B(vc)),total_bytes:BigInt(this.buffer.byteLength),magic:yc,version:1,inode_format:5,metadata_block_size:B(vc),uuid:D(crypto.randomUUID())}),Cc(this),Cc(e);return}if(this.checksum!==Sc(this))throw ue(N(`EIO`,`sbfs: checksum mismatch for super block`));if(this.metadata=new vc(this.buffer,this.metadata_offset),this.metadata.checksum!==Sc(this.metadata))throw ue(N(`EIO`,`sbfs: checksum mismatch for metadata block (saved ${hc(this.metadata.checksum)}, computed ${hc(Sc(this.metadata))})`));if(this.inode_format!=5)throw ue(N(`EIO`,`sbfs: inode format mismatch`));if(this.metadata_block_size!=B(vc))throw ue(N(`EIO`,`sbfs: metadata block size mismatch`))}#e=Q(this,g,void 0);get checksum(){return this.#e}set checksum(e){this.#e=e}#t=(Q(this,_),Q(this,y,void 0));get magic(){return this.#t}set magic(e){this.#t=e}#n=(Q(this,b),Q(this,S,void 0));get version(){return this.#n}set version(e){this.#n=e}#r=(Q(this,C),Q(this,T,void 0));get inode_format(){return this.#r}set inode_format(e){this.#r=e}#i=(Q(this,ee),Q(this,ne,void 0));get flags(){return this.#i}set flags(e){this.#i=e}#a=(Q(this,re),Q(this,O,void 0));get used_bytes(){return this.#a}set used_bytes(e){this.#a=e}#o=(Q(this,k),Q(this,j,void 0));get total_bytes(){return this.#o}set total_bytes(e){this.#o=e}#s=(Q(this,M),Q(this,ie,void 0));get uuid(){return this.#s}set uuid(e){this.#s=e}#c=(Q(this,F),Q(this,ae,void 0));get metadata_block_size(){return this.#c}set metadata_block_size(e){this.#c=e}#l=(Q(this,L),Q(this,se,void 0));get metadata_offset_(){return this.#l}set metadata_offset_(e){this.#l=e}#u=(Q(this,ce),Q(this,de,void 0));get metadata_offset(){return this.#u}set metadata_offset(e){this.#u=e}metadata=Q(this,fe);#d=Q(this,he,void 0);get label(){return this.#d}set label(e){this.#d=e}#f=(Q(this,ge),Q(this,ve,void 0));get _padding(){return this.#f}set _padding(e){this.#f=e}rotateMetadata(){let e=BigInt(Int32Array.BYTES_PER_ELEMENT),t=BigInt(B(vc)),n=Atomics.load(this,2),r;for(;;){let i=(e-n%e)%e;r=n+i;let a=r+t;if(a>this.total_bytes)throw R(N(`ENOSPC`,`sbfs: not enough space for a new metadata block`));let o=Atomics.compareExchange(this,2,n,a);if(o===n)break;n=o}let i=new vc(this.buffer,Number(r)),a=new Uint32Array(this.buffer,this.byteOffset,B(be)/Uint32Array.BYTES_PER_ELEMENT),o=Atomics.load(a,xc);for(;;){i.previous_offset=o,Cc(i);let e=Atomics.compareExchange(a,xc,o,i.byteOffset);if(e===o)break;o=e}return this.metadata=i,Cc(this),pe(`sbfs: rotated metadata block at ${hc(i.previous_offset)} with new block at ${hc(i.byteOffset)}`),i}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(vc)&&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{Q(p,f)}};return be=p})();const xc=Gt(bc,`metadata_offset`)/Uint32Array.BYTES_PER_ELEMENT;function Sc(e){let t=B(e)-4;return e instanceof vc&&(t-=Int32Array.BYTES_PER_ELEMENT),l(new Uint8Array(e.buffer,e.byteOffset+4,t))}function Cc(e){e instanceof vc&&(e.timestamp=BigInt(Date.now())),e.checksum=Sc(e)}var wc=class extends o{flags=[];name=`sbfs`;type=1935828595;get uuid(){return E(this.superblock.uuid)}superblock;_view;_u8;constructor(...e){if(super(...e),this.byteLength<B(bc)+B(vc))throw ue(N(`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 bc(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 le(N(`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(pc(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,2,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{mc(i)}}}let r=Array.from(this.superblock.metadata.items).find(e=>!e.offset);r||=(this.superblock.rotateMetadata(),this.superblock.metadata.items[0]),pc(n,this.superblock.metadata.lock(),!1);let i=Number(Atomics.add(this.superblock,2,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{mc(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 hr(this)}};const Tc={name:`SingleBuffer`,options:{buffer:{type:`object`,required:!0}},create(e){let t=new mr(ArrayBuffer.isView(e.buffer)?new wc(e.buffer.buffer,e.buffer.byteOffset,e.buffer.byteLength):new wc(e.buffer));return t.checkRootSync(),t}},$=()=>{};async function Ec(e){let t=[];for await(let n of e)t.push(n);return t}function Dc(e,t,n=$){Do.call(this,e,t).then(()=>n(null)).catch(n)}function Oc(e,t=$){Oo.call(this,e).then(t).catch(()=>t(!1))}function kc(e,t,n=$){n=typeof t==`function`?t:n,ko.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function Ac(e,t,n=$){n=typeof t==`function`?t:n,Ao.call(this,e,typeof t==`function`?{}:t).then(e=>n(null,e)).catch(n)}function jc(e,t=0,n=$){n=typeof t==`function`?t:n;let r=typeof t==`number`?t:0;jo.call(this,e,r).then(()=>n(null)).catch(n)}function Mc(e,t=$){Mo.call(this,e).then(()=>t(null)).catch(t)}function Nc(e,t,n,r=$){let i=on(n,420);r=typeof n==`function`?n:r,No.call(this,e,t,i).then(e=>r(null,e.fd)).catch(r)}function Pc(e,t,n=$){n=typeof t==`function`?t:n,Po.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function Fc(e,t,n,r=$){r=typeof n==`function`?n:r,Fo.call(this,e,t,typeof n==`function`?null:n).then(()=>r(null)).catch(r)}function Ic(e,t,n,r=$){let i=typeof n==`function`?void 0:n;r=typeof n==`function`?n:r,Io.call(this,e,t,i).then(()=>r(null)).catch(r)}function Lc(e,t,n=$){n=typeof t==`function`?t:n,new Eo(this,e).stat().then(e=>n(null,typeof t==`object`&&t?.bigint?new Mn(e):e)).catch(n)}function Rc(e,t=$){new Eo(this,e).close().then(()=>t(null)).catch(t)}function zc(e,t,n=$){let r=typeof t==`number`?t:0;n=typeof t==`function`?t:n;let i=new Eo(this,e);if(r<0)throw N(`EINVAL`);i.truncate(r).then(()=>n(null)).catch(n)}function Bc(e,t=$){new Eo(this,e).sync().then(()=>t(null)).catch(t)}function Vc(e,t=$){new Eo(this,e).datasync().then(()=>t(null)).catch(t)}function Hc(e,t,n,r,i,a=$){let o,s,c,l,u,d=new Eo(this,e),f=[n,r,i].find(e=>typeof e==`function`)??a;typeof t==`string`?(l=typeof n==`number`?n:null,u=typeof r==`string`?r:`utf8`,o=Y.Buffer.from(t,u),s=0,c=o.byteLength):(o=Y.Buffer.from(t.buffer,t.byteOffset,t.byteLength),s=typeof n==`number`?n:0,c=typeof r==`number`?r:o.byteLength-s,l=typeof i==`number`?i:null),d.write(o,s,c,l).then(({bytesWritten:e})=>f(null,e,typeof t==`string`?t:o)).catch(f)}function Uc(e,t,n,r,i,a=$){new Eo(this,e).read(t,n,r,i).then(({bytesRead:e,buffer:t})=>a(null,e,t)).catch(a)}function Wc(e,t,n,r=$){new Eo(this,e).chown(t,n).then(()=>r(null)).catch(r)}function Gc(e,t,n){new Eo(this,e).chmod(t).then(()=>n(null)).catch(n)}function Kc(e,t,n,r=$){new Eo(this,e).utimes(t,n).then(()=>r(null)).catch(r)}function qc(e,t=$){Lo.call(this,e).then(()=>t(null)).catch(t)}function Jc(e,t,n=$){Ro.call(this,e,t).then(()=>n(null)).catch(n)}function Yc(e,t,n=$){n=typeof t==`function`?t:n;let r=typeof t==`function`?{}:t;zo.call(this,e,r).then(e=>n(null,e)).catch(n)}function Xc(e,t,n=$){Bo.call(this,e,t).then(()=>n(null)).catch(n)}function Zc(e,t,n,r=$){let i=typeof n==`string`?n:`file`;r=typeof n==`function`?n:r,Vo.call(this,e,t,i).then(()=>r(null)).catch(r)}function Qc(e,t,n=$){n=typeof t==`function`?t:n,Ho.call(this,e).then(e=>n(null,e)).catch(n)}function $c(e,t,n,r=$){Uo.call(this,e,t,n).then(()=>r(null)).catch(r)}function el(e,t,n,r=$){Wo.call(this,e,t,n).then(()=>r(null)).catch(r)}function tl(e,t,n=$){Go.call(this,e,t).then(()=>n(null)).catch(n)}function nl(e,t,n=$){Ko.call(this,e,t).then(()=>n(null)).catch(n)}function rl(e,t,n,r=$){qo.call(this,e,t,n).then(()=>r(null)).catch(r)}function il(e,t,n,r=$){Jo.call(this,e,t,n).then(()=>r(null)).catch(r)}function al(e,t,n=$){n=typeof t==`function`?t:n,Yo.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function ol(e,t,n=$){let r=typeof t==`number`?t:4;n=typeof t==`function`?t:n,Zo.call(this,e,r).then(()=>n(null)).catch(n)}const sl=new Map;function cl(e,t,n){let r=H.call(this,e),i=typeof t==`function`?{}:t;if(typeof t==`function`&&(n=t),!n)throw M(`EINVAL`,`watch`,e.toString());if(sl.has(r)){let e=sl.get(r);e&&e.listeners.add(n);return}let a=new wa(this,r,i);a.on(`change`,(e,t)=>{let n=sl.get(r);if(n)for(let r of n.listeners)r(e,t)}),sl.set(r,{watcher:a,listeners:new Set([n])})}function ll(e,t=$){let n=H.call(this,e),r=sl.get(n);r&&(t&&t!==$?r.listeners.delete(t):r.listeners.clear(),r.listeners.size===0&&(r.watcher.stop(),sl.delete(n)))}function ul(e,t,n){let r=new Ca(this,H.call(this,e),typeof t==`object`?t:{});return n=typeof t==`function`?t:n,r.on(`change`,n||$),r}function dl(e,t){t=typeof t==`object`?t:{encoding:t};let n=No.call(this,e,`r`,t?.mode);return new yo({...t,autoClose:!0},n)}function fl(e,t){t=typeof t==`object`?t:{encoding:t};let n=No.call(this,e,`w`,t?.mode);return new bo(t,n)}function pl(e,t,n=$){n=typeof t==`function`?t:n,Qo.call(this,e,typeof t==`function`?void 0:t).then(()=>n(null)).catch(n)}function ml(e,t,n=$){n=typeof t==`function`?t:n,$o.call(this,e,typeof t==`function`?null:t).then(e=>n(null,e)).catch(n)}function hl(e,t,n,r=$){r=typeof n==`function`?n:r,ts.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function gl(e,t,n,r=$){r=typeof n==`function`?n:r,new Eo(this,e).readv(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesRead:t})=>r(null,t,e)).catch(r)}function _l(e,t,n,r=$){r=typeof n==`function`?n:r,new Eo(this,e).writev(t,typeof n==`function`?void 0:n).then(({buffers:e,bytesWritten:t})=>r(null,t,e)).catch(r)}function vl(e,t,n=$){n=typeof t==`function`?t:n,ns.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}function yl(e,t,n,r=$){r=typeof n==`function`?n:r,rs.call(this,e,t,typeof n==`function`?void 0:n).then(()=>r(null)).catch(r)}function bl(e,t,n=$){n=typeof t==`function`?t:n,is.call(this,e,typeof t==`function`?void 0:t).then(e=>n(null,e)).catch(n)}async function xl(e,t){let n=await No.call(this,e.toString(),`r`),r=await n.readFile();return await n.close(),new Blob([r],t)}function Sl(e,t,n=$){n=typeof t==`function`?t:n,Ec(as.call(this,e,typeof t==`function`?void 0:t)).then(e=>n(null,e??[])).catch(e=>n(e))}function Cl(e,t){return Object.assign(Error(t),{code:e})}function wl(e,t,n){return Cl(`ERR_INVALID_ARG_TYPE`,`The "${e}" argument must be of type ${t}. Received ${typeof n}`)}function Tl(e){return Cl(`ERR_INVALID_STATE`,`Invalid state: `+e)}function El(e,t){if(typeof e!=`number`)throw wl(t,`number`,e);if(!Number.isInteger(e)||e<0||e>4294967295)throw Cl(`ERR_OUT_OF_RANGE`,`The value of "${t}" is out of range. It must be an integer >= 0 and <= 4294967295. Received ${e}`)}const Dl=16384,Ol=Y.Buffer.alloc(0),kl={open:Nc,openSync:Ii,close:Rc,write:Hc,writeSync:Ki,fsync:Bc,fsyncSync:Wi,mkdir:Jc,mkdirSync:Qi};function Al(e,t,n){if(typeof e==`string`){if(Y.Buffer.byteLength(e)===n)n=e.length;else{let t=Y.Buffer.from(e);for(;n>0&&(t[n]&192)==128;)n--;n=t.subarray(0,n).toString().length}}return{writingBuf:e.slice(n),len:Math.max(t-n,0)}}function jl(e,t){return e.length?e.length==1?e[0]:Y.Buffer.concat(e,t):Ol}const Ml=Symbol(`Utf8StreamFS`);var Nl=class extends u.default{#e=0;#t=-1;#n=[];#r=[];#i=!1;#a=!1;#o=!1;#s=!1;#c=!1;#l=16387;#u=null;#d=!1;#f=0;#p=0;#m=Dl;#h=!1;#g=0;#_;#v=!1;#y=!1;#b=!0;#x;#S=()=>!0;#C=!1;#w;#T=``;#E;static[Ml]=kl;static _withContext(e){Le(e);class t extends Nl{static[Ml]=_(kl,e)}return t}constructor(e={}){if(typeof e!=`object`||!e)throw wl(`options`,`object`,e);let{dest:t,minLength:n,maxLength:r,maxWrite:i,periodicFlush:a,sync:o,append:s=!0,mkdir:c,retryEAGAIN:l,fsync:u,contentMode:d=`utf8`,mode:f,fs:p={}}=e;super();let m=e.fd??t;if(typeof p!=`object`||!p)throw wl(`options.fs`,`object`,p);this.#E={...this.constructor[Ml],...p};let h=this.#E;for(let e of[`write`,`writeSync`,`fsync`,`fsyncSync`,`close`,`open`,`mkdir`,`mkdirSync`])if(typeof h[e]!=`function`)throw wl(`options.fs.${e}`,`function`,h[e]);this.#l=Math.max(n||0,this.#l),this.#f=n||0,this.#p=r||0,this.#m=i||Dl,this.#g=a||0,this.#v=o||!1,this.#y=u||!1,this.#b=s||!1,this.#x=f,this.#S=l||(()=>!0),this.#C=c||!1,El(this.#l,`options.hwm`),El(this.#f,`options.minLength`),El(this.#p,`options.maxLength`),El(this.#m,`options.maxWrite`),El(this.#g,`options.periodicFlush`);for(let[e,t]of[[`sync`,this.#v],[`fsync`,this.#y],[`append`,this.#b],[`mkdir`,this.#C]])if(typeof t!=`boolean`)throw wl(`options.${e}`,`boolean`,t);if(typeof this.#S!=`function`)throw wl(`options.retryEAGAIN`,`function`,this.#S);if(d!=`buffer`&&d!=`utf8`)throw Cl(`ERR_INVALID_ARG_VALUE`,`The property 'options.contentMode' must be one of: 'buffer', 'utf8'. Received ${JSON.stringify(d)}`);if(this.#w=d,this.#T=d==`buffer`?Ol:``,typeof m==`number`)this.#t=m,queueMicrotask(()=>this.emit(`ready`));else if(typeof m==`string`)this.#N(m);else throw wl(`fd`,`number or string`,m);if(this.#f>=this.#m)throw Cl(`ERR_INVALID_ARG_VALUE`,`The argument 'minLength' should be smaller than maxWrite (${this.#m}). Received ${this.#f}`);this.#g!==0&&(this.#_=setInterval(()=>this.flush(),this.#g),this.#_.unref?.())}write(e){if(this.#d)throw Tl(`Utf8Stream is destroyed`);if(this.#w==`buffer`){if(!Y.Buffer.isBuffer(e))throw wl(`data`,`Buffer`,e)}else if(typeof e!=`string`)throw wl(`data`,`string`,e);let t=this.#e+e.length;if(this.#p&&t>this.#p)return this.emit(`drop`,e),this.#e<this.#l;let n=this.#n.length-1;if(this.#w==`buffer`){let t=this.#n;!t.length||this.#r[n]+e.length>this.#m?(t.push([e]),this.#r.push(e.length)):(t[n].push(e),this.#r[n]+=e.length)}else{let t=this.#n;!t.length||t[n].length+e.length>this.#m?t.push(e):t[n]+=e}return this.#e=t,!this.#i&&this.#e>=this.#f&&this.#F(),this.#e<this.#l}flush(e){if(e!=null&&typeof e!=`function`)throw wl(`cb`,`function`,e);if(this.#d){let t=Tl(`Utf8Stream is destroyed`);if(!e)throw t;e(t);return}if(this.#f<=0){e?.(null);return}e&&this.#I(e),!this.#i&&(this.#n.length||(this.#n.push(this.#w==`buffer`?[]:``),this.#w==`buffer`&&this.#r.push(0)),this.#F())}flushSync(){if(this.#d)throw Tl(`Utf8Stream is destroyed`);if(this.#t<0)throw Tl(`Invalid file descriptor`);this.#w==`buffer`?this.#D():this.#O()}#D(){let e=this.#n;!this.#i&&this.#T.length>0&&(e.unshift([this.#T]),this.#T=Ol);let t=Ol;for(;e.length||t.length;){t.length<=0&&(t=jl(e[0],this.#r[0]));let n=this.#E.writeSync(this.#t,t);t=t.subarray(n),this.#e=Math.max(this.#e-n,0),t.length<=0&&(e.shift(),this.#r.shift())}}#O(){let e=this.#n;!this.#i&&this.#T.length>0&&(e.unshift(this.#T),this.#T=``);let t=``;for(;e.length||t;){t.length<=0&&(t=e[0]);let n=this.#E.writeSync(this.#t,t,`utf8`),r=Al(t,this.#e,n);t=r.writingBuf,this.#e=r.len,t.length<=0&&e.shift()}try{this.#E.fsyncSync(this.#t)}catch{}}reopen(e){if(this.#d)throw Tl(`Utf8Stream is destroyed`);if(this.#h){this.once(`ready`,()=>this.reopen(e));return}if(this.#a)return;if(!this.#u)throw Cl(`ERR_OPERATION_FAILED`,`Unable to reopen a file descriptor, you must pass a file to Utf8Stream`);if(e&&(this.#u=e.toString()),this.#o=!0,this.#i)return;let t=this.#t;this.once(`ready`,()=>{t!==this.#t&&this.#E.close(t,e=>{e&&this.emit(`error`,e)})}),this.#N(this.#u)}end(){if(this.#d)throw Tl(`Utf8Stream is destroyed`);if(this.#h){this.once(`ready`,()=>this.end());return}this.#a||(this.#a=!0,!this.#i&&(this.#e>0&&this.#t>=0?this.#F():this.#P()))}destroy(){this.#d||this.#P()}get mode(){return this.#x}get file(){return this.#u}get fd(){return this.#t}get minLength(){return this.#f}get maxLength(){return this.#p}get writing(){return this.#i}get sync(){return this.#v}get fsync(){return this.#y}get append(){return this.#b}get periodicFlush(){return this.#g}get contentMode(){return this.#w}get mkdir(){return this.#C}[Symbol.dispose](){this.destroy()}#k(){this.listenerCount(`drain`)&&(this.#s=!1,this.emit(`drain`))}#A(e,t=0){if(e){!this.#v&&(e.code===`EAGAIN`||e.code===`EBUSY`)&&this.#S(e,this.#T.length,this.#e-this.#T.length)?setTimeout(()=>this.#j(),100):(this.#i=!1,this.emit(`error`,e));return}this.emit(`write`,t);let n=Al(this.#T,this.#e,t);if(this.#e=n.len,this.#T=n.writingBuf,this.#T.length){if(!this.#v){this.#j();return}try{do{let e=this.#M(),t=Al(this.#T,this.#e,e);this.#e=t.len,this.#T=t.writingBuf}while(this.#T.length)}catch(e){this.#A(e);return}}this.#y&&this.#E.fsyncSync(this.#t);let r=this.#e;this.#o?(this.#i=!1,this.#o=!1,this.reopen()):r>this.#f?this.#F():this.#a?r>0?this.#F():(this.#i=!1,this.#P()):(this.#i=!1,this.#v?this.#s||(this.#s=!0,queueMicrotask(()=>this.#k())):this.emit(`drain`))}#j(){this.#w==`buffer`?this.#E.write(this.#t,this.#T,(e,t)=>this.#A(e,t)):this.#E.write(this.#t,this.#T,`utf8`,(e,t)=>this.#A(e,t))}#M(){return this.#w==`buffer`?this.#E.writeSync(this.#t,this.#T):this.#E.writeSync(this.#t,this.#T,`utf8`)}#N(e){this.#h=!0,this.#i=!0,this.#s=!1;let t=(t,n=-1)=>{if(t){this.#o=!1,this.#i=!1,this.#h=!1,this.#v?queueMicrotask(()=>void(this.listenerCount(`error`)&&this.emit(`error`,t))):this.emit(`error`,t);return}let r=this.#o;this.#t=n,this.#u=e,this.#o=!1,this.#h=!1,this.#i=!1,this.#v?queueMicrotask(()=>this.emit(`ready`)):this.emit(`ready`),!this.#d&&(!this.#i&&this.#e>this.#f||this.#c?this.#F():r&&queueMicrotask(()=>this.emit(`drain`)))},n=this.#b?`a`:`w`,r=this.#x??438;if(this.#v)try{this.#C&&this.#E.mkdirSync(W(e),{recursive:!0}),t(null,this.#E.openSync(e,n,r))}catch(e){throw t(e),e}else this.#C?this.#E.mkdir(W(e),{recursive:!0},i=>{if(i)return t(i);this.#E.open(e,n,r,t)}):this.#E.open(e,n,r,t)}#P(){if(this.#t===-1){this.once(`ready`,()=>this.#P());return}this.#_!==void 0&&clearInterval(this.#_),this.#d=!0,this.#n=[],this.#r=[];let e=e=>{if(e){this.emit(`error`,e);return}this.#a&&!this.#i&&this.emit(`finish`),this.emit(`close`)},t=()=>{this.#t!==1&&this.#t!==2?this.#E.close(this.#t,e):e(null)};try{this.#E.fsync(this.#t,t)}catch{}}#F(){if(this.#i=!0,this.#w==`buffer`?this.#T=this.#T.length?this.#T:jl(this.#n.shift()??[],this.#r.shift()??0):this.#T||=this.#n.shift()||``,!this.#v){this.#j();return}try{this.#A(null,this.#M())}catch(e){this.#A(e)}}#I(e){this.#c=!0;let t=()=>{if(this.#y||this.#d)this.#c=!1,e(null);else try{this.#E.fsync(this.#t,t=>{this.#c=!1,e(t?.code==`EBADF`?null:t)})}catch(t){this.#c=!1,e(t)}this.off(`error`,n)},n=n=>{this.#c=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,n)}on(e,t,n){return e===`drain`&&(this.#s=!1),super.on(e,t,n)}addListener(e,t,n){return this.on(e,t,n)}once(e,t,n){return e===`drain`&&(this.#s=!1),super.once(e,t,n)}off(e,t,n,r){return super.off(e,t,n,r)}removeListener(e,t,n,r){return super.removeListener(e,t,n,r)}setMaxListeners(){throw M(`ENOSYS`,`Utf8Stream.setMaxListeners`)}getMaxListeners(){throw M(`ENOSYS`,`Utf8Stream.getMaxListeners`)}prependListener(){throw M(`ENOSYS`,`Utf8Stream.prependListener`)}prependOnceListener(){throw M(`ENOSYS`,`Utf8Stream.prependOnceListener`)}rawListeners(){throw M(`ENOSYS`,`Utf8Stream.rawListeners`)}},Pl=t({BigIntStatsFs:()=>Fn,Dir:()=>Di,Dirent:()=>Ti,ReadStream:()=>yo,Stats:()=>jn,StatsFs:()=>Pn,Utf8Stream:()=>Nl,WriteStream:()=>bo,access:()=>ol,accessSync:()=>ua,appendFile:()=>Ic,appendFileSync:()=>Bi,chmod:()=>tl,chmodSync:()=>aa,chown:()=>$c,chownSync:()=>ra,close:()=>Rc,closeSync:()=>Hi,constants:()=>He,copyFile:()=>hl,copyFileSync:()=>ma,cp:()=>yl,cpSync:()=>va,createReadStream:()=>dl,createWriteStream:()=>fl,exists:()=>Oc,existsSync:()=>ji,fchmod:()=>Gc,fchmodSync:()=>Yi,fchown:()=>Wc,fchownSync:()=>Ji,fdatasync:()=>Vc,fdatasyncSync:()=>Gi,fstat:()=>Lc,fstatSync:()=>Vi,fsync:()=>Bc,fsyncSync:()=>Wi,ftruncate:()=>zc,ftruncateSync:()=>Ui,futimes:()=>Kc,futimesSync:()=>Xi,glob:()=>Sl,globSync:()=>ba,lchmod:()=>nl,lchmodSync:()=>oa,lchown:()=>el,lchownSync:()=>ia,link:()=>Xc,linkSync:()=>ea,lopenSync:()=>Li,lstat:()=>Ac,lstatSync:()=>Ni,lutimes:()=>il,lutimesSync:()=>ca,mkdir:()=>Jc,mkdirSync:()=>Qi,mkdtemp:()=>ml,mkdtempDisposableSync:()=>pa,mkdtempSync:()=>fa,open:()=>Nc,openAsBlob:()=>xl,openSync:()=>Ii,opendir:()=>vl,opendirSync:()=>_a,promises:()=>xo,read:()=>Uc,readFile:()=>Pc,readFileSync:()=>Ri,readSync:()=>qi,readdir:()=>Yc,readdirSync:()=>$i,readlink:()=>Qc,readlinkSync:()=>na,readv:()=>gl,readvSync:()=>ha,realpath:()=>al,realpathSync:()=>la,rename:()=>Dc,renameSync:()=>Ai,rm:()=>pl,rmSync:()=>da,rmdir:()=>qc,rmdirSync:()=>Zi,stat:()=>kc,statSync:()=>Mi,statfs:()=>bl,statfsSync:()=>ya,symlink:()=>Zc,symlinkSync:()=>ta,truncate:()=>jc,truncateSync:()=>Pi,unlink:()=>Mc,unlinkSync:()=>Fi,unwatchFile:()=>ll,utimes:()=>rl,utimesSync:()=>sa,watch:()=>ul,watchFile:()=>cl,write:()=>Hc,writeFile:()=>Fc,writeFileSync:()=>zi,writeSync:()=>Ki,writev:()=>_l,writevSync:()=>ga}),Fl=t({get:()=>Rl,getSync:()=>zl,list:()=>Wl,listSync:()=>Gl,remove:()=>Hl,removeSync:()=>Ul,set:()=>Bl,setSync:()=>Vl});const Il=[];function Ll(e,t,n,r){if(!t.startsWith(`user.`)&&!Il.includes(t))throw M(`ENOTSUP`,r,n)}async function Rl(e,t,n={}){e=H.call(this,e);let{fs:r,path:i}=ui(e,this);Ll(this,t,e,`xattr.get`);let a=await r.stat(i).catch(P(`xattr.get`,e));if(X&&!J(this,a,4))throw M(`EACCES`,`xattr.get`,e);a.attributes??=new zn;let o=a.attributes.get(t);if(!o)throw M(`ENODATA`,`xattr.get`,e);let s=Y.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}function zl(e,t,n={}){e=H.call(this,e),Ll(this,t,e,`xattr.get`);let{fs:r,path:i}=ui(e,this),a;try{a=r.statSync(i)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!J(this,a,4))throw M(`EACCES`,`xattr.get`,e);a.attributes??=new zn;let o=a.attributes.get(t);if(!o)throw M(`ENODATA`,`xattr.get`,e);let s=Y.Buffer.from(o);return n.encoding==`buffer`||!n.encoding?s:s.toString(n.encoding)}async function Bl(e,t,n,r={}){e=H.call(this,e);let{fs:i,path:a}=ui(e,this);Ll(this,t,e,`xattr.set`);let o=await i.stat(a).catch(P(`xattr.set`,e));if(X&&!J(this,o,2))throw M(`EACCES`,`xattr.set`,e);o.attributes??=new zn;let s=o.attributes.get(t);if(r.create&&s)throw M(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw M(`ENODATA`,`xattr.set`,e);o.attributes.set(t,Y.Buffer.from(n)),await i.touch(a,o).catch(P(`xattr.set`,e))}function Vl(e,t,n,r={}){e=H.call(this,e);let{fs:i,path:a}=ui(e,this);Ll(this,t,e,`xattr.set`);let o;try{o=i.statSync(a)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!J(this,o,2))throw M(`EACCES`,`xattr.set`,e);o.attributes??=new zn;let s=o.attributes.get(t);if(r.create&&s)throw M(`EEXIST`,`xattr.set`,e);if(r.replace&&!s)throw M(`ENODATA`,`xattr.set`,e);o.attributes.set(t,Y.Buffer.from(n));try{i.touchSync(a,o)}catch(t){throw A(Object.assign(t,{path:e}))}}async function Hl(e,t){e=H.call(this,e);let{fs:n,path:r}=ui(e,this);Ll(this,t,e,`xattr.remove`);let i=await n.stat(r).catch(P(`xattr.remove`,e));if(X&&!J(this,i,2))throw M(`EACCES`,`xattr.remove`,e);if(i.attributes??=new zn,!i.attributes.get(t))throw M(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t),await n.touch(r,i)}function Ul(e,t){e=H.call(this,e);let{fs:n,path:r}=ui(e,this);Ll(this,t,e,`xattr.remove`);let i;try{i=n.statSync(r)}catch(t){throw A(Object.assign(t,{path:e}))}if(X&&!J(this,i,2))throw M(`EACCES`,`xattr.remove`,e);if(i.attributes??=new zn,!i.attributes.get(t))throw M(`ENODATA`,`xattr.remove`,e);i.attributes.remove(t);try{n.touchSync(r,i)}catch(t){throw A(Object.assign(t,{path:e}))}}async function Wl(e){e=H.call(this,e);let{fs:t,path:n}=ui(e,this),r=await t.stat(n).catch(P(`xattr.list`,e));return r.attributes?[...r.attributes.keys()]:[]}function Gl(e){e=H.call(this,e);let{fs:t,path:n}=ui(e,this),r;try{r=t.statSync(n)}catch(t){throw A(Object.assign(t,{path:e}))}return r.attributes?[...r.attributes.keys()]:[]}const Kl=new Map;function ql(e={}){let t=ze(this),n=t.parent||Re;if(!Mi.call(n,n.root).isDirectory())throw M(`ENOTDIR`,{syscall:`chroot`,path:n.root});let r=Ve(t,e),i=Object.assign(r,{fs:{..._(Pl,r),Utf8Stream:Nl._withContext(r),promises:_(xo,r),xattr:_(Fl,r)},path:_(gn,r),bind:e=>{let t=ql.call(r,e);return r.children.push(t),t}});return Kl.set(r.id,i),i}var Jl=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},Yl=(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}),Xl=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()}},Zl=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 Xl(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=N(`EDEADLK`);throw e.stack+=r?.slice(5),R(e)}},e),await t?.done(),n}lockSync(){if(this.currentLock?.isLocked)throw R(N(`EBUSY`));return this.addLock()}get isLocked(){return!!this.currentLock?.isLocked}async rename(e,t){let n={stack:[],error:void 0,hasError:!1};try{Jl(n,await this.lock(),!1),await this._fs.rename(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}renameSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.renameSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async stat(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,await this.lock(),!1),await this._fs.stat(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}statSync(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,this.lockSync(),!1),this._fs.statSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}async touch(e,t){let n={stack:[],error:void 0,hasError:!1};try{Jl(n,await this.lock(),!1),await this._fs.touch(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}touchSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{Jl(n,this.lockSync(),!1),this._fs.touchSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async createFile(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,await this.lock(),!1),await this._fs.createFile(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}createFileSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.createFileSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async unlink(e){let t={stack:[],error:void 0,hasError:!1};try{Jl(t,await this.lock(),!1),await this._fs.unlink(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}unlinkSync(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,this.lockSync(),!1),this._fs.unlinkSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}async rmdir(e){let t={stack:[],error:void 0,hasError:!1};try{Jl(t,await this.lock(),!1),await this._fs.rmdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}rmdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,this.lockSync(),!1),this._fs.rmdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}async mkdir(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,await this.lock(),!1),await this._fs.mkdir(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}mkdirSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.mkdirSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async readdir(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,await this.lock(),!1),await this._fs.readdir(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}readdirSync(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,this.lockSync(),!1),this._fs.readdirSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}async exists(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,await this.lock(),!1),await this._fs.exists(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}existsSync(e){let t={stack:[],error:void 0,hasError:!1};try{return Jl(t,this.lockSync(),!1),this._fs.existsSync(e)}catch(e){t.error=e,t.hasError=!0}finally{Yl(t)}}async link(e,t){let n={stack:[],error:void 0,hasError:!1};try{Jl(n,await this.lock(),!1),await this._fs.link(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}linkSync(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.linkSync(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async sync(){let e={stack:[],error:void 0,hasError:!1};try{Jl(e,await this.lock(),!1),await this._fs.sync()}catch(t){e.error=t,e.hasError=!0}finally{Yl(e)}}syncSync(){let e={stack:[],error:void 0,hasError:!1};try{return Jl(e,this.lockSync(),!1),this._fs.syncSync()}catch(t){e.error=t,e.hasError=!0}finally{Yl(e)}}async read(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return Jl(i,await this.lock(),!1),await this._fs.read(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Yl(i)}}readSync(e,t,n,r){let i={stack:[],error:void 0,hasError:!1};try{return Jl(i,this.lockSync(),!1),this._fs.readSync(e,t,n,r)}catch(e){i.error=e,i.hasError=!0}finally{Yl(i)}}async write(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return Jl(r,await this.lock(),!1),await this._fs.write(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Yl(r)}}writeSync(e,t,n){let r={stack:[],error:void 0,hasError:!1};try{return Jl(r,this.lockSync(),!1),this._fs.writeSync(e,t,n)}catch(e){r.error=e,r.hasError=!0}finally{Yl(r)}}streamRead(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.streamRead(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}streamWrite(e,t){let n={stack:[],error:void 0,hasError:!1};try{return Jl(n,this.lockSync(),!1),this._fs.streamWrite(e,t)}catch(e){n.error=e,n.hasError=!0}finally{Yl(n)}}async ioctl(e,t,...n){let r={stack:[],error:void 0,hasError:!1};try{return Jl(r,await this.lock(),!1),await this._fs.ioctl({...e,fs:this._fs},t,...n)}catch(e){r.error=e,r.hasError=!0}finally{Yl(r)}}ioctlSync(e,t,...n){let r={stack:[],error:void 0,hasError:!1};try{return Jl(r,this.lockSync(),!1),this._fs.ioctlSync({...e,fs:this._fs},t,...n)}catch(e){r.error=e,r.hasError=!0}finally{Yl(r)}}};function Ql(e){class t extends Zl{constructor(...t){super(),this._fs=new e(...t)}}return t}function $l(e){class t extends e{constructor(...e){super(...e),this.attributes.set(`no_write`)}async rename(){throw N(`EROFS`)}renameSync(){throw N(`EROFS`)}async createFile(){throw N(`EROFS`)}createFileSync(){throw N(`EROFS`)}async unlink(){throw N(`EROFS`)}unlinkSync(){throw N(`EROFS`)}async rmdir(){throw N(`EROFS`)}rmdirSync(){throw N(`EROFS`)}async mkdir(){throw N(`EROFS`)}mkdirSync(){throw N(`EROFS`)}async link(){throw N(`EROFS`)}linkSync(){throw N(`EROFS`)}async touch(){throw N(`EROFS`)}touchSync(){throw N(`EROFS`)}async sync(){throw N(`EROFS`)}syncSync(){throw N(`EROFS`)}async write(){throw N(`EROFS`)}writeSync(){throw N(`EROFS`)}streamWrite(){throw N(`EROFS`)}}return t}function eu(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)}async ioctl(e,t,...n){return this.ioctlSync(e,t,...n)}}return t}async function tu(e,t,...n){let r,i,a;if(typeof e==`number`)a=Xr(this,e),r=Z(a.fs),i=a.vnode,i.refs++;else{e=H.call(this,e);let t=await ja(this,e,!1,{syscall:`ioctl`,path:e});if(!t.stats)throw M(`ENOENT`,{syscall:`ioctl`,path:e});r=Z(t.fs),i=r.ref(t.path,r.get(t.path)?.inode??t.stats)}let o={fs:i.fs,inode:i.inode,path:i.path,file:a};try{return await i.fs.ioctl(o,t,...n)}catch(t){throw A(Object.assign(t,{syscall:`ioctl`,path:e}))}finally{r.unref(i)}}function nu(e,t,...n){let r,i,a;if(typeof e==`number`)a=Xr(this,e),r=Z(a.fs),i=a.vnode,i.refs++;else{e=H.call(this,e);let t=_i(this,e,!1,{syscall:`ioctl`,path:e});if(!t.stats)throw M(`ENOENT`,{syscall:`ioctl`,path:e});r=Z(t.fs),i=r.ref(t.path,r.get(t.path)?.inode??t.stats)}let o={fs:i.fs,inode:i.inode,path:i.path,file:a};try{return i.fs.ioctlSync(o,t,...n)}catch(t){throw A(Object.assign(t,{syscall:`ioctl`,path:e}))}finally{r.unref(i)}}var ru={name:`@zenfs/core`,version:`2.7.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`,`fs`,`browser`],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`,"./*.js":`./dist/*.js`,"./*":`./dist/*.js`,"./emulation/*":`./dist/node/*`,"./promises":`./dist/node/promises.js`,"./readline":`./dist/node/readline.js`,"./eslint":`./eslint.shared.js`,"./tests/*.ts":`./tests/*.ts`,"./tests/*.js":`./tests/*.js`,"./tests/*":`./tests/*.js`,"./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 -s zenfs-test --clean; npx -s zenfs-test -abcpn; tests/fetch/run.sh; npx -s zenfs-test --report-only`,"test:native":`npx -s zenfs-test tests/native-setup.ts --verbose`,build:`tsc -p tsconfig.json`,"build:docs":`typedoc`,dev:`tsc -p tsconfig.json --watch`,prepublishOnly:`npm run build`},dependencies:{"@types/node":`^26.0.0`,buffer:`^6.0.3`,eventemitter3:`^5.0.1`,kerium:`^1.4.2`,memium:`^1.0.0`,"readable-stream":`^4.5.2`,utilium:`^3.0.0`},devDependencies:{"@eslint/js":`^10.0.1`,"@octokit/action":`^8.0.4`,c8:`^12.0.0`,eslint:`^10.1.0`,globals:`^17.3.0`,prettier:`^3.2.5`,typedoc:`^0.28.18`,typescript:`^6.0.0`,"typescript-eslint":`^8.58.0`},prettier:{singleQuote:!0,useTabs:!0,trailingComma:`es5`,tabWidth:4,printWidth:150,arrowParens:`avoid`,experimentalOperatorPosition:`start`}},iu=t({BigIntStatsFs:()=>Fn,Dir:()=>Di,Dirent:()=>Ti,ReadStream:()=>yo,Stats:()=>jn,StatsFs:()=>Pn,Utf8Stream:()=>Nl,WriteStream:()=>bo,_version:()=>au,access:()=>ol,accessSync:()=>ua,appendFile:()=>Ic,appendFileSync:()=>Bi,chmod:()=>tl,chmodSync:()=>aa,chown:()=>$c,chownSync:()=>ra,chroot:()=>fi,close:()=>Rc,closeSync:()=>Hi,constants:()=>He,copyFile:()=>hl,copyFileSync:()=>ma,cp:()=>yl,cpSync:()=>va,createReadStream:()=>dl,createWriteStream:()=>fl,exists:()=>Oc,existsSync:()=>ji,fchmod:()=>Gc,fchmodSync:()=>Yi,fchown:()=>Wc,fchownSync:()=>Ji,fdatasync:()=>Vc,fdatasyncSync:()=>Gi,fstat:()=>Lc,fstatSync:()=>Vi,fsync:()=>Bc,fsyncSync:()=>Wi,ftruncate:()=>zc,ftruncateSync:()=>Ui,futimes:()=>Kc,futimesSync:()=>Xi,glob:()=>Sl,globSync:()=>ba,ioctl:()=>tu,ioctlSync:()=>nu,lchmod:()=>nl,lchmodSync:()=>oa,lchown:()=>el,lchownSync:()=>ia,link:()=>Xc,linkSync:()=>ea,lopenSync:()=>Li,lstat:()=>Ac,lstatSync:()=>Ni,lutimes:()=>il,lutimesSync:()=>ca,mkdir:()=>Jc,mkdirSync:()=>Qi,mkdtemp:()=>ml,mkdtempDisposableSync:()=>pa,mkdtempSync:()=>fa,mount:()=>ci,open:()=>Nc,openAsBlob:()=>xl,openSync:()=>Ii,opendir:()=>vl,opendirSync:()=>_a,promises:()=>xo,read:()=>Uc,readFile:()=>Pc,readFileSync:()=>Ri,readSync:()=>qi,readdir:()=>Yc,readdirSync:()=>$i,readlink:()=>Qc,readlinkSync:()=>na,readv:()=>gl,readvSync:()=>ha,realpath:()=>al,realpathSync:()=>la,rename:()=>Dc,renameSync:()=>Ai,rm:()=>pl,rmSync:()=>da,rmdir:()=>qc,rmdirSync:()=>Zi,stat:()=>kc,statSync:()=>Mi,statfs:()=>bl,statfsSync:()=>ya,symlink:()=>Zc,symlinkSync:()=>ta,truncate:()=>jc,truncateSync:()=>Pi,umount:()=>li,unlink:()=>Mc,unlinkSync:()=>Fi,unwatchFile:()=>ll,utimes:()=>rl,utimesSync:()=>sa,watch:()=>ul,watchFile:()=>cl,write:()=>Hc,writeFile:()=>Fc,writeFileSync:()=>zi,writeSync:()=>Ki,writev:()=>_l,writevSync:()=>ga,xattr:()=>Fl});const au=ru.version;var ou=t({DirType:()=>Or,Dirent:()=>jr,Handle:()=>Jr,chroot:()=>fi,deleteFD:()=>Zr,dtToIf:()=>Ar,dupFD:()=>Qr,fromFD:()=>Xr,ifToDt:()=>kr,ioctl:()=>tu,ioctlSync:()=>nu,link:()=>La,mkdir:()=>Pa,mount:()=>ci,open:()=>Ma,readdir:()=>Fa,readlink:()=>Na,rename:()=>Ia,resolve:()=>ja,stat:()=>Ra,sync:()=>mi,toFD:()=>Yr,umount:()=>li,xattr:()=>Fl}),su=t({Async:()=>oc,AsyncMapTransaction:()=>gr,AsyncTransaction:()=>ur,Attributes:()=>zn,BigIntStatsFs:()=>Fn,CopyOnWrite:()=>Es,CopyOnWriteFS:()=>Ts,DeviceFS:()=>yr,Dir:()=>Di,Dirent:()=>Ti,ErrnoError:()=>ri,Fetch:()=>Is,FetchFS:()=>Fs,FileSystem:()=>sr,InMemory:()=>vr,InMemoryStore:()=>_r,Index:()=>Yn,IndexFS:()=>Ns,Inode:()=>K,InodeFlags:()=>Vn,Journal:()=>ws,MetadataBlock:()=>vc,MutexLock:()=>Xl,Mutexed:()=>Ql,Passthrough:()=>Bs,PassthroughFS:()=>zs,Port:()=>uc,PortFS:()=>sc,RPC:()=>Vs,ReadStream:()=>yo,Readonly:()=>$l,SingleBuffer:()=>Tc,SingleBufferStore:()=>wc,Stats:()=>jn,StatsFs:()=>Pn,StoreFS:()=>mr,SuperBlock:()=>bc,Sync:()=>eu,SyncMapTransaction:()=>hr,SyncTransaction:()=>lr,Transaction:()=>cr,Utf8Stream:()=>Nl,WrappedTransaction:()=>dr,WriteStream:()=>bo,_MutexedFS:()=>Zl,_asyncFSKeys:()=>ac,_chown:()=>Jn,_fnOpt:()=>ke,_inode_fields:()=>Bn,_inode_version:()=>5,_isNoEntry:()=>ln,_tempDirName:()=>mn,_temporal:()=>hn,_version:()=>au,access:()=>ol,accessSync:()=>ua,addDevice:()=>hs,appendFile:()=>Ic,appendFileSync:()=>Bi,assertContext:()=>Le,attachFS:()=>cc,bindContext:()=>ql,boundContexts:()=>Kl,checkOptions:()=>je,chmod:()=>tl,chmodSync:()=>aa,chown:()=>$c,chownSync:()=>ra,chroot:()=>fi,close:()=>Rc,closeSync:()=>Hi,configure:()=>_s,configureFileSystem:()=>os,configureSingle:()=>ds,configureSingleSync:()=>fs,configureSync:()=>vs,constants:()=>He,contextOf:()=>ze,copyFile:()=>hl,copyFileSync:()=>ma,cp:()=>yl,cpSync:()=>va,createChildContext:()=>Ve,createCredentials:()=>Ne,createReadStream:()=>dl,createWriteStream:()=>fl,credentialsAllowRoot:()=>Pe,decodeDirListing:()=>rn,default:()=>cu,defaultContext:()=>Re,detachFS:()=>lc,devices:()=>Er,encodeDirListing:()=>an,exists:()=>Oc,existsSync:()=>ji,fchmod:()=>Gc,fchmodSync:()=>Yi,fchown:()=>Wc,fchownSync:()=>Ji,fdatasync:()=>Vc,fdatasyncSync:()=>Gi,fs:()=>iu,fstat:()=>Lc,fstatSync:()=>Vi,fsync:()=>Bc,fsyncSync:()=>Wi,ftruncate:()=>zc,ftruncateSync:()=>Ui,fullDevice:()=>Cr,futimes:()=>Kc,futimesSync:()=>Xi,glob:()=>Sl,globSync:()=>ba,globToRegex:()=>fn,hasAccess:()=>J,ioctl:()=>tu,ioctlSync:()=>nu,isBackend:()=>Oe,isBackendConfig:()=>Me,isBlockDevice:()=>Gn,isCharacterDevice:()=>Kn,isContext:()=>Ie,isDirectory:()=>q,isFIFO:()=>qn,isFile:()=>Hn,isSocket:()=>Wn,isSymbolicLink:()=>Un,lchmod:()=>nl,lchmodSync:()=>oa,lchown:()=>el,lchownSync:()=>ia,link:()=>Xc,linkSync:()=>ea,log:()=>ie,lopenSync:()=>Li,lstat:()=>Ac,lstatSync:()=>Ni,lutimes:()=>il,lutimesSync:()=>ca,mkdir:()=>Jc,mkdirSync:()=>Qi,mkdtemp:()=>ml,mkdtempDisposableSync:()=>pa,mkdtempSync:()=>fa,mount:()=>ci,mounts:()=>si,normalizeMode:()=>on,normalizeOptions:()=>dn,normalizePath:()=>H,normalizeTime:()=>un,nullDevice:()=>xr,open:()=>Nc,openAsBlob:()=>xl,openSync:()=>Ii,opendir:()=>vl,opendirSync:()=>_a,promises:()=>xo,randomDevice:()=>wr,read:()=>Uc,readFile:()=>Pc,readFileSync:()=>Ri,readSync:()=>qi,readdir:()=>Yc,readdirSync:()=>$i,readlink:()=>Qc,readlinkSync:()=>na,readv:()=>gl,readvSync:()=>ha,realpath:()=>al,realpathSync:()=>la,rename:()=>Dc,renameSync:()=>Ai,resolveMountConfig:()=>ls,resolveMountConfigSync:()=>us,resolveRemoteMount:()=>dc,rm:()=>pl,rmSync:()=>da,rmdir:()=>qc,rmdirSync:()=>Zi,rootIno:()=>0,stat:()=>kc,statSync:()=>Mi,statfs:()=>bl,statfsSync:()=>ya,symlink:()=>Zc,symlinkSync:()=>ta,sync:()=>ys,truncate:()=>jc,truncateSync:()=>Pi,umount:()=>li,unlink:()=>Mc,unlinkSync:()=>Fi,unwatchFile:()=>ll,userModifiableFlags:()=>229631,userVisibleFlags:()=>253951,utimes:()=>rl,utimesSync:()=>sa,validateFD:()=>cn,version:()=>1,vfs:()=>ou,waitOnline:()=>pn,watch:()=>ul,watchFile:()=>cl,withExceptionContext:()=>oi,withPath:()=>ii,wrap:()=>ai,write:()=>Hc,writeFile:()=>Fc,writeFileSync:()=>zi,writeSync:()=>Ki,writev:()=>_l,writevSync:()=>ga,xattr:()=>Fl,zeroDevice:()=>Sr}),cu=iu
|
|
13
13
|
/*!
|
|
14
14
|
* @zenfs/core — https://npmjs.com/package/@zenfs/core
|
|
15
15
|
* Copyright © James Prevett and other ZenFS contributors.
|