import { createStore as s } from "./vanilla.mjs";
import i from "react";
import E from "../../use-sync-external-store/shim/with-selector.mjs";
const { useDebugValue: a } = i, { useSyncExternalStoreWithSelector: c } = E;
function l(t, e = t.getState, o) {
  const r = c(
    t.subscribe,
    t.getState,
    t.getServerState || t.getState,
    e,
    o
  );
  return a(r), r;
}
const n = (t) => {
  const e = typeof t == "function" ? s(t) : t, o = (r, u) => l(e, r, u);
  return Object.assign(o, e), o;
}, S = (t) => t ? n(t) : n;
export {
  S as create,
  s as createStore,
  l as useStore
};
