import * as i from "react";
import "react-dom";
import { c as m } from "./index-DLcqcWxM.mjs";
import { jsx as p } from "react/jsx-runtime";
// @__NO_SIDE_EFFECTS__
function y(e) {
  const r = /* @__PURE__ */ g(e), o = i.forwardRef((n, t) => {
    const { children: l, ...a } = n, s = i.Children.toArray(l), c = s.find(v);
    if (c) {
      const f = c.props.children, d = s.map((u) => u === c ? i.Children.count(f) > 1 ? i.Children.only(null) : i.isValidElement(f) ? f.props.children : null : u);
      return /* @__PURE__ */ p(r, { ...a, ref: t, children: i.isValidElement(f) ? i.cloneElement(f, void 0, d) : null });
    }
    return /* @__PURE__ */ p(r, { ...a, ref: t, children: l });
  });
  return o.displayName = `${e}.Slot`, o;
}
// @__NO_SIDE_EFFECTS__
function g(e) {
  const r = i.forwardRef((o, n) => {
    const { children: t, ...l } = o;
    if (i.isValidElement(t)) {
      const a = E(t), s = C(l, t.props);
      return t.type !== i.Fragment && (s.ref = n ? m(n, a) : a), i.cloneElement(t, s);
    }
    return i.Children.count(t) > 1 ? i.Children.only(null) : null;
  });
  return r.displayName = `${e}.SlotClone`, r;
}
var S = /* @__PURE__ */ Symbol("radix.slottable");
function v(e) {
  return i.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === S;
}
function C(e, r) {
  const o = { ...r };
  for (const n in r) {
    const t = e[n], l = r[n];
    /^on[A-Z]/.test(n) ? t && l ? o[n] = (...s) => {
      l(...s), t(...s);
    } : t && (o[n] = t) : n === "style" ? o[n] = { ...t, ...l } : n === "className" && (o[n] = [t, l].filter(Boolean).join(" "));
  }
  return { ...e, ...o };
}
function E(e) {
  let r = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, o = r && "isReactWarning" in r && r.isReactWarning;
  return o ? e.ref : (r = Object.getOwnPropertyDescriptor(e, "ref")?.get, o = r && "isReactWarning" in r && r.isReactWarning, o ? e.props.ref : e.props.ref || e.ref);
}
var h = [
  "a",
  "button",
  "div",
  "form",
  "h2",
  "h3",
  "img",
  "input",
  "label",
  "li",
  "nav",
  "ol",
  "p",
  "span",
  "svg",
  "ul"
], w = h.reduce((e, r) => {
  const o = /* @__PURE__ */ y(`Primitive.${r}`), n = i.forwardRef((t, l) => {
    const { asChild: a, ...s } = t, c = a ? o : r;
    return typeof window < "u" && (window[/* @__PURE__ */ Symbol.for("radix-ui")] = !0), /* @__PURE__ */ p(c, { ...s, ref: l });
  });
  return n.displayName = `Primitive.${r}`, { ...e, [r]: n };
}, {});
export {
  w as P,
  y as c
};
//# sourceMappingURL=index-CCNZ9uWB.mjs.map
