import{i as e,o as t,r as n,t as r}from"./button-DJ30HgDO.js";import{k as i}from"./free-solid-svg-icons-CttZC1b4.js";import{t as a}from"./toast-context-val-Z-lwvYkJ.js";var o=t(e(),1),s=t(n(),1);const c=({isOpen:e,onClose:t,title:n,children:a,width:c=`max-w-xl`})=>{let l=o.useRef(null);return(0,o.useEffect)(()=>(e?(l.current?.showModal(),document.body.style.overflow=`hidden`):(l.current?.close(),document.body.style.overflow=`unset`),()=>{document.body.style.overflow=`unset`}),[e]),(0,s.jsxs)(`dialog`,{ref:l,className:`relative m-auto bg-ui-bg dark:bg-ui-secondary-bg-dark rounded-lg shadow-xl w-full ${c} p-6 backdrop:bg-ui-bg-dark/50 dark:backdrop:bg-ui-bg-dark/70`,onClick:e=>{e.target===l.current&&t()},onCancel:t,children:[(0,s.jsx)(`div`,{className:`absolute top-1 right-1`,children:(0,s.jsx)(r,{onClick:t,"aria-label":`Close modal`,variant:`ghost`,icon:i})}),(0,s.jsx)(`div`,{className:`mb-4`,children:(0,s.jsx)(`h4`,{className:`text-lg text-ui-text dark:text-ui-text-dark font-semibold`,children:n})}),(0,s.jsx)(`div`,{className:`space-y-5`,children:a})]})},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};