1import{d as o}from"./GlobalStylesStore-CHYE5Nly.js";import{T as i,h as e}from"./TemplateElement-CdZ7OCoX.js";import{u as r,w as a}from"./directives-CgZXbjBP.js";import{i as n}from"./i18n-BHsd5ecF.js";import"./icon.js-CyOdugBa.js";import"./StyledElement-7gi18rn4.js";const h=":host{display:contents}.content{width:clamp(300px,50ch,90%)}";class l extends i{constructor(){super({styles:[h],shadowRender:!0}),this._geoResolved=!1,this._isCH=!1}properties(){return{text:"",buttonLabel:"",cookieConsentGroup:"C0001",showBanner:!0,onlyCh:!1}}get hasConsented(){return window.OptanonActiveGroups&&window.OptanonActiveGroups.includes(this.cookieConsentGroup)}get shouldRenderContent(){return this.onlyCh?this._geoResolved?this._isCH:!1:!0}connected(){if(!(this.hasAttribute("text")&&this.hasAttribute("button-label"))){if(this.cookieConsentGroup==="C0001"){this.showBanner=!1;return}this.text=n("cookieConsentOverlayMessages.defaultText"),this.onlyCh&&(this.showBanner=!1),window.optanonReady().then(()=>{var s;const t=(s=window.Optanon)==null?void 0:s.getGeolocationData();if(this._isCH=(t==null?void 0:t.country)==="CH",this._geoResolved=!0,this._isCH&&(this.text=n(`cookieConsentOverlayMessages.${this.cookieConsentGroup}.text`),this.buttonLabel=n(`cookieConsentOverlayMessages.${this.cookieConsentGroup}.buttonLabel`)),!this.shouldRenderContent){this.showBanner=!1;return}this.showBanner=!this.hasConsented})}}events(){return{window:{OneTrustGroupsUpdated:()=>{if(!this.shouldRenderContent){this.showBanner=!1;return}this.showBanner=!this.hasConsented}},"[data-consent]":{click:()=>{var t;(t=window.Optanon)==null||t.UpdateConsent("Category",`${this.cookieConsentGroup}:1`)}}}}template(){if(!this.showBanner)return e`<slot></slot>`;const t=new DOMParser().parseFromString(this.text,"text/html").documentElement.textContent;return e` 2 <div class="relative aspect-video min-h-[250px]"> 3 <div class="absolute inset-0 h-full w-full bg-gray-20 grid place-items-center z-[12]"> 4 <div class="content bg-[white] p-16 md:p-24 rounded-xs"> 5 <div class="richtext" style="margin-bottom: 1rem;">${r(t)}</div> 6 ${a(this.buttonLabel&&this.cookieConsentGroup,e`<button class="btn btn-primary" data-consent>${this.buttonLabel}</button>`)} 7 </div> 8 </div> 9 </div> 10 `}}o("mb-cookie-consent-banner",l);export{l as default}; 11//# sourceMappingURL=cookie-consent-banner.js-B3Q65kPn.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.