var crypto=window.crypto||window.msCrypto,Dmp;crypto.randomUUID instanceof Function||(crypto.randomUUID=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(n){return(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16)})});Dmp=Dmp||{};Dmp.Platform=Dmp.Platform||{};Dmp.Platform.CookiesConsent=Dmp.Platform.CookiesConsent||{};Dmp.Platform.CookiesConsent.Manager=function(n){var t=this;this.consents={preferred:!1,marketing:!1,analytical:!1};this.sentEvents={};this.options=$.extend({consentIdSelector:"#js-cookie-consent-id",modalSelector:"#cookie-consent-modal",openModalSelector:".js-cookie-consent-open-modal",barSelector:".js-cookie-consent-bar",consentSubmitSelector:".js-cookie-consent-submit",consentSubmitAllSelector:".js-cookie-consent-submit-all",consentCheckboxesSelector:".js-cookie-consent-category",cookiesConsentID:crypto.randomUUID(),analyticCookieName:"Analytical",preferredCookieName:"Preferred",marketingCookieName:"Marketing"},n||{});this.cookiesConsentID=t.options.cookiesConsentID;this.init=function(){var i=this.getCookie(t.options.cookieName),n;i&&(n=JSON.parse(i),n&&(this.cookiesConsentID=n.ID,n.Consents.forEach(this.setCheckboxValue),this.saveConsent(n.Consents),this.triggerEvents()));this.shouldOpen(i)?this.open():this.close();this.initHandlers();$(t.options.consentIdSelector).text(this.cookiesConsentID)};this.setCheckboxValue=function(n){if(n.Agreement){var t="#"+n.Category;$(t).prop("checked",!0)}};this.shouldOpen=function(n){if(n===null)return!0;var t=JSON.parse(n);return t?this.remindConsentAfterUpdatePeriod(t):!0};this.open=function(){$(t.options.barSelector).show()};this.openModal=function(){$(t.options.modalSelector).modal()};this.close=function(){$(t.options.barSelector).hide();$(t.options.modalSelector).modal("hide")};this.getCookie=function(n){for(var t,r=n+"=",u=document.cookie.split(";"),i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1,t.length);if(t.indexOf(r)==0)return t.substring(r.length,t.length)}return null};this.setCookie=function(n,t,i){var u="",r;i&&(r=new Date,r.setTime(r.getTime()+i*864e5),u="; expires="+r.toUTCString());document.cookie=n+"="+(t||"")+u+"; path=/"};this.remindConsentAfterUpdatePeriod=function(n){var i=!1,r=new Date((new Date).setMonth((new Date).getMonth()-t.options.toUpdateInMonths)),u=new Date(Date.parse(n.Updated));return u<r&&n.Consents.forEach(function(n){n.Agreement||(i=!0)}),i};this.setConsent=function(n){var i=[],r;n.each(function(n,t){var r={Category:t.id,Agreement:t.checked};i.push(r)});r={ID:this.cookiesConsentID,Updated:new Date,Consents:i};this.setCookie(t.options.cookieName,JSON.stringify(r),t.options.daysValid);this.saveConsent(i);this.triggerEvents();$.ajax({url:t.options.logConsentUrl,type:"POST",data:JSON.stringify(r,null,2),contentType:"application/json; charset=utf-8"});this.close()};this.initHandlers=function(){$("body").on("click",t.options.consentSubmitSelector,function(){var n=$(t.options.consentCheckboxesSelector);t.setConsent(n)});$("body").on("click",t.options.consentSubmitAllSelector,function(){var n=$(t.options.consentCheckboxesSelector);n.each(function(n,t){t.checked=!0});t.setConsent(n)});$("body").on("click",t.options.openModalSelector,function(){t.openModal()})};this.saveConsent=function(n){n.forEach(function(n){switch(n.Category){case t.options.analyticCookieName:t.consents.analytical=n.Agreement;break;case t.options.preferredCookieName:t.consents.preferred=n.Agreement;break;case t.options.marketingCookieName:t.consents.marketing=n.Agreement}})};this.triggerEvents=function(){this.consents.analytical&&this.triggerEvent("Dmp.Platform.CookiesConsent.Event.LoadAnalytical");this.consents.marketing&&this.triggerEvent("Dmp.Platform.CookiesConsent.Event.LoadMarketing");this.consents.preferred&&this.triggerEvent("Dmp.Platform.CookiesConsent.Event.LoadPreferred")};this.triggerEvent=function(n){if(!this.sentEvents[n]){this.sentEvents[n]=!0;var t=document.createEvent("Event");t.initEvent(n,!0,!0);document.dispatchEvent(t)}};this.init()}