"use strict";const e=require("react/jsx-runtime"),t=require("./core-CjmLbclt.cjs"),a=require("react"),g=require("react-dom"),E=({open:l,onClose:c,title:n,size:f="md",children:h,footer:r,closeOnOverlay:v=!0,closeOnEscape:i=!0,fullscreenable:y,zIndex:d,className:x,style:_,displayStyle:u})=>{const{t:b}=t.Wo(),j=a.useContext(t.Qt),m=a.useRef(null),[o,N]=a.useState(!1),k=t.Ui("modal",u),w=t.Gi("modal",u);if(t.fs(m,l),a.useEffect(()=>{if(!l||!i)return;const s=L=>{L.key==="Escape"&&c()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[l,i,c]),a.useEffect(()=>(l?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[l]),!l||typeof document>"u")return null;const C=e.jsx("div",{className:"nice-modal-overlay",style:d?{zIndex:d}:void 0,onClick:v?c:void 0,children:e.jsxs("div",{ref:m,className:`nice-modal nice-modal--${o?"full":f} nice-modal--ds-${w} ${x||""}`,style:{...k,..._},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:[y&&e.jsx("button",{type:"button",className:"nice-modal__fullscreen",onClick:()=>N(s=>!s),"aria-label":o?"Exit fullscreen":"Fullscreen",children:o?"⇲":"⇱"}),e.jsx("button",{type:"button",className:"nice-modal__close",onClick:c,"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 g.createPortal(C,j?.portalTarget??document.body)};exports.NiceModal=E;
