"use strict";(self.webpackChunk_contentpass_ui=self.webpackChunk_contentpass_ui||[]).push([[4301],{41340:(n,e,t)=>{t.d(e,{default:()=>p});var s=t(11011);t(98304);var o=t(42224);function r(n){const{window:e}=n,t=e.__cmp("getCMPData");if(t)return o.A.info("[CP] Consentmanager found cmpData",t),t;o.A.info("[CP] Consentmanager no cmpData found")}function a(n){return!(n&&n.purposesList&&n.purposesList.length&&n.purposeConsents&&n.vendorsList&&n.vendorsList.length&&n.vendorConsents)}function c(n){return((null==n?void 0:n.purposesList)||[]).map((n=>n.id)).filter((n=>"c1"!==n))}async function i(n){var e;const t=await n.fetchPropertyConfig,s=(null==t||null===(e=t.cmpConfig)||void 0===e?void 0:e.whitelistedVendors)||[],i=r(n);if(a(i))return!1;const l=c(i),d=i.purposeConsents||{},u=(i.vendorsList||[]).map((n=>"".concat(n.id))).filter((n=>!s.includes(n))),C=i.vendorConsents||{},f=l.every((n=>d[n]))&&u.every((n=>C[n]));return o.A.info("[CP] Consentmanager were all required consents given?",f,i),f}async function l(){}const d=["consentapproved","consentrejected","consentcustom"];let u=!1;var C=t(86153);let f;const p={name:s.Ay.CONSENTMANAGER,acceptAll:async function(n){return n.window.__cmp&&n.window.__cmp("setConsent",1),!1},denyAll:async function(n){return n.window.__cmp("setConsent",0),!1},getCustomPurposes:async function(n,e){var t;return((null===(t=n.window.cmpmngr)||void 0===t?void 0:t.purposes)||[]).filter((n=>!n.isIABPurpose())).map((n=>({id:Number(n.id.replace("c",""))||-1,purposeId:n.id,name:n.nameTrans||n.nameTrans[e]||n.nameTrans.XX,description:n.descrTrans||n.descrTrans[e]||n.descrTrans.XX})))},getNumberOfVendors:async function(n){var e;const t=r(n);return a(t)?0:null===(e=t.vendorsList)||void 0===e?void 0:e.length},getRequiredPurposes:async function(n){return c(r(n)).map((n=>"string"==typeof n&&n.startsWith("r")?n.replace("r","sf"):"".concat(n)))},hasAllConsents:i,hideCmpLayer:l,onContentpassUser:async function(){},registerForConsentChanges:async function(n,e){async function t(){const t=await i(n);e(t)}d.forEach((e=>{n.window.__cmp("addEventListener",[e,t,!1],null)})),t()},render:async function(n,e){const{window:t}=n;if(o.A.info("[CP] Render Consentmanager CMP"),u)return void o.A.info("[CP] Consentmanager CMP already initialized");u=!0;let s=!1;const r=e=>r=>{async function a(n){if(o.A.info("[CP] Consentmanager CMP consentscreenoff event fired"),n)return o.A.info("[CP] Consentmanager CMP all consents given, allowing close"),u=!1,void(r&&r(n));o.A.info("[CP] Consentmanager CMP all consents given?",n),s=!1,r&&r(n)}s||(s=!0,o.A.info("[CP] Funnel called Consentmanager CMP callback:",e),"acceptAll"===e&&(a(!0),setTimeout((()=>{o.A.info("[CP] Accept all Consentmanager CMP consents"),t.__cmp("setConsent",1)}),0)),"denyAll"===e&&(t.__cmp("setConsent",0),o.A.info("[CP] Deny all Consentmanager CMP consents"),a(!1)),"show"===e&&(t.__cmp("showScreenAdvanced"),o.A.info("[CP] Show Consentmanager CMP"),t.__cmp("addEventListener",["consentscreenoff",async function e(){t.__cmp("removeEventListener",["consentscreenoff",e,!1],null),a(await i(n))},!1],null)))};e({showCmpTool:r("show"),acceptAllCmpConsents:r("acceptAll"),denyAllCmpConsents:r("denyAll")})},renderControl:async function(n,e){var t;let{renderContentpassLayer:s}=e;o.A.info("[CP] Start Consentmanager CMP");const r=await n.fetchPropertyConfig;async function a(){o.A.info("[CP] Checking Consentmanager CMP consents");await i(n)?o.A.info("[CP] Not rendering because of Consentmanager CMP collected consent."):(o.A.info("[CP] Rendering Consentmanager CMP due to missing consents."),s())}null!=r&&null!==(t=r.funnelConfig)&&void 0!==t&&t.cmpRendersWall?o.A.info("[CP] Not rendering because Consentmanager renders the wall"):(await l(),n.window.__cmp("addEventListener",["consentscreenoff",()=>{o.A.info("[CP] Consentmanager consentscreenoff event, considering to re-open funnel"),a()},!1],null),a())},resurfaceWall:async function(n){const{window:e}=n;o.A.info("[CP] Watching for consent changes in Consentmanager"),e.__tcfapi("addEventListener",2,(async(t,s)=>{if(!s)return;if(!["tcloaded","useractioncomplete"].includes(t.eventStatus))return;await i(n)||(o.A.info("[CP] Consent changed to non-full consent. Resurfacing the wall"),setTimeout((()=>{e.cmpmngr&&e.cmpmngr.display&&(e.cmpmngr.display.toggleWasChanged=!1),e.__cmp("showScreen")}),0))}))},waitForInit:function(n){return f||(f=async function(n){const{window:e}=n;return await(0,C.A)(e,"__cmp"),a(r(n))?new Promise((n=>{e.__cmp("addEventListener",["settings",()=>{o.A.info("[CP] Consentmanager settings event, CMP is ready"),n()},!1],null)})):(o.A.info("[CP] Found cmpData, CMP is ready"),Promise.resolve())}(n)),f}}}}]);