import { useState as u, useLayoutEffect as c, useEffect as s } from "../../../../../../preact@10.29.0/node_modules/preact/hooks/dist/hooks.module.js";
function _(e, n) {
  const a = n(), [{ _instance: t }, r] = u({
    _instance: { _value: a, _getSnapshot: n }
  });
  return c(() => {
    t._value = a, t._getSnapshot = n, o(t) && r({ _instance: t });
  }, [e, a, n]), s(() => (o(t) && r({ _instance: t }), e(() => {
    o(t) && r({ _instance: t });
  })), [e]), a;
}
function o(e) {
  const n = e._getSnapshot, a = e._value;
  try {
    const t = n();
    return !Object.is(a, t);
  } catch {
    return !0;
  }
}
export {
  _ as useSyncExternalStore
};
