import{x as S,r as i,V as F,j as s,a8 as x,O as f,X as p,Z as k,Q as R,aW as L,W as _,aX as z,aY as G,aZ as V,a_ as X,a$ as Z,b0 as U,b1 as W,w as Y}from"./index-C-gKvEDq.js";const $=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],pe=S("x",$);var D="Dialog",[P,ge]=k(D),[H,u]=P(D),K=e=>{const{__scopeDialog:n,children:a,open:r,defaultOpen:t,onOpenChange:o,modal:l=!0}=e,c=i.useRef(null),O=i.useRef(null),[w,v]=F({prop:r,defaultProp:t??!1,onChange:o,caller:D});return s.jsx(H,{scope:n,triggerRef:c,contentRef:O,contentId:x(),titleId:x(),descriptionId:x(),open:w,onOpenChange:v,onOpenToggle:i.useCallback(()=>v(M=>!M),[v]),modal:l,children:a})};K.displayName=D;var y="DialogTrigger",Q=i.forwardRef((e,n)=>{const{__scopeDialog:a,...r}=e,t=u(y,a),o=_(n,t.triggerRef);return s.jsx(f.button,{type:"button","aria-haspopup":"dialog","aria-expanded":t.open,"aria-controls":t.open?t.contentId:void 0,"data-state":C(t.open),...r,ref:o,onClick:p(e.onClick,t.onOpenToggle)})});Q.displayName=y;var m="DialogPortal",[q,N]=P(m,{forceMount:void 0}),B=e=>{const{__scopeDialog:n,forceMount:a,children:r,container:t}=e,o=u(m,n);return s.jsx(q,{scope:n,forceMount:a,children:i.Children.map(r,l=>s.jsx(R,{present:a||o.open,children:s.jsx(L,{asChild:!0,container:t,children:l})}))})};B.displayName=m;var g="DialogOverlay",J=i.forwardRef((e,n)=>{const a=N(g,e.__scopeDialog),{forceMount:r=a.forceMount,...t}=e,o=u(g,e.__scopeDialog);return o.modal?s.jsx(R,{present:r||o.open,children:s.jsx(oe,{...t,ref:n})}):null});J.displayName=g;var ee=W("DialogOverlay.RemoveScroll"),oe=i.forwardRef((e,n)=>{const{__scopeDialog:a,...r}=e,t=u(g,a),o=G(),l=_(n,o);return s.jsx(V,{as:ee,allowPinchZoom:!0,shards:[t.contentRef],children:s.jsx(f.div,{"data-state":C(t.open),...r,ref:l,style:{pointerEvents:"auto",...r.style}})})}),d="DialogContent",te=i.forwardRef((e,n)=>{const a=N(d,e.__scopeDialog),{forceMount:r=a.forceMount,...t}=e,o=u(d,e.__scopeDialog);return s.jsx(R,{present:r||o.open,children:o.modal?s.jsx(ae,{...t,ref:n}):s.jsx(re,{...t,ref:n})})});te.displayName=d;var ae=i.forwardRef((e,n)=>{const a=u(d,e.__scopeDialog),r=i.useRef(null),t=_(n,a.contentRef,r);return i.useEffect(()=>{const o=r.current;if(o)return z(o)},[]),s.jsx(E,{...e,ref:t,trapFocus:a.open,disableOutsidePointerEvents:a.open,onCloseAutoFocus:p(e.onCloseAutoFocus,o=>{o.preventDefault(),a.triggerRef.current?.focus()}),onPointerDownOutside:p(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&o.preventDefault()}),onFocusOutside:p(e.onFocusOutside,o=>o.preventDefault())})}),re=i.forwardRef((e,n)=>{const a=u(d,e.__scopeDialog),r=i.useRef(!1),t=i.useRef(!1);return s.jsx(E,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(r.current||a.triggerRef.current?.focus(),o.preventDefault()),r.current=!1,t.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(t.current=!0));const l=o.target;a.triggerRef.current?.contains(l)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&t.current&&o.preventDefault()}})}),E=i.forwardRef((e,n)=>{const{__scopeDialog:a,trapFocus:r,onOpenAutoFocus:t,onCloseAutoFocus:o,...l}=e,c=u(d,a);return X(),s.jsx(s.Fragment,{children:s.jsx(Z,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:t,onUnmountAutoFocus:o,children:s.jsx(U,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":C(c.open),...l,ref:n,deferPointerDownOutside:!0,onDismiss:()=>c.onOpenChange(!1)})})})}),I="DialogTitle",ne=i.forwardRef((e,n)=>{const{__scopeDialog:a,...r}=e,t=u(I,a);return s.jsx(f.h2,{id:t.titleId,...r,ref:n})});ne.displayName=I;var b="DialogDescription",se=i.forwardRef((e,n)=>{const{__scopeDialog:a,...r}=e,t=u(b,a);return s.jsx(f.p,{id:t.descriptionId,...r,ref:n})});se.displayName=b;var j="DialogClose",ie=i.forwardRef((e,n)=>{const{__scopeDialog:a,...r}=e,t=u(j,a);return s.jsx(f.button,{type:"button",...r,ref:n,onClick:p(e.onClick,()=>t.onOpenChange(!1))})});ie.displayName=j;function C(e){return e?"open":"closed"}var le="Separator",h="horizontal",ce=["horizontal","vertical"],A=i.forwardRef((e,n)=>{const{decorative:a,orientation:r=h,...t}=e,o=ue(r)?r:h,c=a?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return s.jsx(f.div,{"data-orientation":o,...c,...t,ref:n})});A.displayName=le;function ue(e){return ce.includes(e)}var T=A;const de=i.forwardRef(({className:e,orientation:n="horizontal",decorative:a=!0,...r},t)=>s.jsx(T,{ref:t,decorative:a,orientation:n,className:Y("shrink-0 bg-border",n==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));de.displayName=T.displayName;export{K as D,de as S,pe as X,ie as a,B as b,ge as c,te as d,ne as e,se as f,J as g,Q as h};
