"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[4769],{4769(e,t,l){l.r(t),l.d(t,{default:()=>i});var n=l(1609),o=l(6427),a=l(6087),r=l(7723),c=l(2144),m=l(9668),u=l(6550);const d=({onClickOutside:e,children:t,toggleRef:l})=>{const o=(0,a.useRef)();return(0,a.useEffect)(()=>{const t=t=>{l?.current&&l.current.contains(t.target)||o.current&&!o.current.contains(t.target)&&e?.()};return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[e,l]),(0,n.createElement)("div",{ref:o},t)},i=({componentId:e,defaultValue:t,updateField:l,...i})=>{const s=e=>t=>l(e,t),b=e=>t=>l(e,t.target.value),_=(0,a.useRef)();return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(o.Dropdown,{popoverProps:{placement:"bottom-end"},className:"og-clone",contentClassName:"og og-clone__content",focusOnMount:!1,renderToggle:({onToggle:e})=>(0,n.createElement)("label",{ref:_,className:"og-status "+(t.clone?"og-status--active":""),onClick:e},(0,r.__)("Cloneable","meta-box-builder")),renderContent:({onClose:l})=>(0,n.createElement)(d,{onClickOutside:l,toggleRef:_},(0,n.createElement)(o.Button,{icon:c.A,onClick:l,iconSize:16}),(0,n.createElement)(o.ToggleControl,{className:"og-field",label:(0,r.__)("Make the field cloneable","meta-box-builder"),checked:t.clone,onChange:s("clone")}),(0,n.createElement)(o.ToggleControl,{className:"og-field",label:(0,n.createElement)(n.Fragment,null,(0,r.__)("Start with no inputs","meta-box-builder"),(0,n.createElement)(u.default,{content:(0,r.__)('Show no inputs at first except the "+ Add more" button',"meta-box-builder")})),checked:t.clone_empty_start,onChange:s("clone_empty_start")}),(0,n.createElement)(o.ToggleControl,{className:"og-field",label:(0,r.__)("Allow to reorder clones","meta-box-builder"),checked:t.sort_clone,onChange:s("sort_clone")}),(0,n.createElement)(o.ToggleControl,{className:"og-field",label:(0,r.__)("Set default values for new clones","meta-box-builder"),checked:t.clone_default,onChange:s("clone_default")}),(0,n.createElement)(o.ToggleControl,{className:"og-field",label:(0,n.createElement)(n.Fragment,null,(0,r.__)("Save in multiple rows","meta-box-builder"),(0,n.createElement)(u.default,{content:(0,r.__)("Save each clone in a single row instead of saving all clones in one serialized row in the database","meta-box-builder")})),checked:t.clone_as_multiple,onChange:s("clone_as_multiple")}),(0,n.createElement)(m.default,{label:(0,r.__)("Number of clones","meta-box-builder")},(0,n.createElement)("div",{className:"og-input-group"},(0,n.createElement)("label",{htmlFor:`${e}-min_clone`},(0,r.__)("Min","meta-box-builder")),(0,n.createElement)("input",{type:"number",min:"0",id:`${e}-min_clone`,defaultValue:t.min_clone,onChange:b("min_clone")}),(0,n.createElement)("label",{htmlFor:`${e}-max_clone`},(0,r.__)("Max","meta-box-builder")),(0,n.createElement)("input",{type:"number",min:"0",id:`${e}-max_clone`,defaultValue:t.max_clone,onChange:b("max_clone")}))),(0,n.createElement)(m.default,{htmlFor:`${e}-add_button`,label:(0,r.__)("Add more text","meta-box-builder"),description:(0,r.__)('Custom text for the the "+ Add more" button. Leave empty to use the default text.',"meta-box-builder")},(0,n.createElement)("input",{type:"text",id:`${e}-add_button`,defaultValue:t.add_button,onChange:b("add_button")})))}))}}}]);