var o=Object.defineProperty;var u=(t,e,c)=>e in t?o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:c}):t[e]=c;var r=(t,e,c)=>u(t,typeof e!="symbol"?e+"":e,c);const n=[];for(let t=0;t<256;++t)n.push((t+256).toString(16).slice(1));function d(t,e=0){return(n[t[e+0]]+n[t[e+1]]+n[t[e+2]]+n[t[e+3]]+"-"+n[t[e+4]]+n[t[e+5]]+"-"+n[t[e+6]]+n[t[e+7]]+"-"+n[t[e+8]]+n[t[e+9]]+"-"+n[t[e+10]]+n[t[e+11]]+n[t[e+12]]+n[t[e+13]]+n[t[e+14]]+n[t[e+15]]).toLowerCase()}let s;const l=new Uint8Array(16);function g(){if(!s){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");s=crypto.getRandomValues.bind(crypto)}return s(l)}const m=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),h={randomUUID:m};function y(t,e,c){var i;if(h.randomUUID&&!t)return h.randomUUID();t=t||{};const a=t.random??((i=t.rng)==null?void 0:i.call(t))??g();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=a[6]&15|64,a[8]=a[8]&63|128,d(a)}function p(){return y()}function w(t,e,c){return{type:t,payload:e,requestId:c??p(),timestamp:Date.now()}}class x{constructor(e){r(this,"cache",new Map);r(this,"maxSize");this.maxSize=e}get(e){const c=this.cache.get(e);return c!==void 0&&(this.cache.delete(e),this.cache.set(e,c)),c}set(e,c){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){const a=this.cache.keys().next().value;a!==void 0&&this.cache.delete(a)}this.cache.set(e,c)}has(e){return this.cache.has(e)}clear(){this.cache.clear()}get size(){return this.cache.size}}function v(t){let e=0;for(let c=0;c<t.length;c++){const a=t.charCodeAt(c);e=(e<<5)-e+a,e|=0}return e.toString(36)}async function S(t,e){try{return(await chrome.storage.local.get(t))[t]??e}catch{return e}}async function b(t,e){try{await chrome.storage.local.set({[t]:e})}catch(c){console.error(`[PrivacyGuardian] Failed to write storage key "${t}":`,c)}}export{x as L,b as a,w as c,p as g,v as h,S as s};
