function t(t,e){let n;try{n=t()}catch(r){return}return{getItem:t=>{var e;const r=t=>null===t?null:JSON.parse(t,void 0),s=null!=(e=n.getItem(t))?e:null;return s instanceof Promise?s.then(r):r(s)},setItem:(t,e)=>n.setItem(t,JSON.stringify(e,void 0)),removeItem:t=>n.removeItem(t)}}function e(t){const e=n.useRef(void 0);return n=>{const r=t(n);return function(t,e){return!!Object.is(t,e)||"object"==typeof t&&null!==t&&"object"==typeof e&&null!==e&&Object.getPrototypeOf(t)===Object.getPrototypeOf(e)&&(S(t)&&S(e)?v(t)&&v(e)?y(t,e):((t,e)=>{const n=t[Symbol.iterator](),r=e[Symbol.iterator]();let s=n.next(),o=r.next();for(;!s.done&&!o.done;){if(!Object.is(s.value,o.value))return!1;s=n.next(),o=r.next()}return!!s.done&&!!o.done})(t,e):y({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)}))}(e.current,r)?e.current:e.current=r}}import{R as n}from"./vendor-react.DHNfi5sm.js";import{d as r}from"./vendor-immer.BWrU0tzq.js";const s=t=>{let e;const n=new Set,r=(t,r)=>{const s="function"==typeof t?t(e):t;if(!Object.is(s,e)){const t=e;e=(null!=r?r:"object"!=typeof s||null===s)?s:Object.assign({},e,s),n.forEach(n=>n(e,t))}},s=()=>e,o={setState:r,getState:s,getInitialState:()=>i,subscribe:t=>(n.add(t),()=>n.delete(t))},i=e=t(r,s,o);return o},o=t=>t,i=t=>{const e=(t=>t?s(t):s)(t),r=t=>function(t,e=o){const r=n.useSyncExternalStore(t.subscribe,n.useCallback(()=>e(t.getState()),[t,e]),n.useCallback(()=>e(t.getInitialState()),[t,e]));return n.useDebugValue(r),r}(e,t);return Object.assign(r,e),r},a=t=>t?i(t):i,c=t=>(e,n,r)=>{const s=r.subscribe;return r.subscribe=(t,e,n)=>{let o=t;if(e){const s=(null==n?void 0:n.equalityFn)||Object.is;let i=t(r.getState());o=n=>{const r=t(n);if(!s(i,r)){const t=i;e(i=r,t)}},(null==n?void 0:n.fireImmediately)&&e(i,i)}return s(o)},t(e,n,r)},u=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then:t=>u(t)(n),catch(t){return this}}}catch(n){return{then(t){return this},catch:t=>u(t)(n)}}},l=(e,n)=>(r,s,o)=>{let i={storage:t(()=>localStorage),partialize:t=>t,version:0,merge:(t,e)=>({...e,...t}),...n},a=!1;const c=new Set,l=new Set;let f=i.storage;if(!f)return e((...t)=>{r(...t)},s,o);const b=()=>{const t=i.partialize({...s()});return f.setItem(i.name,{state:t,version:i.version})},d=o.setState;o.setState=(t,e)=>(d(t,e),b());const g=e((...t)=>(r(...t),b()),s,o);let m;o.getInitialState=()=>g;const S=()=>{var t,e;if(!f)return;a=!1,c.forEach(t=>{var e;return t(null!=(e=s())?e:g)});const n=(null==(e=i.onRehydrateStorage)?void 0:e.call(i,null!=(t=s())?t:g))||void 0;return u(f.getItem.bind(f))(i.name).then(t=>{if(t){if("number"!=typeof t.version||t.version===i.version)return[!1,t.state];if(i.migrate){const e=i.migrate(t.state,t.version);return e instanceof Promise?e.then(t=>[!0,t]):[!0,e]}}return[!1,void 0]}).then(t=>{var e;const[n,o]=t;if(m=i.merge(o,null!=(e=s())?e:g),r(m,!0),n)return b()}).then(()=>{null==n||n(m,void 0),m=s(),a=!0,l.forEach(t=>t(m))}).catch(t=>{null==n||n(void 0,t)})};return o.persist={setOptions:t=>{i={...i,...t},t.storage&&(f=t.storage)},clearStorage:()=>{null==f||f.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>S(),hasHydrated:()=>a,onHydrate:t=>(c.add(t),()=>{c.delete(t)}),onFinishHydration:t=>(l.add(t),()=>{l.delete(t)})},i.skipHydration||S(),m||g},f=t=>(e,n,s)=>(s.setState=(t,n,...s)=>{const o="function"==typeof t?r(t):t;return e(o,n,...s)},t(s.setState,n,s)),b=t=>{let e;const n=new Set,r=(t,r)=>{const s="function"==typeof t?t(e):t;if(!Object.is(s,e)){const t=e;e=(null!=r?r:"object"!=typeof s||null===s)?s:Object.assign({},e,s),n.forEach(n=>n(e,t))}},s=()=>e,o={setState:r,getState:s,getInitialState:()=>i,subscribe:t=>(n.add(t),()=>n.delete(t))},i=e=t(r,s,o);return o},d=t=>t,g=t=>{const e=(t=>t?b(t):b)(t),r=t=>function(t,e=d){const r=n.useSyncExternalStore(t.subscribe,n.useCallback(()=>e(t.getState()),[t,e]),n.useCallback(()=>e(t.getInitialState()),[t,e]));return n.useDebugValue(r),r}(e,t);return Object.assign(r,e),r},m=t=>t?g(t):g,S=t=>Symbol.iterator in t,v=t=>"entries"in t,y=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),r=e instanceof Map?e:new Map(e.entries());if(n.size!==r.size)return!1;for(const[s,o]of n)if(!r.has(s)||!Object.is(o,r.get(s)))return!1;return!0};export{m as a,a as c,f as i,l as p,c as s,e as u};
//# sourceMappingURL=vendor-zustand.DjpBj9LH.js.map
