const b = (s) => {
  let t;
  const o = /* @__PURE__ */ new Set(), n = (e, a) => {
    const c = typeof e == "function" ? e(t) : e;
    if (!Object.is(c, t)) {
      const d = t;
      t = (a != null ? a : typeof c != "object") ? c : Object.assign({}, t, c), o.forEach((f) => f(t, d));
    }
  }, r = () => t, u = { setState: n, getState: r, subscribe: (e) => (o.add(e), () => o.delete(e)), destroy: () => o.clear() };
  return t = s(n, r, u), u;
}, l = (s) => s ? b(s) : b;
export {
  l as default
};
//# sourceMappingURL=vanilla.es.js.map
