import{o as e,r as t,t as n}from"./jsx-runtime-BbTa8W_M-1776590214964.js";import{a as r,n as i}from"./dist-D94YI0ma-1776590214964.js";import{t as a}from"./dist-BC6wWoZJ-1776590214964.js";import{n as o,r as s}from"./dist-DOof8Mki-1776590214964.js";import{n as c,t as l}from"./dist-kbJpaBn8-1776590214964.js";import{t as u}from"./dist-Bft84b45-1776590214964.js";import{n as d,r as f,t as p}from"./dist-BS52_tGF-1776590214964.js";import{i as m,n as h,r as g,t as _}from"./es2015-BhevoVC0-1776590214964.js";var v=e(t(),1),y=n(),b=`Dialog`,[x,ee]=s(b),[S,C]=x(b),w=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[u,d]=l({prop:r,defaultProp:i??!1,onChange:a,caller:b});return(0,y.jsx)(S,{scope:t,triggerRef:s,contentRef:c,contentId:f(),titleId:f(),descriptionId:f(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(e=>!e),[d]),modal:o,children:n})};w.displayName=b;var T=`DialogTrigger`,E=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,o=C(T,n),s=r(t,o.triggerRef);return(0,y.jsx)(a.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":o.open,"aria-controls":o.contentId,"data-state":K(o.open),...i,ref:s,onClick:c(e.onClick,o.onOpenToggle)})});E.displayName=T;var D=`DialogPortal`,[O,k]=x(D,{forceMount:void 0}),A=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=C(D,t);return(0,y.jsx)(O,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(u,{present:n||a.open,children:(0,y.jsx)(p,{asChild:!0,container:i,children:e})}))})};A.displayName=D;var j=`DialogOverlay`,M=v.forwardRef((e,t)=>{let n=k(j,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=C(j,e.__scopeDialog);return a.modal?(0,y.jsx)(u,{present:r||a.open,children:(0,y.jsx)(P,{...i,ref:t})}):null});M.displayName=j;var N=i(`DialogOverlay.RemoveScroll`),P=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(j,n);return(0,y.jsx)(h,{as:N,allowPinchZoom:!0,shards:[i.contentRef],children:(0,y.jsx)(a.div,{"data-state":K(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),F=`DialogContent`,I=v.forwardRef((e,t)=>{let n=k(F,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=C(F,e.__scopeDialog);return(0,y.jsx)(u,{present:r||a.open,children:a.modal?(0,y.jsx)(L,{...i,ref:t}):(0,y.jsx)(R,{...i,ref:t})})});I.displayName=F;var L=v.forwardRef((e,t)=>{let n=C(F,e.__scopeDialog),i=v.useRef(null),a=r(t,n.contentRef,i);return v.useEffect(()=>{let e=i.current;if(e)return _(e)},[]),(0,y.jsx)(z,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:c(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:c(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:c(e.onFocusOutside,e=>e.preventDefault())})}),R=v.forwardRef((e,t)=>{let n=C(F,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(z,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),z=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,...s}=e,c=C(F,n),l=v.useRef(null),u=r(t,l);return g(),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(m,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:a,onUnmountAutoFocus:o,children:(0,y.jsx)(d,{role:`dialog`,id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":K(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Y,{titleId:c.titleId}),(0,y.jsx)(Z,{contentRef:l,descriptionId:c.descriptionId})]})]})}),B=`DialogTitle`,V=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(B,n);return(0,y.jsx)(a.h2,{id:i.titleId,...r,ref:t})});V.displayName=B;var H=`DialogDescription`,U=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(H,n);return(0,y.jsx)(a.p,{id:i.descriptionId,...r,ref:t})});U.displayName=H;var W=`DialogClose`,G=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=C(W,n);return(0,y.jsx)(a.button,{type:`button`,...r,ref:t,onClick:c(e.onClick,()=>i.onOpenChange(!1))})});G.displayName=W;function K(e){return e?`open`:`closed`}var q=`DialogTitleWarning`,[te,J]=o(q,{contentName:F,titleName:B,docsSlug:`dialog`}),Y=({titleId:e})=>{let t=J(q),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},X=`DialogDescriptionWarning`,Z=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${J(X).contentName}}.`;return v.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Q=w,$=E,ne=A,re=M,ie=I,ae=V,oe=U,se=G;export{ne as a,$ as c,re as i,ie as n,Q as o,oe as r,ae as s,se as t};