import s from "../../../@babel/runtime/helpers/esm/extends.js";
import { forwardRef as m, useEffect as n, createElement as p } from "react";
import { flushSync as d } from "react-dom";
import { Slot as $ } from "../../react-slot/dist/index.js";
const l = [
  "a",
  "button",
  "div",
  "form",
  "h2",
  "h3",
  "img",
  "input",
  "label",
  "li",
  "nav",
  "ol",
  "p",
  "span",
  "svg",
  "ul"
], E = l.reduce((e, t) => {
  const r = /* @__PURE__ */ m((i, o) => {
    const { asChild: c, ...f } = i, a = c ? $ : t;
    return n(() => {
      window[Symbol.for("radix-ui")] = !0;
    }, []), /* @__PURE__ */ p(a, s({}, f, {
      ref: o
    }));
  });
  return r.displayName = `Primitive.${t}`, {
    ...e,
    [t]: r
  };
}, {});
function b(e, t) {
  e && d(
    () => e.dispatchEvent(t)
  );
}
export {
  E as Primitive,
  b as dispatchDiscreteCustomEvent
};
