"use client";
import * as React from "react";
import { SelectPortalContext } from "./SelectPortalContext.js";
import { useSelectRootContext } from "../root/SelectRootContext.js";
import { selectors } from "../store.js";
import { jsx } from "react/jsx-runtime";
import { FloatingPortal } from "../../floating-ui-react/components/FloatingPortal.js";
import { useStore } from "../../../../utils/esm/store/useStore.js";
const SelectPortal = /* @__PURE__ */ React.forwardRef(function SelectPortal2(portalProps, forwardedRef) {
  const {
    store
  } = useSelectRootContext();
  const mounted = useStore(store, selectors.mounted);
  const forceMount = useStore(store, selectors.forceMount);
  const shouldRender = mounted || forceMount;
  if (!shouldRender) {
    return null;
  }
  return /* @__PURE__ */ jsx(SelectPortalContext.Provider, {
    value: true,
    children: /* @__PURE__ */ jsx(FloatingPortal, {
      ref: forwardedRef,
      ...portalProps
    })
  });
});
if (process.env.NODE_ENV !== "production") SelectPortal.displayName = "SelectPortal";
export {
  SelectPortal
};
//# sourceMappingURL=SelectPortal.js.map
