import{n as c,aa as m,ab as a,$ as f}from"./index-CoQ-x5A8.js";function b(e){return m(e)===!0?"__q_date|"+e.getTime():a(e)===!0?"__q_expr|"+e.source:typeof e=="number"?"__q_numb|"+e:typeof e=="boolean"?"__q_bool|"+(e?"1":"0"):typeof e=="string"?"__q_strn|"+e:typeof e=="function"?"__q_strn|"+e.toString():e===Object(e)?"__q_objt|"+JSON.stringify(e):e}function h(e){if(e.length<9)return e;const o=e.substring(0,8),n=e.substring(9);switch(o){case"__q_date":const g=Number(n);return new Date(Number.isNaN(g)===!0?n:g);case"__q_expr":return new RegExp(n);case"__q_numb":return Number(n);case"__q_bool":return n==="1";case"__q_strn":return""+n;case"__q_objt":return JSON.parse(n);default:return e}}function y(){const e=()=>null;return{has:()=>!1,hasItem:()=>!1,getLength:()=>0,getItem:e,getIndex:e,getKey:e,getAll:()=>{},getAllKeys:()=>[],set:c,setItem:c,remove:c,removeItem:c,clear:c,isEmpty:()=>!0}}function p(e){const r=window[e+"Storage"],o=t=>{const s=r.getItem(t);return s?h(s):null},n=t=>r.getItem(t)!==null,g=(t,s)=>{r.setItem(t,b(s))},u=t=>{r.removeItem(t)};return{has:n,hasItem:n,getLength:()=>r.length,getItem:o,getIndex:t=>t<r.length?o(r.key(t)):null,getKey:t=>t<r.length?r.key(t):null,getAll:()=>{let t;const s={},_=r.length;for(let l=0;l<_;l++)t=r.key(l),s[t]=o(t);return s},getAllKeys:()=>{const t=[],s=r.length;for(let _=0;_<s;_++)t.push(r.key(_));return t},set:g,setItem:g,remove:u,removeItem:u,clear:()=>{r.clear()},isEmpty:()=>r.length===0}}const i=f.has.webStorage===!1?y():p("local"),I={install({$q:e}){e.localStorage=i}};Object.assign(I,i);export{I as P};
