"use strict";(self.webpackChunkcomplianz_gdpr=self.webpackChunkcomplianz_gdpr||[]).push([[800],{10800:(e,t,c)=>{c.r(t),c.d(t,{default:()=>_});var r=c(51609),a=c(86087),n=c(58168),s=c(9957),l=c(91071),o=c(62133),d=c(81351),u=c(85357),i=c(31769),p=c(12579);const h="Switch",[b,m]=(0,o.A)(h),[f,k]=b(h),v=(0,r.forwardRef)(((e,t)=>{const{__scopeSwitch:c,name:a,checked:o,defaultChecked:u,required:i,disabled:h,value:b="on",onCheckedChange:m,...k}=e,[v,E]=(0,r.useState)(null),C=(0,l.s)(t,(e=>E(e))),y=(0,r.useRef)(!1),_=!v||Boolean(v.closest("form")),[z=!1,S]=(0,d.i)({prop:o,defaultProp:u,onChange:m});return(0,r.createElement)(f,{scope:c,checked:z,disabled:h},(0,r.createElement)(p.sG.button,(0,n.A)({type:"button",role:"switch","aria-checked":z,"aria-required":i,"data-state":g(z),"data-disabled":h?"":void 0,disabled:h,value:b},k,{ref:C,onClick:(0,s.m)(e.onClick,(e=>{S((e=>!e)),_&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())}))})),_&&(0,r.createElement)(w,{control:v,bubbles:!y.current,name:a,value:b,checked:z,required:i,disabled:h,style:{transform:"translateX(-100%)"}}))})),w=e=>{const{control:t,checked:c,bubbles:a=!0,...s}=e,l=(0,r.useRef)(null),o=(0,u.Z)(c),d=(0,i.X)(t);return(0,r.useEffect)((()=>{const e=l.current,t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(o!==c&&r){const t=new Event("click",{bubbles:a});r.call(e,c),e.dispatchEvent(t)}}),[o,c,a]),(0,r.createElement)("input",(0,n.A)({type:"checkbox","aria-hidden":!0,defaultChecked:c},s,{tabIndex:-1,ref:l,style:{...e.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function g(e){return e?"checked":"unchecked"}const E=v,C=(0,r.forwardRef)(((e,t)=>{const{__scopeSwitch:c,...a}=e,s=k("SwitchThumb",c);return(0,r.createElement)(p.sG.span,(0,n.A)({"data-state":g(s.checked),"data-disabled":s.disabled?"":void 0},a,{ref:t}))}));var y=c(4219);const _=(0,a.memo)((({value:e,onChange:t,required:c,disabled:a,className:n,label:s,id:l})=>{const{getField:o}=(0,y.default)();let d=e;return"0"!==e&&"1"!==e||(d="1"===e),(0,r.createElement)("div",{className:"cmplz-input-group cmplz-switch-group"},(0,r.createElement)(E,{className:"cmplz-switch-root "+n,checked:d,onCheckedChange:e=>{"banner"===o(l).data_target&&(e=e?"1":"0"),t(e)},disabled:a,required:c},(0,r.createElement)(C,{className:"cmplz-switch-thumb"})))}))},85357:(e,t,c)=>{c.d(t,{Z:()=>a});var r=c(51609);function a(e){const t=(0,r.useRef)({value:e,previous:e});return(0,r.useMemo)((()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous)),[e])}}}]);