import{c as B}from"./button-CZmOQP7j.js";import{r as i,j as s}from"./app-BBZbvTSO.js";import{u as H,c as V,a as p,d as X}from"./index-CbDI-tXU.js";import{u as R,a as q}from"./utils-YhN_nlHn.js";import{b as C,P as K,h as U,R as Y,a as Z,F as z,D as J}from"./Combination-9YgcTppv.js";import{P as _}from"./index-C1VwruLz.js";import{P as D}from"./index-13DH8-b5.js";/**
 * @license lucide-react v0.475.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Q=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],me=B("X",Q);var v="Dialog",[y,ve]=V(v),[ee,u]=y(v),N=e=>{const{__scopeDialog:o,children:r,open:a,defaultOpen:n,onOpenChange:t,modal:c=!0}=e,l=i.useRef(null),d=i.useRef(null),[g,x]=H({prop:a,defaultProp:n??!1,onChange:t,caller:v});return s.jsx(ee,{scope:o,triggerRef:l,contentRef:d,contentId:C(),titleId:C(),descriptionId:C(),open:g,onOpenChange:x,onOpenToggle:i.useCallback(()=>x($=>!$),[x]),modal:c,children:r})};N.displayName=v;var O="DialogTrigger",I=i.forwardRef((e,o)=>{const{__scopeDialog:r,...a}=e,n=u(O,r),t=R(o,n.triggerRef);return s.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":P(n.open),...a,ref:t,onClick:p(e.onClick,n.onOpenToggle)})});I.displayName=O;var h="DialogPortal",[te,b]=y(h,{forceMount:void 0}),A=e=>{const{__scopeDialog:o,forceMount:r,children:a,container:n}=e,t=u(h,o);return s.jsx(te,{scope:o,forceMount:r,children:i.Children.map(a,c=>s.jsx(_,{present:r||t.open,children:s.jsx(K,{asChild:!0,container:n,children:c})}))})};A.displayName=h;var m="DialogOverlay",T=i.forwardRef((e,o)=>{const r=b(m,e.__scopeDialog),{forceMount:a=r.forceMount,...n}=e,t=u(m,e.__scopeDialog);return t.modal?s.jsx(_,{present:a||t.open,children:s.jsx(ne,{...n,ref:o})}):null});T.displayName=m;var oe=q("DialogOverlay.RemoveScroll"),ne=i.forwardRef((e,o)=>{const{__scopeDialog:r,...a}=e,n=u(m,r);return s.jsx(Y,{as:oe,allowPinchZoom:!0,shards:[n.contentRef],children:s.jsx(D.div,{"data-state":P(n.open),...a,ref:o,style:{pointerEvents:"auto",...a.style}})})}),f="DialogContent",j=i.forwardRef((e,o)=>{const r=b(f,e.__scopeDialog),{forceMount:a=r.forceMount,...n}=e,t=u(f,e.__scopeDialog);return s.jsx(_,{present:a||t.open,children:t.modal?s.jsx(re,{...n,ref:o}):s.jsx(ae,{...n,ref:o})})});j.displayName=f;var re=i.forwardRef((e,o)=>{const r=u(f,e.__scopeDialog),a=i.useRef(null),n=R(o,r.contentRef,a);return i.useEffect(()=>{const t=a.current;if(t)return U(t)},[]),s.jsx(M,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:p(e.onCloseAutoFocus,t=>{var c;t.preventDefault(),(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,t=>{const c=t.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0;(c.button===2||l)&&t.preventDefault()}),onFocusOutside:p(e.onFocusOutside,t=>t.preventDefault())})}),ae=i.forwardRef((e,o)=>{const r=u(f,e.__scopeDialog),a=i.useRef(!1),n=i.useRef(!1);return s.jsx(M,{...e,ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var c,l;(c=e.onCloseAutoFocus)==null||c.call(e,t),t.defaultPrevented||(a.current||(l=r.triggerRef.current)==null||l.focus(),t.preventDefault()),a.current=!1,n.current=!1},onInteractOutside:t=>{var d,g;(d=e.onInteractOutside)==null||d.call(e,t),t.defaultPrevented||(a.current=!0,t.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const c=t.target;((g=r.triggerRef.current)==null?void 0:g.contains(c))&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&n.current&&t.preventDefault()}})}),M=i.forwardRef((e,o)=>{const{__scopeDialog:r,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:t,...c}=e,l=u(f,r),d=i.useRef(null),g=R(o,d);return Z(),s.jsxs(s.Fragment,{children:[s.jsx(z,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:t,children:s.jsx(J,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":P(l.open),...c,ref:g,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(se,{titleId:l.titleId}),s.jsx(ce,{contentRef:d,descriptionId:l.descriptionId})]})]})}),E="DialogTitle",F=i.forwardRef((e,o)=>{const{__scopeDialog:r,...a}=e,n=u(E,r);return s.jsx(D.h2,{id:n.titleId,...a,ref:o})});F.displayName=E;var w="DialogDescription",S=i.forwardRef((e,o)=>{const{__scopeDialog:r,...a}=e,n=u(w,r);return s.jsx(D.p,{id:n.descriptionId,...a,ref:o})});S.displayName=w;var W="DialogClose",k=i.forwardRef((e,o)=>{const{__scopeDialog:r,...a}=e,n=u(W,r);return s.jsx(D.button,{type:"button",...a,ref:o,onClick:p(e.onClick,()=>n.onOpenChange(!1))})});k.displayName=W;function P(e){return e?"open":"closed"}var L="DialogTitleWarning",[xe,G]=X(L,{contentName:f,titleName:E,docsSlug:"dialog"}),se=({titleId:e})=>{const o=G(L),r=`\`${o.contentName}\` requires a \`${o.titleName}\` for the component to be accessible for screen reader users.

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

For more information, see https://radix-ui.com/primitives/docs/components/${o.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},ie="DialogDescriptionWarning",ce=({contentRef:e,descriptionId:o})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${G(ie).contentName}}.`;return i.useEffect(()=>{var t;const n=(t=e.current)==null?void 0:t.getAttribute("aria-describedby");o&&n&&(document.getElementById(o)||console.warn(a))},[a,e,o]),null},Ce=N,Re=I,_e=A,he=T,Ee=j,Pe=F,ye=S,Ne=k;export{Ee as C,ye as D,he as O,_e as P,Ce as R,Pe as T,xe as W,me as X,Ne as a,Re as b,ve as c,S as d};
