"use strict";const l=require("./FetchConfigsUtils-c73b687c.js"),n=require("./SSRHelper-b80e8420.js"),a=require("classnames"),o=require("react"),d=require("react-dom"),c=require("react-feather"),m="dialogBody _dialogBody_26b1c",u="dialogFooter _dialogFooter_a7107",s={dialogBody:m,dialogFooter:u};function g(t){if(n.SSRHelper.isSSR())return null;const e=t?"editorDialogWrapper":"dialogWrapper";let i=document.getElementById(e);return i||(i=document.createElement("div"),i.id=e,t?h(i):document.body.appendChild(i)),i}function h(t){const e=document.getElementById(l.EDITOR_PREVIEWER_ID);e&&e.appendChild(t)}const p=t=>o.createElement("div",{className:a(s.dialogBody,t.className)},t.children),E=t=>o.createElement("div",{className:a(s.dialogFooter,t.className)},t.children);class v extends o.Component{constructor(e){super(e),this.modalRoot=g(this.props.isPreviewMode),this.modalContainer=n.SSRHelper.isSSR()?null:document.createElement("div")}componentDidMount(){!this.modalRoot||!this.modalContainer||this.modalRoot.appendChild(this.modalContainer)}componentWillUnmount(){!this.modalRoot||!this.modalContainer||this.modalRoot.removeChild(this.modalContainer)}renderDialog(){const{title:e="",className:i="",onClose:r=null}=this.props;return o.createElement("section",{className:a("dialog",i,l.OverrideCSS.BODY_FONT)},e&&o.createElement("div",{className:"dialogHeader"},o.createElement("h2",{className:a("titleContainer",l.OverrideCSS.TITLE_FONT)},e),!!r&&o.createElement("div",{className:"closeButtonContainer",style:{color:"rgb(var(--od-rgba-secondary)"}},o.createElement("button",{onClick:()=>{r&&r()}},o.createElement(c.X,null)))),this.props.children)}renderDialogOverlay(){const{isOpen:e}=this.props;return e?o.createElement("div",{className:"dialogOverlay editorDialogOverlay"},this.renderDialog()):null}render(){var e;return this.props.isPreviewMode&&((e=this.props.className)!=null&&e.includes("paymentStatusDialog"))?this.renderDialogOverlay():this.modalContainer?d.createPortal(this.renderDialogOverlay(),this.modalContainer):o.createElement("div",null)}}exports.Dialog=v;exports.DialogBody=p;exports.DialogFooter=E;
