@nationalarchives/frontend 0.44.0 → 0.44.1

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.
Files changed (51) hide show
  1. package/nationalarchives/all+analytics.js +1 -2
  2. package/nationalarchives/all+analytics.js.map +1 -1
  3. package/nationalarchives/all.css +1 -1
  4. package/nationalarchives/all.css.map +1 -1
  5. package/nationalarchives/all.js +1 -2
  6. package/nationalarchives/all.js.map +1 -1
  7. package/nationalarchives/analytics.js +1 -1
  8. package/nationalarchives/analytics.js.map +1 -1
  9. package/nationalarchives/components/accordion/accordion.js +1 -1
  10. package/nationalarchives/components/accordion/accordion.js.map +1 -1
  11. package/nationalarchives/components/breadcrumbs/breadcrumbs.js +1 -1
  12. package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +1 -1
  13. package/nationalarchives/components/code-block/code-block.js +1 -2
  14. package/nationalarchives/components/code-block/code-block.js.map +1 -1
  15. package/nationalarchives/components/cookie-banner/cookie-banner.js +1 -1
  16. package/nationalarchives/components/cookie-banner/cookie-banner.js.map +1 -1
  17. package/nationalarchives/components/date-input/date-input.js +1 -1
  18. package/nationalarchives/components/date-input/date-input.js.map +1 -1
  19. package/nationalarchives/components/error-summary/error-summary.js +1 -1
  20. package/nationalarchives/components/error-summary/error-summary.js.map +1 -1
  21. package/nationalarchives/components/file-input/file-input.js +1 -1
  22. package/nationalarchives/components/file-input/file-input.js.map +1 -1
  23. package/nationalarchives/components/footer/footer.js +1 -1
  24. package/nationalarchives/components/footer/footer.js.map +1 -1
  25. package/nationalarchives/components/gallery/gallery.js +1 -1
  26. package/nationalarchives/components/gallery/gallery.js.map +1 -1
  27. package/nationalarchives/components/global-header/global-header.js +1 -1
  28. package/nationalarchives/components/global-header/global-header.js.map +1 -1
  29. package/nationalarchives/components/header/header.js +1 -1
  30. package/nationalarchives/components/header/header.js.map +1 -1
  31. package/nationalarchives/components/hero/hero.css +1 -1
  32. package/nationalarchives/components/hero/hero.css.map +1 -1
  33. package/nationalarchives/components/hero/hero.scss +3 -3
  34. package/nationalarchives/components/picture/picture.js +1 -1
  35. package/nationalarchives/components/picture/picture.js.map +1 -1
  36. package/nationalarchives/components/sidebar/sidebar.js +1 -1
  37. package/nationalarchives/components/sidebar/sidebar.js.map +1 -1
  38. package/nationalarchives/components/skip-link/skip-link.js +1 -1
  39. package/nationalarchives/components/skip-link/skip-link.js.map +1 -1
  40. package/nationalarchives/components/tabs/tabs.js +1 -1
  41. package/nationalarchives/components/tabs/tabs.js.map +1 -1
  42. package/nationalarchives/components/text-input/text-input.js +1 -1
  43. package/nationalarchives/components/text-input/text-input.js.map +1 -1
  44. package/nationalarchives/components/textarea/textarea.js +1 -1
  45. package/nationalarchives/components/textarea/textarea.js.map +1 -1
  46. package/nationalarchives/prototype-kit.css +1 -1
  47. package/nationalarchives/prototype-kit.css.map +1 -1
  48. package/package.json +3 -3
  49. package/nationalarchives/all+analytics.js.LICENSE.txt +0 -1
  50. package/nationalarchives/all.js.LICENSE.txt +0 -1
  51. package/nationalarchives/components/code-block/code-block.js.LICENSE.txt +0 -1
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("TNAFrontend",[],e):"object"==typeof exports?exports.TNAFrontend=e():t.TNAFrontend=e()}(self,()=>(()=>{"use strict";var t={927(t,e,r){r.d(e,{DJ:()=>n});var o=r(181),n=function(t){var e=t.querySelector("caption");"true"!==t.dataset.tableScrollInitialised&&(e&&!e.id&&(e.id="table-caption-".concat((0,o.A)())),t.dataset.tableScrollInitialised="true"),t.scrollWidth>t.clientWidth?(t.setAttribute("tabindex","0"),t.setAttribute("role","region"),t.setAttribute("aria-labelledby",(null==e?void 0:e.id)||""),t.classList.add("tna-table-wrapper--scroll")):(t.removeAttribute("tabindex"),t.removeAttribute("role"),t.removeAttribute("aria-labelledby"),t.classList.remove("tna-table-wrapper--scroll"))}},181(t,e,r){r.d(e,{A:()=>o});const o=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(t){return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)})}}},e={};function r(o){var n=e[o];if(void 0!==n)return n.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,r),i.exports}r.d=(t,e)=>{for(var o in e)r.o(e,o)&&!r.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{Accordion:()=>c});var n=r(927);function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}function a(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,l(o.key),o)}}function l(t){var e=function(t){if("object"!=i(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==i(e)?e:e+""}var c=function(){return t=function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$module=e,this.$items=e&&e.querySelectorAll(".tna-accordion__item"),this.$module&&this.$items&&(this.allowMultipleItemsOpen="true"!==this.$module.dataset.singleOpenItem,this.$items.forEach(function(t){return r.initItem(t)}),this.initState(),this.$toggleAllButton=this.$module.querySelector(".tna-accordion__toggle-all"),this.$toggleAllButton&&(this.syncToggleAllButton(),this.$toggleAllButton.removeAttribute("hidden"),this.$toggleAllButton.addEventListener("click",function(){r.isAllOpen()?r.$items.forEach(function(t){return r.closeItem(t)}):r.$items.forEach(function(t){return r.openItem(t)}),r.syncToggleAllButton()})))},(e=[{key:"initItem",value:function(t){var e=this,r=t.querySelector(".tna-accordion__heading"),o=t.querySelector(".tna-accordion__body");if(r&&o){t.classList.add("tna-accordion__details"),t.classList.remove("tna-accordion__item"),r.removeAttribute("class"),o.classList.add("tna-accordion__content"),o.classList.remove("tna-accordion__body"),o.setAttribute("hidden","");var n=document.createElement("button");n.classList.add("tna-accordion__summary"),n.setAttribute("type","button"),n.setAttribute("aria-controls",o.id),n.innerText=r.innerText,r.innerText="",r.appendChild(n),n.addEventListener("click",function(){"true"===n.getAttribute("aria-expanded")?e.closeItem(t):e.openItem(t)})}}},{key:"initState",value:function(){var t=this;this.$items.forEach(function(e){"true"===e.dataset.isopen?t.openItem(e):t.closeItem(e),e.removeAttribute("data-isopen")})}},{key:"openItem",value:function(t){this.allowMultipleItemsOpen||this.closeAllItemsExcept(t);var e=t.querySelector(".tna-accordion__summary"),r=t.querySelector(".tna-accordion__content");e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","".concat(e.innerText.trim(),", Hide this section")),r.removeAttribute("hidden"),this.syncToggleAllButton();var o=r.querySelectorAll(".tna-table-wrapper");o&&o.forEach(function(t){(0,n.DJ)(t)})}},{key:"closeItem",value:function(t){var e=t.querySelector(".tna-accordion__summary"),r=t.querySelector(".tna-accordion__content");e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","".concat(e.innerText.trim(),", Show this section")),r.setAttribute("hidden",""),this.syncToggleAllButton()}},{key:"closeAllItemsExcept",value:function(t){var e=this;Array.from(this.$items).filter(function(e){return e.querySelector(".tna-accordion__summary")!==t&&"true"===e.querySelector(".tna-accordion__summary").getAttribute("aria-expanded")}).forEach(function(t){return e.closeItem(t)})}},{key:"isAllOpen",value:function(){return Array.from(this.$items).every(function(t){return"true"===t.querySelector(".tna-accordion__summary").getAttribute("aria-expanded")})}},{key:"syncToggleAllButton",value:function(){this.$toggleAllButton&&(this.isAllOpen()?this.$toggleAllButton.innerText=this.$toggleAllButton.dataset.closeAllLabel||"Hide all sections":this.$toggleAllButton.innerText=this.$toggleAllButton.dataset.openAllLabel||"Show all sections")}}])&&a(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();return o})());
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("TNAFrontend",[],e):"object"==typeof exports?exports.TNAFrontend=e():t.TNAFrontend=e()}(self,()=>(()=>{"use strict";var t={927(t,e,o){o.d(e,{DJ:()=>i});var r=o(181);const i=t=>{const e=t.querySelector("caption");"true"!==t.dataset.tableScrollInitialised&&(e&&!e.id&&(e.id=`table-caption-${(0,r.A)()}`),t.dataset.tableScrollInitialised="true"),t.scrollWidth>t.clientWidth?(t.setAttribute("tabindex","0"),t.setAttribute("role","region"),t.setAttribute("aria-labelledby",e?.id||""),t.classList.add("tna-table-wrapper--scroll")):(t.removeAttribute("tabindex"),t.removeAttribute("role"),t.removeAttribute("aria-labelledby"),t.classList.remove("tna-table-wrapper--scroll"))}},181(t,e,o){o.d(e,{A:()=>r});const r=()=>([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/gu,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}},e={};function o(r){var i=e[r];if(void 0!==i)return i.exports;var n=e[r]={exports:{}};return t[r](n,n.exports,o),n.exports}o.d=(t,e)=>{for(var r in e)o.o(e,r)&&!o.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};o.r(r),o.d(r,{Accordion:()=>n});var i=o(927);class n{constructor(t){this.$module=t,this.$items=t&&t.querySelectorAll(".tna-accordion__item"),this.$module&&this.$items&&(this.allowMultipleItemsOpen="true"!==this.$module.dataset.singleOpenItem,this.$items.forEach(t=>this.initItem(t)),this.initState(),this.$toggleAllButton=this.$module.querySelector(".tna-accordion__toggle-all"),this.$toggleAllButton&&(this.syncToggleAllButton(),this.$toggleAllButton.removeAttribute("hidden"),this.$toggleAllButton.addEventListener("click",()=>{this.isAllOpen()?this.$items.forEach(t=>this.closeItem(t)):this.$items.forEach(t=>this.openItem(t)),this.syncToggleAllButton()})))}initItem(t){const e=t.querySelector(".tna-accordion__heading"),o=t.querySelector(".tna-accordion__body");if(!e||!o)return;t.classList.add("tna-accordion__details"),t.classList.remove("tna-accordion__item"),e.removeAttribute("class"),o.classList.add("tna-accordion__content"),o.classList.remove("tna-accordion__body"),o.setAttribute("hidden","");const r=document.createElement("button");r.classList.add("tna-accordion__summary"),r.setAttribute("type","button"),r.setAttribute("aria-controls",o.id),r.innerText=e.innerText,e.innerText="",e.appendChild(r),r.addEventListener("click",()=>{"true"===r.getAttribute("aria-expanded")?this.closeItem(t):this.openItem(t)})}initState(){this.$items.forEach(t=>{"true"===t.dataset.isopen?this.openItem(t):this.closeItem(t),t.removeAttribute("data-isopen")})}openItem(t){this.allowMultipleItemsOpen||this.closeAllItemsExcept(t);const e=t.querySelector(".tna-accordion__summary"),o=t.querySelector(".tna-accordion__content");e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label",`${e.innerText.trim()}, Hide this section`),o.removeAttribute("hidden"),this.syncToggleAllButton();const r=o.querySelectorAll(".tna-table-wrapper");r&&r.forEach(t=>{(0,i.DJ)(t)})}closeItem(t){const e=t.querySelector(".tna-accordion__summary"),o=t.querySelector(".tna-accordion__content");e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label",`${e.innerText.trim()}, Show this section`),o.setAttribute("hidden",""),this.syncToggleAllButton()}closeAllItemsExcept(t){Array.from(this.$items).filter(e=>e.querySelector(".tna-accordion__summary")!==t&&"true"===e.querySelector(".tna-accordion__summary").getAttribute("aria-expanded")).forEach(t=>this.closeItem(t))}isAllOpen(){return Array.from(this.$items).every(t=>"true"===t.querySelector(".tna-accordion__summary").getAttribute("aria-expanded"))}syncToggleAllButton(){this.$toggleAllButton&&(this.isAllOpen()?this.$toggleAllButton.innerText=this.$toggleAllButton.dataset.closeAllLabel||"Hide all sections":this.$toggleAllButton.innerText=this.$toggleAllButton.dataset.openAllLabel||"Show all sections")}}return r})());
2
2
  //# sourceMappingURL=accordion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components/accordion/accordion.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC,CATD,CASCK,KAAA,wECwFYC,EAAsB,SAACC,GAClC,IAAMC,EAAWD,EAAcE,cAAc,WACU,SAAjDF,EAAcG,QAAQC,yBACtBH,IAAaA,EAASI,KACxBJ,EAASI,GAAE,iBAAAC,QAAoBC,EAAAA,EAAAA,OAEjCP,EAAcG,QAAQC,uBAAyB,QAE7CJ,EAAcQ,YAAcR,EAAcS,aAC5CT,EAAcU,aAAa,WAAY,KACvCV,EAAcU,aAAa,OAAQ,UACnCV,EAAcU,aAAa,mBAAmBT,aAAQ,EAARA,EAAUI,KAAM,IAC9DL,EAAcW,UAAUC,IAAI,+BAE5BZ,EAAca,gBAAgB,YAC9Bb,EAAca,gBAAgB,QAC9Bb,EAAca,gBAAgB,mBAC9Bb,EAAcW,UAAUG,OAAO,6BAEnC,+BC1GA,MAAAC,EARe,WAAH,OACT,CAAC,MAAQ,KAAO,KAAO,KAAO,MAAMC,QAAQ,SAAW,SAACC,GAAI,OAEzDA,EACCC,OAAOC,gBAAgB,IAAIC,WAAW,IAAI,GAAM,IAAOH,EAAO,GAC/DI,SAAS,GAAG,EACf,ICPHC,EAAA,GAGA,SAAAC,EAAAC,GAEA,IAAAC,EAAAH,EAAAE,GACA,QAA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SAACuB,IACrB9E,EAAAA,EAAAA,IAAoB8E,EACtB,EAEJ,GAAC,CAAA/C,IAAA,YAAAc,MAED,SAAUW,GACR,IAAMY,EAAiBZ,EAAMrD,cAAc,2BACrCgE,EAAWX,EAAMrD,cAAc,2BACrCiE,EAAezD,aAAa,gBAAiB,SAC7CyD,EAAezD,aACb,aAAY,GAAAJ,OACT6D,EAAeG,UAAUM,OAAM,wBAEpCV,EAASxD,aAAa,SAAU,IAEhCsC,KAAKW,qBACP,GAAC,CAAA7B,IAAA,sBAAAc,MAED,SAAoBkC,GAAc,IAAAC,EAAA/B,KAChCgC,MAAMC,KAAKjC,KAAKE,QACbgC,OACC,SAAC3B,GAAK,OACJA,EAAMrD,cAAc,6BAA+B4E,GAGd,SAFrCvB,EACGrD,cAAc,2BACdsE,aAAa,gBAA2B,GAE9ClB,QAAQ,SAACC,GAAK,OAAKwB,EAAKjB,UAAUP,EAAM,EAC7C,GAAC,CAAAzB,IAAA,YAAAc,MAED,WACE,OAAOoC,MAAMC,KAAKjC,KAAKE,QAAQiC,MAC7B,SAAC5B,GAAK,MAGiC,SAFrCA,EACGrD,cAAc,2BACdsE,aAAa,gBAA2B,EAEjD,GAAC,CAAA1C,IAAA,sBAAAc,MAED,WACMI,KAAKU,mBACHV,KAAKa,YACPb,KAAKU,iBAAiBY,UACpBtB,KAAKU,iBAAiBvD,QAAQiF,eAAiB,oBAEjDpC,KAAKU,iBAAiBY,UACpBtB,KAAKU,iBAAiBvD,QAAQkF,cAAgB,oBAGtD,mFAAC,CAhJmB","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/helpers.mjs","webpack://TNAFrontend/./src/nationalarchives/lib/uuid.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/accordion/accordion.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 ","import uuidv4 from \"./uuid.mjs\";\n\nexport const iso8601ToPrettyDatetime = (dateStr) => {\n const datetime = dateStr;\n\n if (!datetime) {\n throw new Error(\"No datetime provided\");\n }\n const isDateTime =\n /^\\d{4}(?:-\\d{2}){2}(?:T| )\\d{2}(?::\\d{2}){1,2}(?:\\.\\d+)?(?:Z|(?:[+-]\\d{2}:\\d{2}))?$/u.test(\n datetime,\n );\n const isDate = /^\\d{4}(?:-\\d{2}){2}$/u.test(datetime);\n if (!isDateTime && !isDate) {\n throw new Error(\"Invalid datetime provided\");\n }\n\n const date = new Date(datetime);\n if (!(date instanceof Date) || isNaN(date)) {\n throw new Error(\"Invalid datetime provided\");\n }\n\n const dayString = date.toLocaleDateString(\"en-GB\", {\n weekday: \"long\",\n });\n const dateString = date.toLocaleDateString(\"en-GB\", {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n });\n\n if (isDateTime && (date.getHours() || date.getMinutes())) {\n let timeString = date.toLocaleTimeString(\"en-GB\", {\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n if (date.getSeconds()) {\n timeString = date.toLocaleTimeString(\"en-GB\", {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n }\n return `${dayString} ${dateString}, ${timeString}`;\n }\n return `${dayString} ${dateString}`;\n};\n\n/*\n * ==========================================\n * Transform any <time> element into a pretty\n * and human readable format that is based on\n * the valid ISO 8601 datetime attribute. The\n * replaced value will be localised according\n * to user's system settings, repurposing the\n * original text content as a title attribute\n * to allow users to see the value. A null or\n * invalid datetime format will result in the\n * element not being modified. If the updated\n * value is similar to the starting value for\n * the element text content, then the element\n * will not be updated to avoid redundancy.\n * ------------------------------------------\n * For example if the user's system has a UTC\n * timezone set then the element:\n *\n * <time\n * datetime=\"2026-03-05T13:48:00-05:00\"\n * >\n * 5 March 2026, 13:48 (UTC -5)\n * </time>\n *\n * would become:\n *\n * <time\n * datetime=\"2026-03-05T13:48:00-05:00\"\n * title=\"5 March 2026, 13:48 (UTC -5)\"\n * >\n * Thursday 5 March 2026, 09:48\n * </time>\n * ==========================================\n */\nexport const updateTimeElement = ($el) => {\n const datetime = $el.getAttribute(\"datetime\");\n\n try {\n const prettyDatetime = iso8601ToPrettyDatetime(datetime);\n if (!prettyDatetime.includes($el.textContent)) {\n $el.setAttribute(\"title\", $el.textContent);\n $el.textContent = prettyDatetime;\n }\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n // Do nothing if the datetime is invalid or not provided\n }\n};\n\nexport const checkTableForScroll = ($tableWrapper) => {\n const $caption = $tableWrapper.querySelector(\"caption\");\n if (!($tableWrapper.dataset.tableScrollInitialised === \"true\")) {\n if ($caption && !$caption.id) {\n $caption.id = `table-caption-${uuidv4()}`;\n }\n $tableWrapper.dataset.tableScrollInitialised = \"true\";\n }\n if ($tableWrapper.scrollWidth > $tableWrapper.clientWidth) {\n $tableWrapper.setAttribute(\"tabindex\", \"0\");\n $tableWrapper.setAttribute(\"role\", \"region\");\n $tableWrapper.setAttribute(\"aria-labelledby\", $caption?.id || \"\");\n $tableWrapper.classList.add(\"tna-table-wrapper--scroll\");\n } else {\n $tableWrapper.removeAttribute(\"tabindex\");\n $tableWrapper.removeAttribute(\"role\");\n $tableWrapper.removeAttribute(\"aria-labelledby\");\n $tableWrapper.classList.remove(\"tna-table-wrapper--scroll\");\n }\n};\n","/* eslint-disable no-magic-numbers */\n/* eslint-disable no-bitwise */\nconst uuidv4 = () =>\n ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/gu, (char) =>\n (\n char ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (char / 4)))\n ).toString(16),\n );\n\nexport default uuidv4;\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 { checkTableForScroll } from \"../../lib/helpers.mjs\";\n\nexport class Accordion {\n constructor($module) {\n this.$module = $module;\n this.$items = $module && $module.querySelectorAll(\".tna-accordion__item\");\n if (!this.$module || !this.$items) {\n return;\n }\n\n this.allowMultipleItemsOpen =\n this.$module.dataset.singleOpenItem !== \"true\";\n\n this.$items.forEach(($item) => this.initItem($item));\n this.initState();\n\n this.$toggleAllButton = this.$module.querySelector(\n \".tna-accordion__toggle-all\",\n );\n if (this.$toggleAllButton) {\n this.syncToggleAllButton();\n this.$toggleAllButton.removeAttribute(\"hidden\");\n this.$toggleAllButton.addEventListener(\"click\", () => {\n if (this.isAllOpen()) {\n this.$items.forEach(($item) => this.closeItem($item));\n } else {\n this.$items.forEach(($item) => this.openItem($item));\n }\n this.syncToggleAllButton();\n });\n }\n }\n\n initItem($item) {\n const $heading = $item.querySelector(\".tna-accordion__heading\");\n const $content = $item.querySelector(\".tna-accordion__body\");\n\n if (!$heading || !$content) {\n return;\n }\n\n $item.classList.add(\"tna-accordion__details\");\n $item.classList.remove(\"tna-accordion__item\");\n\n $heading.removeAttribute(\"class\");\n\n $content.classList.add(\"tna-accordion__content\");\n $content.classList.remove(\"tna-accordion__body\");\n $content.setAttribute(\"hidden\", \"\");\n\n const $headingButton = document.createElement(\"button\");\n $headingButton.classList.add(\"tna-accordion__summary\");\n $headingButton.setAttribute(\"type\", \"button\");\n $headingButton.setAttribute(\"aria-controls\", $content.id);\n $headingButton.innerText = $heading.innerText;\n $heading.innerText = \"\";\n $heading.appendChild($headingButton);\n\n $headingButton.addEventListener(\"click\", () => {\n const isOpen = $headingButton.getAttribute(\"aria-expanded\") === \"true\";\n if (isOpen) {\n this.closeItem($item);\n } else {\n this.openItem($item);\n }\n });\n }\n\n initState() {\n this.$items.forEach(($item) => {\n if ($item.dataset.isopen === \"true\") {\n this.openItem($item);\n } else {\n this.closeItem($item);\n }\n $item.removeAttribute(\"data-isopen\");\n });\n }\n\n openItem($item) {\n if (!this.allowMultipleItemsOpen) {\n this.closeAllItemsExcept($item);\n }\n const $headingButton = $item.querySelector(\".tna-accordion__summary\");\n const $content = $item.querySelector(\".tna-accordion__content\");\n $headingButton.setAttribute(\"aria-expanded\", \"true\");\n $headingButton.setAttribute(\n \"aria-label\",\n `${$headingButton.innerText.trim()}, Hide this section`,\n );\n $content.removeAttribute(\"hidden\");\n // $content.setAttribute(\"tabindex\", \"0\");\n this.syncToggleAllButton();\n\n const $tableWrapper = $content.querySelectorAll(\".tna-table-wrapper\");\n if ($tableWrapper) {\n $tableWrapper.forEach(($wrapper) => {\n checkTableForScroll($wrapper);\n });\n }\n }\n\n closeItem($item) {\n const $headingButton = $item.querySelector(\".tna-accordion__summary\");\n const $content = $item.querySelector(\".tna-accordion__content\");\n $headingButton.setAttribute(\"aria-expanded\", \"false\");\n $headingButton.setAttribute(\n \"aria-label\",\n `${$headingButton.innerText.trim()}, Show this section`,\n );\n $content.setAttribute(\"hidden\", \"\");\n // $content.setAttribute(\"tabindex\", \"-1\");\n this.syncToggleAllButton();\n }\n\n closeAllItemsExcept($excludeItem) {\n Array.from(this.$items)\n .filter(\n ($item) =>\n $item.querySelector(\".tna-accordion__summary\") !== $excludeItem &&\n $item\n .querySelector(\".tna-accordion__summary\")\n .getAttribute(\"aria-expanded\") === \"true\",\n )\n .forEach(($item) => this.closeItem($item));\n }\n\n isAllOpen() {\n return Array.from(this.$items).every(\n ($item) =>\n $item\n .querySelector(\".tna-accordion__summary\")\n .getAttribute(\"aria-expanded\") === \"true\",\n );\n }\n\n syncToggleAllButton() {\n if (this.$toggleAllButton) {\n if (this.isAllOpen()) {\n this.$toggleAllButton.innerText =\n this.$toggleAllButton.dataset.closeAllLabel || \"Hide all sections\";\n } else {\n this.$toggleAllButton.innerText =\n this.$toggleAllButton.dataset.openAllLabel || \"Show all sections\";\n }\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","checkTableForScroll","$tableWrapper","$caption","querySelector","dataset","tableScrollInitialised","id","concat","uuidv4","scrollWidth","clientWidth","setAttribute","classList","add","removeAttribute","remove","__WEBPACK_DEFAULT_EXPORT__","replace","char","crypto","getRandomValues","Uint8Array","toString","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","Accordion","$module","_this","this","_classCallCheck","$items","querySelectorAll","allowMultipleItemsOpen","singleOpenItem","forEach","$item","initItem","initState","$toggleAllButton","syncToggleAllButton","addEventListener","isAllOpen","closeItem","openItem","_this2","$heading","$content","$headingButton","document","createElement","innerText","appendChild","getAttribute","_this3","isopen","closeAllItemsExcept","trim","$wrapper","$excludeItem","_this4","Array","from","filter","every","closeAllLabel","openAllLabel"],"sourceRoot":""}
1
+ {"version":3,"file":"components/accordion/accordion.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC,CATD,CASCK,KAAA,wECPM,MA+FMC,EAAuBC,IAClC,MAAMC,EAAWD,EAAcE,cAAc,WACU,SAAjDF,EAAcG,QAAQC,yBACtBH,IAAaA,EAASI,KACxBJ,EAASI,GAAK,kBAAiB,EAAAC,EAAAC,QAEjCP,EAAcG,QAAQC,uBAAyB,QAE7CJ,EAAcQ,YAAcR,EAAcS,aAC5CT,EAAcU,aAAa,WAAY,KACvCV,EAAcU,aAAa,OAAQ,UACnCV,EAAcU,aAAa,kBAAmBT,GAAUI,IAAM,IAC9DL,EAAcW,UAAUC,IAAI,+BAE5BZ,EAAca,gBAAgB,YAC9Bb,EAAca,gBAAgB,QAC9Bb,EAAca,gBAAgB,mBAC9Bb,EAAcW,UAAUG,OAAO,4DChHnC,MAQAC,EARe,KACZ,CAAC,MAAQ,KAAO,KAAO,KAAO,MAAMC,QAAQ,UAAYC,IAErDA,EACCC,OAAOC,gBAAgB,IAAIC,WAAW,IAAI,GAAM,IAAOH,EAAO,GAC/DI,SAAS,OCNfC,EAAA,GAGA,SAAAC,EAAAC,GAEA,IAAAC,EAAAH,EAAAE,GACA,QAAAE,IAAAD,EACA,OAAAA,EAAA/B,QAGA,IAAAC,EAAA2B,EAAAE,GAAA,CAGA9B,QAAA,IAOA,OAHAiC,EAAAH,GAAA7B,EAAAA,EAAAD,QAAA6B,GAGA5B,EAAAD,OACA,CCrBA6B,EAAAK,EAAA,CAAAlC,EAAAmC,KACA,QAAAC,KAAAD,EACAN,EAAAQ,EAAAF,EAAAC,KAAAP,EAAA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SAFrCA,EACGpD,cAAc,2BACdoE,aAAa,iBAEtB,CAEA,mBAAAZ,GACMV,KAAKS,mBACHT,KAAKY,YACPZ,KAAKS,iBAAiBW,UACpBpB,KAAKS,iBAAiBtD,QAAQ+E,eAAiB,oBAEjDlC,KAAKS,iBAAiBW,UACpBpB,KAAKS,iBAAiBtD,QAAQgF,cAAgB,oBAGtD","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/helpers.mjs","webpack://TNAFrontend/./src/nationalarchives/lib/uuid.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/accordion/accordion.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 ","import uuidv4 from \"./uuid.mjs\";\n\nexport const iso8601ToPrettyDatetime = (dateStr) => {\n const datetime = dateStr;\n\n if (!datetime) {\n throw new Error(\"No datetime provided\");\n }\n const isDateTime =\n /^\\d{4}(?:-\\d{2}){2}(?:T| )\\d{2}(?::\\d{2}){1,2}(?:\\.\\d+)?(?:Z|(?:[+-]\\d{2}:\\d{2}))?$/u.test(\n datetime,\n );\n const isDate = /^\\d{4}(?:-\\d{2}){2}$/u.test(datetime);\n if (!isDateTime && !isDate) {\n throw new Error(\"Invalid datetime provided\");\n }\n\n const date = new Date(datetime);\n if (!(date instanceof Date) || isNaN(date)) {\n throw new Error(\"Invalid datetime provided\");\n }\n\n const dayString = date.toLocaleDateString(\"en-GB\", {\n weekday: \"long\",\n });\n const dateString = date.toLocaleDateString(\"en-GB\", {\n day: \"numeric\",\n month: \"long\",\n year: \"numeric\",\n });\n\n if (isDateTime && (date.getHours() || date.getMinutes())) {\n let timeString = date.toLocaleTimeString(\"en-GB\", {\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n if (date.getSeconds()) {\n timeString = date.toLocaleTimeString(\"en-GB\", {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n }\n return `${dayString} ${dateString}, ${timeString}`;\n }\n return `${dayString} ${dateString}`;\n};\n\n/*\n * ==========================================\n * Transform any <time> element into a pretty\n * and human readable format that is based on\n * the valid ISO 8601 datetime attribute. The\n * replaced value will be localised according\n * to user's system settings, repurposing the\n * original text content as a title attribute\n * to allow users to see the value. A null or\n * invalid datetime format will result in the\n * element not being modified. If the updated\n * value is similar to the starting value for\n * the element text content, then the element\n * will not be updated to avoid redundancy.\n * ------------------------------------------\n * For example if the user's system has a UTC\n * timezone set then the element:\n *\n * <time\n * datetime=\"2026-03-05T13:48:00-05:00\"\n * >\n * 5 March 2026, 13:48 (UTC -5)\n * </time>\n *\n * would become:\n *\n * <time\n * datetime=\"2026-03-05T13:48:00-05:00\"\n * title=\"5 March 2026, 13:48 (UTC -5)\"\n * >\n * Thursday 5 March 2026, 09:48\n * </time>\n * ==========================================\n */\nexport const updateTimeElement = ($el) => {\n const datetime = $el.getAttribute(\"datetime\");\n\n try {\n const prettyDatetime = iso8601ToPrettyDatetime(datetime);\n if (!prettyDatetime.includes($el.textContent)) {\n $el.setAttribute(\"title\", $el.textContent);\n $el.textContent = prettyDatetime;\n }\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\n // Do nothing if the datetime is invalid or not provided\n }\n};\n\nexport const checkTableForScroll = ($tableWrapper) => {\n const $caption = $tableWrapper.querySelector(\"caption\");\n if (!($tableWrapper.dataset.tableScrollInitialised === \"true\")) {\n if ($caption && !$caption.id) {\n $caption.id = `table-caption-${uuidv4()}`;\n }\n $tableWrapper.dataset.tableScrollInitialised = \"true\";\n }\n if ($tableWrapper.scrollWidth > $tableWrapper.clientWidth) {\n $tableWrapper.setAttribute(\"tabindex\", \"0\");\n $tableWrapper.setAttribute(\"role\", \"region\");\n $tableWrapper.setAttribute(\"aria-labelledby\", $caption?.id || \"\");\n $tableWrapper.classList.add(\"tna-table-wrapper--scroll\");\n } else {\n $tableWrapper.removeAttribute(\"tabindex\");\n $tableWrapper.removeAttribute(\"role\");\n $tableWrapper.removeAttribute(\"aria-labelledby\");\n $tableWrapper.classList.remove(\"tna-table-wrapper--scroll\");\n }\n};\n","/* eslint-disable no-magic-numbers */\n/* eslint-disable no-bitwise */\nconst uuidv4 = () =>\n ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/gu, (char) =>\n (\n char ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (char / 4)))\n ).toString(16),\n );\n\nexport default uuidv4;\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 { checkTableForScroll } from \"../../lib/helpers.mjs\";\n\nexport class Accordion {\n constructor($module) {\n this.$module = $module;\n this.$items = $module && $module.querySelectorAll(\".tna-accordion__item\");\n if (!this.$module || !this.$items) {\n return;\n }\n\n this.allowMultipleItemsOpen =\n this.$module.dataset.singleOpenItem !== \"true\";\n\n this.$items.forEach(($item) => this.initItem($item));\n this.initState();\n\n this.$toggleAllButton = this.$module.querySelector(\n \".tna-accordion__toggle-all\",\n );\n if (this.$toggleAllButton) {\n this.syncToggleAllButton();\n this.$toggleAllButton.removeAttribute(\"hidden\");\n this.$toggleAllButton.addEventListener(\"click\", () => {\n if (this.isAllOpen()) {\n this.$items.forEach(($item) => this.closeItem($item));\n } else {\n this.$items.forEach(($item) => this.openItem($item));\n }\n this.syncToggleAllButton();\n });\n }\n }\n\n initItem($item) {\n const $heading = $item.querySelector(\".tna-accordion__heading\");\n const $content = $item.querySelector(\".tna-accordion__body\");\n\n if (!$heading || !$content) {\n return;\n }\n\n $item.classList.add(\"tna-accordion__details\");\n $item.classList.remove(\"tna-accordion__item\");\n\n $heading.removeAttribute(\"class\");\n\n $content.classList.add(\"tna-accordion__content\");\n $content.classList.remove(\"tna-accordion__body\");\n $content.setAttribute(\"hidden\", \"\");\n\n const $headingButton = document.createElement(\"button\");\n $headingButton.classList.add(\"tna-accordion__summary\");\n $headingButton.setAttribute(\"type\", \"button\");\n $headingButton.setAttribute(\"aria-controls\", $content.id);\n $headingButton.innerText = $heading.innerText;\n $heading.innerText = \"\";\n $heading.appendChild($headingButton);\n\n $headingButton.addEventListener(\"click\", () => {\n const isOpen = $headingButton.getAttribute(\"aria-expanded\") === \"true\";\n if (isOpen) {\n this.closeItem($item);\n } else {\n this.openItem($item);\n }\n });\n }\n\n initState() {\n this.$items.forEach(($item) => {\n if ($item.dataset.isopen === \"true\") {\n this.openItem($item);\n } else {\n this.closeItem($item);\n }\n $item.removeAttribute(\"data-isopen\");\n });\n }\n\n openItem($item) {\n if (!this.allowMultipleItemsOpen) {\n this.closeAllItemsExcept($item);\n }\n const $headingButton = $item.querySelector(\".tna-accordion__summary\");\n const $content = $item.querySelector(\".tna-accordion__content\");\n $headingButton.setAttribute(\"aria-expanded\", \"true\");\n $headingButton.setAttribute(\n \"aria-label\",\n `${$headingButton.innerText.trim()}, Hide this section`,\n );\n $content.removeAttribute(\"hidden\");\n // $content.setAttribute(\"tabindex\", \"0\");\n this.syncToggleAllButton();\n\n const $tableWrapper = $content.querySelectorAll(\".tna-table-wrapper\");\n if ($tableWrapper) {\n $tableWrapper.forEach(($wrapper) => {\n checkTableForScroll($wrapper);\n });\n }\n }\n\n closeItem($item) {\n const $headingButton = $item.querySelector(\".tna-accordion__summary\");\n const $content = $item.querySelector(\".tna-accordion__content\");\n $headingButton.setAttribute(\"aria-expanded\", \"false\");\n $headingButton.setAttribute(\n \"aria-label\",\n `${$headingButton.innerText.trim()}, Show this section`,\n );\n $content.setAttribute(\"hidden\", \"\");\n // $content.setAttribute(\"tabindex\", \"-1\");\n this.syncToggleAllButton();\n }\n\n closeAllItemsExcept($excludeItem) {\n Array.from(this.$items)\n .filter(\n ($item) =>\n $item.querySelector(\".tna-accordion__summary\") !== $excludeItem &&\n $item\n .querySelector(\".tna-accordion__summary\")\n .getAttribute(\"aria-expanded\") === \"true\",\n )\n .forEach(($item) => this.closeItem($item));\n }\n\n isAllOpen() {\n return Array.from(this.$items).every(\n ($item) =>\n $item\n .querySelector(\".tna-accordion__summary\")\n .getAttribute(\"aria-expanded\") === \"true\",\n );\n }\n\n syncToggleAllButton() {\n if (this.$toggleAllButton) {\n if (this.isAllOpen()) {\n this.$toggleAllButton.innerText =\n this.$toggleAllButton.dataset.closeAllLabel || \"Hide all sections\";\n } else {\n this.$toggleAllButton.innerText =\n this.$toggleAllButton.dataset.openAllLabel || \"Show all sections\";\n }\n }\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","checkTableForScroll","$tableWrapper","$caption","querySelector","dataset","tableScrollInitialised","id","_uuid_mjs__WEBPACK_IMPORTED_MODULE_0__","A","scrollWidth","clientWidth","setAttribute","classList","add","removeAttribute","remove","__WEBPACK_DEFAULT_EXPORT__","replace","char","crypto","getRandomValues","Uint8Array","toString","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","Accordion","constructor","$module","this","$items","querySelectorAll","allowMultipleItemsOpen","singleOpenItem","forEach","$item","initItem","initState","$toggleAllButton","syncToggleAllButton","addEventListener","isAllOpen","closeItem","openItem","$heading","$content","$headingButton","document","createElement","innerText","appendChild","getAttribute","isopen","closeAllItemsExcept","trim","$wrapper","_lib_helpers_mjs__WEBPACK_IMPORTED_MODULE_0__","DJ","$excludeItem","Array","from","filter","every","closeAllLabel","openAllLabel"],"sourceRoot":""}
@@ -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={181(e,t,r){r.d(t,{A:()=>n});const n=function(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(e){return(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16)})}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{Breadcrumbs:()=>u});var o=r(181);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 a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function s(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=i(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}var u=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.$breadcrumbsList=t&&t.querySelector(".tna-breadcrumbs__list"),this.$breadcrumbs=t&&this.$breadcrumbsList&&t.querySelectorAll(".tna-breadcrumbs__item"),this.$module&&this.$breadcrumbsList&&this.$breadcrumbs&&this.$breadcrumbs.length>2&&!this.$module.classList.contains("tna-breadcrumbs--no-collapse")&&this.init()},(t=[{key:"init",value:function(){var e=this,t="tna-breadcrumbs-".concat((0,o.A)()),r=document.createElement("li");r.classList.add("tna-breadcrumbs__item","tna-breadcrumbs__item--expandable"),r.style.display="none";var n=document.createElement("button");n.classList.add("tna-breadcrumbs__link"),n.innerHTML="<span class='tna-!--visually-hidden'>Expand breadcrumbs</span>&hellip;",n.setAttribute("type","button"),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-controls",t),n.addEventListener("click",function(){e.$module.classList.remove("tna-breadcrumbs--collapsed"),r.remove(),e.$module.setAttribute("tabindex","0"),e.$module.focus(),e.$module.addEventListener("blur",function(){e.$module.removeAttribute("tabindex")},{once:!0})}),r.appendChild(n),this.$breadcrumbsList.setAttribute("id",t),this.$breadcrumbsList.insertBefore(r,this.$breadcrumbs[this.$breadcrumbs.length-2].nextSibling),this.$module.classList.add("tna-breadcrumbs--collapsed")}}])&&a(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={181(e,t,r){r.d(t,{A:()=>s});const s=()=>([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/gu,e=>(e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>e/4).toString(16))}},t={};function r(s){var a=t[s];if(void 0!==a)return a.exports;var i=t[s]={exports:{}};return e[s](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};r.r(s),r.d(s,{Breadcrumbs:()=>i});var a=r(181);class i{constructor(e){this.$module=e,this.$breadcrumbsList=e&&e.querySelector(".tna-breadcrumbs__list"),this.$breadcrumbs=e&&this.$breadcrumbsList&&e.querySelectorAll(".tna-breadcrumbs__item"),this.$module&&this.$breadcrumbsList&&this.$breadcrumbs&&this.$breadcrumbs.length>2&&!this.$module.classList.contains("tna-breadcrumbs--no-collapse")&&this.init()}init(){const e=`tna-breadcrumbs-${(0,a.A)()}`,t=document.createElement("li");t.classList.add("tna-breadcrumbs__item","tna-breadcrumbs__item--expandable"),t.style.display="none";const r=document.createElement("button");r.classList.add("tna-breadcrumbs__link"),r.innerHTML="<span class='tna-!--visually-hidden'>Expand breadcrumbs</span>&hellip;",r.setAttribute("type","button"),r.setAttribute("aria-expanded","false"),r.setAttribute("aria-controls",e),r.addEventListener("click",()=>{this.$module.classList.remove("tna-breadcrumbs--collapsed"),t.remove(),this.$module.setAttribute("tabindex","0"),this.$module.focus(),this.$module.addEventListener("blur",()=>{this.$module.removeAttribute("tabindex")},{once:!0})}),t.appendChild(r),this.$breadcrumbsList.setAttribute("id",e),this.$breadcrumbsList.insertBefore(t,this.$breadcrumbs[this.$breadcrumbs.length-2].nextSibling),this.$module.classList.add("tna-breadcrumbs--collapsed")}}return s})());
2
2
  //# sourceMappingURL=breadcrumbs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components/breadcrumbs/breadcrumbs.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC,CATD,CASCK,KAAA,0DCCD,MAAAC,EARe,WAAH,OACT,CAAC,MAAQ,KAAO,KAAO,KAAO,MAAMC,QAAQ,SAAW,SAACC,GAAI,OAEzDA,EACCC,OAAOC,gBAAgB,IAAIC,WAAW,IAAI,GAAM,IAAOH,EAAO,GAC/DI,SAAS,GAAG,EACf,ICPHC,EAAA,GAGA,SAAAC,EAAAC,GAEA,IAAAC,EAAAH,EAAAE,GACA,QAAAE,IAAAD,EACA,OAAAA,EAAAf,QAGA,IAAAC,EAAAW,EAAAE,GAAA,CAGAd,QAAA,IAOA,OAHAiB,EAAAH,GAAAb,EAAAA,EAAAD,QAAAa,GAGAZ,EAAAD,OACA,CCrBAa,EAAAK,EAAA,CAAAlB,EAAAmB,KACA,QAAAC,KAAAD,EACAN,EAAAQ,EAAAF,EAAAC,KAAAP,EAAAQ,EAAArB,EAAAoB,IACAE,OAAAC,eAAAvB,EAAAoB,EAAA,CAAyCI,YAAA,EAAAC,IAAAN,EAAAC,MCJzCP,EAAAQ,EAAA,CAAAK,EAAAC,IAAAL,OAAAM,UAAAC,eAAAC,KA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E,OAAS,GAAGwB,aAGlD7B,KAAKF,QAAQQ,UAAUU,IAAI,6BAC7B,mFAAC,CA9DqB","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/uuid.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/breadcrumbs/breadcrumbs.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 ","/* eslint-disable no-magic-numbers */\n/* eslint-disable no-bitwise */\nconst uuidv4 = () =>\n ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/gu, (char) =>\n (\n char ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (char / 4)))\n ).toString(16),\n );\n\nexport default uuidv4;\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 uuidv4 from \"../../lib/uuid.mjs\";\n\nexport class Breadcrumbs {\n constructor($module) {\n this.$module = $module;\n this.$breadcrumbsList =\n $module && $module.querySelector(\".tna-breadcrumbs__list\");\n this.$breadcrumbs =\n $module &&\n this.$breadcrumbsList &&\n $module.querySelectorAll(\".tna-breadcrumbs__item\");\n\n if (!this.$module || !this.$breadcrumbsList || !this.$breadcrumbs) {\n return;\n }\n\n if (\n /* eslint-disable-next-line no-magic-numbers */\n this.$breadcrumbs.length > 2 &&\n !this.$module.classList.contains(\"tna-breadcrumbs--no-collapse\")\n ) {\n this.init();\n }\n }\n\n init() {\n const uniqueId = `tna-breadcrumbs-${uuidv4()}`;\n const $expandable = document.createElement(\"li\");\n $expandable.classList.add(\n \"tna-breadcrumbs__item\",\n \"tna-breadcrumbs__item--expandable\",\n );\n $expandable.style.display = \"none\";\n\n const $expandButton = document.createElement(\"button\");\n $expandButton.classList.add(\"tna-breadcrumbs__link\");\n $expandButton.innerHTML =\n \"<span class='tna-!--visually-hidden'>Expand breadcrumbs</span>&hellip;\";\n $expandButton.setAttribute(\"type\", \"button\");\n $expandButton.setAttribute(\"aria-expanded\", \"false\");\n $expandButton.setAttribute(\"aria-controls\", uniqueId);\n $expandButton.addEventListener(\"click\", () => {\n this.$module.classList.remove(\"tna-breadcrumbs--collapsed\");\n $expandable.remove();\n this.$module.setAttribute(\"tabindex\", \"0\");\n this.$module.focus();\n this.$module.addEventListener(\n \"blur\",\n () => {\n this.$module.removeAttribute(\"tabindex\");\n },\n { once: true },\n );\n });\n $expandable.appendChild($expandButton);\n\n this.$breadcrumbsList.setAttribute(\"id\", uniqueId);\n this.$breadcrumbsList.insertBefore(\n $expandable,\n /* eslint-disable-next-line no-magic-numbers */\n this.$breadcrumbs[this.$breadcrumbs.length - 2].nextSibling,\n );\n\n this.$module.classList.add(\"tna-breadcrumbs--collapsed\");\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","__WEBPACK_DEFAULT_EXPORT__","replace","char","crypto","getRandomValues","Uint8Array","toString","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","Breadcrumbs","$module","_classCallCheck","this","$breadcrumbsList","querySelector","$breadcrumbs","querySelectorAll","length","classList","contains","init","_this","uniqueId","concat","uuidv4","$expandable","document","createElement","add","style","display","$expandButton","innerHTML","setAttribute","addEventListener","remove","focus","removeAttribute","once","appendChild","insertBefore","nextSibling"],"sourceRoot":""}
1
+ {"version":3,"file":"components/breadcrumbs/breadcrumbs.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC,CATD,CASCK,KAAA,0DCPD,MAQAC,EARe,KACZ,CAAC,MAAQ,KAAO,KAAO,KAAO,MAAMC,QAAQ,UAAYC,IAErDA,EACCC,OAAOC,gBAAgB,IAAIC,WAAW,IAAI,GAAM,IAAOH,EAAO,GAC/DI,SAAS,OCNfC,EAAA,GAGA,SAAAC,EAAAC,GAEA,IAAAC,EAAAH,EAAAE,GACA,QAAAE,IAAAD,EACA,OAAAA,EAAAf,QAGA,IAAAC,EAAAW,EAAAE,GAAA,CAGAd,QAAA,IAOA,OAHAiB,EAAAH,GAAAb,EAA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KAAKD,QAAQsB,iBACX,OACA,KACErB,KAAKD,QAAQyB,gBAAgB,aAE/B,CAAEC,MAAM,MAGZb,EAAYc,YAAYR,GAExBlB,KAAKC,iBAAiBmB,aAAa,KAAMX,GACzCT,KAAKC,iBAAiB0B,aACpBf,EAEAZ,KAAKG,aAAaH,KAAKG,aAAaE,OAAS,GAAGuB,aAGlD5B,KAAKD,QAAQO,UAAUS,IAAI,6BAC7B","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/uuid.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/breadcrumbs/breadcrumbs.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 ","/* eslint-disable no-magic-numbers */\n/* eslint-disable no-bitwise */\nconst uuidv4 = () =>\n ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/gu, (char) =>\n (\n char ^\n (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (char / 4)))\n ).toString(16),\n );\n\nexport default uuidv4;\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 uuidv4 from \"../../lib/uuid.mjs\";\n\nexport class Breadcrumbs {\n constructor($module) {\n this.$module = $module;\n this.$breadcrumbsList =\n $module && $module.querySelector(\".tna-breadcrumbs__list\");\n this.$breadcrumbs =\n $module &&\n this.$breadcrumbsList &&\n $module.querySelectorAll(\".tna-breadcrumbs__item\");\n\n if (!this.$module || !this.$breadcrumbsList || !this.$breadcrumbs) {\n return;\n }\n\n if (\n /* eslint-disable-next-line no-magic-numbers */\n this.$breadcrumbs.length > 2 &&\n !this.$module.classList.contains(\"tna-breadcrumbs--no-collapse\")\n ) {\n this.init();\n }\n }\n\n init() {\n const uniqueId = `tna-breadcrumbs-${uuidv4()}`;\n const $expandable = document.createElement(\"li\");\n $expandable.classList.add(\n \"tna-breadcrumbs__item\",\n \"tna-breadcrumbs__item--expandable\",\n );\n $expandable.style.display = \"none\";\n\n const $expandButton = document.createElement(\"button\");\n $expandButton.classList.add(\"tna-breadcrumbs__link\");\n $expandButton.innerHTML =\n \"<span class='tna-!--visually-hidden'>Expand breadcrumbs</span>&hellip;\";\n $expandButton.setAttribute(\"type\", \"button\");\n $expandButton.setAttribute(\"aria-expanded\", \"false\");\n $expandButton.setAttribute(\"aria-controls\", uniqueId);\n $expandButton.addEventListener(\"click\", () => {\n this.$module.classList.remove(\"tna-breadcrumbs--collapsed\");\n $expandable.remove();\n this.$module.setAttribute(\"tabindex\", \"0\");\n this.$module.focus();\n this.$module.addEventListener(\n \"blur\",\n () => {\n this.$module.removeAttribute(\"tabindex\");\n },\n { once: true },\n );\n });\n $expandable.appendChild($expandButton);\n\n this.$breadcrumbsList.setAttribute(\"id\", uniqueId);\n this.$breadcrumbsList.insertBefore(\n $expandable,\n /* eslint-disable-next-line no-magic-numbers */\n this.$breadcrumbs[this.$breadcrumbs.length - 2].nextSibling,\n );\n\n this.$module.classList.add(\"tna-breadcrumbs--collapsed\");\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","__WEBPACK_DEFAULT_EXPORT__","replace","char","crypto","getRandomValues","Uint8Array","toString","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","Breadcrumbs","constructor","$module","this","$breadcrumbsList","querySelector","$breadcrumbs","querySelectorAll","length","classList","contains","init","uniqueId","_lib_uuid_mjs__WEBPACK_IMPORTED_MODULE_0__","A","$expandable","document","createElement","add","style","display","$expandButton","innerHTML","setAttribute","addEventListener","remove","focus","removeAttribute","once","appendChild","insertBefore","nextSibling"],"sourceRoot":""}
@@ -1,3 +1,2 @@
1
- /*! For license information please see code-block.js.LICENSE.txt */
2
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("TNAFrontend",[],e):"object"==typeof exports?exports.TNAFrontend=e():t.TNAFrontend=e()}(self,()=>(()=>{"use strict";var t={d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function r(){var t,e,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",c=o.toStringTag||"@@toStringTag";function u(o,r,i,c){var u=r&&r.prototype instanceof f?r:f,l=Object.create(u.prototype);return n(l,"_invoke",function(o,r,n){var i,c,u,f=0,l=n||[],p=!1,y={p:0,n:0,v:t,a:s,f:s.bind(t,4),d:function(e,o){return i=e,c=0,u=t,y.n=o,a}};function s(o,r){for(c=o,u=r,e=0;!p&&f&&!n&&e<l.length;e++){var n,i=l[e],s=y.p,d=i[2];o>3?(n=d===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=t):i[0]<=s&&((n=o<2&&s<i[1])?(c=0,y.v=r,y.n=i[1]):s<d&&(n=o<3||i[0]>r||r>d)&&(i[4]=o,i[5]=r,y.n=d,c=0))}if(n||o>1)return a;throw p=!0,r}return function(n,l,d){if(f>1)throw TypeError("Generator is already running");for(p&&1===l&&s(l,d),c=l,u=d;(e=c<2?t:u)||!p;){i||(c?c<3?(c>1&&(y.n=-1),s(c,u)):y.n=u:y.v=u);try{if(f=2,i){if(c||(n="next"),e=i[n]){if(!(e=e.call(i,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,c<2&&(c=0)}else 1===c&&(e=i.return)&&e.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+n+"' method"),c=1);i=t}else if((e=(p=y.n<0)?u:o.call(r,y))!==a)break}catch(e){i=t,c=1,u=e}finally{f=1}}return{value:e,done:p}}}(o,i,c),!0),l}var a={};function f(){}function l(){}function p(){}e=Object.getPrototypeOf;var y=[][i]?e(e([][i]())):(n(e={},i,function(){return this}),e),s=p.prototype=f.prototype=Object.create(y);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,n(t,c,"GeneratorFunction")),t.prototype=Object.create(s),t}return l.prototype=p,n(s,"constructor",p),n(p,"constructor",l),l.displayName="GeneratorFunction",n(p,c,"GeneratorFunction"),n(s),n(s,c,"Generator"),n(s,i,function(){return this}),n(s,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:d}})()}function n(t,e,o,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}n=function(t,e,o,r){function c(e,o){n(t,e,function(t){return this._invoke(e,o,t)})}e?i?i(t,e,{value:o,enumerable:!r,configurable:!r,writable:!r}):t[e]=o:(c("next",0),c("throw",1),c("return",2))},n(t,e,o,r)}function i(t,e,o,r,n,i,c){try{var u=t[i](c),a=u.value}catch(t){return void o(t)}u.done?e(a):Promise.resolve(a).then(r,n)}function c(t){return function(){var e=this,o=arguments;return new Promise(function(r,n){var c=t.apply(e,o);function u(t){i(c,r,n,u,a,"next",t)}function a(t){i(c,r,n,u,a,"throw",t)}u(void 0)})}}function u(t,e){for(var o=0;o<e.length;o++){var r=e[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,f(r.key),r)}}function a(t,e,o){return e&&u(t.prototype,e),o&&u(t,o),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}t.r(e),t.d(e,{CodeBlock:()=>l});var l=a(function t(e){var o=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.$module=e,this.$code=this.$module.querySelector("pre code"),this.$copyButton=this.$module.querySelector(".tna-code-block__copy"),this.$module&&this.$code&&this.$copyButton&&navigator.clipboard&&(this.$copyButton.removeAttribute("hidden"),this.$module.classList.add("tna-code-block__copyable"),this.$copyButton.addEventListener("click",c(r().m(function t(){return r().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,navigator.clipboard.writeText(o.$code.innerText);case 1:o.$copyButton.innerText="Code copied",t.n=3;break;case 2:t.p=2,t.v;case 3:return t.a(2)}},t,null,[[0,2]])}))),this.$copyButton.addEventListener("blur",function(){o.$copyButton.innerText="Copy code"}))});return e})());
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={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{CodeBlock:()=>o});class o{constructor(e){this.$module=e,this.$code=this.$module.querySelector("pre code"),this.$copyButton=this.$module.querySelector(".tna-code-block__copy"),this.$module&&this.$code&&this.$copyButton&&navigator.clipboard&&(this.$copyButton.removeAttribute("hidden"),this.$module.classList.add("tna-code-block__copyable"),this.$copyButton.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(this.$code.innerText),this.$copyButton.innerText="Code copied"}catch{}}),this.$copyButton.addEventListener("blur",()=>{this.$copyButton.innerText="Copy code"}))}}return t})());
3
2
  //# sourceMappingURL=code-block.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components/code-block/code-block.js","mappings":";CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC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AAAL,EAAAJ,KAAAK,EAAAC,UAAA,aAAA8C,EAAA3C,GAAA,OAAAA,EAAA,UAAAgB,UAAA,uDAAA6B,OAAAjD,EAAA,CAAAkD,CAAAlD,GAAA,gBAAA+C,EAAA3C,GAAAA,EAAAA,EAAA,mCADO,IAAM+C,EAASL,EACpB,SAAAK,EAAYC,GAAS,IAAAC,EAAA5B,MAAvB,SAAAV,EAAAb,GAAA,KAAAa,aAAAb,GAAA,UAAAkB,UAAA,qCAAuBkC,CAAA7B,KAAA0B,GACnB1B,KAAK2B,QAAUA,EACf3B,KAAK8B,MAAQ9B,KAAK2B,QAAQI,cAAc,YACxC/B,KAAKgC,YAAchC,KAAK2B,QAAQI,cAAc,yBAG3C/B,KAAK2B,SACL3B,KAAK8B,OACL9B,KAAKgC,aACLC,UAAUC,YAKblC,KAAKgC,YAAYG,gBAAgB,UACjCnC,KAAK2B,QAAQS,UAAUC,IAAI,4BAE3BrC,KAAKgC,YAAYM,iBAAiB,QAAOxB,EAAAV,IAAAE,EAAE,SAAAiC,IAAA,OAAAnC,IAAAC,EAAA,SAAAmC,GAAA,cAAAA,EAAAtD,EAAAsD,EAAA/D,GAAA,cAAA+D,EAAAtD,EAAA,EAAAsD,EAAA/D,EAAA,EAEjCwD,UAAUC,UAAUO,UAAUb,EAAKE,MAAMY,WAAU,OACzDd,EAAKI,YAAYU,UAAY,cAAcF,EAAA/D,EAAA,eAAA+D,EAAAtD,EAAA,EAAAsD,EAAAnD,EAAA,cAAAmD,EAAAlD,EAAA,KAAAiD,EAAA,kBAM/CvC,KAAKgC,YAAYM,iBAAiB,OAAQ,WACxCV,EAAKI,YAAYU,UAAY,WAC/B,GACF","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","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/code-block/code-block.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 ","// The require scope\nvar __webpack_require__ = {};\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};","export class CodeBlock {\n constructor($module) {\n this.$module = $module;\n this.$code = this.$module.querySelector(\"pre code\");\n this.$copyButton = this.$module.querySelector(\".tna-code-block__copy\");\n\n if (\n !this.$module ||\n !this.$code ||\n !this.$copyButton ||\n !navigator.clipboard\n ) {\n return;\n }\n\n this.$copyButton.removeAttribute(\"hidden\");\n this.$module.classList.add(\"tna-code-block__copyable\");\n\n this.$copyButton.addEventListener(\"click\", async () => {\n try {\n await navigator.clipboard.writeText(this.$code.innerText);\n this.$copyButton.innerText = \"Code copied\";\n } catch {\n // Continue regardless of error\n }\n });\n\n this.$copyButton.addEventListener(\"blur\", () => {\n this.$copyButton.innerText = \"Copy code\";\n });\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","e","t","r","n","iterator","i","c","Generator","u","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","done","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","this","setPrototypeOf","__proto__","displayName","_regenerator","w","m","_invoke","configurable","writable","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","_defineProperties","_toPropertyKey","_createClass","_typeof","toPrimitive","String","_toPrimitive","CodeBlock","$module","_this","_classCallCheck","$code","querySelector","$copyButton","navigator","clipboard","removeAttribute","classList","add","addEventListener","_callee","_context","writeText","innerText"],"sourceRoot":""}
1
+ {"version":3,"file":"components/code-block/code-block.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC,CATD,CASCK,KAAA,uBCRD,IAAAC,EAAA,CCAAA,EAAA,CAAAL,EAAAM,KACA,QAAAC,KAAAD,EACAD,EAAAG,EAAAF,EAAAC,KAAAF,EAAAG,EAAAR,EAAAO,IACAE,OAAAC,eAAAV,EAAAO,EAAA,CAAyCI,YAAA,EAAAC,IAAAN,EAAAC,MCJzCF,EAAA,CAAAQ,EAAAC,IAAAL,OAAAM,UAAAC,eAAAC,KAAAJ,EAAAC,GCCAT,EAAAL,IACA,oBAAAkB,QAAAA,OAAAC,aACAV,OAAAC,eAAAV,EAAAkB,OAAAC,YAAA,CAAuDC,MAAA,WAEvDX,OAAAC,eAAAV,EAAA,cAAgDoB,OAAA,2CCLzC,MAAMC,EACX,WAAAC,CAAYC,GACVC,KAAKD,QAAUA,EACfC,KAAKC,MAAQD,KAAKD,QAAQG,cAAc,YACxCF,KAAKG,YAAcH,KAAKD,QAAQG,cAAc,yBAG3CF,KAAKD,SACLC,KAAKC,OACLD,KAAKG,aACLC,UAAUC,YAKbL,KAAKG,YAAYG,gBAAgB,UACjCN,KAAKD,QAAQQ,UAAUC,IAAI,4BAE3BR,KAAKG,YAAYM,iBAAiB,QAASC,UACzC,UACQN,UAAUC,UAAUM,UAAUX,KAAKC,MAAMW,WAC/CZ,KAAKG,YAAYS,UAAY,aAC/B,CAAE,MACA,IAIJZ,KAAKG,YAAYM,iBAAiB,OAAQ,KACxCT,KAAKG,YAAYS,UAAY,cAEjC","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","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/code-block/code-block.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 ","// The require scope\nvar __webpack_require__ = {};\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};","export class CodeBlock {\n constructor($module) {\n this.$module = $module;\n this.$code = this.$module.querySelector(\"pre code\");\n this.$copyButton = this.$module.querySelector(\".tna-code-block__copy\");\n\n if (\n !this.$module ||\n !this.$code ||\n !this.$copyButton ||\n !navigator.clipboard\n ) {\n return;\n }\n\n this.$copyButton.removeAttribute(\"hidden\");\n this.$module.classList.add(\"tna-code-block__copyable\");\n\n this.$copyButton.addEventListener(\"click\", async () => {\n try {\n await navigator.clipboard.writeText(this.$code.innerText);\n this.$copyButton.innerText = \"Code copied\";\n } catch {\n // Continue regardless of error\n }\n });\n\n this.$copyButton.addEventListener(\"blur\", () => {\n this.$copyButton.innerText = \"Copy code\";\n });\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","CodeBlock","constructor","$module","this","$code","querySelector","$copyButton","navigator","clipboard","removeAttribute","classList","add","addEventListener","async","writeText","innerText"],"sourceRoot":""}
@@ -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={533(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)}var o;function r(e){return function(e){if(Array.isArray(e))return s(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 s(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)?s(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 s(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 c(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,l(i.key),i)}}function a(e,t,n){return(t=l(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(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:()=>k}),(o=window).TNAFrontendCookieEvents||(o.TNAFrontendCookieEvents=null);var u,h=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),a(this,"events",{}),a(this,"oneTimeEvents",{}),a(this,"debug",!1),this.debug=t,window.TNAFrontendCookieEvents)return this.log("Using existing TNAFrontendCookieEvents instance"),window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this},t=[{key:"log",value:function(){if(this.debug){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,["[TNA Frontend Cookie Events]"].concat(n))}}},{key:"on",value:function(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[].concat(r(this.events[e]),[t])}},{key:"once",value:function(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[].concat(r(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.log("Triggering event: ".concat(e),n),this.events[e].forEach(function(e){return e.call(t,n)})),Object.hasOwn(this.oneTimeEvents,e)){this.log("Triggering one-time event: ".concat(e),n);for(var i=this.oneTimeEvents[e].length-1;i>=0;i-=1)this.oneTimeEvents[e][i].call(this,n),this.oneTimeEvents[e].splice(i,1)}}}],t&&c(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function f(e){return f="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},f(e)}function d(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 y(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 v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach(function(t){g(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function p(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,m(i.key),i)}}function g(e,t,n){return(t=m(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){var t=function(e){if("object"!=f(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}(u=window).TNAFrontendCookies||(u.TNAFrontendCookies=null);var b=["usage","settings","marketing","essential"],k=function(){return e=function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),g(this,"defaultDomain",""),g(this,"defaultPath",""),g(this,"secure",!0),g(this,"policiesKey",""),g(this,"events",null),g(this,"defaultAge",null),g(this,"policiesCorrectOnInit",!1),g(this,"debug","true"===document.documentElement.dataset.tnaFrontendDebug);var i=n.defaultDomain,o=n.defaultPath,r=n.secure,s=n.policiesKey,c=n.defaultAge,a=n.newInstance,l=void 0!==a&&a,u=n.noInit,f=void 0!==u&&u;if(!l&&window.TNAFrontendCookies)return window.TNAFrontendCookies;this.defaultDomain=i||document.documentElement.dataset.tnaCookiesDomain||window.location.hostname,this.defaultPath=o||document.documentElement.dataset.tnaCookiesPath||"/",this.secure=r||"true"!==document.documentElement.dataset.tnaCookiesInsecure,this.policiesKey=s||document.documentElement.dataset.tnaCookiesPoliciesKey||"cookies_policy",this.defaultAge=c||parseInt(document.documentElement.dataset.tnaCookiesDefaultAge,10)||31536e3,this.events=new h(this.debug),this.policiesCorrectOnInit=Object.keys(this.policies).length===b.length&&b.every(function(e){return Object.keys(t.policies).includes(e)&&"boolean"==typeof t.policies[e]}),this.policiesCorrectOnInit||f||this.init(),this.log({defaultDomain:this.defaultDomain,defaultPath:this.defaultPath,secure:this.secure,policiesKey:this.policiesKey,defaultAge:this.defaultAge,policiesCorrectOnInit:this.policiesCorrectOnInit}),l||window.TNAFrontendCookies||(window.TNAFrontendCookies=this)},t=[{key:"init",value:function(){var e=this.policies;this.log("Existing policies on init:",e);var t=Object.fromEntries(Object.keys(e).filter(function(e){return b.includes(e)}).map(function(t){return[t,e[t]]}));Object.keys(t).length&&this.log("Filtered existing policies:",t),this.savePolicies(v(v({usage:!1,settings:!1,marketing:!1},t),{},{essential:!0}))}},{key:"log",value:function(){if(this.debug){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,["[TNA Frontend Cookies]"].concat(n,[this.all]))}}},{key:"destroyInstance",value:function(){this.log("Destroying TNAFrontendCookies instance"),window.TNAFrontendCookies=null}},{key:"all",get:function(){var e={};return document.cookie.split("; ").filter(function(e){return""!==e.trim()}).forEach(function(t){var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,r,s,c=[],a=!0,l=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;a=!1}else for(;!(a=(i=r.call(n)).done)&&(c.push(i.value),c.length!==t);a=!0);}catch(e){l=!0,o=e}finally{try{if(!a&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return d(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)?d(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.trim().split("="),2),i=n[0],o=n[1];i&&(e[i]=decodeURIComponent(o||""))}),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.defaultDomain:c,l=n.path,u=void 0===l?this.defaultPath:l,h=n.secure,f=void 0===h?this.secure:h,d=n.session,y=void 0!==d&&d;if(e){var v="";f&&(v="; secure");var p="";y||(p="; max-age=".concat(o));var g="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t),"; domain=").concat(a,"; samesite=").concat(s,"; path=").concat(u).concat(p).concat(v);document.cookie=g,this.log("Set cookie:",{key:e,value:t,maxAge:o,path:u,sameSite:s,domain:a,secure:f,session:y,cookie:g}),this.events.trigger("setCookie",{key:e,value:t,maxAge:o,path:u,sameSite:s,domain:a,secure:f,session:y,cookie:g})}}},{key:"delete",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.defaultDomain,i={maxAge:-1,path:t,domain:n||this.defaultDomain};this.set(e,"",i),this.log("Deleted cookie:",v({key:e,path:t,domain:n},i)),this.events.trigger("deleteCookie",v({key:e},i))}},{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]:this.defaultDomain;Object.keys(this.all).forEach(function(i){e.delete(i,t,n)}),this.log("Deleted all cookies",{path:t,domain:n}),this.events.trigger("deleteAllCookies",{path:t,domain:n})}},{key:"acceptPolicy",value:function(e){this.log("Accepting policy:",e),this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",g({},e,!0))}},{key:"rejectPolicy",value:function(e){this.log("Rejecting policy:",e),this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",g({},e,!1))}},{key:"setPolicy",value:function(e,t){"essential"!==e?(this.log("Setting policy ".concat(e," to ").concat(t)),this.savePolicies(v(v({},this.policies),{},g(g({},e,t),"essential",!0))),this.events.trigger("changePolicy",g({},e,t))):this.log("Cannot change essential policy, it is always accepted.")}},{key:"acceptAllPolicies",value:function(){this.log("Accepting all policies");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(){this.log("Rejecting all policies");var e=v(v({},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.log("Saving policies:",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.log("Adding event listener for: ".concat(e)),this.events.on(e,t)}},{key:"once",value:function(e,t){this.log("Adding one-time event listener for: ".concat(e)),this.events.once(e,t)}}],t&&p(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var 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,{CookieBanner:()=>a,Cookies:()=>o.A});var o=n(533);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.$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&&(this.cookies=new o.A({newInstance:!0}),this.cookiePreferencesSetKey=this.$module.dataset.preferencesKey||"cookie_preferences_set",this.cookies.policiesCorrectOnInit||this.cookies.delete(this.cookiePreferencesSetKey),this.cookies.exists(this.cookiePreferencesSetKey)&&this.cookies.hasValue(this.cookiePreferencesSetKey,"true")||(this.$module.removeAttribute("hidden"),this.$acceptButton.addEventListener("click",function(){return n.accept()}),this.$rejectButton.addEventListener("click",function(){return n.reject()})))},(t=[{key:"accept",value:function(){var e=this;this.$prompt.setAttribute("hidden",""),this.complete(),this.cookies.acceptAllPolicies(),this.$acceptedMessage.removeAttribute("hidden"),this.$acceptedMessage.setAttribute("tabindex","0"),this.$acceptedMessage.focus(),this.$acceptedMessage.addEventListener("blur",function(){e.$acceptedMessage.removeAttribute("tabindex")})}},{key:"reject",value:function(){var e=this;this.$prompt.setAttribute("hidden",""),this.complete(),this.cookies.rejectAllPolicies(),this.$rejectedMessage.removeAttribute("hidden"),this.$rejectedMessage.setAttribute("tabindex","0"),this.$rejectedMessage.focus(),this.$rejectedMessage.addEventListener("blur",function(){e.$rejectedMessage.removeAttribute("tabindex")})}},{key:"complete",value:function(){var e=this;this.cookies.set(this.cookiePreferencesSetKey,!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 i})());
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={533(e,t,i){i.d(t,{A:()=>n}),window.TNAFrontendCookieEvents||=null;class s{events={};oneTimeEvents={};debug=!1;constructor(e=!1){if(this.debug=e,window.TNAFrontendCookieEvents)return this.log("Using existing TNAFrontendCookieEvents instance"),window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this}log(...e){this.debug&&console.log("[TNA Frontend Cookie Events]",...e)}on(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[...this.events[e],t]}once(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[...this.oneTimeEvents[e],t]}trigger(e,t={}){if(Object.hasOwn(this.events,e)&&(this.log(`Triggering event: ${e}`,t),this.events[e].forEach(e=>e.call(this,t))),Object.hasOwn(this.oneTimeEvents,e)){this.log(`Triggering one-time event: ${e}`,t);for(let i=this.oneTimeEvents[e].length-1;i>=0;i-=1)this.oneTimeEvents[e][i].call(this,t),this.oneTimeEvents[e].splice(i,1)}}}window.TNAFrontendCookies||=null;const o=["usage","settings","marketing","essential"];class n{defaultDomain="";defaultPath="";secure=!0;policiesKey="";events=null;defaultAge=null;policiesCorrectOnInit=!1;debug="true"===document.documentElement.dataset.tnaFrontendDebug;constructor(e={}){const{defaultDomain:t,defaultPath:i,secure:n,policiesKey:c,defaultAge:l,newInstance:r=!1,noInit:a=!1}=e;if(!r&&window.TNAFrontendCookies)return window.TNAFrontendCookies;if(this.defaultDomain=t||document.documentElement.dataset.tnaCookiesDomain||window.location.hostname,this.defaultPath=i||document.documentElement.dataset.tnaCookiesPath||"/",this.secure=n||"true"!==document.documentElement.dataset.tnaCookiesInsecure,this.policiesKey=c||document.documentElement.dataset.tnaCookiesPoliciesKey||"cookies_policy",l)this.defaultAge=l;else{const e=31536e3;this.defaultAge=parseInt(document.documentElement.dataset.tnaCookiesDefaultAge,10)||e}this.events=new s(this.debug),this.policiesCorrectOnInit=Object.keys(this.policies).length===o.length&&o.every(e=>Object.keys(this.policies).includes(e)&&"boolean"==typeof this.policies[e]),this.policiesCorrectOnInit||a||this.init(),this.log({defaultDomain:this.defaultDomain,defaultPath:this.defaultPath,secure:this.secure,policiesKey:this.policiesKey,defaultAge:this.defaultAge,policiesCorrectOnInit:this.policiesCorrectOnInit}),r||window.TNAFrontendCookies||(window.TNAFrontendCookies=this)}init(){const e=this.policies;this.log("Existing policies on init:",e);const t=Object.fromEntries(Object.keys(e).filter(e=>o.includes(e)).map(t=>[t,e[t]]));Object.keys(t).length&&this.log("Filtered existing policies:",t),this.savePolicies({usage:!1,settings:!1,marketing:!1,...t,essential:!0})}log(...e){this.debug&&console.log("[TNA Frontend Cookies]",...e,this.all)}destroyInstance(){this.log("Destroying TNAFrontendCookies instance"),window.TNAFrontendCookies=null}get all(){const e={};return document.cookie.split("; ").filter(e=>""!==e.trim()).forEach(t=>{const i=t.trim().split("="),[s,o]=i;s&&(e[s]=decodeURIComponent(o||""))}),e}get policies(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}exists(e){return Object.hasOwn(this.all,e)}hasValue(e,t){return this.get(e)===t}get(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}set(e,t,i={}){const{maxAge:s=this.defaultAge,sameSite:o="Lax",domain:n=this.defaultDomain,path:c=this.defaultPath,secure:l=this.secure,session:r=!1}=i;if(!e)return;let a="";l&&(a="; secure");let h="";r||(h=`; max-age=${s}`);const d=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; domain=${n}; samesite=${o}; path=${c}${h}${a}`;document.cookie=d,this.log("Set cookie:",{key:e,value:t,maxAge:s,path:c,sameSite:o,domain:n,secure:l,session:r,cookie:d}),this.events.trigger("setCookie",{key:e,value:t,maxAge:s,path:c,sameSite:o,domain:n,secure:l,session:r,cookie:d})}delete(e,t="/",i=this.defaultDomain){const s={maxAge:-1,path:t,domain:i||this.defaultDomain};this.set(e,"",s),this.log("Deleted cookie:",{key:e,path:t,domain:i,...s}),this.events.trigger("deleteCookie",{key:e,...s})}deleteAll(e="/",t=this.defaultDomain){Object.keys(this.all).forEach(i=>{this.delete(i,e,t)}),this.log("Deleted all cookies",{path:e,domain:t}),this.events.trigger("deleteAllCookies",{path:e,domain:t})}acceptPolicy(e){this.log("Accepting policy:",e),this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",{[e]:!0})}rejectPolicy(e){this.log("Rejecting policy:",e),this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",{[e]:!1})}setPolicy(e,t){"essential"!==e?(this.log(`Setting policy ${e} to ${t}`),this.savePolicies({...this.policies,[e]:t,essential:!0}),this.events.trigger("changePolicy",{[e]:t})):this.log("Cannot change essential policy, it is always accepted.")}acceptAllPolicies(){this.log("Accepting all policies");const e=Object.fromEntries(Object.keys(this.policies).map(e=>[e.toLowerCase(),!0]));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}rejectAllPolicies(){this.log("Rejecting all policies");const e={...Object.fromEntries(Object.keys(this.policies).map(e=>[e.toLowerCase(),!1])),essential:!0};this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}savePolicies(e){this.log("Saving policies:",e),this.set(this.policiesKey,JSON.stringify(e))}isPolicyAccepted(e){return Object.hasOwn(this.policies,e)?!0===this.policies[e]:null}on(e,t){this.log(`Adding event listener for: ${e}`),this.events.on(e,t)}once(e,t){this.log(`Adding one-time event listener for: ${e}`),this.events.once(e,t)}}}},t={};function i(s){var o=t[s];if(void 0!==o)return o.exports;var n=t[s]={exports:{}};return e[s](n,n.exports,i),n.exports}i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},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 s={};i.r(s),i.d(s,{CookieBanner:()=>n,Cookies:()=>o.A});var o=i(533);class n{constructor(e){this.$module=e,this.$acceptButton=e&&e.querySelector('[value="accept"]'),this.$rejectButton=e&&e.querySelector('[value="reject"]'),this.$prompt=e&&e.querySelector(".tna-cookie-banner__message--prompt"),this.$acceptedMessage=e&&e.querySelector(".tna-cookie-banner__message--accepted"),this.$rejectedMessage=e&&e.querySelector(".tna-cookie-banner__message--rejected"),this.$closeButtons=e&&e.querySelectorAll('[value="close"]'),this.$module&&this.$acceptButton&&this.$rejectButton&&this.$prompt&&this.$acceptedMessage&&this.$rejectedMessage&&this.$closeButtons&&(this.cookies=new o.A({newInstance:!0}),this.cookiePreferencesSetKey=this.$module.dataset.preferencesKey||"cookie_preferences_set",this.cookies.policiesCorrectOnInit||this.cookies.delete(this.cookiePreferencesSetKey),this.cookies.exists(this.cookiePreferencesSetKey)&&this.cookies.hasValue(this.cookiePreferencesSetKey,"true")||(this.$module.removeAttribute("hidden"),this.$acceptButton.addEventListener("click",()=>this.accept()),this.$rejectButton.addEventListener("click",()=>this.reject())))}accept(){this.$prompt.setAttribute("hidden",""),this.complete(),this.cookies.acceptAllPolicies(),this.$acceptedMessage.removeAttribute("hidden"),this.$acceptedMessage.setAttribute("tabindex","0"),this.$acceptedMessage.focus(),this.$acceptedMessage.addEventListener("blur",()=>{this.$acceptedMessage.removeAttribute("tabindex")})}reject(){this.$prompt.setAttribute("hidden",""),this.complete(),this.cookies.rejectAllPolicies(),this.$rejectedMessage.removeAttribute("hidden"),this.$rejectedMessage.setAttribute("tabindex","0"),this.$rejectedMessage.focus(),this.$rejectedMessage.addEventListener("blur",()=>{this.$rejectedMessage.removeAttribute("tabindex")})}complete(){this.cookies.set(this.cookiePreferencesSetKey,!0),this.$closeButtons.forEach(e=>{e.addEventListener("click",()=>this.close())})}close(){this.$module.setAttribute("hidden","")}}return s})());
2
2
  //# sourceMappingURL=cookie-banner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components/cookie-banner/cookie-banner.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC,CATD,CASCK,KAAA,8jDCTDC,EAAAC,QAAOC,0BAAPF,EAAOE,wBAA4B,MAE5B,MAAMC,EAAkB,WAa5B,SARD,SAAAA,IAA2B,IAAfC,EAAKC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GAEf,+FAFuBG,CAAAC,KAAAN,GAAAO,EAAAD,KAAA,SAJhB,CAAC,GAACC,EAAAD,KAAA,gBACK,CAAC,GAACC,EAAAD,KAAA,SACV,GAGNA,KAAKL,MAAQA,EACTH,OAAOC,wBAGT,OAFAO,KAAKE,IAAI,mDAEFV,OAAOC,wBAEhBD,OAAOC,wBAA0BO,IACnC,IAAC,EAAAG,IAAA,MAAAC,MAED,WACE,GAAIJ,KAAKL,MAAO,SAAAU,EAAAC,EAAAV,UAAAC,OADXU,EAAI,IAAAC,MAAAF,GAAAG,EAAA,EAAAA,EAAAH,EAAAG,IAAJF,EAAIE,GAAAb,UAAAa,IAGPJ,EAAAK,SAAQR,IAAGS,MAAAN,EAAA,CAAC,gCAA8BO,OAAKL,GACjD,CACF,GAEA,CAAAJ,IAAA,KAAAC,MAKA,SAAGS,EAAOC,GACHC,OAAOC,OAAOhB,KAAKiB,OAAQJ,KAC9Bb,KAAKiB,OAAOJ,GAAS,IAEvBb,KAAKiB,OAAOJ,GAAM,GAAAD,OAAAM,EAAOlB,KAAKiB,OAAOJ,IAAM,CAAEC,GAC/C,GAAC,CAAAX,IAAA,OAAAC,MAED,SAAKS,EAAOC,GACL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KkI,iBAAiBe,QACtBjJ,KAAKkI,iBAAiBS,iBAAiB,OAAQ,WAC7CxC,EAAK+B,iBAAiBQ,gBAAgB,WACxC,EACF,GAAC,CAAAvI,IAAA,SAAAC,MAED,WAAS,IAAA8I,EAAAlJ,KACPA,KAAKiI,QAAQa,aAAa,SAAU,IACpC9I,KAAK+I,WACL/I,KAAKsI,QAAQa,oBACbnJ,KAAKmI,iBAAiBO,gBAAgB,UACtC1I,KAAKmI,iBAAiBW,aAAa,WAAY,KAC/C9I,KAAKmI,iBAAiBc,QACtBjJ,KAAKmI,iBAAiBQ,iBAAiB,OAAQ,WAC7CO,EAAKf,iBAAiBO,gBAAgB,WACxC,EACF,GAAC,CAAAvI,IAAA,WAAAC,MAED,WAAW,IAAAgJ,EAAApJ,KACTA,KAAKsI,QAAQpC,IAAIlG,KAAKuI,yBAAyB,GAC/CvI,KAAKoI,cAAc9G,QAAQ,SAAC+H,GAC1BA,EAAaV,iBAAiB,QAAS,kBAAMS,EAAKE,OAAO,EAC3D,EACF,GAAC,CAAAnJ,IAAA,QAAAC,MAED,WACEJ,KAAK6H,QAAQiB,aAAa,SAAU,GACtC,mFAAC,CA9EsB","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookie-events.mjs","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.TNAFrontendCookieEvents ||= null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n debug = false;\n\n constructor(debug = false) {\n this.debug = debug;\n if (window.TNAFrontendCookieEvents) {\n this.log(\"Using existing TNAFrontendCookieEvents instance\");\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n log(...args) {\n if (this.debug) {\n /* eslint-disable-next-line no-console */\n console.log(\"[TNA Frontend Cookie Events]\", ...args);\n }\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.log(`Triggering event: ${event}`, data);\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n this.log(`Triggering one-time event: ${event}`, data);\n\n for (\n /* eslint-disable-next-line no-magic-numbers */\n let eventIndex = this.oneTimeEvents[event].length - 1;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex >= 0;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex -= 1\n ) {\n const eventToTrigger = this.oneTimeEvents[event][eventIndex];\n eventToTrigger.call(this, data);\n /* eslint-disable-next-line no-magic-numbers */\n this.oneTimeEvents[event].splice(eventIndex, 1);\n }\n }\n }\n}\n","/* eslint-disable max-lines */\n/* eslint-disable no-console */\n\nimport { CookieEventHandler } from \"./cookie-events.mjs\";\n\nwindow.TNAFrontendCookies ||= null;\n\nconst tnaCookiePolicies = [\"usage\", \"settings\", \"marketing\", \"essential\"];\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n defaultDomain = \"\";\n /** @protected */\n defaultPath = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n /** @protected */\n policiesCorrectOnInit = false;\n /** @protected */\n debug = document.documentElement.dataset.tnaFrontendDebug === \"true\";\n\n /**\n * Create a cookie handler.\n * @param {String} [options.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path] - The domain to register the cookie with.\n * @param {Boolean} [options.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey] - The name of the cookie.\n * @param {Number} [options.defaultAge] - The default age of non-session cookies.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {Boolean} [options.noInit=false] - Don't initialise a blank cookie policy.\n */\n constructor(options = {}) {\n const {\n defaultDomain,\n defaultPath,\n secure,\n policiesKey,\n defaultAge,\n newInstance = false,\n noInit = false,\n } = options;\n if (!newInstance && window.TNAFrontendCookies) {\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookies;\n }\n if (defaultDomain) {\n this.defaultDomain = defaultDomain;\n } else {\n this.defaultDomain =\n document.documentElement.dataset.tnaCookiesDomain ||\n window.location.hostname;\n }\n if (defaultPath) {\n this.defaultPath = defaultPath;\n } else {\n this.defaultPath = document.documentElement.dataset.tnaCookiesPath || \"/\";\n }\n if (secure) {\n this.secure = secure;\n } else {\n this.secure =\n document.documentElement.dataset.tnaCookiesInsecure !== \"true\";\n }\n if (policiesKey) {\n this.policiesKey = policiesKey;\n } else {\n this.policiesKey =\n document.documentElement.dataset.tnaCookiesPoliciesKey ||\n \"cookies_policy\";\n }\n if (defaultAge) {\n this.defaultAge = defaultAge;\n } else {\n /* eslint-disable-next-line no-magic-numbers */\n const secondsInAYear = 365 * 24 * 60 * 60;\n this.defaultAge =\n parseInt(document.documentElement.dataset.tnaCookiesDefaultAge, 10) ||\n secondsInAYear;\n }\n this.events = new CookieEventHandler(this.debug);\n this.policiesCorrectOnInit =\n Object.keys(this.policies).length === tnaCookiePolicies.length &&\n tnaCookiePolicies.every(\n (policy) =>\n Object.keys(this.policies).includes(policy) &&\n typeof this.policies[policy] === \"boolean\",\n );\n if (!this.policiesCorrectOnInit && !noInit) {\n this.init();\n }\n this.log({\n defaultDomain: this.defaultDomain,\n defaultPath: this.defaultPath,\n secure: this.secure,\n policiesKey: this.policiesKey,\n defaultAge: this.defaultAge,\n policiesCorrectOnInit: this.policiesCorrectOnInit,\n });\n if (!newInstance && !window.TNAFrontendCookies) {\n window.TNAFrontendCookies = this;\n }\n }\n\n /** @protected */\n init() {\n const existingPolicies = this.policies;\n this.log(\"Existing policies on init:\", existingPolicies);\n const filteredExistingPolicies = Object.fromEntries(\n Object.keys(existingPolicies)\n .filter((policy) => tnaCookiePolicies.includes(policy))\n .map((policy) => [policy, existingPolicies[policy]]),\n );\n if (Object.keys(filteredExistingPolicies).length) {\n this.log(\"Filtered existing policies:\", filteredExistingPolicies);\n }\n this.savePolicies({\n usage: false,\n settings: false,\n marketing: false,\n ...filteredExistingPolicies,\n essential: true,\n });\n }\n\n log(...args) {\n if (this.debug) {\n console.log(\"[TNA Frontend Cookies]\", ...args, this.all);\n }\n }\n\n destroyInstance() {\n this.log(\"Destroying TNAFrontendCookies instance\");\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n /* eslint-disable-next-line class-methods-use-this */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((cookie) => cookie.trim() !== \"\")\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n const [key, value] = parts;\n if (key) {\n deserialised[key] = decodeURIComponent(value || \"\");\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\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|null}\n */\n get(key) {\n if (this.exists(key)) {\n return decodeURIComponent(this.all[key]);\n }\n return 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.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path=this.defaultPath] - 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.defaultDomain,\n path = this.defaultPath,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n let secureString = \"\";\n if (secure) {\n secureString = \"; secure\";\n }\n let sessionString = \"\";\n if (!session) {\n sessionString = `; max-age=${maxAge}`;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}; domain=${domain}; samesite=${sameSite}; path=${path}${sessionString}${secureString}`;\n document.cookie = cookie;\n this.log(\"Set cookie:\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\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 = this.defaultDomain) {\n const options = { maxAge: -1, path, domain: domain || this.defaultDomain };\n this.set(key, \"\", options);\n this.log(\"Deleted cookie:\", { key, path, domain, ...options });\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = this.defaultDomain) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.log(\"Deleted all cookies\", { path, domain });\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.log(\"Accepting policy:\", 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.log(\"Rejecting policy:\", 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 this.log(\"Cannot change essential policy, it is always accepted.\");\n return;\n }\n this.log(`Setting policy ${policy} to ${accepted}`);\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 this.log(\"Accepting all policies\");\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.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 this.log(\"Rejecting all policies\");\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.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.log(\"Saving policies:\", 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 if (Object.hasOwn(this.policies, policy)) {\n return this.policies[policy] === true;\n }\n return 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.log(`Adding event listener for: ${event}`);\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.log(`Adding one-time event listener for: ${event}`);\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 this.cookies = new Cookies({ newInstance: true });\n\n this.cookiePreferencesSetKey =\n this.$module.dataset.preferencesKey || \"cookie_preferences_set\";\n\n if (!this.cookies.policiesCorrectOnInit) {\n this.cookies.delete(this.cookiePreferencesSetKey);\n }\n\n if (\n !this.cookies.exists(this.cookiePreferencesSetKey) ||\n !this.cookies.hasValue(this.cookiePreferencesSetKey, \"true\")\n ) {\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.cookies.acceptAllPolicies();\n this.$acceptedMessage.removeAttribute(\"hidden\");\n this.$acceptedMessage.setAttribute(\"tabindex\", \"0\");\n this.$acceptedMessage.focus();\n this.$acceptedMessage.addEventListener(\"blur\", () => {\n this.$acceptedMessage.removeAttribute(\"tabindex\");\n });\n }\n\n reject() {\n this.$prompt.setAttribute(\"hidden\", \"\");\n this.complete();\n this.cookies.rejectAllPolicies();\n this.$rejectedMessage.removeAttribute(\"hidden\");\n this.$rejectedMessage.setAttribute(\"tabindex\", \"0\");\n this.$rejectedMessage.focus();\n this.$rejectedMessage.addEventListener(\"blur\", () => {\n this.$rejectedMessage.removeAttribute(\"tabindex\");\n });\n }\n\n complete() {\n this.cookies.set(this.cookiePreferencesSetKey, 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","window","TNAFrontendCookieEvents","CookieEventHandler","debug","arguments","length","undefined","_classCallCheck","this","_defineProperty","log","key","value","_console","_len","args","Array","_key","console","apply","concat","event","callback","Object","hasOwn","events","_toConsumableArray","oneTimeEvents","_this","data","forEach","eventToTrigger","call","eventIndex","splice","TNAFrontendCookies","tnaCookiePolicies","Cookies","options","document","documentElement","dataset","tnaFrontendDebug","defaultDomain","defaultPath","secure","policiesKey","defaultAge","_options$newInstance","newInstance","_options$noInit","noInit","tnaCookiesDomain","location","hostname","tnaCookiesPath","tnaCookiesInsecure","tnaCookiesPoliciesKey","parseInt","tnaCookiesDefaultAge","policiesCorrectOnInit","keys","policies","every","policy","includes","init","existingPolicies","filteredExistingPolicies","fromEntries","filter","map","savePolicies","_objectSpread","usage","settings","marketing","essential","all","get","deserialised","cookie","split","trim","_parts","_slicedToArray","decodeURIComponent","JSON","parse","error","exists","_options$maxAge","maxAge","_options$sameSite","sameSite","_options$domain","domain","_options$path","path","_options$secure","_options$session","session","secureString","sessionString","encodeURIComponent","trigger","set","_this2","setPolicy","accepted","allPolicies","toLowerCase","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","cookiePreferencesSetKey","preferencesKey","hasValue","removeAttribute","addEventListener","accept","reject","setAttribute","complete","acceptAllPolicies","focus","_this3","rejectAllPolicies","_this4","$closeButton","close"],"sourceRoot":""}
1
+ {"version":3,"file":"components/cookie-banner/cookie-banner.js","mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,QAAAA,OAAAC,IACAD,OAAA,iBAAAH,GACA,iBAAAC,QACAA,QAAA,YAAAD,IAEAD,EAAA,YAAAC,GACC,CATD,CASCK,KAAA,0DCTDC,OAAOC,0BAA4B,KAE5B,MAAMC,EACXC,OAAS,CAAC,EACVC,cAAgB,CAAC,EACjBC,OAAQ,EAER,WAAAC,CAAYD,GAAQ,GAElB,GADAE,KAAKF,MAAQA,EACTL,OAAOC,wBAGT,OAFAM,KAAKC,IAAI,mDAEFR,OAAOC,wBAEhBD,OAAOC,wBAA0BM,IACnC,CAEA,GAAAC,IAAOC,GACDF,KAAKF,OAEPK,QAAQF,IAAI,kCAAmCC,EAEnD,CAOA,EAAAE,CAAGC,EAAOC,GACHC,OAAOC,OAAOR,KAAKJ,OAAQS,KAC9BL,KAAKJ,OAAOS,GAAS,IAEvBL,KAAKJ,OAAOS,GAAS,IAAIL,KAAKJ,OAAOS,GAAQC,EAC/C,CAEA,IAAAG,CAAKJ,EAAOC,GACLC,OAAOC,OAAOR,KAAKH,cAAeQ,KACrCL,KAAKH,cAAcQ,GAAS,IAE9BL,KAAKH,cAAcQ,GAAS,IAAIL,KAAKH,cAAcQ,GAAQC,EAC7D,CAGA,OAAAI,CAAQL,EAAOM,EAAO,CAAC,GAOrB,GANIJ,OA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,QACtBvI,KAAKwH,iBAAiBU,iBAAiB,OAAQ,KAC7ClI,KAAKwH,iBAAiBS,gBAAgB,aAE1C,CAEA,MAAAG,GACEpI,KAAKuH,QAAQc,aAAa,SAAU,IACpCrI,KAAKsI,WACLtI,KAAK4H,QAAQ/B,oBACb7F,KAAKyH,iBAAiBQ,gBAAgB,UACtCjI,KAAKyH,iBAAiBY,aAAa,WAAY,KAC/CrI,KAAKyH,iBAAiBc,QACtBvI,KAAKyH,iBAAiBS,iBAAiB,OAAQ,KAC7ClI,KAAKyH,iBAAiBQ,gBAAgB,aAE1C,CAEA,QAAAK,GACEtI,KAAK4H,QAAQjD,IAAI3E,KAAK+H,yBAAyB,GAC/C/H,KAAK0H,cAAc9G,QAAS4H,IAC1BA,EAAaN,iBAAiB,QAAS,IAAMlI,KAAKyI,UAEtD,CAEA,KAAAA,GACEzI,KAAKmH,QAAQkB,aAAa,SAAU,GACtC","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/./src/nationalarchives/lib/cookie-events.mjs","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.TNAFrontendCookieEvents ||= null;\n\nexport class CookieEventHandler {\n events = {};\n oneTimeEvents = {};\n debug = false;\n\n constructor(debug = false) {\n this.debug = debug;\n if (window.TNAFrontendCookieEvents) {\n this.log(\"Using existing TNAFrontendCookieEvents instance\");\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookieEvents;\n }\n window.TNAFrontendCookieEvents = this;\n }\n\n log(...args) {\n if (this.debug) {\n /* eslint-disable-next-line no-console */\n console.log(\"[TNA Frontend Cookie Events]\", ...args);\n }\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.log(`Triggering event: ${event}`, data);\n this.events[event].forEach((eventToTrigger) =>\n eventToTrigger.call(this, data),\n );\n }\n if (Object.hasOwn(this.oneTimeEvents, event)) {\n this.log(`Triggering one-time event: ${event}`, data);\n\n for (\n /* eslint-disable-next-line no-magic-numbers */\n let eventIndex = this.oneTimeEvents[event].length - 1;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex >= 0;\n /* eslint-disable-next-line no-magic-numbers */\n eventIndex -= 1\n ) {\n const eventToTrigger = this.oneTimeEvents[event][eventIndex];\n eventToTrigger.call(this, data);\n /* eslint-disable-next-line no-magic-numbers */\n this.oneTimeEvents[event].splice(eventIndex, 1);\n }\n }\n }\n}\n","/* eslint-disable max-lines */\n/* eslint-disable no-console */\n\nimport { CookieEventHandler } from \"./cookie-events.mjs\";\n\nwindow.TNAFrontendCookies ||= null;\n\nconst tnaCookiePolicies = [\"usage\", \"settings\", \"marketing\", \"essential\"];\n\n/**\n * Class to handle cookies.\n * @class Cookies\n * @constructor\n * @public\n */\nexport default class Cookies {\n /** @protected */\n defaultDomain = \"\";\n /** @protected */\n defaultPath = \"\";\n /** @protected */\n secure = true;\n /** @protected */\n policiesKey = \"\";\n /** @protected */\n events = null;\n /** @protected */\n defaultAge = null;\n /** @protected */\n policiesCorrectOnInit = false;\n /** @protected */\n debug = document.documentElement.dataset.tnaFrontendDebug === \"true\";\n\n /**\n * Create a cookie handler.\n * @param {String} [options.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path] - The domain to register the cookie with.\n * @param {Boolean} [options.secure] - Only set cookie in HTTPS environments.\n * @param {String} [options.policiesKey] - The name of the cookie.\n * @param {Number} [options.defaultAge] - The default age of non-session cookies.\n * @param {String} [options.newInstance=false] - Create a fresh instance of the cookie class.\n * @param {Boolean} [options.noInit=false] - Don't initialise a blank cookie policy.\n */\n constructor(options = {}) {\n const {\n defaultDomain,\n defaultPath,\n secure,\n policiesKey,\n defaultAge,\n newInstance = false,\n noInit = false,\n } = options;\n if (!newInstance && window.TNAFrontendCookies) {\n /* eslint-disable-next-line no-constructor-return */\n return window.TNAFrontendCookies;\n }\n if (defaultDomain) {\n this.defaultDomain = defaultDomain;\n } else {\n this.defaultDomain =\n document.documentElement.dataset.tnaCookiesDomain ||\n window.location.hostname;\n }\n if (defaultPath) {\n this.defaultPath = defaultPath;\n } else {\n this.defaultPath = document.documentElement.dataset.tnaCookiesPath || \"/\";\n }\n if (secure) {\n this.secure = secure;\n } else {\n this.secure =\n document.documentElement.dataset.tnaCookiesInsecure !== \"true\";\n }\n if (policiesKey) {\n this.policiesKey = policiesKey;\n } else {\n this.policiesKey =\n document.documentElement.dataset.tnaCookiesPoliciesKey ||\n \"cookies_policy\";\n }\n if (defaultAge) {\n this.defaultAge = defaultAge;\n } else {\n /* eslint-disable-next-line no-magic-numbers */\n const secondsInAYear = 365 * 24 * 60 * 60;\n this.defaultAge =\n parseInt(document.documentElement.dataset.tnaCookiesDefaultAge, 10) ||\n secondsInAYear;\n }\n this.events = new CookieEventHandler(this.debug);\n this.policiesCorrectOnInit =\n Object.keys(this.policies).length === tnaCookiePolicies.length &&\n tnaCookiePolicies.every(\n (policy) =>\n Object.keys(this.policies).includes(policy) &&\n typeof this.policies[policy] === \"boolean\",\n );\n if (!this.policiesCorrectOnInit && !noInit) {\n this.init();\n }\n this.log({\n defaultDomain: this.defaultDomain,\n defaultPath: this.defaultPath,\n secure: this.secure,\n policiesKey: this.policiesKey,\n defaultAge: this.defaultAge,\n policiesCorrectOnInit: this.policiesCorrectOnInit,\n });\n if (!newInstance && !window.TNAFrontendCookies) {\n window.TNAFrontendCookies = this;\n }\n }\n\n /** @protected */\n init() {\n const existingPolicies = this.policies;\n this.log(\"Existing policies on init:\", existingPolicies);\n const filteredExistingPolicies = Object.fromEntries(\n Object.keys(existingPolicies)\n .filter((policy) => tnaCookiePolicies.includes(policy))\n .map((policy) => [policy, existingPolicies[policy]]),\n );\n if (Object.keys(filteredExistingPolicies).length) {\n this.log(\"Filtered existing policies:\", filteredExistingPolicies);\n }\n this.savePolicies({\n usage: false,\n settings: false,\n marketing: false,\n ...filteredExistingPolicies,\n essential: true,\n });\n }\n\n log(...args) {\n if (this.debug) {\n console.log(\"[TNA Frontend Cookies]\", ...args, this.all);\n }\n }\n\n destroyInstance() {\n this.log(\"Destroying TNAFrontendCookies instance\");\n window.TNAFrontendCookies = null;\n }\n\n /** @protected */\n /* eslint-disable-next-line class-methods-use-this */\n get all() {\n const deserialised = {};\n document.cookie\n .split(\"; \")\n .filter((cookie) => cookie.trim() !== \"\")\n .forEach((cookie) => {\n const parts = cookie.trim().split(\"=\");\n const [key, value] = parts;\n if (key) {\n deserialised[key] = decodeURIComponent(value || \"\");\n }\n });\n return deserialised;\n }\n\n /** @protected */\n get policies() {\n try {\n return JSON.parse(this.get(this.policiesKey) || \"{}\");\n // eslint-disable-next-line no-unused-vars\n } catch (error) {\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|null}\n */\n get(key) {\n if (this.exists(key)) {\n return decodeURIComponent(this.all[key]);\n }\n return 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.defaultDomain] - The domain to register the cookie with.\n * @param {String} [options.path=this.defaultPath] - 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.defaultDomain,\n path = this.defaultPath,\n secure = this.secure,\n session = false,\n } = options;\n if (!key) {\n return;\n }\n let secureString = \"\";\n if (secure) {\n secureString = \"; secure\";\n }\n let sessionString = \"\";\n if (!session) {\n sessionString = `; max-age=${maxAge}`;\n }\n const cookie = `${encodeURIComponent(key)}=${encodeURIComponent(value)}; domain=${domain}; samesite=${sameSite}; path=${path}${sessionString}${secureString}`;\n document.cookie = cookie;\n this.log(\"Set cookie:\", {\n key,\n value,\n maxAge,\n path,\n sameSite,\n domain,\n secure,\n session,\n cookie,\n });\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 = this.defaultDomain) {\n const options = { maxAge: -1, path, domain: domain || this.defaultDomain };\n this.set(key, \"\", options);\n this.log(\"Deleted cookie:\", { key, path, domain, ...options });\n this.events.trigger(\"deleteCookie\", { key, ...options });\n }\n\n /**\n * Delete all cookies.\n */\n deleteAll(path = \"/\", domain = this.defaultDomain) {\n Object.keys(this.all).forEach((cookie) => {\n this.delete(cookie, path, domain);\n });\n this.log(\"Deleted all cookies\", { path, domain });\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.log(\"Accepting policy:\", 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.log(\"Rejecting policy:\", 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 this.log(\"Cannot change essential policy, it is always accepted.\");\n return;\n }\n this.log(`Setting policy ${policy} to ${accepted}`);\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 this.log(\"Accepting all policies\");\n const allPolicies = Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.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 this.log(\"Rejecting all policies\");\n const allPolicies = {\n ...Object.fromEntries(\n Object.keys(this.policies).map((key) => [key.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.log(\"Saving policies:\", 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 if (Object.hasOwn(this.policies, policy)) {\n return this.policies[policy] === true;\n }\n return 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.log(`Adding event listener for: ${event}`);\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.log(`Adding one-time event listener for: ${event}`);\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 this.cookies = new Cookies({ newInstance: true });\n\n this.cookiePreferencesSetKey =\n this.$module.dataset.preferencesKey || \"cookie_preferences_set\";\n\n if (!this.cookies.policiesCorrectOnInit) {\n this.cookies.delete(this.cookiePreferencesSetKey);\n }\n\n if (\n !this.cookies.exists(this.cookiePreferencesSetKey) ||\n !this.cookies.hasValue(this.cookiePreferencesSetKey, \"true\")\n ) {\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.cookies.acceptAllPolicies();\n this.$acceptedMessage.removeAttribute(\"hidden\");\n this.$acceptedMessage.setAttribute(\"tabindex\", \"0\");\n this.$acceptedMessage.focus();\n this.$acceptedMessage.addEventListener(\"blur\", () => {\n this.$acceptedMessage.removeAttribute(\"tabindex\");\n });\n }\n\n reject() {\n this.$prompt.setAttribute(\"hidden\", \"\");\n this.complete();\n this.cookies.rejectAllPolicies();\n this.$rejectedMessage.removeAttribute(\"hidden\");\n this.$rejectedMessage.setAttribute(\"tabindex\", \"0\");\n this.$rejectedMessage.focus();\n this.$rejectedMessage.addEventListener(\"blur\", () => {\n this.$rejectedMessage.removeAttribute(\"tabindex\");\n });\n }\n\n complete() {\n this.cookies.set(this.cookiePreferencesSetKey, 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","TNAFrontendCookieEvents","CookieEventHandler","events","oneTimeEvents","debug","constructor","this","log","args","console","on","event","callback","Object","hasOwn","once","trigger","data","forEach","eventToTrigger","call","eventIndex","length","splice","TNAFrontendCookies","tnaCookiePolicies","Cookies","defaultDomain","defaultPath","secure","policiesKey","defaultAge","policiesCorrectOnInit","document","documentElement","dataset","tnaFrontendDebug","options","newInstance","noInit","tnaCookiesDomain","location","hostname","tnaCookiesPath","tnaCookiesInsecure","tnaCookiesPoliciesKey","secondsInAYear","parseInt","tnaCookiesDefaultAge","keys","policies","every","policy","includes","init","existingPolicies","filteredExistingPolicies","fromEntries","filter","map","savePolicies","usage","settings","marketing","essential","all","destroyInstance","deserialised","cookie","split","trim","parts","key","value","decodeURIComponent","JSON","parse","get","error","exists","hasValue","set","maxAge","sameSite","domain","path","session","secureString","sessionString","encodeURIComponent","deleteAll","delete","acceptPolicy","setPolicy","rejectPolicy","accepted","acceptAllPolicies","allPolicies","toLowerCase","rejectAllPolicies","stringify","isPolicyAccepted","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__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","_lib_cookies_mjs__WEBPACK_IMPORTED_MODULE_0__","A","cookiePreferencesSetKey","preferencesKey","removeAttribute","addEventListener","accept","reject","setAttribute","complete","focus","$closeButton","close"],"sourceRoot":""}
@@ -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={533(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)}var o;function r(e){return function(e){if(Array.isArray(e))return a(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 a(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)?a(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 a(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 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 u(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(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:()=>k}),(o=window).TNAFrontendCookieEvents||(o.TNAFrontendCookieEvents=null);var l,h=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,"events",{}),u(this,"oneTimeEvents",{}),u(this,"debug",!1),this.debug=t,window.TNAFrontendCookieEvents)return this.log("Using existing TNAFrontendCookieEvents instance"),window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this},t=[{key:"log",value:function(){if(this.debug){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,["[TNA Frontend Cookie Events]"].concat(n))}}},{key:"on",value:function(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[].concat(r(this.events[e]),[t])}},{key:"once",value:function(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[].concat(r(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.log("Triggering event: ".concat(e),n),this.events[e].forEach(function(e){return e.call(t,n)})),Object.hasOwn(this.oneTimeEvents,e)){this.log("Triggering one-time event: ".concat(e),n);for(var i=this.oneTimeEvents[e].length-1;i>=0;i-=1)this.oneTimeEvents[e][i].call(this,n),this.oneTimeEvents[e].splice(i,1)}}}],t&&s(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function f(e){return f="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},f(e)}function p(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 y(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 d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?y(Object(n),!0).forEach(function(t){m(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v(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,g(i.key),i)}}function m(e,t,n){return(t=g(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){var t=function(e){if("object"!=f(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}(l=window).TNAFrontendCookies||(l.TNAFrontendCookies=null);var b=["usage","settings","marketing","essential"],k=function(){return e=function e(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),m(this,"defaultDomain",""),m(this,"defaultPath",""),m(this,"secure",!0),m(this,"policiesKey",""),m(this,"events",null),m(this,"defaultAge",null),m(this,"policiesCorrectOnInit",!1),m(this,"debug","true"===document.documentElement.dataset.tnaFrontendDebug);var i=n.defaultDomain,o=n.defaultPath,r=n.secure,a=n.policiesKey,s=n.defaultAge,u=n.newInstance,c=void 0!==u&&u,l=n.noInit,f=void 0!==l&&l;if(!c&&window.TNAFrontendCookies)return window.TNAFrontendCookies;this.defaultDomain=i||document.documentElement.dataset.tnaCookiesDomain||window.location.hostname,this.defaultPath=o||document.documentElement.dataset.tnaCookiesPath||"/",this.secure=r||"true"!==document.documentElement.dataset.tnaCookiesInsecure,this.policiesKey=a||document.documentElement.dataset.tnaCookiesPoliciesKey||"cookies_policy",this.defaultAge=s||parseInt(document.documentElement.dataset.tnaCookiesDefaultAge,10)||31536e3,this.events=new h(this.debug),this.policiesCorrectOnInit=Object.keys(this.policies).length===b.length&&b.every(function(e){return Object.keys(t.policies).includes(e)&&"boolean"==typeof t.policies[e]}),this.policiesCorrectOnInit||f||this.init(),this.log({defaultDomain:this.defaultDomain,defaultPath:this.defaultPath,secure:this.secure,policiesKey:this.policiesKey,defaultAge:this.defaultAge,policiesCorrectOnInit:this.policiesCorrectOnInit}),c||window.TNAFrontendCookies||(window.TNAFrontendCookies=this)},t=[{key:"init",value:function(){var e=this.policies;this.log("Existing policies on init:",e);var t=Object.fromEntries(Object.keys(e).filter(function(e){return b.includes(e)}).map(function(t){return[t,e[t]]}));Object.keys(t).length&&this.log("Filtered existing policies:",t),this.savePolicies(d(d({usage:!1,settings:!1,marketing:!1},t),{},{essential:!0}))}},{key:"log",value:function(){if(this.debug){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];(e=console).log.apply(e,["[TNA Frontend Cookies]"].concat(n,[this.all]))}}},{key:"destroyInstance",value:function(){this.log("Destroying TNAFrontendCookies instance"),window.TNAFrontendCookies=null}},{key:"all",get:function(){var e={};return document.cookie.split("; ").filter(function(e){return""!==e.trim()}).forEach(function(t){var n=function(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,r,a,s=[],u=!0,c=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(i=r.call(n)).done)&&(s.push(i.value),s.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(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)?p(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.trim().split("="),2),i=n[0],o=n[1];i&&(e[i]=decodeURIComponent(o||""))}),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,a=void 0===r?"Lax":r,s=n.domain,u=void 0===s?this.defaultDomain:s,c=n.path,l=void 0===c?this.defaultPath:c,h=n.secure,f=void 0===h?this.secure:h,p=n.session,y=void 0!==p&&p;if(e){var d="";f&&(d="; secure");var v="";y||(v="; max-age=".concat(o));var m="".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t),"; domain=").concat(u,"; samesite=").concat(a,"; path=").concat(l).concat(v).concat(d);document.cookie=m,this.log("Set cookie:",{key:e,value:t,maxAge:o,path:l,sameSite:a,domain:u,secure:f,session:y,cookie:m}),this.events.trigger("setCookie",{key:e,value:t,maxAge:o,path:l,sameSite:a,domain:u,secure:f,session:y,cookie:m})}}},{key:"delete",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.defaultDomain,i={maxAge:-1,path:t,domain:n||this.defaultDomain};this.set(e,"",i),this.log("Deleted cookie:",d({key:e,path:t,domain:n},i)),this.events.trigger("deleteCookie",d({key:e},i))}},{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]:this.defaultDomain;Object.keys(this.all).forEach(function(i){e.delete(i,t,n)}),this.log("Deleted all cookies",{path:t,domain:n}),this.events.trigger("deleteAllCookies",{path:t,domain:n})}},{key:"acceptPolicy",value:function(e){this.log("Accepting policy:",e),this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",m({},e,!0))}},{key:"rejectPolicy",value:function(e){this.log("Rejecting policy:",e),this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",m({},e,!1))}},{key:"setPolicy",value:function(e,t){"essential"!==e?(this.log("Setting policy ".concat(e," to ").concat(t)),this.savePolicies(d(d({},this.policies),{},m(m({},e,t),"essential",!0))),this.events.trigger("changePolicy",m({},e,t))):this.log("Cannot change essential policy, it is always accepted.")}},{key:"acceptAllPolicies",value:function(){this.log("Accepting all policies");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(){this.log("Rejecting all policies");var e=d(d({},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.log("Saving policies:",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.log("Adding event listener for: ".concat(e)),this.events.on(e,t)}},{key:"once",value:function(e,t){this.log("Adding one-time event listener for: ".concat(e)),this.events.once(e,t)}}],t&&v(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var 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,{Cookies:()=>o.A,DateInputProgressive:()=>u});var o=n(533);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 a(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,s(i.key),i)}}function s(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 u=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.$yearWrapper=t&&t.querySelector(".tna-date-input__item--year"),this.$yearInput=this.$yearWrapper&&this.$yearWrapper.querySelector("input"),this.$monthWrapper=t&&t.querySelector(".tna-date-input__item--month"),this.$monthInput=this.$monthWrapper&&this.$monthWrapper.querySelector("input"),this.$dayWrapper=t&&t.querySelector(".tna-date-input__item--day"),this.$dayInput=this.$dayWrapper&&this.$dayWrapper.querySelector("input"),this.$module&&(this.update(),window.addEventListener("pageshow",function(){return n.update()}),this.$yearInput&&(this.$yearInput.addEventListener("keyup",function(){return n.update()}),this.$yearInput.addEventListener("change",function(){return n.update()})),this.$monthInput&&(this.$monthInput.addEventListener("keyup",function(){return n.update()}),this.$monthInput.addEventListener("change",function(){return n.update()})),this.$dayInput&&(this.$dayInput.addEventListener("keyup",function(){return n.update()}),this.$dayInput.addEventListener("change",function(){return n.update()})))},(t=[{key:"update",value:function(){this.isValidYear()?(this.showMonth(),this.isValidMonth()?this.showDay():this.hideDay()):(this.hideMonth(),this.hideDay())}},{key:"isValidYear",value:function(){if(!this.$yearInput)return!0;var e=parseInt(this.$yearInput.value.trim(),10);return!isNaN(this.$yearInput.value)&&!isNaN(e)&&e>0}},{key:"isValidMonth",value:function(){if(!this.$monthInput)return!0;var e=this.$monthInput.value.trim(),t=parseInt(e,10);return!isNaN(this.$monthInput.value)&&!isNaN(t)&&t>0&&t<=12||["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","jun","jul","aug","sep","oct","nov","dec"].includes(e.toLowerCase())}},{key:"showMonth",value:function(){this.$monthWrapper&&this.$monthWrapper.removeAttribute("hidden")}},{key:"hideMonth",value:function(){this.$monthWrapper&&this.$monthWrapper.setAttribute("hidden","")}},{key:"showDay",value:function(){this.$dayWrapper&&this.$dayWrapper.removeAttribute("hidden")}},{key:"hideDay",value:function(){this.$dayWrapper&&this.$dayWrapper.setAttribute("hidden","")}}])&&a(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();return i})());
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={533(e,t,i){i.d(t,{A:()=>o}),window.TNAFrontendCookieEvents||=null;class s{events={};oneTimeEvents={};debug=!1;constructor(e=!1){if(this.debug=e,window.TNAFrontendCookieEvents)return this.log("Using existing TNAFrontendCookieEvents instance"),window.TNAFrontendCookieEvents;window.TNAFrontendCookieEvents=this}log(...e){this.debug&&console.log("[TNA Frontend Cookie Events]",...e)}on(e,t){Object.hasOwn(this.events,e)||(this.events[e]=[]),this.events[e]=[...this.events[e],t]}once(e,t){Object.hasOwn(this.oneTimeEvents,e)||(this.oneTimeEvents[e]=[]),this.oneTimeEvents[e]=[...this.oneTimeEvents[e],t]}trigger(e,t={}){if(Object.hasOwn(this.events,e)&&(this.log(`Triggering event: ${e}`,t),this.events[e].forEach(e=>e.call(this,t))),Object.hasOwn(this.oneTimeEvents,e)){this.log(`Triggering one-time event: ${e}`,t);for(let i=this.oneTimeEvents[e].length-1;i>=0;i-=1)this.oneTimeEvents[e][i].call(this,t),this.oneTimeEvents[e].splice(i,1)}}}window.TNAFrontendCookies||=null;const n=["usage","settings","marketing","essential"];class o{defaultDomain="";defaultPath="";secure=!0;policiesKey="";events=null;defaultAge=null;policiesCorrectOnInit=!1;debug="true"===document.documentElement.dataset.tnaFrontendDebug;constructor(e={}){const{defaultDomain:t,defaultPath:i,secure:o,policiesKey:a,defaultAge:r,newInstance:h=!1,noInit:l=!1}=e;if(!h&&window.TNAFrontendCookies)return window.TNAFrontendCookies;if(this.defaultDomain=t||document.documentElement.dataset.tnaCookiesDomain||window.location.hostname,this.defaultPath=i||document.documentElement.dataset.tnaCookiesPath||"/",this.secure=o||"true"!==document.documentElement.dataset.tnaCookiesInsecure,this.policiesKey=a||document.documentElement.dataset.tnaCookiesPoliciesKey||"cookies_policy",r)this.defaultAge=r;else{const e=31536e3;this.defaultAge=parseInt(document.documentElement.dataset.tnaCookiesDefaultAge,10)||e}this.events=new s(this.debug),this.policiesCorrectOnInit=Object.keys(this.policies).length===n.length&&n.every(e=>Object.keys(this.policies).includes(e)&&"boolean"==typeof this.policies[e]),this.policiesCorrectOnInit||l||this.init(),this.log({defaultDomain:this.defaultDomain,defaultPath:this.defaultPath,secure:this.secure,policiesKey:this.policiesKey,defaultAge:this.defaultAge,policiesCorrectOnInit:this.policiesCorrectOnInit}),h||window.TNAFrontendCookies||(window.TNAFrontendCookies=this)}init(){const e=this.policies;this.log("Existing policies on init:",e);const t=Object.fromEntries(Object.keys(e).filter(e=>n.includes(e)).map(t=>[t,e[t]]));Object.keys(t).length&&this.log("Filtered existing policies:",t),this.savePolicies({usage:!1,settings:!1,marketing:!1,...t,essential:!0})}log(...e){this.debug&&console.log("[TNA Frontend Cookies]",...e,this.all)}destroyInstance(){this.log("Destroying TNAFrontendCookies instance"),window.TNAFrontendCookies=null}get all(){const e={};return document.cookie.split("; ").filter(e=>""!==e.trim()).forEach(t=>{const i=t.trim().split("="),[s,n]=i;s&&(e[s]=decodeURIComponent(n||""))}),e}get policies(){try{return JSON.parse(this.get(this.policiesKey)||"{}")}catch(e){return{}}}exists(e){return Object.hasOwn(this.all,e)}hasValue(e,t){return this.get(e)===t}get(e){return this.exists(e)?decodeURIComponent(this.all[e]):null}set(e,t,i={}){const{maxAge:s=this.defaultAge,sameSite:n="Lax",domain:o=this.defaultDomain,path:a=this.defaultPath,secure:r=this.secure,session:h=!1}=i;if(!e)return;let l="";r&&(l="; secure");let c="";h||(c=`; max-age=${s}`);const d=`${encodeURIComponent(e)}=${encodeURIComponent(t)}; domain=${o}; samesite=${n}; path=${a}${c}${l}`;document.cookie=d,this.log("Set cookie:",{key:e,value:t,maxAge:s,path:a,sameSite:n,domain:o,secure:r,session:h,cookie:d}),this.events.trigger("setCookie",{key:e,value:t,maxAge:s,path:a,sameSite:n,domain:o,secure:r,session:h,cookie:d})}delete(e,t="/",i=this.defaultDomain){const s={maxAge:-1,path:t,domain:i||this.defaultDomain};this.set(e,"",s),this.log("Deleted cookie:",{key:e,path:t,domain:i,...s}),this.events.trigger("deleteCookie",{key:e,...s})}deleteAll(e="/",t=this.defaultDomain){Object.keys(this.all).forEach(i=>{this.delete(i,e,t)}),this.log("Deleted all cookies",{path:e,domain:t}),this.events.trigger("deleteAllCookies",{path:e,domain:t})}acceptPolicy(e){this.log("Accepting policy:",e),this.setPolicy(e,!0),this.events.trigger("acceptPolicy",e),this.events.trigger("changePolicy",{[e]:!0})}rejectPolicy(e){this.log("Rejecting policy:",e),this.setPolicy(e,!1),this.events.trigger("rejectPolicy",e),this.events.trigger("changePolicy",{[e]:!1})}setPolicy(e,t){"essential"!==e?(this.log(`Setting policy ${e} to ${t}`),this.savePolicies({...this.policies,[e]:t,essential:!0}),this.events.trigger("changePolicy",{[e]:t})):this.log("Cannot change essential policy, it is always accepted.")}acceptAllPolicies(){this.log("Accepting all policies");const e=Object.fromEntries(Object.keys(this.policies).map(e=>[e.toLowerCase(),!0]));this.savePolicies(e),this.events.trigger("acceptAllPolicies"),this.events.trigger("changePolicy",e)}rejectAllPolicies(){this.log("Rejecting all policies");const e={...Object.fromEntries(Object.keys(this.policies).map(e=>[e.toLowerCase(),!1])),essential:!0};this.savePolicies(e),this.events.trigger("rejectAllPolicies"),this.events.trigger("changePolicy",e)}savePolicies(e){this.log("Saving policies:",e),this.set(this.policiesKey,JSON.stringify(e))}isPolicyAccepted(e){return Object.hasOwn(this.policies,e)?!0===this.policies[e]:null}on(e,t){this.log(`Adding event listener for: ${e}`),this.events.on(e,t)}once(e,t){this.log(`Adding one-time event listener for: ${e}`),this.events.once(e,t)}}}},t={};function i(s){var n=t[s];if(void 0!==n)return n.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,i),o.exports}i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},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 s={};i.r(s),i.d(s,{Cookies:()=>n.A,DateInputProgressive:()=>o});var n=i(533);class o{constructor(e){this.$module=e,this.$yearWrapper=e&&e.querySelector(".tna-date-input__item--year"),this.$yearInput=this.$yearWrapper&&this.$yearWrapper.querySelector("input"),this.$monthWrapper=e&&e.querySelector(".tna-date-input__item--month"),this.$monthInput=this.$monthWrapper&&this.$monthWrapper.querySelector("input"),this.$dayWrapper=e&&e.querySelector(".tna-date-input__item--day"),this.$dayInput=this.$dayWrapper&&this.$dayWrapper.querySelector("input"),this.$module&&(this.update(),window.addEventListener("pageshow",()=>this.update()),this.$yearInput&&(this.$yearInput.addEventListener("keyup",()=>this.update()),this.$yearInput.addEventListener("change",()=>this.update())),this.$monthInput&&(this.$monthInput.addEventListener("keyup",()=>this.update()),this.$monthInput.addEventListener("change",()=>this.update())),this.$dayInput&&(this.$dayInput.addEventListener("keyup",()=>this.update()),this.$dayInput.addEventListener("change",()=>this.update())))}update(){this.isValidYear()?(this.showMonth(),this.isValidMonth()?this.showDay():this.hideDay()):(this.hideMonth(),this.hideDay())}isValidYear(){if(!this.$yearInput)return!0;const e=parseInt(this.$yearInput.value.trim(),10);return!isNaN(this.$yearInput.value)&&!isNaN(e)&&e>0}isValidMonth(){if(!this.$monthInput)return!0;const e=this.$monthInput.value.trim(),t=parseInt(e,10);return!isNaN(this.$monthInput.value)&&!isNaN(t)&&t>0&&t<=12||["january","february","march","april","may","june","july","august","september","october","november","december","jan","feb","mar","apr","jun","jul","aug","sep","oct","nov","dec"].includes(e.toLowerCase())}showMonth(){this.$monthWrapper&&this.$monthWrapper.removeAttribute("hidden")}hideMonth(){this.$monthWrapper&&this.$monthWrapper.setAttribute("hidden","")}showDay(){this.$dayWrapper&&this.$dayWrapper.removeAttribute("hidden")}hideDay(){this.$dayWrapper&&this.$dayWrapper.setAttribute("hidden","")}}return s})());
2
2
  //# sourceMappingURL=date-input.js.map