"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[1370],{41370:(e,t,l)=>{l.r(t),l.d(t,{default:()=>r});var a=l(86087),n=l(51609),o=l(27723),p=l(45111);const r=(0,n.memo)((({label:e,id:t,value:l,onChange:r,required:i,defaultValue:c,disabled:m,options:u={},units:s=["px"]})=>{const d=c.type||l.type||s[0],[g,b]=(0,n.useState)(d),[k,z]=(0,n.useState)(!1),h={top:(0,o.__)("Top","complianz-gdpr"),right:(0,o.__)("Right","complianz-gdpr"),bottom:(0,o.__)("Bottom","complianz-gdpr"),left:(0,o.__)("Left","complianz-gdpr")};(0,n.useEffect)((()=>{l.top===l.right&&l.top===l.bottom&&l.top===l.left&&z(!0)}),[]),(0,n.useEffect)((()=>{k&&E(l.top,"top")}),[k]);const E=(e,t)=>{let a={...l};k?a=_(e):a[t]=e,r(a)},_=e=>{let t={...l};return t.top=e,t.right=e,t.bottom=e,t.left=e,t};return(0,a.createElement)("div",{className:"cmplz-border-input"},Object.keys(h).map((e=>{const t=h[e],o=l.hasOwnProperty(e)?l[e]:c[e];return(0,a.createElement)(n.Fragment,{key:e},(0,a.createElement)("input",{className:"cmplz-border-input-side",type:"number",key:e,onChange:t=>E(t.target.value,e),value:o}),(0,a.createElement)("p",{className:"cmplz-border-input-side-label"},t))})),k&&(0,a.createElement)("button",{className:"cmplz-border-input-link linked",onClick:()=>z(!k)},(0,a.createElement)(p.default,{name:"linked",size:16,tooltip:(0,o.__)("Unlink values","complianz-gdpr")})),!k&&(0,a.createElement)("button",{className:"cmplz-border-input-link",onClick:()=>z(!k)},(0,a.createElement)(p.default,{name:"unlinked",size:16,tooltip:(0,o.__)("Link values together","complianz-gdpr")})),s.length>1&&(0,a.createElement)("div",{className:"cmplz-border-input-unit"},(0,a.createElement)("select",{value:g,onChange:e=>(e=>{b(e);let t={...l};t.type=e,r(t)})(e.target.value)},s.map(((e,t)=>(0,a.createElement)("option",{key:t,value:e},e))))),1===s.length&&(0,a.createElement)("div",{className:"cmplz-border-input-unit"},g))}))}}]);