"use strict";const e=require("react/jsx-runtime"),t=require("react"),L=require("react-dom"),o=require("./core-C2ZmWe_u.cjs"),g=({open:l,onClose:a,title:n,size:f="md",children:h,footer:r,closeOnOverlay:y=!0,closeOnEscape:i=!0,fullscreenable:v,zIndex:d,className:x,style:_,displayStyle:u})=>{const{t:b}=o.Wo(),j=t.useContext(o.NiceThemeContext),m=t.useRef(null),[c,N]=t.useState(!1),C=o.useComponentDisplayStyle("modal",u),k=o.useComponentDisplayClass("modal",u);if(o.useFocusTrap(m,l),t.useEffect(()=>{if(!l||!i)return;const s=w=>{w.key==="Escape"&&a()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[l,i,a]),t.useEffect(()=>(l?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[l]),!l||typeof document>"u")return null;const p=e.jsx("div",{className:"nice-modal-overlay",style:d?{zIndex:d}:void 0,onClick:y?a:void 0,children:e.jsxs("div",{ref:m,className:`nice-modal nice-modal--${c?"full":f} nice-modal--ds-${k} ${x||""}`,style:{...C,..._},role:"dialog","aria-modal":"true","aria-label":n,onClick:s=>s.stopPropagation(),children:[n&&e.jsxs("div",{className:"nice-modal__header",children:[e.jsx("h2",{className:"nice-modal__title",children:n}),e.jsxs("div",{className:"nice-modal__header-actions",children:[v&&e.jsx("button",{type:"button",className:"nice-modal__fullscreen",onClick:()=>N(s=>!s),"aria-label":c?"Exit fullscreen":"Fullscreen",children:c?"⇲":"⇱"}),e.jsx("button",{type:"button",className:"nice-modal__close",onClick:a,"aria-label":b("controls.close","Close"),children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"})})})]})]}),e.jsx("div",{className:"nice-modal__body",children:h}),r&&e.jsx("div",{className:"nice-modal__footer",children:r})]})});return L.createPortal(p,j?.portalTarget??document.body)};exports.NiceModal=g;
