"use strict";const x=require("react/jsx-runtime"),t=require("react"),r=require("../tools/tools.cjs"),b=function(h){const{as:g="div",className:i,dropOldClass:l,fade:d,style:c,toggle:u,variables:f,visible:s,...B}=h,[m,y]=t.useState(!1),[a,p]=t.useState(!1),v=t.useRef(null),k=t.useMemo(()=>{const e=r.classx(!l&&"modal-backdrop",d&&"fade",m&&"show",i),o=r.stylex((n,w)=>({tKey:r.convertBsKeyToVar(w)}),f,c);return{className:e,style:o}},[i,l,d,m,c,f]);return t.useEffect(()=>{if(s&&!a){p(!0);return}const e=v.current;if(!e)return;const o=()=>{s||(u||(document.body.classList.remove("overflow-hidden"),document.body.style.removeProperty("padding-right")),p(!1))};e.addEventListener("transitionend",o);let n;return s?(document.body.style.setProperty("padding-right",r.getScrollbarWidth("px")),document.body.classList.add("overflow-hidden"),n=requestAnimationFrame(()=>y(!0))):y(!1),()=>{e.removeEventListener("transitionend",o),n&&cancelAnimationFrame(n)}},[u,a,s]),a&&x.jsx(g,{...B,...k,ref:v})};b.displayName="BRL.ModalBackdrop";exports.ModalBackdrop=b;
//# sourceMappingURL=modal-backdrop.cjs.map
