"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[277,5228],{40277:(e,l,t)=>{t.r(l),t.d(l,{default:()=>u});var a=t(51609),n=t(25228),o=t(88499),c=t(4219),r=t(27723),m=t(86087),i=t(42838),s=t.n(i);const u=(0,m.memo)((e=>{const{customizeUrl:l,selectedBanner:t,bannerDataLoaded:m}=(0,o.default)(),{updateField:i,setChangedField:u}=(0,c.default)();let p,d="cmplz-logo-preview";return"complianz"===e.value?d+=" cmplz-complianz-logo":"site"===e.value&&(d+=" cmplz-theme-image"),(0,a.createElement)("div",{className:"cmplz-logo-container"},(0,a.createElement)(n.default,{label:e.label,onChange:l=>{return a=l,i(e.id,a),u(e.id,a),void(document.querySelector(".cmplz-cookiebanner .cmplz-logo").innerHTML=t.logo_options[a]);var a},value:e.value,options:e.options}),"complianz"===e.value&&(0,a.createElement)("div",{className:d},(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:s().sanitize(t.logo_options[e.value])}})),"site"===e.value&&(0,a.createElement)("div",{className:d},(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:s().sanitize(t.logo_options[e.value])}}),"site"===e.value&&0===t.logo_options[e.value].length&&(0,a.createElement)(a.Fragment,null,(0,a.createElement)("p",null,(0,r.__)("No logo found. Please add a logo in the customizer.","complianz-gdpr")))),"custom"===e.value&&(0,a.createElement)("div",{className:"cmplz-logo-preview cmplz-clickable",onClick:()=>(p||(p=wp.media({title:(0,r.__)("Select a logo","complianz-gdpr"),button:{text:(0,r.__)("Set logo","complianz-gdpr")},multiple:!1}),p.on("select",(function(){for(var e=p.state().get("selection").length,l=p.state().get("selection").models,t=0;t<e;t++){var a=l[t].id,n=!1;if((n=l[t].attributes.sizes.cmplz_banner_image)||(n=l[t].attributes.sizes.medium),n||(n=l[t].attributes.sizes.thumbnail),n||(n=l[t].attributes.sizes.full),n){var o=n.url;i("logo_attachment_id",a),u("logo_attachment_id",a);let e=document.createElement("img");document.querySelector(".cmplz-cookiebanner .cmplz-logo").appendChild(e),document.querySelector(".cmplz-cookiebanner .cmplz-logo img").src=o,document.querySelector(".cmplz-custom-image img").src=o}}}))),void p.open())},(0,a.createElement)("div",{dangerouslySetInnerHTML:{__html:s().sanitize(t.logo_options[e.value])},alt:"Banner Logo",className:"cmplz-custom-image"})))}))},25228:(e,l,t)=>{t.r(l),t.d(l,{default:()=>m});var a=t(51609),n=t(86087),o=t(45296),c=t(45111),r=t(27723);const m=(0,n.memo)((({value:e=!1,onChange:l,required:t,defaultValue:n,disabled:m,options:i={},canBeEmpty:s=!0,label:u})=>{if(Array.isArray(i)){let e={};i.map((l=>{e[l.value]=l.label})),i=e}return s?(""===e||!1===e||0===e)&&(e="0",i={0:(0,r.__)("Select an option","complianz-gdpr"),...i}):e||(e=Object.keys(i)[0]),(0,a.createElement)("div",{className:"cmplz-input-group cmplz-select-group",key:u},(0,a.createElement)(o.bL,{value:e,defaultValue:n,onValueChange:l,required:t,disabled:m&&!Array.isArray(m)},(0,a.createElement)(o.l9,{className:"cmplz-select-group__trigger"},(0,a.createElement)(o.WT,null),(0,a.createElement)(c.default,{name:"chevron-down"})),(0,a.createElement)(o.UC,{className:"cmplz-select-group__content",position:"popper"},(0,a.createElement)(o.PP,{className:"cmplz-select-group__scroll-button"},(0,a.createElement)(c.default,{name:"chevron-up"})),(0,a.createElement)(o.LM,{className:"cmplz-select-group__viewport"},(0,a.createElement)(o.YJ,null,Object.entries(i).map((([e,l])=>(0,a.createElement)(o.q7,{disabled:Array.isArray(m)&&m.includes(e),className:"cmplz-select-group__item",key:e,value:e},(0,a.createElement)(o.p4,null,l)))))),(0,a.createElement)(o.wn,{className:"cmplz-select-group__scroll-button"},(0,a.createElement)(c.default,{name:"chevron-down"})))))}))}}]);