1import{aG as b,c8 as R,c5 as E,c6 as T,c7 as j,e5 as _,r as P,c4 as w,bM as a,bN as k,bT as z,de as L}from"./index-DaJJdpWR.js";import{m as U,c as D,f as N,b as A,k as C,n as y}from"./floating-ui.react-DY7EhHRq.js";import{u as B}from"./useScrollLock-DtPRJxpD.js";import{F as I,f as O,m as W}from"./index-BLw2wu9R.js";import{d as S}from"./makeCustomizable-CNSTBc9X.js";import{withFloatingTree as q}from"./index-BJ4nsr-b.js";const G=(t={})=>{const{bubbles:d=!1,shoudFlip:f=!0,outsidePress:i,adjustToReferenceWidth:s=!1,referenceElement:n,canCloseModal:u}=t,[l,o]=b.useState(t.defaultOpen||!1),r=U(),{update:c,refs:m,strategy:h,x,y:F,context:p}=D({open:l,onOpenChange:o,elements:{reference:n==null?void 0:n.current},nodeId:r,whileElementsMounted:t.autoUpdate===!1?void 0:R,placement:t.placement||"bottom-start",middleware:[E(t.offset||6),f&&T(),j(),_({apply({elements:g}){if(s){const e=g.reference;g.floating.style.width=e?`${e==null?void 0:e.offsetWidth}px`:""}}})]});N(p,{enabled:u!==!1,bubbles:d,outsidePress:i}),P.useEffect(()=>{t.defaultOpen&&c()},[]);const M=b.useCallback(()=>o(g=>!g),[o]),$=b.useCallback(()=>o(!0),[o]),v=b.useCallback(()=>o(!1),[o]);return{reference:m.setReference,floating:m.setFloating,toggle:M,open:$,nodeId:r,close:v,isOpen:l,styles:{position:h,top:F??0,left:x??0},context:p}},H=t=>{const{context:d,initialFocus:f,outsideElementsInert:i=!1,order:s=["reference","content"],nodeId:n,isOpen:u,portal:l=!0,root:o,children:r}=t,c=w(),m=o??(c==null?void 0:c())??void 0;return l?a(y,{id:n,children:a(A,{root:m,children:u&&a(C,{context:d,initialFocus:f,outsideElementsInert:i,order:s,children:a(k,{children:r})})})}):a(y,{id:n,children:u&&a(C,{context:d,initialFocus:f,order:s,children:a(k,{children:r})})})},[J,oe,K]=z("ModalContext"),Q=q(t=>{const{disableScrollLock:d,enableScrollLock:f}=B(),{handleClose:i,handleOpen:s,contentSx:n,containerSx:u,canCloseModal:l,id:o,style:r,portalRoot:c,initialFocusRef:m}=t,h=w(),x=P.useRef(null),{floating:F,isOpen:p,context:M,nodeId:$,toggle:v}=G({defaultOpen:!0,autoUpdate:!1,outsidePress:e=>e.target===x.current,canCloseModal:l});b.useEffect(()=>{p?s==null||s():i==null||i()},[p]);const g=b.useMemo(()=>({value:l===!1?{}:{toggle:v}}),[v,l]);return L(()=>(f(),()=>{d()}),[]),a(H,{nodeId:$,context:M,isOpen:p,outsideElementsInert:!0,root:c??(h==null?void 0:h())??void 0,initialFocus:m,children:a(J.Provider,{value:g,children:a(I,{id:o,ref:x,elementDescriptor:S.modalBackdrop,style:r,sx:[e=>({animation:`${O.fadeIn} 150ms ${e.transitionTiming.$common}
1`,zIndex:e.zIndices.$modal,backgroundColor:e.colors.$colorModalBackdrop,alignItems:"flex-start",justifyContent:"center",overflow:"auto",width:"100vw",height:["100vh","-webkit-fill-available"],position:"fixed",left:0,top:0}),u],children:a(I,{elementDescriptor:S.modalContent,ref:F,"aria-modal":"true",role:"dialog",sx:[e=>({position:"relative",outline:0,animation:`${O.modalSlideAndFade} 180ms ${e.transitionTiming.$easeOut}`,margin:`${e.space.$16} 0`,[W.sm]:{margin:`${e.space.$10} 0`}}),n],children:t.children})})})})}),ae=Object.freeze(Object.defineProperty({__proto__:null,Modal:Q,useUnsafeModalContext:K},Symbol.toStringTag,{value:"Module"}));export{Q as M,H as P,K as a,ae as b,G as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.