nhsuk-frontend
Advanced tools
Comparing version 8.2.0 to 8.3.0
@@ -1,1 +0,1 @@ | ||
(()=>{var e={405:()=>{NodeList.prototype.forEach||(NodeList.prototype.forEach=Array.prototype.forEach),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{enumerable:!1,value:function(e){return this.filter((function(t){return t===e})).length>0}}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(Element.prototype.matches.call(t,e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n})}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(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,o(i.key),i)}}function i(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(t){var n=function(t,n){if("object"!==e(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,"string");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(n)?n:String(n)}var a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"KEY_SPACE",32),i(this,"DEBOUNCE_TIMEOUT_IN_SECONDS",1),this.$module=t,this.debounceFormSubmitTimer=null}var n,o;return n=e,(o=[{key:"handleKeyDown",value:function(e){var t=e.target;"button"===t.getAttribute("role")&&e.keyCode===this.KEY_SPACE&&(e.preventDefault(),t.click())}},{key:"debounce",value:function(e){var t=this;if("true"===e.target.getAttribute("data-prevent-double-click"))return this.debounceFormSubmitTimer?(e.preventDefault(),!1):void(this.debounceFormSubmitTimer=setTimeout((function(){t.debounceFormSubmitTimer=null}),1e3*this.DEBOUNCE_TIMEOUT_IN_SECONDS))}},{key:"init",value:function(){this.$module.addEventListener("keydown",this.handleKeyDown.bind(this)),this.$module.addEventListener("click",this.debounce.bind(this))}}])&&t(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),e}();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,(void 0,o=function(e,t){if("object"!==r(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key),"symbol"===r(o)?o:String(o)),i)}var o}var u=function(){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.$textarea=t.querySelector(".nhsuk-js-character-count"),this.$visibleCountMessage=null,this.$screenReaderCountMessage=null,this.lastInputTimestamp=null}var t,n,i;return t=e,i=[{key:"getDataset",value:function(e){var t={},n=e.attributes;if(n)for(var i=0;i<n.length;i++){var o=n[i],a=o.name.match(/^data-(.+)/);a&&(t[a[1]]=o.value)}return t}}],(n=[{key:"init",value:function(){if(this.$textarea){var t=this.$module,n=this.$textarea,i=document.getElementById("".concat(n.id,"-info"));n.insertAdjacentElement("afterend",i);var o=document.createElement("div");o.className="nhsuk-character-count__sr-status nhsuk-u-visually-hidden",o.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=o,i.insertAdjacentElement("afterend",o);var a=document.createElement("div");a.className=i.className,a.classList.add("nhsuk-character-count__status"),a.setAttribute("aria-hidden","true"),this.$visibleCountMessage=a,i.insertAdjacentElement("afterend",a),i.classList.add("nhsuk-u-visually-hidden"),this.options=e.getDataset(t);var r=this.defaults.characterCountAttribute;this.options.maxwords&&(r=this.defaults.wordCountAttribute),this.maxLength=t.getAttribute(r),this.maxLength&&(n.removeAttribute("maxlength"),this.bindChangeEvents(),"onpageshow"in window?window.addEventListener("pageshow",this.updateCountMessage.bind(this)):window.addEventListener("DOMContentLoaded",this.updateCountMessage.bind(this)),this.updateCountMessage())}}},{key:"count",value:function(e){return this.options.maxwords?(e.match(/\S+/g)||[]).length:e.length}},{key:"bindChangeEvents",value:function(){var e=this.$textarea;e.addEventListener("keyup",this.handleKeyUp.bind(this)),e.addEventListener("focus",this.handleFocus.bind(this)),e.addEventListener("blur",this.handleBlur.bind(this))}},{key:"checkIfValueChanged",value:function(){this.$textarea.oldValue||(this.$textarea.oldValue=""),this.$textarea.value!==this.$textarea.oldValue&&(this.$textarea.oldValue=this.$textarea.value,this.updateCountMessage())}},{key:"updateCountMessage",value:function(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()}},{key:"updateVisibleCountMessage",value:function(){var e=this.$textarea,t=this.$visibleCountMessage,n=this.maxLength-this.count(e.value);this.isOverThreshold()?t.classList.remove("nhsuk-character-count__message--disabled"):t.classList.add("nhsuk-character-count__message--disabled"),n<0?(e.classList.add("nhsuk-textarea--error"),t.classList.remove("nhsuk-hint"),t.classList.add("nhsuk-error-message")):(e.classList.remove("nhsuk-textarea--error"),t.classList.remove("nhsuk-error-message"),t.classList.add("nhsuk-hint")),t.innerHTML=this.formattedUpdateMessage()}},{key:"updateScreenReaderCountMessage",value:function(){var e=this.$screenReaderCountMessage;this.isOverThreshold()?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",!0),e.innerHTML=this.formattedUpdateMessage()}},{key:"formattedUpdateMessage",value:function(){var e,t,n=this.$textarea,i=this.options,o=this.maxLength-this.count(n.value),a="character";return i.maxwords&&(a="word"),a+=-1===o||1===o?"":"s",e=o<0?"too many":"remaining",t=Math.abs(o),"You have ".concat(t," ").concat(a," ").concat(e)}},{key:"isOverThreshold",value:function(){var e=this.$textarea,t=this.options,n=this.count(e.value);return this.maxLength*(t.threshold?t.threshold:0)/100<=n}},{key:"handleKeyUp",value:function(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()}},{key:"handleFocus",value:function(){var e=this;this.valueChecker=setInterval((function(){(!e.lastInputTimestamp||Date.now()-500>=e.lastInputTimestamp)&&e.checkIfValueChanged()}),1e3)}},{key:"handleBlur",value:function(){clearInterval(this.valueChecker)}}])&&s(t.prototype,n),i&&s(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();u.prototype.defaults={characterCountAttribute:"data-maxlength",wordCountAttribute:"data-maxwords"};var c=function(e,t){if(e&&t){var n="true"===e.getAttribute(t)?"false":"true";e.setAttribute(t,n)}},l=function(e,t){if(e&&t){var n=e.getAttribute("aria-controls");if(n){var i=document.getElementById(n);i&&(e.checked?(i.classList.remove(t),e.setAttribute("aria-expanded",!0)):(i.classList.add(t),e.setAttribute("aria-expanded",!1)))}}},h=function(e){e.form.querySelectorAll('input[type="checkbox"]').forEach((function(e){return l(e,"nhsuk-checkboxes__conditional--hidden")}))},d=function(e){e.form.querySelectorAll('input[type="checkbox"][data-checkbox-exclusive-group="'.concat(e.getAttribute("data-checkbox-exclusive-group"),'"]')).forEach((function(t){e.form===t.form&&t!==e&&(t.checked=!1)})),h(e)},b=function(e){e.form.querySelectorAll('input[type="checkbox"][data-checkbox-exclusive][data-checkbox-exclusive-group="'.concat(e.getAttribute("data-checkbox-exclusive-group"),'"]')).forEach((function(t){e.form===t.form&&(t.checked=!1)})),h(e)};function v(e){(function(e){if("A"!==e.tagName||!1===e.href)return!1;var t=document.querySelector(e.hash);if(!t)return!1;var n=function(e){var t=e.closest("fieldset");if(t){var n=t.getElementsByTagName("legend");if(n.length){var i=n[0];if("checkbox"===e.type||"radio"===e.type)return i;var o=i.getBoundingClientRect().top,a=e.getBoundingClientRect();if(a.height&&window.innerHeight&&a.top+a.height-o<window.innerHeight/2)return i}}return document.querySelector("label[for='".concat(e.getAttribute("id"),"']"))||e.closest("label")}(t);return!!n&&(n.scrollIntoView(),t.focus({preventScroll:!0}),!0)})(e.target)&&e.preventDefault()}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 m(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,(void 0,o=function(e,t){if("object"!==f(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==f(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key),"symbol"===f(o)?o:String(o)),i)}var o}var p=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.menuIsOpen=!1,this.navigation=document.querySelector(".nhsuk-navigation"),this.navigationList=document.querySelector(".nhsuk-header__navigation-list"),this.mobileMenu=document.createElement("ul"),this.mobileMenuToggleButton=document.querySelector(".nhsuk-header__menu-toggle"),this.mobileMenuCloseButton=document.createElement("button"),this.mobileMenuContainer=document.querySelector(".nhsuk-mobile-menu-container"),this.breakpoints=[],this.width=document.body.offsetWidth}var t,n;return t=e,n=[{key:"init",value:function(){var e=this;this.navigation&&this.navigationList&&this.mobileMenuToggleButton&&this.mobileMenuContainer&&(this.setupMobileMenu(),this.calculateBreakpoints(),this.updateNavigation(),this.doOnOrientationChange(),this.handleResize=this.debounce((function(){e.calculateBreakpoints(),e.updateNavigation()})),this.mobileMenuToggleButton.addEventListener("click",this.toggleMobileMenu.bind(this)),window.addEventListener("resize",this.handleResize),window.addEventListener("orientationchange",this.doOnOrientationChange()))}},{key:"debounce",value:function(e){var t,n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return function(){for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];clearTimeout(t),t=setTimeout((function(){e.apply(n,a)}),i)}}},{key:"calculateBreakpoints",value:function(){for(var e=0,t=0;t<this.navigationList.children.length;t++)e+=this.navigationList.children[t].offsetWidth,this.breakpoints[t]=e}},{key:"setupMobileMenu",value:function(){this.mobileMenuContainer.appendChild(this.mobileMenu),this.mobileMenu.classList.add("nhsuk-header__drop-down","nhsuk-header__drop-down--hidden")}},{key:"closeMobileMenu",value:function(){this.menuIsOpen=!1,this.mobileMenu.classList.add("nhsuk-header__drop-down--hidden"),this.navigation.style.marginBottom=0,this.mobileMenuToggleButton.setAttribute("aria-expanded","false"),this.mobileMenuToggleButton.focus(),this.mobileMenuCloseButton.removeEventListener("click",this.closeMobileMenu.bind(this)),document.removeEventListener("keydown",this.handleEscapeKey.bind(this))}},{key:"handleEscapeKey",value:function(e){"Escape"===e.key&&this.closeMobileMenu()}},{key:"openMobileMenu",value:function(){this.menuIsOpen=!0,this.mobileMenu.classList.remove("nhsuk-header__drop-down--hidden");var e=this.mobileMenu.offsetHeight;this.navigation.style.marginBottom="".concat(e,"px"),this.mobileMenuToggleButton.setAttribute("aria-expanded","true"),document.addEventListener("keydown",this.handleEscapeKey.bind(this)),this.mobileMenuCloseButton.addEventListener("click",this.closeMobileMenu.bind(this))}},{key:"toggleMobileMenu",value:function(){this.menuIsOpen?this.closeMobileMenu():this.openMobileMenu()}},{key:"updateNavigation",value:function(){var e=this.navigation.offsetWidth,t=this.navigationList.children.length;if(e<this.breakpoints[t-1]){if(this.mobileMenuToggleButton.classList.add("nhsuk-header__menu-toggle--visible"),this.mobileMenuContainer.classList.add("nhsuk-mobile-menu-container--visible"),2===t)return;for(;e<this.breakpoints[t-1];)this.mobileMenu.insertBefore(this.navigationList.children[t-2],this.mobileMenu.firstChild),t-=1}else if(e>this.breakpoints[t])for(;e>this.breakpoints[t];)this.navigationList.insertBefore(this.mobileMenu.removeChild(this.mobileMenu.firstChild),this.mobileMenuContainer),t+=1;this.mobileMenu.children.length||(this.mobileMenuToggleButton.classList.remove("nhsuk-header__menu-toggle--visible"),this.mobileMenuContainer.classList.remove("nhsuk-mobile-menu-container--visible")),document.body.offsetWidth!==this.width&&this.menuIsOpen&&this.closeMobileMenu()}},{key:"doOnOrientationChange",value:function(){var e=this;90===window.orientation&&setTimeout((function(){e.calculateBreakpoints(),e.updateNavigation()}),200)}}],n&&m(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function y(e){return y="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},y(e)}function g(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,(void 0,o=function(e,t){if("object"!==y(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!==y(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i.key),"symbol"===y(o)?o:String(o)),i)}var o}var k=function(){function e(t,n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.namespace=n,this.responsive=i,this.historyEnabled=o,this.$tabs=t.querySelectorAll(".".concat(this.namespace,"__tab")),this.keys={down:40,left:37,right:39,up:38},this.jsHiddenClass="".concat(this.namespace,"__panel--hidden"),this.showEvent=new CustomEvent("tab.show"),this.hideEvent=new CustomEvent("tab.hide")}var t,n,i;return t=e,i=[{key:"getHref",value:function(e){var t=e.getAttribute("href");return t.slice(t.indexOf("#"),t.length)}}],(n=[{key:"init",value:function(){"function"==typeof window.matchMedia&&this.responsive?this.setupResponsiveChecks():this.setup()}},{key:"setupResponsiveChecks",value:function(){this.mql=window.matchMedia("(min-width: 641px)"),this.mql.addEventListener("change",this.checkMode.bind(this)),this.checkMode()}},{key:"checkMode",value:function(){this.mql.matches?this.setup():this.teardown()}},{key:"setup",value:function(){var e=this,t=this.$module,n=this.$tabs,i=t.querySelector(".".concat(this.namespace,"__list")),o=t.querySelectorAll(".".concat(this.namespace,"__list-item"));if(n&&i&&o){i.setAttribute("role","tablist"),o.forEach((function(e){e.setAttribute("role","presentation")})),n.forEach((function(t){e.setAttributes(t),t.boundTabClick=e.onTabClick.bind(e),t.boundTabKeydown=e.onTabKeydown.bind(e),t.addEventListener("click",t.boundTabClick,!0),t.addEventListener("keydown",t.boundTabKeydown,!0),e.hideTab(t)}));var a=this.getTab(window.location.hash)||this.$tabs[0];this.showTab(a),this.historyEnabled&&(t.boundOnHashChange=this.onHashChange.bind(this),window.addEventListener("hashchange",t.boundOnHashChange,!0))}}},{key:"teardown",value:function(){var e=this,t=this.$module,n=this.$tabs,i=t.querySelector(".".concat(this.namespace,"__list")),o=t.querySelectorAll(".".concat(this.namespace,"__list-item"));n&&i&&o&&(i.removeAttribute("role"),o.forEach((function(e){e.removeAttribute("role","presentation")})),n.forEach((function(t){t.removeEventListener("click",t.boundTabClick,!0),t.removeEventListener("keydown",t.boundTabKeydown,!0),e.unsetAttributes(t)})),this.historyEnabled&&window.removeEventListener("hashchange",t.boundOnHashChange,!0))}},{key:"onHashChange",value:function(){var e=window.location.hash,t=this.getTab(e);if(t)if(this.changingHash)this.changingHash=!1;else{var n=this.getCurrentTab();this.hideTab(n),this.showTab(t),t.focus()}}},{key:"hideTab",value:function(e){this.unhighlightTab(e),this.hidePanel(e)}},{key:"showTab",value:function(e){this.highlightTab(e),this.showPanel(e)}},{key:"getTab",value:function(e){return this.$module.querySelector(".".concat(this.namespace,'__tab[href="').concat(e,'"]'))}},{key:"setAttributes",value:function(t){var n=e.getHref(t).slice(1);t.setAttribute("id","tab_".concat(n)),t.setAttribute("role","tab"),t.setAttribute("aria-controls",n),t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");var i=this.getPanel(t);i.setAttribute("role","tabpanel"),i.setAttribute("aria-labelledby",t.id),i.classList.add(this.jsHiddenClass)}},{key:"unsetAttributes",value:function(e){e.removeAttribute("id"),e.removeAttribute("role"),e.removeAttribute("aria-controls"),e.removeAttribute("aria-selected"),e.removeAttribute("tabindex");var t=this.getPanel(e);t.removeAttribute("role"),t.removeAttribute("aria-labelledby"),t.removeAttribute("tabindex"),t.classList.remove(this.jsHiddenClass)}},{key:"onTabClick",value:function(e){e.target.classList.contains("".concat(this.namespace,"__tab"))||(e.stopPropagation(),e.preventDefault()),e.preventDefault();var t=e.target,n=this.getCurrentTab();this.hideTab(n),this.showTab(t),this.createHistoryEntry(t)}},{key:"createHistoryEntry",value:function(t){if(this.historyEnabled){var n=this.getPanel(t),i=n.id;n.id="",this.changingHash=!0,window.location.hash=e.getHref(t).slice(1),n.id=i}}},{key:"onTabKeydown",value:function(e){switch(e.keyCode){case this.keys.left:case this.keys.up:this.activatePreviousTab(),e.preventDefault();break;case this.keys.right:case this.keys.down:this.activateNextTab(),e.preventDefault()}}},{key:"activateNextTab",value:function(){var e,t=this.getCurrentTab(),n=t.parentNode.nextElementSibling;n&&(e=n.querySelector(".".concat(this.namespace,"__tab"))),e&&(this.hideTab(t),this.showTab(e),e.focus(),this.createHistoryEntry(e))}},{key:"activatePreviousTab",value:function(){var e,t=this.getCurrentTab(),n=t.parentNode.previousElementSibling;n&&(e=n.querySelector(".".concat(this.namespace,"__tab"))),e&&(this.hideTab(t),this.showTab(e),e.focus(),this.createHistoryEntry(e))}},{key:"getPanel",value:function(t){return this.$module.querySelector(e.getHref(t))}},{key:"showPanel",value:function(e){var t=this.getPanel(e);t.classList.remove(this.jsHiddenClass),t.dispatchEvent(this.showEvent)}},{key:"hidePanel",value:function(e){var t=this.getPanel(e);t.classList.add(this.jsHiddenClass),t.dispatchEvent(this.hideEvent)}},{key:"unhighlightTab",value:function(e){e.setAttribute("aria-selected","false"),e.parentNode.classList.remove("".concat(this.namespace,"__list-item--selected")),e.setAttribute("tabindex","-1")}},{key:"highlightTab",value:function(e){e.setAttribute("aria-selected","true"),e.parentNode.classList.add("".concat(this.namespace,"__list-item--selected")),e.setAttribute("tabindex","0")}},{key:"getCurrentTab",value:function(){return this.$module.querySelector(".".concat(this.namespace,"__list-item--selected .").concat(this.namespace,"__tab"))}}])&&g(t.prototype,n),i&&g(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();n(405),document.addEventListener("DOMContentLoaded",(function(){var e,t,n;(new p).init(),e=document.querySelector("h1"),t=document.querySelector(".nhsuk-skip-link"),e&&t&&(t.addEventListener("click",(function(t){t.preventDefault(),e.setAttribute("tabIndex","-1"),e.focus()})),e.addEventListener("blur",(function(t){t.preventDefault(),e.removeAttribute("tabIndex")}))),function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).scope;(void 0===e?document:e).querySelectorAll('[data-module="nhsuk-button"]').forEach((function(e){new a(e).init()}))}({scope:n=document}),function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).scope;(void 0===e?document:e).querySelectorAll('[data-module="nhsuk-character-count"]').forEach((function(e){new u(e).init()}))}({scope:n}),function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).scope,t=(void 0===e?document:e).querySelectorAll(".nhsuk-checkboxes .nhsuk-checkboxes__input"),n=function(e){l(e.target,"nhsuk-checkboxes__conditional--hidden"),e.target.checked&&(e.target.hasAttribute("data-checkbox-exclusive")?d(e.target):b(e.target))};"onpageshow"in window?window.addEventListener("pageshow",(function(){return t.forEach((function(e){return h(e)}))})):window.addEventListener("DOMContentLoaded",(function(){return t.forEach((function(e){return h(e)}))})),t.forEach((function(e){return h(e)})),t.forEach((function(e){e.addEventListener("change",n)}))}({scope:n}),function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).scope,t=void 0===e?document:e;if("boolean"!=typeof document.createElement("details").open){var n=t.querySelectorAll("details");n.length&&n.forEach((function(e,n){e.hasAttribute("nhsuk-polyfilled")||function(e,n){e.setAttribute("nhsuk-polyfilled","true"),e.id||e.setAttribute("id","nhsuk-details".concat(n));var i=t.querySelector("#".concat(e.id," .nhsuk-details__text"));i.id||i.setAttribute("id","nhsuk-details__text".concat(n));var o=t.querySelector("#".concat(e.id," .nhsuk-details__summary"));o.setAttribute("role","button"),o.setAttribute("aria-controls",i.id),o.setAttribute("tabIndex","0"),1==(null!==e.getAttribute("open"))?(o.setAttribute("aria-expanded","true"),i.setAttribute("aria-hidden","false")):(o.setAttribute("aria-expanded","false"),i.setAttribute("aria-hidden","true"),i.style.display="none"),o.addEventListener("click",(function(){c(o,"aria-expanded"),c(i,"aria-hidden"),i.style.display="true"===i.getAttribute("aria-hidden")?"none":"",e.hasAttribute("open")?e.removeAttribute("open"):e.setAttribute("open","open")})),o.addEventListener("keydown",(function(e){13!==e.keyCode&&32!==e.keyCode||(e.preventDefault(),o.click())}))}(e,n)}))}}({scope:n}),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.focusOnPageLoad,n=void 0===t||t,i=e.scope,o=(void 0===i?document:i).querySelector(".nhsuk-error-summary");o&&(n&&o.focus(),o.addEventListener("click",v))}({scope:n}),function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).scope,t=(void 0===e?document:e).querySelectorAll(".nhsuk-radios--conditional .nhsuk-radios__input"),n=function(){t.forEach((function(e){return l(e,"nhsuk-radios__conditional--hidden")}))};"onpageshow"in window?window.addEventListener("pageshow",n):window.addEventListener("DOMContentLoaded",n),n(),t.forEach((function(e){e.addEventListener("change",n)}))}({scope:n}),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.namespace,n=void 0===t?"nhsuk-tabs":t,i=e.responsive,o=void 0===i||i,a=e.historyEnabled,r=void 0===a||a,s=e.scope;(void 0===s?document:s).querySelectorAll('[data-module="'.concat(n,'"]')).forEach((function(e){new k(e,n,o,r).init()}))}({scope:n})}))})()})(); | ||
(()=>{var e={405:()=>{NodeList.prototype.forEach||(NodeList.prototype.forEach=Array.prototype.forEach),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{enumerable:!1,value:function(e){return this.filter((function(t){return t===e})).length>0}}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(Element.prototype.matches.call(t,e))return t;t=t.parentElement||t.parentNode}while(null!==t&&1===t.nodeType);return null}),"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n})}},t={};function n(i){var o=t[i];if(void 0!==o)return o.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(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,o(i.key),i)}}function i(e,t,n){return(t=o(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var o=i.call(t,"string");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(n)?n:n+""}var a=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),i(this,"KEY_SPACE",32),i(this,"DEBOUNCE_TIMEOUT_IN_SECONDS",1),this.$module=t,this.debounceFormSubmitTimer=null},(n=[{key:"handleKeyDown",value:function(e){var t=e.target;"button"===t.getAttribute("role")&&e.keyCode===this.KEY_SPACE&&(e.preventDefault(),t.click())}},{key:"debounce",value:function(e){var t=this;if("true"===e.target.getAttribute("data-prevent-double-click"))return this.debounceFormSubmitTimer?(e.preventDefault(),!1):void(this.debounceFormSubmitTimer=setTimeout((function(){t.debounceFormSubmitTimer=null}),1e3*this.DEBOUNCE_TIMEOUT_IN_SECONDS))}},{key:"init",value:function(){this.$module.addEventListener("keydown",this.handleKeyDown.bind(this)),this.$module.addEventListener("click",this.debounce.bind(this))}}])&&t(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n}();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,u(i.key),i)}}function u(e){var t=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}var c=function(){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.$textarea=t.querySelector(".nhsuk-js-character-count"),this.$visibleCountMessage=null,this.$screenReaderCountMessage=null,this.lastInputTimestamp=null}return t=e,i=[{key:"getDataset",value:function(e){var t={},n=e.attributes;if(n)for(var i=0;i<n.length;i++){var o=n[i],a=o.name.match(/^data-(.+)/);a&&(t[a[1]]=o.value)}return t}}],(n=[{key:"init",value:function(){if(this.$textarea){var t=this.$module,n=this.$textarea,i=document.getElementById("".concat(n.id,"-info"));n.insertAdjacentElement("afterend",i);var o=document.createElement("div");o.className="nhsuk-character-count__sr-status nhsuk-u-visually-hidden",o.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=o,i.insertAdjacentElement("afterend",o);var a=document.createElement("div");a.className=i.className,a.classList.add("nhsuk-character-count__status"),a.setAttribute("aria-hidden","true"),this.$visibleCountMessage=a,i.insertAdjacentElement("afterend",a),i.classList.add("nhsuk-u-visually-hidden"),this.options=e.getDataset(t);var r=this.defaults.characterCountAttribute;this.options.maxwords&&(r=this.defaults.wordCountAttribute),this.maxLength=t.getAttribute(r),this.maxLength&&(n.removeAttribute("maxlength"),this.bindChangeEvents(),"onpageshow"in window?window.addEventListener("pageshow",this.updateCountMessage.bind(this)):window.addEventListener("DOMContentLoaded",this.updateCountMessage.bind(this)),this.updateCountMessage())}}},{key:"count",value:function(e){return this.options.maxwords?(e.match(/\S+/g)||[]).length:e.length}},{key:"bindChangeEvents",value:function(){var e=this.$textarea;e.addEventListener("keyup",this.handleKeyUp.bind(this)),e.addEventListener("focus",this.handleFocus.bind(this)),e.addEventListener("blur",this.handleBlur.bind(this))}},{key:"checkIfValueChanged",value:function(){this.$textarea.oldValue||(this.$textarea.oldValue=""),this.$textarea.value!==this.$textarea.oldValue&&(this.$textarea.oldValue=this.$textarea.value,this.updateCountMessage())}},{key:"updateCountMessage",value:function(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()}},{key:"updateVisibleCountMessage",value:function(){var e=this.$textarea,t=this.$visibleCountMessage,n=this.maxLength-this.count(e.value);this.isOverThreshold()?t.classList.remove("nhsuk-character-count__message--disabled"):t.classList.add("nhsuk-character-count__message--disabled"),n<0?(e.classList.add("nhsuk-textarea--error"),t.classList.remove("nhsuk-hint"),t.classList.add("nhsuk-error-message")):(e.classList.remove("nhsuk-textarea--error"),t.classList.remove("nhsuk-error-message"),t.classList.add("nhsuk-hint")),t.innerHTML=this.formattedUpdateMessage()}},{key:"updateScreenReaderCountMessage",value:function(){var e=this.$screenReaderCountMessage;this.isOverThreshold()?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",!0),e.innerHTML=this.formattedUpdateMessage()}},{key:"formattedUpdateMessage",value:function(){var e,t,n=this.$textarea,i=this.options,o=this.maxLength-this.count(n.value),a="character";return i.maxwords&&(a="word"),a+=-1===o||1===o?"":"s",e=o<0?"too many":"remaining",t=Math.abs(o),"You have ".concat(t," ").concat(a," ").concat(e)}},{key:"isOverThreshold",value:function(){var e=this.$textarea,t=this.options,n=this.count(e.value);return this.maxLength*(t.threshold?t.threshold:0)/100<=n}},{key:"handleKeyUp",value:function(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()}},{key:"handleFocus",value:function(){var e=this;this.valueChecker=setInterval((function(){(!e.lastInputTimestamp||Date.now()-500>=e.lastInputTimestamp)&&e.checkIfValueChanged()}),1e3)}},{key:"handleBlur",value:function(){clearInterval(this.valueChecker)}}])&&s(t.prototype,n),i&&s(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i}();c.prototype.defaults={characterCountAttribute:"data-maxlength",wordCountAttribute:"data-maxwords"};var l=function(e,t){if(e&&t){var n="true"===e.getAttribute(t)?"false":"true";e.setAttribute(t,n)}},h=function(e,t){if(e&&t){var n=e.getAttribute("aria-controls");if(n){var i=document.getElementById(n);i&&(e.checked?(i.classList.remove(t),e.setAttribute("aria-expanded",!0)):(i.classList.add(t),e.setAttribute("aria-expanded",!1)))}}},d=function(e){e.form.querySelectorAll('input[type="checkbox"]').forEach((function(e){return h(e,"nhsuk-checkboxes__conditional--hidden")}))},b=function(e){e.form.querySelectorAll('input[type="checkbox"][data-checkbox-exclusive-group="'.concat(e.getAttribute("data-checkbox-exclusive-group"),'"]')).forEach((function(t){e.form===t.form&&t!==e&&(t.checked=!1)})),d(e)},v=function(e){e.form.querySelectorAll('input[type="checkbox"][data-checkbox-exclusive][data-checkbox-exclusive-group="'.concat(e.getAttribute("data-checkbox-exclusive-group"),'"]')).forEach((function(t){e.form===t.form&&(t.checked=!1)})),d(e)};function f(e){(function(e){if("A"!==e.tagName||!1===e.href)return!1;var t=document.querySelector(e.hash);if(!t)return!1;var n=function(e){var t=e.closest("fieldset");if(t){var n=t.getElementsByTagName("legend");if(n.length){var i=n[0];if("checkbox"===e.type||"radio"===e.type)return i;var o=i.getBoundingClientRect().top,a=e.getBoundingClientRect();if(a.height&&window.innerHeight&&a.top+a.height-o<window.innerHeight/2)return i}}return document.querySelector("label[for='".concat(e.getAttribute("id"),"']"))||e.closest("label")}(t);return!!n&&(n.scrollIntoView(),t.focus({preventScroll:!0}),!0)})(e.target)&&e.preventDefault()}function m(e){return m="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},m(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,y(i.key),i)}}function y(e){var t=function(e,t){if("object"!=m(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=m(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==m(t)?t:t+""}var g=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.menuIsOpen=!1,this.navigation=document.querySelector(".nhsuk-navigation"),this.navigationList=document.querySelector(".nhsuk-header__navigation-list"),this.mobileMenu=document.createElement("ul"),this.mobileMenuToggleButton=document.querySelector(".nhsuk-header__menu-toggle"),this.mobileMenuCloseButton=document.createElement("button"),this.mobileMenuContainer=document.querySelector(".nhsuk-mobile-menu-container"),this.breakpoints=[],this.width=document.body.offsetWidth},t=[{key:"init",value:function(){var e=this;this.navigation&&this.navigationList&&this.mobileMenuToggleButton&&this.mobileMenuContainer&&(this.setupMobileMenu(),this.calculateBreakpoints(),this.updateNavigation(),this.doOnOrientationChange(),this.handleResize=this.debounce((function(){e.calculateBreakpoints(),e.updateNavigation()})),this.mobileMenuToggleButton.addEventListener("click",this.toggleMobileMenu.bind(this)),window.addEventListener("resize",this.handleResize),window.addEventListener("orientationchange",this.doOnOrientationChange()))}},{key:"debounce",value:function(e){var t,n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return function(){for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];clearTimeout(t),t=setTimeout((function(){e.apply(n,a)}),i)}}},{key:"calculateBreakpoints",value:function(){for(var e=0,t=0;t<this.navigationList.children.length;t++)e+=this.navigationList.children[t].offsetWidth,this.breakpoints[t]=e}},{key:"setupMobileMenu",value:function(){this.mobileMenuContainer.appendChild(this.mobileMenu),this.mobileMenu.classList.add("nhsuk-header__drop-down","nhsuk-header__drop-down--hidden")}},{key:"closeMobileMenu",value:function(){this.menuIsOpen=!1,this.mobileMenu.classList.add("nhsuk-header__drop-down--hidden"),this.navigation.style.marginBottom=0,this.mobileMenuToggleButton.setAttribute("aria-expanded","false"),this.mobileMenuToggleButton.focus(),this.mobileMenuCloseButton.removeEventListener("click",this.closeMobileMenu.bind(this)),document.removeEventListener("keydown",this.handleEscapeKey.bind(this))}},{key:"handleEscapeKey",value:function(e){"Escape"===e.key&&this.closeMobileMenu()}},{key:"openMobileMenu",value:function(){this.menuIsOpen=!0,this.mobileMenu.classList.remove("nhsuk-header__drop-down--hidden");var e=this.mobileMenu.offsetHeight;this.navigation.style.marginBottom="".concat(e,"px"),this.mobileMenuToggleButton.setAttribute("aria-expanded","true"),document.addEventListener("keydown",this.handleEscapeKey.bind(this)),this.mobileMenuCloseButton.addEventListener("click",this.closeMobileMenu.bind(this))}},{key:"toggleMobileMenu",value:function(){this.menuIsOpen?this.closeMobileMenu():this.openMobileMenu()}},{key:"updateNavigation",value:function(){var e=this.navigation.offsetWidth,t=this.navigationList.children.length;if(e<this.breakpoints[t-1]){if(this.mobileMenuToggleButton.classList.add("nhsuk-header__menu-toggle--visible"),this.mobileMenuContainer.classList.add("nhsuk-mobile-menu-container--visible"),2===t)return;for(;e<this.breakpoints[t-1];)this.mobileMenu.insertBefore(this.navigationList.children[t-2],this.mobileMenu.firstChild),t-=1}else if(e>this.breakpoints[t])for(;e>this.breakpoints[t];)this.navigationList.insertBefore(this.mobileMenu.removeChild(this.mobileMenu.firstChild),this.mobileMenuContainer),t+=1;this.mobileMenu.children.length||(this.mobileMenuToggleButton.classList.remove("nhsuk-header__menu-toggle--visible"),this.mobileMenuContainer.classList.remove("nhsuk-mobile-menu-container--visible")),document.body.offsetWidth!==this.width&&this.menuIsOpen&&this.closeMobileMenu()}},{key:"doOnOrientationChange",value:function(){var e=this;90===window.orientation&&setTimeout((function(){e.calculateBreakpoints(),e.updateNavigation()}),200)}}],t&&p(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function k(e){return k="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},k(e)}function w(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,E(i.key),i)}}function E(e){var t=function(e,t){if("object"!=k(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=k(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==k(t)?t:t+""}var A=function(){function e(t,n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.namespace=n,this.responsive=i,this.historyEnabled=o,this.$tabs=t.querySelectorAll(".".concat(this.namespace,"__tab")),this.keys={down:40,left:37,right:39,up:38},this.jsHiddenClass="".concat(this.namespace,"__panel--hidden"),this.showEvent=new CustomEvent("tab.show"),this.hideEvent=new CustomEvent("tab.hide")}return t=e,n=[{key:"init",value:function(){"function"==typeof window.matchMedia&&this.responsive?this.setupResponsiveChecks():this.setup()}},{key:"setupResponsiveChecks",value:function(){this.mql=window.matchMedia("(min-width: 641px)"),this.mql.addEventListener("change",this.checkMode.bind(this)),this.checkMode()}},{key:"checkMode",value:function(){this.mql.matches?this.setup():this.teardown()}},{key:"setup",value:function(){var e=this,t=this.$module,n=this.$tabs,i=t.querySelector(".".concat(this.namespace,"__list")),o=t.querySelectorAll(".".concat(this.namespace,"__list-item"));if(n&&i&&o){i.setAttribute("role","tablist"),o.forEach((function(e){e.setAttribute("role","presentation")})),n.forEach((function(t){e.setAttributes(t),t.boundTabClick=e.onTabClick.bind(e),t.boundTabKeydown=e.onTabKeydown.bind(e),t.addEventListener("click",t.boundTabClick,!0),t.addEventListener("keydown",t.boundTabKeydown,!0),e.hideTab(t)}));var a=this.getTab(window.location.hash)||this.$tabs[0];this.showTab(a),this.historyEnabled&&(t.boundOnHashChange=this.onHashChange.bind(this),window.addEventListener("hashchange",t.boundOnHashChange,!0))}}},{key:"teardown",value:function(){var e=this,t=this.$module,n=this.$tabs,i=t.querySelector(".".concat(this.namespace,"__list")),o=t.querySelectorAll(".".concat(this.namespace,"__list-item"));n&&i&&o&&(i.removeAttribute("role"),o.forEach((function(e){e.removeAttribute("role","presentation")})),n.forEach((function(t){t.removeEventListener("click",t.boundTabClick,!0),t.removeEventListener("keydown",t.boundTabKeydown,!0),e.unsetAttributes(t)})),this.historyEnabled&&window.removeEventListener("hashchange",t.boundOnHashChange,!0))}},{key:"onHashChange",value:function(){var e=window.location.hash,t=this.getTab(e);if(t)if(this.changingHash)this.changingHash=!1;else{var n=this.getCurrentTab();this.hideTab(n),this.showTab(t),t.focus()}}},{key:"hideTab",value:function(e){this.unhighlightTab(e),this.hidePanel(e)}},{key:"showTab",value:function(e){this.highlightTab(e),this.showPanel(e)}},{key:"getTab",value:function(e){return this.$module.querySelector(".".concat(this.namespace,'__tab[href="').concat(e,'"]'))}},{key:"setAttributes",value:function(t){var n=e.getHref(t).slice(1);t.setAttribute("id","tab_".concat(n)),t.setAttribute("role","tab"),t.setAttribute("aria-controls",n),t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");var i=this.getPanel(t);i.setAttribute("role","tabpanel"),i.setAttribute("aria-labelledby",t.id),i.classList.add(this.jsHiddenClass)}},{key:"unsetAttributes",value:function(e){e.removeAttribute("id"),e.removeAttribute("role"),e.removeAttribute("aria-controls"),e.removeAttribute("aria-selected"),e.removeAttribute("tabindex");var t=this.getPanel(e);t.removeAttribute("role"),t.removeAttribute("aria-labelledby"),t.removeAttribute("tabindex"),t.classList.remove(this.jsHiddenClass)}},{key:"onTabClick",value:function(e){e.target.classList.contains("".concat(this.namespace,"__tab"))||(e.stopPropagation(),e.preventDefault()),e.preventDefault();var t=e.target,n=this.getCurrentTab();this.hideTab(n),this.showTab(t),this.createHistoryEntry(t)}},{key:"createHistoryEntry",value:function(t){if(this.historyEnabled){var n=this.getPanel(t),i=n.id;n.id="",this.changingHash=!0,window.location.hash=e.getHref(t).slice(1),n.id=i}}},{key:"onTabKeydown",value:function(e){switch(e.keyCode){case this.keys.left:case this.keys.up:this.activatePreviousTab(),e.preventDefault();break;case this.keys.right:case this.keys.down:this.activateNextTab(),e.preventDefault()}}},{key:"activateNextTab",value:function(){var e,t=this.getCurrentTab(),n=t.parentNode.nextElementSibling;n&&(e=n.querySelector(".".concat(this.namespace,"__tab"))),e&&(this.hideTab(t),this.showTab(e),e.focus(),this.createHistoryEntry(e))}},{key:"activatePreviousTab",value:function(){var e,t=this.getCurrentTab(),n=t.parentNode.previousElementSibling;n&&(e=n.querySelector(".".concat(this.namespace,"__tab"))),e&&(this.hideTab(t),this.showTab(e),e.focus(),this.createHistoryEntry(e))}},{key:"getPanel",value:function(t){return this.$module.querySelector(e.getHref(t))}},{key:"showPanel",value:function(e){var t=this.getPanel(e);t.classList.remove(this.jsHiddenClass),t.dispatchEvent(this.showEvent)}},{key:"hidePanel",value:function(e){var t=this.getPanel(e);t.classList.add(this.jsHiddenClass),t.dispatchEvent(this.hideEvent)}},{key:"unhighlightTab",value:function(e){e.setAttribute("aria-selected","false"),e.parentNode.classList.remove("".concat(this.namespace,"__list-item--selected")),e.setAttribute("tabindex","-1")}},{key:"highlightTab",value:function(e){e.setAttribute("aria-selected","true"),e.parentNode.classList.add("".concat(this.namespace,"__list-item--selected")),e.setAttribute("tabindex","0")}},{key:"getCurrentTab",value:function(){return this.$module.querySelector(".".concat(this.namespace,"__list-item--selected .").concat(this.namespace,"__tab"))}}],i=[{key:"getHref",value:function(e){var t=e.getAttribute("href");return t.slice(t.indexOf("#"),t.length)}}],n&&w(t.prototype,n),i&&w(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i}();n(405),document.addEventListener("DOMContentLoaded",(function(){var e,t,n;(new g).init(),e=document.querySelector("h1"),t=document.querySelector(".nhsuk-skip-link"),e&&t&&(t.addEventListener("click",(function(t){t.preventDefault(),e.setAttribute("tabIndex","-1"),e.focus()})),e.addEventListener("blur",(function(t){t.preventDefault(),e.removeAttribute("tabIndex")}))),function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).scope;(void 0===e?document:e).querySelectorAll('[data-module="nhsuk-button"]').forEach((function(e){new a(e).init()}))}({scope:n=document}),function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).scope;(void 0===e?document:e).querySelectorAll('[data-module="nhsuk-character-count"]').forEach((function(e){new c(e).init()}))}({scope:n}),function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).scope,t=(void 0===e?document:e).querySelectorAll(".nhsuk-checkboxes .nhsuk-checkboxes__input"),n=function(e){h(e.target,"nhsuk-checkboxes__conditional--hidden"),e.target.checked&&(e.target.hasAttribute("data-checkbox-exclusive")?b(e.target):v(e.target))};"onpageshow"in window?window.addEventListener("pageshow",(function(){return t.forEach((function(e){return d(e)}))})):window.addEventListener("DOMContentLoaded",(function(){return t.forEach((function(e){return d(e)}))})),t.forEach((function(e){return d(e)})),t.forEach((function(e){e.addEventListener("change",n)}))}({scope:n}),function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).scope,t=void 0===e?document:e;if("boolean"!=typeof document.createElement("details").open){var n=t.querySelectorAll("details");n.length&&n.forEach((function(e,n){e.hasAttribute("nhsuk-polyfilled")||function(e,n){e.setAttribute("nhsuk-polyfilled","true"),e.id||e.setAttribute("id","nhsuk-details".concat(n));var i=t.querySelector("#".concat(e.id," .nhsuk-details__text"));i.id||i.setAttribute("id","nhsuk-details__text".concat(n));var o=t.querySelector("#".concat(e.id," .nhsuk-details__summary"));o.setAttribute("role","button"),o.setAttribute("aria-controls",i.id),o.setAttribute("tabIndex","0"),1==(null!==e.getAttribute("open"))?(o.setAttribute("aria-expanded","true"),i.setAttribute("aria-hidden","false")):(o.setAttribute("aria-expanded","false"),i.setAttribute("aria-hidden","true"),i.style.display="none"),o.addEventListener("click",(function(){l(o,"aria-expanded"),l(i,"aria-hidden"),i.style.display="true"===i.getAttribute("aria-hidden")?"none":"",e.hasAttribute("open")?e.removeAttribute("open"):e.setAttribute("open","open")})),o.addEventListener("keydown",(function(e){13!==e.keyCode&&32!==e.keyCode||(e.preventDefault(),o.click())}))}(e,n)}))}}({scope:n}),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.focusOnPageLoad,n=void 0===t||t,i=e.scope,o=(void 0===i?document:i).querySelector(".nhsuk-error-summary");o&&(n&&o.focus(),o.addEventListener("click",f))}({scope:n}),function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).scope,t=(void 0===e?document:e).querySelectorAll(".nhsuk-radios--conditional .nhsuk-radios__input"),n=function(){t.forEach((function(e){return h(e,"nhsuk-radios__conditional--hidden")}))};"onpageshow"in window?window.addEventListener("pageshow",n):window.addEventListener("DOMContentLoaded",n),n(),t.forEach((function(e){e.addEventListener("change",n)}))}({scope:n}),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.namespace,n=void 0===t?"nhsuk-tabs":t,i=e.responsive,o=void 0===i||i,a=e.historyEnabled,r=void 0===a||a,s=e.scope;(void 0===s?document:s).querySelectorAll('[data-module="'.concat(n,'"]')).forEach((function(e){new A(e,n,o,r).init()}))}({scope:n})}))})()})(); |
@@ -1,1 +0,1 @@ | ||
(()=>{var n={405:()=>{NodeList.prototype.forEach||(NodeList.prototype.forEach=Array.prototype.forEach),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{enumerable:!1,value:function(t){return 0<this.filter(function(e){return e===t}).length}}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(Element.prototype.matches.call(t,e))return t}while(null!==(t=t.parentElement||t.parentNode)&&1===t.nodeType);return null}),"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n})}},i={};function k(e){var t=i[e];return void 0!==t||(t=i[e]={exports:{}},n[e](t,t.exports,k)),t.exports}(()=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t,n){(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}function r(e){e=function(e){if("object"!==n(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!==n(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(e);return"symbol"===n(e)?e:String(e)}var i=function(){function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");s(this,"KEY_SPACE",32),s(this,"DEBOUNCE_TIMEOUT_IN_SECONDS",1),this.$module=e,this.debounceFormSubmitTimer=null}for(var e=t,n=e.prototype,i=[{key:"handleKeyDown",value:function(e){var t=e.target;"button"===t.getAttribute("role")&&e.keyCode===this.KEY_SPACE&&(e.preventDefault(),t.click())}},{key:"debounce",value:function(e){var t=this;if("true"===e.target.getAttribute("data-prevent-double-click"))return this.debounceFormSubmitTimer?(e.preventDefault(),!1):void(this.debounceFormSubmitTimer=setTimeout(function(){t.debounceFormSubmitTimer=null},1e3*this.DEBOUNCE_TIMEOUT_IN_SECONDS))}},{key:"init",value:function(){this.$module.addEventListener("keydown",this.handleKeyDown.bind(this)),this.$module.addEventListener("click",this.debounce.bind(this))}}],o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(n,r(a.key),a)}return Object.defineProperty(e,"prototype",{writable:!1}),t}();function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function e(e,t){for(var n,i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(n=function(e){if("object"!==a(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!==a(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(o.key),"symbol"===a(n)?n:String(n)),o)}}p=[{key:"getDataset",value:function(e){var t={},n=e.attributes;if(n)for(var i=0;i<n.length;i++){var o=n[i],a=o.name.match(/^data-(.+)/);a&&(t[a[1]]=o.value)}return t}}],e((m=u).prototype,[{key:"init",value:function(){var e,t,n,i;this.$textarea&&(e=this.$module,t=this.$textarea,n=document.getElementById("".concat(t.id,"-info")),t.insertAdjacentElement("afterend",n),(i=document.createElement("div")).className="nhsuk-character-count__sr-status nhsuk-u-visually-hidden",i.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=i,n.insertAdjacentElement("afterend",i),(i=document.createElement("div")).className=n.className,i.classList.add("nhsuk-character-count__status"),i.setAttribute("aria-hidden","true"),this.$visibleCountMessage=i,n.insertAdjacentElement("afterend",i),n.classList.add("nhsuk-u-visually-hidden"),this.options=u.getDataset(e),i=this.defaults.characterCountAttribute,this.options.maxwords&&(i=this.defaults.wordCountAttribute),this.maxLength=e.getAttribute(i),this.maxLength)&&(t.removeAttribute("maxlength"),this.bindChangeEvents(),"onpageshow"in window?window.addEventListener("pageshow",this.updateCountMessage.bind(this)):window.addEventListener("DOMContentLoaded",this.updateCountMessage.bind(this)),this.updateCountMessage())}},{key:"count",value:function(e){return(this.options.maxwords?e.match(/\S+/g)||[]:e).length}},{key:"bindChangeEvents",value:function(){var e=this.$textarea;e.addEventListener("keyup",this.handleKeyUp.bind(this)),e.addEventListener("focus",this.handleFocus.bind(this)),e.addEventListener("blur",this.handleBlur.bind(this))}},{key:"checkIfValueChanged",value:function(){this.$textarea.oldValue||(this.$textarea.oldValue=""),this.$textarea.value!==this.$textarea.oldValue&&(this.$textarea.oldValue=this.$textarea.value,this.updateCountMessage())}},{key:"updateCountMessage",value:function(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()}},{key:"updateVisibleCountMessage",value:function(){var e=this.$textarea,t=this.$visibleCountMessage,n=this.maxLength-this.count(e.value);this.isOverThreshold()?t.classList.remove("nhsuk-character-count__message--disabled"):t.classList.add("nhsuk-character-count__message--disabled"),n<0?(e.classList.add("nhsuk-textarea--error"),t.classList.remove("nhsuk-hint"),t.classList.add("nhsuk-error-message")):(e.classList.remove("nhsuk-textarea--error"),t.classList.remove("nhsuk-error-message"),t.classList.add("nhsuk-hint")),t.innerHTML=this.formattedUpdateMessage()}},{key:"updateScreenReaderCountMessage",value:function(){var e=this.$screenReaderCountMessage;this.isOverThreshold()?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",!0),e.innerHTML=this.formattedUpdateMessage()}},{key:"formattedUpdateMessage",value:function(){var e=this.$textarea,t=this.options,e=this.maxLength-this.count(e.value),n="character";return t.maxwords&&(n="word"),n+=-1==e||1==e?"":"s",t=e<0?"too many":"remaining",e=Math.abs(e),"You have ".concat(e," ").concat(n," ").concat(t)}},{key:"isOverThreshold",value:function(){var e=this.$textarea,t=this.options,e=this.count(e.value);return this.maxLength*(t.threshold||0)/100<=e}},{key:"handleKeyUp",value:function(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()}},{key:"handleFocus",value:function(){var e=this;this.valueChecker=setInterval(function(){(!e.lastInputTimestamp||Date.now()-500>=e.lastInputTimestamp)&&e.checkIfValueChanged()},1e3)}},{key:"handleBlur",value:function(){clearInterval(this.valueChecker)}}]),e(m,p),Object.defineProperty(m,"prototype",{writable:!1});var o=u;function u(e){if(!(this instanceof u))throw new TypeError("Cannot call a class as a function");this.$module=e,this.$textarea=e.querySelector(".nhsuk-js-character-count"),this.$visibleCountMessage=null,this.$screenReaderCountMessage=null,this.lastInputTimestamp=null}o.prototype.defaults={characterCountAttribute:"data-maxlength",wordCountAttribute:"data-maxwords"};function l(e,t){var n;e&&t&&(n="true"===e.getAttribute(t)?"false":"true",e.setAttribute(t,n))}function c(e,t){var n;e&&t&&(n=e.getAttribute("aria-controls"))&&(n=document.getElementById(n))&&(e.checked?(n.classList.remove(t),e.setAttribute("aria-expanded",!0)):(n.classList.add(t),e.setAttribute("aria-expanded",!1)))}var h=function(e){e.form.querySelectorAll('input[type="checkbox"]').forEach(function(e){return c(e,"nhsuk-checkboxes__conditional--hidden")})};function d(e){!function(e){if("A"===e.tagName&&!1!==e.href){var t,e=document.querySelector(e.hash);if(e)return(t=function(e){var t=e.closest("fieldset");if(t){t=t.getElementsByTagName("legend");if(t.length){t=t[0];if("checkbox"===e.type||"radio"===e.type)return t;var n=t.getBoundingClientRect().top,i=e.getBoundingClientRect();if(i.height&&window.innerHeight&&i.top+i.height-n<window.innerHeight/2)return t}}return document.querySelector("label[for='".concat(e.getAttribute("id"),"']"))||e.closest("label")}(e))&&(t.scrollIntoView(),e.focus({preventScroll:!0}),1)}}(e.target)||e.preventDefault()}function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var f=function(){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.menuIsOpen=!1,this.navigation=document.querySelector(".nhsuk-navigation"),this.navigationList=document.querySelector(".nhsuk-header__navigation-list"),this.mobileMenu=document.createElement("ul"),this.mobileMenuToggleButton=document.querySelector(".nhsuk-header__menu-toggle"),this.mobileMenuCloseButton=document.createElement("button"),this.mobileMenuContainer=document.querySelector(".nhsuk-mobile-menu-container"),this.breakpoints=[],this.width=document.body.offsetWidth}for(var t,n=e,i=[{key:"init",value:function(){var e=this;this.navigation&&this.navigationList&&this.mobileMenuToggleButton&&this.mobileMenuContainer&&(this.setupMobileMenu(),this.calculateBreakpoints(),this.updateNavigation(),this.doOnOrientationChange(),this.handleResize=this.debounce(function(){e.calculateBreakpoints(),e.updateNavigation()}),this.mobileMenuToggleButton.addEventListener("click",this.toggleMobileMenu.bind(this)),window.addEventListener("resize",this.handleResize),window.addEventListener("orientationchange",this.doOnOrientationChange()))}},{key:"debounce",value:function(i){var o,a=this,s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:100;return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];clearTimeout(o),o=setTimeout(function(){i.apply(a,t)},s)}}},{key:"calculateBreakpoints",value:function(){for(var e=0,t=0;t<this.navigationList.children.length;t++)e+=this.navigationList.children[t].offsetWidth,this.breakpoints[t]=e}},{key:"setupMobileMenu",value:function(){this.mobileMenuContainer.appendChild(this.mobileMenu),this.mobileMenu.classList.add("nhsuk-header__drop-down","nhsuk-header__drop-down--hidden")}},{key:"closeMobileMenu",value:function(){this.menuIsOpen=!1,this.mobileMenu.classList.add("nhsuk-header__drop-down--hidden"),this.navigation.style.marginBottom=0,this.mobileMenuToggleButton.setAttribute("aria-expanded","false"),this.mobileMenuToggleButton.focus(),this.mobileMenuCloseButton.removeEventListener("click",this.closeMobileMenu.bind(this)),document.removeEventListener("keydown",this.handleEscapeKey.bind(this))}},{key:"handleEscapeKey",value:function(e){"Escape"===e.key&&this.closeMobileMenu()}},{key:"openMobileMenu",value:function(){this.menuIsOpen=!0,this.mobileMenu.classList.remove("nhsuk-header__drop-down--hidden");var e=this.mobileMenu.offsetHeight;this.navigation.style.marginBottom="".concat(e,"px"),this.mobileMenuToggleButton.setAttribute("aria-expanded","true"),document.addEventListener("keydown",this.handleEscapeKey.bind(this)),this.mobileMenuCloseButton.addEventListener("click",this.closeMobileMenu.bind(this))}},{key:"toggleMobileMenu",value:function(){this.menuIsOpen?this.closeMobileMenu():this.openMobileMenu()}},{key:"updateNavigation",value:function(){var e=this.navigation.offsetWidth,t=this.navigationList.children.length;if(e<this.breakpoints[t-1]){if(this.mobileMenuToggleButton.classList.add("nhsuk-header__menu-toggle--visible"),this.mobileMenuContainer.classList.add("nhsuk-mobile-menu-container--visible"),2===t)return;for(;e<this.breakpoints[t-1];)this.mobileMenu.insertBefore(this.navigationList.children[t-2],this.mobileMenu.firstChild),--t}else if(e>this.breakpoints[t])for(;e>this.breakpoints[t];)this.navigationList.insertBefore(this.mobileMenu.removeChild(this.mobileMenu.firstChild),this.mobileMenuContainer),t+=1;this.mobileMenu.children.length||(this.mobileMenuToggleButton.classList.remove("nhsuk-header__menu-toggle--visible"),this.mobileMenuContainer.classList.remove("nhsuk-mobile-menu-container--visible")),document.body.offsetWidth!==this.width&&this.menuIsOpen&&this.closeMobileMenu()}},{key:"doOnOrientationChange",value:function(){var e=this;90===window.orientation&&setTimeout(function(){e.calculateBreakpoints(),e.updateNavigation()},200)}}],o=n.prototype,a=i,s=0;s<a.length;s++){var r=a[s];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(o,(t=function(e){if("object"!==b(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!==b(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(r.key),"symbol"===b(t)?t:String(t)),r)}return Object.defineProperty(n,"prototype",{writable:!1}),e}();function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function t(e,t){for(var n,i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(n=function(e){if("object"!==v(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!==v(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(o.key),"symbol"===v(n)?n:String(n)),o)}}p=[{key:"getHref",value:function(e){e=e.getAttribute("href");return e.slice(e.indexOf("#"),e.length)}}],t((m=g).prototype,[{key:"init",value:function(){"function"==typeof window.matchMedia&&this.responsive?this.setupResponsiveChecks():this.setup()}},{key:"setupResponsiveChecks",value:function(){this.mql=window.matchMedia("(min-width: 641px)"),this.mql.addEventListener("change",this.checkMode.bind(this)),this.checkMode()}},{key:"checkMode",value:function(){this.mql.matches?this.setup():this.teardown()}},{key:"setup",value:function(){var t=this,e=this.$module,n=this.$tabs,i=e.querySelector(".".concat(this.namespace,"__list")),o=e.querySelectorAll(".".concat(this.namespace,"__list-item"));n&&i&&o&&(i.setAttribute("role","tablist"),o.forEach(function(e){e.setAttribute("role","presentation")}),n.forEach(function(e){t.setAttributes(e),e.boundTabClick=t.onTabClick.bind(t),e.boundTabKeydown=t.onTabKeydown.bind(t),e.addEventListener("click",e.boundTabClick,!0),e.addEventListener("keydown",e.boundTabKeydown,!0),t.hideTab(e)}),i=this.getTab(window.location.hash)||this.$tabs[0],this.showTab(i),this.historyEnabled)&&(e.boundOnHashChange=this.onHashChange.bind(this),window.addEventListener("hashchange",e.boundOnHashChange,!0))}},{key:"teardown",value:function(){var t=this,e=this.$module,n=this.$tabs,i=e.querySelector(".".concat(this.namespace,"__list")),o=e.querySelectorAll(".".concat(this.namespace,"__list-item"));n&&i&&o&&(i.removeAttribute("role"),o.forEach(function(e){e.removeAttribute("role","presentation")}),n.forEach(function(e){e.removeEventListener("click",e.boundTabClick,!0),e.removeEventListener("keydown",e.boundTabKeydown,!0),t.unsetAttributes(e)}),this.historyEnabled)&&window.removeEventListener("hashchange",e.boundOnHashChange,!0)}},{key:"onHashChange",value:function(){var e,t=window.location.hash,t=this.getTab(t);t&&(this.changingHash?this.changingHash=!1:(e=this.getCurrentTab(),this.hideTab(e),this.showTab(t),t.focus()))}},{key:"hideTab",value:function(e){this.unhighlightTab(e),this.hidePanel(e)}},{key:"showTab",value:function(e){this.highlightTab(e),this.showPanel(e)}},{key:"getTab",value:function(e){return this.$module.querySelector(".".concat(this.namespace,'__tab[href="').concat(e,'"]'))}},{key:"setAttributes",value:function(e){var t=g.getHref(e).slice(1),t=(e.setAttribute("id","tab_".concat(t)),e.setAttribute("role","tab"),e.setAttribute("aria-controls",t),e.setAttribute("aria-selected","false"),e.setAttribute("tabindex","-1"),this.getPanel(e));t.setAttribute("role","tabpanel"),t.setAttribute("aria-labelledby",e.id),t.classList.add(this.jsHiddenClass)}},{key:"unsetAttributes",value:function(e){e.removeAttribute("id"),e.removeAttribute("role"),e.removeAttribute("aria-controls"),e.removeAttribute("aria-selected"),e.removeAttribute("tabindex");e=this.getPanel(e);e.removeAttribute("role"),e.removeAttribute("aria-labelledby"),e.removeAttribute("tabindex"),e.classList.remove(this.jsHiddenClass)}},{key:"onTabClick",value:function(e){e.target.classList.contains("".concat(this.namespace,"__tab"))||(e.stopPropagation(),e.preventDefault()),e.preventDefault();var e=e.target,t=this.getCurrentTab();this.hideTab(t),this.showTab(e),this.createHistoryEntry(e)}},{key:"createHistoryEntry",value:function(e){var t,n;this.historyEnabled&&(n=(t=this.getPanel(e)).id,t.id="",this.changingHash=!0,window.location.hash=g.getHref(e).slice(1),t.id=n)}},{key:"onTabKeydown",value:function(e){switch(e.keyCode){case this.keys.left:case this.keys.up:this.activatePreviousTab(),e.preventDefault();break;case this.keys.right:case this.keys.down:this.activateNextTab(),e.preventDefault()}}},{key:"activateNextTab",value:function(){var e,t=this.getCurrentTab(),n=t.parentNode.nextElementSibling;(e=n?n.querySelector(".".concat(this.namespace,"__tab")):e)&&(this.hideTab(t),this.showTab(e),e.focus(),this.createHistoryEntry(e))}},{key:"activatePreviousTab",value:function(){var e,t=this.getCurrentTab(),n=t.parentNode.previousElementSibling;(e=n?n.querySelector(".".concat(this.namespace,"__tab")):e)&&(this.hideTab(t),this.showTab(e),e.focus(),this.createHistoryEntry(e))}},{key:"getPanel",value:function(e){return this.$module.querySelector(g.getHref(e))}},{key:"showPanel",value:function(e){e=this.getPanel(e);e.classList.remove(this.jsHiddenClass),e.dispatchEvent(this.showEvent)}},{key:"hidePanel",value:function(e){e=this.getPanel(e);e.classList.add(this.jsHiddenClass),e.dispatchEvent(this.hideEvent)}},{key:"unhighlightTab",value:function(e){e.setAttribute("aria-selected","false"),e.parentNode.classList.remove("".concat(this.namespace,"__list-item--selected")),e.setAttribute("tabindex","-1")}},{key:"highlightTab",value:function(e){e.setAttribute("aria-selected","true"),e.parentNode.classList.add("".concat(this.namespace,"__list-item--selected")),e.setAttribute("tabindex","0")}},{key:"getCurrentTab",value:function(){return this.$module.querySelector(".".concat(this.namespace,"__list-item--selected .").concat(this.namespace,"__tab"))}}]),t(m,p),Object.defineProperty(m,"prototype",{writable:!1});var m,p,y=g;function g(e,t,n,i){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");this.$module=e,this.namespace=t,this.responsive=n,this.historyEnabled=i,this.$tabs=e.querySelectorAll(".".concat(this.namespace,"__tab")),this.keys={down:40,left:37,right:39,up:38},this.jsHiddenClass="".concat(this.namespace,"__panel--hidden"),this.showEvent=new CustomEvent("tab.show"),this.hideEvent=new CustomEvent("tab.hide")}k(405),document.addEventListener("DOMContentLoaded",function(){var t,e;(new f).init(),t=document.querySelector("h1"),e=document.querySelector(".nhsuk-skip-link"),t&&e&&(e.addEventListener("click",function(e){e.preventDefault(),t.setAttribute("tabIndex","-1"),t.focus()}),t.addEventListener("blur",function(e){e.preventDefault(),t.removeAttribute("tabIndex")})),function(e){e=(0<arguments.length&&void 0!==e?e:{}).scope;(void 0===e?document:e).querySelectorAll('[data-module="nhsuk-button"]').forEach(function(e){new i(e).init()})}({scope:e=document}),function(e){e=(0<arguments.length&&void 0!==e?e:{}).scope;(void 0===e?document:e).querySelectorAll('[data-module="nhsuk-character-count"]').forEach(function(e){new o(e).init()})}({scope:e}),function(e){function t(e){var t,n;c(e.target,"nhsuk-checkboxes__conditional--hidden"),e.target.checked&&(e.target.hasAttribute("data-checkbox-exclusive")?((n=e.target).form.querySelectorAll('input[type="checkbox"][data-checkbox-exclusive-group="'.concat(n.getAttribute("data-checkbox-exclusive-group"),'"]')).forEach(function(e){n.form===e.form&&e!==n&&(e.checked=!1)}),h(n)):((t=e.target).form.querySelectorAll('input[type="checkbox"][data-checkbox-exclusive][data-checkbox-exclusive-group="'.concat(t.getAttribute("data-checkbox-exclusive-group"),'"]')).forEach(function(e){t.form===e.form&&(e.checked=!1)}),h(t)))}var e=(0<arguments.length&&void 0!==e?e:{}).scope,n=(void 0===e?document:e).querySelectorAll(".nhsuk-checkboxes .nhsuk-checkboxes__input");"onpageshow"in window?window.addEventListener("pageshow",function(){return n.forEach(function(e){return h(e)})}):window.addEventListener("DOMContentLoaded",function(){return n.forEach(function(e){return h(e)})}),n.forEach(function(e){return h(e)}),n.forEach(function(e){e.addEventListener("change",t)})}({scope:e}),function(e){var e=(0<arguments.length&&void 0!==e?e:{}).scope,a=void 0===e?document:e;"boolean"!=typeof document.createElement("details").open&&(e=a.querySelectorAll("details")).length&&e.forEach(function(e,t){var n,i,o;e.hasAttribute("nhsuk-polyfilled")||(t=t,(n=e).setAttribute("nhsuk-polyfilled","true"),n.id||n.setAttribute("id","nhsuk-details".concat(t)),(i=a.querySelector("#".concat(n.id," .nhsuk-details__text"))).id||i.setAttribute("id","nhsuk-details__text".concat(t)),(o=a.querySelector("#".concat(n.id," .nhsuk-details__summary"))).setAttribute("role","button"),o.setAttribute("aria-controls",i.id),o.setAttribute("tabIndex","0"),1==(null!==n.getAttribute("open"))?(o.setAttribute("aria-expanded","true"),i.setAttribute("aria-hidden","false")):(o.setAttribute("aria-expanded","false"),i.setAttribute("aria-hidden","true"),i.style.display="none"),o.addEventListener("click",function(){l(o,"aria-expanded"),l(i,"aria-hidden"),i.style.display="true"===i.getAttribute("aria-hidden")?"none":"",n.hasAttribute("open")?n.removeAttribute("open"):n.setAttribute("open","open")}),o.addEventListener("keydown",function(e){13!==e.keyCode&&32!==e.keyCode||(e.preventDefault(),o.click())}))})}({scope:e}),function(e){var e=0<arguments.length&&void 0!==e?e:{},t=e.focusOnPageLoad,t=void 0===t||t,e=e.scope,e=(void 0===e?document:e).querySelector(".nhsuk-error-summary");e&&(t&&e.focus(),e.addEventListener("click",d))}({scope:e}),function(e){function t(){n.forEach(function(e){return c(e,"nhsuk-radios__conditional--hidden")})}var e=(0<arguments.length&&void 0!==e?e:{}).scope,n=(void 0===e?document:e).querySelectorAll(".nhsuk-radios--conditional .nhsuk-radios__input");"onpageshow"in window?window.addEventListener("pageshow",t):window.addEventListener("DOMContentLoaded",t),t(),n.forEach(function(e){e.addEventListener("change",t)})}({scope:e}),function(e){var e=0<arguments.length&&void 0!==e?e:{},t=e.namespace,n=void 0===t?"nhsuk-tabs":t,t=e.responsive,i=void 0===t||t,t=e.historyEnabled,o=void 0===t||t,t=e.scope;(void 0===t?document:t).querySelectorAll('[data-module="'.concat(n,'"]')).forEach(function(e){new y(e,n,i,o).init()})}({scope:e})})})()})(); | ||
(()=>{var n={405:()=>{NodeList.prototype.forEach||(NodeList.prototype.forEach=Array.prototype.forEach),Array.prototype.includes||Object.defineProperty(Array.prototype,"includes",{enumerable:!1,value:function(t){return 0<this.filter(function(e){return e===t}).length}}),Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){var t=this;do{if(Element.prototype.matches.call(t,e))return t}while(null!==(t=t.parentElement||t.parentNode)&&1===t.nodeType);return null}),"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n})}},i={};function w(e){var t=i[e];return void 0!==t||(t=i[e]={exports:{}},n[e](t,t.exports,w)),t.exports}(()=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t,n){(t=s(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n}function s(e){e=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!=n(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(e);return"symbol"==n(e)?e:e+""}var i=function(){for(var e,e=function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");a(this,"KEY_SPACE",32),a(this,"DEBOUNCE_TIMEOUT_IN_SECONDS",1),this.$module=t,this.debounceFormSubmitTimer=null},t=e.prototype,n=[{key:"handleKeyDown",value:function(e){var t=e.target;"button"===t.getAttribute("role")&&e.keyCode===this.KEY_SPACE&&(e.preventDefault(),t.click())}},{key:"debounce",value:function(e){var t=this;if("true"===e.target.getAttribute("data-prevent-double-click"))return this.debounceFormSubmitTimer?(e.preventDefault(),!1):void(this.debounceFormSubmitTimer=setTimeout(function(){t.debounceFormSubmitTimer=null},1e3*this.DEBOUNCE_TIMEOUT_IN_SECONDS))}},{key:"init",value:function(){this.$module.addEventListener("keydown",this.handleKeyDown.bind(this)),this.$module.addEventListener("click",this.debounce.bind(this))}}],i=0;i<n.length;i++){var o=n[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,s(o.key),o)}return Object.defineProperty(e,"prototype",{writable:!1}),e}();function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function e(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,function(e){e=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!=o(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(e);return"symbol"==o(e)?e:e+""}(i.key),i)}}p=[{key:"getDataset",value:function(e){var t={},n=e.attributes;if(n)for(var i=0;i<n.length;i++){var o=n[i],a=o.name.match(/^data-(.+)/);a&&(t[a[1]]=o.value)}return t}}],e((y=u).prototype,[{key:"init",value:function(){var e,t,n,i;this.$textarea&&(e=this.$module,t=this.$textarea,n=document.getElementById("".concat(t.id,"-info")),t.insertAdjacentElement("afterend",n),(i=document.createElement("div")).className="nhsuk-character-count__sr-status nhsuk-u-visually-hidden",i.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=i,n.insertAdjacentElement("afterend",i),(i=document.createElement("div")).className=n.className,i.classList.add("nhsuk-character-count__status"),i.setAttribute("aria-hidden","true"),this.$visibleCountMessage=i,n.insertAdjacentElement("afterend",i),n.classList.add("nhsuk-u-visually-hidden"),this.options=u.getDataset(e),i=this.defaults.characterCountAttribute,this.options.maxwords&&(i=this.defaults.wordCountAttribute),this.maxLength=e.getAttribute(i),this.maxLength)&&(t.removeAttribute("maxlength"),this.bindChangeEvents(),"onpageshow"in window?window.addEventListener("pageshow",this.updateCountMessage.bind(this)):window.addEventListener("DOMContentLoaded",this.updateCountMessage.bind(this)),this.updateCountMessage())}},{key:"count",value:function(e){return(this.options.maxwords?e.match(/\S+/g)||[]:e).length}},{key:"bindChangeEvents",value:function(){var e=this.$textarea;e.addEventListener("keyup",this.handleKeyUp.bind(this)),e.addEventListener("focus",this.handleFocus.bind(this)),e.addEventListener("blur",this.handleBlur.bind(this))}},{key:"checkIfValueChanged",value:function(){this.$textarea.oldValue||(this.$textarea.oldValue=""),this.$textarea.value!==this.$textarea.oldValue&&(this.$textarea.oldValue=this.$textarea.value,this.updateCountMessage())}},{key:"updateCountMessage",value:function(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()}},{key:"updateVisibleCountMessage",value:function(){var e=this.$textarea,t=this.$visibleCountMessage,n=this.maxLength-this.count(e.value);this.isOverThreshold()?t.classList.remove("nhsuk-character-count__message--disabled"):t.classList.add("nhsuk-character-count__message--disabled"),n<0?(e.classList.add("nhsuk-textarea--error"),t.classList.remove("nhsuk-hint"),t.classList.add("nhsuk-error-message")):(e.classList.remove("nhsuk-textarea--error"),t.classList.remove("nhsuk-error-message"),t.classList.add("nhsuk-hint")),t.innerHTML=this.formattedUpdateMessage()}},{key:"updateScreenReaderCountMessage",value:function(){var e=this.$screenReaderCountMessage;this.isOverThreshold()?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",!0),e.innerHTML=this.formattedUpdateMessage()}},{key:"formattedUpdateMessage",value:function(){var e=this.$textarea,t=this.options,e=this.maxLength-this.count(e.value),n="character";return t.maxwords&&(n="word"),n+=-1==e||1==e?"":"s",t=e<0?"too many":"remaining",e=Math.abs(e),"You have ".concat(e," ").concat(n," ").concat(t)}},{key:"isOverThreshold",value:function(){var e=this.$textarea,t=this.options,e=this.count(e.value);return this.maxLength*(t.threshold||0)/100<=e}},{key:"handleKeyUp",value:function(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()}},{key:"handleFocus",value:function(){var e=this;this.valueChecker=setInterval(function(){(!e.lastInputTimestamp||Date.now()-500>=e.lastInputTimestamp)&&e.checkIfValueChanged()},1e3)}},{key:"handleBlur",value:function(){clearInterval(this.valueChecker)}}]),e(y,p),Object.defineProperty(y,"prototype",{writable:!1});var r=y;function u(e){if(!(this instanceof u))throw new TypeError("Cannot call a class as a function");this.$module=e,this.$textarea=e.querySelector(".nhsuk-js-character-count"),this.$visibleCountMessage=null,this.$screenReaderCountMessage=null,this.lastInputTimestamp=null}r.prototype.defaults={characterCountAttribute:"data-maxlength",wordCountAttribute:"data-maxwords"};function c(e,t){var n;e&&t&&(n="true"===e.getAttribute(t)?"false":"true",e.setAttribute(t,n))}function l(e,t){var n;e&&t&&(n=e.getAttribute("aria-controls"))&&(n=document.getElementById(n))&&(e.checked?(n.classList.remove(t),e.setAttribute("aria-expanded",!0)):(n.classList.add(t),e.setAttribute("aria-expanded",!1)))}var h=function(e){e.form.querySelectorAll('input[type="checkbox"]').forEach(function(e){return l(e,"nhsuk-checkboxes__conditional--hidden")})};function d(e){!function(e){if("A"===e.tagName&&!1!==e.href){var t,e=document.querySelector(e.hash);if(e)return(t=function(e){var t=e.closest("fieldset");if(t){t=t.getElementsByTagName("legend");if(t.length){t=t[0];if("checkbox"===e.type||"radio"===e.type)return t;var n=t.getBoundingClientRect().top,i=e.getBoundingClientRect();if(i.height&&window.innerHeight&&i.top+i.height-n<window.innerHeight/2)return t}}return document.querySelector("label[for='".concat(e.getAttribute("id"),"']"))||e.closest("label")}(e))&&(t.scrollIntoView(),e.focus({preventScroll:!0}),1)}}(e.target)||e.preventDefault()}function b(e){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function t(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,function(e){e=function(e){if("object"!=b(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!=b(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(e);return"symbol"==b(e)?e:e+""}(i.key),i)}}t((p=function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");this.menuIsOpen=!1,this.navigation=document.querySelector(".nhsuk-navigation"),this.navigationList=document.querySelector(".nhsuk-header__navigation-list"),this.mobileMenu=document.createElement("ul"),this.mobileMenuToggleButton=document.querySelector(".nhsuk-header__menu-toggle"),this.mobileMenuCloseButton=document.createElement("button"),this.mobileMenuContainer=document.querySelector(".nhsuk-mobile-menu-container"),this.breakpoints=[],this.width=document.body.offsetWidth}).prototype,[{key:"init",value:function(){var e=this;this.navigation&&this.navigationList&&this.mobileMenuToggleButton&&this.mobileMenuContainer&&(this.setupMobileMenu(),this.calculateBreakpoints(),this.updateNavigation(),this.doOnOrientationChange(),this.handleResize=this.debounce(function(){e.calculateBreakpoints(),e.updateNavigation()}),this.mobileMenuToggleButton.addEventListener("click",this.toggleMobileMenu.bind(this)),window.addEventListener("resize",this.handleResize),window.addEventListener("orientationchange",this.doOnOrientationChange()))}},{key:"debounce",value:function(i){var o,a=this,s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:100;return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];clearTimeout(o),o=setTimeout(function(){i.apply(a,t)},s)}}},{key:"calculateBreakpoints",value:function(){for(var e=0,t=0;t<this.navigationList.children.length;t++)e+=this.navigationList.children[t].offsetWidth,this.breakpoints[t]=e}},{key:"setupMobileMenu",value:function(){this.mobileMenuContainer.appendChild(this.mobileMenu),this.mobileMenu.classList.add("nhsuk-header__drop-down","nhsuk-header__drop-down--hidden")}},{key:"closeMobileMenu",value:function(){this.menuIsOpen=!1,this.mobileMenu.classList.add("nhsuk-header__drop-down--hidden"),this.navigation.style.marginBottom=0,this.mobileMenuToggleButton.setAttribute("aria-expanded","false"),this.mobileMenuToggleButton.focus(),this.mobileMenuCloseButton.removeEventListener("click",this.closeMobileMenu.bind(this)),document.removeEventListener("keydown",this.handleEscapeKey.bind(this))}},{key:"handleEscapeKey",value:function(e){"Escape"===e.key&&this.closeMobileMenu()}},{key:"openMobileMenu",value:function(){this.menuIsOpen=!0,this.mobileMenu.classList.remove("nhsuk-header__drop-down--hidden");var e=this.mobileMenu.offsetHeight;this.navigation.style.marginBottom="".concat(e,"px"),this.mobileMenuToggleButton.setAttribute("aria-expanded","true"),document.addEventListener("keydown",this.handleEscapeKey.bind(this)),this.mobileMenuCloseButton.addEventListener("click",this.closeMobileMenu.bind(this))}},{key:"toggleMobileMenu",value:function(){this.menuIsOpen?this.closeMobileMenu():this.openMobileMenu()}},{key:"updateNavigation",value:function(){var e=this.navigation.offsetWidth,t=this.navigationList.children.length;if(e<this.breakpoints[t-1]){if(this.mobileMenuToggleButton.classList.add("nhsuk-header__menu-toggle--visible"),this.mobileMenuContainer.classList.add("nhsuk-mobile-menu-container--visible"),2===t)return;for(;e<this.breakpoints[t-1];)this.mobileMenu.insertBefore(this.navigationList.children[t-2],this.mobileMenu.firstChild),--t}else if(e>this.breakpoints[t])for(;e>this.breakpoints[t];)this.navigationList.insertBefore(this.mobileMenu.removeChild(this.mobileMenu.firstChild),this.mobileMenuContainer),t+=1;this.mobileMenu.children.length||(this.mobileMenuToggleButton.classList.remove("nhsuk-header__menu-toggle--visible"),this.mobileMenuContainer.classList.remove("nhsuk-mobile-menu-container--visible")),document.body.offsetWidth!==this.width&&this.menuIsOpen&&this.closeMobileMenu()}},{key:"doOnOrientationChange",value:function(){var e=this;90===window.orientation&&setTimeout(function(){e.calculateBreakpoints(),e.updateNavigation()},200)}}]),Object.defineProperty(p,"prototype",{writable:!1});var f=p;function v(e){return(v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(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,function(e){e=function(e){if("object"!=v(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);t=t.call(e,"string");if("object"!=v(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}(e);return"symbol"==v(e)?e:e+""}(i.key),i)}}y=[{key:"getHref",value:function(e){e=e.getAttribute("href");return e.slice(e.indexOf("#"),e.length)}}],m((p=k).prototype,[{key:"init",value:function(){"function"==typeof window.matchMedia&&this.responsive?this.setupResponsiveChecks():this.setup()}},{key:"setupResponsiveChecks",value:function(){this.mql=window.matchMedia("(min-width: 641px)"),this.mql.addEventListener("change",this.checkMode.bind(this)),this.checkMode()}},{key:"checkMode",value:function(){this.mql.matches?this.setup():this.teardown()}},{key:"setup",value:function(){var t=this,e=this.$module,n=this.$tabs,i=e.querySelector(".".concat(this.namespace,"__list")),o=e.querySelectorAll(".".concat(this.namespace,"__list-item"));n&&i&&o&&(i.setAttribute("role","tablist"),o.forEach(function(e){e.setAttribute("role","presentation")}),n.forEach(function(e){t.setAttributes(e),e.boundTabClick=t.onTabClick.bind(t),e.boundTabKeydown=t.onTabKeydown.bind(t),e.addEventListener("click",e.boundTabClick,!0),e.addEventListener("keydown",e.boundTabKeydown,!0),t.hideTab(e)}),i=this.getTab(window.location.hash)||this.$tabs[0],this.showTab(i),this.historyEnabled)&&(e.boundOnHashChange=this.onHashChange.bind(this),window.addEventListener("hashchange",e.boundOnHashChange,!0))}},{key:"teardown",value:function(){var t=this,e=this.$module,n=this.$tabs,i=e.querySelector(".".concat(this.namespace,"__list")),o=e.querySelectorAll(".".concat(this.namespace,"__list-item"));n&&i&&o&&(i.removeAttribute("role"),o.forEach(function(e){e.removeAttribute("role","presentation")}),n.forEach(function(e){e.removeEventListener("click",e.boundTabClick,!0),e.removeEventListener("keydown",e.boundTabKeydown,!0),t.unsetAttributes(e)}),this.historyEnabled)&&window.removeEventListener("hashchange",e.boundOnHashChange,!0)}},{key:"onHashChange",value:function(){var e,t=window.location.hash,t=this.getTab(t);t&&(this.changingHash?this.changingHash=!1:(e=this.getCurrentTab(),this.hideTab(e),this.showTab(t),t.focus()))}},{key:"hideTab",value:function(e){this.unhighlightTab(e),this.hidePanel(e)}},{key:"showTab",value:function(e){this.highlightTab(e),this.showPanel(e)}},{key:"getTab",value:function(e){return this.$module.querySelector(".".concat(this.namespace,'__tab[href="').concat(e,'"]'))}},{key:"setAttributes",value:function(e){var t=k.getHref(e).slice(1),t=(e.setAttribute("id","tab_".concat(t)),e.setAttribute("role","tab"),e.setAttribute("aria-controls",t),e.setAttribute("aria-selected","false"),e.setAttribute("tabindex","-1"),this.getPanel(e));t.setAttribute("role","tabpanel"),t.setAttribute("aria-labelledby",e.id),t.classList.add(this.jsHiddenClass)}},{key:"unsetAttributes",value:function(e){e.removeAttribute("id"),e.removeAttribute("role"),e.removeAttribute("aria-controls"),e.removeAttribute("aria-selected"),e.removeAttribute("tabindex");e=this.getPanel(e);e.removeAttribute("role"),e.removeAttribute("aria-labelledby"),e.removeAttribute("tabindex"),e.classList.remove(this.jsHiddenClass)}},{key:"onTabClick",value:function(e){e.target.classList.contains("".concat(this.namespace,"__tab"))||(e.stopPropagation(),e.preventDefault()),e.preventDefault();var e=e.target,t=this.getCurrentTab();this.hideTab(t),this.showTab(e),this.createHistoryEntry(e)}},{key:"createHistoryEntry",value:function(e){var t,n;this.historyEnabled&&(n=(t=this.getPanel(e)).id,t.id="",this.changingHash=!0,window.location.hash=k.getHref(e).slice(1),t.id=n)}},{key:"onTabKeydown",value:function(e){switch(e.keyCode){case this.keys.left:case this.keys.up:this.activatePreviousTab(),e.preventDefault();break;case this.keys.right:case this.keys.down:this.activateNextTab(),e.preventDefault()}}},{key:"activateNextTab",value:function(){var e,t=this.getCurrentTab(),n=t.parentNode.nextElementSibling;(e=n?n.querySelector(".".concat(this.namespace,"__tab")):e)&&(this.hideTab(t),this.showTab(e),e.focus(),this.createHistoryEntry(e))}},{key:"activatePreviousTab",value:function(){var e,t=this.getCurrentTab(),n=t.parentNode.previousElementSibling;(e=n?n.querySelector(".".concat(this.namespace,"__tab")):e)&&(this.hideTab(t),this.showTab(e),e.focus(),this.createHistoryEntry(e))}},{key:"getPanel",value:function(e){return this.$module.querySelector(k.getHref(e))}},{key:"showPanel",value:function(e){e=this.getPanel(e);e.classList.remove(this.jsHiddenClass),e.dispatchEvent(this.showEvent)}},{key:"hidePanel",value:function(e){e=this.getPanel(e);e.classList.add(this.jsHiddenClass),e.dispatchEvent(this.hideEvent)}},{key:"unhighlightTab",value:function(e){e.setAttribute("aria-selected","false"),e.parentNode.classList.remove("".concat(this.namespace,"__list-item--selected")),e.setAttribute("tabindex","-1")}},{key:"highlightTab",value:function(e){e.setAttribute("aria-selected","true"),e.parentNode.classList.add("".concat(this.namespace,"__list-item--selected")),e.setAttribute("tabindex","0")}},{key:"getCurrentTab",value:function(){return this.$module.querySelector(".".concat(this.namespace,"__list-item--selected .").concat(this.namespace,"__tab"))}}]),m(p,y),Object.defineProperty(p,"prototype",{writable:!1});var p,y,g=p;function k(e,t,n,i){if(!(this instanceof k))throw new TypeError("Cannot call a class as a function");this.$module=e,this.namespace=t,this.responsive=n,this.historyEnabled=i,this.$tabs=e.querySelectorAll(".".concat(this.namespace,"__tab")),this.keys={down:40,left:37,right:39,up:38},this.jsHiddenClass="".concat(this.namespace,"__panel--hidden"),this.showEvent=new CustomEvent("tab.show"),this.hideEvent=new CustomEvent("tab.hide")}w(405),document.addEventListener("DOMContentLoaded",function(){var t,e;(new f).init(),t=document.querySelector("h1"),e=document.querySelector(".nhsuk-skip-link"),t&&e&&(e.addEventListener("click",function(e){e.preventDefault(),t.setAttribute("tabIndex","-1"),t.focus()}),t.addEventListener("blur",function(e){e.preventDefault(),t.removeAttribute("tabIndex")})),function(e){e=(0<arguments.length&&void 0!==e?e:{}).scope;(void 0===e?document:e).querySelectorAll('[data-module="nhsuk-button"]').forEach(function(e){new i(e).init()})}({scope:e=document}),function(e){e=(0<arguments.length&&void 0!==e?e:{}).scope;(void 0===e?document:e).querySelectorAll('[data-module="nhsuk-character-count"]').forEach(function(e){new r(e).init()})}({scope:e}),function(e){function t(e){var t,n;l(e.target,"nhsuk-checkboxes__conditional--hidden"),e.target.checked&&(e.target.hasAttribute("data-checkbox-exclusive")?((n=e.target).form.querySelectorAll('input[type="checkbox"][data-checkbox-exclusive-group="'.concat(n.getAttribute("data-checkbox-exclusive-group"),'"]')).forEach(function(e){n.form===e.form&&e!==n&&(e.checked=!1)}),h(n)):((t=e.target).form.querySelectorAll('input[type="checkbox"][data-checkbox-exclusive][data-checkbox-exclusive-group="'.concat(t.getAttribute("data-checkbox-exclusive-group"),'"]')).forEach(function(e){t.form===e.form&&(e.checked=!1)}),h(t)))}var e=(0<arguments.length&&void 0!==e?e:{}).scope,n=(void 0===e?document:e).querySelectorAll(".nhsuk-checkboxes .nhsuk-checkboxes__input");"onpageshow"in window?window.addEventListener("pageshow",function(){return n.forEach(function(e){return h(e)})}):window.addEventListener("DOMContentLoaded",function(){return n.forEach(function(e){return h(e)})}),n.forEach(function(e){return h(e)}),n.forEach(function(e){e.addEventListener("change",t)})}({scope:e}),function(e){var e=(0<arguments.length&&void 0!==e?e:{}).scope,a=void 0===e?document:e;"boolean"!=typeof document.createElement("details").open&&(e=a.querySelectorAll("details")).length&&e.forEach(function(e,t){var n,i,o;e.hasAttribute("nhsuk-polyfilled")||(t=t,(n=e).setAttribute("nhsuk-polyfilled","true"),n.id||n.setAttribute("id","nhsuk-details".concat(t)),(i=a.querySelector("#".concat(n.id," .nhsuk-details__text"))).id||i.setAttribute("id","nhsuk-details__text".concat(t)),(o=a.querySelector("#".concat(n.id," .nhsuk-details__summary"))).setAttribute("role","button"),o.setAttribute("aria-controls",i.id),o.setAttribute("tabIndex","0"),1==(null!==n.getAttribute("open"))?(o.setAttribute("aria-expanded","true"),i.setAttribute("aria-hidden","false")):(o.setAttribute("aria-expanded","false"),i.setAttribute("aria-hidden","true"),i.style.display="none"),o.addEventListener("click",function(){c(o,"aria-expanded"),c(i,"aria-hidden"),i.style.display="true"===i.getAttribute("aria-hidden")?"none":"",n.hasAttribute("open")?n.removeAttribute("open"):n.setAttribute("open","open")}),o.addEventListener("keydown",function(e){13!==e.keyCode&&32!==e.keyCode||(e.preventDefault(),o.click())}))})}({scope:e}),function(e){var e=0<arguments.length&&void 0!==e?e:{},t=e.focusOnPageLoad,t=void 0===t||t,e=e.scope,e=(void 0===e?document:e).querySelector(".nhsuk-error-summary");e&&(t&&e.focus(),e.addEventListener("click",d))}({scope:e}),function(e){function t(){n.forEach(function(e){return l(e,"nhsuk-radios__conditional--hidden")})}var e=(0<arguments.length&&void 0!==e?e:{}).scope,n=(void 0===e?document:e).querySelectorAll(".nhsuk-radios--conditional .nhsuk-radios__input");"onpageshow"in window?window.addEventListener("pageshow",t):window.addEventListener("DOMContentLoaded",t),t(),n.forEach(function(e){e.addEventListener("change",t)})}({scope:e}),function(e){var e=0<arguments.length&&void 0!==e?e:{},t=e.namespace,n=void 0===t?"nhsuk-tabs":t,t=e.responsive,i=void 0===t||t,t=e.historyEnabled,o=void 0===t||t,t=e.scope;(void 0===t?document:t).querySelectorAll('[data-module="'.concat(n,'"]')).forEach(function(e){new g(e,n,i,o).init()})}({scope:e})})})()})(); |
{ | ||
"name": "nhsuk-frontend", | ||
"version": "8.2.0", | ||
"version": "8.3.0", | ||
"description": "NHS.UK frontend contains the code you need to start building user interfaces for NHS websites and services.", | ||
"engines": { | ||
"node": ">=20.0.0" | ||
}, | ||
"scripts": { | ||
@@ -31,15 +34,15 @@ "prepare": "gulp bundle", | ||
"devDependencies": { | ||
"@babel/core": "^7.18.6", | ||
"@babel/eslint-parser": "^7.18.9", | ||
"@babel/preset-env": "^7.18.6", | ||
"babel-loader": "^8.2.5", | ||
"backstopjs": "^6.1.0", | ||
"concurrently": "^7.2.2", | ||
"@babel/core": "^7.24.7", | ||
"@babel/eslint-parser": "^7.24.7", | ||
"@babel/preset-env": "^7.24.7", | ||
"babel-loader": "^9.1.3", | ||
"backstopjs": "^6.3.23", | ||
"concurrently": "^8.2.2", | ||
"eslint": "^8.19.0", | ||
"eslint-config-airbnb-base": "^15.0.0", | ||
"eslint-config-postcss": "^4.0.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"follow-redirects": "^1.15.6", | ||
"gulp": "^4.0.2", | ||
"gulp": "^5.0.0", | ||
"gulp-clean": "^0.4.0", | ||
@@ -54,17 +57,17 @@ "gulp-clean-css": "^4.3.0", | ||
"htmlhint": "^1.1.4", | ||
"husky": "^8.0.1", | ||
"jest": "^28.1.3", | ||
"jest-environment-jsdom": "^28.1.3", | ||
"jest-environment-puppeteer": "^7.0.0", | ||
"minimist": "^1.2.6", | ||
"nunjucks": "^3.2.3", | ||
"prettier": "^2.7.1", | ||
"puppeteer": "^18.1.0", | ||
"sass": "^1.53.0", | ||
"start-server-and-test": "^1.14.0", | ||
"husky": "^9.0.11", | ||
"jest": "^29.7.0", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"jest-environment-puppeteer": "^10.0.1", | ||
"minimist": "^1.2.8", | ||
"nunjucks": "^3.2.4", | ||
"prettier": "^3.3.2", | ||
"puppeteer": "^22.12.1", | ||
"sass": "^1.77.6", | ||
"start-server-and-test": "^2.0.4", | ||
"stylelint": "^13.13.1", | ||
"stylelint-config-prettier": "^9.0.3", | ||
"stylelint-config-prettier": "^9.0.5", | ||
"stylelint-order": "^4.1.0", | ||
"stylelint-scss": "^3.19.0", | ||
"wait-on": "^6.0.1", | ||
"stylelint-scss": "^3.21.0", | ||
"wait-on": "^7.2.0", | ||
"webpack-stream": "^7.0.0" | ||
@@ -71,0 +74,0 @@ }, |
@@ -133,2 +133,27 @@ # Button | ||
### Button warning | ||
[Preview the button warning component](https://nhsuk.github.io/nhsuk-frontend/components/button/warning.html) | ||
#### HTML markup | ||
```html | ||
<button class="nhsuk-button nhsuk-button--warning" type="submit" data-module="nhsuk-button"> | ||
Delete account | ||
</button> | ||
``` | ||
#### Nunjucks macro | ||
``` | ||
{% from 'components/button/macro.njk' import button %} | ||
{{ button({ | ||
"text": "Yes, delete this vaccine", | ||
"classes": "nhsuk-button--warning" | ||
}) }} | ||
``` | ||
--- | ||
### Button with double click prevention | ||
@@ -135,0 +160,0 @@ |
@@ -28,3 +28,3 @@ # Footer | ||
<li class="nhsuk-footer__list-item nhsuk-footer-default__list-item"> | ||
<a class="nhsuk-footer__list-item-link" href="#">Contact us</a> | ||
<a class="nhsuk-footer__list-item-link" href="#">Give us feedback</a> | ||
</li> | ||
@@ -63,3 +63,3 @@ <li class="nhsuk-footer__list-item nhsuk-footer-default__list-item"> | ||
"URL": "#", | ||
"label": "Contact us" | ||
"label": "Give us feedback" | ||
}, | ||
@@ -139,5 +139,2 @@ { | ||
<li class="nhsuk-footer__list-item"> | ||
<a class="nhsuk-footer__list-item-link" href="/contact-us/">Contact us</a> | ||
</li> | ||
<li class="nhsuk-footer__list-item"> | ||
<a class="nhsuk-footer__list-item-link" href="/nhs-sites/">Other NHS websites</a> | ||
@@ -154,2 +151,5 @@ </li> | ||
<li class="nhsuk-footer__list-item"> | ||
<a class="nhsuk-footer__list-item-link" href="/contact-us/">Give us feedback</a> | ||
</li> | ||
<li class="nhsuk-footer__list-item"> | ||
<a class="nhsuk-footer__list-item-link" href="/accessibility-statement/">Accessibility statement</a> | ||
@@ -179,2 +179,3 @@ </li> | ||
{{ footer({ | ||
"copyright": "© Crown copyright", | ||
"links": [ | ||
@@ -243,6 +244,2 @@ { | ||
"URL": "#", | ||
"label": "Contact us" | ||
}, | ||
{ | ||
"URL": "#", | ||
"label": "Other NHS websites" | ||
@@ -262,2 +259,6 @@ }, | ||
"URL": "#", | ||
"label": "Give us feedback" | ||
}, | ||
{ | ||
"URL": "#", | ||
"label": "Accessibility statement" | ||
@@ -277,2 +278,72 @@ }, | ||
### Footer (custom copyright statement) | ||
[Preview the footer (custom copyright statement) component](https://nhsuk.github.io/nhsuk-frontend/components/footer/custom-copyright.html) | ||
#### HTML markup | ||
```html | ||
<footer role="contentinfo"> | ||
<div class="nhsuk-footer-container"> | ||
<div class="nhsuk-width-container"> | ||
<h2 class="nhsuk-u-visually-hidden">Support links</h2> | ||
<div class="nhsuk-footer"> | ||
<ul class="nhsuk-footer__list"> | ||
<li class="nhsuk-footer__list-item nhsuk-footer-default__list-item"> | ||
<a class="nhsuk-footer__list-item-link" href="#">Accessibility statement</a> | ||
</li> | ||
<li class="nhsuk-footer__list-item nhsuk-footer-default__list-item"> | ||
<a class="nhsuk-footer__list-item-link" href="#">Give us feedback</a> | ||
</li> | ||
<li class="nhsuk-footer__list-item nhsuk-footer-default__list-item"> | ||
<a class="nhsuk-footer__list-item-link" href="#">Cookies</a> | ||
</li> | ||
<li class="nhsuk-footer__list-item nhsuk-footer-default__list-item"> | ||
<a class="nhsuk-footer__list-item-link" href="#">Privacy policy</a> | ||
</li> | ||
<li class="nhsuk-footer__list-item nhsuk-footer-default__list-item"> | ||
<a class="nhsuk-footer__list-item-link" href="#">Terms and conditions</a> | ||
</li> | ||
</ul> | ||
<div> | ||
<p class="nhsuk-footer__copyright">© East London NHS Foundation Trust</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</footer> | ||
``` | ||
#### Nunjucks macro | ||
``` | ||
{% from 'components/footer/macro.njk' import footer %} | ||
{{ footer({ | ||
"copyright": "© East London NHS Foundation Trust", | ||
"links": [ | ||
{ | ||
"URL": "#", | ||
"label": "Accessibility statement" | ||
}, | ||
{ | ||
"URL": "#", | ||
"label": "Give us feedback" | ||
}, | ||
{ | ||
"URL": "#", | ||
"label": "Cookies" | ||
}, | ||
{ | ||
"URL": "#", | ||
"label": "Privacy policy" | ||
}, | ||
{ | ||
"URL": "#", | ||
"label": "Terms and conditions" | ||
} | ||
] | ||
})}} | ||
``` | ||
### Nunjucks arguments | ||
@@ -293,2 +364,3 @@ | ||
| **linksColumn3.[].label** | string | No | The label of a navigation item in the third column of the footer. | | ||
| **copyright** | string | No | Optional text for the copyright notice in the footer. Defaults to '© NHS England' | | ||
| **classes** | string | No | Optional additional classes to add to the footer container. Separate each class with a space. | | ||
@@ -295,0 +367,0 @@ | **attributes** | object | No | Any extra HTML attributes (for example data attributes) to add to the footer container. | |
@@ -773,24 +773,26 @@ # Header | ||
| Name | Type | Required | Description | | ||
| --------------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| **showNav** | boolean | Yes | Set to "true" to show the navigation links in the header. | | ||
| **showSearch** | boolean | Yes | Set to "true" to show the site search input form. | | ||
| **homeHref** | string | No | The href of the link for the logo and mobile home link in the navigation links. Defaults to "/". | | ||
| **ariaLabel** | string | No | Aria label for the logo href. Defaults to "NHS homepage". | | ||
| **organisation** | object | No | Settings for header with organisational logo. | | ||
| **organisation.name** | string | No | Organisation name value. | | ||
| **organisation.split** | string | No | Longer organisation names can be split onto multiple lines. | | ||
| **organisation.descriptor** | string | No | Organisation descriptor. | | ||
| **organisation.logoURL** | string | No | Organisation logo if using a static asset, such as PNG, is preferred. | | ||
| **primaryLinks** | array | No | Array of navigation links for use in the header. | | ||
| **primaryLinks[].url** | string | No | The href of a navigation item in the header. | | ||
| **primaryLinks[].label** | string | No | The label of a navigation item in the header. | | ||
| **transactional** | string | No | Set to "true" if this is a transactional header (with smaller logo). | | ||
| **transactionalService** | object | No | Object containing the _name_ and _href_ of the transactional service. | | ||
| **service** | object | No | Object containing the _name_ and optional boolean _longName_ of the service. Set this to "true" if the service name is longer than 22 characters. | | ||
| **classes** | string | No | Optional additional classes to add to the header container. Separate each class with a space. | | ||
| **attributes** | object | No | Any extra HTML attributes (for example data attributes) to add to the header container. | | ||
| **searchAction** | string | No | The search action endpoint. Defaults to "https://www.nhs.uk/search/" | | ||
| **searchInputName** | string | No | The name for the search field. Defaults to "q" | | ||
| Name | Type | Required | Description | | ||
| ----------------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| **showNav** | boolean | Yes | Set to "true" to show the navigation links in the header. | | ||
| **showSearch** | boolean | Yes | Set to "true" to show the site search input form. | | ||
| **homeHref** | string | No | The href of the link for the logo and mobile home link in the navigation links. Defaults to "/". | | ||
| **ariaLabel** | string | No | Aria label for the logo href. Defaults to "NHS homepage". | | ||
| **organisation** | object | No | Settings for header with organisational logo. | | ||
| **organisation.name** | string | No | Organisation name value. | | ||
| **organisation.split** | string | No | Longer organisation names can be split onto multiple lines. | | ||
| **organisation.descriptor** | string | No | Organisation descriptor. | | ||
| **organisation.logoURL** | string | No | Organisation logo if using a static asset, such as PNG, is preferred. | | ||
| **primaryLinks** | array | No | Array of navigation links for use in the header. | | ||
| **primaryLinks[].url** | string | No | The href of a navigation item in the header. | | ||
| **primaryLinks[].label** | string | No | The label of a navigation item in the header. | | ||
| **primaryLinks[].classes** | string | No | Optional additional classes to add to the list item. | | ||
| **primaryLinks[].attributes** | string | No | Any extra HTML attributes (for example data attributes) to add to the list item. | | ||
| **transactional** | string | No | Set to "true" if this is a transactional header (with smaller logo). | | ||
| **transactionalService** | object | No | Object containing the _name_ and _href_ of the transactional service. | | ||
| **service** | object | No | Object containing the _name_ and optional boolean _longName_ of the service. Set this to "true" if the service name is longer than 22 characters. | | ||
| **classes** | string | No | Optional additional classes to add to the header container. Separate each class with a space. | | ||
| **attributes** | object | No | Any extra HTML attributes (for example data attributes) to add to the header container. | | ||
| **searchAction** | string | No | The search action endpoint. Defaults to "https://www.nhs.uk/search/" | | ||
| **searchInputName** | string | No | The name for the search field. Defaults to "q" | | ||
If you are using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `html` can be a [security risk](https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting). Read more about this in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning). |
@@ -177,8 +177,2 @@ # Core | ||
### Remove top and bottom margins | ||
```html | ||
<h1 class="nhsuk-u-top-and-bottom"></h1> | ||
``` | ||
### Spacing overrides | ||
@@ -185,0 +179,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
995200
8163
228