@nationalarchives/frontend 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,(()=>(()=>{"use strict";var e={169:(e,t,i)=>{function n(e){return n="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},n(e)}function o(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function r(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?o(Object(i),!0).forEach((function(t){h(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):o(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function s(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?c(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function u(e,t,i){return t&&l(e.prototype,t),i&&l(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,i){return(t=f(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function f(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}i.d(t,{A:()=>v}),window.TNAFrontendCookies=window.TNAFrontendCookies||null,window.TNAFrontendCookieEvents=window.TNAFrontendCookieEvents||null;var d=function(){return u((function e(){if(a(this,e),h(this,"events",{}),h(this,"oneTimeEvents",{}),window.TNAFrontendCookieEvents)return window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this}),[{key:"on",value:function(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[].concat(s(this.events[e]),[t])}},{key:"once",value:function(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[].concat(s(this.oneTimeEvents[e]),[t])}},{key:"trigger",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.hasOwn(this.events,e)&&this.events[e].forEach((function(e){return e.call(t,i)})),Object.hasOwn(this.oneTimeEvents,e))for(var n=this.oneTimeEvents[e].length-1;n>=0;n--)this.oneTimeEvents[e][n].call(this,i),this.oneTimeEvents[e].splice(n,1)}}])}(),v=function(){return u((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),h(this,"extraPolicies",[]),h(this,"domain",""),h(this,"path",""),h(this,"secure",!0),h(this,"policiesKey",""),h(this,"events",null),h(this,"defaultAge",null);var i=t.extraPolicies,n=void 0===i?[]:i,o=t.domain,r=void 0===o?null:o,s=t.path,c=void 0===s?null:s,l=t.secure,u=void 0===l||l,f=t.policiesKey,v=void 0===f?"cookies_policy":f,p=t.newInstance,y=void 0!==p&&p,m=t.defaultAge,b=void 0===m?31536e3:m;if(y)this.destroyInstance();else if(window.TNAFrontendCookies)return window.TNAFrontendCookies;this.extraPolicies=n,this.domain=null===r?document.documentElement.dataset.tnaCookiesDomain||"":r,this.path=null===c?document.documentElement.dataset.tnaCookiesPath||"/":c,this.secure=u,this.policiesKey=v,this.defaultAge=b,this.events=new d,this.init(),window.TNAFrontendCookies=this}),[{key:"init",value:function(){this.savePolicies(r(r(r({},Object.fromEntries(this.extraPolicies.map((function(e){return[e.toLowerCase(),!1]})))),{},{usage:!1,settings:!1,marketing:!1},this.policies),{},{essential:!0}))}},{key:"destroyInstance",value:function(){window.TNAFrontendCookies=null}},{key:"all",get:function(){var e={};return document.cookie.split("; ").filter((function(e){return e})).forEach((function(t){var i=t.trim().split("=");i[0]&&(e[i[0]]=i[1])})),e}},{key:"policies",get:function(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}},{key:"exists",value:function(e){return Object.hasOwn(this.all,e)}},{key:"hasValue",value:function(e,t){return this.get(e)==t}},{key:"get",value:function(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}},{key:"set",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.maxAge,o=void 0===n?this.defaultAge:n,r=i.sameSite,s=void 0===r?"Lax":r,c=i.domain,a=void 0===c?this.domain:c,l=i.path,u=void 0===l?this.path:l,h=i.secure,f=void 0===h?this.secure:h,d=i.session,v=void 0!==d&&d;if(e){var p="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t),";").concat(a?" domain=".concat(a,"; "):""," samesite=").concat(s,"; path=").concat(u).concat(v?"":"; max-age=".concat(o)).concat(f?"; secure":"");document.cookie=p,this.events.trigger("setCookie",{key:e,value:t,maxAge:o,path:u,sameSite:s,domain:a,secure:f,session:v,cookie:p})}}},{key:"delete",value:function(e){var t={maxAge:-1,path:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",domain:(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||void 0};this.set(e,"",t),this.events.trigger("deleteCookie",r({key:e},t))}},{key:"deleteAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Object.keys(this.all).forEach((function(n){e.delete(n,t,i)})),this.events.trigger("deleteAllCookies",{path:t,domain:i})}},{key:"acceptPolicy",value:function(e){this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",h({},e,!0))}},{key:"rejectPolicy",value:function(e){this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",h({},e,!1))}},{key:"setPolicy",value:function(e,t){"essential"!==e&&(this.savePolicies(r(r({},this.policies),{},h(h({},e,t),"essential",!0))),this.events.trigger("changePolicy",h({},e,t)))}},{key:"acceptAllPolicies",value:function(){var e=Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!0]})));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"rejectAllPolicies",value:function(){var e=r(r({},Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!1]})))),{},{essential:!0});this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"savePolicies",value:function(e){this.set(this.policiesKey,JSON.stringify(e),{maxAge:31536e3})}},{key:"isPolicyAccepted",value:function(e){return Object.hasOwn(this.policies,e)?!0===this.policies[e]:null}},{key:"on",value:function(e,t){this.events.on(e,t)}},{key:"once",value:function(e,t){this.events.once(e,t)}}])}()}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,i),r.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};i.r(n),i.d(n,{CookieBanner:()=>a,Cookies:()=>o.A});var o=i(169);function r(e){return r="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},r(e)}function s(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}function c(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}var a=function(){return e=function e(t){var i=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.$acceptButton=t&&t.querySelector('[value="accept"]'),this.$rejectButton=t&&t.querySelector('[value="reject"]'),this.$prompt=t&&t.querySelector(".tna-cookie-banner__message--prompt"),this.$acceptedMessage=t&&t.querySelector(".tna-cookie-banner__message--accepted"),this.$rejectedMessage=t&&t.querySelector(".tna-cookie-banner__message--rejected"),this.$closeButtons=t&&t.querySelectorAll('[value="close"]'),this.$module&&this.$acceptButton&&this.$rejectButton&&this.$prompt&&this.$acceptedMessage&&this.$rejectedMessage&&this.$closeButtons){var n=(this.$module.dataset.policies||"").split(",").filter((function(e){return e})).map((function(e){return e.trim()})),r=this.$module.dataset.domain||void 0,s=this.$module.dataset.path||void 0,c=this.$module.dataset.secure||void 0,a=this.$module.dataset.policiesKey||void 0;this.cookies=new o.A({extraPolicies:n,domain:r,path:s,secure:c,policiesKey:a,newInstance:!0}),this.cookiePreferencesSet=this.$module.dataset.preferencesKey||"cookie_preferences_set",this.cookies.hasValue(this.cookiePreferencesSet,"true")||(this.$module.removeAttribute("hidden"),this.$acceptButton.addEventListener("click",(function(){return i.accept()})),this.$rejectButton.addEventListener("click",(function(){return i.reject()})))}},(t=[{key:"accept",value:function(){this.$prompt.setAttribute("hidden",""),this.complete(),this.$acceptedMessage.removeAttribute("hidden"),this.$acceptedMessage.focus(),this.$acceptedMessage.setAttribute("tabindex","-1"),this.cookies.acceptAllPolicies()}},{key:"reject",value:function(){this.$prompt.setAttribute("hidden",""),this.complete(),this.$rejectedMessage.removeAttribute("hidden"),this.$rejectedMessage.focus(),this.$rejectedMessage.setAttribute("tabindex","-1"),this.cookies.rejectAllPolicies()}},{key:"complete",value:function(){var e=this;this.cookies.set(this.cookiePreferencesSet,!0),this.$closeButtons.forEach((function(t){t.addEventListener("click",(function(){return e.close()}))}))}},{key:"close",value:function(){this.$module.setAttribute("hidden","")}}])&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();return n})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,(()=>(()=>{"use strict";var e={169:(e,t,i)=>{function n(e){return n="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},n(e)}function o(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function r(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?o(Object(i),!0).forEach((function(t){h(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):o(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function s(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?c(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function u(e,t,i){return t&&l(e.prototype,t),i&&l(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,i){return(t=f(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function f(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}i.d(t,{A:()=>v}),window.TNAFrontendCookies=window.TNAFrontendCookies||null,window.TNAFrontendCookieEvents=window.TNAFrontendCookieEvents||null;var d=function(){return u((function e(){if(a(this,e),h(this,"events",{}),h(this,"oneTimeEvents",{}),window.TNAFrontendCookieEvents)return window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this}),[{key:"on",value:function(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[].concat(s(this.events[e]),[t])}},{key:"once",value:function(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[].concat(s(this.oneTimeEvents[e]),[t])}},{key:"trigger",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.hasOwn(this.events,e)&&this.events[e].forEach((function(e){return e.call(t,i)})),Object.hasOwn(this.oneTimeEvents,e))for(var n=this.oneTimeEvents[e].length-1;n>=0;n--)this.oneTimeEvents[e][n].call(this,i),this.oneTimeEvents[e].splice(n,1)}}])}(),v=function(){return u((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),h(this,"extraPolicies",[]),h(this,"domain",""),h(this,"path",""),h(this,"secure",!0),h(this,"policiesKey",""),h(this,"events",null),h(this,"defaultAge",null),h(this,"validPoliciesOnInit",!1);var i=t.extraPolicies,n=void 0===i?[]:i,o=t.domain,r=void 0===o?null:o,s=t.path,c=void 0===s?null:s,l=t.secure,u=void 0===l||l,f=t.policiesKey,v=void 0===f?"cookies_policy":f,p=t.newInstance,y=void 0!==p&&p,m=t.defaultAge,b=void 0===m?31536e3:m;if(y)this.destroyInstance();else if(window.TNAFrontendCookies)return window.TNAFrontendCookies;this.extraPolicies=n,this.domain=null===r?document.documentElement.dataset.tnaCookiesDomain||"":r,this.path=null===c?document.documentElement.dataset.tnaCookiesPath||"/":c,this.secure=u,this.policiesKey=v,this.defaultAge=b,this.events=new d,this.validPoliciesOnInit=Object.keys(this.policies).length>0,this.init(),window.TNAFrontendCookies=this}),[{key:"init",value:function(){this.savePolicies(r(r(r({},Object.fromEntries(this.extraPolicies.map((function(e){return[e.toLowerCase(),!1]})))),{},{usage:!1,settings:!1,marketing:!1},this.policies),{},{essential:!0}))}},{key:"destroyInstance",value:function(){window.TNAFrontendCookies=null}},{key:"all",get:function(){var e={};return document.cookie.split("; ").filter((function(e){return e})).forEach((function(t){var i=t.trim().split("=");i[0]&&(e[i[0]]=i[1])})),e}},{key:"policies",get:function(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}},{key:"exists",value:function(e){return Object.hasOwn(this.all,e)}},{key:"hasValue",value:function(e,t){return this.get(e)==t}},{key:"get",value:function(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}},{key:"set",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i.maxAge,o=void 0===n?this.defaultAge:n,r=i.sameSite,s=void 0===r?"Lax":r,c=i.domain,a=void 0===c?this.domain:c,l=i.path,u=void 0===l?this.path:l,h=i.secure,f=void 0===h?this.secure:h,d=i.session,v=void 0!==d&&d;if(e){var p="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t),";").concat(a?" domain=".concat(a,"; "):""," samesite=").concat(s,"; path=").concat(u).concat(v?"":"; max-age=".concat(o)).concat(f?"; secure":"");document.cookie=p,this.events.trigger("setCookie",{key:e,value:t,maxAge:o,path:u,sameSite:s,domain:a,secure:f,session:v,cookie:p})}}},{key:"delete",value:function(e){var t={maxAge:-1,path:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",domain:(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||void 0};this.set(e,"",t),this.events.trigger("deleteCookie",r({key:e},t))}},{key:"deleteAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Object.keys(this.all).forEach((function(n){e.delete(n,t,i)})),this.events.trigger("deleteAllCookies",{path:t,domain:i})}},{key:"acceptPolicy",value:function(e){this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",h({},e,!0))}},{key:"rejectPolicy",value:function(e){this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",h({},e,!1))}},{key:"setPolicy",value:function(e,t){"essential"!==e&&(this.savePolicies(r(r({},this.policies),{},h(h({},e,t),"essential",!0))),this.events.trigger("changePolicy",h({},e,t)))}},{key:"acceptAllPolicies",value:function(){var e=Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!0]})));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"rejectAllPolicies",value:function(){var e=r(r({},Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!1]})))),{},{essential:!0});this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"savePolicies",value:function(e){this.set(this.policiesKey,JSON.stringify(e))}},{key:"isPolicyAccepted",value:function(e){return Object.hasOwn(this.policies,e)?!0===this.policies[e]:null}},{key:"on",value:function(e,t){this.events.on(e,t)}},{key:"once",value:function(e,t){this.events.once(e,t)}}])}()}},t={};function i(n){var o=t[n];if(void 0!==o)return o.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,i),r.exports}i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};i.r(n),i.d(n,{CookieBanner:()=>a,Cookies:()=>o.A});var o=i(169);function r(e){return r="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},r(e)}function s(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}function c(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}var a=function(){return e=function e(t){var i=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.$acceptButton=t&&t.querySelector('[value="accept"]'),this.$rejectButton=t&&t.querySelector('[value="reject"]'),this.$prompt=t&&t.querySelector(".tna-cookie-banner__message--prompt"),this.$acceptedMessage=t&&t.querySelector(".tna-cookie-banner__message--accepted"),this.$rejectedMessage=t&&t.querySelector(".tna-cookie-banner__message--rejected"),this.$closeButtons=t&&t.querySelectorAll('[value="close"]'),this.$module&&this.$acceptButton&&this.$rejectButton&&this.$prompt&&this.$acceptedMessage&&this.$rejectedMessage&&this.$closeButtons){var n=(this.$module.dataset.policies||"").split(",").filter((function(e){return e})).map((function(e){return e.trim()})),r=this.$module.dataset.domain||void 0,s=this.$module.dataset.path||void 0,c=this.$module.dataset.secure||void 0,a=this.$module.dataset.policiesKey||void 0;this.cookies=new o.A({extraPolicies:n,domain:r,path:s,secure:c,policiesKey:a,newInstance:!0}),this.cookiePreferencesSet=this.$module.dataset.preferencesKey||"cookie_preferences_set",this.cookies.hasValue(this.cookiePreferencesSet,"true")&&this.cookies.validPoliciesOnInit||(this.$module.removeAttribute("hidden"),this.$acceptButton.addEventListener("click",(function(){return i.accept()})),this.$rejectButton.addEventListener("click",(function(){return i.reject()})))}},(t=[{key:"accept",value:function(){this.$prompt.setAttribute("hidden",""),this.complete(),this.$acceptedMessage.removeAttribute("hidden"),this.$acceptedMessage.focus(),this.$acceptedMessage.setAttribute("tabindex","-1"),this.cookies.acceptAllPolicies()}},{key:"reject",value:function(){this.$prompt.setAttribute("hidden",""),this.complete(),this.$rejectedMessage.removeAttribute("hidden"),this.$rejectedMessage.focus(),this.$rejectedMessage.setAttribute("tabindex","-1"),this.cookies.rejectAllPolicies()}},{key:"complete",value:function(){var e=this;this.cookies.set(this.cookiePreferencesSet,!0),this.$closeButtons.forEach((function(t){t.addEventListener("click",(function(){return e.close()}))}))}},{key:"close",value:function(){this.$module.setAttribute("hidden","")}}])&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();return n})()));
2
2
  //# sourceMappingURL=cookie-banner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components/cookie-banner/cookie-banner.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,IAEzBD,EAAkB,YAAIC,GACvB,CATD,CASGK,MAAM,I,+zECTTC,OAAOC,mBAAqBD,OAAOC,oBAAsB,KACzDD,OAAOE,wBAA0BF,OAAOE,yBAA2B,KAE5D,IAAMC,EAAkB,WAW7B,OAAAC,GAPA,SAAAD,IACE,GADYE,EAAA,KAAAF,GAAAG,EAAA,cAHL,CAAC,GAACA,EAAA,qBACK,CAAC,GAGXN,OAAOE,wBACT,OAAOF,OAAOE,wBAEhBF,OAAOE,wBAA0BK,IACnC,GAEA,EAAAC,IAAA,KAAAC,MAKA,SAAGC,EAAOC,GACHC,OAAOC,OAAON,KAAKO,OAAQJ,KAC9BH,KAAKO,OAAOJ,GAAS,IAEvBH,KAAKO,OAAOJ,GAAS,GAAHK,OAAAC,EAAOT,KAAKO,OAAOJ,IAAM,CAAEC,GAC/C,GAAC,CAAAH,IAAA,OAAAC,MAED,SAAKC,EAAOC,GACLC,OAAOC,OAAON,KAAKU,cAAeP,KACrCH,KAAKU,cAAcP,GAAS,IAE9BH,KAAKU,cAAcP,GAAS,GAAHK,OAAAC,EAAOT,KAAKU,cAAcP,IAAM,CAAEC,GAC7D,GAEA,CAAAH,IAAA,UAA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ack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/cookie-banner/cookie-banner.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","window.TNAFrontendCookies = window.TNAFrontendCookies || null;\nwindow.TNAFrontendCookieEvents = window.TNAFrontendCookieEvents || null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n\n constructor() {\n if (window.TNAFrontendCookieEvents) {\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n if (!Object.hasOwn(this.events, event)) {\n this.events[event] = [];\n }\n this.events[event] = [...this.events[event], callback];\n }\n\n once(event, callback) {\n if (!Object.hasOwn(this.oneTimeEvents, event)) {\n this.oneTimeEvents[event] = [];\n }\n this.oneTimeEvents[event] = [...this.oneTimeEvents[event], callback];\n }\n\n /** @protected */\n trigger(event, data = {}) {\n if (Object.hasOwn(this.events, event)) {\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n for (let i = this.oneTimeEvents[event].length - 1; i >= 0; i--) {\n const eventToTrigger = this.oneTimeEvents[event][i];\n eventToTrigger.call(this, data);\n this.oneTimeEvents[event].splice(i, 1);\n }\n }\n }\n}\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n extraPolicies = [];\n /** @protected */\n domain = \"\";\n /** @protected */\n path = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n\n /**\n * Create a cookie handler.\n * @param {String} [options.extraPolicies=[]] - The extra cookie policies to manage in addition to essential, settings, usage and marketing.\n * @param {String} [options.domain=\"\"] - The domain to register the cookie with.\n * @param {String} [options.path=\"\"] - The domain to register the cookie with.\n * @param {String} [options.secure=true] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey=\"cookies_policy\"] - The name of the cookie.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {String} [options.defaultAge=31536000] - The default age of non-session cookies.\n */\n constructor(options = {}) {\n const {\n extraPolicies = [],\n domain = null,\n path = null,\n secure = true,\n policiesKey = \"cookies_policy\",\n newInstance = false,\n defaultAge = 31536000, // 365 days\n } = options;\n if (newInstance) {\n this.destroyInstance();\n } else if (window.TNAFrontendCookies) {\n return window.TNAFrontendCookies;\n }\n this.extraPolicies = extraPolicies;\n if (domain === null) {\n this.domain = document.documentElement.dataset.tnaCookiesDomain || \"\";\n } else {\n this.domain = domain;\n }\n if (path === null) {\n this.path = document.documentElement.dataset.tnaCookiesPath || \"/\";\n } else {\n this.path = path;\n }\n this.secure = secure;\n this.policiesKey = policiesKey;\n this.defaultAge = defaultAge;\n this.events = new CookieEventHandler();\n this.init();\n window.TNAFrontendCookies = this;\n }\n\n /** @protected */\n init() {\n this.savePolicies({\n ...Object.fromEntries(\n this.extraPolicies.map((k) => [k.toLowerCase(), false]),\n ),\n usage: false,\n settings: false,\n marketing: false,\n ...this.policies,\n essential: true,\n });\n }\n\n destroyInstance() {\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((x) => x)\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n if (parts[0]) {\n deserialised[parts[0]] = parts[1];\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n } catch (e) {\n return {};\n }\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {String} key - The cookie name.\n * @returns {Boolean}\n */\n exists(key) {\n return Object.hasOwn(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) == value;\n }\n\n /**\n * Get a cookie.\n * @param {String} key - The cookie name.\n * @returns {String|Number|Boolean}\n */\n get(key) {\n return this.exists(key) ? decodeURIComponent(this.all[key]) : null;\n }\n\n /**\n * Set a cookie.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The cookie value.\n * @param {Object} options\n * @param {Number} [options.maxAge=this.defaultAge] - The maximum age of the cookie in seconds.\n * @param {String} [options.path=/] - The path to register the cookie for.\n * @param {String} [options.sameSite=Lax] - The sameSite attribute.\n * @param {String} [options.domain=this.domain] - The domain to register the cookie with.\n * @param {String} [options.path=this.path] - The path to register the cookie with.\n * @param {String} [options.secure=this.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.session=false] - Set a session cookie.\n */\n set(key, value, options = {}) {\n const {\n maxAge = this.defaultAge,\n sameSite = \"Lax\",\n domain = this.domain,\n path = this.path,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)};${\n domain ? ` domain=${domain}; ` : \"\"\n } samesite=${sameSite}; path=${path}${!session ? `; max-age=${maxAge}` : \"\"}${\n secure ? \"; secure\" : \"\"\n }`;\n document.cookie = cookie;\n this.events.trigger(\"setCookie\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n }\n\n /**\n * Delete a cookie.\n * @param {String} key - The cookie name.\n * @param {String} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\", domain = null) {\n const options = { maxAge: -1, path, domain: domain || undefined };\n this.set(key, \"\", options);\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = null) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.events.trigger(\"deleteAllCookies\", { path, domain });\n }\n\n /**\n * Accept a policy.\n * @param {String} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.setPolicy(policy, true);\n this.events.trigger(\"acceptPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: true });\n }\n\n /**\n * Reject a policy.\n * @param {String} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n this.setPolicy(policy, false);\n this.events.trigger(\"rejectPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: false });\n }\n\n /**\n * Set a policy.\n * @param {String} policy - The name of the policy.\n * @param {Boolean} accepted - Whether the policy is accepted or not.\n */\n setPolicy(policy, accepted) {\n if (policy === \"essential\") {\n return;\n }\n this.savePolicies({\n ...this.policies,\n [policy]: accepted,\n essential: true,\n });\n this.events.trigger(\"changePolicy\", { [policy]: accepted });\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), true]),\n );\n this.savePolicies(allPolicies);\n this.events.trigger(\"acceptAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), false]),\n ),\n essential: true,\n };\n this.savePolicies(allPolicies);\n this.events.trigger(\"rejectAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Commit policy preferences to the browser.\n * @param {object} policies - The policies to commit.\n */\n savePolicies(policies) {\n this.set(this.policiesKey, JSON.stringify(policies), {\n maxAge: 60 * 60 * 24 * 365,\n });\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {String} policy - The name of the policy.\n * @returns {Boolean}\n */\n isPolicyAccepted(policy) {\n return Object.hasOwn(this.policies, policy)\n ? this.policies[policy] === true\n : null;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n this.events.on(event, callback);\n }\n\n /**\n * Add a one-time event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n once(event, callback) {\n this.events.once(event, callback);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Cookies from \"../../lib/cookies.mjs\";\n\nexport { Cookies };\n\nexport class CookieBanner {\n constructor($module) {\n this.$module = $module;\n this.$acceptButton = $module && $module.querySelector('[value=\"accept\"]');\n this.$rejectButton = $module && $module.querySelector('[value=\"reject\"]');\n this.$prompt =\n $module && $module.querySelector(\".tna-cookie-banner__message--prompt\");\n this.$acceptedMessage =\n $module && $module.querySelector(\".tna-cookie-banner__message--accepted\");\n this.$rejectedMessage =\n $module && $module.querySelector(\".tna-cookie-banner__message--rejected\");\n this.$closeButtons = $module && $module.querySelectorAll('[value=\"close\"]');\n\n if (\n !this.$module ||\n !this.$acceptButton ||\n !this.$rejectButton ||\n !this.$prompt ||\n !this.$acceptedMessage ||\n !this.$rejectedMessage ||\n !this.$closeButtons\n ) {\n return;\n }\n\n const policies = this.$module.dataset.policies || \"\";\n const extraPolicies = policies\n .split(\",\")\n .filter((x) => x)\n .map((policy) => policy.trim());\n const domain = this.$module.dataset.domain || undefined;\n const path = this.$module.dataset.path || undefined;\n const secure = this.$module.dataset.secure || undefined;\n const policiesKey = this.$module.dataset.policiesKey || undefined;\n\n this.cookies = new Cookies({\n extraPolicies,\n domain,\n path,\n secure,\n policiesKey,\n newInstance: true,\n });\n\n this.cookiePreferencesSet =\n this.$module.dataset.preferencesKey || \"cookie_preferences_set\";\n const cookiePreferencesSet = this.cookies.hasValue(\n this.cookiePreferencesSet,\n \"true\",\n );\n\n if (!cookiePreferencesSet) {\n this.$module.removeAttribute(\"hidden\");\n\n this.$acceptButton.addEventListener(\"click\", () => this.accept());\n this.$rejectButton.addEventListener(\"click\", () => this.reject());\n }\n }\n\n accept() {\n this.$prompt.setAttribute(\"hidden\", \"\");\n this.complete();\n this.$acceptedMessage.removeAttribute(\"hidden\");\n this.$acceptedMessage.focus();\n this.$acceptedMessage.setAttribute(\"tabindex\", \"-1\");\n this.cookies.acceptAllPolicies();\n }\n\n reject() {\n this.$prompt.setAttribute(\"hidden\", \"\");\n this.complete();\n this.$rejectedMessage.removeAttribute(\"hidden\");\n this.$rejectedMessage.focus();\n this.$rejectedMessage.setAttribute(\"tabindex\", \"-1\");\n this.cookies.rejectAllPolicies();\n }\n\n complete() {\n this.cookies.set(this.cookiePreferencesSet, true);\n this.$closeButtons.forEach(($closeButton) => {\n $closeButton.addEventListener(\"click\", () => this.close());\n });\n }\n\n close() {\n this.$module.setAttribute(\"hidden\", \"\");\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","window","TNAFrontendCookies","TNAFrontendCookieEvents","CookieEventHandler","_createClass","_classCallCheck","_defineProperty","this","key","value","event","callback","Object","hasOwn","events","concat","_toConsumableArray","oneTimeEvents","_this","data","arguments","length","undefined","forEach","eventToTrigger","call","i","splice","Cookies","options","_options$extraPolicie","extraPolicies","_options$domain","domain","_options$path","path","_options$secure","secure","_options$policiesKey","policiesKey","_options$newInstance","newInstance","_options$defaultAge","defaultAge","destroyInstance","document","documentElement","dataset","tnaCookiesDomain","tnaCookiesPath","init","savePolicies","_objectSpread","fromEntries","map","k","toLowerCase","usage","settings","marketing","policies","essential","get","deserialised","cookie","split","filter","x","parts","trim","JSON","parse","e","all","exists","decodeURIComponent","_options$maxAge","maxAge","_options$sameSite","sameSite","_options$domain2","_options$path2","_options$secure2","_options$session","session","encodeURIComponent","trigger","set","_this2","keys","policy","setPolicy","accepted","allPolicies","stringify","on","once","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","CookieBanner","$module","$acceptButton","querySelector","$rejectButton","$prompt","$acceptedMessage","$rejectedMessage","$closeButtons","querySelectorAll","cookies","cookiePreferencesSet","preferencesKey","hasValue","removeAttribute","addEventListener","accept","reject","setAttribute","complete","focus","acceptAllPolicies","rejectAllPolicies","$closeButton","close"],"sourceRoot":""}
1
+ {"version":3,"file":"components/cookie-banner/cookie-banner.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD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G,QAAQa,gBAAgB,UAE7B1H,KAAK8G,cAAca,iBAAiB,SAAS,kBAAMhH,EAAKiH,QAAQ,IAChE5H,KAAKgH,cAAcW,iBAAiB,SAAS,kBAAMhH,EAAKkH,QAAQ,IAhClE,CAkCF,G,EAAC,EAAA5H,IAAA,SAAAC,MAED,WACEF,KAAKiH,QAAQa,aAAa,SAAU,IACpC9H,KAAK+H,WACL/H,KAAKkH,iBAAiBQ,gBAAgB,UACtC1H,KAAKkH,iBAAiBc,QACtBhI,KAAKkH,iBAAiBY,aAAa,WAAY,MAC/C9H,KAAKsH,QAAQW,mBACf,GAAC,CAAAhI,IAAA,SAAAC,MAED,WACEF,KAAKiH,QAAQa,aAAa,SAAU,IACpC9H,KAAK+H,WACL/H,KAAKmH,iBAAiBO,gBAAgB,UACtC1H,KAAKmH,iBAAiBa,QACtBhI,KAAKmH,iBAAiBW,aAAa,WAAY,MAC/C9H,KAAKsH,QAAQY,mBACf,GAAC,CAAAjI,IAAA,WAAAC,MAED,WAAW,IAAAiF,EAAA,KACTnF,KAAKsH,QAAQpC,IAAIlF,KAAKuH,sBAAsB,GAC5CvH,KAAKoH,cAAcpG,SAAQ,SAACmH,GAC1BA,EAAaR,iBAAiB,SAAS,kBAAMxC,EAAKiD,OAAO,GAC3D,GACF,GAAC,CAAAnI,IAAA,QAAAC,MAED,WACEF,KAAK6G,QAAQiB,aAAa,SAAU,GACtC,M,6EAAC,CAtFsB,G","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/cookie-banner/cookie-banner.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","window.TNAFrontendCookies = window.TNAFrontendCookies || null;\nwindow.TNAFrontendCookieEvents = window.TNAFrontendCookieEvents || null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n\n constructor() {\n if (window.TNAFrontendCookieEvents) {\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n if (!Object.hasOwn(this.events, event)) {\n this.events[event] = [];\n }\n this.events[event] = [...this.events[event], callback];\n }\n\n once(event, callback) {\n if (!Object.hasOwn(this.oneTimeEvents, event)) {\n this.oneTimeEvents[event] = [];\n }\n this.oneTimeEvents[event] = [...this.oneTimeEvents[event], callback];\n }\n\n /** @protected */\n trigger(event, data = {}) {\n if (Object.hasOwn(this.events, event)) {\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n for (let i = this.oneTimeEvents[event].length - 1; i >= 0; i--) {\n const eventToTrigger = this.oneTimeEvents[event][i];\n eventToTrigger.call(this, data);\n this.oneTimeEvents[event].splice(i, 1);\n }\n }\n }\n}\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n extraPolicies = [];\n /** @protected */\n domain = \"\";\n /** @protected */\n path = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n /** @protected */\n validPoliciesOnInit = false;\n\n /**\n * Create a cookie handler.\n * @param {String} [options.extraPolicies=[]] - The extra cookie policies to manage in addition to essential, settings, usage and marketing.\n * @param {String} [options.domain=\"\"] - The domain to register the cookie with.\n * @param {String} [options.path=\"\"] - The domain to register the cookie with.\n * @param {String} [options.secure=true] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey=\"cookies_policy\"] - The name of the cookie.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {String} [options.defaultAge=31536000] - The default age of non-session cookies.\n */\n constructor(options = {}) {\n const {\n extraPolicies = [],\n domain = null,\n path = null,\n secure = true,\n policiesKey = \"cookies_policy\",\n newInstance = false,\n defaultAge = 31536000, // 365 days\n } = options;\n if (newInstance) {\n this.destroyInstance();\n } else if (window.TNAFrontendCookies) {\n return window.TNAFrontendCookies;\n }\n this.extraPolicies = extraPolicies;\n if (domain === null) {\n this.domain = document.documentElement.dataset.tnaCookiesDomain || \"\";\n } else {\n this.domain = domain;\n }\n if (path === null) {\n this.path = document.documentElement.dataset.tnaCookiesPath || \"/\";\n } else {\n this.path = path;\n }\n this.secure = secure;\n this.policiesKey = policiesKey;\n this.defaultAge = defaultAge;\n this.events = new CookieEventHandler();\n this.validPoliciesOnInit = Object.keys(this.policies).length > 0;\n this.init();\n window.TNAFrontendCookies = this;\n }\n\n /** @protected */\n init() {\n this.savePolicies({\n ...Object.fromEntries(\n this.extraPolicies.map((k) => [k.toLowerCase(), false]),\n ),\n usage: false,\n settings: false,\n marketing: false,\n ...this.policies,\n essential: true,\n });\n }\n\n destroyInstance() {\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((x) => x)\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n if (parts[0]) {\n deserialised[parts[0]] = parts[1];\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n } catch (e) {\n return {};\n }\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {String} key - The cookie name.\n * @returns {Boolean}\n */\n exists(key) {\n return Object.hasOwn(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) == value;\n }\n\n /**\n * Get a cookie.\n * @param {String} key - The cookie name.\n * @returns {String|Number|Boolean}\n */\n get(key) {\n return this.exists(key) ? decodeURIComponent(this.all[key]) : null;\n }\n\n /**\n * Set a cookie.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The cookie value.\n * @param {Object} options\n * @param {Number} [options.maxAge=this.defaultAge] - The maximum age of the cookie in seconds.\n * @param {String} [options.path=/] - The path to register the cookie for.\n * @param {String} [options.sameSite=Lax] - The sameSite attribute.\n * @param {String} [options.domain=this.domain] - The domain to register the cookie with.\n * @param {String} [options.path=this.path] - The path to register the cookie with.\n * @param {String} [options.secure=this.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.session=false] - Set a session cookie.\n */\n set(key, value, options = {}) {\n const {\n maxAge = this.defaultAge,\n sameSite = \"Lax\",\n domain = this.domain,\n path = this.path,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)};${\n domain ? ` domain=${domain}; ` : \"\"\n } samesite=${sameSite}; path=${path}${!session ? `; max-age=${maxAge}` : \"\"}${\n secure ? \"; secure\" : \"\"\n }`;\n document.cookie = cookie;\n this.events.trigger(\"setCookie\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n }\n\n /**\n * Delete a cookie.\n * @param {String} key - The cookie name.\n * @param {String} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\", domain = null) {\n const options = { maxAge: -1, path, domain: domain || undefined };\n this.set(key, \"\", options);\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = null) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.events.trigger(\"deleteAllCookies\", { path, domain });\n }\n\n /**\n * Accept a policy.\n * @param {String} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.setPolicy(policy, true);\n this.events.trigger(\"acceptPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: true });\n }\n\n /**\n * Reject a policy.\n * @param {String} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n this.setPolicy(policy, false);\n this.events.trigger(\"rejectPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: false });\n }\n\n /**\n * Set a policy.\n * @param {String} policy - The name of the policy.\n * @param {Boolean} accepted - Whether the policy is accepted or not.\n */\n setPolicy(policy, accepted) {\n if (policy === \"essential\") {\n return;\n }\n this.savePolicies({\n ...this.policies,\n [policy]: accepted,\n essential: true,\n });\n this.events.trigger(\"changePolicy\", { [policy]: accepted });\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), true]),\n );\n this.savePolicies(allPolicies);\n this.events.trigger(\"acceptAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), false]),\n ),\n essential: true,\n };\n this.savePolicies(allPolicies);\n this.events.trigger(\"rejectAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Commit policy preferences to the browser.\n * @param {object} policies - The policies to commit.\n */\n savePolicies(policies) {\n this.set(this.policiesKey, JSON.stringify(policies));\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {String} policy - The name of the policy.\n * @returns {Boolean}\n */\n isPolicyAccepted(policy) {\n return Object.hasOwn(this.policies, policy)\n ? this.policies[policy] === true\n : null;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n this.events.on(event, callback);\n }\n\n /**\n * Add a one-time event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n once(event, callback) {\n this.events.once(event, callback);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Cookies from \"../../lib/cookies.mjs\";\n\nexport { Cookies };\n\nexport class CookieBanner {\n constructor($module) {\n this.$module = $module;\n this.$acceptButton = $module && $module.querySelector('[value=\"accept\"]');\n this.$rejectButton = $module && $module.querySelector('[value=\"reject\"]');\n this.$prompt =\n $module && $module.querySelector(\".tna-cookie-banner__message--prompt\");\n this.$acceptedMessage =\n $module && $module.querySelector(\".tna-cookie-banner__message--accepted\");\n this.$rejectedMessage =\n $module && $module.querySelector(\".tna-cookie-banner__message--rejected\");\n this.$closeButtons = $module && $module.querySelectorAll('[value=\"close\"]');\n\n if (\n !this.$module ||\n !this.$acceptButton ||\n !this.$rejectButton ||\n !this.$prompt ||\n !this.$acceptedMessage ||\n !this.$rejectedMessage ||\n !this.$closeButtons\n ) {\n return;\n }\n\n const policies = this.$module.dataset.policies || \"\";\n const extraPolicies = policies\n .split(\",\")\n .filter((x) => x)\n .map((policy) => policy.trim());\n const domain = this.$module.dataset.domain || undefined;\n const path = this.$module.dataset.path || undefined;\n const secure = this.$module.dataset.secure || undefined;\n const policiesKey = this.$module.dataset.policiesKey || undefined;\n\n this.cookies = new Cookies({\n extraPolicies,\n domain,\n path,\n secure,\n policiesKey,\n newInstance: true,\n });\n\n this.cookiePreferencesSet =\n this.$module.dataset.preferencesKey || \"cookie_preferences_set\";\n const cookiePreferencesSet = this.cookies.hasValue(\n this.cookiePreferencesSet,\n \"true\",\n );\n\n if (!cookiePreferencesSet || !this.cookies.validPoliciesOnInit) {\n this.$module.removeAttribute(\"hidden\");\n\n this.$acceptButton.addEventListener(\"click\", () => this.accept());\n this.$rejectButton.addEventListener(\"click\", () => this.reject());\n }\n }\n\n accept() {\n this.$prompt.setAttribute(\"hidden\", \"\");\n this.complete();\n this.$acceptedMessage.removeAttribute(\"hidden\");\n this.$acceptedMessage.focus();\n this.$acceptedMessage.setAttribute(\"tabindex\", \"-1\");\n this.cookies.acceptAllPolicies();\n }\n\n reject() {\n this.$prompt.setAttribute(\"hidden\", \"\");\n this.complete();\n this.$rejectedMessage.removeAttribute(\"hidden\");\n this.$rejectedMessage.focus();\n this.$rejectedMessage.setAttribute(\"tabindex\", \"-1\");\n this.cookies.rejectAllPolicies();\n }\n\n complete() {\n this.cookies.set(this.cookiePreferencesSet, true);\n this.$closeButtons.forEach(($closeButton) => {\n $closeButton.addEventListener(\"click\", () => this.close());\n });\n }\n\n close() {\n this.$module.setAttribute(\"hidden\", \"\");\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","window","TNAFrontendCookies","TNAFrontendCookieEvents","CookieEventHandler","_createClass","_classCallCheck","_defineProperty","this","key","value","event","callback","Object","hasOwn","events","concat","_toConsumableArray","oneTimeEvents","_this","data","arguments","length","undefined","forEach","eventToTrigger","call","i","splice","Cookies","options","_options$extraPolicie","extraPolicies","_options$domain","domain","_options$path","path","_options$secure","secure","_options$policiesKey","policiesKey","_options$newInstance","newInstance","_options$defaultAge","defaultAge","destroyInstance","document","documentElement","dataset","tnaCookiesDomain","tnaCookiesPath","validPoliciesOnInit","keys","policies","init","savePolicies","_objectSpread","fromEntries","map","k","toLowerCase","usage","settings","marketing","essential","get","deserialised","cookie","split","filter","x","parts","trim","JSON","parse","e","all","exists","decodeURIComponent","_options$maxAge","maxAge","_options$sameSite","sameSite","_options$domain2","_options$path2","_options$secure2","_options$session","session","encodeURIComponent","trigger","set","_this2","policy","setPolicy","accepted","allPolicies","stringify","on","once","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","CookieBanner","$module","$acceptButton","querySelector","$rejectButton","$prompt","$acceptedMessage","$rejectedMessage","$closeButtons","querySelectorAll","cookies","cookiePreferencesSet","preferencesKey","hasValue","removeAttribute","addEventListener","accept","reject","setAttribute","complete","focus","acceptAllPolicies","rejectAllPolicies","$closeButton","close"],"sourceRoot":""}
@@ -53,7 +53,7 @@ export class CookieBanner {
53
53
  "true",
54
54
  );
55
55
 
56
- if (!cookiePreferencesSet) {
56
+ if (!cookiePreferencesSet || !this.cookies.validPoliciesOnInit) {
57
57
  this.$module.removeAttribute("hidden");
58
58
 
59
59
  this.$acceptButton.addEventListener("click", () => this.accept());
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,(()=>(()=>{"use strict";var e={169:(e,t,n)=>{function o(e){return o="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},o(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,f(o.key),o)}}function u(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}n.d(t,{A:()=>m}),window.TNAFrontendCookies=window.TNAFrontendCookies||null,window.TNAFrontendCookieEvents=window.TNAFrontendCookieEvents||null;var v=function(){return u((function e(){if(a(this,e),h(this,"events",{}),h(this,"oneTimeEvents",{}),window.TNAFrontendCookieEvents)return window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this}),[{key:"on",value:function(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[].concat(s(this.events[e]),[t])}},{key:"once",value:function(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[].concat(s(this.oneTimeEvents[e]),[t])}},{key:"trigger",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.hasOwn(this.events,e)&&this.events[e].forEach((function(e){return e.call(t,n)})),Object.hasOwn(this.oneTimeEvents,e))for(var o=this.oneTimeEvents[e].length-1;o>=0;o--)this.oneTimeEvents[e][o].call(this,n),this.oneTimeEvents[e].splice(o,1)}}])}(),m=function(){return u((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),h(this,"extraPolicies",[]),h(this,"domain",""),h(this,"path",""),h(this,"secure",!0),h(this,"policiesKey",""),h(this,"events",null),h(this,"defaultAge",null);var n=t.extraPolicies,o=void 0===n?[]:n,i=t.domain,r=void 0===i?null:i,s=t.path,c=void 0===s?null:s,l=t.secure,u=void 0===l||l,f=t.policiesKey,m=void 0===f?"cookies_policy":f,y=t.newInstance,d=void 0!==y&&y,p=t.defaultAge,b=void 0===p?31536e3:p;if(d)this.destroyInstance();else if(window.TNAFrontendCookies)return window.TNAFrontendCookies;this.extraPolicies=o,this.domain=null===r?document.documentElement.dataset.tnaCookiesDomain||"":r,this.path=null===c?document.documentElement.dataset.tnaCookiesPath||"/":c,this.secure=u,this.policiesKey=m,this.defaultAge=b,this.events=new v,this.init(),window.TNAFrontendCookies=this}),[{key:"init",value:function(){this.savePolicies(r(r(r({},Object.fromEntries(this.extraPolicies.map((function(e){return[e.toLowerCase(),!1]})))),{},{usage:!1,settings:!1,marketing:!1},this.policies),{},{essential:!0}))}},{key:"destroyInstance",value:function(){window.TNAFrontendCookies=null}},{key:"all",get:function(){var e={};return document.cookie.split("; ").filter((function(e){return e})).forEach((function(t){var n=t.trim().split("=");n[0]&&(e[n[0]]=n[1])})),e}},{key:"policies",get:function(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}},{key:"exists",value:function(e){return Object.hasOwn(this.all,e)}},{key:"hasValue",value:function(e,t){return this.get(e)==t}},{key:"get",value:function(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}},{key:"set",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.maxAge,i=void 0===o?this.defaultAge:o,r=n.sameSite,s=void 0===r?"Lax":r,c=n.domain,a=void 0===c?this.domain:c,l=n.path,u=void 0===l?this.path:l,h=n.secure,f=void 0===h?this.secure:h,v=n.session,m=void 0!==v&&v;if(e){var y="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t),";").concat(a?" domain=".concat(a,"; "):""," samesite=").concat(s,"; path=").concat(u).concat(m?"":"; max-age=".concat(i)).concat(f?"; secure":"");document.cookie=y,this.events.trigger("setCookie",{key:e,value:t,maxAge:i,path:u,sameSite:s,domain:a,secure:f,session:m,cookie:y})}}},{key:"delete",value:function(e){var t={maxAge:-1,path:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",domain:(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||void 0};this.set(e,"",t),this.events.trigger("deleteCookie",r({key:e},t))}},{key:"deleteAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Object.keys(this.all).forEach((function(o){e.delete(o,t,n)})),this.events.trigger("deleteAllCookies",{path:t,domain:n})}},{key:"acceptPolicy",value:function(e){this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",h({},e,!0))}},{key:"rejectPolicy",value:function(e){this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",h({},e,!1))}},{key:"setPolicy",value:function(e,t){"essential"!==e&&(this.savePolicies(r(r({},this.policies),{},h(h({},e,t),"essential",!0))),this.events.trigger("changePolicy",h({},e,t)))}},{key:"acceptAllPolicies",value:function(){var e=Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!0]})));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"rejectAllPolicies",value:function(){var e=r(r({},Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!1]})))),{},{essential:!0});this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"savePolicies",value:function(e){this.set(this.policiesKey,JSON.stringify(e),{maxAge:31536e3})}},{key:"isPolicyAccepted",value:function(e){return Object.hasOwn(this.policies,e)?!0===this.policies[e]:null}},{key:"on",value:function(e,t){this.events.on(e,t)}},{key:"once",value:function(e,t){this.events.once(e,t)}}])}()}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.r(o),n.d(o,{Footer:()=>a});var i=n(169);function r(e){return r="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},r(e)}function s(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,c(o.key),o)}}function c(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}var a=function(){return e=function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.$themeSelector=t&&t.querySelector(".tna-footer__theme-selector"),this.$tnaTemplate=document.querySelector(".tna-template"),this.$module&&this.$themeSelector&&this.$tnaTemplate&&(this.$themeSelectorButtons=this.$themeSelector.querySelectorAll("button.tna-footer__theme-selector-button[value]"),Array.from(this.$themeSelectorButtons).forEach((function(e){e.addEventListener("click",(function(e){var t=e.target;n.setTheme(t.value),n.selectThemeSelectorButton(t)}))})),this.cookies=new i.A,this.cookies.isPolicyAccepted("settings")&&this.showThemeSelector(),this.cookies.on("changePolicy",(function(e){Object.hasOwn(e,"settings")&&(!0===e.settings?n.showThemeSelector():(n.cookies.delete("theme"),n.hideThemeSelector()))})))},(t=[{key:"showThemeSelector",value:function(){var e=this;if(this.$themeSelector.removeAttribute("hidden"),this.cookies.exists("theme")){var t=Array.from(this.$themeSelectorButtons).find((function(t){return t.value===e.cookies.get("theme")}));t&&this.selectThemeSelectorButton(t)}}},{key:"hideThemeSelector",value:function(){this.$themeSelector.setAttribute("hidden","")}},{key:"setTheme",value:function(e){if("light"===e)this.$tnaTemplate.classList.remove("tna-template--system-theme","tna-template--dark-theme");else if("dark"===e)this.$tnaTemplate.classList.remove("tna-template--system-theme"),this.$tnaTemplate.classList.add("tna-template--dark-theme");else{if("system"!==e)return;this.$tnaTemplate.classList.remove("tna-template--dark-theme"),this.$tnaTemplate.classList.add("tna-template--system-theme")}this.cookies.set("theme",e)}},{key:"selectThemeSelectorButton",value:function(e){Array.from(this.$themeSelectorButtons).forEach((function(t){t.value===e.value?(t.classList.remove("tna-button--plain"),t.setAttribute("aria-current",!0)):(t.classList.add("tna-button--plain"),t.removeAttribute("aria-current"))}))}}])&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();return o})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,(()=>(()=>{"use strict";var e={169:(e,t,n)=>{function i(e){return i="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},i(e)}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,f(i.key),i)}}function u(e,t,n){return t&&l(e.prototype,t),n&&l(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}n.d(t,{A:()=>m}),window.TNAFrontendCookies=window.TNAFrontendCookies||null,window.TNAFrontendCookieEvents=window.TNAFrontendCookieEvents||null;var v=function(){return u((function e(){if(a(this,e),h(this,"events",{}),h(this,"oneTimeEvents",{}),window.TNAFrontendCookieEvents)return window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this}),[{key:"on",value:function(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[].concat(s(this.events[e]),[t])}},{key:"once",value:function(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[].concat(s(this.oneTimeEvents[e]),[t])}},{key:"trigger",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Object.hasOwn(this.events,e)&&this.events[e].forEach((function(e){return e.call(t,n)})),Object.hasOwn(this.oneTimeEvents,e))for(var i=this.oneTimeEvents[e].length-1;i>=0;i--)this.oneTimeEvents[e][i].call(this,n),this.oneTimeEvents[e].splice(i,1)}}])}(),m=function(){return u((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a(this,e),h(this,"extraPolicies",[]),h(this,"domain",""),h(this,"path",""),h(this,"secure",!0),h(this,"policiesKey",""),h(this,"events",null),h(this,"defaultAge",null),h(this,"validPoliciesOnInit",!1);var n=t.extraPolicies,i=void 0===n?[]:n,o=t.domain,r=void 0===o?null:o,s=t.path,c=void 0===s?null:s,l=t.secure,u=void 0===l||l,f=t.policiesKey,m=void 0===f?"cookies_policy":f,y=t.newInstance,d=void 0!==y&&y,p=t.defaultAge,b=void 0===p?31536e3:p;if(d)this.destroyInstance();else if(window.TNAFrontendCookies)return window.TNAFrontendCookies;this.extraPolicies=i,this.domain=null===r?document.documentElement.dataset.tnaCookiesDomain||"":r,this.path=null===c?document.documentElement.dataset.tnaCookiesPath||"/":c,this.secure=u,this.policiesKey=m,this.defaultAge=b,this.events=new v,this.validPoliciesOnInit=Object.keys(this.policies).length>0,this.init(),window.TNAFrontendCookies=this}),[{key:"init",value:function(){this.savePolicies(r(r(r({},Object.fromEntries(this.extraPolicies.map((function(e){return[e.toLowerCase(),!1]})))),{},{usage:!1,settings:!1,marketing:!1},this.policies),{},{essential:!0}))}},{key:"destroyInstance",value:function(){window.TNAFrontendCookies=null}},{key:"all",get:function(){var e={};return document.cookie.split("; ").filter((function(e){return e})).forEach((function(t){var n=t.trim().split("=");n[0]&&(e[n[0]]=n[1])})),e}},{key:"policies",get:function(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}},{key:"exists",value:function(e){return Object.hasOwn(this.all,e)}},{key:"hasValue",value:function(e,t){return this.get(e)==t}},{key:"get",value:function(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}},{key:"set",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.maxAge,o=void 0===i?this.defaultAge:i,r=n.sameSite,s=void 0===r?"Lax":r,c=n.domain,a=void 0===c?this.domain:c,l=n.path,u=void 0===l?this.path:l,h=n.secure,f=void 0===h?this.secure:h,v=n.session,m=void 0!==v&&v;if(e){var y="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t),";").concat(a?" domain=".concat(a,"; "):""," samesite=").concat(s,"; path=").concat(u).concat(m?"":"; max-age=".concat(o)).concat(f?"; secure":"");document.cookie=y,this.events.trigger("setCookie",{key:e,value:t,maxAge:o,path:u,sameSite:s,domain:a,secure:f,session:m,cookie:y})}}},{key:"delete",value:function(e){var t={maxAge:-1,path:arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",domain:(arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)||void 0};this.set(e,"",t),this.events.trigger("deleteCookie",r({key:e},t))}},{key:"deleteAll",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;Object.keys(this.all).forEach((function(i){e.delete(i,t,n)})),this.events.trigger("deleteAllCookies",{path:t,domain:n})}},{key:"acceptPolicy",value:function(e){this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",h({},e,!0))}},{key:"rejectPolicy",value:function(e){this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",h({},e,!1))}},{key:"setPolicy",value:function(e,t){"essential"!==e&&(this.savePolicies(r(r({},this.policies),{},h(h({},e,t),"essential",!0))),this.events.trigger("changePolicy",h({},e,t)))}},{key:"acceptAllPolicies",value:function(){var e=Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!0]})));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"rejectAllPolicies",value:function(){var e=r(r({},Object.fromEntries(Object.keys(this.policies).map((function(e){return[e.toLowerCase(),!1]})))),{},{essential:!0});this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}},{key:"savePolicies",value:function(e){this.set(this.policiesKey,JSON.stringify(e))}},{key:"isPolicyAccepted",value:function(e){return Object.hasOwn(this.policies,e)?!0===this.policies[e]:null}},{key:"on",value:function(e,t){this.events.on(e,t)}},{key:"once",value:function(e,t){this.events.once(e,t)}}])}()}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var r=t[i]={exports:{}};return e[i](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};n.r(i),n.d(i,{Footer:()=>a});var o=n(169);function r(e){return r="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},r(e)}function s(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,c(i.key),i)}}function c(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}var a=function(){return e=function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.$themeSelector=t&&t.querySelector(".tna-footer__theme-selector"),this.$tnaTemplate=document.querySelector(".tna-template"),this.$module&&this.$themeSelector&&this.$tnaTemplate&&(this.$themeSelectorButtons=this.$themeSelector.querySelectorAll("button.tna-footer__theme-selector-button[value]"),Array.from(this.$themeSelectorButtons).forEach((function(e){e.addEventListener("click",(function(e){var t=e.target;n.setTheme(t.value),n.selectThemeSelectorButton(t)}))})),this.cookies=new o.A,this.cookies.isPolicyAccepted("settings")&&this.showThemeSelector(),this.cookies.on("changePolicy",(function(e){Object.hasOwn(e,"settings")&&(!0===e.settings?n.showThemeSelector():(n.cookies.delete("theme"),n.hideThemeSelector()))})))},(t=[{key:"showThemeSelector",value:function(){var e=this;if(this.$themeSelector.removeAttribute("hidden"),this.cookies.exists("theme")){var t=Array.from(this.$themeSelectorButtons).find((function(t){return t.value===e.cookies.get("theme")}));t&&this.selectThemeSelectorButton(t)}}},{key:"hideThemeSelector",value:function(){this.$themeSelector.setAttribute("hidden","")}},{key:"setTheme",value:function(e){if("light"===e)this.$tnaTemplate.classList.remove("tna-template--system-theme","tna-template--dark-theme");else if("dark"===e)this.$tnaTemplate.classList.remove("tna-template--system-theme"),this.$tnaTemplate.classList.add("tna-template--dark-theme");else{if("system"!==e)return;this.$tnaTemplate.classList.remove("tna-template--dark-theme"),this.$tnaTemplate.classList.add("tna-template--system-theme")}this.cookies.set("theme",e)}},{key:"selectThemeSelectorButton",value:function(e){Array.from(this.$themeSelectorButtons).forEach((function(t){t.value===e.value?(t.classList.remove("tna-button--plain"),t.setAttribute("aria-current",!0)):(t.classList.add("tna-button--plain"),t.removeAttribute("aria-current"))}))}}])&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();return i})()));
2
2
  //# sourceMappingURL=footer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components/footer/footer.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,IAEzBD,EAAkB,YAAIC,GACvB,CATD,CASGK,MAAM,I,+zECTTC,OA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AIT,OAHAlI,KAAK+G,aAAaoB,UAAUC,OAAO,4BACnCpI,KAAK+G,aAAaoB,UAAUE,IAAI,6BAGlC,CACArI,KAAK0H,QAAQ1C,IAAI,QAASkD,EAC5B,GAAC,CAAAjI,IAAA,4BAAAC,MAED,SAA0BoI,GACxBpB,MAAMC,KAAKnH,KAAKgH,uBAAuBhG,SAAQ,SAACsG,GAC1CA,EAAQpH,QAAUoI,EAAgBpI,OACpCoH,EAAQa,UAAUC,OAAO,qBACzBd,EAAQW,aAAa,gBAAgB,KAErCX,EAAQa,UAAUE,IAAI,qBACtBf,EAAQQ,gBAAgB,gBAE5B,GACF,M,6EAAC,CAnFgB,G","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/footer/footer.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","window.TNAFrontendCookies = window.TNAFrontendCookies || null;\nwindow.TNAFrontendCookieEvents = window.TNAFrontendCookieEvents || null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n\n constructor() {\n if (window.TNAFrontendCookieEvents) {\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n if (!Object.hasOwn(this.events, event)) {\n this.events[event] = [];\n }\n this.events[event] = [...this.events[event], callback];\n }\n\n once(event, callback) {\n if (!Object.hasOwn(this.oneTimeEvents, event)) {\n this.oneTimeEvents[event] = [];\n }\n this.oneTimeEvents[event] = [...this.oneTimeEvents[event], callback];\n }\n\n /** @protected */\n trigger(event, data = {}) {\n if (Object.hasOwn(this.events, event)) {\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n for (let i = this.oneTimeEvents[event].length - 1; i >= 0; i--) {\n const eventToTrigger = this.oneTimeEvents[event][i];\n eventToTrigger.call(this, data);\n this.oneTimeEvents[event].splice(i, 1);\n }\n }\n }\n}\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n extraPolicies = [];\n /** @protected */\n domain = \"\";\n /** @protected */\n path = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n\n /**\n * Create a cookie handler.\n * @param {String} [options.extraPolicies=[]] - The extra cookie policies to manage in addition to essential, settings, usage and marketing.\n * @param {String} [options.domain=\"\"] - The domain to register the cookie with.\n * @param {String} [options.path=\"\"] - The domain to register the cookie with.\n * @param {String} [options.secure=true] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey=\"cookies_policy\"] - The name of the cookie.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {String} [options.defaultAge=31536000] - The default age of non-session cookies.\n */\n constructor(options = {}) {\n const {\n extraPolicies = [],\n domain = null,\n path = null,\n secure = true,\n policiesKey = \"cookies_policy\",\n newInstance = false,\n defaultAge = 31536000, // 365 days\n } = options;\n if (newInstance) {\n this.destroyInstance();\n } else if (window.TNAFrontendCookies) {\n return window.TNAFrontendCookies;\n }\n this.extraPolicies = extraPolicies;\n if (domain === null) {\n this.domain = document.documentElement.dataset.tnaCookiesDomain || \"\";\n } else {\n this.domain = domain;\n }\n if (path === null) {\n this.path = document.documentElement.dataset.tnaCookiesPath || \"/\";\n } else {\n this.path = path;\n }\n this.secure = secure;\n this.policiesKey = policiesKey;\n this.defaultAge = defaultAge;\n this.events = new CookieEventHandler();\n this.init();\n window.TNAFrontendCookies = this;\n }\n\n /** @protected */\n init() {\n this.savePolicies({\n ...Object.fromEntries(\n this.extraPolicies.map((k) => [k.toLowerCase(), false]),\n ),\n usage: false,\n settings: false,\n marketing: false,\n ...this.policies,\n essential: true,\n });\n }\n\n destroyInstance() {\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((x) => x)\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n if (parts[0]) {\n deserialised[parts[0]] = parts[1];\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n } catch (e) {\n return {};\n }\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {String} key - The cookie name.\n * @returns {Boolean}\n */\n exists(key) {\n return Object.hasOwn(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) == value;\n }\n\n /**\n * Get a cookie.\n * @param {String} key - The cookie name.\n * @returns {String|Number|Boolean}\n */\n get(key) {\n return this.exists(key) ? decodeURIComponent(this.all[key]) : null;\n }\n\n /**\n * Set a cookie.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The cookie value.\n * @param {Object} options\n * @param {Number} [options.maxAge=this.defaultAge] - The maximum age of the cookie in seconds.\n * @param {String} [options.path=/] - The path to register the cookie for.\n * @param {String} [options.sameSite=Lax] - The sameSite attribute.\n * @param {String} [options.domain=this.domain] - The domain to register the cookie with.\n * @param {String} [options.path=this.path] - The path to register the cookie with.\n * @param {String} [options.secure=this.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.session=false] - Set a session cookie.\n */\n set(key, value, options = {}) {\n const {\n maxAge = this.defaultAge,\n sameSite = \"Lax\",\n domain = this.domain,\n path = this.path,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)};${\n domain ? ` domain=${domain}; ` : \"\"\n } samesite=${sameSite}; path=${path}${!session ? `; max-age=${maxAge}` : \"\"}${\n secure ? \"; secure\" : \"\"\n }`;\n document.cookie = cookie;\n this.events.trigger(\"setCookie\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n }\n\n /**\n * Delete a cookie.\n * @param {String} key - The cookie name.\n * @param {String} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\", domain = null) {\n const options = { maxAge: -1, path, domain: domain || undefined };\n this.set(key, \"\", options);\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = null) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.events.trigger(\"deleteAllCookies\", { path, domain });\n }\n\n /**\n * Accept a policy.\n * @param {String} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.setPolicy(policy, true);\n this.events.trigger(\"acceptPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: true });\n }\n\n /**\n * Reject a policy.\n * @param {String} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n this.setPolicy(policy, false);\n this.events.trigger(\"rejectPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: false });\n }\n\n /**\n * Set a policy.\n * @param {String} policy - The name of the policy.\n * @param {Boolean} accepted - Whether the policy is accepted or not.\n */\n setPolicy(policy, accepted) {\n if (policy === \"essential\") {\n return;\n }\n this.savePolicies({\n ...this.policies,\n [policy]: accepted,\n essential: true,\n });\n this.events.trigger(\"changePolicy\", { [policy]: accepted });\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), true]),\n );\n this.savePolicies(allPolicies);\n this.events.trigger(\"acceptAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), false]),\n ),\n essential: true,\n };\n this.savePolicies(allPolicies);\n this.events.trigger(\"rejectAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Commit policy preferences to the browser.\n * @param {object} policies - The policies to commit.\n */\n savePolicies(policies) {\n this.set(this.policiesKey, JSON.stringify(policies), {\n maxAge: 60 * 60 * 24 * 365,\n });\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {String} policy - The name of the policy.\n * @returns {Boolean}\n */\n isPolicyAccepted(policy) {\n return Object.hasOwn(this.policies, policy)\n ? this.policies[policy] === true\n : null;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n this.events.on(event, callback);\n }\n\n /**\n * Add a one-time event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n once(event, callback) {\n this.events.once(event, callback);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Cookies from \"../../lib/cookies.mjs\";\n\nexport class Footer {\n constructor($module) {\n this.$module = $module;\n this.$themeSelector =\n $module && $module.querySelector(\".tna-footer__theme-selector\");\n this.$tnaTemplate = document.querySelector(\".tna-template\");\n\n if (!this.$module || !this.$themeSelector || !this.$tnaTemplate) {\n return;\n }\n\n this.$themeSelectorButtons = this.$themeSelector.querySelectorAll(\n \"button.tna-footer__theme-selector-button[value]\",\n );\n\n Array.from(this.$themeSelectorButtons).forEach(($themeSelectorButton) => {\n $themeSelectorButton.addEventListener(\"click\", (e) => {\n const $button = e.target;\n this.setTheme($button.value);\n this.selectThemeSelectorButton($button);\n });\n });\n\n this.cookies = new Cookies();\n if (this.cookies.isPolicyAccepted(\"settings\")) {\n this.showThemeSelector();\n }\n this.cookies.on(\"changePolicy\", (data) => {\n if (Object.hasOwn(data, \"settings\")) {\n if (data.settings === true) {\n this.showThemeSelector();\n } else {\n this.cookies.delete(\"theme\");\n this.hideThemeSelector();\n }\n }\n });\n }\n\n showThemeSelector() {\n this.$themeSelector.removeAttribute(\"hidden\");\n if (this.cookies.exists(\"theme\")) {\n const $currentThemeButton = Array.from(this.$themeSelectorButtons).find(\n ($button) => $button.value === this.cookies.get(\"theme\"),\n );\n if ($currentThemeButton) {\n this.selectThemeSelectorButton($currentThemeButton);\n }\n }\n }\n\n hideThemeSelector() {\n this.$themeSelector.setAttribute(\"hidden\", \"\");\n }\n\n setTheme(theme) {\n if (theme === \"light\") {\n this.$tnaTemplate.classList.remove(\n \"tna-template--system-theme\",\n \"tna-template--dark-theme\",\n );\n } else if (theme === \"dark\") {\n this.$tnaTemplate.classList.remove(\"tna-template--system-theme\");\n this.$tnaTemplate.classList.add(`tna-template--dark-theme`);\n } else if (theme === \"system\") {\n this.$tnaTemplate.classList.remove(\"tna-template--dark-theme\");\n this.$tnaTemplate.classList.add(`tna-template--system-theme`);\n } else {\n return;\n }\n this.cookies.set(\"theme\", theme);\n }\n\n selectThemeSelectorButton($selectedButton) {\n Array.from(this.$themeSelectorButtons).forEach(($button) => {\n if ($button.value === $selectedButton.value) {\n $button.classList.remove(\"tna-button--plain\");\n $button.setAttribute(\"aria-current\", true);\n } else {\n $button.classList.add(\"tna-button--plain\");\n $button.removeAttribute(\"aria-current\");\n }\n });\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","window","TNAFrontendCookies","TNAFrontendCookieEvents","CookieEventHandler","_createClass","_classCallCheck","_defineProperty","this","key","value","event","callback","Object","hasOwn","events","concat","_toConsumableArray","oneTimeEvents","_this","data","arguments","length","undefined","forEach","eventToTrigger","call","i","splice","Cookies","options","_options$extraPolicie","extraPolicies","_options$domain","domain","_options$path","path","_options$secure","secure","_options$policiesKey","policiesKey","_options$newInstance","newInstance","_options$defaultAge","defaultAge","destroyInstance","document","documentElement","dataset","tnaCookiesDomain","tnaCookiesPath","init","savePolicies","_objectSpread","fromEntries","map","k","toLowerCase","usage","settings","marketing","policies","essential","get","deserialised","cookie","split","filter","x","parts","trim","JSON","parse","e","all","exists","decodeURIComponent","_options$maxAge","maxAge","_options$sameSite","sameSite","_options$domain2","_options$path2","_options$secure2","_options$session","session","encodeURIComponent","trigger","set","_this2","keys","policy","setPolicy","accepted","allPolicies","stringify","on","once","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","Footer","$module","$themeSelector","querySelector","$tnaTemplate","$themeSelectorButtons","querySelectorAll","Array","from","$themeSelectorButton","addEventListener","$button","target","setTheme","selectThemeSelectorButton","cookies","isPolicyAccepted","showThemeSelector","hideThemeSelector","removeAttribute","$currentThemeButton","find","setAttribute","theme","classList","remove","add","$selectedButton"],"sourceRoot":""}
1
+ {"version":3,"file":"components/footer/footer.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,IAEzBD,EAAkB,YAAIC,GACvB,CATD,CASGK,MAAM,I,+zECTTC,OAAOC,mBAAqBD,OAAOC,oBAAsB,KACzDD,OAAOE,wBAA0BF,OAAOE,yBAA2B,KAE5D,IAAMC,EAAkB,WAW7B,OAAAC,GAPA,SAAAD,IACE,GADYE,EAAA,KAAAF,GAAAG,EAAA,cAHL,CAAC,GAACA,EAAA,qBACK,CAAC,GAGXN,OAAOE,wBACT,OAAOF,OAAOE,wBAEhBF,OAAOE,wBAA0BK,IACnC,GAEA,EAAAC,IAAA,KAAAC,MAKA,SAAGC,EAAOC,GACHC,OAAOC,OAAON,KAAKO,OAAQJ,KAC9BH,KAAKO,OAAOJ,GAAS,IAEvBH,KAAKO,OAAOJ,GAAS,GAAHK,OAAAC,EAAOT,KAAKO,OAAOJ,IAAM,CAAEC,GAC/C,GAAC,CAAAH,IAAA,OAAAC,MAED,SAAKC,EAAOC,GACLC,OAAOC,OAAON,KAAKU,cAAeP,KACrCH,KAAKU,cAAcP,GAAS,IAE9BH,KAAKU,cAAcP,GAAS,GAAHK,OAAAC,EAAOT,KAAKU,cAAcP,IAAM,CAAEC,GAC7D,GAEA,CAAAH,IAAA,UAAAC,MACA,SAAQC,GAAkB,IAA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AAA7H,IAAA,oBAAAC,MAED,WAAoB,IAAAiF,EAAA,KAElB,GADAnF,KAAK8G,eAAeiB,gBAAgB,UAChC/H,KAAK2H,QAAQtD,OAAO,SAAU,CAChC,IAAM2D,EAAsBb,MAAMC,KAAKpH,KAAKiH,uBAAuBgB,MACjE,SAACV,GAAO,OAAKA,EAAQrH,QAAUiF,EAAKwC,QAAQlE,IAAI,QAAQ,IAEtDuE,GACFhI,KAAK0H,0BAA0BM,EAEnC,CACF,GAAC,CAAA/H,IAAA,oBAAAC,MAED,WACEF,KAAK8G,eAAeoB,aAAa,SAAU,GAC7C,GAAC,CAAAjI,IAAA,WAAAC,MAED,SAASiI,GACP,GAAc,UAAVA,EACFnI,KAAKgH,aAAaoB,UAAUC,OAC1B,6BACA,iCAEG,GAAc,SAAVF,EACTnI,KAAKgH,aAAaoB,UAAUC,OAAO,8BACnCrI,KAAKgH,aAAaoB,UAAUE,IAAI,gCAC3B,IAAc,WAAVH,EAIT,OAHAnI,KAAKgH,aAAaoB,UAAUC,OAAO,4BACnCrI,KAAKgH,aAAaoB,UAAUE,IAAI,6BAGlC,CACAtI,KAAK2H,QAAQzC,IAAI,QAASiD,EAC5B,GAAC,CAAAlI,IAAA,4BAAAC,MAED,SAA0BqI,GACxBpB,MAAMC,KAAKpH,KAAKiH,uBAAuBjG,SAAQ,SAACuG,GAC1CA,EAAQrH,QAAUqI,EAAgBrI,OACpCqH,EAAQa,UAAUC,OAAO,qBACzBd,EAAQW,aAAa,gBAAgB,KAErCX,EAAQa,UAAUE,IAAI,qBACtBf,EAAQQ,gBAAgB,gBAE5B,GACF,M,6EAAC,CAnFgB,G","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookies.mjs","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/footer/footer.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","window.TNAFrontendCookies = window.TNAFrontendCookies || null;\nwindow.TNAFrontendCookieEvents = window.TNAFrontendCookieEvents || null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n\n constructor() {\n if (window.TNAFrontendCookieEvents) {\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n if (!Object.hasOwn(this.events, event)) {\n this.events[event] = [];\n }\n this.events[event] = [...this.events[event], callback];\n }\n\n once(event, callback) {\n if (!Object.hasOwn(this.oneTimeEvents, event)) {\n this.oneTimeEvents[event] = [];\n }\n this.oneTimeEvents[event] = [...this.oneTimeEvents[event], callback];\n }\n\n /** @protected */\n trigger(event, data = {}) {\n if (Object.hasOwn(this.events, event)) {\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n for (let i = this.oneTimeEvents[event].length - 1; i >= 0; i--) {\n const eventToTrigger = this.oneTimeEvents[event][i];\n eventToTrigger.call(this, data);\n this.oneTimeEvents[event].splice(i, 1);\n }\n }\n }\n}\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n extraPolicies = [];\n /** @protected */\n domain = \"\";\n /** @protected */\n path = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n /** @protected */\n validPoliciesOnInit = false;\n\n /**\n * Create a cookie handler.\n * @param {String} [options.extraPolicies=[]] - The extra cookie policies to manage in addition to essential, settings, usage and marketing.\n * @param {String} [options.domain=\"\"] - The domain to register the cookie with.\n * @param {String} [options.path=\"\"] - The domain to register the cookie with.\n * @param {String} [options.secure=true] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey=\"cookies_policy\"] - The name of the cookie.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {String} [options.defaultAge=31536000] - The default age of non-session cookies.\n */\n constructor(options = {}) {\n const {\n extraPolicies = [],\n domain = null,\n path = null,\n secure = true,\n policiesKey = \"cookies_policy\",\n newInstance = false,\n defaultAge = 31536000, // 365 days\n } = options;\n if (newInstance) {\n this.destroyInstance();\n } else if (window.TNAFrontendCookies) {\n return window.TNAFrontendCookies;\n }\n this.extraPolicies = extraPolicies;\n if (domain === null) {\n this.domain = document.documentElement.dataset.tnaCookiesDomain || \"\";\n } else {\n this.domain = domain;\n }\n if (path === null) {\n this.path = document.documentElement.dataset.tnaCookiesPath || \"/\";\n } else {\n this.path = path;\n }\n this.secure = secure;\n this.policiesKey = policiesKey;\n this.defaultAge = defaultAge;\n this.events = new CookieEventHandler();\n this.validPoliciesOnInit = Object.keys(this.policies).length > 0;\n this.init();\n window.TNAFrontendCookies = this;\n }\n\n /** @protected */\n init() {\n this.savePolicies({\n ...Object.fromEntries(\n this.extraPolicies.map((k) => [k.toLowerCase(), false]),\n ),\n usage: false,\n settings: false,\n marketing: false,\n ...this.policies,\n essential: true,\n });\n }\n\n destroyInstance() {\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((x) => x)\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n if (parts[0]) {\n deserialised[parts[0]] = parts[1];\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n } catch (e) {\n return {};\n }\n }\n\n /**\n * Check to see whether a cookie exists or not.\n * @param {String} key - The cookie name.\n * @returns {Boolean}\n */\n exists(key) {\n return Object.hasOwn(this.all, key);\n }\n\n /**\n * Check to see whether a cookie has a particular value.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The value to check against.\n * @returns\n */\n hasValue(key, value) {\n return this.get(key) == value;\n }\n\n /**\n * Get a cookie.\n * @param {String} key - The cookie name.\n * @returns {String|Number|Boolean}\n */\n get(key) {\n return this.exists(key) ? decodeURIComponent(this.all[key]) : null;\n }\n\n /**\n * Set a cookie.\n * @param {String} key - The cookie name.\n * @param {String|Number|Boolean} value - The cookie value.\n * @param {Object} options\n * @param {Number} [options.maxAge=this.defaultAge] - The maximum age of the cookie in seconds.\n * @param {String} [options.path=/] - The path to register the cookie for.\n * @param {String} [options.sameSite=Lax] - The sameSite attribute.\n * @param {String} [options.domain=this.domain] - The domain to register the cookie with.\n * @param {String} [options.path=this.path] - The path to register the cookie with.\n * @param {String} [options.secure=this.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.session=false] - Set a session cookie.\n */\n set(key, value, options = {}) {\n const {\n maxAge = this.defaultAge,\n sameSite = \"Lax\",\n domain = this.domain,\n path = this.path,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)};${\n domain ? ` domain=${domain}; ` : \"\"\n } samesite=${sameSite}; path=${path}${!session ? `; max-age=${maxAge}` : \"\"}${\n secure ? \"; secure\" : \"\"\n }`;\n document.cookie = cookie;\n this.events.trigger(\"setCookie\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\n }\n\n /**\n * Delete a cookie.\n * @param {String} key - The cookie name.\n * @param {String} [path=/] - The path to the cookie is registered on.\n */\n delete(key, path = \"/\", domain = null) {\n const options = { maxAge: -1, path, domain: domain || undefined };\n this.set(key, \"\", options);\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = null) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.events.trigger(\"deleteAllCookies\", { path, domain });\n }\n\n /**\n * Accept a policy.\n * @param {String} policy - The name of the policy.\n */\n acceptPolicy(policy) {\n this.setPolicy(policy, true);\n this.events.trigger(\"acceptPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: true });\n }\n\n /**\n * Reject a policy.\n * @param {String} policy - The name of the policy.\n */\n rejectPolicy(policy) {\n this.setPolicy(policy, false);\n this.events.trigger(\"rejectPolicy\", policy);\n this.events.trigger(\"changePolicy\", { [policy]: false });\n }\n\n /**\n * Set a policy.\n * @param {String} policy - The name of the policy.\n * @param {Boolean} accepted - Whether the policy is accepted or not.\n */\n setPolicy(policy, accepted) {\n if (policy === \"essential\") {\n return;\n }\n this.savePolicies({\n ...this.policies,\n [policy]: accepted,\n essential: true,\n });\n this.events.trigger(\"changePolicy\", { [policy]: accepted });\n }\n\n /**\n * Accept all the cookie policies.\n */\n acceptAllPolicies() {\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), true]),\n );\n this.savePolicies(allPolicies);\n this.events.trigger(\"acceptAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Reject all the cookie policies.\n */\n rejectAllPolicies() {\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((k) => [k.toLowerCase(), false]),\n ),\n essential: true,\n };\n this.savePolicies(allPolicies);\n this.events.trigger(\"rejectAllPolicies\");\n this.events.trigger(\"changePolicy\", allPolicies);\n }\n\n /**\n * Commit policy preferences to the browser.\n * @param {object} policies - The policies to commit.\n */\n savePolicies(policies) {\n this.set(this.policiesKey, JSON.stringify(policies));\n }\n\n /**\n * Get the acceptance status of a policy.\n * @param {String} policy - The name of the policy.\n * @returns {Boolean}\n */\n isPolicyAccepted(policy) {\n return Object.hasOwn(this.policies, policy)\n ? this.policies[policy] === true\n : null;\n }\n\n /**\n * Add an event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n on(event, callback) {\n this.events.on(event, callback);\n }\n\n /**\n * Add a one-time event listener.\n * @param {String} event - The event to add a listener for.\n * @param {Function} callback - The callback function to call when the event is triggered.\n */\n once(event, callback) {\n this.events.once(event, callback);\n }\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import Cookies from \"../../lib/cookies.mjs\";\n\nexport class Footer {\n constructor($module) {\n this.$module = $module;\n this.$themeSelector =\n $module && $module.querySelector(\".tna-footer__theme-selector\");\n this.$tnaTemplate = document.querySelector(\".tna-template\");\n\n if (!this.$module || !this.$themeSelector || !this.$tnaTemplate) {\n return;\n }\n\n this.$themeSelectorButtons = this.$themeSelector.querySelectorAll(\n \"button.tna-footer__theme-selector-button[value]\",\n );\n\n Array.from(this.$themeSelectorButtons).forEach(($themeSelectorButton) => {\n $themeSelectorButton.addEventListener(\"click\", (e) => {\n const $button = e.target;\n this.setTheme($button.value);\n this.selectThemeSelectorButton($button);\n });\n });\n\n this.cookies = new Cookies();\n if (this.cookies.isPolicyAccepted(\"settings\")) {\n this.showThemeSelector();\n }\n this.cookies.on(\"changePolicy\", (data) => {\n if (Object.hasOwn(data, \"settings\")) {\n if (data.settings === true) {\n this.showThemeSelector();\n } else {\n this.cookies.delete(\"theme\");\n this.hideThemeSelector();\n }\n }\n });\n }\n\n showThemeSelector() {\n this.$themeSelector.removeAttribute(\"hidden\");\n if (this.cookies.exists(\"theme\")) {\n const $currentThemeButton = Array.from(this.$themeSelectorButtons).find(\n ($button) => $button.value === this.cookies.get(\"theme\"),\n );\n if ($currentThemeButton) {\n this.selectThemeSelectorButton($currentThemeButton);\n }\n }\n }\n\n hideThemeSelector() {\n this.$themeSelector.setAttribute(\"hidden\", \"\");\n }\n\n setTheme(theme) {\n if (theme === \"light\") {\n this.$tnaTemplate.classList.remove(\n \"tna-template--system-theme\",\n \"tna-template--dark-theme\",\n );\n } else if (theme === \"dark\") {\n this.$tnaTemplate.classList.remove(\"tna-template--system-theme\");\n this.$tnaTemplate.classList.add(`tna-template--dark-theme`);\n } else if (theme === \"system\") {\n this.$tnaTemplate.classList.remove(\"tna-template--dark-theme\");\n this.$tnaTemplate.classList.add(`tna-template--system-theme`);\n } else {\n return;\n }\n this.cookies.set(\"theme\", theme);\n }\n\n selectThemeSelectorButton($selectedButton) {\n Array.from(this.$themeSelectorButtons).forEach(($button) => {\n if ($button.value === $selectedButton.value) {\n $button.classList.remove(\"tna-button--plain\");\n $button.setAttribute(\"aria-current\", true);\n } else {\n $button.classList.add(\"tna-button--plain\");\n $button.removeAttribute(\"aria-current\");\n }\n });\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","window","TNAFrontendCookies","TNAFrontendCookieEvents","CookieEventHandler","_createClass","_classCallCheck","_defineProperty","this","key","value","event","callback","Object","hasOwn","events","concat","_toConsumableArray","oneTimeEvents","_this","data","arguments","length","undefined","forEach","eventToTrigger","call","i","splice","Cookies","options","_options$extraPolicie","extraPolicies","_options$domain","domain","_options$path","path","_options$secure","secure","_options$policiesKey","policiesKey","_options$newInstance","newInstance","_options$defaultAge","defaultAge","destroyInstance","document","documentElement","dataset","tnaCookiesDomain","tnaCookiesPath","validPoliciesOnInit","keys","policies","init","savePolicies","_objectSpread","fromEntries","map","k","toLowerCase","usage","settings","marketing","essential","get","deserialised","cookie","split","filter","x","parts","trim","JSON","parse","e","all","exists","decodeURIComponent","_options$maxAge","maxAge","_options$sameSite","sameSite","_options$domain2","_options$path2","_options$secure2","_options$session","session","encodeURIComponent","trigger","set","_this2","policy","setPolicy","accepted","allPolicies","stringify","on","once","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","r","Symbol","toStringTag","Footer","$module","$themeSelector","querySelector","$tnaTemplate","$themeSelectorButtons","querySelectorAll","Array","from","$themeSelectorButton","addEventListener","$button","target","setTheme","selectThemeSelectorButton","cookies","isPolicyAccepted","showThemeSelector","hideThemeSelector","removeAttribute","$currentThemeButton","find","setAttribute","theme","classList","remove","add","$selectedButton"],"sourceRoot":""}
@@ -69,6 +69,8 @@ export default class Cookies {
69
69
  events = null;
70
70
  /** @protected */
71
71
  defaultAge = null;
72
+ /** @protected */
73
+ validPoliciesOnInit = false;
72
74
 
73
75
  /**
74
76
  * Create a cookie handler.
@@ -110,6 +112,7 @@ export default class Cookies {
110
112
  this.policiesKey = policiesKey;
111
113
  this.defaultAge = defaultAge;
112
114
  this.events = new CookieEventHandler();
115
+ this.validPoliciesOnInit = Object.keys(this.policies).length > 0;
113
116
  this.init();
114
117
  window.TNAFrontendCookies = this;
115
118
  }
@@ -318,9 +321,7 @@ export default class Cookies {
318
321
  * @param {object} policies - The policies to commit.
319
322
  */
320
323
  savePolicies(policies) {
321
- this.set(this.policiesKey, JSON.stringify(policies), {
322
- maxAge: 60 * 60 * 24 * 365,
323
- });
324
+ this.set(this.policiesKey, JSON.stringify(policies));
324
325
  }
325
326
 
326
327
  /**