'use client';import { a } from './chunk-LU4CTAVZ.js';
import { Root, Trigger, Anchor, Portal, Content, Close, Arrow } from '@radix-ui/react-popover';
import { cx } from '@onbeam/styled-system/css';
import { forwardRef, useRef, useEffect } from 'react';
import { CloseIcon } from '@onbeam/icons';
import { popover, customScrollbar } from '@onbeam/styled-system/recipes';
import { jsxs, jsx } from 'react/jsx-runtime';

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

export { v as a, U as b };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=chunk-4ZQNZNLS.js.map