"use strict";const e=require("react/jsx-runtime"),t=require("./core-CSfXTICE.cjs"),a=require("react"),g=require("react-dom"),E=({open:l,onClose:c,title:o,size:f="md",children:h,footer:r,closeOnOverlay:v=!0,closeOnEscape:d=!0,fullscreenable:y,zIndex:i,className:x,style:_,displayStyle:u})=>{const{t:b}=t.$o(),j=a.useContext(t.tr),m=a.useRef(null),[n,N]=a.useState(!1),k=t.os("modal",u),w=t.is("modal",u);if(t.ks(m,l),a.useEffect(()=>{if(!l||!d)return;const s=L=>{L.key==="Escape"&&c()};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[l,d,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:i?{zIndex:i}:void 0,onClick:v?c:void 0,children:e.jsxs("div",{ref:m,className:`nice-modal nice-modal--${n?"full":f} nice-modal--ds-${w} ${x||""}`,style:{...k,..._},role:"dialog","aria-modal":"true","aria-label":o,onClick:s=>s.stopPropagation(),children:[o&&e.jsxs("div",{className:"nice-modal__header",children:[e.jsx("h2",{className:"nice-modal__title",children:o}),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":n?"Exit fullscreen":"Fullscreen",children:n?"⇲":"⇱"}),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;
