/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/zustand-computed@2.1.1/dist/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const isIterable=e=>Symbol.iterator in e,hasIterableEntries=e=>"entries"in e,compareEntries=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),o=t instanceof Map?t:new Map(t.entries());if(n.size!==o.size)return!1;for(const[e,t]of n)if(!Object.is(t,o.get(e)))return!1;return!0},compareIterables=(e,t)=>{const n=e[Symbol.iterator](),o=t[Symbol.iterator]();let r=n.next(),s=o.next();for(;!r.done&&!s.done;){if(!Object.is(r.value,s.value))return!1;r=n.next(),s=o.next()}return!!r.done&&!!s.done};function shallow(e,t){return!!Object.is(e,t)||"object"==typeof e&&null!==e&&"object"==typeof t&&null!==t&&(isIterable(e)&&isIterable(t)?hasIterableEntries(e)&&hasIterableEntries(t)?compareEntries(e,t):compareIterables(e,t):compareEntries({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)}))}const computedImpl=(e,t)=>n=>{const o=t&&"keys"in t&&null!=t.keys?t.keys:void 0,r=o?new Set(o):void 0;function s(e,t){return!r||null==t||Object.keys(t).some((e=>r.has(e)))}const i=t&&"shouldRecompute"in t?t.shouldRecompute??s:s;return(o,r,s)=>{const c=(null==t?void 0:t.equalityFn)??shallow;function a(t){const n=e(t);for(const e of Object.keys(n))e in t&&c(n[e],t[e])&&delete n[e];return Object.assign(t,n)}const l=s;function u(e,t){o(!1!==t&&null!=t?t=>{const n=e,o="function"==typeof n?n(t):n;return i(t,o)?a(o):o}:t=>{const n="function"==typeof e?e(t):e;return i(t,n)?a(Object.assign(t,n)):n},t)}l.setState=u;const b=n(u,r,l);return Object.assign({},b,e(b))}},createComputed=computedImpl;exports.createComputed=createComputed;
//# sourceMappingURL=/sm/bd44547d7e5ca38a9574f40f0f51382795d61ac7235dd0c0107fcc3ab645461b.map