import{a as P,b as N,c as I,d as A}from"/build/_shared/chunk-ICHCA3YF.js";import{a as u,b as O,c as E,e as b,g as h,h as p,j as R,k as y,l as D}from"/build/_shared/chunk-7Z6LVCRT.js";import{p as l,r as m,s as x}from"/build/_shared/chunk-VX2L2R2M.js";import{a as k}from"/build/_shared/chunk-XIQ3C74K.js";import{d as W}from"/build/_shared/chunk-G5WX4PPA.js";var e=W(k(),1);var H="Dialog",[M,ve]=E(H),[G,d]=M(H),L=o=>{let{__scopeDialog:s,children:c,open:r,defaultOpen:n,onOpenChange:t,modal:a=!0}=o,i=(0,e.useRef)(null),$=(0,e.useRef)(null),[g=!1,v]=h({prop:r,defaultProp:n,onChange:t});return(0,e.createElement)(G,{scope:s,triggerRef:i,contentRef:$,contentId:b(),titleId:b(),descriptionId:b(),open:g,onOpenChange:v,onOpenToggle:(0,e.useCallback)(()=>v(w=>!w),[v]),modal:a},c)},j="DialogTrigger",B=(0,e.forwardRef)((o,s)=>{let{__scopeDialog:c,...r}=o,n=d(j,c),t=m(s,n.triggerRef);return(0,e.createElement)(p.button,l({type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":C(n.open)},r,{ref:t,onClick:u(o.onClick,n.onOpenToggle)}))}),T="DialogPortal",[V,F]=M(T,{forceMount:void 0}),q=o=>{let{__scopeDialog:s,forceMount:c,children:r,container:n}=o,t=d(T,s);return(0,e.createElement)(V,{scope:s,forceMount:c},e.Children.map(r,a=>(0,e.createElement)(D,{present:c||t.open},(0,e.createElement)(y,{asChild:!0,container:n},a))))},_="DialogOverlay",K=(0,e.forwardRef)((o,s)=>{let c=F(_,o.__scopeDialog),{forceMount:r=c.forceMount,...n}=o,t=d(_,o.__scopeDialog);return t.modal?(0,e.createElement)(D,{present:r||t.open},(0,e.createElement)(Y,l({},n,{ref:s}))):null}),Y=(0,e.forwardRef)((o,s)=>{let{__scopeDialog:c,...r}=o,n=d(_,c);return(0,e.createElement)(I,{as:x,allowPinchZoom:!0,shards:[n.contentRef]},(0,e.createElement)(p.div,l({"data-state":C(n.open)},r,{ref:s,style:{pointerEvents:"auto",...r.style}})))}),f="DialogContent",Z=(0,e.forwardRef)((o,s)=>{let c=F(f,o.__scopeDialog),{forceMount:r=c.forceMount,...n}=o,t=d(f,o.__scopeDialog);return(0,e.createElement)(D,{present:r||t.open},t.modal?(0,e.createElement)(z,l({},n,{ref:s})):(0,e.createElement)(J,l({},n,{ref:s})))}),z=(0,e.forwardRef)((o,s)=>{let c=d(f,o.__scopeDialog),r=(0,e.useRef)(null),n=m(s,c.contentRef,r);return(0,e.useEffect)(()=>{let t=r.current;if(t)return A(t)},[]),(0,e.createElement)(U,l({},o,{ref:n,trapFocus:c.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:u(o.onCloseAutoFocus,t=>{var a;t.preventDefault(),(a=c.triggerRef.current)===null||a===void 0||a.focus()}),onPointerDownOutside:u(o.onPointerDownOutside,t=>{let a=t.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&t.preventDefault()}),onFocusOutside:u(o.onFocusOutside,t=>t.preventDefault())}))}),J=(0,e.forwardRef)((o,s)=>{let c=d(f,o.__scopeDialog),r=(0,e.useRef)(!1),n=(0,e.useRef)(!1);return(0,e.createElement)(U,l({},o,{ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{var a;if((a=o.onCloseAutoFocus)===null||a===void 0||a.call(o,t),!t.defaultPrevented){var i;r.current||(i=c.triggerRef.current)===null||i===void 0||i.focus(),t.preventDefault()}r.current=!1,n.current=!1},onInteractOutside:t=>{var a,i;(a=o.onInteractOutside)===null||a===void 0||a.call(o,t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type==="pointerdown"&&(n.current=!0));let $=t.target;((i=c.triggerRef.current)===null||i===void 0?void 0:i.contains($))&&t.preventDefault(),t.detail.originalEvent.type==="focusin"&&n.current&&t.preventDefault()}}))}),U=(0,e.forwardRef)((o,s)=>{let{__scopeDialog:c,trapFocus:r,onOpenAutoFocus:n,onCloseAutoFocus:t,...a}=o,i=d(f,c),$=(0,e.useRef)(null),g=m(s,$);return N(),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(P,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:n,onUnmountAutoFocus:t},(0,e.createElement)(R,l({role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":C(i.open)},a,{ref:g,onDismiss:()=>i.onOpenChange(!1)}))),!1)}),S="DialogTitle",Q=(0,e.forwardRef)((o,s)=>{let{__scopeDialog:c,...r}=o,n=d(S,c);return(0,e.createElement)(p.h2,l({id:n.titleId},r,{ref:s}))}),X="DialogDescription",ee=(0,e.forwardRef)((o,s)=>{let{__scopeDialog:c,...r}=o,n=d(X,c);return(0,e.createElement)(p.p,l({id:n.descriptionId},r,{ref:s}))}),oe="DialogClose",te=(0,e.forwardRef)((o,s)=>{let{__scopeDialog:c,...r}=o,n=d(oe,c);return(0,e.createElement)(p.button,l({type:"button"},r,{ref:s,onClick:u(o.onClick,()=>n.onOpenChange(!1))}))});function C(o){return o?"open":"closed"}var ne="DialogTitleWarning",[_e,Ce]=O(ne,{contentName:f,titleName:S,docsSlug:"dialog"});var xe=L,Oe=B,Ee=q,he=K,Re=Z,Pe=Q,ye=ee,Ne=te;export{xe as a,Oe as b,Ee as c,he as d,Re as e,Pe as f,ye as g,Ne as h};
