var k=Object.defineProperty,N=Object.defineProperties;var v=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable;var x=(e,t,a)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,l=(e,t)=>{for(var a in t||(t={}))C.call(t,a)&&x(e,a,t[a]);if(b)for(var a of b(t))g.call(t,a)&&x(e,a,t[a]);return e},r=(e,t)=>N(e,v(t));import{R as h,j as n}from"./react-vendor-xYZnmIII.js";import{c as y}from"./ui-components-CQM92IK3.js";import{useEditor as R}from"./use-editor-CiTCcx1l.js";import{E as j}from"./element-wrapper-BnFoieV6.js";import"./inertia-vendor-cBbDTmhJ.js";import"./ui-vendor-Ds9iwIxa.js";import"./interactive-vendor-B1OgcAgP.js";import"./editor-provider-0C4WlrME.js";import"./v4-DsPse6Vr.js";import"./index-D-Nk4yec.js";import"./ActionsWrapper-DCj6FSQ6.js";const $=({element:e})=>{const{dispatch:t,editor:a}=R(),{editor:i}=a,{styles:p,content:s}=e,c=h.useRef(null),o=typeof s=="object"&&"label"in s?s.label:"Checkbox",m=typeof s=="object"&&"name"in s?s.name:"",d=typeof s=="object"&&"value"in s?s.value:"on",u=typeof s=="object"&&"checked"in s?s.checked:!1;return h.useEffect(()=>{c.current&&c.current.innerText!==o&&(c.current.innerText=o)},[o]),i.liveMode?n.jsxs("label",{style:p,className:y("flex items-center gap-2",e.className),children:[n.jsx("input",{type:"checkbox",name:m,value:d,defaultChecked:u}),n.jsx("span",{className:"ml-2",children:o})]}):n.jsx(j,{applyStyles:!1,element:e,children:n.jsxs("label",{style:p,className:y("flex items-center gap-2",e.className),children:[n.jsx("input",{type:"checkbox",name:m,value:d,defaultChecked:u,disabled:!i.liveMode}),n.jsx(j,{element:r(l({},e),{id:`${e.id}-label`,type:"span"}),tag:"span",wrapperClassName:"",showDeleteButton:!1,htmlAttributes:{ref:c,className:"ml-2 outline-none"},contentEditable:!i.liveMode,suppressContentEditableWarning:!0,onBlur:E=>{const f=E.target.innerText;f!==o&&t({type:"UPDATE_ELEMENT",payload:{elementDetails:r(l({},e),{content:r(l({},typeof s=="object"?s:{}),{label:f})})}})},children:o})]})})};export{$ as default};
