import{g as p}from"./chunk-CwBz3wv4.js";const l="web3UrlCache";async function o(){return(await chrome.storage.local.get(l))[l]??{}}async function y(t){await chrome.storage.local.set({[l]:t})}function r(t){return t.toLowerCase()}async function g(t){return(await o())[r(t)]??null}async function m(t){const a=await o();a[r(t.contractAddress)]={...t,contractAddress:r(t.contractAddress)},await y(a)}async function E(t){const a=await o(),e=r(t),n=a[e];n&&(n.lastAccess=Date.now(),await y(a))}async function A(){const t=await o();return Object.values(t).sort((a,e)=>e.lastAccess-a.lastAccess)}async function B(t){const a=await o(),e=r(t),n=a[e];return n?(delete a[e],await y(a),n):null}async function h(t,a){const e=await o(),n=Object.values(e).sort((c,u)=>c.lastAccess-u.lastAccess);let s=n.reduce((c,u)=>c+u.bodyLen,0)+t,i=n.length+1;const w=[];for(const c of n){if(s<=a.sizeCapBytes&&i<=a.entryBudget)break;w.push(c),s-=c.bodyLen,i-=1}return{toEvict:w,remainingBytes:s,remainingCount:i}}async function C(){const t=await p();return{sizeCapBytes:t.web3SizeCapBytes??f,entryBudget:t.web3EntryBudget??d}}const f=50*1024*1024,d=200;async function W(t){const a=await crypto.subtle.digest("SHA-256",t),e=new Uint8Array(a);let n="";for(let s=0;s<e.length;s++)n+=(e[s]??0).toString(16).padStart(2,"0");return n}function S(t,a){return`/dapp3/web3/${r(t)}/${a}`}export{f as D,m as a,E as b,C as c,d,g,A as l,S as m,h as p,B as r,W as s};
//# sourceMappingURL=chunk-Ba02fv6T.js.map
