'use client';'use strict';

var chunk5MDNIIWX_cjs = require('./chunk-5MDNIIWX.cjs');
var reactPopover = require('@radix-ui/react-popover');
var css = require('@onbeam/styled-system/css');
var react = require('react');
var icons = require('@onbeam/icons');
var recipes = require('@onbeam/styled-system/recipes');
var jsxRuntime = require('react/jsx-runtime');

var v=react.forwardRef(({children:u,open:N,onOpenChange:C,trigger:R,anchor:i,title:s,size:E="md",align:T="start",side:w="bottom",className:M,onInteractOutside:O,...a},y)=>{let e=react.useRef(null),I=react.useRef(),t=recipes.popover();return react.useEffect(()=>{if(!e.current)return;e.current.getRootNode().nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(I.current=e.current.getRootNode());},[]),jsxRuntime.jsxs(reactPopover.Root,{open:N,onOpenChange:C,children:[jsxRuntime.jsx(reactPopover.Trigger,{ref:e,asChild:!0,children:R??jsxRuntime.jsx("div",{"aria-hidden":!0,className:t.hidden})}),i&&jsxRuntime.jsx(reactPopover.Anchor,{asChild:!0,children:i}),jsxRuntime.jsx(reactPopover.Portal,{children:jsxRuntime.jsx(reactPopover.Content,{ref:y,sideOffset:8,align:T,side:w,...a,className:css.cx(recipes.customScrollbar(),t.content,M),onInteractOutside:r=>{r.detail.originalEvent.composedPath().some(p=>p instanceof Node&&e.current?.contains(p))&&r.preventDefault(),O?.(r);},...a,children:jsxRuntime.jsxs(chunk5MDNIIWX_cjs.a,{size:E,children:[s&&jsxRuntime.jsxs("div",{className:t.header,children:[jsxRuntime.jsx("span",{children:s}),jsxRuntime.jsx(reactPopover.Close,{className:t.close,children:jsxRuntime.jsx(icons.CloseIcon,{height:16,width:16})})]}),u]})})})]})});v.displayName="Popover";var U={Portal:reactPopover.Portal,Root:reactPopover.Root,Trigger:reactPopover.Trigger,Content:reactPopover.Content,Close:reactPopover.Close,Arrow:reactPopover.Arrow,Anchor:reactPopover.Anchor};

exports.a = v;
exports.b = U;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-FKRUXIQQ.cjs.map