New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@chiiya/haven

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chiiya/haven - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

13

dist/haven.esm.js
/*!
* @chiiya/haven v0.1.1
* @chiiya/haven v0.1.2
* (c) Elisha Witte <elishawitte@gmail.com>

@@ -790,3 +790,7 @@ * Released under the MIT License.

var injectGoogleAnalytics = function injectGoogleAnalytics(id) {
var injectGoogleAnalytics = function injectGoogleAnalytics(id, options) {
if (options === void 0) {
options = {};
}
if (hasLoadedScript('https://www.google-analytics.com/analytics.js')) {

@@ -806,2 +810,7 @@ return;

window.ga('create', id, 'auto');
if (options.anonymizeIp === true) {
window.ga('set', 'anonymizeIp', true);
}
window.ga('send', 'pageview');

@@ -808,0 +817,0 @@ };

4

dist/haven.umd.min.js
/*!
* @chiiya/haven v0.1.1
* @chiiya/haven v0.1.2
* (c) Elisha Witte <elishawitte@gmail.com>
* Released under the MIT License.
*/
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).haven={})}(this,function(e){"use strict";var n=function(){return(n=Object.assign||function(e){for(var n,o=1,t=arguments.length;o<t;o++)for(var i in n=arguments[o])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)};function o(e){var n="function"==typeof Symbol&&e[Symbol.iterator],o=0;return n?n.call(e):{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}}}function t(e,n){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var t,i,r=o.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(t=r.next()).done;)a.push(t.value)}catch(e){i={error:e}}finally{try{t&&!t.done&&(o=r.return)&&o.call(r)}finally{if(i)throw i.error}}return a}function i(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat(t(arguments[n]));return e}function r(e){return e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)}var a=function(){function e(){}return e.set=function(e,n,t){var i,r,a=this.resolveOptions(t),c=encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),s=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),l="";try{for(var u=o(Object.keys(a)),f=u.next();!f.done;f=u.next()){var d=f.value,p=a[d];p&&(l+="; "+d,!0!==p&&(l+="="+p.split(";")[0]))}}catch(e){i={error:e}}finally{try{f&&!f.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}document.cookie=s+"="+c+l},e.get=function(e){var n,t,i=document.cookie?document.cookie.split("; "):[];try{for(var a=o(i),c=a.next();!c.done;c=a.next()){var s=c.value.split("=");if(e===r(s[0])){var l=s.slice(1).join("=");return'"'===l.charAt(0)&&(l=l.slice(1,-1)),l=r(l)}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(t=a.return)&&t.call(a)}finally{if(n)throw n.error}}},e.getAll=function(){var e,n,t=document.cookie?document.cookie.split("; "):[],i={};try{for(var a=o(t),c=a.next();!c.done;c=a.next()){var s=c.value.split("="),l=r(s[0]),u=s.slice(1).join("=");'"'===u.charAt(0)&&(u=u.slice(1,-1)),u=r(u),i[l]=u}}catch(n){e={error:n}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return i},e.remove=function(e,n){void 0===n&&(n={});var o=Object.assign(n,{expires:-1});if(e instanceof RegExp)return this.removeByRegex(e,o);this.set(e,"",o)},e.removeByRegex=function(e,n){var o=this;Object.keys(this.getAll()).map(function(t){e.test(t)&&o.set(t,"",n)})},e.resolveOptions=function(e){return e&&"number"==typeof e.expires&&(e.expires=new Date(Date.now()+864e5*e.expires)),e&&e.expires instanceof Date&&(e.expires=e.expires.toUTCString()),Object.assign({path:"/"},e)},e}(),c=new(function(){function e(){this.subscriptions={},this.counter=0}return e.prototype.on=function(e,n){var o=this,t=this.counter+=1;return void 0===this.subscriptions[e]&&(this.subscriptions[e]={}),this.subscriptions[e][t]=n,{unsubscribe:function(){delete o.subscriptions[e][t]}}},e.prototype.emit=function(e,n){var t,i;if(void 0!==this.subscriptions[e])try{for(var r=o(Object.keys(this.subscriptions[e])),a=r.next();!a.done;a=r.next()){var c=a.value;this.subscriptions[e][c](n)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},e}());function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var l={prefix:"cookies",domains:[],cookies:{},lang:"en",type:"opt-in",services:[],notification:{position:"bottom",policyUrl:"/cookie-policy",styles:{background:"#3C366B",textColor:"#FFF",linkColor:"#F7FAFC",buttonBackgroundColor:"#F1D600",buttonBackgroundColorHover:"#F6E05E",buttonTextColor:"#1A202C"}},preferences:{styles:{textColor:"#666666",toggleBorder:"#666666",toggleBackground:"#9FD6AE",buttonColor:"#FFF",buttonBackground:"#3273DC",buttonBackgroundHover:"#2F6BCD"}},translations:{en:{notification:{message:"This website uses cookies to ensure you get the best experience on our website.",policy:"Learn more",accept:"Allow cookies",decline:"Decline"},preferences:{description:"This website uses the following cookies:",save:"Save changes",saved:"Saved"},purposes:{functional:{name:"Functional",description:"Functional cookies are absolutely necessary for core functions such as navigating the page or accessing secure areas. The website cannot function properly without these cookies.\n"},analytics:{name:"Analytics",description:"Analytics cookies serve to improve the performance and functionality of this website by collecting and reporting information anonymously.\n"},marketing:{name:"Marketing",description:"Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.\n"},preferences:{name:"Preferences",description:"Preference cookies are used to remember settings and customizations that change the way the website behaves or looks.\n"}}},de:{notification:{message:"Wir verwenden Cookies, um Ihnen den bestmöglichen Service auf unserer Website zu bieten.",policy:"Cookie-Einstellungen ändern",accept:"Annehmen",decline:"Ablehnen"},preferences:{description:"Diese Website setzt folgende Cookies ein:",save:"Änderungen speichern",saved:"Änderungen gespeichert"},purposes:{functional:{name:"Funktionale Cookies",description:"Funktionale Cookies sind für Kernfunktionen wie das Navigieren auf der Seite oder den Zugriff auf geschützte Bereiche zwingend erforderlich. Ohne diese Cookies kann die Website nicht richtig funktionieren.\n"},analytics:{name:"Analyse-Cookies",description:"Analyse-Cookies dienen dazu, die Leistung und Funktionalität dieser Website zu verbessern, indem sie Informationen anonym sammeln und melden.\n"},marketing:{name:"Marketing-Cookies",description:"Marketing-Cookies werden verwendet, um Besucher auf Websites zu tracken. Ziel ist es, Anzeigen zu schalten, die für den einzelnen Nutzer relevant und ansprechend sind und damit für Publisher und Drittwerber wertvoller sind.\n"},preferences:{name:"Präferenz-Cookies",description:"Präferenz-Cookies werden verwendet, um Einstellungen und Anpassungen zu speichern, die das Verhalten oder das Aussehen der Website verändern.\n"}}}}},u=function(e){var n,t,i=l.translations[l.lang],r=e.split("."),a=i;try{for(var c=o(r),s=c.next();!s.done;s=c.next()){var u=s.value;if(!a[u])return;a=a[u]}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return a},f=function(){if(l.purposes)return l.purposes;var e=l.services.map(function(e){return e.purposes||[]}).flat();return i(new Set(i(e)))};function d(e){return e&&"object"===s(e)&&!Array.isArray(e)}function p(e,n){var o=Object.assign({},e);return d(e)&&d(n)&&Object.keys(n).forEach(function(t){var i,r;d(n[t])?t in e?o[t]=p(e[t],n[t]):Object.assign(o,((i={})[t]=n[t],i)):Object.assign(o,((r={})[t]=n[t],r))}),o}function v(e){return null!==document.querySelector('script[src="'+e+'"')}var h=function(){function e(e,n){void 0===n&&(n="opt-in"),this.prefix=e,this.type=n}return e.getCookie=function(e){return a.get(e)},e.setCookie=function(e,n,o){a.set(e,n,o)},e.removeCookie=function(e,n){a.remove(e,n)},e.cookieExists=function(e){return void 0!==a.get(e)&&""!==a.get(e)},e.prototype.enableFunctionalCookie=function(){e.setCookie(this.prefix+"-functional","true",{expires:365}),c.emit("functional-enabled")},e.prototype.hasFunctionalCookie=function(){return e.cookieExists(this.prefix+"-functional")},e.prototype.enableCookies=function(n){e.setCookie(this.prefix+"-"+n,"true",{expires:365}),console.log(n+"-enabled"),c.emit(n+"-enabled")},e.prototype.disableCookies=function(n){e.setCookie(this.prefix+"-"+n,"false",{expires:365}),c.emit(n+"-disabled")},e.prototype.hasCookiesEnabled=function(n){var o=e.getCookie(this.prefix+"-"+n);return"opt-in"===this.type?"true"===o:void 0===o||"true"===o},e.prototype.hasAllNecessaryCookiesEnabled=function(e){var n,t;try{for(var i=o(e),r=i.next();!r.done;r=i.next()){var a=r.value;if(!this.hasCookiesEnabled(a))return!1}}catch(e){n={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(n)throw n.error}}return!0},e.prototype.enableAllCookies=function(){var e=this;i(["functional"],f()).map(function(n){return e.enableCookies(n)})},e.prototype.disableAllCookies=function(){var e=this;f().map(function(n){return e.disableCookies(n)})},e}(),y=function(){function e(){}return e.resolve=function(e){e.domains&&Array.isArray(e.domains)&&(e.domains=e.domains.map(function(e){return e.startsWith(".")?e:"."+e})),this.resolveBaseConfiguration(e),l.notification=p(l.notification,e.notification),l.translations=p(l.translations,e.translations)},e.resolveBaseConfiguration=function(e){var n,t;try{for(var i=o(["prefix","cookies","lang","type","services"]),r=i.next();!r.done;r=i.next()){var a=r.value;void 0!==e[a]&&(l[a]=e[a])}}catch(e){n={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(n)throw n.error}}var c=e.domains||[];l.domains=c.length>0?c:this.getDomains()},e.getDomains=function(){var e=[],n=window.location.hostname,o=n.match(/(?:[A-Za-z0-9-]+\.)*([A-Za-z0-9-]+\.co.uk|\.com.br|\.co.jp|\.com.au)\b/);null!==o&&e.push(o[1]);var t=n.match(/(?:[A-Za-z0-9-]+\.)*([A-Za-z0-9-]+\.(?:[A-za-z]{2}|[A-Za-z]{3,}))\b/);return null!==t&&e.push(t[1]),e.push(n),e},e}(),g=["-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto","Oxygen","Ubuntu","Cantarell",'"Fira Sans"','"Droid Sans"','"Helvetica Neue"',"Arial",'"Noto Sans"',"sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"','"Noto Color Emoji"'],m=function(){function e(){}return e.create=function(){var e,n=document.createElement("style");n.type="text/css",n.appendChild(document.createTextNode("\n .hv-notification {\n align-items: center;\n background: "+(e=l.notification.styles).background+";\n box-sizing: border-box;\n color: "+e.textColor+";\n display: flex;\n font-family: "+g.join(", ")+";\n font-size: 16px;\n justify-content: space-between;\n left: 0;\n line-height: 1.5;\n opacity: 1;\n overflow: hidden;\n padding: 16px 32px;\n position: fixed;\n right: 0;\n transition: opacity 1s ease;\n width: 100%;\n z-index: 9999;\n }\n\n .hv-notification--hidden {\n opacity: 0;\n }\n\n .hv-notification--top {\n top: 0;\n }\n\n .hv-notification--bottom {\n bottom: 0;\n }\n\n .hv-notification__message {\n margin: 0 16px 0 0;\n }\n\n .hv-notification__message a {\n color: "+e.linkColor+";\n text-decoration: underline;\n }\n\n .hv-notification__message a:hover {\n color: "+e.textColor+";\n }\n\n .hv-notification-button {\n align-items: center;\n border: 0;\n cursor: pointer;\n display: inline-flex;\n font-size: 14px;\n font-weight: 500;\n justify-content: center;\n outline: 0;\n padding: 8px 32px;\n transition: background-color 0.2s ease, color 0.2s ease;\n }\n\n .hv-notification__decline {\n background: transparent;\n color: "+e.textColor+";\n }\n\n .hv-notification__decline:hover {\n text-decoration: underline;\n }\n\n .hv-notification__accept {\n background: "+e.buttonBackgroundColor+";\n color: "+e.buttonTextColor+";\n }\n\n .hv-notification__accept:hover {\n background: "+e.buttonBackgroundColorHover+";\n }\n ")),document.head.appendChild(n);var o=document.createElement("div");o.innerHTML=function(){var e=l.notification;return'\n <div id="cookie-notification" role="alert" class="hv-notification hv-notification--'+e.position+'" data-display="flex" style="display: none;">\n <p class="hv-notification__message">\n '+u("notification.message")+' <a href="'+e.policyUrl+'" target="_blank">'+u("notification.policy")+'</a>\n </p>\n <div class="hv-notification__actions">\n <button id="cookie-notification__decline" class="hv-notification-button hv-notification__decline">'+u("notification.decline")+'</button>\n <button id="cookie-notification__accept" class="hv-notification-button hv-notification__accept">'+u("notification.accept")+"</button>\n </div>\n </div>\n "}(),document.body.appendChild(o)},e}(),k=function(){function e(){this.cookieNotification=null,this.cookiesAccept=null,this.cookiesDecline=null,this.cookieManager=new h(l.prefix,l.type)}return e.prototype.init=function(){var e=this;this.cookieNotification=document.getElementById("cookie-notification"),null===this.cookieNotification&&(m.create(),this.cookieNotification=document.getElementById("cookie-notification")),this.cookiesAccept=document.getElementById("cookie-notification__accept"),this.cookiesDecline=document.getElementById("cookie-notification__decline"),null===this.cookieNotification||this.cookieManager.hasFunctionalCookie()||this.showCookieNotification(),null!==this.cookiesAccept&&this.cookiesAccept.addEventListener("click",function(n){n.preventDefault(),e.cookieManager.enableAllCookies(),e.hideCookieNotification()}),null!==this.cookiesDecline&&this.cookiesDecline.addEventListener("click",function(n){n.preventDefault(),e.cookieManager.disableAllCookies(),e.cookieManager.enableFunctionalCookie(),e.hideCookieNotification()})},e.prototype.showCookieNotification=function(){null!==this.cookieNotification&&(this.cookieNotification.style.display=this.cookieNotification.dataset.display||"block",this.cookieNotification.classList.remove("hv-notification--hidden"))},e.prototype.hideCookieNotification=function(){null!==this.cookieNotification&&(this.cookieNotification.style.display="none")},e}(),b=["-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto","Oxygen","Ubuntu","Cantarell",'"Fira Sans"','"Droid Sans"','"Helvetica Neue"',"Arial",'"Noto Sans"',"sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"','"Noto Color Emoji"'],x=function(){function e(){}return e.create=function(e){var n,o=document.createElement("style");o.type="text/css",o.appendChild(document.createTextNode((n=l.preferences.styles,"\n .hv-preference {\n align-items: center;\n box-sizing: border-box;\n display: flex;\n font-family: "+b.join(", ")+";\n font-size: 16px;\n justify-content: space-between;\n line-height: 1.5;\n width: 100%;\n }\n\n .hv-preference__purpose {\n font-size: 20px;\n margin: 0;\n }\n\n .hv-preference__description {\n margin-top: 10px;\n width: 100%;\n }\n\n .hv-toggle {\n display: none;\n }\n\n .hv-toggle:checked + label::before {\n background: "+n.toggleBackground+";\n left: auto;\n right: 20px;\n transform: translateX(16px);\n }\n\n .hv-toggle:disabled + label {\n cursor: not-allowed;\n opacity: .5;\n }\n\n .hv-toggle-label {\n border: 1px solid "+n.toggleBorder+";\n border-radius: 9999px;\n cursor: pointer;\n display: inline-block;\n height: 24px;\n margin: 0;\n position: relative;\n width: 48px;\n }\n\n .hv-toggle-label::before {\n background: "+n.toggleBorder+';\n border-radius: 9999px;\n content: "";\n height: 16px;\n left: 4px;\n position: absolute;\n transition: transform .3s ease, background-color .3s ease;\n top: 3px;\n width: 16px;\n }\n\n .hv-button {\n background: '+n.buttonBackground+";\n color: "+n.buttonColor+";\n align-items: center;\n border: 0;\n border-radius: 3px;\n cursor: pointer;\n display: inline-flex;\n font-size: 15px;\n justify-content: center;\n padding: 8px 16px;\n transition: background-color 150ms;\n vertical-align: middle;\n white-space: nowrap;\n }\n\n .hv-button:disabled {\n cursor: not-allowed;\n }\n\n .hv-button:hover {\n background: "+n.buttonBackgroundHover+";\n }\n "))),document.head.appendChild(o);var t,r=document.createElement("div");r.innerHTML=(t=i(["functional"],f()),"\n <p>"+u("preferences.description")+"</p>\n "+t.map(function(e){return'\n <div class="hv-preference">\n <h3 class="hv-preference__purpose">'+u("purposes."+e+".name")+'</h3>\n <input type="checkbox" class="hv-toggle" id="cookie-preferences--'+e+'" '+("functional"===e?"disabled checked":"")+'>\n <label for="cookie-preferences--'+e+'" class="hv-toggle-label"></label>\n </div>\n <p class="hv-preference__description">'+u("purposes."+e+".description")+"</p>\n "}).join("")+'\n <button class="hv-button" id="cookie-preferences__save">'+u("preferences.save")+"</button>\n "),e.appendChild(r)},e}(),w=function(){function e(){this.saveButton=null,this.cookieManager=new h(l.prefix,l.type)}return e.prototype.init=function(){var e,n,t=this,i=document.getElementById("cookie-preferences");null!==i&&x.create(i);var r=f(),a={};try{for(var c=o(r),s=c.next();!s.done;s=c.next()){var l=s.value,u=document.getElementById("cookie-preferences--"+l);null!==u&&(a[l]=u,u.checked=this.cookieManager.hasCookiesEnabled(l),u.addEventListener("change",function(){t.enableButton()}))}}catch(n){e={error:n}}finally{try{s&&!s.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}this.saveButton=document.getElementById("cookie-preferences__save"),null!==this.saveButton&&this.saveButton.addEventListener("click",function(){var e,n;t.disableButton(),t.cookieManager.enableFunctionalCookie();try{for(var i=o(r),c=i.next();!c.done;c=i.next()){var s=c.value;a[s].checked?t.cookieManager.enableCookies(s):t.cookieManager.disableCookies(s)}}catch(n){e={error:n}}finally{try{c&&!c.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}})},e.prototype.enableButton=function(){this.saveButton.disabled=!1,this.saveButton.innerText=u("preferences.save")},e.prototype.disableButton=function(){this.saveButton.disabled=!0,this.saveButton.innerText=u("preferences.saved")},e}(),C=function(e){if(!v("https://connect.facebook.net/en_US/fbevents.js")&&!window.fbq){var n=window.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};window._fbq||(window._fbq=n),n.push=n,n.loaded=!0,n.version="2.0",n.queue=[];var o=document.createElement("script");o.async=!0,o.src="https://connect.facebook.net/en_US/fbevents.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(o,t),window.fbq("init",e),window.fbq("track","PageView")}},_=function(e){if(!v("https://www.google-analytics.com/analytics.js")){window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;var n=document.getElementsByTagName("script")[0],o=document.createElement("script");o.src="https://www.google-analytics.com/analytics.js",n.parentNode.insertBefore(o,n),window.ga("create",e,"auto"),window.ga("send","pageview")}},S=function(e){if(!B(e)){window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"gtm.js","gtm.start":(new Date).getTime()});var n=document.getElementsByTagName("script")[0],o=document.createElement("script");o.src="https://www.googletagmanager.com/gtm.js?id="+e,n.parentNode.insertBefore(o,n)}},B=function(e){var n="https://www.googletagmanager.com/gtm.js?id="+e;return null!==document.querySelector('script[src="'+n+'"')},j=function(){function e(){this.cookieManager=new h(l.prefix,l.type)}return e.prototype.injectServices=function(){var e,n;console.log(l.services);try{for(var t=o(l.services),i=t.next();!i.done;i=t.next()){var r=i.value;this.injectService(r),c.emit("service-loaded",r.name)}}catch(n){e={error:n}}finally{try{i&&!i.done&&(n=t.return)&&n.call(t)}finally{if(e)throw e.error}}c.emit("services-loaded")},e.prototype.injectService=function(e){if(this.shouldBeInjected(e)){var n=this.getInjectorFunction(e);void 0!==n&&(void 0!==e.id&&n(e.id),n())}},e.prototype.shouldBeInjected=function(e){return e.required||this.cookieManager.hasAllNecessaryCookiesEnabled(e.purposes)},e.prototype.getInjectorFunction=function(e){if(!0===e.inject){if(void 0===this.getDefaultInjector(e.name))return void console.error("No default injector found for "+e.name+". Please specify your own implementation.")}else if(e.inject)return e.inject},e.prototype.getDefaultInjector=function(e){switch(e){case"google-analytics":return _;case"google-tag-manager":return S;case"facebook-pixel":return C;default:return}},e.prototype.registerService=function(e,o,t,i){void 0===i&&(i={});var r=n({name:e,purposes:o,inject:t},i);l.services.push(r),this.injectService(r)},e}(),A=function(){function e(){}return e.removeCookies=function(){var e,n,t=this;try{for(var i=o(l.services),r=i.next();!r.done;r=i.next()){var a=r.value;this.removeCookiesSetByService(a)}}catch(n){e={error:n}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}l.cookies&&Object.values(l.cookies).map(function(e){return t.removeSimpleCookies(e)}),window.location.reload()},e.removeCookiesForPurpose=function(e){var n,t;try{for(var i=o(l.services),r=i.next();!r.done;r=i.next()){var a=r.value;-1!==a.purposes.indexOf(e)&&this.removeCookiesSetByService(a)}}catch(e){n={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(n)throw n.error}}l.cookies&&l.cookies[e]&&this.removeSimpleCookies(l.cookies[e])},e.removeCookiesSetByService=function(e){e.cookies&&e.cookies.length&&this.removeSimpleCookies(e.cookies),"google-analytics"===e.name&&this.removeGoogleAnalyticsCookies(e.id)},e.removeGoogleAnalyticsCookies=function(e){this.removeSimpleCookies(["_ga","_gid","_gat","AMP_TOKEN"]),void 0!==e&&this.removeCompositeCookies(["_dc_gtm_","_gac_","_gat_gtag_","_gat_"],e)},e.removeSimpleCookies=function(e){var n,t,i,r;try{for(var a=o(e),c=a.next();!c.done;c=a.next()){var s=c.value;try{for(var u=(i=void 0,o(l.domains)),f=u.next();!f.done;f=u.next()){var d=f.value;h.removeCookie(s,{domain:d})}}catch(e){i={error:e}}finally{try{f&&!f.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}h.removeCookie(s)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(t=a.return)&&t.call(a)}finally{if(n)throw n.error}}},e.removeCompositeCookies=function(e,n){var t,i,r,a;try{for(var c=o(e),s=c.next();!s.done;s=c.next()){var u=s.value;try{for(var f=(r=void 0,o(l.domains)),d=f.next();!d.done;d=f.next()){var p=d.value;h.removeCookie(""+u+n,{domain:p})}}catch(e){r={error:e}}finally{try{d&&!d.done&&(a=f.return)&&a.call(f)}finally{if(r)throw r.error}}h.removeCookie(""+u+n)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}},e}(),E=function(){function e(e){y.resolve(e),this.cookieNotification=new k,this.cookiePreferences=new w,this.cookieManager=new h(l.prefix,l.type),this.serviceLoader=new j}return e.prototype.init=function(){var e=this;document.addEventListener("DOMContentLoaded",function(){e.cookieNotification.init(),e.cookiePreferences.init()}),this.registerDefaultListeners(),this.checkInitialState()},e.prototype.checkInitialState=function(){var e,n,t=f();try{for(var i=o(t),r=i.next();!r.done;r=i.next()){var a=r.value;this.cookieManager.hasCookiesEnabled(a)&&c.emit(a+"-enabled")}}catch(n){e={error:n}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}},e.prototype.registerDefaultListeners=function(){var e,n,t=this,i=f();console.log(i);var r=function(e){c.on(e+"-enabled",function(){t.serviceLoader.injectServices()}),c.on(e+"-disabled",function(){A.removeCookiesForPurpose(e)})};try{for(var a=o(i),s=a.next();!s.done;s=a.next()){r(s.value)}}catch(n){e={error:n}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}},e.prototype.registerService=function(e,n,o,t){void 0===t&&(t={}),this.serviceLoader.registerService(e,n,o,t)},e.on=function(e,n){return c.on(e,n)},e.create=function(n){return e.instance&&console.warn("Replacing an existing Haven instance. Are you sure this behaviour is intended?"),e.instance=new e(n),e.instance.init(),e.instance},e.getInstance=function(){if(e.instance)return e.instance;console.error("No Haven instance found. Make sure to create a Haven instance before attempting to access it.")},e.removeCookies=function(e,n){var t,i;try{for(var r=o(e),a=r.next();!a.done;a=r.next()){var c=a.value;h.removeCookie(c,n)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},e}();window.Haven=E,e.CookieManager=h,e.Haven=E,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).haven={})}(this,function(e){"use strict";var n=function(){return(n=Object.assign||function(e){for(var n,o=1,t=arguments.length;o<t;o++)for(var i in n=arguments[o])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e}).apply(this,arguments)};function o(e){var n="function"==typeof Symbol&&e[Symbol.iterator],o=0;return n?n.call(e):{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}}}function t(e,n){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var t,i,r=o.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(t=r.next()).done;)a.push(t.value)}catch(e){i={error:e}}finally{try{t&&!t.done&&(o=r.return)&&o.call(r)}finally{if(i)throw i.error}}return a}function i(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat(t(arguments[n]));return e}function r(e){return e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)}var a=function(){function e(){}return e.set=function(e,n,t){var i,r,a=this.resolveOptions(t),c=encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),s=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),l="";try{for(var u=o(Object.keys(a)),f=u.next();!f.done;f=u.next()){var d=f.value,p=a[d];p&&(l+="; "+d,!0!==p&&(l+="="+p.split(";")[0]))}}catch(e){i={error:e}}finally{try{f&&!f.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}document.cookie=s+"="+c+l},e.get=function(e){var n,t,i=document.cookie?document.cookie.split("; "):[];try{for(var a=o(i),c=a.next();!c.done;c=a.next()){var s=c.value.split("=");if(e===r(s[0])){var l=s.slice(1).join("=");return'"'===l.charAt(0)&&(l=l.slice(1,-1)),l=r(l)}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(t=a.return)&&t.call(a)}finally{if(n)throw n.error}}},e.getAll=function(){var e,n,t=document.cookie?document.cookie.split("; "):[],i={};try{for(var a=o(t),c=a.next();!c.done;c=a.next()){var s=c.value.split("="),l=r(s[0]),u=s.slice(1).join("=");'"'===u.charAt(0)&&(u=u.slice(1,-1)),u=r(u),i[l]=u}}catch(n){e={error:n}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return i},e.remove=function(e,n){void 0===n&&(n={});var o=Object.assign(n,{expires:-1});if(e instanceof RegExp)return this.removeByRegex(e,o);this.set(e,"",o)},e.removeByRegex=function(e,n){var o=this;Object.keys(this.getAll()).map(function(t){e.test(t)&&o.set(t,"",n)})},e.resolveOptions=function(e){return e&&"number"==typeof e.expires&&(e.expires=new Date(Date.now()+864e5*e.expires)),e&&e.expires instanceof Date&&(e.expires=e.expires.toUTCString()),Object.assign({path:"/"},e)},e}(),c=new(function(){function e(){this.subscriptions={},this.counter=0}return e.prototype.on=function(e,n){var o=this,t=this.counter+=1;return void 0===this.subscriptions[e]&&(this.subscriptions[e]={}),this.subscriptions[e][t]=n,{unsubscribe:function(){delete o.subscriptions[e][t]}}},e.prototype.emit=function(e,n){var t,i;if(void 0!==this.subscriptions[e])try{for(var r=o(Object.keys(this.subscriptions[e])),a=r.next();!a.done;a=r.next()){var c=a.value;this.subscriptions[e][c](n)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},e}());function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var l={prefix:"cookies",domains:[],cookies:{},lang:"en",type:"opt-in",services:[],notification:{position:"bottom",policyUrl:"/cookie-policy",styles:{background:"#3C366B",textColor:"#FFF",linkColor:"#F7FAFC",buttonBackgroundColor:"#F1D600",buttonBackgroundColorHover:"#F6E05E",buttonTextColor:"#1A202C"}},preferences:{styles:{textColor:"#666666",toggleBorder:"#666666",toggleBackground:"#9FD6AE",buttonColor:"#FFF",buttonBackground:"#3273DC",buttonBackgroundHover:"#2F6BCD"}},translations:{en:{notification:{message:"This website uses cookies to ensure you get the best experience on our website.",policy:"Learn more",accept:"Allow cookies",decline:"Decline"},preferences:{description:"This website uses the following cookies:",save:"Save changes",saved:"Saved"},purposes:{functional:{name:"Functional",description:"Functional cookies are absolutely necessary for core functions such as navigating the page or accessing secure areas. The website cannot function properly without these cookies.\n"},analytics:{name:"Analytics",description:"Analytics cookies serve to improve the performance and functionality of this website by collecting and reporting information anonymously.\n"},marketing:{name:"Marketing",description:"Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.\n"},preferences:{name:"Preferences",description:"Preference cookies are used to remember settings and customizations that change the way the website behaves or looks.\n"}}},de:{notification:{message:"Wir verwenden Cookies, um Ihnen den bestmöglichen Service auf unserer Website zu bieten.",policy:"Cookie-Einstellungen ändern",accept:"Annehmen",decline:"Ablehnen"},preferences:{description:"Diese Website setzt folgende Cookies ein:",save:"Änderungen speichern",saved:"Änderungen gespeichert"},purposes:{functional:{name:"Funktionale Cookies",description:"Funktionale Cookies sind für Kernfunktionen wie das Navigieren auf der Seite oder den Zugriff auf geschützte Bereiche zwingend erforderlich. Ohne diese Cookies kann die Website nicht richtig funktionieren.\n"},analytics:{name:"Analyse-Cookies",description:"Analyse-Cookies dienen dazu, die Leistung und Funktionalität dieser Website zu verbessern, indem sie Informationen anonym sammeln und melden.\n"},marketing:{name:"Marketing-Cookies",description:"Marketing-Cookies werden verwendet, um Besucher auf Websites zu tracken. Ziel ist es, Anzeigen zu schalten, die für den einzelnen Nutzer relevant und ansprechend sind und damit für Publisher und Drittwerber wertvoller sind.\n"},preferences:{name:"Präferenz-Cookies",description:"Präferenz-Cookies werden verwendet, um Einstellungen und Anpassungen zu speichern, die das Verhalten oder das Aussehen der Website verändern.\n"}}}}},u=function(e){var n,t,i=l.translations[l.lang],r=e.split("."),a=i;try{for(var c=o(r),s=c.next();!s.done;s=c.next()){var u=s.value;if(!a[u])return;a=a[u]}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return a},f=function(){if(l.purposes)return l.purposes;var e=l.services.map(function(e){return e.purposes||[]}).flat();return i(new Set(i(e)))};function d(e){return e&&"object"===s(e)&&!Array.isArray(e)}function p(e,n){var o=Object.assign({},e);return d(e)&&d(n)&&Object.keys(n).forEach(function(t){var i,r;d(n[t])?t in e?o[t]=p(e[t],n[t]):Object.assign(o,((i={})[t]=n[t],i)):Object.assign(o,((r={})[t]=n[t],r))}),o}function v(e){return null!==document.querySelector('script[src="'+e+'"')}var h=function(){function e(e,n){void 0===n&&(n="opt-in"),this.prefix=e,this.type=n}return e.getCookie=function(e){return a.get(e)},e.setCookie=function(e,n,o){a.set(e,n,o)},e.removeCookie=function(e,n){a.remove(e,n)},e.cookieExists=function(e){return void 0!==a.get(e)&&""!==a.get(e)},e.prototype.enableFunctionalCookie=function(){e.setCookie(this.prefix+"-functional","true",{expires:365}),c.emit("functional-enabled")},e.prototype.hasFunctionalCookie=function(){return e.cookieExists(this.prefix+"-functional")},e.prototype.enableCookies=function(n){e.setCookie(this.prefix+"-"+n,"true",{expires:365}),console.log(n+"-enabled"),c.emit(n+"-enabled")},e.prototype.disableCookies=function(n){e.setCookie(this.prefix+"-"+n,"false",{expires:365}),c.emit(n+"-disabled")},e.prototype.hasCookiesEnabled=function(n){var o=e.getCookie(this.prefix+"-"+n);return"opt-in"===this.type?"true"===o:void 0===o||"true"===o},e.prototype.hasAllNecessaryCookiesEnabled=function(e){var n,t;try{for(var i=o(e),r=i.next();!r.done;r=i.next()){var a=r.value;if(!this.hasCookiesEnabled(a))return!1}}catch(e){n={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(n)throw n.error}}return!0},e.prototype.enableAllCookies=function(){var e=this;i(["functional"],f()).map(function(n){return e.enableCookies(n)})},e.prototype.disableAllCookies=function(){var e=this;f().map(function(n){return e.disableCookies(n)})},e}(),y=function(){function e(){}return e.resolve=function(e){e.domains&&Array.isArray(e.domains)&&(e.domains=e.domains.map(function(e){return e.startsWith(".")?e:"."+e})),this.resolveBaseConfiguration(e),l.notification=p(l.notification,e.notification),l.translations=p(l.translations,e.translations)},e.resolveBaseConfiguration=function(e){var n,t;try{for(var i=o(["prefix","cookies","lang","type","services"]),r=i.next();!r.done;r=i.next()){var a=r.value;void 0!==e[a]&&(l[a]=e[a])}}catch(e){n={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(n)throw n.error}}var c=e.domains||[];l.domains=c.length>0?c:this.getDomains()},e.getDomains=function(){var e=[],n=window.location.hostname,o=n.match(/(?:[A-Za-z0-9-]+\.)*([A-Za-z0-9-]+\.co.uk|\.com.br|\.co.jp|\.com.au)\b/);null!==o&&e.push(o[1]);var t=n.match(/(?:[A-Za-z0-9-]+\.)*([A-Za-z0-9-]+\.(?:[A-za-z]{2}|[A-Za-z]{3,}))\b/);return null!==t&&e.push(t[1]),e.push(n),e},e}(),g=["-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto","Oxygen","Ubuntu","Cantarell",'"Fira Sans"','"Droid Sans"','"Helvetica Neue"',"Arial",'"Noto Sans"',"sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"','"Noto Color Emoji"'],m=function(){function e(){}return e.create=function(){var e,n=document.createElement("style");n.type="text/css",n.appendChild(document.createTextNode("\n .hv-notification {\n align-items: center;\n background: "+(e=l.notification.styles).background+";\n box-sizing: border-box;\n color: "+e.textColor+";\n display: flex;\n font-family: "+g.join(", ")+";\n font-size: 16px;\n justify-content: space-between;\n left: 0;\n line-height: 1.5;\n opacity: 1;\n overflow: hidden;\n padding: 16px 32px;\n position: fixed;\n right: 0;\n transition: opacity 1s ease;\n width: 100%;\n z-index: 9999;\n }\n\n .hv-notification--hidden {\n opacity: 0;\n }\n\n .hv-notification--top {\n top: 0;\n }\n\n .hv-notification--bottom {\n bottom: 0;\n }\n\n .hv-notification__message {\n margin: 0 16px 0 0;\n }\n\n .hv-notification__message a {\n color: "+e.linkColor+";\n text-decoration: underline;\n }\n\n .hv-notification__message a:hover {\n color: "+e.textColor+";\n }\n\n .hv-notification-button {\n align-items: center;\n border: 0;\n cursor: pointer;\n display: inline-flex;\n font-size: 14px;\n font-weight: 500;\n justify-content: center;\n outline: 0;\n padding: 8px 32px;\n transition: background-color 0.2s ease, color 0.2s ease;\n }\n\n .hv-notification__decline {\n background: transparent;\n color: "+e.textColor+";\n }\n\n .hv-notification__decline:hover {\n text-decoration: underline;\n }\n\n .hv-notification__accept {\n background: "+e.buttonBackgroundColor+";\n color: "+e.buttonTextColor+";\n }\n\n .hv-notification__accept:hover {\n background: "+e.buttonBackgroundColorHover+";\n }\n ")),document.head.appendChild(n);var o=document.createElement("div");o.innerHTML=function(){var e=l.notification;return'\n <div id="cookie-notification" role="alert" class="hv-notification hv-notification--'+e.position+'" data-display="flex" style="display: none;">\n <p class="hv-notification__message">\n '+u("notification.message")+' <a href="'+e.policyUrl+'" target="_blank">'+u("notification.policy")+'</a>\n </p>\n <div class="hv-notification__actions">\n <button id="cookie-notification__decline" class="hv-notification-button hv-notification__decline">'+u("notification.decline")+'</button>\n <button id="cookie-notification__accept" class="hv-notification-button hv-notification__accept">'+u("notification.accept")+"</button>\n </div>\n </div>\n "}(),document.body.appendChild(o)},e}(),k=function(){function e(){this.cookieNotification=null,this.cookiesAccept=null,this.cookiesDecline=null,this.cookieManager=new h(l.prefix,l.type)}return e.prototype.init=function(){var e=this;this.cookieNotification=document.getElementById("cookie-notification"),null===this.cookieNotification&&(m.create(),this.cookieNotification=document.getElementById("cookie-notification")),this.cookiesAccept=document.getElementById("cookie-notification__accept"),this.cookiesDecline=document.getElementById("cookie-notification__decline"),null===this.cookieNotification||this.cookieManager.hasFunctionalCookie()||this.showCookieNotification(),null!==this.cookiesAccept&&this.cookiesAccept.addEventListener("click",function(n){n.preventDefault(),e.cookieManager.enableAllCookies(),e.hideCookieNotification()}),null!==this.cookiesDecline&&this.cookiesDecline.addEventListener("click",function(n){n.preventDefault(),e.cookieManager.disableAllCookies(),e.cookieManager.enableFunctionalCookie(),e.hideCookieNotification()})},e.prototype.showCookieNotification=function(){null!==this.cookieNotification&&(this.cookieNotification.style.display=this.cookieNotification.dataset.display||"block",this.cookieNotification.classList.remove("hv-notification--hidden"))},e.prototype.hideCookieNotification=function(){null!==this.cookieNotification&&(this.cookieNotification.style.display="none")},e}(),b=["-apple-system","BlinkMacSystemFont",'"Segoe UI"',"Roboto","Oxygen","Ubuntu","Cantarell",'"Fira Sans"','"Droid Sans"','"Helvetica Neue"',"Arial",'"Noto Sans"',"sans-serif",'"Apple Color Emoji"','"Segoe UI Emoji"','"Segoe UI Symbol"','"Noto Color Emoji"'],x=function(){function e(){}return e.create=function(e){var n,o=document.createElement("style");o.type="text/css",o.appendChild(document.createTextNode((n=l.preferences.styles,"\n .hv-preference {\n align-items: center;\n box-sizing: border-box;\n display: flex;\n font-family: "+b.join(", ")+";\n font-size: 16px;\n justify-content: space-between;\n line-height: 1.5;\n width: 100%;\n }\n\n .hv-preference__purpose {\n font-size: 20px;\n margin: 0;\n }\n\n .hv-preference__description {\n margin-top: 10px;\n width: 100%;\n }\n\n .hv-toggle {\n display: none;\n }\n\n .hv-toggle:checked + label::before {\n background: "+n.toggleBackground+";\n left: auto;\n right: 20px;\n transform: translateX(16px);\n }\n\n .hv-toggle:disabled + label {\n cursor: not-allowed;\n opacity: .5;\n }\n\n .hv-toggle-label {\n border: 1px solid "+n.toggleBorder+";\n border-radius: 9999px;\n cursor: pointer;\n display: inline-block;\n height: 24px;\n margin: 0;\n position: relative;\n width: 48px;\n }\n\n .hv-toggle-label::before {\n background: "+n.toggleBorder+';\n border-radius: 9999px;\n content: "";\n height: 16px;\n left: 4px;\n position: absolute;\n transition: transform .3s ease, background-color .3s ease;\n top: 3px;\n width: 16px;\n }\n\n .hv-button {\n background: '+n.buttonBackground+";\n color: "+n.buttonColor+";\n align-items: center;\n border: 0;\n border-radius: 3px;\n cursor: pointer;\n display: inline-flex;\n font-size: 15px;\n justify-content: center;\n padding: 8px 16px;\n transition: background-color 150ms;\n vertical-align: middle;\n white-space: nowrap;\n }\n\n .hv-button:disabled {\n cursor: not-allowed;\n }\n\n .hv-button:hover {\n background: "+n.buttonBackgroundHover+";\n }\n "))),document.head.appendChild(o);var t,r=document.createElement("div");r.innerHTML=(t=i(["functional"],f()),"\n <p>"+u("preferences.description")+"</p>\n "+t.map(function(e){return'\n <div class="hv-preference">\n <h3 class="hv-preference__purpose">'+u("purposes."+e+".name")+'</h3>\n <input type="checkbox" class="hv-toggle" id="cookie-preferences--'+e+'" '+("functional"===e?"disabled checked":"")+'>\n <label for="cookie-preferences--'+e+'" class="hv-toggle-label"></label>\n </div>\n <p class="hv-preference__description">'+u("purposes."+e+".description")+"</p>\n "}).join("")+'\n <button class="hv-button" id="cookie-preferences__save">'+u("preferences.save")+"</button>\n "),e.appendChild(r)},e}(),w=function(){function e(){this.saveButton=null,this.cookieManager=new h(l.prefix,l.type)}return e.prototype.init=function(){var e,n,t=this,i=document.getElementById("cookie-preferences");null!==i&&x.create(i);var r=f(),a={};try{for(var c=o(r),s=c.next();!s.done;s=c.next()){var l=s.value,u=document.getElementById("cookie-preferences--"+l);null!==u&&(a[l]=u,u.checked=this.cookieManager.hasCookiesEnabled(l),u.addEventListener("change",function(){t.enableButton()}))}}catch(n){e={error:n}}finally{try{s&&!s.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}this.saveButton=document.getElementById("cookie-preferences__save"),null!==this.saveButton&&this.saveButton.addEventListener("click",function(){var e,n;t.disableButton(),t.cookieManager.enableFunctionalCookie();try{for(var i=o(r),c=i.next();!c.done;c=i.next()){var s=c.value;a[s].checked?t.cookieManager.enableCookies(s):t.cookieManager.disableCookies(s)}}catch(n){e={error:n}}finally{try{c&&!c.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}})},e.prototype.enableButton=function(){this.saveButton.disabled=!1,this.saveButton.innerText=u("preferences.save")},e.prototype.disableButton=function(){this.saveButton.disabled=!0,this.saveButton.innerText=u("preferences.saved")},e}(),C=function(e){if(!v("https://connect.facebook.net/en_US/fbevents.js")&&!window.fbq){var n=window.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};window._fbq||(window._fbq=n),n.push=n,n.loaded=!0,n.version="2.0",n.queue=[];var o=document.createElement("script");o.async=!0,o.src="https://connect.facebook.net/en_US/fbevents.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(o,t),window.fbq("init",e),window.fbq("track","PageView")}},_=function(e,n){if(void 0===n&&(n={}),!v("https://www.google-analytics.com/analytics.js")){window.ga=window.ga||function(){(window.ga.q=window.ga.q||[]).push(arguments)},window.ga.l=+new Date;var o=document.getElementsByTagName("script")[0],t=document.createElement("script");t.src="https://www.google-analytics.com/analytics.js",o.parentNode.insertBefore(t,o),window.ga("create",e,"auto"),!0===n.anonymizeIp&&window.ga("set","anonymizeIp",!0),window.ga("send","pageview")}},S=function(e){if(!B(e)){window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"gtm.js","gtm.start":(new Date).getTime()});var n=document.getElementsByTagName("script")[0],o=document.createElement("script");o.src="https://www.googletagmanager.com/gtm.js?id="+e,n.parentNode.insertBefore(o,n)}},B=function(e){var n="https://www.googletagmanager.com/gtm.js?id="+e;return null!==document.querySelector('script[src="'+n+'"')},j=function(){function e(){this.cookieManager=new h(l.prefix,l.type)}return e.prototype.injectServices=function(){var e,n;console.log(l.services);try{for(var t=o(l.services),i=t.next();!i.done;i=t.next()){var r=i.value;this.injectService(r),c.emit("service-loaded",r.name)}}catch(n){e={error:n}}finally{try{i&&!i.done&&(n=t.return)&&n.call(t)}finally{if(e)throw e.error}}c.emit("services-loaded")},e.prototype.injectService=function(e){if(this.shouldBeInjected(e)){var n=this.getInjectorFunction(e);void 0!==n&&(void 0!==e.id&&n(e.id),n())}},e.prototype.shouldBeInjected=function(e){return e.required||this.cookieManager.hasAllNecessaryCookiesEnabled(e.purposes)},e.prototype.getInjectorFunction=function(e){if(!0===e.inject){if(void 0===this.getDefaultInjector(e.name))return void console.error("No default injector found for "+e.name+". Please specify your own implementation.")}else if(e.inject)return e.inject},e.prototype.getDefaultInjector=function(e){switch(e){case"google-analytics":return _;case"google-tag-manager":return S;case"facebook-pixel":return C;default:return}},e.prototype.registerService=function(e,o,t,i){void 0===i&&(i={});var r=n({name:e,purposes:o,inject:t},i);l.services.push(r),this.injectService(r)},e}(),A=function(){function e(){}return e.removeCookies=function(){var e,n,t=this;try{for(var i=o(l.services),r=i.next();!r.done;r=i.next()){var a=r.value;this.removeCookiesSetByService(a)}}catch(n){e={error:n}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}l.cookies&&Object.values(l.cookies).map(function(e){return t.removeSimpleCookies(e)}),window.location.reload()},e.removeCookiesForPurpose=function(e){var n,t;try{for(var i=o(l.services),r=i.next();!r.done;r=i.next()){var a=r.value;-1!==a.purposes.indexOf(e)&&this.removeCookiesSetByService(a)}}catch(e){n={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(n)throw n.error}}l.cookies&&l.cookies[e]&&this.removeSimpleCookies(l.cookies[e])},e.removeCookiesSetByService=function(e){e.cookies&&e.cookies.length&&this.removeSimpleCookies(e.cookies),"google-analytics"===e.name&&this.removeGoogleAnalyticsCookies(e.id)},e.removeGoogleAnalyticsCookies=function(e){this.removeSimpleCookies(["_ga","_gid","_gat","AMP_TOKEN"]),void 0!==e&&this.removeCompositeCookies(["_dc_gtm_","_gac_","_gat_gtag_","_gat_"],e)},e.removeSimpleCookies=function(e){var n,t,i,r;try{for(var a=o(e),c=a.next();!c.done;c=a.next()){var s=c.value;try{for(var u=(i=void 0,o(l.domains)),f=u.next();!f.done;f=u.next()){var d=f.value;h.removeCookie(s,{domain:d})}}catch(e){i={error:e}}finally{try{f&&!f.done&&(r=u.return)&&r.call(u)}finally{if(i)throw i.error}}h.removeCookie(s)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(t=a.return)&&t.call(a)}finally{if(n)throw n.error}}},e.removeCompositeCookies=function(e,n){var t,i,r,a;try{for(var c=o(e),s=c.next();!s.done;s=c.next()){var u=s.value;try{for(var f=(r=void 0,o(l.domains)),d=f.next();!d.done;d=f.next()){var p=d.value;h.removeCookie(""+u+n,{domain:p})}}catch(e){r={error:e}}finally{try{d&&!d.done&&(a=f.return)&&a.call(f)}finally{if(r)throw r.error}}h.removeCookie(""+u+n)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}},e}(),E=function(){function e(e){y.resolve(e),this.cookieNotification=new k,this.cookiePreferences=new w,this.cookieManager=new h(l.prefix,l.type),this.serviceLoader=new j}return e.prototype.init=function(){var e=this;document.addEventListener("DOMContentLoaded",function(){e.cookieNotification.init(),e.cookiePreferences.init()}),this.registerDefaultListeners(),this.checkInitialState()},e.prototype.checkInitialState=function(){var e,n,t=f();try{for(var i=o(t),r=i.next();!r.done;r=i.next()){var a=r.value;this.cookieManager.hasCookiesEnabled(a)&&c.emit(a+"-enabled")}}catch(n){e={error:n}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}},e.prototype.registerDefaultListeners=function(){var e,n,t=this,i=f();console.log(i);var r=function(e){c.on(e+"-enabled",function(){t.serviceLoader.injectServices()}),c.on(e+"-disabled",function(){A.removeCookiesForPurpose(e)})};try{for(var a=o(i),s=a.next();!s.done;s=a.next()){r(s.value)}}catch(n){e={error:n}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}},e.prototype.registerService=function(e,n,o,t){void 0===t&&(t={}),this.serviceLoader.registerService(e,n,o,t)},e.on=function(e,n){return c.on(e,n)},e.create=function(n){return e.instance&&console.warn("Replacing an existing Haven instance. Are you sure this behaviour is intended?"),e.instance=new e(n),e.instance.init(),e.instance},e.getInstance=function(){if(e.instance)return e.instance;console.error("No Haven instance found. Make sure to create a Haven instance before attempting to access it.")},e.removeCookies=function(e,n){var t,i;try{for(var r=o(e),a=r.next();!a.done;a=r.next()){var c=a.value;h.removeCookie(c,n)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}},e}();window.Haven=E,e.CookieManager=h,e.Haven=E,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=haven.umd.min.js.map

@@ -7,4 +7,4 @@ import { HavenService, Purpose } from '../types';

protected static removeGoogleAnalyticsCookies(id: string | undefined): void;
protected static removeSimpleCookies(cookies: string[]): void;
protected static removeSimpleCookies(cookies: (string | RegExp)[]): void;
protected static removeCompositeCookies(cookies: string[], id: string): void;
}

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

export declare const injectGoogleAnalytics: (id: string) => void;
import { HavenServiceOptions } from '../types';
export declare const injectGoogleAnalytics: (id: string, options?: HavenServiceOptions) => void;

@@ -20,3 +20,3 @@ import { Translations } from './translations';

export interface HavenCustomCookies {
[purpose: string]: string[];
[purpose: string]: (string | RegExp)[];
}

@@ -43,3 +43,3 @@ export interface HavenPreferencesOptions {

export interface HavenService {
name: string;
name: HavenServiceName;
purposes: Purpose[];

@@ -51,4 +51,9 @@ title?: string;

required?: boolean;
cookies?: string[];
cookies?: (string | RegExp)[];
options?: HavenServiceOptions;
}
export interface HavenServiceOptions {
anonymizeIp?: boolean;
[option: string]: any;
}
export interface CookieAttributes {

@@ -62,1 +67,2 @@ expires?: number | Date | string;

export declare type Purpose = 'functional' | 'analytics' | 'marketing' | 'preferences' | string;
export declare type HavenServiceName = 'google-analytics' | 'google-tag-manager' | 'facebook-pixel' | string;
{
"name": "@chiiya/haven",
"version": "0.1.2",
"version": "0.2.0",
"author": "Elisha Witte <elishawitte@gmail.com>",

@@ -5,0 +5,0 @@ "license": "MIT",

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