import { createPortal as c } from "../../external/.pnpm/preact@10.28.2/node_modules/preact/compat/dist/compat.module.js";
import { useState as f, useMemo as i } from "../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import m from "../useReflex.js";
const v = (r, t) => {
  const [n, o] = f(), d = m(
    i(() => {
      const u = (e) => (...a) => {
        const s = r(e, ...a);
        return s && c(s, e);
      };
      return o(void 0), (e) => o(e instanceof Element ? () => u(e) : void 0);
    }, [r]),
    t
  );
  return [n, d];
};
export {
  v as default
};
