@freshjuice/zest 1.0.0 → 2.1.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/README.md +178 -78
- package/dist/zest.d.ts +214 -0
- package/dist/zest.de.js +692 -305
- package/dist/zest.de.js.map +1 -1
- package/dist/zest.de.min.js +1 -1
- package/dist/zest.en.js +692 -305
- package/dist/zest.en.js.map +1 -1
- package/dist/zest.en.min.js +1 -1
- package/dist/zest.es.js +692 -305
- package/dist/zest.es.js.map +1 -1
- package/dist/zest.es.min.js +1 -1
- package/dist/zest.esm.js +692 -305
- package/dist/zest.esm.js.map +1 -1
- package/dist/zest.esm.min.js +1 -1
- package/dist/zest.fr.js +692 -305
- package/dist/zest.fr.js.map +1 -1
- package/dist/zest.fr.min.js +1 -1
- package/dist/zest.headless.d.ts +178 -0
- package/dist/zest.headless.esm.js +2299 -0
- package/dist/zest.headless.esm.js.map +1 -0
- package/dist/zest.headless.esm.min.js +1 -0
- package/dist/zest.it.js +692 -305
- package/dist/zest.it.js.map +1 -1
- package/dist/zest.it.min.js +1 -1
- package/dist/zest.ja.js +692 -305
- package/dist/zest.ja.js.map +1 -1
- package/dist/zest.ja.min.js +1 -1
- package/dist/zest.js +692 -305
- package/dist/zest.js.map +1 -1
- package/dist/zest.min.js +1 -1
- package/dist/zest.nl.js +692 -305
- package/dist/zest.nl.js.map +1 -1
- package/dist/zest.nl.min.js +1 -1
- package/dist/zest.pl.js +692 -305
- package/dist/zest.pl.js.map +1 -1
- package/dist/zest.pl.min.js +1 -1
- package/dist/zest.pt.js +692 -305
- package/dist/zest.pt.js.map +1 -1
- package/dist/zest.pt.min.js +1 -1
- package/dist/zest.ru.js +692 -305
- package/dist/zest.ru.js.map +1 -1
- package/dist/zest.ru.min.js +1 -1
- package/dist/zest.uk.js +692 -305
- package/dist/zest.uk.js.map +1 -1
- package/dist/zest.uk.min.js +1 -1
- package/dist/zest.zh.js +692 -305
- package/dist/zest.zh.js.map +1 -1
- package/dist/zest.zh.min.js +1 -1
- package/package.json +23 -4
- package/src/core/cookie-interceptor.js +20 -5
- package/src/core/known-trackers.js +41 -14
- package/src/core/pattern-matcher.js +20 -5
- package/src/core/script-blocker.js +85 -79
- package/src/core/security.js +204 -0
- package/src/core/storage-interceptor.js +5 -1
- package/src/core-lifecycle.js +192 -0
- package/src/headless.js +133 -0
- package/src/index.js +73 -184
- package/src/storage/consent-store.js +32 -8
- package/src/types/zest.d.ts +214 -0
- package/src/types/zest.headless.d.ts +178 -0
- package/src/ui/banner.js +11 -7
- package/src/ui/modal.js +16 -12
- package/src/ui/styles.js +25 -4
- package/src/ui/widget.js +3 -1
package/dist/zest.fr.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var Zest=function(){"use strict";const t={essential:[/^zest_/,/^csrf/i,/^xsrf/i,/^session/i,/^__host-/i,/^__secure-/i],functional:[/^lang/i,/^locale/i,/^theme/i,/^preferences/i,/^ui_/i],analytics:[/^_ga/,/^_gid/,/^_gat/,/^_utm/,/^__utm/,/^plausible/i,/^_pk_/,/^matomo/i,/^_hj/,/^ajs_/],marketing:[/^_fbp/,/^_fbc/,/^_gcl/,/^_ttp/,/^ads/i,/^doubleclick/i,/^__gads/,/^__gpi/,/^_pin_/,/^li_/]};let e={...t};function n(t){for(const[n,o]of Object.entries(e))if(o.some(e=>e.test(t)))return n;return"marketing"}let o=null;const a=[];let s=()=>!1;function r(){return o}let i=null,c=null;const l=[],d=[];let u=()=>!1;function p(t,e,o){return new Proxy(t,{get(t,o){if("setItem"===o)return(o,a)=>{const s=n(o);u(s)?t.setItem(o,a):e.push({key:o,value:a,category:s,timestamp:Date.now()})};const a=t[o];return"function"==typeof a?a.bind(t):a}})}const m={analytics:["google-analytics.com","www.google-analytics.com","analytics.google.com","googletagmanager.com","www.googletagmanager.com","plausible.io","cloudflareinsights.com","static.cloudflareinsights.com"],marketing:["connect.facebook.net","www.facebook.com/tr","ads.google.com","www.googleadservices.com","googleads.g.doubleclick.net","pagead2.googlesyndication.com"]},f={analytics:[...m.analytics,"analytics.tiktok.com","matomo.","hotjar.com","static.hotjar.com","script.hotjar.com","clarity.ms","www.clarity.ms","heapanalytics.com","cdn.heapanalytics.com","mixpanel.com","cdn.mxpnl.com","segment.com","cdn.segment.com","api.segment.io","fullstory.com","rs.fullstory.com","amplitude.com","cdn.amplitude.com","mouseflow.com","cdn.mouseflow.com","luckyorange.com","cdn.luckyorange.net","crazyegg.com","script.crazyegg.com"],marketing:[...m.marketing,"snap.licdn.com","px.ads.linkedin.com","ads.linkedin.com","analytics.twitter.com","static.ads-twitter.com","t.co","analytics.tiktok.com","ads.tiktok.com","sc-static.net","tr.snapchat.com","ct.pinterest.com","pintrk.com","s.pinimg.com","widgets.pinterest.com","bat.bing.com","ads.yahoo.com","sp.analytics.yahoo.com","amazon-adsystem.com","z-na.amazon-adsystem.com","criteo.com","static.criteo.net","dis.criteo.com","taboola.com","cdn.taboola.com","trc.taboola.com","outbrain.com","widgets.outbrain.com","adroll.com","s.adroll.com"],functional:["cdn.onesignal.com","onesignal.com","pusher.com","js.pusher.com","intercom.io","widget.intercom.io","js.intercomcdn.com","crisp.chat","client.crisp.chat","cdn.livechatinc.com","livechatinc.com","tawk.to","embed.tawk.to","zendesk.com","static.zdassets.com"]};function g(t,e){try{const n=new URL(t).hostname.toLowerCase(),o=t.toLowerCase();for(const t of e)if(t.endsWith(".")){if(n.includes(t.slice(0,-1)))return!0}else{if(n===t||n.endsWith("."+t))return!0;if(o.includes(t))return!0}}catch(t){}return!1}function b(t,e="safe"){const n="strict"===e?f:m;for(const[e,o]of Object.entries(n))if(g(t,o))return e;return null}const y=[];let z=null,h="safe",x=[],w=()=>!1;function v(t){const e=t.getAttribute("data-consent-category");if(e)return e;if(t.hasAttribute("data-zest-allow"))return null;const n=t.src;if(!n)return null;const o=function(t){if(!t||0===x.length)return null;try{const e=new URL(t).hostname.toLowerCase();for(const t of x){const n="string"==typeof t?t:t.domain,o="string"==typeof t?"marketing":t.category||"marketing";if(e===n||e.endsWith("."+n))return o}}catch(t){}return null}(n);if(o)return o;switch(h){case"manual":default:return null;case"safe":case"strict":return b(n,h);case"doomsday":return function(t){try{const e=new URL(t).hostname,n=window.location.hostname,o=t=>t.replace(/^www\./,"");return o(e)!==o(n)}catch(t){return!1}}(n)?b(n,"strict")||"marketing":null}}function k(t){if(t.hasAttribute("data-zest-processed"))return!1;const e=v(t);if(!e)return t.setAttribute("data-zest-processed","allowed"),!1;if(w(e))return t.setAttribute("data-zest-processed","allowed"),!1;const n={category:e,src:t.src,inline:t.textContent,type:t.type,async:t.async,defer:t.defer,timestamp:Date.now()};return t.setAttribute("data-zest-processed","blocked"),t.setAttribute("data-consent-category",e),t.type="text/plain",t.src&&(t.setAttribute("data-blocked-src",t.src),t.removeAttribute("src")),y.push(n),!0}function _(t){const e=document.createElement("script");t.src?e.src=t.src:t.inline&&(e.textContent=t.inline),t.async&&(e.async=!0),t.defer&&(e.defer=!0),e.setAttribute("data-zest-processed","executed"),e.setAttribute("data-consent-executed","true"),document.head.appendChild(e)}function A(t){for(const e of t)for(const t of e.addedNodes)if("SCRIPT"!==t.nodeName||t.hasAttribute("data-zest-processed")||k(t),t.querySelectorAll){t.querySelectorAll("script:not([data-zest-processed])").forEach(k)}}function C(t="safe",e=[]){return h=t,x=e,document.querySelectorAll("script:not([data-zest-processed])").forEach(k),z=new MutationObserver(A),z.observe(document.documentElement,{childList:!0,subtree:!0}),!0}const E={essential:{id:"essential",label:"Essential",description:"Required for the website to function properly. Cannot be disabled.",required:!0,default:!0},functional:{id:"functional",label:"Functional",description:"Enable personalized features like language preferences and themes.",required:!1,default:!1},analytics:{id:"analytics",label:"Analytics",description:"Help us understand how visitors interact with our website.",required:!1,default:!1},marketing:{id:"marketing",label:"Marketing",description:"Used to deliver relevant advertisements and track campaign performance.",required:!1,default:!1}};function S(){if("undefined"==typeof navigator)return!1;const t=navigator.doNotTrack||window.doNotTrack||navigator.msDoNotTrack;return"1"===t||"yes"===t||!0===t||!0===navigator.globalPrivacyControl}function j(t,e,n){const o=n?"default":"update";e.consentModeGoogle&&function(t,e){if(window.dataLayer=window.dataLayer||[],"function"==typeof window.gtag)window.gtag("consent",t,e);else{function n(){window.dataLayer.push(arguments)}n("consent",t,e)}}(o,function(t){const e=t=>t?"granted":"denied";return{ad_storage:e(t.marketing),ad_user_data:e(t.marketing),ad_personalization:e(t.marketing),analytics_storage:e(t.analytics),functionality_storage:"granted",personalization_storage:e(t.functional)}}(t)),e.consentModeMicrosoft&&function(t,e){window.uetq=window.uetq||[],window.uetq.push("consent",t,e)}(o,function(t){return{ad_storage:t.marketing?"granted":"denied"}}(t))}const N={labels:{banner:{title:"Nous respectons votre vie privée",description:"Nous utilisons des cookies pour améliorer votre expérience de navigation, proposer du contenu personnalisé et analyser notre trafic. En cliquant sur « Tout accepter », vous consentez à l'utilisation de cookies.",acceptAll:"Tout accepter",rejectAll:"Tout refuser",settings:"Paramètres"},modal:{title:"Paramètres de confidentialité",description:"Gérez vos préférences en matière de cookies. Vous pouvez activer ou désactiver différents types de cookies ci-dessous.",save:"Enregistrer les préférences",acceptAll:"Tout accepter",rejectAll:"Tout refuser"},widget:{label:"Paramètres des cookies"}},categories:{essential:{label:"Essentiels",description:"Nécessaires au bon fonctionnement du site. Ne peuvent pas être désactivés."},functional:{label:"Fonctionnels",description:"Permettent des fonctionnalités personnalisées comme les préférences de langue et de thème."},analytics:{label:"Analytiques",description:"Nous aident à comprendre comment les visiteurs interagissent avec notre site."},marketing:{label:"Marketing",description:"Utilisés pour afficher des publicités pertinentes et mesurer les performances des campagnes."}}};const M={lang:"auto",position:"bottom",theme:"auto",accentColor:"#0071e3",categories:E,labels:{banner:{title:"We value your privacy",description:'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies.',acceptAll:"Accept All",rejectAll:"Reject All",settings:"Settings"},modal:{title:"Privacy Settings",description:"Manage your cookie preferences. You can enable or disable different types of cookies below.",save:"Save Preferences",acceptAll:"Accept All",rejectAll:"Reject All"},widget:{label:"Cookie Settings"}},autoInit:!0,showWidget:!0,expiration:365,respectDNT:!0,dntBehavior:"reject",customStyles:"",consentModeGoogle:!1,consentModeMicrosoft:!1,mode:"safe",blockedDomains:[],policyUrl:null,imprintUrl:null,callbacks:{onAccept:null,onReject:null,onChange:null,onReady:null}};function R(t){const e={...M};t||(t={});const n=["lang","position","theme","accentColor","autoInit","showWidget","expiration","policyUrl","imprintUrl","customStyles","mode","blockedDomains","respectDNT","dntBehavior","consentModeGoogle","consentModeMicrosoft"];for(const o of n)void 0!==t[o]&&(e[o]=t[o]);e.lang="fr";const o=N,a=o.labels||{},s=t.labels||{};e.labels={banner:{...M.labels.banner,...a.banner,...s.banner},modal:{...M.labels.modal,...a.modal,...s.modal},widget:{...M.labels.widget,...a.widget,...s.widget}};const r=o.categories||{},i=t.categories||{};e.categories={...M.categories};for(const t of Object.keys(M.categories))e.categories[t]={...M.categories[t],...r[t],...i[t]};return t.callbacks&&(e.callbacks={...M.callbacks,...t.callbacks}),t.patterns&&(e.patterns=t.patterns),e}function $(){const t="undefined"!=typeof window&&window.ZestConfig?window.ZestConfig:{},e=function(){const t=document.currentScript||document.querySelector("script[data-zest]")||document.querySelector('script[src*="zest"]');if(!t)return{};const e={},n=t.getAttribute("data-position");n&&(e.position=n);const o=t.getAttribute("data-theme");o&&(e.theme=o);const a=t.getAttribute("data-accent")||t.getAttribute("data-accent-color");a&&(e.accentColor=a);const s=t.getAttribute("data-policy-url")||t.getAttribute("data-privacy-url");s&&(e.policyUrl=s);const r=t.getAttribute("data-imprint-url");r&&(e.imprintUrl=r);const i=t.getAttribute("data-show-widget");null!==i&&(e.showWidget="false"!==i);const c=t.getAttribute("data-auto-init");null!==c&&(e.autoInit="false"!==c);const l=t.getAttribute("data-expiration");l&&(e.expiration=parseInt(l,10));const d=t.getAttribute("data-consent-mode-google");null!==d&&(e.consentModeGoogle="false"!==d);const u=t.getAttribute("data-consent-mode-microsoft");return null!==u&&(e.consentModeMicrosoft="false"!==u),e}();return R({...t,...e})}let T=null;function q(){return T||(T=$()),T}const D="zest_consent";let L=null;function O(t){const e=r();e?.set?e.set.call(document,t):document.cookie=t}function I(){const t=r();return t?.get?t.get.call(document):document.cookie}function P(){try{const t=I().match(RegExp(D+"=([^;]+)"));if(t){const e=JSON.parse(decodeURIComponent(t[1]));return L=e.categories||{essential:!0,functional:!1,analytics:!1,marketing:!1},{...L}}}catch(t){}return L={essential:!0,functional:!1,analytics:!1,marketing:!1},{...L}}function U(){return L||(L=P()),{...L}}function W(t,e=365){const n=L?{...L}:{essential:!0,functional:!1,analytics:!1,marketing:!1};return L={essential:!0,functional:!!t.functional,analytics:!!t.analytics,marketing:!!t.marketing},function(t=365){L||(L={essential:!0,functional:!1,analytics:!1,marketing:!1});const e={version:"1.0",timestamp:Date.now(),categories:L},n=new Date(Date.now()+24*t*60*60*1e3).toUTCString();O(`${D}=${encodeURIComponent(JSON.stringify(e))}; expires=${n}; path=/; SameSite=Lax`)}(e),{current:{...L},previous:n}}function Z(t){return L||(L=P()),!0===L[t]}function Y(t=365){return W({functional:!1,analytics:!1,marketing:!1},t)}function H(){try{return I().includes(D)}catch(t){return!1}}const B={READY:"zest:ready",CONSENT:"zest:consent",REJECT:"zest:reject",CHANGE:"zest:change",SHOW:"zest:show",HIDE:"zest:hide"};function G(t,e={}){const n=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0});return document.dispatchEvent(n),n}function F(t,e){return G(B.CONSENT,{consent:t,previous:e})}function J(t){return G(B.REJECT,{consent:t})}function X(t,e){return G(B.CHANGE,{consent:t,previous:e})}function V(t="banner"){return G(B.SHOW,{type:t})}function K(t="banner"){return G(B.HIDE,{type:t})}function Q(t){const e=t.accentColor||"#4F46E5";return`\n:host {\n --zest-accent: ${e};\n --zest-accent-hover: ${function(t,e){const n=parseInt(t.replace("#",""),16),o=Math.round(2.55*e);return"#"+(16777216+65536*Math.min(255,Math.max(0,(n>>16)+o))+256*Math.min(255,Math.max(0,(n>>8&255)+o))+Math.min(255,Math.max(0,(255&n)+o))).toString(16).slice(1)}(e,-15)};\n --zest-bg: #ffffff;\n --zest-bg-secondary: #f3f4f6;\n --zest-text: #1f2937;\n --zest-text-secondary: #6b7280;\n --zest-border: #e5e7eb;\n --zest-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n --zest-radius: 12px;\n --zest-radius-sm: 8px;\n --zest-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;\n\n font-family: var(--zest-font);\n font-size: 14px;\n line-height: 1.5;\n color: var(--zest-text);\n box-sizing: border-box;\n}\n\n:host([data-theme="dark"]) {\n --zest-bg: #1f2937;\n --zest-bg-secondary: #374151;\n --zest-text: #f9fafb;\n --zest-text-secondary: #9ca3af;\n --zest-border: #4b5563;\n --zest-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);\n}\n\n@media (prefers-color-scheme: dark) {\n :host([data-theme="auto"]) {\n --zest-bg: #1f2937;\n --zest-bg-secondary: #374151;\n --zest-text: #f9fafb;\n --zest-text-secondary: #9ca3af;\n --zest-border: #4b5563;\n --zest-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);\n }\n}\n\n*, *::before, *::after {\n box-sizing: border-box;\n}\n\n/* Banner */\n.zest-banner {\n position: fixed;\n z-index: 999999;\n max-width: 480px;\n padding: 20px;\n background: var(--zest-bg);\n border-radius: var(--zest-radius);\n box-shadow: var(--zest-shadow);\n animation: zest-slide-in 0.3s ease-out;\n}\n\n.zest-banner--bottom {\n bottom: 20px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.zest-banner--bottom-left {\n bottom: 20px;\n left: 20px;\n}\n\n.zest-banner--bottom-right {\n bottom: 20px;\n right: 20px;\n}\n\n.zest-banner--top {\n top: 20px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n@keyframes zest-slide-in {\n from {\n opacity: 0;\n transform: translateX(-50%) translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateX(-50%) translateY(0);\n }\n}\n\n.zest-banner--bottom-left {\n animation-name: zest-slide-in-left;\n}\n\n@keyframes zest-slide-in-left {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n.zest-banner--bottom-right {\n animation-name: zest-slide-in-right;\n}\n\n@keyframes zest-slide-in-right {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .zest-banner,\n .zest-modal {\n animation: none;\n }\n}\n\n.zest-banner__title {\n margin: 0 0 8px 0;\n font-size: 16px;\n font-weight: 600;\n color: var(--zest-text);\n}\n\n.zest-banner__description {\n margin: 0 0 16px 0;\n font-size: 14px;\n color: var(--zest-text-secondary);\n}\n\n.zest-banner__buttons {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n/* Buttons */\n.zest-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 10px 16px;\n font-size: 14px;\n font-weight: 500;\n font-family: inherit;\n border: none;\n border-radius: var(--zest-radius-sm);\n cursor: pointer;\n transition: background-color 0.15s ease, transform 0.1s ease;\n}\n\n.zest-btn:hover {\n transform: translateY(-1px);\n}\n\n.zest-btn:active {\n transform: translateY(0);\n}\n\n.zest-btn:focus-visible {\n outline: 2px solid var(--zest-accent);\n outline-offset: 2px;\n}\n\n.zest-btn--primary {\n background: var(--zest-accent);\n color: #ffffff;\n}\n\n.zest-btn--primary:hover {\n background: var(--zest-accent-hover);\n}\n\n.zest-btn--secondary {\n background: var(--zest-bg-secondary);\n color: var(--zest-text);\n}\n\n.zest-btn--secondary:hover {\n background: var(--zest-border);\n}\n\n.zest-btn--ghost {\n background: transparent;\n color: var(--zest-text-secondary);\n}\n\n.zest-btn--ghost:hover {\n background: var(--zest-bg-secondary);\n color: var(--zest-text);\n}\n\n/* Modal */\n.zest-modal-overlay {\n position: fixed;\n inset: 0;\n z-index: 999998;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px;\n background: rgba(0, 0, 0, 0.5);\n animation: zest-fade-in 0.2s ease-out;\n}\n\n@keyframes zest-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n.zest-modal {\n width: 100%;\n max-width: 500px;\n max-height: 90vh;\n overflow-y: auto;\n background: var(--zest-bg);\n border-radius: var(--zest-radius);\n box-shadow: var(--zest-shadow);\n animation: zest-modal-in 0.3s ease-out;\n}\n\n@keyframes zest-modal-in {\n from {\n opacity: 0;\n transform: scale(0.95);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n.zest-modal__header {\n padding: 20px 20px 0;\n}\n\n.zest-modal__title {\n margin: 0 0 8px 0;\n font-size: 18px;\n font-weight: 600;\n color: var(--zest-text);\n}\n\n.zest-modal__description {\n margin: 0;\n font-size: 14px;\n color: var(--zest-text-secondary);\n}\n\n.zest-modal__body {\n padding: 20px;\n}\n\n.zest-modal__footer {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n padding: 0 20px 20px;\n}\n\n/* Categories */\n.zest-category {\n padding: 16px;\n margin-bottom: 12px;\n background: var(--zest-bg-secondary);\n border-radius: var(--zest-radius-sm);\n}\n\n.zest-category:last-child {\n margin-bottom: 0;\n}\n\n.zest-category__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n.zest-category__info {\n flex: 1;\n}\n\n.zest-category__label {\n display: block;\n font-size: 14px;\n font-weight: 600;\n color: var(--zest-text);\n}\n\n.zest-category__description {\n margin: 4px 0 0;\n font-size: 13px;\n color: var(--zest-text-secondary);\n}\n\n/* Toggle Switch */\n.zest-toggle {\n position: relative;\n width: 44px;\n height: 24px;\n flex-shrink: 0;\n}\n\n.zest-toggle__input {\n position: absolute;\n opacity: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n margin: 0;\n}\n\n.zest-toggle__input:disabled {\n cursor: not-allowed;\n}\n\n.zest-toggle__slider {\n position: absolute;\n inset: 0;\n background: var(--zest-border);\n border-radius: 12px;\n transition: background-color 0.2s ease;\n pointer-events: none;\n}\n\n.zest-toggle__slider::before {\n content: '';\n position: absolute;\n top: 2px;\n left: 2px;\n width: 20px;\n height: 20px;\n background: #ffffff;\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\n}\n\n.zest-toggle__input:checked + .zest-toggle__slider {\n background: var(--zest-accent);\n}\n\n.zest-toggle__input:checked + .zest-toggle__slider::before {\n transform: translateX(20px);\n}\n\n.zest-toggle__input:focus-visible + .zest-toggle__slider {\n outline: 2px solid var(--zest-accent);\n outline-offset: 2px;\n}\n\n.zest-toggle__input:disabled + .zest-toggle__slider {\n opacity: 0.6;\n}\n\n/* Widget */\n.zest-widget {\n position: fixed;\n z-index: 999997;\n bottom: 20px;\n left: 20px;\n}\n\n.zest-widget__btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n padding: 0;\n background: var(--zest-bg);\n border: 1px solid var(--zest-border);\n border-radius: 50%;\n box-shadow: var(--zest-shadow);\n cursor: pointer;\n transition: transform 0.2s ease, box-shadow 0.2s ease;\n}\n\n.zest-widget__btn:hover {\n transform: scale(1.05);\n box-shadow: 0 12px 28px -5px rgba(0, 0, 0, 0.15);\n}\n\n.zest-widget__btn:focus-visible {\n outline: 2px solid var(--zest-accent);\n outline-offset: 2px;\n}\n\n.zest-widget__icon {\n width: 24px;\n height: 24px;\n fill: var(--zest-text);\n}\n\n/* Link */\n.zest-link {\n color: var(--zest-accent);\n text-decoration: none;\n}\n\n.zest-link:hover {\n text-decoration: underline;\n}\n\n/* Mobile */\n@media (max-width: 480px) {\n .zest-banner {\n left: 10px;\n right: 10px;\n max-width: none;\n transform: none;\n }\n\n .zest-banner--bottom,\n .zest-banner--bottom-left,\n .zest-banner--bottom-right {\n bottom: 10px;\n }\n\n .zest-banner--top {\n top: 10px;\n transform: none;\n }\n\n @keyframes zest-slide-in {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n .zest-banner__buttons {\n flex-direction: column;\n }\n\n .zest-btn {\n width: 100%;\n }\n\n .zest-modal-overlay {\n padding: 10px;\n }\n\n .zest-widget {\n bottom: 10px;\n left: 10px;\n }\n}\n\n/* Hidden utility */\n.zest-hidden {\n display: none !important;\n}\n${t.customStyles||""}\n`}let tt=null,et=null;function nt(t={}){tt?tt.classList.remove("zest-hidden"):function(t={}){if(tt)return tt;const e=q();tt=document.createElement("zest-banner"),tt.setAttribute("data-theme",e.theme||"light"),et=tt.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=Q(e),et.appendChild(n);const o=document.createElement("div");o.innerHTML=function(t){const e=t.labels.banner;return`\n <div class="zest-banner zest-banner--${t.position||"bottom"}" role="dialog" aria-modal="false" aria-label="${e.title}">\n <h2 class="zest-banner__title">${e.title}</h2>\n <p class="zest-banner__description">${e.description}</p>\n <div class="zest-banner__buttons">\n <button type="button" class="zest-btn zest-btn--primary" data-action="accept-all">\n ${e.acceptAll}\n </button>\n <button type="button" class="zest-btn zest-btn--secondary" data-action="reject-all">\n ${e.rejectAll}\n </button>\n <button type="button" class="zest-btn zest-btn--ghost" data-action="settings">\n ${e.settings}\n </button>\n </div>\n </div>\n `}(e),et.appendChild(o.firstElementChild);const a=et.querySelector(".zest-banner");a.addEventListener("click",e=>{const n=e.target.dataset.action;if(n)switch(n){case"accept-all":t.onAcceptAll?.();break;case"reject-all":t.onRejectAll?.();break;case"settings":t.onSettings?.()}}),a.addEventListener("keydown",e=>{"Escape"===e.key&&t.onSettings?.()}),document.body.appendChild(tt),requestAnimationFrame(()=>{const t=et.querySelector("button");t?.focus()})}(t)}function ot(){tt&&(tt.remove(),tt=null,et=null)}let at=null,st=null,rt={};function it(){if(!st)return rt;const t=st.querySelectorAll(".zest-toggle__input"),e={essential:!0};return t.forEach(t=>{const n=t.dataset.category;n&&"essential"!==n&&(e[n]=t.checked)}),e}function ct(t={},e={}){if(at)return at;const n=q();rt={...t},at=document.createElement("zest-modal"),at.setAttribute("data-theme",n.theme||"light"),st=at.attachShadow({mode:"open"});const o=document.createElement("style");o.textContent=Q(n),st.appendChild(o);const a=document.createElement("div");a.innerHTML=function(t,e){const n=t.labels.modal,o=Object.values(t.categories||E).map(t=>{return`\n <div class="zest-category">\n <div class="zest-category__header">\n <div class="zest-category__info">\n <span class="zest-category__label">${(n=t).label}</span>\n <p class="zest-category__description">${n.description}</p>\n </div>\n <label class="zest-toggle">\n <input\n type="checkbox"\n class="zest-toggle__input"\n data-category="${n.id}"\n ${e[t.id]??t.default?"checked":""}\n ${t.required?"disabled":""}\n aria-label="${n.label}"\n >\n <span class="zest-toggle__slider"></span>\n </label>\n </div>\n </div>\n `;var n}).join("");return`\n <div class="zest-modal-overlay" role="dialog" aria-modal="true" aria-label="${n.title}">\n <div class="zest-modal">\n <div class="zest-modal__header">\n <h2 class="zest-modal__title">${n.title}</h2>\n <p class="zest-modal__description">${n.description} ${t.policyUrl?`<a href="${t.policyUrl}" class="zest-link" target="_blank" rel="noopener">Privacy Policy</a>`:""}</p>\n </div>\n <div class="zest-modal__body">\n ${o}\n </div>\n <div class="zest-modal__footer">\n <button type="button" class="zest-btn zest-btn--primary" data-action="save">\n ${n.save}\n </button>\n <button type="button" class="zest-btn zest-btn--secondary" data-action="accept-all">\n ${n.acceptAll}\n </button>\n <button type="button" class="zest-btn zest-btn--ghost" data-action="reject-all">\n ${n.rejectAll}\n </button>\n </div>\n </div>\n </div>\n `}(n,t),st.appendChild(a.firstElementChild);const s=st.querySelector(".zest-modal-overlay");return s.addEventListener("click",t=>{const n=t.target.dataset.action;if(n)switch(n){case"save":e.onSave?.(it());break;case"accept-all":e.onAcceptAll?.();break;case"reject-all":e.onRejectAll?.()}else t.target===s&&e.onClose?.()}),s.addEventListener("keydown",t=>{"Escape"===t.key&&e.onClose?.()}),st.querySelectorAll(".zest-toggle__input").forEach(t=>{t.addEventListener("change",()=>{rt=it()})}),document.body.appendChild(at),requestAnimationFrame(()=>{const t=st.querySelector("button");t?.focus()}),at}function lt(){at&&(at.remove(),at=null,st=null)}let dt=null,ut=null;function pt(t={}){dt?dt.style.display="":function(t={}){if(dt)return dt;const e=q();dt=document.createElement("zest-widget"),dt.setAttribute("data-theme",e.theme||"light"),ut=dt.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=Q(e),ut.appendChild(n);const o=document.createElement("div");o.innerHTML=function(t){const e=t.labels.widget;return`\n <div class="zest-widget">\n <button type="button" class="zest-widget__btn" aria-label="${e.label}" title="${e.label}">\n <span class="zest-widget__icon"><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-.728-.078-1.437-.225-2.12a1 1 0 0 0-1.482-.63 3 3 0 0 1-4.086-3.72 1 1 0 0 0-.793-1.263A10.05 10.05 0 0 0 12 2zm0 2c.178 0 .354.006.528.017a5 5 0 0 0 5.955 5.955c.011.174.017.35.017.528 0 4.418-3.582 8-8 8s-8-3.582-8-8 3.582-8 8-8zm-4 6a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zm5 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 4a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z"/></svg></span>\n </button>\n </div>\n `}(e),ut.appendChild(o.firstElementChild),ut.querySelector(".zest-widget__btn").addEventListener("click",()=>{t.onClick?.()}),document.body.appendChild(dt)}(t)}function mt(){dt&&(dt.style.display="none")}let ft=!1,gt=null;function bt(t){return Z(t)}function yt(t){!function(t){const e=[];for(const n of a)t.includes(n.category)?o?.set&&o.set.call(document,n.value):e.push(n);a.length=0,a.push(...e)}(t),function(t){const e=[];for(const n of l)t.includes(n.category)?i?.setItem(n.key,n.value):e.push(n);l.length=0,l.push(...e);const n=[];for(const e of d)t.includes(e.category)?c?.setItem(e.key,e.value):n.push(e);d.length=0,d.push(...n)}(t),function(t){const e=[];for(const n of y)t.includes(n.category)?_(n):e.push(n);y.length=0,y.push(...e),document.querySelectorAll('script[data-zest-processed="blocked"]').forEach(e=>{const n=e.getAttribute("data-consent-category");if(t.includes(n)){const t=document.createElement("script"),n=e.getAttribute("data-blocked-src");n?t.src=n:t.textContent=e.textContent,e.async&&(t.async=!0),e.defer&&(t.defer=!0),t.setAttribute("data-zest-processed","executed"),t.setAttribute("data-consent-executed","true"),e.parentNode?.replaceChild(t,e)}})}(t)}function zt(){const t=function(t=365){return W({functional:!0,analytics:!0,marketing:!0},t)}(gt.expiration),e=Object.keys(E);j(t.current,gt,!1),ot(),lt(),yt(e),gt.showWidget&&pt({onClick:wt}),F(t.current,t.previous),X(t.current,t.previous),gt.callbacks?.onAccept?.(t.current),gt.callbacks?.onChange?.(t.current)}function ht(){const t=Y(gt.expiration);j(t.current,gt,!1),ot(),lt(),gt.showWidget&&pt({onClick:wt}),J(t.current),X(t.current,t.previous),gt.callbacks?.onReject?.(),gt.callbacks?.onChange?.(t.current)}function xt(t){const e=W(t,gt.expiration);j(e.current,gt,!1);const n=Object.keys(e.current).filter(t=>e.current[t]&&!e.previous[t]);n.length>0&&yt(n),lt(),gt.showWidget&&pt({onClick:wt});Object.entries(t).some(([t,e])=>"essential"!==t&&e)?F(e.current,e.previous):J(e.current),X(e.current,e.previous),gt.callbacks?.onChange?.(e.current)}function wt(){ot(),mt(),ct(U(),{onSave:xt,onAcceptAll:zt,onRejectAll:ht,onClose:vt}),V("modal")}function vt(){lt(),K("modal"),H()&>.showWidget?pt({onClick:wt}):nt({onAcceptAll:zt,onRejectAll:ht,onSettings:wt})}function kt(r={}){if(ft)return console.warn("[Zest] Already initialized"),_t;gt=function(t){return T=R(t),T}(r),j({functional:!1,analytics:!1,marketing:!1},gt,!0),gt.patterns&&function(n){e={...t};for(const[t,o]of Object.entries(n))Array.isArray(o)&&(e[t]=o.map(t=>t instanceof RegExp?t:RegExp(t)))}(gt.patterns),s=bt,function(t){u=t}(bt),function(t){w=t}(bt),o=Object.getOwnPropertyDescriptor(Document.prototype,"cookie"),o?Object.defineProperty(document,"cookie",{get:()=>o.get.call(document),set(t){const e=function(t){const e=t.match(/^([^=]+)/);return e?e[1].trim():null}(t);if(!e)return;const r=n(e);s(r)?o.set.call(document,t):a.push({value:t,name:e,category:r,timestamp:Date.now()})},configurable:!0}):console.warn("[Zest] Could not get cookie descriptor"),function(){try{return i=window.localStorage,c=window.sessionStorage,Object.defineProperty(window,"localStorage",{value:p(i,l),configurable:!0,writable:!1}),Object.defineProperty(window,"sessionStorage",{value:p(c,d),configurable:!0,writable:!1}),!0}catch(t){return console.warn("[Zest] Could not intercept storage APIs:",t),!1}}(),C(gt.mode,gt.blockedDomains);const m=P();ft=!0,H()&&j(m,gt,!1);let f=!1;if(S()&>.respectDNT&&"ignore"!==gt.dntBehavior&&"reject"===gt.dntBehavior&&!H()){const t=Y(gt.expiration);f=!0,j(t.current,gt,!1),J(t.current),X(t.current,t.previous),gt.callbacks?.onReject?.(),gt.callbacks?.onChange?.(t.current)}return function(t){G(B.READY,{consent:t})}(m),gt.callbacks?.onReady?.(m),H()||f?gt.showWidget&&pt({onClick:wt}):(nt({onAcceptAll:zt,onRejectAll:ht,onSettings:wt}),V("banner")),_t}const _t={init:kt,show(){ft?(lt(),mt(),nt({onAcceptAll:zt,onRejectAll:ht,onSettings:wt}),V("banner")):console.warn("[Zest] Not initialized. Call Zest.init() first.")},hide(){ot(),K("banner")},showSettings(){ft?wt():console.warn("[Zest] Not initialized. Call Zest.init() first.")},hideSettings(){lt(),K("modal")},getConsent:U,hasConsent:Z,hasConsentDecision:H,getConsentProof:function(){try{const t=I().match(RegExp(D+"=([^;]+)"));if(t)return JSON.parse(decodeURIComponent(t[1]))}catch(t){}return null},isDoNotTrackEnabled:S,getDNTDetails:function(){if("undefined"==typeof navigator)return{enabled:!1,source:null};const t=navigator.doNotTrack||window.doNotTrack||navigator.msDoNotTrack;return"1"===t||"yes"===t||!0===t?{enabled:!0,source:"dnt"}:!0===navigator.globalPrivacyControl?{enabled:!0,source:"gpc"}:{enabled:!1,source:null}},acceptAll(){ft?zt():console.warn("[Zest] Not initialized. Call Zest.init() first.")},rejectAll(){ft?ht():console.warn("[Zest] Not initialized. Call Zest.init() first.")},reset(){O(D+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"),L=null,lt(),dt&&(dt.remove(),dt=null,ut=null),ft&&(nt({onAcceptAll:zt,onRejectAll:ht,onSettings:wt}),V("banner"))},getConfig:q,EVENTS:B};if("undefined"!=typeof window){window.Zest=_t;const t=()=>{!1!==$().autoInit&&kt(window.ZestConfig)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}return _t}();
|
|
1
|
+
var Zest=function(){"use strict";const t={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};function e(e){if(null==e)return"";return("string"==typeof e?e:e+"").replace(/[&<>"'`]/g,e=>t[e])}const n=new Set(["transparent","black","white","red","green","blue","yellow","orange","purple","pink","gray","grey","brown","cyan","magenta","silver","gold","navy","teal","maroon","olive","lime","aqua","fuchsia","indigo","violet","crimson","coral","salmon","tomato"]);const o=[/(\([^)]*[+*][^)]*\)|\[[^\]]*\]|\\w|\\d|\\s)\s*[+*]/,/\(\?[=!][^)]*[+*][^)]*\)[+*]/];function s(t,e){if(t instanceof RegExp)return t;if("string"!=typeof t)return null;if(t.length>500)return null;for(const e of o)if(e.test(t))return null;try{return RegExp(t,e)}catch(t){return null}}const a=new Set(["__proto__","constructor","prototype"]);function r(t,e){if(!t||"object"!=typeof t||Array.isArray(t))return null;const n={version:"string"==typeof t.version?t.version:null,timestamp:"number"==typeof t.timestamp&&Number.isFinite(t.timestamp)?t.timestamp:null,categories:{}},o=t.categories;if(!o||"object"!=typeof o||Array.isArray(o))return null;for(const t of e)a.has(t)||Object.prototype.hasOwnProperty.call(o,t)&&(n.categories[t]=!0===o[t]);return e.includes("essential")&&(n.categories.essential=!0),n}function i(t,...e){if("function"==typeof t)try{return t(...e)}catch(t){try{console.error("[Zest] User callback threw:",t)}catch(t){}return}}const c={essential:[/^zest_/,/^csrf/i,/^xsrf/i,/^session/i,/^__host-/i,/^__secure-/i],functional:[/^lang/i,/^locale/i,/^theme/i,/^preferences/i,/^ui_/i],analytics:[/^_ga/,/^_gid/,/^_gat/,/^_utm/,/^__utm/,/^plausible/i,/^_pk_/,/^matomo/i,/^_hj/,/^ajs_/],marketing:[/^_fbp/,/^_fbc/,/^_gcl/,/^_ttp/,/^ads/i,/^doubleclick/i,/^__gads/,/^__gpi/,/^_pin_/,/^li_/]};let l={...c};function d(t){for(const[e,n]of Object.entries(l))if(n.some(e=>e.test(t)))return e;return"marketing"}let u=null;const p=[];let f=()=>!1;function g(){return u}let m=null,b=null;const y=[],h=[];let z=()=>!1;function w(t,e,n){return new Proxy(t,{get(t,n){if("setItem"===n)return(n,o)=>{const s=d(n);z(s)?t.setItem(n,o):200>e.length&&e.push({key:n,value:o,category:s,timestamp:Date.now()})};const o=t[n];return"function"==typeof o?o.bind(t):o}})}const x={analytics:["google-analytics.com","www.google-analytics.com","analytics.google.com","googletagmanager.com","www.googletagmanager.com","plausible.io","cloudflareinsights.com","static.cloudflareinsights.com"],marketing:["connect.facebook.net","www.facebook.com/tr","ads.google.com","www.googleadservices.com","googleads.g.doubleclick.net","pagead2.googlesyndication.com"]},v={analytics:[...x.analytics,"analytics.tiktok.com","matomo.","hotjar.com","static.hotjar.com","script.hotjar.com","clarity.ms","www.clarity.ms","heapanalytics.com","cdn.heapanalytics.com","mixpanel.com","cdn.mxpnl.com","segment.com","cdn.segment.com","api.segment.io","fullstory.com","rs.fullstory.com","amplitude.com","cdn.amplitude.com","mouseflow.com","cdn.mouseflow.com","luckyorange.com","cdn.luckyorange.net","crazyegg.com","script.crazyegg.com"],marketing:[...x.marketing,"snap.licdn.com","px.ads.linkedin.com","ads.linkedin.com","analytics.twitter.com","static.ads-twitter.com","t.co","analytics.tiktok.com","ads.tiktok.com","sc-static.net","tr.snapchat.com","ct.pinterest.com","pintrk.com","s.pinimg.com","widgets.pinterest.com","bat.bing.com","ads.yahoo.com","sp.analytics.yahoo.com","amazon-adsystem.com","z-na.amazon-adsystem.com","criteo.com","static.criteo.net","dis.criteo.com","taboola.com","cdn.taboola.com","trc.taboola.com","outbrain.com","widgets.outbrain.com","adroll.com","s.adroll.com"],functional:["cdn.onesignal.com","onesignal.com","pusher.com","js.pusher.com","intercom.io","widget.intercom.io","js.intercomcdn.com","crisp.chat","client.crisp.chat","cdn.livechatinc.com","livechatinc.com","tawk.to","embed.tawk.to","zendesk.com","static.zdassets.com"]};function k(t,e){let n;try{n=new URL(t)}catch(t){return!1}const o=n.hostname.toLowerCase(),s=n.pathname.toLowerCase();for(const t of e){if("string"!=typeof t)continue;const e=t.toLowerCase();if(e.endsWith(".")){const t=e.slice(0,-1);if(o.split(".").some(e=>e===t)||o.startsWith(e))return!0;continue}const n=e.indexOf("/");if(-1!==n){const t=e.slice(0,n),a=e.slice(n);if((o===t||o.endsWith("."+t))&&s.startsWith(a))return!0;continue}if(o===e||o.endsWith("."+e))return!0}return!1}function _(t,e="safe"){const n="strict"===e?v:x;for(const[e,o]of Object.entries(n))if(k(t,o))return e;return null}const A=new Set(["functional","analytics","marketing"]),C=[];let S=null,j="safe",E=[],N=()=>!1;function $(t){if(t.hasAttribute("data-zest-allow"))return null;const e=t.getAttribute("data-consent-category"),n=e&&A.has(e)?e:null,o=t.src;if(!o)return n;const s=function(t){if(!t||0===E.length)return null;try{const e=new URL(t).hostname.toLowerCase();for(const t of E){const n="string"==typeof t?t:t.domain,o="string"==typeof t?"marketing":t.category||"marketing";if(e===n||e.endsWith("."+n))return o}}catch(t){}return null}(o);let a=null;switch(j){case"manual":break;case"safe":case"strict":a=_(o,j);break;case"doomsday":(function(t){try{const e=new URL(t).hostname,n=window.location.hostname,o=t=>t.replace(/^www\./,"");return o(e)!==o(n)}catch(t){return!1}})(o)&&(a=_(o,"strict")||"marketing")}return a||s||n}function L(t){if(t.hasAttribute("data-zest-processed"))return!1;const e=$(t);if(!e)return t.setAttribute("data-zest-processed","allowed"),!1;if(N(e))return t.setAttribute("data-zest-processed","allowed"),!1;const n={category:e,src:t.src||"",inline:t.textContent,type:t.type,async:t.async,defer:t.defer,element:t,timestamp:Date.now()};return t.setAttribute("data-zest-processed","blocked"),t.setAttribute("data-consent-category",e),t.type="text/plain",t.src&&t.removeAttribute("src"),500>C.length&&C.push(n),!0}function M(t){for(const e of t)for(const t of e.addedNodes)if("SCRIPT"!==t.nodeName||t.hasAttribute("data-zest-processed")||L(t),t.querySelectorAll){t.querySelectorAll("script:not([data-zest-processed])").forEach(L)}}function R(t="safe",e=[]){return j=t,E=e,document.querySelectorAll("script:not([data-zest-processed])").forEach(L),S=new MutationObserver(M),S.observe(document.documentElement,{childList:!0,subtree:!0}),!0}const T={essential:{id:"essential",label:"Essential",description:"Required for the website to function properly. Cannot be disabled.",required:!0,default:!0},functional:{id:"functional",label:"Functional",description:"Enable personalized features like language preferences and themes.",required:!1,default:!1},analytics:{id:"analytics",label:"Analytics",description:"Help us understand how visitors interact with our website.",required:!1,default:!1},marketing:{id:"marketing",label:"Marketing",description:"Used to deliver relevant advertisements and track campaign performance.",required:!1,default:!1}};function D(){return Object.keys(T)}function q(){if("undefined"==typeof navigator)return!1;const t=navigator.doNotTrack||window.doNotTrack||navigator.msDoNotTrack;return"1"===t||"yes"===t||!0===t||!0===navigator.globalPrivacyControl}function O(t,e,n){const o=n?"default":"update";e.consentModeGoogle&&function(t,e){if(window.dataLayer=window.dataLayer||[],"function"==typeof window.gtag)window.gtag("consent",t,e);else{function n(){window.dataLayer.push(arguments)}n("consent",t,e)}}(o,function(t){const e=t=>t?"granted":"denied";return{ad_storage:e(t.marketing),ad_user_data:e(t.marketing),ad_personalization:e(t.marketing),analytics_storage:e(t.analytics),functionality_storage:"granted",personalization_storage:e(t.functional)}}(t)),e.consentModeMicrosoft&&function(t,e){window.uetq=window.uetq||[],window.uetq.push("consent",t,e)}(o,function(t){return{ad_storage:t.marketing?"granted":"denied"}}(t))}const W={labels:{banner:{title:"Nous respectons votre vie privée",description:"Nous utilisons des cookies pour améliorer votre expérience de navigation, proposer du contenu personnalisé et analyser notre trafic. En cliquant sur « Tout accepter », vous consentez à l'utilisation de cookies.",acceptAll:"Tout accepter",rejectAll:"Tout refuser",settings:"Paramètres"},modal:{title:"Paramètres de confidentialité",description:"Gérez vos préférences en matière de cookies. Vous pouvez activer ou désactiver différents types de cookies ci-dessous.",save:"Enregistrer les préférences",acceptAll:"Tout accepter",rejectAll:"Tout refuser"},widget:{label:"Paramètres des cookies"}},categories:{essential:{label:"Essentiels",description:"Nécessaires au bon fonctionnement du site. Ne peuvent pas être désactivés."},functional:{label:"Fonctionnels",description:"Permettent des fonctionnalités personnalisées comme les préférences de langue et de thème."},analytics:{label:"Analytiques",description:"Nous aident à comprendre comment les visiteurs interagissent avec notre site."},marketing:{label:"Marketing",description:"Utilisés pour afficher des publicités pertinentes et mesurer les performances des campagnes."}}};const I={lang:"auto",position:"bottom",theme:"auto",accentColor:"#0071e3",categories:T,labels:{banner:{title:"We value your privacy",description:'We use cookies to enhance your browsing experience, serve personalized content, and analyze our traffic. By clicking "Accept All", you consent to our use of cookies.',acceptAll:"Accept All",rejectAll:"Reject All",settings:"Settings"},modal:{title:"Privacy Settings",description:"Manage your cookie preferences. You can enable or disable different types of cookies below.",save:"Save Preferences",acceptAll:"Accept All",rejectAll:"Reject All"},widget:{label:"Cookie Settings"}},autoInit:!0,showWidget:!0,expiration:365,respectDNT:!0,dntBehavior:"reject",customStyles:"",consentModeGoogle:!1,consentModeMicrosoft:!1,mode:"safe",blockedDomains:[],policyUrl:null,imprintUrl:null,callbacks:{onAccept:null,onReject:null,onChange:null,onReady:null}};function P(t){const e={...I};t||(t={});const n=["lang","position","theme","accentColor","autoInit","showWidget","expiration","policyUrl","imprintUrl","customStyles","mode","blockedDomains","respectDNT","dntBehavior","consentModeGoogle","consentModeMicrosoft"];for(const o of n)void 0!==t[o]&&(e[o]=t[o]);e.lang="fr";const o=W,s=o.labels||{},a=t.labels||{};e.labels={banner:{...I.labels.banner,...s.banner,...a.banner},modal:{...I.labels.modal,...s.modal,...a.modal},widget:{...I.labels.widget,...s.widget,...a.widget}};const r=o.categories||{},i=t.categories||{};e.categories={...I.categories};for(const t of Object.keys(I.categories))e.categories[t]={...I.categories[t],...r[t],...i[t]};return t.callbacks&&(e.callbacks={...I.callbacks,...t.callbacks}),t.patterns&&(e.patterns=t.patterns),e}function U(){const t="undefined"!=typeof window&&window.ZestConfig?window.ZestConfig:{},e=function(){const t=document.currentScript||document.querySelector("script[data-zest]")||document.querySelector('script[src*="zest"]');if(!t)return{};const e={},n=t.getAttribute("data-position");n&&(e.position=n);const o=t.getAttribute("data-theme");o&&(e.theme=o);const s=t.getAttribute("data-accent")||t.getAttribute("data-accent-color");s&&(e.accentColor=s);const a=t.getAttribute("data-policy-url")||t.getAttribute("data-privacy-url");a&&(e.policyUrl=a);const r=t.getAttribute("data-imprint-url");r&&(e.imprintUrl=r);const i=t.getAttribute("data-show-widget");null!==i&&(e.showWidget="false"!==i);const c=t.getAttribute("data-auto-init");null!==c&&(e.autoInit="false"!==c);const l=t.getAttribute("data-expiration");l&&(e.expiration=parseInt(l,10));const d=t.getAttribute("data-consent-mode-google");null!==d&&(e.consentModeGoogle="false"!==d);const u=t.getAttribute("data-consent-mode-microsoft");return null!==u&&(e.consentModeMicrosoft="false"!==u),e}();return P({...t,...e})}let Z=null;function Y(){return Z||(Z=U()),Z}const H="zest_consent";function F(){try{return"undefined"!=typeof location&&"https:"===location.protocol?"; Secure":""}catch(t){return""}}let B=null;function G(t){const e=g();e?.set?e.set.call(document,t):document.cookie=t}function J(){const t=g();return t?.get?t.get.call(document):document.cookie}function X(){try{const t=J().match(RegExp(H+"=([^;]+)"));if(t){const e=r(JSON.parse(decodeURIComponent(t[1])),D());if(e&&e.categories)return B={essential:!0,functional:!1,analytics:!1,marketing:!1,...e.categories},{...B}}}catch(t){}return B={essential:!0,functional:!1,analytics:!1,marketing:!1},{...B}}function V(){return B||(B=X()),{...B}}function K(t,e=365){const n=B?{...B}:{essential:!0,functional:!1,analytics:!1,marketing:!1};return B={essential:!0,functional:!!t.functional,analytics:!!t.analytics,marketing:!!t.marketing},function(t=365){B||(B={essential:!0,functional:!1,analytics:!1,marketing:!1});const e={version:"1.0",timestamp:Date.now(),categories:B},n=new Date(Date.now()+24*t*60*60*1e3).toUTCString();G(`${H}=${encodeURIComponent(JSON.stringify(e))}; expires=${n}; path=/; SameSite=Lax${F()}`)}(e),{current:{...B},previous:n}}function Q(t){return B||(B=X()),!0===B[t]}function tt(t=365){return K({functional:!1,analytics:!1,marketing:!1},t)}function et(){try{return J().includes(H)}catch(t){return!1}}const nt={READY:"zest:ready",CONSENT:"zest:consent",REJECT:"zest:reject",CHANGE:"zest:change",SHOW:"zest:show",HIDE:"zest:hide"};function ot(t,e={}){const n=new CustomEvent(t,{detail:e,bubbles:!0,cancelable:!0});return document.dispatchEvent(n),n}function st(t,e){return ot(nt.CONSENT,{consent:t,previous:e})}function at(t){return ot(nt.REJECT,{consent:t})}function rt(t,e){return ot(nt.CHANGE,{consent:t,previous:e})}function it(t="banner"){return ot(nt.SHOW,{type:t})}function ct(t="banner"){return ot(nt.HIDE,{type:t})}let lt=!1,dt=null;function ut(t){return Q(t)}function pt(t){!function(t){const e=[];for(const n of p)t.includes(n.category)?u?.set&&u.set.call(document,n.value):e.push(n);p.length=0,p.push(...e)}(t),function(t){const e=[];for(const n of y)t.includes(n.category)?m?.setItem(n.key,n.value):e.push(n);y.length=0,y.push(...e);const n=[];for(const e of h)t.includes(e.category)?b?.setItem(e.key,e.value):n.push(e);h.length=0,h.push(...n)}(t),function(t){const e=[];for(const n of C){if(!t.includes(n.category)){e.push(n);continue}const o=document.createElement("script");n.src?o.src=n.src:n.inline&&(o.textContent=n.inline),n.async&&(o.async=!0),n.defer&&(o.defer=!0),n.type&&"text/plain"!==n.type&&(o.type=n.type),o.setAttribute("data-zest-processed","executed"),o.setAttribute("data-consent-executed","true");const s=n.element;s&&s.isConnected&&s.parentNode?s.parentNode.replaceChild(o,s):document.head.appendChild(o)}C.length=0,C.push(...e)}(t)}function ft(t={}){if(lt)return{alreadyInitialized:!0,config:dt,consent:X(),hasDecision:et(),dntApplied:!1};Z=P(t),dt=Z,O({functional:!1,analytics:!1,marketing:!1},dt,!0),dt.patterns&&function(t){if(l={...c},t&&"object"==typeof t)for(const[e,n]of Object.entries(t)){if(!Array.isArray(n))continue;const t=[];for(const e of n){const n=s(e);if(n)t.push(n);else try{console.warn("[Zest] Rejected unsafe pattern:",e)}catch(t){}}l[e]=t}}(dt.patterns),f=ut,function(t){z=t}(ut),function(t){N=t}(ut),u=Object.getOwnPropertyDescriptor(Document.prototype,"cookie"),u?Object.defineProperty(document,"cookie",{get:()=>u.get.call(document),set(t){const e=function(t){const e=t.match(/^([^=]+)/);return e?e[1].trim():null}(t);if(!e)return;const n=d(e);f(n)?u.set.call(document,t):100>p.length&&p.push({value:t,name:e,category:n,timestamp:Date.now()})},configurable:!1}):console.warn("[Zest] Could not get cookie descriptor"),function(){try{return m=window.localStorage,b=window.sessionStorage,Object.defineProperty(window,"localStorage",{value:w(m,y),configurable:!0,writable:!1}),Object.defineProperty(window,"sessionStorage",{value:w(b,h),configurable:!0,writable:!1}),!0}catch(t){return console.warn("[Zest] Could not intercept storage APIs:",t),!1}}(),R(dt.mode,dt.blockedDomains);const e=X();lt=!0,et()&&O(e,dt,!1);let n=!1;if(q()&&dt.respectDNT&&"ignore"!==dt.dntBehavior&&"reject"===dt.dntBehavior&&!et()){const t=tt(dt.expiration);n=!0,O(t.current,dt,!1),at(t.current),rt(t.current,t.previous),i(dt.callbacks?.onReject),i(dt.callbacks?.onChange,t.current)}return function(t){ot(nt.READY,{consent:t})}(e),i(dt.callbacks?.onReady,e),{alreadyInitialized:!1,config:dt,consent:e,hasDecision:et(),dntApplied:n}}function gt(){if(!lt)return null;const t=function(t=365){return K({functional:!0,analytics:!0,marketing:!0},t)}(dt.expiration);return O(t.current,dt,!1),pt(D()),st(t.current,t.previous),rt(t.current,t.previous),i(dt.callbacks?.onAccept,t.current),i(dt.callbacks?.onChange,t.current),t}function mt(){G(`${H}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/; SameSite=Lax${F()}`),B=null}function bt(){return lt}function yt(){return dt}const ht="#4F46E5";function zt(t){const e=function(t){if("string"!=typeof t)return null;const e=t.trim();return/^#[0-9a-fA-F]{3,8}$/.test(e)||n.has(e.toLowerCase())||/^(rgb|rgba|hsl|hsla)\(\s*[\d.,%\s/]+\s*\)$/i.test(e)?e:null}(t.accentColor)||ht,o=function(t){if("string"!=typeof t||0===t.length)return"";if(t.length>2e4)return"";let e=t.replace(/\/\*[\s\S]*?\*\//g,"");return e=e.replace(/@import\s+[^;]+;?/gi,""),e=e.replace(/@charset\s+[^;]+;?/gi,""),e=e.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/gi,(t,e,n)=>{const o=n.trim().toLowerCase();return o.startsWith("https:")||o.startsWith("data:image/")||o.startsWith("/")||o.startsWith("#")?t:"url(#)"}),e=e.replace(/\.zest-btn--secondary\s*\{[^}]*\}/gi,""),e=e.replace(/\[data-action\s*=\s*["']reject-all["']\]\s*\{[^}]*\}/gi,""),e=e.replace(/\[data-action\s*=\s*["']accept-all["']\]\s*\{[^}]*\}/gi,""),e=e.replace(/expression\s*\([^)]*\)/gi,""),e=e.replace(/-moz-binding\s*:[^;}]*/gi,""),e}(t.customStyles);return`\n:host {\n --zest-accent: ${e};\n --zest-accent-hover: ${function(t,e){"string"==typeof t&&/^#[0-9a-fA-F]{3,8}$/.test(t.trim())||(t=ht);let n=t.trim().replace("#","");3===n.length&&(n=n.split("").map(t=>t+t).join(""));8===n.length&&(n=n.slice(0,6));6!==n.length&&(n="4F46E5");const o=parseInt(n,16),s=Math.round(2.55*e);return"#"+(16777216+65536*Math.min(255,Math.max(0,(o>>16)+s))+256*Math.min(255,Math.max(0,(o>>8&255)+s))+Math.min(255,Math.max(0,(255&o)+s))).toString(16).slice(1)}(e,-15)};\n --zest-bg: #ffffff;\n --zest-bg-secondary: #f3f4f6;\n --zest-text: #1f2937;\n --zest-text-secondary: #6b7280;\n --zest-border: #e5e7eb;\n --zest-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);\n --zest-radius: 12px;\n --zest-radius-sm: 8px;\n --zest-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;\n\n font-family: var(--zest-font);\n font-size: 14px;\n line-height: 1.5;\n color: var(--zest-text);\n box-sizing: border-box;\n}\n\n:host([data-theme="dark"]) {\n --zest-bg: #1f2937;\n --zest-bg-secondary: #374151;\n --zest-text: #f9fafb;\n --zest-text-secondary: #9ca3af;\n --zest-border: #4b5563;\n --zest-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);\n}\n\n@media (prefers-color-scheme: dark) {\n :host([data-theme="auto"]) {\n --zest-bg: #1f2937;\n --zest-bg-secondary: #374151;\n --zest-text: #f9fafb;\n --zest-text-secondary: #9ca3af;\n --zest-border: #4b5563;\n --zest-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);\n }\n}\n\n*, *::before, *::after {\n box-sizing: border-box;\n}\n\n/* Banner */\n.zest-banner {\n position: fixed;\n z-index: 999999;\n max-width: 480px;\n padding: 20px;\n background: var(--zest-bg);\n border-radius: var(--zest-radius);\n box-shadow: var(--zest-shadow);\n animation: zest-slide-in 0.3s ease-out;\n}\n\n.zest-banner--bottom {\n bottom: 20px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.zest-banner--bottom-left {\n bottom: 20px;\n left: 20px;\n}\n\n.zest-banner--bottom-right {\n bottom: 20px;\n right: 20px;\n}\n\n.zest-banner--top {\n top: 20px;\n left: 50%;\n transform: translateX(-50%);\n}\n\n@keyframes zest-slide-in {\n from {\n opacity: 0;\n transform: translateX(-50%) translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateX(-50%) translateY(0);\n }\n}\n\n.zest-banner--bottom-left {\n animation-name: zest-slide-in-left;\n}\n\n@keyframes zest-slide-in-left {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n.zest-banner--bottom-right {\n animation-name: zest-slide-in-right;\n}\n\n@keyframes zest-slide-in-right {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .zest-banner,\n .zest-modal {\n animation: none;\n }\n}\n\n.zest-banner__title {\n margin: 0 0 8px 0;\n font-size: 16px;\n font-weight: 600;\n color: var(--zest-text);\n}\n\n.zest-banner__description {\n margin: 0 0 16px 0;\n font-size: 14px;\n color: var(--zest-text-secondary);\n}\n\n.zest-banner__buttons {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n/* Buttons */\n.zest-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 10px 16px;\n font-size: 14px;\n font-weight: 500;\n font-family: inherit;\n border: none;\n border-radius: var(--zest-radius-sm);\n cursor: pointer;\n transition: background-color 0.15s ease, transform 0.1s ease;\n}\n\n.zest-btn:hover {\n transform: translateY(-1px);\n}\n\n.zest-btn:active {\n transform: translateY(0);\n}\n\n.zest-btn:focus-visible {\n outline: 2px solid var(--zest-accent);\n outline-offset: 2px;\n}\n\n.zest-btn--primary {\n background: var(--zest-accent);\n color: #ffffff;\n}\n\n.zest-btn--primary:hover {\n background: var(--zest-accent-hover);\n}\n\n.zest-btn--secondary {\n background: var(--zest-bg-secondary);\n color: var(--zest-text);\n}\n\n.zest-btn--secondary:hover {\n background: var(--zest-border);\n}\n\n.zest-btn--ghost {\n background: transparent;\n color: var(--zest-text-secondary);\n}\n\n.zest-btn--ghost:hover {\n background: var(--zest-bg-secondary);\n color: var(--zest-text);\n}\n\n/* Modal */\n.zest-modal-overlay {\n position: fixed;\n inset: 0;\n z-index: 999998;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 20px;\n background: rgba(0, 0, 0, 0.5);\n animation: zest-fade-in 0.2s ease-out;\n}\n\n@keyframes zest-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n.zest-modal {\n width: 100%;\n max-width: 500px;\n max-height: 90vh;\n overflow-y: auto;\n background: var(--zest-bg);\n border-radius: var(--zest-radius);\n box-shadow: var(--zest-shadow);\n animation: zest-modal-in 0.3s ease-out;\n}\n\n@keyframes zest-modal-in {\n from {\n opacity: 0;\n transform: scale(0.95);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n.zest-modal__header {\n padding: 20px 20px 0;\n}\n\n.zest-modal__title {\n margin: 0 0 8px 0;\n font-size: 18px;\n font-weight: 600;\n color: var(--zest-text);\n}\n\n.zest-modal__description {\n margin: 0;\n font-size: 14px;\n color: var(--zest-text-secondary);\n}\n\n.zest-modal__body {\n padding: 20px;\n}\n\n.zest-modal__footer {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n padding: 0 20px 20px;\n}\n\n/* Categories */\n.zest-category {\n padding: 16px;\n margin-bottom: 12px;\n background: var(--zest-bg-secondary);\n border-radius: var(--zest-radius-sm);\n}\n\n.zest-category:last-child {\n margin-bottom: 0;\n}\n\n.zest-category__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n.zest-category__info {\n flex: 1;\n}\n\n.zest-category__label {\n display: block;\n font-size: 14px;\n font-weight: 600;\n color: var(--zest-text);\n}\n\n.zest-category__description {\n margin: 4px 0 0;\n font-size: 13px;\n color: var(--zest-text-secondary);\n}\n\n/* Toggle Switch */\n.zest-toggle {\n position: relative;\n width: 44px;\n height: 24px;\n flex-shrink: 0;\n}\n\n.zest-toggle__input {\n position: absolute;\n opacity: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n margin: 0;\n}\n\n.zest-toggle__input:disabled {\n cursor: not-allowed;\n}\n\n.zest-toggle__slider {\n position: absolute;\n inset: 0;\n background: var(--zest-border);\n border-radius: 12px;\n transition: background-color 0.2s ease;\n pointer-events: none;\n}\n\n.zest-toggle__slider::before {\n content: '';\n position: absolute;\n top: 2px;\n left: 2px;\n width: 20px;\n height: 20px;\n background: #ffffff;\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);\n}\n\n.zest-toggle__input:checked + .zest-toggle__slider {\n background: var(--zest-accent);\n}\n\n.zest-toggle__input:checked + .zest-toggle__slider::before {\n transform: translateX(20px);\n}\n\n.zest-toggle__input:focus-visible + .zest-toggle__slider {\n outline: 2px solid var(--zest-accent);\n outline-offset: 2px;\n}\n\n.zest-toggle__input:disabled + .zest-toggle__slider {\n opacity: 0.6;\n}\n\n/* Widget */\n.zest-widget {\n position: fixed;\n z-index: 999997;\n bottom: 20px;\n left: 20px;\n}\n\n.zest-widget__btn {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 48px;\n height: 48px;\n padding: 0;\n background: var(--zest-bg);\n border: 1px solid var(--zest-border);\n border-radius: 50%;\n box-shadow: var(--zest-shadow);\n cursor: pointer;\n transition: transform 0.2s ease, box-shadow 0.2s ease;\n}\n\n.zest-widget__btn:hover {\n transform: scale(1.05);\n box-shadow: 0 12px 28px -5px rgba(0, 0, 0, 0.15);\n}\n\n.zest-widget__btn:focus-visible {\n outline: 2px solid var(--zest-accent);\n outline-offset: 2px;\n}\n\n.zest-widget__icon {\n width: 24px;\n height: 24px;\n fill: var(--zest-text);\n}\n\n/* Link */\n.zest-link {\n color: var(--zest-accent);\n text-decoration: none;\n}\n\n.zest-link:hover {\n text-decoration: underline;\n}\n\n/* Mobile */\n@media (max-width: 480px) {\n .zest-banner {\n left: 10px;\n right: 10px;\n max-width: none;\n transform: none;\n }\n\n .zest-banner--bottom,\n .zest-banner--bottom-left,\n .zest-banner--bottom-right {\n bottom: 10px;\n }\n\n .zest-banner--top {\n top: 10px;\n transform: none;\n }\n\n @keyframes zest-slide-in {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n .zest-banner__buttons {\n flex-direction: column;\n }\n\n .zest-btn {\n width: 100%;\n }\n\n .zest-modal-overlay {\n padding: 10px;\n }\n\n .zest-widget {\n bottom: 10px;\n left: 10px;\n }\n}\n\n/* Hidden utility */\n.zest-hidden {\n display: none !important;\n}\n${o}\n`}let wt=null,xt=null;const vt=new Set(["bottom","bottom-left","bottom-right","top"]);function kt(t={}){if(wt)return wt;const n=Y();wt=document.createElement("zest-banner"),wt.setAttribute("data-theme",n.theme||"light"),xt=wt.attachShadow({mode:"open"});const o=document.createElement("style");o.textContent=zt(n),xt.appendChild(o);const s=document.createElement("div");s.innerHTML=function(t){const n=t.labels.banner,o=t.position||"bottom";return`\n <div class="zest-banner zest-banner--${vt.has(o)?o:"bottom"}" role="dialog" aria-modal="false" aria-label="${e(n.title)}">\n <h2 class="zest-banner__title">${e(n.title)}</h2>\n <p class="zest-banner__description">${e(n.description)}</p>\n <div class="zest-banner__buttons">\n <button type="button" class="zest-btn zest-btn--primary" data-action="accept-all">\n ${e(n.acceptAll)}\n </button>\n <button type="button" class="zest-btn zest-btn--secondary" data-action="reject-all">\n ${e(n.rejectAll)}\n </button>\n <button type="button" class="zest-btn zest-btn--ghost" data-action="settings">\n ${e(n.settings)}\n </button>\n </div>\n </div>\n `}(n),xt.appendChild(s.firstElementChild);const a=xt.querySelector(".zest-banner");return a.addEventListener("click",e=>{const n=e.target.dataset.action;if(n)switch(n){case"accept-all":t.onAcceptAll?.();break;case"reject-all":t.onRejectAll?.();break;case"settings":t.onSettings?.()}}),a.addEventListener("keydown",e=>{"Escape"===e.key&&t.onSettings?.()}),document.body.appendChild(wt),requestAnimationFrame(()=>{const t=xt.querySelector("button");t?.focus()}),wt}function _t(t={}){wt?wt.classList.remove("zest-hidden"):kt(t)}function At(){wt&&(wt.remove(),wt=null,xt=null)}let Ct=null,St=null,jt={};function Et(t,n){const o=t.labels.modal,s=Object.values(t.categories||T).map(t=>function(t,n,o){const s=o?"disabled":"",a=n?"checked":"",r=e(t.id),i=e(t.label);return`\n <div class="zest-category">\n <div class="zest-category__header">\n <div class="zest-category__info">\n <span class="zest-category__label">${i}</span>\n <p class="zest-category__description">${e(t.description)}</p>\n </div>\n <label class="zest-toggle">\n <input\n type="checkbox"\n class="zest-toggle__input"\n data-category="${r}"\n ${a}\n ${s}\n aria-label="${i}"\n >\n <span class="zest-toggle__slider"></span>\n </label>\n </div>\n </div>\n `}(t,n[t.id]??t.default,t.required)).join(""),a=t.policyUrl?function(t){if("string"!=typeof t||0===t.length)return null;const e=t.trim();if(0===e.length)return null;if(/^[/?#]/.test(e))return e;const n=e.match(/^([a-z][a-z0-9+.-]*):/i);if(!n)return e;const o=n[1].toLowerCase();return"http"===o||"https"===o||"mailto"===o||"tel"===o?e:null}(t.policyUrl):null,r=a?`<a href="${e(a)}" class="zest-link" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`:"";return`\n <div class="zest-modal-overlay" role="dialog" aria-modal="true" aria-label="${e(o.title)}">\n <div class="zest-modal">\n <div class="zest-modal__header">\n <h2 class="zest-modal__title">${e(o.title)}</h2>\n <p class="zest-modal__description">${e(o.description)} ${r}</p>\n </div>\n <div class="zest-modal__body">\n ${s}\n </div>\n <div class="zest-modal__footer">\n <button type="button" class="zest-btn zest-btn--primary" data-action="save">\n ${e(o.save)}\n </button>\n <button type="button" class="zest-btn zest-btn--secondary" data-action="accept-all">\n ${e(o.acceptAll)}\n </button>\n <button type="button" class="zest-btn zest-btn--ghost" data-action="reject-all">\n ${e(o.rejectAll)}\n </button>\n </div>\n </div>\n </div>\n `}function Nt(){if(!St)return jt;const t=St.querySelectorAll(".zest-toggle__input"),e={essential:!0};return t.forEach(t=>{const n=t.dataset.category;n&&"essential"!==n&&(e[n]=t.checked)}),e}function $t(){Ct&&(Ct.remove(),Ct=null,St=null)}let Lt=null,Mt=null;function Rt(t={}){if(Lt)return Lt;const n=Y();Lt=document.createElement("zest-widget"),Lt.setAttribute("data-theme",n.theme||"light"),Mt=Lt.attachShadow({mode:"open"});const o=document.createElement("style");o.textContent=zt(n),Mt.appendChild(o);const s=document.createElement("div");s.innerHTML=function(t){const n=e(t.labels.widget.label);return`\n <div class="zest-widget">\n <button type="button" class="zest-widget__btn" aria-label="${n}" title="${n}">\n <span class="zest-widget__icon"><svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10c0-.728-.078-1.437-.225-2.12a1 1 0 0 0-1.482-.63 3 3 0 0 1-4.086-3.72 1 1 0 0 0-.793-1.263A10.05 10.05 0 0 0 12 2zm0 2c.178 0 .354.006.528.017a5 5 0 0 0 5.955 5.955c.011.174.017.35.017.528 0 4.418-3.582 8-8 8s-8-3.582-8-8 3.582-8 8-8zm-4 6a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3zm5 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm-2 4a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3z"/></svg></span>\n </button>\n </div>\n `}(n),Mt.appendChild(s.firstElementChild);return Mt.querySelector(".zest-widget__btn").addEventListener("click",()=>{t.onClick?.()}),document.body.appendChild(Lt),Lt}function Tt(t={}){Lt?Lt.style.display="":Rt(t)}function Dt(){Lt&&(Lt.style.display="none")}function qt(){gt();const t=yt();At(),$t(),t?.showWidget&&Tt({onClick:It})}function Ot(){!function(){if(!lt)return null;const t=tt(dt.expiration);O(t.current,dt,!1),at(t.current),rt(t.current,t.previous),i(dt.callbacks?.onReject),i(dt.callbacks?.onChange,t.current)}();const t=yt();At(),$t(),t?.showWidget&&Tt({onClick:It})}function Wt(t){!function(t){if(!lt)return null;const e=K(t,dt.expiration);O(e.current,dt,!1);const n=Object.keys(e.current).filter(t=>e.current[t]&&!e.previous[t]);n.length>0&&pt(n),Object.entries(t||{}).some(([t,e])=>"essential"!==t&&e)?st(e.current,e.previous):at(e.current),rt(e.current,e.previous),i(dt.callbacks?.onChange,e.current)}(t);const e=yt();$t(),e?.showWidget&&Tt({onClick:It})}function It(){At(),Dt(),function(t={},e={}){if(Ct)return Ct;const n=Y();jt={...t},Ct=document.createElement("zest-modal"),Ct.setAttribute("data-theme",n.theme||"light"),St=Ct.attachShadow({mode:"open"});const o=document.createElement("style");o.textContent=zt(n),St.appendChild(o);const s=document.createElement("div");s.innerHTML=Et(n,t),St.appendChild(s.firstElementChild);const a=St.querySelector(".zest-modal-overlay");a.addEventListener("click",t=>{const n=t.target.dataset.action;if(n)switch(n){case"save":e.onSave?.(Nt());break;case"accept-all":e.onAcceptAll?.();break;case"reject-all":e.onRejectAll?.()}else t.target===a&&e.onClose?.()}),a.addEventListener("keydown",t=>{"Escape"===t.key&&e.onClose?.()}),St.querySelectorAll(".zest-toggle__input").forEach(t=>{t.addEventListener("change",()=>{jt=Nt()})}),document.body.appendChild(Ct),requestAnimationFrame(()=>{const t=St.querySelector("button");t?.focus()})}(V(),{onSave:Wt,onAcceptAll:qt,onRejectAll:Ot,onClose:Pt}),it("modal")}function Pt(){$t(),ct("modal");const t=yt();et()&&t?.showWidget?Tt({onClick:It}):_t({onAcceptAll:qt,onRejectAll:Ot,onSettings:It})}function Ut(t={}){const{alreadyInitialized:e,hasDecision:n,dntApplied:o}=ft(t);if(e)return console.warn("[Zest] Already initialized"),Zt;const s=yt();return n||o?s?.showWidget&&Tt({onClick:It}):(_t({onAcceptAll:qt,onRejectAll:Ot,onSettings:It}),it("banner")),Zt}const Zt={init:Ut,show(){bt()?($t(),Dt(),_t({onAcceptAll:qt,onRejectAll:Ot,onSettings:It}),it("banner")):console.warn("[Zest] Not initialized. Call Zest.init() first.")},hide(){At(),ct("banner")},showSettings(){bt()?It():console.warn("[Zest] Not initialized. Call Zest.init() first.")},hideSettings(){$t(),ct("modal")},getConsent:V,hasConsent:Q,hasConsentDecision:et,getConsentProof:function(){try{const t=J().match(RegExp(H+"=([^;]+)"));if(t){return r(JSON.parse(decodeURIComponent(t[1])),D())}}catch(t){}return null},isDoNotTrackEnabled:q,getDNTDetails:function(){if("undefined"==typeof navigator)return{enabled:!1,source:null};const t=navigator.doNotTrack||window.doNotTrack||navigator.msDoNotTrack;return"1"===t||"yes"===t||!0===t?{enabled:!0,source:"dnt"}:!0===navigator.globalPrivacyControl?{enabled:!0,source:"gpc"}:{enabled:!1,source:null}},acceptAll(){bt()?qt():console.warn("[Zest] Not initialized. Call Zest.init() first.")},rejectAll(){bt()?Ot():console.warn("[Zest] Not initialized. Call Zest.init() first.")},reset(){mt(),$t(),Lt&&(Lt.remove(),Lt=null,Mt=null),bt()&&(_t({onAcceptAll:qt,onRejectAll:Ot,onSettings:It}),it("banner"))},getConfig:Y,on:function(t,e){return document.addEventListener(t,e),()=>document.removeEventListener(t,e)},once:function(t,e){document.addEventListener(t,e,{once:!0})},EVENTS:nt};if("undefined"!=typeof window){try{Object.defineProperty(window,"Zest",{value:Object.freeze(Zt),writable:!1,configurable:!1,enumerable:!0})}catch(t){window.Zest=Zt}const t=()=>{!1!==U().autoInit&&Ut(window.ZestConfig)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",t):t()}return Zt}();
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for `@freshjuice/zest/headless`.
|
|
3
|
+
*
|
|
4
|
+
* The headless build ships the consent engine without any UI: no Shadow
|
|
5
|
+
* DOM, no styles, no DOM mounting. You bring your own banner / modal /
|
|
6
|
+
* settings markup and call into Zest for the consent state.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import Zest from '@freshjuice/zest/headless';
|
|
11
|
+
*
|
|
12
|
+
* Zest.init({ respectDNT: true, expiration: 365 });
|
|
13
|
+
*
|
|
14
|
+
* if (!Zest.hasConsentDecision()) myBanner.show();
|
|
15
|
+
*
|
|
16
|
+
* acceptBtn.addEventListener('click', () => Zest.acceptAll());
|
|
17
|
+
* rejectBtn.addEventListener('click', () => Zest.rejectAll());
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** Built-in consent categories. */
|
|
22
|
+
export type ConsentCategory =
|
|
23
|
+
| 'essential'
|
|
24
|
+
| 'functional'
|
|
25
|
+
| 'analytics'
|
|
26
|
+
| 'marketing';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Per-category boolean consent state. `essential` is always `true` —
|
|
30
|
+
* consent for it cannot be revoked because it covers strictly-necessary
|
|
31
|
+
* processing.
|
|
32
|
+
*/
|
|
33
|
+
export type ConsentState =
|
|
34
|
+
& Partial<Record<ConsentCategory, boolean>>
|
|
35
|
+
& { essential: true };
|
|
36
|
+
|
|
37
|
+
/** Snapshot returned by `init()`. */
|
|
38
|
+
export interface InitSnapshot {
|
|
39
|
+
consent: ConsentState;
|
|
40
|
+
hasDecision: boolean;
|
|
41
|
+
dntApplied: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Tamper-evident proof of the user's last consent decision. */
|
|
45
|
+
export interface ConsentProof {
|
|
46
|
+
version: string;
|
|
47
|
+
timestamp: number;
|
|
48
|
+
categories: ConsentState;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Output of `getDNTDetails()`. */
|
|
52
|
+
export interface DNTDetails {
|
|
53
|
+
dnt: boolean;
|
|
54
|
+
gpc: boolean;
|
|
55
|
+
doNotTrack: string | null;
|
|
56
|
+
globalPrivacyControl: boolean;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Behaviour when DNT / GPC is detected at init time. */
|
|
60
|
+
export type DNTBehavior = 'reject' | 'preselect' | 'ignore';
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Optional consumer callbacks. Each is wrapped in a try/catch internally
|
|
64
|
+
* so a thrown error never breaks the consent pipeline.
|
|
65
|
+
*/
|
|
66
|
+
export interface ZestCallbacks {
|
|
67
|
+
onAccept?: (consent: ConsentState) => void;
|
|
68
|
+
onReject?: (consent: ConsentState) => void;
|
|
69
|
+
onChange?: (consent: ConsentState) => void;
|
|
70
|
+
onReady?: (consent: ConsentState) => void;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Configuration accepted by `init()`. */
|
|
74
|
+
export interface InitOptions {
|
|
75
|
+
/** Respect Do Not Track / Global Privacy Control. Default `true`. */
|
|
76
|
+
respectDNT?: boolean;
|
|
77
|
+
/** What to do when DNT/GPC is on. Default `'reject'`. */
|
|
78
|
+
dntBehavior?: DNTBehavior;
|
|
79
|
+
/** Cookie expiration in days. Default `365`. */
|
|
80
|
+
expiration?: number;
|
|
81
|
+
/** Consumer callbacks. */
|
|
82
|
+
callbacks?: ZestCallbacks;
|
|
83
|
+
/** Anything else — Zest tolerates unknown keys at runtime. */
|
|
84
|
+
[key: string]: unknown;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Event names emitted on the `window` `document.documentElement`. */
|
|
88
|
+
export interface ZestEvents {
|
|
89
|
+
READY: 'zest:ready';
|
|
90
|
+
CONSENT: 'zest:consent';
|
|
91
|
+
REJECT: 'zest:reject';
|
|
92
|
+
CHANGE: 'zest:change';
|
|
93
|
+
SHOW: 'zest:show';
|
|
94
|
+
HIDE: 'zest:hide';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type ZestEventName = ZestEvents[keyof ZestEvents];
|
|
98
|
+
|
|
99
|
+
/** Detail payload of the consent-change event. */
|
|
100
|
+
export interface ZestEventDetail {
|
|
101
|
+
consent: ConsentState;
|
|
102
|
+
previous?: ConsentState;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare const Zest: {
|
|
106
|
+
/** Initialise the consent engine. Must be called before any other API. */
|
|
107
|
+
init(options?: InitOptions): InitSnapshot;
|
|
108
|
+
|
|
109
|
+
/** Current consent state (clone, safe to mutate). */
|
|
110
|
+
getConsent(): ConsentState;
|
|
111
|
+
|
|
112
|
+
/** Has the user granted consent for `category`? */
|
|
113
|
+
hasConsent(category: ConsentCategory): boolean;
|
|
114
|
+
|
|
115
|
+
/** Has the user made any consent decision yet (accept, reject, or
|
|
116
|
+
* partial)? */
|
|
117
|
+
hasConsentDecision(): boolean;
|
|
118
|
+
|
|
119
|
+
/** Tamper-evident snapshot of the last consent decision. */
|
|
120
|
+
getConsentProof(): ConsentProof | null;
|
|
121
|
+
|
|
122
|
+
/** Grant consent for every category. */
|
|
123
|
+
acceptAll(): ConsentState | null;
|
|
124
|
+
|
|
125
|
+
/** Revoke consent for every non-essential category. */
|
|
126
|
+
rejectAll(): ConsentState | null;
|
|
127
|
+
|
|
128
|
+
/** Set per-category consent. Missing keys are left untouched. */
|
|
129
|
+
updateConsent(
|
|
130
|
+
selections: Partial<Record<ConsentCategory, boolean>>
|
|
131
|
+
): ConsentState | null;
|
|
132
|
+
|
|
133
|
+
/** Wipe all consent state. Useful for "I changed my mind" flows. */
|
|
134
|
+
reset(): void;
|
|
135
|
+
|
|
136
|
+
/** True if the browser is sending DNT or GPC. */
|
|
137
|
+
isDoNotTrackEnabled(): boolean;
|
|
138
|
+
|
|
139
|
+
/** Why `isDoNotTrackEnabled()` returned what it did. */
|
|
140
|
+
getDNTDetails(): DNTDetails;
|
|
141
|
+
|
|
142
|
+
/** Subscribe to a consent event. Returns an unsubscribe function. */
|
|
143
|
+
on(
|
|
144
|
+
eventName: ZestEventName,
|
|
145
|
+
handler: (event: CustomEvent<ZestEventDetail>) => void
|
|
146
|
+
): () => void;
|
|
147
|
+
|
|
148
|
+
/** Subscribe once; auto-unsubscribes after the first call. */
|
|
149
|
+
once(
|
|
150
|
+
eventName: ZestEventName,
|
|
151
|
+
handler: (event: CustomEvent<ZestEventDetail>) => void
|
|
152
|
+
): () => void;
|
|
153
|
+
|
|
154
|
+
/** Constants for `on()` / `once()`. */
|
|
155
|
+
EVENTS: ZestEvents;
|
|
156
|
+
|
|
157
|
+
/** Active configuration after `init()`. */
|
|
158
|
+
getConfig(): InitOptions | null;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export default Zest;
|
|
162
|
+
|
|
163
|
+
// Named tree-shake-friendly exports.
|
|
164
|
+
export const init: typeof Zest.init;
|
|
165
|
+
export const acceptAll: typeof Zest.acceptAll;
|
|
166
|
+
export const rejectAll: typeof Zest.rejectAll;
|
|
167
|
+
export const updateConsent: typeof Zest.updateConsent;
|
|
168
|
+
export const reset: typeof Zest.reset;
|
|
169
|
+
export const getConsent: typeof Zest.getConsent;
|
|
170
|
+
export const hasConsent: typeof Zest.hasConsent;
|
|
171
|
+
export const hasConsentDecision: typeof Zest.hasConsentDecision;
|
|
172
|
+
export const getConsentProof: typeof Zest.getConsentProof;
|
|
173
|
+
export const isDoNotTrackEnabled: typeof Zest.isDoNotTrackEnabled;
|
|
174
|
+
export const getDNTDetails: typeof Zest.getDNTDetails;
|
|
175
|
+
export const on: typeof Zest.on;
|
|
176
|
+
export const once: typeof Zest.once;
|
|
177
|
+
export const EVENTS: ZestEvents;
|
|
178
|
+
export const getConfig: typeof Zest.getConfig;
|