'use client';
import{jsx as e,jsxs as l}from"react/jsx-runtime";import{useEditorMode as o,isEmptyChildren as s,filterToolbarPreview as t}from"@gem-sdk/core";import a from"../../grid/components/ChildrenDroppable.js";import{createAttr as i,createStyle as r,createClass as m,If as n}from"@gem-sdk/system";import{getAttr as c,getAttrContainer as d,getAttrOverlay as p,getAttrClose as f}from"../common/attrs.js";import{getWrapperStyle as g,getContainStyle as y,getBackdropStyle as u,getOverlayStyle as b,getDialogContentStyle as h,getButtonContentStyle as v,getSvgContentStyle as j,getBodyContentStyle as N}from"../common/styles.js";import{getContainClasses as k,getBackdropClasses as C,getOverlayClasses as D,getDialogContentClasses as L,getHeadContentClasses as x,getButtonContentClasses as B,getSvgContentClasses as I,getBodyContentClasses as S}from"../common/classes.js";import w from"../../button/components/ButtonIcon.js";import{useDialog as z}from"../hooks/useDialog.js";let Dialog=E=>{let{setting:M,children:q,builderProps:A,style:F,advanced:G,builderAttrs:H}=E,J=G?.d,{name:K,fullScreen:O,width:P,height:Q,position:R,overlayColor:T,overlayOpacity:U,iconSize:V,closeButtonPosition:W,iconSvg:X}=M??{},Y=o(),{ref:Z,overlay:$,handleClickOverlay:_,closeModal:ee,open:el,dialogId:eo}=z(M,A,"edit"===Y),es="edit"!==Y,et=i({...c({uid:A?.uid||""})}),ea=r({...g(J)}),ei=m({...k(G?.cssClass,U,T)}),er=i({...d({uid:eo||""})}),em=r({...y()}),en=m({...C(R)}),ec=r({...u(F)}),ed=i({...p()}),ep=m({...D()}),ef=r({...b(U,T,F)}),eg=r({...h({style:F,width:P,height:Q,fullScreen:O})}),ey=m({...L({setting:M,enableEffect:el,isILP:es})}),eu=i({...f()}),eb=m({...x()}),eh=r({...v(M)}),ev=m({...B(W)}),ej=r({...j(V)}),eN=m({...I()}),ek=r({...N(M,F)}),eC=m({...S()});return e("div",{...et,style:ea,children:(el||"edit"!==Y)&&e("dialog",{ref:Z,open:el,"aria-label":K,...er,className:ei,style:em,children:l("div",{"aria-label":"Backdrop",className:en,style:ec,children:[n(!!T,e("div",{ref:$,...ed,className:ep,style:ef,onClick:_,"aria-hidden":!0})),e("span",{className:eb}),l("div",{role:"dialog","aria-label":"Dialog content",...H,className:ey,style:eg,children:[e("button",{...eu,type:"button",tabIndex:-1,className:ev,style:eh,onClick:ee,children:e(w,{iconSvg:X??`<svg viewBox="0 0 12 12" fill="currentColor" style={svgContentStyle}>
                  <path d="M7.1,6l4.5,4.5l-1.1,1.1L6,7.1l-4.5,4.5l-1.1-1.1L4.9,6L0.5,1.5l1.1-1.1L6,4.9l4.5-4.5l1.1,1.1L7.1,6z"></path>
                </svg>`,styles:ej,classes:eN})}),e("div",{"aria-label":"Dialog body",style:ek,className:eC,children:s(q)?e(a,{}):t(q)}),t(q,!0)]})]})})})};export{Dialog as default};
