import{c as e}from"./security-CTzQb9Ko.js";import{$i as t,Qi as n,f as r}from"./bundle-mjs-lcbR1pPJ.js";import{K as i,_ as a,h as o}from"./dist-C0UdmnhX.js";var s=e(t(),1),c=e(i(),1),l=e(n(),1),u=s.createContext(void 0),d=()=>{let e=s.useContext(u);if(!e)throw Error(`Dialog components must be used within a Dialog`);return e},f=({open:e,onOpenChange:t,children:n})=>{let[r,i]=s.useState(!1);if(s.useEffect(()=>(i(!0),()=>i(!1)),[]),s.useEffect(()=>(e?document.body.style.overflow=`hidden`:document.body.style.overflow=``,()=>{document.body.style.overflow=``}),[e]),!r)return null;let a={open:e,onOpenChange:t};return(0,l.jsx)(u.Provider,{value:a,children:(0,c.createPortal)((0,l.jsx)(l.Fragment,{children:e&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:`fixed inset-0 z-50 bg-black/50 backdrop-blur-sm animate-in fade-in-0`,onClick:()=>t(!1),"aria-hidden":`true`}),(0,l.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none`,children:n})]})}),document.body)})},p=s.forwardRef(({className:e,children:t,...n},i)=>{let{onOpenChange:s}=d();return(0,l.jsxs)(`div`,{ref:i,className:a(`relative z-50 grid w-full max-w-lg gap-4 border bg-background p-6 shadow-lg duration-200`,`animate-in fade-in-0 zoom-in-95 slide-in-from-left-1/2 slide-in-from-top-[48%]`,`sm:rounded-lg`,`pointer-events-auto`,e),onClick:e=>e.stopPropagation(),...n,children:[t,(0,l.jsxs)(o,{variant:`ghost`,size:`icon`,className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none`,onClick:()=>s(!1),children:[(0,l.jsx)(r,{className:`h-4 w-4`}),(0,l.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})});p.displayName=`DialogContent`;var m=s.forwardRef(({className:e,...t},n)=>(0,l.jsx)(`div`,{ref:n,className:a(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t}));m.displayName=`DialogHeader`;var h=s.forwardRef(({className:e,...t},n)=>(0,l.jsx)(`div`,{ref:n,className:a(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t}));h.displayName=`DialogFooter`;var g=s.forwardRef(({className:e,...t},n)=>(0,l.jsx)(`h2`,{ref:n,className:a(`text-lg font-semibold leading-none tracking-tight`,e),...t}));g.displayName=`DialogTitle`;var _=s.forwardRef(({className:e,...t},n)=>(0,l.jsx)(`p`,{ref:n,className:a(`text-sm text-muted-foreground`,e),...t}));_.displayName=`DialogDescription`;var v=s.forwardRef(({children:e,asChild:t,onClick:n,...r},i)=>{if(t&&s.isValidElement(e)){let t=e;return s.cloneElement(t,{...t.props,onClick:e=>{n?.(e),t.props.onClick?.(e)}})}return(0,l.jsx)(`button`,{ref:i,onClick:n,...r,children:e})});v.displayName=`DialogTrigger`;export{m as a,h as i,p as n,g as o,_ as r,v as s,f as t};