/* Socket Lib - Built with esbuild */
var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var g=(e,t)=>{for(var n in t)s(e,n,{get:t[n],enumerable:!0})},x=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of h(t))!y.call(e,a)&&a!==n&&s(e,a,{get:()=>t[a],enumerable:!(r=l(t,a))||r.enumerable});return e};var w=e=>x(s({},"__esModule",{value:!0}),e);var k={};g(k,{clear:()=>T,get:()=>f,getCacache:()=>o,put:()=>O,remove:()=>b,safeGet:()=>C,withTmp:()=>v});module.exports=w(k);var c=require("./paths");function o(){return require("./external/cacache")}function E(e){const n=e.replaceAll(/[.+?^${}()|[\]\\]/g,"\\$&").replaceAll("*",".*");return new RegExp(`^${n}`)}function P(e,t){return t.includes("*")?E(t).test(e):e.startsWith(t)}async function T(e){const t={__proto__:null,...e},n=o(),r=(0,c.getSocketCacacheDir)();if(!t.prefix)try{await n.rm.all(r);return}catch(i){if(i?.code!=="ENOTEMPTY")throw i;return}if(!t.prefix.includes("*")){let i=0;const m=n.ls.stream(r);for await(const u of m)if(u.key.startsWith(t.prefix))try{await n.rm.entry(r,u.key),i++}catch{}return i}let d=0;const p=n.ls.stream(r);for await(const i of p)if(P(i.key,t.prefix))try{await n.rm.entry(r,i.key),d++}catch{}return d}async function f(e,t){if(e.includes("*"))throw new TypeError('Cache key cannot contain wildcards (*). Wildcards are only supported in clear({ prefix: "pattern*" }).');return await o().get((0,c.getSocketCacacheDir)(),e,t)}async function O(e,t,n){if(e.includes("*"))throw new TypeError('Cache key cannot contain wildcards (*). Wildcards are only supported in clear({ prefix: "pattern*" }).');return await o().put((0,c.getSocketCacacheDir)(),e,t,n)}async function b(e){if(e.includes("*"))throw new TypeError('Cache key cannot contain wildcards (*). Use clear({ prefix: "pattern*" }) to remove multiple entries.');return await o().rm.entry((0,c.getSocketCacacheDir)(),e)}async function C(e,t){try{return await f(e,t)}catch{return}}async function v(e){return await o().tmp.withTmp((0,c.getSocketCacacheDir)(),{},e)}0&&(module.exports={clear,get,getCacache,put,remove,safeGet,withTmp});
//# sourceMappingURL=cacache.js.map
