const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./FileSystemFileHandle.4sVW5ZPT.js","./FileSystemHandle.CFTLjada.js","./util.BQqrH4rd.js","./rolldown-runtime.C0FnF6B9.js","./preload-helper.HclGiUj8.js","./config.Mbx-WYSj.js"])))=>i.map(i=>d[i]);
import{t as e}from"./preload-helper.HclGiUj8.js";import{t}from"./FileSystemHandle.CFTLjada.js";import{t as n}from"./util.BQqrH4rd.js";var{GONE:r,MOD_ERR:i}=n,a=Symbol(`adapter`),o=class n extends t{[a];constructor(e){super(e),this[a]=e}async getDirectoryHandle(e,t={}){if(e===``)throw TypeError(`Name can't be an empty string.`);if(e===`.`||e===`..`||e.includes(`/`))throw TypeError(`Name contains invalid characters.`);t.create=!!t.create;let r=await this[a].getDirectoryHandle(e,t);return new n(r)}async*entries(){let{FileSystemFileHandle:t}=await e(async()=>{let{FileSystemFileHandle:e}=await import(`./FileSystemFileHandle.4sVW5ZPT.js`);return{FileSystemFileHandle:e}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url);for await(let[e,r]of this[a].entries())yield[r.name,r.kind===`file`?new t(r):new n(r)]}async*getEntries(){let{FileSystemFileHandle:t}=await e(async()=>{let{FileSystemFileHandle:e}=await import(`./FileSystemFileHandle.4sVW5ZPT.js`);return{FileSystemFileHandle:e}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url);console.warn(`deprecated, use .entries() instead`);for await(let e of this[a].entries())yield e.kind===`file`?new t(e):new n(e)}async getFileHandle(t,n={}){let{FileSystemFileHandle:r}=await e(async()=>{let{FileSystemFileHandle:e}=await import(`./FileSystemFileHandle.4sVW5ZPT.js`);return{FileSystemFileHandle:e}},__vite__mapDeps([0,1,2,3,4,5]),import.meta.url);if(t===``)throw TypeError(`Name can't be an empty string.`);if(t===`.`||t===`..`||t.includes(`/`))throw TypeError(`Name contains invalid characters.`);return n.create=!!n.create,new r(await this[a].getFileHandle(t,n))}async removeEntry(e,t={}){if(e===``)throw TypeError(`Name can't be an empty string.`);if(e===`.`||e===`..`||e.includes(`/`))throw TypeError(`Name contains invalid characters.`);return t.recursive=!!t.recursive,this[a].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];let t=[{handle:this,path:[]}];for(;t.length;){let{handle:n,path:r}=t.pop();for await(let i of n.values()){if(await i.isSameEntry(e))return[...r,i.name];i.kind===`directory`&&t.push({handle:i,path:[...r,i.name]})}}return null}async*keys(){for await(let[e]of this[a].entries())yield e}async*values(){for await(let[e,t]of this)yield t}[Symbol.asyncIterator](){return this.entries()}};if(Object.defineProperty(o.prototype,Symbol.toStringTag,{value:`FileSystemDirectoryHandle`,writable:!1,enumerable:!1,configurable:!0}),Object.defineProperties(o.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}}),globalThis.FileSystemDirectoryHandle){let e=globalThis.FileSystemDirectoryHandle.prototype;e.resolve=async function(e){if(await e.isSameEntry(this))return[];let t=[{handle:this,path:[]}];for(;t.length;){let{handle:n,path:r}=t.pop();for await(let i of n.values()){if(await i.isSameEntry(e))return[...r,i.name];i.kind===`directory`&&t.push({handle:i,path:[...r,i.name]})}}return null};async function t(e){if(await(await navigator.storage.getDirectory()).resolve(e)===null)throw new DOMException(...r)}let n=e.entries;e.entries=async function*(){await t(this),yield*n.call(this)},e[Symbol.asyncIterator]=async function*(){yield*this.entries()};let a=e.removeEntry;e.removeEntry=async function(e,t={}){return a.call(this,e,t).catch(async e=>{throw e instanceof DOMException&&e.name===`UnknownError`&&!t.recursive&&!(await n.call(this).next()).done?new DOMException(...i):e})}}export{o as FileSystemDirectoryHandle,o as default};