import{d as y,g as z}from"./vendor-react-CTtPmzVP.js";import{b4 as b}from"./vendor-ux-KtPBvlG0.js";var u={},m;function h(){if(m)return u;m=1,Object.defineProperty(u,"__esModule",{value:!0});var f=y(),c=b(),S=function(o,s,r){if(!c.isBrowser)return[s,c.noop,c.noop];if(!o)throw new Error("useLocalStorage key may not be falsy");var n=r?r.raw?function(t){return t}:r.deserializer:JSON.parse,l=f.useRef(function(t){try{var a=r?r.raw?String:r.serializer:JSON.stringify,e=localStorage.getItem(t);return e!==null?n(e):(s&&localStorage.setItem(t,a(s)),s)}catch{return s}}),g=f.useState(function(){return l.current(o)}),d=g[0],i=g[1];f.useLayoutEffect(function(){return i(l.current(o))},[o]);var v=f.useCallback(function(t){try{var a=typeof t=="function"?t(d):t;if(typeof a>"u")return;var e=void 0;r?r.raw?typeof a=="string"?e=a:e=JSON.stringify(a):r.serializer?e=r.serializer(a):e=JSON.stringify(a):e=JSON.stringify(a),localStorage.setItem(o,e),i(n(e))}catch{}},[o,i]),L=f.useCallback(function(){try{localStorage.removeItem(o),i(void 0)}catch{}},[o,i]);return[d,v,L]};return u.default=S,u}var J=h();const E=z(J);export{E as u};
