import{r as e,t}from"./jsx-runtime-DAs1UGHr.js";import{t as n}from"./react-DxF41JXl.js";import{E as r,T as i}from"./free-solid-svg-icons-DaMIgByo.js";import{t as a}from"./toast-context-val-CcPDsXTx.js";var o=e(n(),1),s=e(t(),1);const c=({isOpen:e,onClose:t,title:n,children:a,width:c=`max-w-xl`})=>((0,o.useEffect)(()=>(e&&(document.body.style.overflow=`hidden`),()=>{document.body.style.overflow=`unset`}),[e]),(0,o.useEffect)(()=>{let n=e=>{e.key===`Escape`&&t()};return e&&document.addEventListener(`keydown`,n),()=>{document.removeEventListener(`keydown`,n)}},[e,t]),e?(0,s.jsx)(`div`,{className:`fixed inset-0 z-50 overflow-y-auto bg-ui-bg-dark/50 dark:bg-ui-bg-dark/70 transition-opacity flex justify-center items-start pt-16 sm:pt-24 md:items-center md:pt-0`,onClick:t,children:(0,s.jsxs)(`div`,{className:`relative bg-ui-bg dark:bg-ui-secondary-bg-dark rounded-lg shadow-xl w-full ${c} p-6`,onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(`div`,{className:`absolute top-0.5 right-1`,children:(0,s.jsx)(r,{onClick:t,"aria-label":`Close modal`,variant:`ghost`,icon:i})}),(0,s.jsx)(`div`,{className:`mb-6`,children:(0,s.jsx)(`h4`,{className:`text-xl text-ui-text dark:text-ui-text-dark font-semibold`,children:n})}),(0,s.jsx)(`div`,{className:`space-y-5`,children:a})]})}):null),l=()=>{let e=(0,o.use)(a);if(!e)throw Error(`useToast must be used within a ToastProvider`);return e};export{c as n,l as t};