import{amasR,zasK,TasY,apasT}from"./entry.c3abd651.js";import{gasW,aas$,basI,sasb,casj,wasB,dasJ,fasH}from"./query.79ebe04e.js";import{pasq}from"./index.a6ef77ff.js";import{uasD}from"./preview.bfc27fc9.js";import"./index.500b5a03.js";import"./utils.5e77fdb8.js";constG="memory",Z=()=>{constr=newMap;return{name:G,options:{},hasItem(t){returnr.has(t)},getItem(t){returnr.get(t)||null},getItemRaw(t){returnr.get(t)||null},setItem(t,n){r.set(t,n)},setItemRaw(t,n){r.set(t,n)},removeItem(t){r.delete(t)},getKeys(){returnArray.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};functionF(r){return!r||typeofr.then!="function"?Promise.resolve(r):r}functiong(r,...t){try{returnF(r(...t))}catch(n){returnPromise.reject(n)}}functionV(r){constt=typeofr;returnr===null||t!=="object"&&t!=="function"}functionQ(r){constt=Object.getPrototypeOf(r);return!t||t.isPrototypeOf(Object)}functionz(r){if(V(r))returnString(r);if(Q(r)||Array.isArray(r))returnJSON.stringify(r);if(typeofr.toJSON=="function")returnz(r.toJSON());thrownewError("[unstorage] Cannot stringify value!")}functionL(){if(typeofBuffer===void0)thrownewTypeError("[unstorage] Buffer is not supported!")}const_="base64:";functionX(r){if(typeofr=="string")returnr;L();constt=Buffer.from(r).toString("base64");return_+t}functionk(r){returntypeofr!="string"||!r.startsWith(_)?r:(L(),Buffer.from(r.slice(_.length),"base64"))}constee=["hasItem","getItem","getItemRaw","setItem","setItemRaw","removeItem","getMeta","setMeta","removeMeta","getKeys","clear","mount","unmount"];functionte(r,t){if(t=v(t),!t)returnr;constn={...r};for(constiofee)n[i]=(s="",...c)=>r[i](t+s,...c);returnn.getKeys=(i="",...s)=>r.getKeys(t+i,...s).then(c=>c.map(u=>u.slice(t.length))),n}functionp(r){returnr?r.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}functionv(r){returnr=p(r),r?r+":":""}constre="memory",ne=()=>{constr=newMap;return{name:re,options:{},hasItem(t){returnr.has(t)},getItem(t){returnr.get(t)||null},getItemRaw(t){returnr.get(t)||null},setItem(t,n){r.set(t,n)},setItemRaw(t,n){r.set(t,n)},removeItem(t){r.delete(t)},getKeys(){returnArray.from(r.keys())},clear(){r.clear()},dispose(){r.clear()}}};functionie(r={}){constt={mounts:{"":r.driver||ne()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=e=>{for(constaoft.mountpoints)if(e.startsWith(a))return{base:a,relativeKey:e.slice(a.length),driver:t.mounts[a]};return{base:"",relativeKey:e,driver:t.mounts[""]}},i=(e,a)=>t.mountpoints.filter(o=>o.startsWith(e)||a&&e.startsWith(o)).map(o=>({relativeBase:e.length>o.length?e.slice(o.length):void0,mountpoint:o,driver:t.mounts[o]})),s=(e,a)=>{if(t.watching){a=p(a);for(constooft.watchListeners)o(e,a)}},c=async()=>{if(!t.watching){t.watching=!0;for(consteint.mounts)t.unwatch[e]=awaitP(t.mounts[e],s,e)}},u=async()=>{if(t.watching){for(consteint.unwatch)awaitt.unwatch[e]();t.unwatch={},t.watching=!1}},h={hasItem(e,a={}){e=p(e);const{relativeKey:o,driver:f}=n(e);returng(f.hasItem,o,a)},getItem(e,a={}){e=p(e);const{relativeKey:o,driver:f}=n(e);returng(f.getItem,o,a).then(m=>R(m))},getItemRaw(e,a={}){e=p(e);const{relativeKey:o,driver:f}=n(e);returnf.getItemRaw?g(f.getItemRaw,o,a):g(f.getItem,o,a).then(m=>k(m))},asyncsetItem(e,a,o={}){if(a===void0)returnh.removeItem(e);e=p(e);const{relativeKey:f,driver:m}=n(e);m.setItem&&(awaitg(m.setItem,f,z(a),o),m.watch||s("update",e))},asyncsetItemRaw(e,a,o={}){if(a===void0)returnh.removeItem(e,o);e=p(e);const{relativeKey:f,driver:m}=n(e);if(m.setItemRaw)awaitg(m.setItemRaw,f,a,o);elseif(m.setItem)awaitg(m.setItem,f,X(a),o);elsereturn;m.watch||s("update",e)},asyncremoveItem(e,a={}){typeofa=="boolean"&&(a={removeMata:a}),e=p(e);const{relativeKey:o,driver:f}=n(e);f.removeItem&&(awaitg(f.removeItem,o,a),a.removeMata&&awaitg(f.removeItem,o+"$",a),f.watch||s("remove",e))},asyncgetMeta(e,a={}){typeofa=="boolean"&&(a={nativeOnly:a}),e=p(e);const{relativeKey:o,driver:f}=n(e),m=Object.create(null);if(f.getMeta&&Object.assign(m,awaitg(f.getMe