'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 d,getAttrContainer as c,getAttrOverlay as p,getAttrClose as f}from"../common/attrs.js";import{getWrapperStyle as g,getContainStyle as u,getBackdropStyle as y,getOverlayStyle as b,getDialogContentStyle as h,getButtonContentStyle as v,getSvgContentStyle as j,getBodyContentStyle as C}from"../common/styles.js";import{getContainClasses as N,getBackdropClasses as k,getOverlayClasses as x,getDialogContentClasses as D,getHeadContentClasses as L,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 E=E=>{let{setting:M,children:q,builderProps:A,style:F,advanced:G,builderAttrs:H,pageContext:J}=E,K=G?.d,{name:O,fullScreen:P,width:Q,height:R,position:T,overlayColor:U,overlayOpacity:V,iconSize:W,closeButtonPosition:X,iconSvg:Y}=M??{},Z=o(),{ref:$,overlay:_,handleClickOverlay:ee,closeModal:el,open:eo,dialogId:es}=z(M,A,"edit"===Z),et="edit"!==Z,ea=i({...d({uid:A?.uid||""})}),ei=r({...g(K)}),er=m({...N(G?.cssClass,V,U)}),em=i({...c({uid:es||""})}),en=r({...u()}),ed=m({...k(T)}),ec=r({...y(F)}),ep=i({...p()}),ef=m({...x()}),eg=r({...b(V,U,F)}),eu=r({...h({style:F,width:Q,height:R,fullScreen:P})}),ey=m({...D({setting:M,enableEffect:eo,isILP:et})}),eb=i({...f()}),eh=m({...L()}),ev=r({...v(M)}),ej=m({...B(X)}),eC=r({...j(W)}),eN=m({...I()}),ek=r({...C({setting:M,style:F,uid:A?.uid,pageContext:J??{}})}),ex=m({...S()});return e("div",{...ea,style:ei,children:(eo||"edit"!==Z)&&e("dialog",{ref:$,open:eo,"aria-label":O,...em,className:er,style:en,children:l("div",{"aria-label":"Backdrop",className:ed,style:ec,children:[n(!!U,e("div",{ref:_,...ep,className:ef,style:eg,onClick:ee,"aria-hidden":!0})),e("span",{className:eh}),l("div",{role:"dialog","aria-label":"Dialog content",...H,className:ey,style:eu,children:[e("button",{...eb,type:"button",tabIndex:-1,className:ej,style:ev,onClick:el,children:e(w,{iconSvg:Y??`<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:eC,classes:eN})}),e("div",{"aria-label":"Dialog body",style:ek,className:ex,children:s(q)?e(a,{}):t(q)}),t(q,!0)]})]})})})};export{E as default};
