cookie-consent-gdpr 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +758 -0
- package/dist/cookie-consent-gdpr.cjs.js +2365 -0
- package/dist/cookie-consent-gdpr.esm.js +2363 -0
- package/dist/cookie-consent-gdpr.min.js +2 -0
- package/dist/cookie-consent-gdpr.umd.js +2371 -0
- package/dist/gdpr-cookie-consent.cjs.js +2365 -0
- package/dist/gdpr-cookie-consent.d.ts +182 -0
- package/dist/gdpr-cookie-consent.esm.js +2363 -0
- package/dist/gdpr-cookie-consent.min.js +2 -0
- package/dist/gdpr-cookie-consent.umd.js +2371 -0
- package/package.json +53 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! cookie-consent-gdpr v1.0.0 | MIT License | github.com/alexgarbacea/cookie-consent-gdpr */
|
|
2
|
+
var CookieConsent=function(){"use strict";var e={container:null,preferencesButton:null,layout:"bar",position:"bottom",closeOnBackdrop:!1,autoShow:!0,reconsentOnChange:!0,forceOverlay:!1,cookie:{name:"cc_consent",domain:"",path:"/",expiryDays:365,sameSite:"Lax",secure:"undefined"!=typeof window&&"https:"===window.location.protocol},webhook:{url:null,headers:{}},categories:{necessary:{enabled:!0,readOnly:!0,title:"Strictly Necessary",description:"These cookies are essential for the website to function and cannot be switched off. They are usually set in response to actions you take such as setting your privacy preferences, logging in, or filling in forms.",cookies:[]},functional:{enabled:!1,readOnly:!1,title:"Functional",description:"These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third-party providers whose services we have added to our pages.",cookies:[]},analytics:{enabled:!1,readOnly:!1,title:"Analytics",description:"These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us know which pages are the most and least popular and see how visitors move around the site.",cookies:[]},marketing:{enabled:!1,readOnly:!1,title:"Marketing",description:"These cookies may be set through our site by our advertising partners. They may be used to build a profile of your interests and show you relevant adverts on other sites.",cookies:[]}},texts:{bannerTitle:"We use cookies",bannerDescription:'We use cookies and similar technologies to help personalise content, tailor and measure ads, and provide a better experience. By clicking "Accept All", you consent to the use of ALL cookies. You may visit "Cookie Settings" to provide controlled consent.',acceptAll:"Accept All",rejectAll:"Reject All",settings:"Cookie Settings",preferencesTitle:"Cookie Preferences",preferencesDescription:"When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences, or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalised web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies.",save:"Save Preferences",acceptAllPreferences:"Accept All",rejectAllPreferences:"Reject All",alwaysActive:"Always Active",cookieNameLabel:"Name",cookieProviderLabel:"Provider",cookiePurposeLabel:"Purpose",cookieExpiryLabel:"Expiry",cookieTypeLabel:"Type",noCookies:"No cookies to display.",privacyPolicyLabel:"Privacy Policy",poweredBy:""},privacyPolicyUrl:"",theme:{primary:"#0e6b4e",primaryHover:"#0a5a40",primaryText:"#ffffff",background:"#ffffff",text:"#333333",textSecondary:"#666666",border:"#e0e0e0",overlay:"rgba(0, 0, 0, 0.55)",toggleOn:"#0e6b4e",toggleOff:"#cccccc",toggleKnob:"#ffffff",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",fontSize:"14px",borderRadius:"8px",zIndex:2147483645,maxWidth:"1140px",popupWidth:"400px"},onConsent:null,onRevoke:null,onAccept:null,onReject:null};function n(){this._listeners={}}function t(e){var n=function(e){for(var n=encodeURIComponent(e)+"=",t=document.cookie.split(";"),o=0;o<t.length;o++){var r=t[o].trim();if(0===r.indexOf(n))return decodeURIComponent(r.substring(n.length))}return null}(e);if(!n)return null;try{return JSON.parse(n)}catch(e){return null}}function o(e,n,t){!function(e,n,t){t=t||{};var o=encodeURIComponent(e)+"="+encodeURIComponent(n);if(t.expiryDays){var r=new Date;r.setTime(r.getTime()+864e5*t.expiryDays),o+="; expires="+r.toUTCString()}o+="; path="+(t.path||"/"),t.domain&&(o+="; domain="+t.domain),t.sameSite&&(o+="; SameSite="+t.sameSite),(t.secure||"None"===t.sameSite)&&(o+="; Secure"),document.cookie=o}(e,JSON.stringify(n),t)}function r(e,n){var t=Object.assign({},e);for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(n[o]&&"object"==typeof n[o]&&!Array.isArray(n[o])&&e[o]&&"object"==typeof e[o]&&!Array.isArray(e[o])?t[o]=r(e[o],n[o]):t[o]=n[o]);return t}function i(e,n){return document.querySelector(e)}function c(e,n){return Array.prototype.slice.call(document.querySelectorAll(e))}function a(e,n,t){var o=document.createElement(e);if(n)for(var r in n)"className"===r?o.className=n[r]:"innerHTML"===r?o.innerHTML=n[r]:"textContent"===r?o.textContent=n[r]:0===r.indexOf("on")?o.addEventListener(r.substring(2).toLowerCase(),n[r]):o.setAttribute(r,n[r]);return t&&("string"==typeof t?o.textContent=t:Array.isArray(t)?t.forEach(function(e){e&&o.appendChild("string"==typeof e?document.createTextNode(e):e)}):o.appendChild(t)),o}function s(e){if(!e)return"";var n=document.createElement("div");return n.appendChild(document.createTextNode(e)),n.innerHTML}function l(e,n){this.config=e,this.emitter=n,this.consent=null,this._configHash=this._computeConfigHash()}function p(e){this.emitter=e,this._activated={},this._observer=null}n.prototype.on=function(e,n){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(n),this},n.prototype.off=function(e,n){return this._listeners[e]?(n?this._listeners[e]=this._listeners[e].filter(function(e){return e!==n}):delete this._listeners[e],this):this},n.prototype.emit=function(e,n){if(!this._listeners[e])return this;for(var t=this._listeners[e].slice(),o=0;o<t.length;o++)try{t[o](n)}catch(e){console.error("[CookieConsent] Event handler error:",e)}return this},l.prototype._computeConfigHash=function(){var e=this.config.categories;return function(e){for(var n=0,t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t)|0;return Math.abs(n).toString(36)}(Object.keys(e).sort().map(function(n){return n+":"+(e[n].cookies||[]).map(function(e){return e.name}).sort().join(",")}).join("|"))},l.prototype.load=function(){return this.consent=t(this.config.cookie.name),this.consent},l.prototype.hasValid=function(){return!!this.consent&&(!(this.consent.expires&&new Date(this.consent.expires)<=new Date)&&(!this.config.reconsentOnChange||this.consent.configHash===this._configHash))},l.prototype.save=function(e){var n=new Date,t=new Date(n.getTime()+864e5*this.config.cookie.expiryDays);e.necessary=!0,this.consent={id:"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)}),timestamp:n.toISOString(),categories:e,configHash:this._configHash,expires:t.toISOString(),url:window.location.href,userAgent:navigator.userAgent},o(this.config.cookie.name,this.consent,{expiryDays:this.config.cookie.expiryDays,domain:this.config.cookie.domain,path:this.config.cookie.path,sameSite:this.config.cookie.sameSite,secure:this.config.cookie.secure}),this.emitter.emit("consent:given",this.consent);var r=this.config.categories;for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]&&r[i].readOnly||(e[i]?(this.emitter.emit("category:accepted",i),"function"==typeof this.config.onAccept&&this.config.onAccept(i)):(this.emitter.emit("category:rejected",i),"function"==typeof this.config.onReject&&this.config.onReject(i))));return"function"==typeof this.config.onConsent&&this.config.onConsent(this.consent),this._sendWebhook(this.consent),this.consent},l.prototype.revoke=function(){var e=this.consent;this.consent=null,function(e,n){n=n||{};var t=encodeURIComponent(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT";t+="; path="+(n.path||"/"),n.domain&&(t+="; domain="+n.domain),document.cookie=t}(this.config.cookie.name,{domain:this.config.cookie.domain,path:this.config.cookie.path}),this.emitter.emit("consent:revoked",e),"function"==typeof this.config.onRevoke&&this.config.onRevoke(e)},l.prototype.get=function(){return this.consent},l.prototype.hasCategory=function(e){return!(!this.consent||!this.consent.categories)&&!!this.consent.categories[e]},l.prototype.acceptAllMap=function(){var e={};for(var n in this.config.categories)Object.prototype.hasOwnProperty.call(this.config.categories,n)&&(e[n]=!0);return e},l.prototype.rejectAllMap=function(){var e={};for(var n in this.config.categories)Object.prototype.hasOwnProperty.call(this.config.categories,n)&&(e[n]=!!this.config.categories[n].readOnly);return e},l.prototype._sendWebhook=function(e){if(this.config.webhook&&this.config.webhook.url){var n={consentId:e.id,timestamp:e.timestamp,categories:e.categories,url:e.url,userAgent:e.userAgent,configHash:e.configHash},t=Object.assign({"Content-Type":"application/json"},this.config.webhook.headers||{});try{var o=new XMLHttpRequest;for(var r in o.open("POST",this.config.webhook.url,!0),t)Object.prototype.hasOwnProperty.call(t,r)&&o.setRequestHeader(r,t[r]);o.send(JSON.stringify(n))}catch(e){console.warn("[CookieConsent] Webhook failed:",e)}}},p.prototype.activate=function(e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&e[n]&&!this._activated[n]&&(this._activateCategory(n),this._activated[n]=!0)},p.prototype._activateCategory=function(e){for(var n=c('[data-cookiecategory="'+e+'"]'),t=0;t<n.length;t++)this._activateElement(n[t])},p.prototype._activateElement=function(e){"script"===e.tagName.toLowerCase()?this._activateScript(e):e.hasAttribute("data-src")&&(e.setAttribute("src",e.getAttribute("data-src")),e.removeAttribute("data-src"))},p.prototype._activateScript=function(e){for(var n=document.createElement("script"),t=0;t<e.attributes.length;t++){var o=e.attributes[t];"type"===o.name?n.setAttribute("type","text/javascript"):n.setAttribute(o.name,o.value)}n.hasAttribute("type")||n.setAttribute("type","text/javascript"),e.textContent&&(n.textContent=e.textContent),e.parentNode&&e.parentNode.replaceChild(n,e)},p.prototype.observe=function(e){var n=this;this._observer&&this._observer.disconnect(),"undefined"!=typeof MutationObserver&&(this._observer=new MutationObserver(function(t){for(var o=0;o<t.length;o++)for(var r=t[o].addedNodes,i=0;i<r.length;i++){var c=r[i];if(1===c.nodeType){var a=c.getAttribute&&c.getAttribute("data-cookiecategory");a&&e[a]&&n._activateElement(c)}}}),this._observer.observe(document.documentElement,{childList:!0,subtree:!0}))},p.prototype.destroy=function(){this._observer&&(this._observer.disconnect(),this._observer=null),this._activated={}};function d(e,n){this.config=e,this.emitter=n,this.el=null,this.overlayEl=null,this._visible=!1}function f(e,n){this.config=e,this.emitter=n,this.el=null,this._visible=!1,this._releaseFocus=null,this._toggles={},this._previousFocus=null}d.prototype.render=function(e){var n=this.config,t=n.texts,o=n.layout,r=n.position||"bottom";this.overlayEl=a("div",{className:"cc-overlay",role:"presentation"});var i="cc-banner";"bar"===o?i+=" cc-banner--bar cc-banner--bar-"+r:"modal"===o?i+=" cc-banner--modal":"popup"===o&&(i+=" cc-banner--popup cc-banner--popup-"+r),this.el=a("div",{className:i,role:"dialog","aria-modal":"modal"===o?"true":"false","aria-label":t.bannerTitle});var c=a("div",{className:"cc-banner__inner"});c.appendChild(a("div",{className:"cc-banner__title"},t.bannerTitle));var l=s(t.bannerDescription);n.privacyPolicyUrl&&(l+=' <a href="'+s(n.privacyPolicyUrl)+'" target="_blank" rel="noopener noreferrer">'+s(t.privacyPolicyLabel)+"</a>"),c.appendChild(a("div",{className:"cc-banner__text",innerHTML:l}));var p=a("div",{className:"cc-banner__actions"}),d=this,f=a("button",{className:"cc-btn cc-btn--primary",type:"button","aria-label":t.acceptAll,onClick:function(){d.emitter.emit("banner:acceptAll")}},t.acceptAll),h=a("button",{className:"cc-btn cc-btn--secondary",type:"button","aria-label":t.rejectAll,onClick:function(){d.emitter.emit("banner:rejectAll")}},t.rejectAll),u=a("button",{className:"cc-btn cc-btn--link",type:"button","aria-label":t.settings,onClick:function(){d.emitter.emit("banner:settings")}},t.settings);if(p.appendChild(f),p.appendChild(h),p.appendChild(u),c.appendChild(p),this.el.appendChild(c),t.poweredBy){var b=a("div",{className:"cc-banner__powered",innerHTML:s(t.poweredBy)});b.style.cssText="text-align:center;font-size:0.75em;padding:0 24px 12px;opacity:0.5;",this.el.appendChild(b)}e.appendChild(this.overlayEl),e.appendChild(this.el)},d.prototype.show=function(){if(this.el&&!this._visible){this._visible=!0;var e=this;this.el.offsetHeight,requestAnimationFrame(function(){e.el.classList.add("cc-banner--visible"),("modal"===e.config.layout||"popup"===e.config.layout||e.config.forceOverlay)&&e.overlayEl.classList.add("cc-overlay--visible")}),this.emitter.emit("banner:shown")}},d.prototype.hide=function(){this.el&&this._visible&&(this._visible=!1,this.el.classList.remove("cc-banner--visible"),this.overlayEl.classList.remove("cc-overlay--visible"),this.emitter.emit("banner:hidden"))},d.prototype.isVisible=function(){return this._visible},d.prototype.destroy=function(){this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.overlayEl&&this.overlayEl.parentNode&&this.overlayEl.parentNode.removeChild(this.overlayEl),this.el=null,this.overlayEl=null,this._visible=!1},f.prototype.render=function(e,n){var t=this.config.texts,o=this;this.el=a("div",{className:"cc-preferences",role:"dialog","aria-modal":"true","aria-label":t.preferencesTitle});var r=a("div",{className:"cc-preferences__overlay"});this.el.appendChild(r);var i=a("div",{className:"cc-preferences__dialog"}),c=a("div",{className:"cc-preferences__header"});c.appendChild(a("div",{className:"cc-preferences__title"},t.preferencesTitle)),c.appendChild(a("div",{className:"cc-preferences__description"},t.preferencesDescription)),i.appendChild(c);var s=a("div",{className:"cc-preferences__body"});this._renderCategories(s,n),i.appendChild(s);var l=a("div",{className:"cc-preferences__footer"}),p=a("button",{className:"cc-btn cc-btn--secondary",type:"button",onClick:function(){o.emitter.emit("preferences:rejectAll")}},t.rejectAllPreferences),d=a("button",{className:"cc-btn cc-btn--secondary",type:"button",onClick:function(){o.emitter.emit("preferences:acceptAll")}},t.acceptAllPreferences),f=a("button",{className:"cc-btn cc-btn--primary",type:"button",onClick:function(){o.emitter.emit("preferences:save",o.getSelected())}},t.save);l.appendChild(p),l.appendChild(d),l.appendChild(f),i.appendChild(l),this.el.appendChild(i),e.appendChild(this.el),this._escHandler=function(e){"Escape"===e.key&&o._visible&&o.emitter.emit("preferences:close")},document.addEventListener("keydown",this._escHandler)},f.prototype._renderCategories=function(e,n){var t=this.config.categories,o=this.config.texts,r=n&&n.categories||{};for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var c=t[i],l=!!c.readOnly||(null!=r[i]?!!r[i]:!!c.enabled),p=a("div",{className:"cc-category"}),d=a("button",{className:"cc-category__header",type:"button","aria-expanded":"false"}),f=a("div",{className:"cc-category__header-left"});f.appendChild(a("span",{innerHTML:'<svg class="cc-category__chevron" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>'})),f.appendChild(a("span",{className:"cc-category__title"},s(c.title)));var h=(c.cookies||[]).length;if(h>0&&f.appendChild(a("span",{className:"cc-category__count"},"("+h+")")),d.appendChild(f),c.readOnly)d.appendChild(a("span",{className:"cc-category__always-active"},o.alwaysActive));else{var u=this._createToggle(i,l);d.appendChild(u)}p.appendChild(d);var b=a("div",{className:"cc-category__body"});b.appendChild(a("div",{className:"cc-category__description"},s(c.description))),this._renderCookieTable(b,c.cookies||[],o),p.appendChild(b),function(e,n){n.addEventListener("click",function(t){if(!t.target.closest(".cc-toggle")){var o=e.classList.toggle("cc-category--expanded");n.setAttribute("aria-expanded",o?"true":"false")}})}(p,d),e.appendChild(p)}},f.prototype._createToggle=function(e,n){var t=a("label",{className:"cc-toggle"}),o=a("input",{className:"cc-toggle__input",type:"checkbox","aria-label":this.config.categories[e].title});return o.checked=n,t.appendChild(o),t.appendChild(a("span",{className:"cc-toggle__slider"})),t.addEventListener("click",function(e){e.stopPropagation()}),this._toggles[e]=o,t},f.prototype._renderCookieTable=function(e,n,t){var o=a("div",{className:"cc-cookies"});if(!n||0===n.length)return o.appendChild(a("div",{className:"cc-cookies__empty"},t.noCookies)),void e.appendChild(o);for(var r=0;r<n.length;r++){for(var i=n[r],c=a("div",{className:"cc-cookie-item"}),l=[{label:t.cookieNameLabel,value:i.name},{label:t.cookieProviderLabel,value:i.provider},{label:t.cookiePurposeLabel,value:i.purpose},{label:t.cookieExpiryLabel,value:i.expiry},{label:t.cookieTypeLabel,value:i.type}],p=0;p<l.length;p++)if(l[p].value){var d=a("div",{className:"cc-cookie-item__row"});d.appendChild(a("div",{className:"cc-cookie-item__label"},s(l[p].label))),d.appendChild(a("div",{className:"cc-cookie-item__value"},s(l[p].value))),c.appendChild(d)}o.appendChild(c)}e.appendChild(o)},f.prototype.getSelected=function(){var e={},n=this.config.categories;for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t].readOnly?e[t]=!0:this._toggles[t]?e[t]=this._toggles[t].checked:e[t]=!1);return e},f.prototype.setAll=function(e){var n=this.config.categories;for(var t in this._toggles)Object.prototype.hasOwnProperty.call(this._toggles,t)&&n[t]&&!n[t].readOnly&&(this._toggles[t].checked=e)},f.prototype.show=function(){if(this.el&&!this._visible){this._visible=!0,this._previousFocus=document.activeElement;var e=this;this.el.offsetHeight,requestAnimationFrame(function(){e.el.classList.add("cc-preferences--visible");var n=e.el.querySelector(".cc-preferences__dialog");n&&(e._releaseFocus=function(e){var n=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),t=n[0],o=n[n.length-1];function r(e){"Tab"===e.key&&(e.shiftKey?document.activeElement===t&&(e.preventDefault(),o.focus()):document.activeElement===o&&(e.preventDefault(),t.focus()))}return e.addEventListener("keydown",r),t&&t.focus(),function(){e.removeEventListener("keydown",r)}}(n))}),this.emitter.emit("preferences:shown")}},f.prototype.hide=function(){this.el&&this._visible&&(this._visible=!1,this.el.classList.remove("cc-preferences--visible"),this._releaseFocus&&(this._releaseFocus(),this._releaseFocus=null),this._previousFocus&&this._previousFocus.focus&&this._previousFocus.focus(),this.emitter.emit("preferences:hidden"))},f.prototype.isVisible=function(){return this._visible},f.prototype.destroy=function(){this._escHandler&&document.removeEventListener("keydown",this._escHandler),this._releaseFocus&&this._releaseFocus(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el),this.el=null,this._visible=!1,this._toggles={}};var h=!1;var u={_initialized:!1,_config:null,_emitter:null,_consent:null,_blocker:null,_banner:null,_preferences:null,_container:null,_prefBtnListeners:[]},b={init:function(t){if(u._initialized)return console.warn("[CookieConsent] Already initialized. Call destroy() first to reinitialize."),b;var o,a=r(e,t||{});u._config=a,u._emitter=new n,u._consent=new l(a,u._emitter),u._blocker=new p(u._emitter),u._initialized=!0,function(){if(!h&&"undefined"!=typeof document){var e=document.createElement("style");e.setAttribute("data-cc-styles",""),e.textContent="\n/* ═══════════════════════════════════════════════════════════════════════════\n GDPR Cookie Consent — Styles\n All rules are scoped under .cc-container to avoid global conflicts.\n ═══════════════════════════════════════════════════════════════════════════ */\n\n.cc-container,\n.cc-container *,\n.cc-container *::before,\n.cc-container *::after {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n}\n\n.cc-container {\n font-family: var(--cc-font);\n font-size: var(--cc-font-size);\n line-height: 1.5;\n color: var(--cc-text);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n/* ─── Overlay ──────────────────────────────────────────────────────────── */\n\n.cc-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: var(--cc-overlay);\n z-index: var(--cc-z-index);\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n}\n\n.cc-overlay--visible {\n opacity: 1;\n visibility: visible;\n}\n\n/* ─── Banner (shared) ──────────────────────────────────────────────────── */\n\n.cc-banner {\n position: fixed;\n z-index: calc(var(--cc-z-index) + 1);\n background: var(--cc-bg);\n color: var(--cc-text);\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;\n}\n\n.cc-banner--visible {\n opacity: 1;\n visibility: visible;\n}\n\n.cc-banner__inner {\n max-width: var(--cc-max-width);\n margin: 0 auto;\n padding: 20px 24px;\n}\n\n.cc-banner__title {\n font-size: 1.1em;\n font-weight: 700;\n margin-bottom: 8px;\n color: var(--cc-text);\n}\n\n.cc-banner__text {\n color: var(--cc-text-secondary);\n margin-bottom: 16px;\n font-size: 0.93em;\n}\n\n.cc-banner__text a {\n color: var(--cc-primary);\n text-decoration: underline;\n}\n\n.cc-banner__text a:hover {\n color: var(--cc-primary-hover);\n}\n\n.cc-banner__actions {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n align-items: center;\n}\n\n/* ─── Banner: Bar layout ───────────────────────────────────────────────── */\n\n.cc-banner--bar {\n left: 0;\n right: 0;\n box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.1);\n}\n\n.cc-banner--bar-bottom {\n bottom: 0;\n transform: translateY(100%);\n}\n\n.cc-banner--bar-bottom.cc-banner--visible {\n transform: translateY(0);\n}\n\n.cc-banner--bar-top {\n top: 0;\n transform: translateY(-100%);\n}\n\n.cc-banner--bar-top.cc-banner--visible {\n transform: translateY(0);\n}\n\n/* ─── Banner: Modal layout ─────────────────────────────────────────────── */\n\n.cc-banner--modal {\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) scale(0.95);\n max-width: 560px;\n width: calc(100% - 32px);\n border-radius: var(--cc-radius);\n box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);\n}\n\n.cc-banner--modal.cc-banner--visible {\n transform: translate(-50%, -50%) scale(1);\n}\n\n/* ─── Banner: Popup layout ─────────────────────────────────────────────── */\n\n.cc-banner--popup {\n border-radius: var(--cc-radius);\n box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);\n width: var(--cc-popup-width);\n max-width: calc(100% - 24px);\n}\n\n.cc-banner--popup-bottom-right {\n bottom: 16px;\n right: 16px;\n transform: translateY(20px);\n}\n\n.cc-banner--popup-bottom-right.cc-banner--visible {\n transform: translateY(0);\n}\n\n.cc-banner--popup-bottom-left {\n bottom: 16px;\n left: 16px;\n transform: translateY(20px);\n}\n\n.cc-banner--popup-bottom-left.cc-banner--visible {\n transform: translateY(0);\n}\n\n.cc-banner--popup-top-right {\n top: 16px;\n right: 16px;\n transform: translateY(-20px);\n}\n\n.cc-banner--popup-top-right.cc-banner--visible {\n transform: translateY(0);\n}\n\n.cc-banner--popup-top-left {\n top: 16px;\n left: 16px;\n transform: translateY(-20px);\n}\n\n.cc-banner--popup-top-left.cc-banner--visible {\n transform: translateY(0);\n}\n\n/* ─── Buttons ──────────────────────────────────────────────────────────── */\n\n.cc-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 10px 20px;\n border: none;\n border-radius: calc(var(--cc-radius) - 2px);\n font-family: var(--cc-font);\n font-size: 0.9em;\n font-weight: 600;\n cursor: pointer;\n transition: background-color 0.2s ease, transform 0.1s ease;\n white-space: nowrap;\n line-height: 1.4;\n}\n\n.cc-btn:focus-visible {\n outline: 2px solid var(--cc-primary);\n outline-offset: 2px;\n}\n\n.cc-btn:active {\n transform: scale(0.98);\n}\n\n.cc-btn--primary {\n background: var(--cc-primary);\n color: var(--cc-primary-text);\n}\n\n.cc-btn--primary:hover {\n background: var(--cc-primary-hover);\n}\n\n.cc-btn--secondary {\n background: transparent;\n color: var(--cc-text);\n border: 1.5px solid var(--cc-border);\n}\n\n.cc-btn--secondary:hover {\n background: var(--cc-border);\n}\n\n.cc-btn--link {\n background: transparent;\n color: var(--cc-primary);\n padding: 10px 12px;\n text-decoration: underline;\n}\n\n.cc-btn--link:hover {\n color: var(--cc-primary-hover);\n}\n\n/* ─── Preferences Modal ────────────────────────────────────────────────── */\n\n.cc-preferences {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: calc(var(--cc-z-index) + 2);\n display: flex;\n align-items: center;\n justify-content: center;\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n}\n\n.cc-preferences--visible {\n opacity: 1;\n visibility: visible;\n}\n\n.cc-preferences__overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: var(--cc-overlay);\n}\n\n.cc-preferences__dialog {\n position: relative;\n background: var(--cc-bg);\n border-radius: var(--cc-radius);\n box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18);\n max-width: 640px;\n width: calc(100% - 32px);\n max-height: calc(100vh - 48px);\n display: flex;\n flex-direction: column;\n transform: scale(0.95);\n transition: transform 0.3s ease;\n}\n\n.cc-preferences--visible .cc-preferences__dialog {\n transform: scale(1);\n}\n\n.cc-preferences__header {\n padding: 24px 24px 0;\n flex-shrink: 0;\n}\n\n.cc-preferences__title {\n font-size: 1.2em;\n font-weight: 700;\n margin-bottom: 8px;\n color: var(--cc-text);\n}\n\n.cc-preferences__description {\n font-size: 0.9em;\n color: var(--cc-text-secondary);\n margin-bottom: 16px;\n line-height: 1.6;\n}\n\n.cc-preferences__body {\n padding: 8px 24px;\n overflow-y: auto;\n flex: 1;\n -webkit-overflow-scrolling: touch;\n}\n\n.cc-preferences__footer {\n padding: 16px 24px;\n border-top: 1px solid var(--cc-border);\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n justify-content: flex-end;\n flex-shrink: 0;\n}\n\n/* ─── Category Accordion ───────────────────────────────────────────────── */\n\n.cc-category {\n border: 1px solid var(--cc-border);\n border-radius: calc(var(--cc-radius) - 2px);\n margin-bottom: 10px;\n overflow: hidden;\n}\n\n.cc-category__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 14px 16px;\n cursor: pointer;\n background: transparent;\n border: none;\n width: 100%;\n font-family: var(--cc-font);\n font-size: 0.95em;\n color: var(--cc-text);\n text-align: left;\n transition: background-color 0.15s ease;\n}\n\n.cc-category__header:hover {\n background: rgba(0, 0, 0, 0.02);\n}\n\n.cc-category__header:focus-visible {\n outline: 2px solid var(--cc-primary);\n outline-offset: -2px;\n}\n\n.cc-category__header-left {\n display: flex;\n align-items: center;\n gap: 10px;\n flex: 1;\n min-width: 0;\n}\n\n.cc-category__chevron {\n width: 18px;\n height: 18px;\n flex-shrink: 0;\n transition: transform 0.2s ease;\n color: var(--cc-text-secondary);\n}\n\n.cc-category--expanded .cc-category__chevron {\n transform: rotate(180deg);\n}\n\n.cc-category__title {\n font-weight: 600;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.cc-category__count {\n font-size: 0.8em;\n color: var(--cc-text-secondary);\n font-weight: 400;\n margin-left: 4px;\n flex-shrink: 0;\n}\n\n.cc-category__body {\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n}\n\n.cc-category--expanded .cc-category__body {\n max-height: 800px;\n}\n\n.cc-category__description {\n padding: 0 16px 12px;\n font-size: 0.88em;\n color: var(--cc-text-secondary);\n line-height: 1.6;\n}\n\n/* ─── Cookie Table ─────────────────────────────────────────────────────── */\n\n.cc-cookies {\n padding: 0 16px 14px;\n}\n\n.cc-cookies__empty {\n font-size: 0.85em;\n color: var(--cc-text-secondary);\n font-style: italic;\n padding: 4px 0;\n}\n\n.cc-cookie-item {\n border: 1px solid var(--cc-border);\n border-radius: calc(var(--cc-radius) - 4px);\n margin-bottom: 8px;\n font-size: 0.85em;\n}\n\n.cc-cookie-item:last-child {\n margin-bottom: 0;\n}\n\n.cc-cookie-item__row {\n display: flex;\n border-bottom: 1px solid var(--cc-border);\n min-height: 32px;\n}\n\n.cc-cookie-item__row:last-child {\n border-bottom: none;\n}\n\n.cc-cookie-item__label {\n flex: 0 0 90px;\n padding: 6px 10px;\n font-weight: 600;\n color: var(--cc-text);\n background: rgba(0, 0, 0, 0.015);\n display: flex;\n align-items: center;\n}\n\n.cc-cookie-item__value {\n flex: 1;\n padding: 6px 10px;\n color: var(--cc-text-secondary);\n word-break: break-word;\n display: flex;\n align-items: center;\n}\n\n/* ─── Toggle Switch ────────────────────────────────────────────────────── */\n\n.cc-toggle {\n position: relative;\n display: inline-block;\n width: 44px;\n height: 24px;\n flex-shrink: 0;\n}\n\n.cc-toggle__input {\n position: absolute;\n opacity: 0;\n width: 0;\n height: 0;\n}\n\n.cc-toggle__slider {\n position: absolute;\n cursor: pointer;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: var(--cc-toggle-off);\n border-radius: 24px;\n transition: background-color 0.2s ease;\n}\n\n.cc-toggle__slider::before {\n content: '';\n position: absolute;\n height: 18px;\n width: 18px;\n left: 3px;\n bottom: 3px;\n background-color: var(--cc-toggle-knob);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);\n}\n\n.cc-toggle__input:checked + .cc-toggle__slider {\n background-color: var(--cc-toggle-on);\n}\n\n.cc-toggle__input:checked + .cc-toggle__slider::before {\n transform: translateX(20px);\n}\n\n.cc-toggle__input:focus-visible + .cc-toggle__slider {\n outline: 2px solid var(--cc-primary);\n outline-offset: 2px;\n}\n\n.cc-toggle__input:disabled + .cc-toggle__slider {\n opacity: 0.7;\n cursor: default;\n}\n\n.cc-category__always-active {\n font-size: 0.8em;\n font-weight: 600;\n color: var(--cc-primary);\n white-space: nowrap;\n padding: 0 4px;\n}\n\n/* ─── Responsive ───────────────────────────────────────────────────────── */\n\n@media (max-width: 480px) {\n .cc-banner__inner {\n padding: 16px;\n }\n\n .cc-banner__actions {\n flex-direction: column;\n align-items: stretch;\n }\n\n .cc-banner__actions .cc-btn {\n width: 100%;\n }\n\n .cc-banner--popup {\n width: calc(100% - 24px);\n left: 12px !important;\n right: 12px !important;\n bottom: 12px !important;\n top: auto !important;\n }\n\n .cc-preferences__dialog {\n max-height: calc(100vh - 24px);\n width: calc(100% - 16px);\n border-radius: calc(var(--cc-radius) - 2px);\n }\n\n .cc-preferences__header,\n .cc-preferences__body {\n padding-left: 16px;\n padding-right: 16px;\n }\n\n .cc-preferences__footer {\n padding: 12px 16px;\n flex-direction: column;\n align-items: stretch;\n }\n\n .cc-preferences__footer .cc-btn {\n width: 100%;\n }\n\n .cc-cookie-item__label {\n flex: 0 0 75px;\n font-size: 0.9em;\n }\n}\n\n/* ─── Accessibility: reduced motion ────────────────────────────────────── */\n\n@media (prefers-reduced-motion: reduce) {\n .cc-banner,\n .cc-overlay,\n .cc-preferences,\n .cc-preferences__dialog,\n .cc-category__body,\n .cc-category__chevron,\n .cc-toggle__slider,\n .cc-toggle__slider::before {\n transition: none !important;\n }\n}\n\n/* ─── Print: hide everything ───────────────────────────────────────────── */\n\n@media print {\n .cc-container {\n display: none !important;\n }\n}\n",(document.head||document.documentElement).appendChild(e),h=!0}}(),a.container&&(o="string"==typeof a.container?i(a.container):a.container),o||(o=document.createElement("div"),document.body.appendChild(o)),o.classList.add("cc-container"),u._container=o,function(e,n){if(e&&n){var t={"--cc-primary":n.primary,"--cc-primary-hover":n.primaryHover,"--cc-primary-text":n.primaryText,"--cc-bg":n.background,"--cc-text":n.text,"--cc-text-secondary":n.textSecondary,"--cc-border":n.border,"--cc-overlay":n.overlay,"--cc-toggle-on":n.toggleOn,"--cc-toggle-off":n.toggleOff,"--cc-toggle-knob":n.toggleKnob,"--cc-font":n.fontFamily,"--cc-font-size":n.fontSize,"--cc-radius":n.borderRadius,"--cc-z-index":n.zIndex,"--cc-max-width":n.maxWidth,"--cc-popup-width":n.popupWidth};for(var o in t)null!=t[o]&&e.style.setProperty(o,String(t[o]))}}(o,a.theme),u._banner=new d(a,u._emitter),u._preferences=new f(a,u._emitter);var s,y=u._consent.load();return u._banner.render(o),(s=u._emitter).on("banner:acceptAll",function(){g(u._consent.acceptAllMap())}),s.on("banner:rejectAll",function(){g(u._consent.rejectAllMap())}),s.on("banner:settings",function(){u._banner&&u._banner.hide(),b.showPreferences()}),s.on("preferences:save",function(e){g(e)}),s.on("preferences:acceptAll",function(){u._preferences&&u._preferences.setAll(!0),g(u._consent.acceptAllMap())}),s.on("preferences:rejectAll",function(){u._preferences&&u._preferences.setAll(!1),g(u._consent.rejectAllMap())}),s.on("preferences:close",function(){b.hidePreferences()}),function(e){var n=function(e){e.preventDefault(),b.showPreferences()};if(e.preferencesButton){("string"==typeof e.preferencesButton?c(e.preferencesButton):[e.preferencesButton]).forEach(function(e){e.addEventListener("click",n),u._prefBtnListeners.push({el:e,fn:n})})}c("[data-cc-open-preferences]").forEach(function(e){e.addEventListener("click",n),u._prefBtnListeners.push({el:e,fn:n})})}(a),y&&u._consent.hasValid()?(u._blocker.activate(y.categories),u._blocker.observe(y.categories)):a.autoShow&&setTimeout(function(){u._banner.show()},100),b},show:function(){return u._banner&&u._banner.show(),b},hide:function(){return u._banner&&u._banner.hide(),b},showPreferences:function(){return function(){if(u._preferences&&!u._preferences.el){var e=u._consent?u._consent.get():null;u._preferences.render(u._container,e)}}(),u._preferences&&u._preferences.show(),b},hidePreferences:function(){return u._preferences&&u._preferences.hide(),b},acceptAll:function(){return u._consent?(g(u._consent.acceptAllMap()),b):b},rejectAll:function(){return u._consent?(g(u._consent.rejectAllMap()),b):b},acceptCategory:function(e){if(!u._consent)return b;var n=u._consent.get(),t=n?Object.assign({},n.categories):u._consent.rejectAllMap();return t[e]=!0,g(t),b},getConsent:function(){return u._consent?u._consent.get():null},hasConsented:function(){return!(!u._consent||!u._consent.get())},hasCategory:function(e){return!!u._consent&&u._consent.hasCategory(e)},revokeConsent:function(){return u._consent&&u._consent.revoke(),u._blocker&&u._blocker.destroy(),u._preferences&&(u._preferences.destroy(),u._preferences=new f(u._config,u._emitter)),u._banner&&u._banner.show(),b},on:function(e,n){return u._emitter&&u._emitter.on(e,n),b},off:function(e,n){return u._emitter&&u._emitter.off(e,n),b},destroy:function(){return u._banner&&u._banner.destroy(),u._preferences&&u._preferences.destroy(),u._blocker&&u._blocker.destroy(),u._prefBtnListeners.forEach(function(e){e.el.removeEventListener("click",e.fn)}),u._prefBtnListeners=[],u._container&&u._container.parentNode&&!u._config.container&&u._container.parentNode.removeChild(u._container),u._initialized=!1,u._config=null,u._emitter=null,u._consent=null,u._blocker=null,u._banner=null,u._preferences=null,u._container=null,b},getConfig:function(){return u._config?JSON.parse(JSON.stringify(u._config)):null}};function g(e){u._consent.save(e),u._banner&&u._banner.hide(),u._preferences&&u._preferences.hide(),u._blocker.activate(e),u._blocker.observe(e)}function y(){if(!u._initialized){var e=document.querySelectorAll("script[data-cc-auto]");if(e.length>0){var n=e[e.length-1].getAttribute("data-cc-config"),t={};if(n)try{t=JSON.parse(n)}catch(e){console.error("[CookieConsent] Invalid data-cc-config JSON:",e)}var o=i("#cc-banner");return o&&(t.container=o),void b.init(t)}var r=i("#cc-banner");if(r&&r.hasAttribute("data-cc-auto")){var c=r.getAttribute("data-cc-config"),a={};if(c)try{a=JSON.parse(c)}catch(e){console.error("[CookieConsent] Invalid data-cc-config JSON:",e)}a.container=r,b.init(a)}}}return"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",y):y()),b}();
|