var te=Object.defineProperty,re=Object.defineProperties;var ne=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var q=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable;var K=(e,o,t)=>o in e?te(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,i=(e,o)=>{for(var t in o||(o={}))q.call(o,t)&&K(e,t,o[t]);if(b)for(var t of b(o))J.call(o,t)&&K(e,t,o[t]);return e},v=(e,o)=>re(e,ne(o));var x=(e,o)=>{var t={};for(var r in e)q.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&b)for(var r of b(e))o.indexOf(r)<0&&J.call(e,r)&&(t[r]=e[r]);return t};import{R as ae,j as l}from"./react-vendor-xYZnmIII.js";import{c}from"./ui-components-CQM92IK3.js";import{useEditor as ie}from"./use-editor-CiTCcx1l.js";import{g as de}from"./index-D-Nk4yec.js";import Q from"./ActionsWrapper-DCj6FSQ6.js";import{i as se,j as le}from"./interactive-vendor-B1OgcAgP.js";const ce=(e,o,t)=>{if(!e)return;const m={container:"container",section:"section",__body:"container","2Col":"2Col","3Col":"3Col",heading:"heading",paragraph:"paragraph",span:"span",image:"image",video:"video",iframe:"iframe",icon:"icon",input:"input",textarea:"textarea",select:"select",checkbox:"checkbox",radio:"radio",button:"button",label:"label",form:"form",link:"link",ul:"ul",li:"li",customCode:"customCode",dynamicContent:"dynamicContent",dynamicWrapper:"dynamicWrapper",article:"article",nav:"nav",header:"header",footer:"footer",aside:"aside",div:"div",hr:"hr",dropdownMenu:"dropdownMenu",dropdownMenuTrigger:"dropdownMenuTrigger",dropdownMenuContent:"dropdownMenuContent",dropdownMenuLabel:"dropdownMenuLabel",dropdownMenuItem:"dropdownMenuItem",popover:"popover",popoverTrigger:"popoverTrigger",popoverContent:"popoverContent",drawer:"drawer",drawerTrigger:"drawerTrigger",drawerContent:"drawerContent",accordion:"accordion",accordionItem:"accordionItem",accordionTrigger:"accordionTrigger",accordionContent:"accordionContent",tabs:"tabs",tabsList:"tabsList",tabsTrigger:"tabsTrigger",tabsContent:"tabsContent"}[e];m&&t({type:"ADD_ELEMENT",payload:de(o,m)})},pe=({element:e,children:o,tag:t="div",isContainer:r=!1,applyStyles:m=!0,wrapperClassName:f="relative",showDeleteButton:D=!0,htmlAttributes:U={},contentEditable:h,onKeyDown:j,onBlur:k,suppressContentEditableWarning:I})=>{var P;const{id:d,type:V}=e,{dispatch:N,editor:X}=ie(),{editor:a}=X,u=m?e.styles:{},{attributes:S,listeners:_,setNodeRef:L,transform:Y,transition:Z,isDragging:y,isOver:$,active:B}=se({id:d,data:{element:e,type:"existing-element",containerId:e.id},disabled:a.liveMode}),H=$&&B&&r,A={transform:le.Transform.toString(Y),transition:Z,opacity:y?.3:1},O=n=>{n.stopPropagation(),N({type:"CHANGE_CLICKED_ELEMENT",payload:{elementDetails:e}})},ee=n=>{n.stopPropagation();const p=n.dataTransfer.getData("componentType");ce(p,d,N)},oe=n=>{n.preventDefault()},R=()=>r?f||"relative":["hr","dropdownMenuLabel","dropdownMenuItem","accordionItem","tabs"].includes(V)?c("relative block w-full",f):c("relative inline-block",f),z=U||{},{style:M,className:E}=z,C=x(z,["style","className"]),F=ae.useMemo(()=>{var G;const n=((G=e.htmlAttributes)==null?void 0:G.eventHandlers)||{},p={};return Object.keys(n).forEach(T=>{const g=n[T];if(typeof g=="string")try{p[T]=new Function("return "+g)()}catch(ge){}else typeof g=="function"&&(p[T]=g)}),p},[(P=e.htmlAttributes)==null?void 0:P.eventHandlers]),{onClick:s}=F,W=x(F,["onClick"]),w=t;return h!==void 0?a.liveMode?l.jsx(w,v(i(i({style:M||u,className:c("outline-none",E)},C),W||{}),{onClick:n=>{s==null||s(n)},contentEditable:h,onKeyDown:j,onBlur:k,suppressContentEditableWarning:I,children:o})):l.jsx("div",{ref:L,style:A,className:c(R(),{"!border-solid !border-blue-500":a.selectedElement.id===d&&!a.liveMode,"!border !border-dashed":!a.liveMode,"z-50":y}),onClick:O,children:l.jsx(Q,{id:d,element:e,listeners:_,attributes:S,showDeleteButton:D,showDropIndicator:H,children:l.jsx(w,v(i({style:M||u,className:c("outline-none",E)},C),{contentEditable:h,onKeyDown:j,onBlur:k,suppressContentEditableWarning:I,children:o}))})}):l.jsx(w,v(i(i({ref:L,style:i(i({},r?u:M||u),A),className:c(R(),{"!border-solid !border-blue-500":a.selectedElement.id===d&&!a.liveMode,"!border !border-dashed":!a.liveMode,"z-50":y},r?e.className:void 0,E)},C),a.liveMode?W||{}:{}),{onClick:n=>{a.liveMode?s==null||s(n):O(n)},onDrop:r?ee:void 0,onDragOver:r?oe:void 0,children:l.jsx(Q,{id:d,element:e,listeners:_,attributes:S,showDeleteButton:D,showDropIndicator:H,children:o})}))},Ce=Object.freeze(Object.defineProperty({__proto__:null,default:pe},Symbol.toStringTag,{value:"Module"}));export{pe as E,ce as a,Ce as e};
