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