Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stormid/cookie-banner

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stormid/cookie-banner - npm Package Compare versions

Comparing version 1.0.0-alpha.29 to 1.0.0-alpha.30

2

dist/index.js

@@ -1,2 +0,2 @@

var e=["button","a"],t=["a[href]","area[href]","input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex="-1"])'],n={ec:"Banner",ea:"Displays",cm1:1},s={ec:"Save preferences",ea:"Banner",cm2:1,cm3:1},i={ec:"Banner",ea:"Clicks",el:"Edit preferences",cm4:1},r={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},a={ec:"Save preferences",ea:"CookiePrefs"},c=function(e){document.cookie=[e.settings.name+"="+btoa(JSON.stringify({consent:e.consent,cid:e.persistentMeasurementParams.cid}))+";","expires="+new Date((new Date).getTime()+24*e.settings.expiry*60*60*1e3).toGMTString()+";",e.settings.path?"path="+e.settings.path+";":"",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")},o=function(e){document.cookie.split("; ").map(function(e){return{name:e.split("=")[0],value:e.split("=")[1],expiry:"Thu, 01 Jan 1970 00:00:01 GMT"}}).map(function(e){return function(t){return document.cookie=[t.name+"="+t.value+";","expires="+t.expiry+";","path="+e.settings.path+";",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")}}(e))},l=function(e){return function(t,n){return t[n]=t[n]?Object.assign({},t[n],{fns:t[n].fns.concat(e.types[n].fns)}):e.types[n],t}},u=function(){},d=function(e){return/radio|checkbox/i.test(e.type)},m=function(e,t){return!d(t)&&function(e){return null!=e.value&&e.value.length>0}(t)&&(e=t.value),d(t)&&t.checked&&(Array.isArray(e)?e.push(t.value):e=[t.value]),e},p="ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|be|bf|bg|bh|bi|bj|bm|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|cl|cm|cn|co|cr|cu|cv|cw|cx|cz|de|dj|dk|dm|do|dz|ec|ee|eg|es|et|eu|fi|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|im|in|io|iq|ir|is|it|je|jo|jp|kg|ki|km|kn|kp|kr|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|na|nc|ne|nf|ng|nl|no|nr|nu|nz|om|pa|pe|pf|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|yt".split("|"),f="netlify|azurewebsites|com|edu|gov|net|mil|org|nom|sch|caa|res|off|gob|int|tur|ip6|uri|urn|asn|act|nsw|qld|tas|vic|pro|biz|adm|adv|agr|arq|art|ato|bio|bmd|cim|cng|cnt|ecn|eco|emp|eng|esp|etc|eti|far|fnd|fot|fst|g12|ggf|imb|ind|inf|jor|jus|leg|lel|mat|med|mus|not|ntr|odo|ppg|psc|psi|qsl|rec|slg|srv|teo|tmp|trd|vet|zlg|web|ltd|sld|pol|fin|k12|lib|pri|aip|fie|eun|sci|prd|cci|pvt|mod|idv|rel|sex|gen|nic|abr|bas|cal|cam|emr|fvg|laz|lig|lom|mar|mol|pmn|pug|sar|sic|taa|tos|umb|vao|vda|ven|mie|北海道|和歌山|神奈川|鹿児島|ass|rep|tra|per|ngo|soc|grp|plc|its|air|and|bus|can|ddr|jfk|mad|nrw|nyc|ski|spy|tcm|ulm|usa|war|fhs|vgs|dep|eid|fet|fla|flå|gol|hof|hol|sel|vik|cri|iwi|ing|abo|fam|gok|gon|gop|gos|aid|atm|gsm|sos|elk|waw|est|aca|bar|cpa|jur|law|sec|plo|www|bir|cbg|jar|khv|msk|nov|nsk|ptz|rnd|spb|stv|tom|tsk|udm|vrn|cmw|kms|nkz|snz|pub|fhv|red|ens|nat|rns|rnu|bbs|tel|bel|kep|nhs|dni|fed|isa|nsn|gub|e12|tec|орг|обр|упр|alt|nis|jpn|mex|ath|iki|nid|gda|inc".split("|"),g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},b=function(e){return[].slice.call(e.querySelectorAll(t.join(","))).filter(function(e){return e.offsetWidth>0||e.offsetHeight>0})},v=function(e,t){return function(){var n=new CustomEvent(e,{bubbles:!0,detail:{getState:t.getState}});window.document.dispatchEvent(n)}},y=function(){[].slice.call(document.querySelectorAll("[data-iframe-src]")).forEach(function(e){var t=document.createElement("iframe");t.src=e.getAttribute("data-iframe-src"),e.hasAttribute("data-iframe-height")&&(t.style.height=e.getAttribute("data-iframe-height")),t.setAttribute("title",e.getAttribute("data-iframe-title")||"iFrame embed"),e.hasAttribute("data-iframe-width")&&(t.style.width=e.getAttribute("data-iframe-width")),t.setAttribute("tabindex","0"),t.setAttribute("frameborder","0"),t.setAttribute("webkitallowfullscreen","webkitallowfullscreen"),t.setAttribute("mozallowfullscreen","mozallowfullscreen"),t.setAttribute("allowfullscreen","allowfullscreen"),e.parentNode.appendChild(t),e.parentNode.removeChild(e)})},h=function(e){!function(e,t,n,s,i,r){e[s]=e[s]||[],e[s].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var a=t.getElementsByTagName(n)[0],c=t.createElement(n);c.async=!0,c.src="https://www.googletagmanager.com/gtm.js?id="+i,a.parentNode.insertBefore(c,a)}(window,document,"script","dataLayer",e)},w={name:".CookiePreferences",path:"/",domain:"localhost"===window.location.hostname?"":"."+function(e){for(var t=(e=e.replace(/^www\./,"")).split(".");t.length>3;)t.shift();return 3===t.length&&-1===f.indexOf(t[1])&&-1===p.indexOf(t[2])&&t.shift(),t.join(".")}(window.location.hostname),secure:!0,samesite:"strict",expiry:365,types:{},necessary:[],policyURL:"/cookie-policy/#preferences",classNames:{banner:"privacy-banner",acceptBtn:"privacy-banner__accept",rejectBtn:"privacy-banner__reject",submitBtn:"privacy-banner__submit",optionsBtn:"privacy-banner__options",field:"privacy-banner__field",form:"privacy-banner__form",fieldset:"privacy-banner__fieldset",legend:"privacy-banner__legend",formContainer:"privacy-banner__form-container",formMessage:"privacy-banner__form-msg",formAnnouncement:"privacy-banner__form-announcement",title:"privacy-banner__form-title",description:"privacy-banner__form-description",bannerToggle:"on--privacy-banner-toggle",bannerToggleTrigger:"js-toggle-btn"},hideBannerOnFormPage:!0,trapTab:!1,savedMessage:"Your settings have been saved.",bannerTemplate:function(e){return'<section role="dialog" aria-live="polite" aria-label="Your privacy" class="'+e.classNames.banner+'">\n <div class="privacy-content">\n <div class="wrap">\n \x3c!--googleoff: all--\x3e\n <div class="privacy-banner__title">Cookies</div>\n <p>We use cookies to improve your experience on our site and show you personalised advertising.</p>\n <p>Find out more from our <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="/privacy-policy">privacy policy</a> and <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">cookie policy</a>.</p>\n <button type="button" class="btn btn--primary '+e.classNames.acceptBtn+'">Accept all</button>\n <button type="button" class="btn btn--primary '+e.classNames.rejectBtn+'">Reject all</button>\n <a class="privacy-banner__link '+e.classNames.optionsBtn+'" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">Your options</a>\n \x3c!--googleon: all--\x3e\n </div>\n </div>\n </section>'},messageTemplate:function(e){return'<div class="'+e.settings.classNames.formMessage+'" aria-hidden="true">'+e.settings.savedMessage+"</div>"},formTemplate:function(e){return'<form id="preferences" class="'+e.settings.classNames.form+'" novalidate>\n '+Object.keys(e.settings.types).map(function(t){return'<fieldset class="'+e.settings.classNames.fieldset+'">\n <legend class="'+e.settings.classNames.legend+'">\n <span class="'+e.settings.classNames.title+'">'+e.settings.types[t].title+'</span>\n <span class="'+e.settings.classNames.description+'">'+e.settings.types[t].description+'</span>\n </legend>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+t.split(" ")[0].replace(" ","-")+'"\n value="1"\n '+(1===e.consent[t]?"checked":"")+'>\n <span class="privacy-banner__label-text">I am OK with this</span>\n <span class="privacy-banner__label-description">'+e.settings.types[t].labels.yes+'</span>\n </label> \n </div>\n </div>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+t.split(" ")[0].replace(" ","-")+'"\n value="0"\n '+(0===e.consent[t]?"checked":"")+'>\n <span class="privacy-banner__label-text">No thank you</span>\n <span class="privacy-banner__label-description">'+e.settings.types[t].labels.no+"</span>\n </label> \n </div>\n </div>\n </fieldset>"}).join("")+'\n <button class="'+e.settings.classNames.submitBtn+'"'+(Object.keys(e.consent).length!==Object.keys(e.settings.types).length?" disabled":"")+">Save my settings</button>\n </form>"}};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},k.apply(this,arguments)}var x=function(e,t){return t},j=function(e,t){return Object.assign({},e,{bannerOpen:t})},_=function(e,t){return Object.assign({},e,{banner:t})},O=function(e,t){return Object.assign({},e,{consent:Object.assign({},e.consent,t)})},S=function(e,t){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,t)})})},N=function(e){return function(t){!function(e){Object.keys(e.consent).forEach(function(t){e.settings.types[t]&&!0!==e.settings.types[t].executed&&e.consent[t]&&Boolean(e.consent[t])&&e.settings.types[t].fns&&e.settings.types[t].fns.forEach(function(t){return t(e)})})}(t),e.update(S,Object.keys(t.settings.types).reduce(function(e,n){return e[n]=Object.assign({},t.settings.types[n],{executed:t.settings.types[n].executed||t.consent[n]&&Boolean(t.consent[n])}),e},{}))}},A=function(e){e.settings.necessary.forEach(function(t){return t(e)})},E=function(e,t){return{tid:t,v:1,t:"event",ds:"cookiebanner",dh:location.hostname,uip:"0.0.0.0",sr:window.screen?window.screen.width+"x"+window.screen.height:null,vp:document.documentElement.clientWidth+"x"+document.documentElement.clientHeight,cid:e,cd1:e,cd3:location.hostname,cd4:"consentAPI"}},T=function(e){return Object.keys(e).filter(function(t){return e[t]}).join(",")},B=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},C=function(e,t,n){return void 0===n&&(n="collect"),function(e){if(!navigator.sendBeacon){var t=document.createElement("img");return t.width=1,t.height=1,t.src=e,t}navigator.sendBeacon(e)}(function(e,t){return"https://www.google-analytics.com/"+t+"?"+function(e){return Object.keys(e).reduce(function(t,n){return null!==e[n]&&t.push(n+"="+encodeURIComponent(e[n])),t},[]).join("&")}(e)}(k({},e.persistentMeasurementParams,t,e.settings.debug?{}:{z:B()}),n))},q=function(e){return function(){var t=e.getState();t.bannerOpen||t.settings.hideBannerOnFormPage&&document.querySelector("."+t.settings.classNames.formContainer)||(document.body.firstElementChild.insertAdjacentHTML("beforebegin",t.settings.bannerTemplate(t.settings)),t.settings.tid&&C(t,n),e.update(_,document.querySelector("."+t.settings.classNames.banner)),e.update(j,!0,[v("banner.show",e)]))}},z=function(t){return function(){var n=t.getState();if(n.banner){var r=function(t){return e.map(function(e){return e+"."+t}).join(", ")},o=[].slice.call(document.querySelectorAll(r(n.settings.classNames.acceptBtn))),l=[].slice.call(document.querySelectorAll(r(n.settings.classNames.rejectBtn))),u=document.querySelector(r(n.settings.classNames.optionsBtn));n.settings.trapTab&&document.addEventListener("keydown",n.keyListener),o.forEach(function(e){e.addEventListener("click",function(e){t.update(O,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=1,e},{}),[c,N(t),M(t),P(t,!1),v("banner.consent",t),function(e){e.settings.tid&&C(e,k({},s,{cd2:T(t.getState().consent)}))}])})}),l.forEach(function(e){e.addEventListener("click",function(e){t.update(O,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=0,e},{}),[c,N(t),M(t),P(t,!1),v("banner.consent",t),function(e){e.settings.tid&&C(e,k({},a,{cd2:T(t.getState().consent)}))}])})}),u&&n.settings.tid?u.addEventListener("click",function(e){return C(n,i)}):console.warn("No trigger added for options element. Check that the element is a Button or Anchor and that your tid is set.")}}},L=function(e){return function(t){var n;e.getState().banner&&9===t.keyCode&&(n=e.getState(),function(e){var t=b(n.banner),s=t.indexOf(document.activeElement);e.shiftKey&&0===s?(e.preventDefault(),t[t.length-1].focus()):e.shiftKey||s!==t.length-1||(e.preventDefault(),t[0].focus())})(t)}},M=function(e){return function(){var t=e.getState(),n=t.banner;n&&n.parentNode&&(n.parentNode.removeChild(n),e.update(j,!1,[v("banner.hide",e)])),t.settings.trapTab&&document.removeEventListener("keydown",t.keyListener)}},P=function(e,t){return void 0===t&&(t=!0),function(){var n=e.getState(),s=document.querySelector("."+n.settings.classNames.formContainer);if(s){s.innerHTML=n.settings.formTemplate(function(e){return Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce(function(t,n){return e.settings.types[n].suggested&&(t[n]=1),t},{})})}(n)),n.settings.tid&&t&&C(n,r);var i=document.querySelector("."+n.settings.classNames.form),l=document.querySelector("."+n.settings.classNames.submitBtn),u=[].slice.call(document.querySelectorAll("."+n.settings.classNames.field)).reduce(function(e,t){var n=t.getAttribute("name").replace("privacy-","");return e[n]?e[n].push(t):e[n]=[t],e},{}),d=document.querySelector("."+n.settings.classNames.formAnnouncement)||document.body.appendChild(Object.assign(document.createElement("div"),{className:n.settings.classNames.formAnnouncement,role:"alert"})),p=function(){return Object.keys(u).reduce(function(e,t){var n=u[t].reduce(m,"");return n&&(e[t]=parseInt(n,10)),e},{})};l.hasAttribute("disabled")&&i.addEventListener("change",function e(t){Object.keys(p()).length===Object.keys(u).length&&(l.removeAttribute("disabled"),i.removeEventListener("change",e))}),i.addEventListener("submit",function(t){t.preventDefault(),e.update(O,p(),[o,c,N(e),M(e),v("banner.consent",e),D(l),R(d),function(e){if(e.settings.tid){var t=T(e.consent);C(e,k({},a,{cd2:""===t?"None":t,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])}),window.location.hash.substring(1)===i.id&&window.scrollTo(0,i.getBoundingClientRect().top+window.scrollY)}}},D=function(e){return function(t){e.insertAdjacentHTML("afterend",t.settings.messageTemplate(t)),e.setAttribute("disabled","disabled"),window.setTimeout(function(){e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)}},R=function(e){return function(t){e.textContent=t.settings.savedMessage,window.setTimeout(function(){e.textContent=""},3e3)}};module.exports=function(e){return function(e){if(function(){try{document.cookie="cookietest=1";var e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}}()){var t,n=(t={},{update:function(e,n,s){t=e(t,n),s&&s.forEach(function(e){return e(t)})},getState:function(){return t}});e.tid||console.warn("The tid setting is missing. A tid is required for banner measurements.");var s=function(e){try{var t=function(e){for(var t=document.cookie.split("; "),n=0;n<=t.length;n++){if(!t[n])return!1;var s=t[n].split("=");if(s[0]===e.name)return window.atob(s[1])}return!1}(e);if(!t)return[!1,g(),{}];var n=JSON.parse(t),s=n.consent;return[void 0!==s,n.cid||g(),s||{}]}catch(e){return[!1,g(),{}]}}(e),i=s[0],r=s[1],a=s[2];return n.update(x,{settings:e,bannerOpen:!1,keyListener:L(n),persistentMeasurementParams:!!e.tid&&E(r,e.tid),consent:a,utils:{renderIframe:y,gtmSnippet:h}},[A,N(n),i?u:q(n),P(n),z(n)]),{getState:n.getState,showBanner:function(e){!function(e){return function(t){if(q(e)(),e.getState().bannerOpen){P(e)();var n=b(document.body.firstElementChild);n.length>0&&n[0].focus(),t&&t.call&&t(e.getState())}}}(n)(e),z(n)()},renderForm:P(n)}}}(Object.assign({},w,e,{types:Object.keys(e.types).reduce(l(e),w.types)}))};
var e=["button","a"],t=["a[href]","area[href]","input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex="-1"])'],n={ec:"Banner",ea:"Displays",cm1:1},s={ec:"Save preferences",ea:"Banner",cm2:1,cm3:1},i={ec:"Banner",ea:"Clicks",el:"Edit preferences",cm4:1},r={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},a={ec:"Save preferences",ea:"CookiePrefs"},c=function(e){document.cookie=[e.settings.name+"="+btoa(JSON.stringify({consent:e.consent,cid:e.persistentMeasurementParams.cid}))+";","expires="+new Date((new Date).getTime()+24*e.settings.expiry*60*60*1e3).toGMTString()+";",e.settings.path?"path="+e.settings.path+";":"",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")},o=function(e){document.cookie.split("; ").map(function(e){return{name:e.split("=")[0],value:e.split("=")[1],expiry:"Thu, 01 Jan 1970 00:00:01 GMT"}}).map(function(e){return function(t){return document.cookie=[t.name+"="+t.value+";","expires="+t.expiry+";","path="+e.settings.path+";",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")}}(e))},l=function(e){return function(t,n){return t[n]=t[n]?Object.assign({},t[n],{fns:t[n].fns.concat(e.types[n].fns)}):e.types[n],t}},u=function(){},d=function(e){return/radio|checkbox/i.test(e.type)},m=function(e,t){return!d(t)&&function(e){return null!=e.value&&e.value.length>0}(t)&&(e=t.value),d(t)&&t.checked&&(Array.isArray(e)?e.push(t.value):e=[t.value]),e},p="ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|be|bf|bg|bh|bi|bj|bm|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|cl|cm|cn|co|cr|cu|cv|cw|cx|cz|de|dj|dk|dm|do|dz|ec|ee|eg|es|et|eu|fi|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|im|in|io|iq|ir|is|it|je|jo|jp|kg|ki|km|kn|kp|kr|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|na|nc|ne|nf|ng|nl|no|nr|nu|nz|om|pa|pe|pf|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|yt".split("|"),f="netlify|azurewebsites|com|edu|gov|net|mil|org|nom|sch|caa|res|off|gob|int|tur|ip6|uri|urn|asn|act|nsw|qld|tas|vic|pro|biz|adm|adv|agr|arq|art|ato|bio|bmd|cim|cng|cnt|ecn|eco|emp|eng|esp|etc|eti|far|fnd|fot|fst|g12|ggf|imb|ind|inf|jor|jus|leg|lel|mat|med|mus|not|ntr|odo|ppg|psc|psi|qsl|rec|slg|srv|teo|tmp|trd|vet|zlg|web|ltd|sld|pol|fin|k12|lib|pri|aip|fie|eun|sci|prd|cci|pvt|mod|idv|rel|sex|gen|nic|abr|bas|cal|cam|emr|fvg|laz|lig|lom|mar|mol|pmn|pug|sar|sic|taa|tos|umb|vao|vda|ven|mie|北海道|和歌山|神奈川|鹿児島|ass|rep|tra|per|ngo|soc|grp|plc|its|air|and|bus|can|ddr|jfk|mad|nrw|nyc|ski|spy|tcm|ulm|usa|war|fhs|vgs|dep|eid|fet|fla|flå|gol|hof|hol|sel|vik|cri|iwi|ing|abo|fam|gok|gon|gop|gos|aid|atm|gsm|sos|elk|waw|est|aca|bar|cpa|jur|law|sec|plo|www|bir|cbg|jar|khv|msk|nov|nsk|ptz|rnd|spb|stv|tom|tsk|udm|vrn|cmw|kms|nkz|snz|pub|fhv|red|ens|nat|rns|rnu|bbs|tel|bel|kep|nhs|dni|fed|isa|nsn|gub|e12|tec|орг|обр|упр|alt|nis|jpn|mex|ath|iki|nid|gda|inc".split("|"),g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},b=function(e){return[].slice.call(e.querySelectorAll(t.join(","))).filter(function(e){return e.offsetWidth>0||e.offsetHeight>0})},v=function(e,t){return function(){var n=new CustomEvent(e,{bubbles:!0,detail:{getState:t.getState}});window.document.dispatchEvent(n)}},y=function(){[].slice.call(document.querySelectorAll("[data-iframe-src]")).forEach(function(e){var t=document.createElement("iframe");t.src=e.getAttribute("data-iframe-src"),e.hasAttribute("data-iframe-height")&&(t.style.height=e.getAttribute("data-iframe-height")),t.setAttribute("title",e.getAttribute("data-iframe-title")||"iFrame embed"),e.hasAttribute("data-iframe-width")&&(t.style.width=e.getAttribute("data-iframe-width")),t.setAttribute("tabindex","0"),t.setAttribute("frameborder","0"),t.setAttribute("webkitallowfullscreen","webkitallowfullscreen"),t.setAttribute("mozallowfullscreen","mozallowfullscreen"),t.setAttribute("allowfullscreen","allowfullscreen"),e.parentNode.appendChild(t),e.parentNode.removeChild(e)})},h=function(e){!function(e,t,n,s,i,r){e[s]=e[s]||[],e[s].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var a=t.getElementsByTagName(n)[0],c=t.createElement(n);c.async=!0,c.src="https://www.googletagmanager.com/gtm.js?id="+i,a.parentNode.insertBefore(c,a)}(window,document,"script","dataLayer",e)},w={name:".CookiePreferences",path:"/",domain:"localhost"===window.location.hostname?"":"."+function(e){for(var t=(e=e.replace(/^www\./,"")).split(".");t.length>3;)t.shift();return 3===t.length&&-1===f.indexOf(t[1])&&-1===p.indexOf(t[2])&&t.shift(),t.join(".")}(window.location.hostname),secure:!0,samesite:"strict",expiry:365,types:{},necessary:[],policyURL:"/cookie-policy/#preferences",classNames:{banner:"privacy-banner",acceptBtn:"privacy-banner__accept",rejectBtn:"privacy-banner__reject",submitBtn:"privacy-banner__submit",optionsBtn:"privacy-banner__options",field:"privacy-banner__field",form:"privacy-banner__form",fieldset:"privacy-banner__fieldset",legend:"privacy-banner__legend",formContainer:"privacy-banner__form-container",formMessage:"privacy-banner__form-msg",formAnnouncement:"privacy-banner__form-announcement",title:"privacy-banner__form-title",description:"privacy-banner__form-description",bannerToggle:"on--privacy-banner-toggle",bannerToggleTrigger:"js-toggle-btn"},hideBannerOnFormPage:!0,trapTab:!1,savedMessage:"Your settings have been saved.",bannerTemplate:function(e){return'<section role="dialog" aria-live="polite" aria-label="Your privacy" class="'+e.classNames.banner+'">\n <div class="privacy-content">\n <div class="wrap">\n \x3c!--googleoff: all--\x3e\n <div class="privacy-banner__title">Cookies</div>\n <p>We use cookies to improve your experience on our site and show you personalised advertising.</p>\n <p>Find out more from our <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="/privacy-policy">privacy policy</a> and <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">cookie policy</a>.</p>\n <button type="button" class="btn btn--primary '+e.classNames.acceptBtn+'">Accept all</button>\n <button type="button" class="btn btn--primary '+e.classNames.rejectBtn+'">Reject all</button>\n <a class="privacy-banner__link '+e.classNames.optionsBtn+'" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">Your options</a>\n \x3c!--googleon: all--\x3e\n </div>\n </div>\n </section>'},messageTemplate:function(e){return'<div class="'+e.settings.classNames.formMessage+'" aria-hidden="true">'+e.settings.savedMessage+"</div>"},formTemplate:function(e){return'<form id="preferences" class="'+e.settings.classNames.form+'" novalidate>\n '+Object.keys(e.settings.types).map(function(t){return'<fieldset class="'+e.settings.classNames.fieldset+'">\n <legend class="'+e.settings.classNames.legend+'">\n <span class="'+e.settings.classNames.title+'">'+e.settings.types[t].title+'</span>\n <span class="'+e.settings.classNames.description+'">'+e.settings.types[t].description+'</span>\n </legend>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+t.split(" ")[0].replace(" ","-")+'"\n value="1"\n '+(1===e.consent[t]?"checked":"")+'>\n <span class="privacy-banner__label-text">I am OK with this</span>\n <span class="privacy-banner__label-description">'+e.settings.types[t].labels.yes+'</span>\n </label> \n </div>\n </div>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+t.split(" ")[0].replace(" ","-")+'"\n value="0"\n '+(0===e.consent[t]?"checked":"")+'>\n <span class="privacy-banner__label-text">No thank you</span>\n <span class="privacy-banner__label-description">'+e.settings.types[t].labels.no+"</span>\n </label> \n </div>\n </div>\n </fieldset>"}).join("")+'\n <button class="'+e.settings.classNames.submitBtn+'"'+(Object.keys(e.consent).length!==Object.keys(e.settings.types).length?" disabled":"")+">Save my settings</button>\n </form>"}};function k(){return k=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},k.apply(this,arguments)}var x=function(e,t){return t},j=function(e,t){return Object.assign({},e,{bannerOpen:t})},_=function(e,t){return Object.assign({},e,{banner:t})},O=function(e,t){return Object.assign({},e,{consent:Object.assign({},e.consent,t)})},S=function(e,t){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,t)})})},N=function(e){return function(t){!function(e){Object.keys(e.consent).forEach(function(t){e.settings.types[t]&&!0!==e.settings.types[t].executed&&e.consent[t]&&Boolean(e.consent[t])&&e.settings.types[t].fns&&e.settings.types[t].fns.forEach(function(t){return t(e)})})}(t),e.update(S,Object.keys(t.settings.types).reduce(function(e,n){return e[n]=Object.assign({},t.settings.types[n],{executed:t.settings.types[n].executed||t.consent[n]&&Boolean(t.consent[n])}),e},{}))}},A=function(e){e.settings.necessary.forEach(function(t){return t(e)})},E=function(e,t){return{tid:t,v:1,t:"event",ds:"cookiebanner",dh:location.hostname,uip:"0.0.0.0",sr:window.screen?window.screen.width+"x"+window.screen.height:null,vp:document.documentElement.clientWidth+"x"+document.documentElement.clientHeight,cid:e,cd1:e,cd3:location.hostname,cd4:"consentAPI"}},T=function(e){return Object.keys(e).filter(function(t){return e[t]}).join(",")},B=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},C=function(e,t,n){return void 0===n&&(n="collect"),function(e){if(!navigator.sendBeacon){var t=document.createElement("img");return t.width=1,t.height=1,t.src=e,t}navigator.sendBeacon(e)}(function(e,t){return"https://www.google-analytics.com/"+t+"?"+function(e){return Object.keys(e).reduce(function(t,n){return null!==e[n]&&t.push(n+"="+encodeURIComponent(e[n])),t},[]).join("&")}(e)}(k({},e.persistentMeasurementParams,t,e.settings.debug?{}:{z:B()}),n))},q=function(e){return function(){var t=e.getState();t.bannerOpen||t.settings.hideBannerOnFormPage&&document.querySelector("."+t.settings.classNames.formContainer)||(document.body.firstElementChild.insertAdjacentHTML("beforebegin",t.settings.bannerTemplate(t.settings)),t.settings.tid&&C(t,n),e.update(_,document.querySelector("."+t.settings.classNames.banner)),e.update(j,!0,[v("banner.show",e)]))}},z=function(t){return function(){var n=t.getState();if(n.banner){var r=function(t){return e.map(function(e){return e+"."+t}).join(", ")},o=[].slice.call(document.querySelectorAll(r(n.settings.classNames.acceptBtn))),l=[].slice.call(document.querySelectorAll(r(n.settings.classNames.rejectBtn))),u=document.querySelector(r(n.settings.classNames.optionsBtn));n.settings.trapTab&&document.addEventListener("keydown",n.keyListener),o.forEach(function(e){e.addEventListener("click",function(e){t.update(O,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=1,e},{}),[c,N(t),M(t),P(t,!1),v("banner.consent",t),function(e){e.settings.tid&&C(e,k({},s,{cd2:T(t.getState().consent)}))}])})}),l.forEach(function(e){e.addEventListener("click",function(e){t.update(O,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=0,e},{}),[c,M(t),P(t,!1),v("banner.consent",t),function(e){e.settings.tid&&C(e,k({},a,{cd2:T(t.getState().consent)}))}])})}),u&&n.settings.tid?u.addEventListener("click",function(e){return C(n,i)}):console.warn("No trigger added for options element. Check that the element is a Button or Anchor and that your tid is set.")}}},L=function(e){return function(t){var n;e.getState().banner&&9===t.keyCode&&(n=e.getState(),function(e){var t=b(n.banner),s=t.indexOf(document.activeElement);e.shiftKey&&0===s?(e.preventDefault(),t[t.length-1].focus()):e.shiftKey||s!==t.length-1||(e.preventDefault(),t[0].focus())})(t)}},M=function(e){return function(){var t=e.getState(),n=t.banner;n&&n.parentNode&&(n.parentNode.removeChild(n),e.update(j,!1,[v("banner.hide",e)])),t.settings.trapTab&&document.removeEventListener("keydown",t.keyListener)}},P=function(e,t){return void 0===t&&(t=!0),function(){var n=e.getState(),s=document.querySelector("."+n.settings.classNames.formContainer);if(s){s.innerHTML=n.settings.formTemplate(function(e){return Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce(function(t,n){return e.settings.types[n].suggested&&(t[n]=1),t},{})})}(n)),n.settings.tid&&t&&C(n,r);var i=document.querySelector("."+n.settings.classNames.form),l=document.querySelector("."+n.settings.classNames.submitBtn),u=[].slice.call(document.querySelectorAll("."+n.settings.classNames.field)).reduce(function(e,t){var n=t.getAttribute("name").replace("privacy-","");return e[n]?e[n].push(t):e[n]=[t],e},{}),d=document.querySelector("."+n.settings.classNames.formAnnouncement)||document.body.appendChild(Object.assign(document.createElement("div"),{className:n.settings.classNames.formAnnouncement,role:"alert"})),p=function(){return Object.keys(u).reduce(function(e,t){var n=u[t].reduce(m,"");return n&&(e[t]=parseInt(n,10)),e},{})};l.hasAttribute("disabled")&&i.addEventListener("change",function e(t){Object.keys(p()).length===Object.keys(u).length&&(l.removeAttribute("disabled"),i.removeEventListener("change",e))}),i.addEventListener("submit",function(t){t.preventDefault(),e.update(O,p(),[o,c,N(e),M(e),v("banner.consent",e),D(l),R(d),function(e){if(e.settings.tid){var t=T(e.consent);C(e,k({},a,{cd2:""===t?"None":t,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])}),window.location.hash.substring(1)===i.id&&window.scrollTo(0,i.getBoundingClientRect().top+window.scrollY)}}},D=function(e){return function(t){e.insertAdjacentHTML("afterend",t.settings.messageTemplate(t)),e.setAttribute("disabled","disabled"),window.setTimeout(function(){e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)}},R=function(e){return function(t){e.textContent=t.settings.savedMessage,window.setTimeout(function(){e.textContent=""},3e3)}};module.exports=function(e){return function(e){if(function(){try{document.cookie="cookietest=1";var e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}}()){var t,n=(t={},{update:function(e,n,s){t=e(t,n),s&&s.forEach(function(e){return e(t)})},getState:function(){return t}});e.tid||console.warn("The tid setting is missing. A tid is required for banner measurements.");var s=function(e){try{var t=function(e){for(var t=document.cookie.split("; "),n=0;n<=t.length;n++){if(!t[n])return!1;var s=t[n].split("=");if(s[0]===e.name)return window.atob(s[1])}return!1}(e);if(!t)return[!1,g(),{}];var n=JSON.parse(t),s=n.consent;return[void 0!==s,n.cid||g(),s||{}]}catch(e){return[!1,g(),{}]}}(e),i=s[0],r=s[1],a=s[2];return n.update(x,{settings:e,bannerOpen:!1,keyListener:L(n),persistentMeasurementParams:!!e.tid&&E(r,e.tid),consent:a,utils:{renderIframe:y,gtmSnippet:h}},[A,N(n),i?u:q(n),P(n),z(n)]),{getState:n.getState,showBanner:function(e){!function(e){return function(t){if(q(e)(),e.getState().bannerOpen){P(e)();var n=b(document.body.firstElementChild);n.length>0&&n[0].focus(),t&&t.call&&t(e.getState())}}}(n)(e),z(n)()},renderForm:P(n)}}}(Object.assign({},w,e,{types:Object.keys(e.types).reduce(l(e),w.types)}))};
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).CookieBanner=t()}(this,function(){var e=["button","a"],t=["a[href]","area[href]","input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex="-1"])'],n={ec:"Banner",ea:"Displays",cm1:1},s={ec:"Save preferences",ea:"Banner",cm2:1,cm3:1},i={ec:"Banner",ea:"Clicks",el:"Edit preferences",cm4:1},r={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},a={ec:"Save preferences",ea:"CookiePrefs"},o="banner.consent",c=function(e){document.cookie=[e.settings.name+"="+btoa(JSON.stringify({consent:e.consent,cid:e.persistentMeasurementParams.cid}))+";","expires="+new Date((new Date).getTime()+24*e.settings.expiry*60*60*1e3).toGMTString()+";",e.settings.path?"path="+e.settings.path+";":"",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")},l=function(e){document.cookie.split("; ").map(function(e){return{name:e.split("=")[0],value:e.split("=")[1],expiry:"Thu, 01 Jan 1970 00:00:01 GMT"}}).map(function(e){return function(t){return document.cookie=[t.name+"="+t.value+";","expires="+t.expiry+";","path="+e.settings.path+";",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")}}(e))},u=function(e){return function(t,n){return t[n]=t[n]?Object.assign({},t[n],{fns:t[n].fns.concat(e.types[n].fns)}):e.types[n],t}},d=function(){},m=function(e){return/radio|checkbox/i.test(e.type)},p=function(e,t){return!m(t)&&function(e){return null!=e.value&&e.value.length>0}(t)&&(e=t.value),m(t)&&t.checked&&(Array.isArray(e)?e.push(t.value):e=[t.value]),e},f="ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|be|bf|bg|bh|bi|bj|bm|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|cl|cm|cn|co|cr|cu|cv|cw|cx|cz|de|dj|dk|dm|do|dz|ec|ee|eg|es|et|eu|fi|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|im|in|io|iq|ir|is|it|je|jo|jp|kg|ki|km|kn|kp|kr|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|na|nc|ne|nf|ng|nl|no|nr|nu|nz|om|pa|pe|pf|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|yt".split("|"),g="netlify|azurewebsites|com|edu|gov|net|mil|org|nom|sch|caa|res|off|gob|int|tur|ip6|uri|urn|asn|act|nsw|qld|tas|vic|pro|biz|adm|adv|agr|arq|art|ato|bio|bmd|cim|cng|cnt|ecn|eco|emp|eng|esp|etc|eti|far|fnd|fot|fst|g12|ggf|imb|ind|inf|jor|jus|leg|lel|mat|med|mus|not|ntr|odo|ppg|psc|psi|qsl|rec|slg|srv|teo|tmp|trd|vet|zlg|web|ltd|sld|pol|fin|k12|lib|pri|aip|fie|eun|sci|prd|cci|pvt|mod|idv|rel|sex|gen|nic|abr|bas|cal|cam|emr|fvg|laz|lig|lom|mar|mol|pmn|pug|sar|sic|taa|tos|umb|vao|vda|ven|mie|北海道|和歌山|神奈川|鹿児島|ass|rep|tra|per|ngo|soc|grp|plc|its|air|and|bus|can|ddr|jfk|mad|nrw|nyc|ski|spy|tcm|ulm|usa|war|fhs|vgs|dep|eid|fet|fla|flå|gol|hof|hol|sel|vik|cri|iwi|ing|abo|fam|gok|gon|gop|gos|aid|atm|gsm|sos|elk|waw|est|aca|bar|cpa|jur|law|sec|plo|www|bir|cbg|jar|khv|msk|nov|nsk|ptz|rnd|spb|stv|tom|tsk|udm|vrn|cmw|kms|nkz|snz|pub|fhv|red|ens|nat|rns|rnu|bbs|tel|bel|kep|nhs|dni|fed|isa|nsn|gub|e12|tec|орг|обр|упр|alt|nis|jpn|mex|ath|iki|nid|gda|inc".split("|"),b=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},v=function(e){return[].slice.call(e.querySelectorAll(t.join(","))).filter(function(e){return e.offsetWidth>0||e.offsetHeight>0})},y=function(e,t){return function(){var n=new CustomEvent(e,{bubbles:!0,detail:{getState:t.getState}});window.document.dispatchEvent(n)}},h=function(){[].slice.call(document.querySelectorAll("[data-iframe-src]")).forEach(function(e){var t=document.createElement("iframe");t.src=e.getAttribute("data-iframe-src"),e.hasAttribute("data-iframe-height")&&(t.style.height=e.getAttribute("data-iframe-height")),t.setAttribute("title",e.getAttribute("data-iframe-title")||"iFrame embed"),e.hasAttribute("data-iframe-width")&&(t.style.width=e.getAttribute("data-iframe-width")),t.setAttribute("tabindex","0"),t.setAttribute("frameborder","0"),t.setAttribute("webkitallowfullscreen","webkitallowfullscreen"),t.setAttribute("mozallowfullscreen","mozallowfullscreen"),t.setAttribute("allowfullscreen","allowfullscreen"),e.parentNode.appendChild(t),e.parentNode.removeChild(e)})},w=function(e){!function(e,t,n,s,i,r){e[s]=e[s]||[],e[s].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var a=t.getElementsByTagName(n)[0],o=t.createElement(n);o.async=!0,o.src="https://www.googletagmanager.com/gtm.js?id="+i,a.parentNode.insertBefore(o,a)}(window,document,"script","dataLayer",e)},k={name:".CookiePreferences",path:"/",domain:"localhost"===window.location.hostname?"":"."+function(e){for(var t=(e=e.replace(/^www\./,"")).split(".");t.length>3;)t.shift();return 3===t.length&&-1===g.indexOf(t[1])&&-1===f.indexOf(t[2])&&t.shift(),t.join(".")}(window.location.hostname),secure:!0,samesite:"strict",expiry:365,types:{},necessary:[],policyURL:"/cookie-policy/#preferences",classNames:{banner:"privacy-banner",acceptBtn:"privacy-banner__accept",rejectBtn:"privacy-banner__reject",submitBtn:"privacy-banner__submit",optionsBtn:"privacy-banner__options",field:"privacy-banner__field",form:"privacy-banner__form",fieldset:"privacy-banner__fieldset",legend:"privacy-banner__legend",formContainer:"privacy-banner__form-container",formMessage:"privacy-banner__form-msg",formAnnouncement:"privacy-banner__form-announcement",title:"privacy-banner__form-title",description:"privacy-banner__form-description",bannerToggle:"on--privacy-banner-toggle",bannerToggleTrigger:"js-toggle-btn"},hideBannerOnFormPage:!0,trapTab:!1,savedMessage:"Your settings have been saved.",bannerTemplate:function(e){return'<section role="dialog" aria-live="polite" aria-label="Your privacy" class="'+e.classNames.banner+'">\n <div class="privacy-content">\n <div class="wrap">\n \x3c!--googleoff: all--\x3e\n <div class="privacy-banner__title">Cookies</div>\n <p>We use cookies to improve your experience on our site and show you personalised advertising.</p>\n <p>Find out more from our <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="/privacy-policy">privacy policy</a> and <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">cookie policy</a>.</p>\n <button type="button" class="btn btn--primary '+e.classNames.acceptBtn+'">Accept all</button>\n <button type="button" class="btn btn--primary '+e.classNames.rejectBtn+'">Reject all</button>\n <a class="privacy-banner__link '+e.classNames.optionsBtn+'" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">Your options</a>\n \x3c!--googleon: all--\x3e\n </div>\n </div>\n </section>'},messageTemplate:function(e){return'<div class="'+e.settings.classNames.formMessage+'" aria-hidden="true">'+e.settings.savedMessage+"</div>"},formTemplate:function(e){return'<form id="preferences" class="'+e.settings.classNames.form+'" novalidate>\n '+Object.keys(e.settings.types).map(function(t){return'<fieldset class="'+e.settings.classNames.fieldset+'">\n <legend class="'+e.settings.classNames.legend+'">\n <span class="'+e.settings.classNames.title+'">'+e.settings.types[t].title+'</span>\n <span class="'+e.settings.classNames.description+'">'+e.settings.types[t].description+'</span>\n </legend>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+t.split(" ")[0].replace(" ","-")+'"\n value="1"\n '+(1===e.consent[t]?"checked":"")+'>\n <span class="privacy-banner__label-text">I am OK with this</span>\n <span class="privacy-banner__label-description">'+e.settings.types[t].labels.yes+'</span>\n </label> \n </div>\n </div>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+t.split(" ")[0].replace(" ","-")+'"\n value="0"\n '+(0===e.consent[t]?"checked":"")+'>\n <span class="privacy-banner__label-text">No thank you</span>\n <span class="privacy-banner__label-description">'+e.settings.types[t].labels.no+"</span>\n </label> \n </div>\n </div>\n </fieldset>"}).join("")+'\n <button class="'+e.settings.classNames.submitBtn+'"'+(Object.keys(e.consent).length!==Object.keys(e.settings.types).length?" disabled":"")+">Save my settings</button>\n </form>"}};function x(){return x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},x.apply(this,arguments)}var j=function(e,t){return t},_=function(e,t){return Object.assign({},e,{bannerOpen:t})},O=function(e,t){return Object.assign({},e,{banner:t})},S=function(e,t){return Object.assign({},e,{consent:Object.assign({},e.consent,t)})},N=function(e,t){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,t)})})},A=function(e){return function(t){!function(e){Object.keys(e.consent).forEach(function(t){e.settings.types[t]&&!0!==e.settings.types[t].executed&&e.consent[t]&&Boolean(e.consent[t])&&e.settings.types[t].fns&&e.settings.types[t].fns.forEach(function(t){return t(e)})})}(t),e.update(N,Object.keys(t.settings.types).reduce(function(e,n){return e[n]=Object.assign({},t.settings.types[n],{executed:t.settings.types[n].executed||t.consent[n]&&Boolean(t.consent[n])}),e},{}))}},E=function(e){e.settings.necessary.forEach(function(t){return t(e)})},T=function(e,t){return{tid:t,v:1,t:"event",ds:"cookiebanner",dh:location.hostname,uip:"0.0.0.0",sr:window.screen?window.screen.width+"x"+window.screen.height:null,vp:document.documentElement.clientWidth+"x"+document.documentElement.clientHeight,cid:e,cd1:e,cd3:location.hostname,cd4:"consentAPI"}},B=function(e){return Object.keys(e).filter(function(t){return e[t]}).join(",")},C=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},q=function(e,t,n){return void 0===n&&(n="collect"),function(e){if(!navigator.sendBeacon){var t=document.createElement("img");return t.width=1,t.height=1,t.src=e,t}navigator.sendBeacon(e)}(function(e,t){return"https://www.google-analytics.com/"+t+"?"+function(e){return Object.keys(e).reduce(function(t,n){return null!==e[n]&&t.push(n+"="+encodeURIComponent(e[n])),t},[]).join("&")}(e)}(x({},e.persistentMeasurementParams,t,e.settings.debug?{}:{z:C()}),n))},z=function(e){return function(){var t=e.getState();t.bannerOpen||t.settings.hideBannerOnFormPage&&document.querySelector("."+t.settings.classNames.formContainer)||(document.body.firstElementChild.insertAdjacentHTML("beforebegin",t.settings.bannerTemplate(t.settings)),t.settings.tid&&q(t,n),e.update(O,document.querySelector("."+t.settings.classNames.banner)),e.update(_,!0,[y("banner.show",e)]))}},L=function(t){return function(){var n=t.getState();if(n.banner){var r=function(t){return e.map(function(e){return e+"."+t}).join(", ")},l=[].slice.call(document.querySelectorAll(r(n.settings.classNames.acceptBtn))),u=[].slice.call(document.querySelectorAll(r(n.settings.classNames.rejectBtn))),d=document.querySelector(r(n.settings.classNames.optionsBtn));n.settings.trapTab&&document.addEventListener("keydown",n.keyListener),l.forEach(function(e){e.addEventListener("click",function(e){t.update(S,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=1,e},{}),[c,A(t),P(t),D(t,!1),y(o,t),function(e){e.settings.tid&&q(e,x({},s,{cd2:B(t.getState().consent)}))}])})}),u.forEach(function(e){e.addEventListener("click",function(e){t.update(S,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=0,e},{}),[c,A(t),P(t),D(t,!1),y(o,t),function(e){e.settings.tid&&q(e,x({},a,{cd2:B(t.getState().consent)}))}])})}),d&&n.settings.tid?d.addEventListener("click",function(e){return q(n,i)}):console.warn("No trigger added for options element. Check that the element is a Button or Anchor and that your tid is set.")}}},M=function(e){return function(t){var n;e.getState().banner&&9===t.keyCode&&(n=e.getState(),function(e){var t=v(n.banner),s=t.indexOf(document.activeElement);e.shiftKey&&0===s?(e.preventDefault(),t[t.length-1].focus()):e.shiftKey||s!==t.length-1||(e.preventDefault(),t[0].focus())})(t)}},P=function(e){return function(){var t=e.getState(),n=t.banner;n&&n.parentNode&&(n.parentNode.removeChild(n),e.update(_,!1,[y("banner.hide",e)])),t.settings.trapTab&&document.removeEventListener("keydown",t.keyListener)}},D=function(e,t){return void 0===t&&(t=!0),function(){var n=e.getState(),s=document.querySelector("."+n.settings.classNames.formContainer);if(s){s.innerHTML=n.settings.formTemplate(function(e){return Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce(function(t,n){return e.settings.types[n].suggested&&(t[n]=1),t},{})})}(n)),n.settings.tid&&t&&q(n,r);var i=document.querySelector("."+n.settings.classNames.form),u=document.querySelector("."+n.settings.classNames.submitBtn),d=[].slice.call(document.querySelectorAll("."+n.settings.classNames.field)).reduce(function(e,t){var n=t.getAttribute("name").replace("privacy-","");return e[n]?e[n].push(t):e[n]=[t],e},{}),m=document.querySelector("."+n.settings.classNames.formAnnouncement)||document.body.appendChild(Object.assign(document.createElement("div"),{className:n.settings.classNames.formAnnouncement,role:"alert"})),f=function(){return Object.keys(d).reduce(function(e,t){var n=d[t].reduce(p,"");return n&&(e[t]=parseInt(n,10)),e},{})};u.hasAttribute("disabled")&&i.addEventListener("change",function e(t){Object.keys(f()).length===Object.keys(d).length&&(u.removeAttribute("disabled"),i.removeEventListener("change",e))}),i.addEventListener("submit",function(t){t.preventDefault(),e.update(S,f(),[l,c,A(e),P(e),y(o,e),R(u),F(m),function(e){if(e.settings.tid){var t=B(e.consent);q(e,x({},a,{cd2:""===t?"None":t,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])}),window.location.hash.substring(1)===i.id&&window.scrollTo(0,i.getBoundingClientRect().top+window.scrollY)}}},R=function(e){return function(t){e.insertAdjacentHTML("afterend",t.settings.messageTemplate(t)),e.setAttribute("disabled","disabled"),window.setTimeout(function(){e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)}},F=function(e){return function(t){e.textContent=t.settings.savedMessage,window.setTimeout(function(){e.textContent=""},3e3)}};return function(e){return function(e){if(function(){try{document.cookie="cookietest=1";var e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}}()){var t,n=(t={},{update:function(e,n,s){t=e(t,n),s&&s.forEach(function(e){return e(t)})},getState:function(){return t}});e.tid||console.warn("The tid setting is missing. A tid is required for banner measurements.");var s=function(e){try{var t=function(e){for(var t=document.cookie.split("; "),n=0;n<=t.length;n++){if(!t[n])return!1;var s=t[n].split("=");if(s[0]===e.name)return window.atob(s[1])}return!1}(e);if(!t)return[!1,b(),{}];var n=JSON.parse(t),s=n.consent;return[void 0!==s,n.cid||b(),s||{}]}catch(e){return[!1,b(),{}]}}(e),i=s[0],r=s[1],a=s[2];return n.update(j,{settings:e,bannerOpen:!1,keyListener:M(n),persistentMeasurementParams:!!e.tid&&T(r,e.tid),consent:a,utils:{renderIframe:h,gtmSnippet:w}},[E,A(n),i?d:z(n),D(n),L(n)]),{getState:n.getState,showBanner:function(e){!function(e){return function(t){if(z(e)(),e.getState().bannerOpen){D(e)();var n=v(document.body.firstElementChild);n.length>0&&n[0].focus(),t&&t.call&&t(e.getState())}}}(n)(e),L(n)()},renderForm:D(n)}}}(Object.assign({},k,e,{types:Object.keys(e.types).reduce(u(e),k.types)}))}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).CookieBanner=t()}(this,function(){var e=["button","a"],t=["a[href]","area[href]","input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex="-1"])'],n={ec:"Banner",ea:"Displays",cm1:1},s={ec:"Save preferences",ea:"Banner",cm2:1,cm3:1},i={ec:"Banner",ea:"Clicks",el:"Edit preferences",cm4:1},r={ec:"CookiePrefsWidget",ea:"Displays",cm5:1},a={ec:"Save preferences",ea:"CookiePrefs"},o="banner.consent",c=function(e){document.cookie=[e.settings.name+"="+btoa(JSON.stringify({consent:e.consent,cid:e.persistentMeasurementParams.cid}))+";","expires="+new Date((new Date).getTime()+24*e.settings.expiry*60*60*1e3).toGMTString()+";",e.settings.path?"path="+e.settings.path+";":"",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")},l=function(e){document.cookie.split("; ").map(function(e){return{name:e.split("=")[0],value:e.split("=")[1],expiry:"Thu, 01 Jan 1970 00:00:01 GMT"}}).map(function(e){return function(t){return document.cookie=[t.name+"="+t.value+";","expires="+t.expiry+";","path="+e.settings.path+";",e.settings.domain?"domain="+e.settings.domain+";":"",e.settings.samesite?"SameSite="+e.settings.samesite+";":"",e.settings.secure?"secure":""].join("")}}(e))},u=function(e){return function(t,n){return t[n]=t[n]?Object.assign({},t[n],{fns:t[n].fns.concat(e.types[n].fns)}):e.types[n],t}},d=function(){},m=function(e){return/radio|checkbox/i.test(e.type)},p=function(e,t){return!m(t)&&function(e){return null!=e.value&&e.value.length>0}(t)&&(e=t.value),m(t)&&t.checked&&(Array.isArray(e)?e.push(t.value):e=[t.value]),e},f="ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|be|bf|bg|bh|bi|bj|bm|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|cl|cm|cn|co|cr|cu|cv|cw|cx|cz|de|dj|dk|dm|do|dz|ec|ee|eg|es|et|eu|fi|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|im|in|io|iq|ir|is|it|je|jo|jp|kg|ki|km|kn|kp|kr|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|na|nc|ne|nf|ng|nl|no|nr|nu|nz|om|pa|pe|pf|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|yt".split("|"),g="netlify|azurewebsites|com|edu|gov|net|mil|org|nom|sch|caa|res|off|gob|int|tur|ip6|uri|urn|asn|act|nsw|qld|tas|vic|pro|biz|adm|adv|agr|arq|art|ato|bio|bmd|cim|cng|cnt|ecn|eco|emp|eng|esp|etc|eti|far|fnd|fot|fst|g12|ggf|imb|ind|inf|jor|jus|leg|lel|mat|med|mus|not|ntr|odo|ppg|psc|psi|qsl|rec|slg|srv|teo|tmp|trd|vet|zlg|web|ltd|sld|pol|fin|k12|lib|pri|aip|fie|eun|sci|prd|cci|pvt|mod|idv|rel|sex|gen|nic|abr|bas|cal|cam|emr|fvg|laz|lig|lom|mar|mol|pmn|pug|sar|sic|taa|tos|umb|vao|vda|ven|mie|北海道|和歌山|神奈川|鹿児島|ass|rep|tra|per|ngo|soc|grp|plc|its|air|and|bus|can|ddr|jfk|mad|nrw|nyc|ski|spy|tcm|ulm|usa|war|fhs|vgs|dep|eid|fet|fla|flå|gol|hof|hol|sel|vik|cri|iwi|ing|abo|fam|gok|gon|gop|gos|aid|atm|gsm|sos|elk|waw|est|aca|bar|cpa|jur|law|sec|plo|www|bir|cbg|jar|khv|msk|nov|nsk|ptz|rnd|spb|stv|tom|tsk|udm|vrn|cmw|kms|nkz|snz|pub|fhv|red|ens|nat|rns|rnu|bbs|tel|bel|kep|nhs|dni|fed|isa|nsn|gub|e12|tec|орг|обр|упр|alt|nis|jpn|mex|ath|iki|nid|gda|inc".split("|"),b=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},v=function(e){return[].slice.call(e.querySelectorAll(t.join(","))).filter(function(e){return e.offsetWidth>0||e.offsetHeight>0})},y=function(e,t){return function(){var n=new CustomEvent(e,{bubbles:!0,detail:{getState:t.getState}});window.document.dispatchEvent(n)}},h=function(){[].slice.call(document.querySelectorAll("[data-iframe-src]")).forEach(function(e){var t=document.createElement("iframe");t.src=e.getAttribute("data-iframe-src"),e.hasAttribute("data-iframe-height")&&(t.style.height=e.getAttribute("data-iframe-height")),t.setAttribute("title",e.getAttribute("data-iframe-title")||"iFrame embed"),e.hasAttribute("data-iframe-width")&&(t.style.width=e.getAttribute("data-iframe-width")),t.setAttribute("tabindex","0"),t.setAttribute("frameborder","0"),t.setAttribute("webkitallowfullscreen","webkitallowfullscreen"),t.setAttribute("mozallowfullscreen","mozallowfullscreen"),t.setAttribute("allowfullscreen","allowfullscreen"),e.parentNode.appendChild(t),e.parentNode.removeChild(e)})},w=function(e){!function(e,t,n,s,i,r){e[s]=e[s]||[],e[s].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var a=t.getElementsByTagName(n)[0],o=t.createElement(n);o.async=!0,o.src="https://www.googletagmanager.com/gtm.js?id="+i,a.parentNode.insertBefore(o,a)}(window,document,"script","dataLayer",e)},k={name:".CookiePreferences",path:"/",domain:"localhost"===window.location.hostname?"":"."+function(e){for(var t=(e=e.replace(/^www\./,"")).split(".");t.length>3;)t.shift();return 3===t.length&&-1===g.indexOf(t[1])&&-1===f.indexOf(t[2])&&t.shift(),t.join(".")}(window.location.hostname),secure:!0,samesite:"strict",expiry:365,types:{},necessary:[],policyURL:"/cookie-policy/#preferences",classNames:{banner:"privacy-banner",acceptBtn:"privacy-banner__accept",rejectBtn:"privacy-banner__reject",submitBtn:"privacy-banner__submit",optionsBtn:"privacy-banner__options",field:"privacy-banner__field",form:"privacy-banner__form",fieldset:"privacy-banner__fieldset",legend:"privacy-banner__legend",formContainer:"privacy-banner__form-container",formMessage:"privacy-banner__form-msg",formAnnouncement:"privacy-banner__form-announcement",title:"privacy-banner__form-title",description:"privacy-banner__form-description",bannerToggle:"on--privacy-banner-toggle",bannerToggleTrigger:"js-toggle-btn"},hideBannerOnFormPage:!0,trapTab:!1,savedMessage:"Your settings have been saved.",bannerTemplate:function(e){return'<section role="dialog" aria-live="polite" aria-label="Your privacy" class="'+e.classNames.banner+'">\n <div class="privacy-content">\n <div class="wrap">\n \x3c!--googleoff: all--\x3e\n <div class="privacy-banner__title">Cookies</div>\n <p>We use cookies to improve your experience on our site and show you personalised advertising.</p>\n <p>Find out more from our <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="/privacy-policy">privacy policy</a> and <a class="privacy-banner__link" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">cookie policy</a>.</p>\n <button type="button" class="btn btn--primary '+e.classNames.acceptBtn+'">Accept all</button>\n <button type="button" class="btn btn--primary '+e.classNames.rejectBtn+'">Reject all</button>\n <a class="privacy-banner__link '+e.classNames.optionsBtn+'" rel="noopener noreferrer nofollow" href="'+e.policyURL+'">Your options</a>\n \x3c!--googleon: all--\x3e\n </div>\n </div>\n </section>'},messageTemplate:function(e){return'<div class="'+e.settings.classNames.formMessage+'" aria-hidden="true">'+e.settings.savedMessage+"</div>"},formTemplate:function(e){return'<form id="preferences" class="'+e.settings.classNames.form+'" novalidate>\n '+Object.keys(e.settings.types).map(function(t){return'<fieldset class="'+e.settings.classNames.fieldset+'">\n <legend class="'+e.settings.classNames.legend+'">\n <span class="'+e.settings.classNames.title+'">'+e.settings.types[t].title+'</span>\n <span class="'+e.settings.classNames.description+'">'+e.settings.types[t].description+'</span>\n </legend>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+t.split(" ")[0].replace(" ","-")+'"\n value="1"\n '+(1===e.consent[t]?"checked":"")+'>\n <span class="privacy-banner__label-text">I am OK with this</span>\n <span class="privacy-banner__label-description">'+e.settings.types[t].labels.yes+'</span>\n </label> \n </div>\n </div>\n <div class="form-row">\n <div class="relative">\n <label class="privacy-banner__label">\n <input\n class="'+e.settings.classNames.field+'"\n type="radio"\n name="privacy-'+t.split(" ")[0].replace(" ","-")+'"\n value="0"\n '+(0===e.consent[t]?"checked":"")+'>\n <span class="privacy-banner__label-text">No thank you</span>\n <span class="privacy-banner__label-description">'+e.settings.types[t].labels.no+"</span>\n </label> \n </div>\n </div>\n </fieldset>"}).join("")+'\n <button class="'+e.settings.classNames.submitBtn+'"'+(Object.keys(e.consent).length!==Object.keys(e.settings.types).length?" disabled":"")+">Save my settings</button>\n </form>"}};function x(){return x=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},x.apply(this,arguments)}var j=function(e,t){return t},_=function(e,t){return Object.assign({},e,{bannerOpen:t})},O=function(e,t){return Object.assign({},e,{banner:t})},S=function(e,t){return Object.assign({},e,{consent:Object.assign({},e.consent,t)})},N=function(e,t){return Object.assign({},e,{settings:Object.assign({},e.settings,{types:Object.assign({},e.settings.types,t)})})},A=function(e){return function(t){!function(e){Object.keys(e.consent).forEach(function(t){e.settings.types[t]&&!0!==e.settings.types[t].executed&&e.consent[t]&&Boolean(e.consent[t])&&e.settings.types[t].fns&&e.settings.types[t].fns.forEach(function(t){return t(e)})})}(t),e.update(N,Object.keys(t.settings.types).reduce(function(e,n){return e[n]=Object.assign({},t.settings.types[n],{executed:t.settings.types[n].executed||t.consent[n]&&Boolean(t.consent[n])}),e},{}))}},E=function(e){e.settings.necessary.forEach(function(t){return t(e)})},T=function(e,t){return{tid:t,v:1,t:"event",ds:"cookiebanner",dh:location.hostname,uip:"0.0.0.0",sr:window.screen?window.screen.width+"x"+window.screen.height:null,vp:document.documentElement.clientWidth+"x"+document.documentElement.clientHeight,cid:e,cd1:e,cd3:location.hostname,cd4:"consentAPI"}},B=function(e){return Object.keys(e).filter(function(t){return e[t]}).join(",")},C=function(){try{var e=new Uint32Array(1);return window.crypto.getRandomValues(e),2147483647&e[0]}catch(e){return Math.round(2147483647*Math.random())}},q=function(e,t,n){return void 0===n&&(n="collect"),function(e){if(!navigator.sendBeacon){var t=document.createElement("img");return t.width=1,t.height=1,t.src=e,t}navigator.sendBeacon(e)}(function(e,t){return"https://www.google-analytics.com/"+t+"?"+function(e){return Object.keys(e).reduce(function(t,n){return null!==e[n]&&t.push(n+"="+encodeURIComponent(e[n])),t},[]).join("&")}(e)}(x({},e.persistentMeasurementParams,t,e.settings.debug?{}:{z:C()}),n))},z=function(e){return function(){var t=e.getState();t.bannerOpen||t.settings.hideBannerOnFormPage&&document.querySelector("."+t.settings.classNames.formContainer)||(document.body.firstElementChild.insertAdjacentHTML("beforebegin",t.settings.bannerTemplate(t.settings)),t.settings.tid&&q(t,n),e.update(O,document.querySelector("."+t.settings.classNames.banner)),e.update(_,!0,[y("banner.show",e)]))}},L=function(t){return function(){var n=t.getState();if(n.banner){var r=function(t){return e.map(function(e){return e+"."+t}).join(", ")},l=[].slice.call(document.querySelectorAll(r(n.settings.classNames.acceptBtn))),u=[].slice.call(document.querySelectorAll(r(n.settings.classNames.rejectBtn))),d=document.querySelector(r(n.settings.classNames.optionsBtn));n.settings.trapTab&&document.addEventListener("keydown",n.keyListener),l.forEach(function(e){e.addEventListener("click",function(e){t.update(S,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=1,e},{}),[c,A(t),P(t),D(t,!1),y(o,t),function(e){e.settings.tid&&q(e,x({},s,{cd2:B(t.getState().consent)}))}])})}),u.forEach(function(e){e.addEventListener("click",function(e){t.update(S,Object.keys(n.settings.types).reduce(function(e,t){return e[t]=0,e},{}),[c,P(t),D(t,!1),y(o,t),function(e){e.settings.tid&&q(e,x({},a,{cd2:B(t.getState().consent)}))}])})}),d&&n.settings.tid?d.addEventListener("click",function(e){return q(n,i)}):console.warn("No trigger added for options element. Check that the element is a Button or Anchor and that your tid is set.")}}},M=function(e){return function(t){var n;e.getState().banner&&9===t.keyCode&&(n=e.getState(),function(e){var t=v(n.banner),s=t.indexOf(document.activeElement);e.shiftKey&&0===s?(e.preventDefault(),t[t.length-1].focus()):e.shiftKey||s!==t.length-1||(e.preventDefault(),t[0].focus())})(t)}},P=function(e){return function(){var t=e.getState(),n=t.banner;n&&n.parentNode&&(n.parentNode.removeChild(n),e.update(_,!1,[y("banner.hide",e)])),t.settings.trapTab&&document.removeEventListener("keydown",t.keyListener)}},D=function(e,t){return void 0===t&&(t=!0),function(){var n=e.getState(),s=document.querySelector("."+n.settings.classNames.formContainer);if(s){s.innerHTML=n.settings.formTemplate(function(e){return Object.keys(e.consent).length>0?e:Object.assign({},e,{consent:Object.keys(e.settings.types).reduce(function(t,n){return e.settings.types[n].suggested&&(t[n]=1),t},{})})}(n)),n.settings.tid&&t&&q(n,r);var i=document.querySelector("."+n.settings.classNames.form),u=document.querySelector("."+n.settings.classNames.submitBtn),d=[].slice.call(document.querySelectorAll("."+n.settings.classNames.field)).reduce(function(e,t){var n=t.getAttribute("name").replace("privacy-","");return e[n]?e[n].push(t):e[n]=[t],e},{}),m=document.querySelector("."+n.settings.classNames.formAnnouncement)||document.body.appendChild(Object.assign(document.createElement("div"),{className:n.settings.classNames.formAnnouncement,role:"alert"})),f=function(){return Object.keys(d).reduce(function(e,t){var n=d[t].reduce(p,"");return n&&(e[t]=parseInt(n,10)),e},{})};u.hasAttribute("disabled")&&i.addEventListener("change",function e(t){Object.keys(f()).length===Object.keys(d).length&&(u.removeAttribute("disabled"),i.removeEventListener("change",e))}),i.addEventListener("submit",function(t){t.preventDefault(),e.update(S,f(),[l,c,A(e),P(e),y(o,e),R(u),F(m),function(e){if(e.settings.tid){var t=B(e.consent);q(e,x({},a,{cd2:""===t?"None":t,cm2:e.consent.performance?e.consent.performance:0,cm3:e.consent.thirdParty?e.consent.thirdParty:0}))}}])}),window.location.hash.substring(1)===i.id&&window.scrollTo(0,i.getBoundingClientRect().top+window.scrollY)}}},R=function(e){return function(t){e.insertAdjacentHTML("afterend",t.settings.messageTemplate(t)),e.setAttribute("disabled","disabled"),window.setTimeout(function(){e.parentNode.removeChild(e.nextElementSibling),e.removeAttribute("disabled")},3e3)}},F=function(e){return function(t){e.textContent=t.settings.savedMessage,window.setTimeout(function(){e.textContent=""},3e3)}};return function(e){return function(e){if(function(){try{document.cookie="cookietest=1";var e=-1!==document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",e}catch(e){return!1}}()){var t,n=(t={},{update:function(e,n,s){t=e(t,n),s&&s.forEach(function(e){return e(t)})},getState:function(){return t}});e.tid||console.warn("The tid setting is missing. A tid is required for banner measurements.");var s=function(e){try{var t=function(e){for(var t=document.cookie.split("; "),n=0;n<=t.length;n++){if(!t[n])return!1;var s=t[n].split("=");if(s[0]===e.name)return window.atob(s[1])}return!1}(e);if(!t)return[!1,b(),{}];var n=JSON.parse(t),s=n.consent;return[void 0!==s,n.cid||b(),s||{}]}catch(e){return[!1,b(),{}]}}(e),i=s[0],r=s[1],a=s[2];return n.update(j,{settings:e,bannerOpen:!1,keyListener:M(n),persistentMeasurementParams:!!e.tid&&T(r,e.tid),consent:a,utils:{renderIframe:h,gtmSnippet:w}},[E,A(n),i?d:z(n),D(n),L(n)]),{getState:n.getState,showBanner:function(e){!function(e){return function(t){if(z(e)(),e.getState().bannerOpen){D(e)();var n=v(document.body.firstElementChild);n.length>0&&n[0].focus(),t&&t.call&&t(e.getState())}}}(n)(e),L(n)()},renderForm:D(n)}}}(Object.assign({},k,e,{types:Object.keys(e.types).reduce(u(e),k.types)}))}});
//# sourceMappingURL=index.umd.js.map
{
"name": "@stormid/cookie-banner",
"version": "1.0.0-alpha.29",
"version": "1.0.0-alpha.30",
"description": "GDPR compliant cookie banner",

@@ -31,3 +31,3 @@ "author": "stormid",

},
"gitHead": "4a4c7900b5dccc1f58fef5d17d347b27db7ee78c"
"gitHead": "9dc92e733514cf76755c2ff87d520c152d615630"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc