hmrc-frontend 6.50.0 → 6.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["src/utils/breakpoints.js","src/components/account-menu/account-menu.js","src/components/back-link-helper/back-link-helper.js","src/utils/debounce.js","src/components/timeout-dialog/utils.js","src/components/timeout-dialog/dialog.js","src/components/timeout-dialog/validate-input.js","src/components/timeout-dialog/redirectHelper.js","src/components/timeout-dialog/timeout-dialog.js","src/components/user-research-banner/user-research-banner.js","src/utils/cookies.js","src/components/timeout-dialog/session-activity-service.js","src/components/hmrc-print-link/hmrc-print-link.js","src/all.js","src/all-govuk-and-hmrc.js"],"names":["breakpoints","xs","mobile","tablet","desktop","getCurrentBreakpoint","windowWidth","Object","keys","reduce","acc","curr","window","innerWidth","isSmall","element","AccountMenu","$module","this","document","querySelector","$moduleBottomMargin","style","marginBottom","$mainNav","$showNavLinkMobile","$currentBreakpoint","BackLinkHelper","prototype","init","setup","addEventListener","eventHandlers","showNavLinkMobileClick","bind","func","wait","immediate","timeout","_this","_len","arguments","length","theParams","Array","_key","context","callNow","clearTimeout","setTimeout","apply","debounce","reinstantiate","resizeEvent","newBreakpoint","target","event","preventDefault","classList","contains","hideMainNavMobile","currentTarget","showMainNavMobile","add","setAttribute","removeAttribute","remove","history","replaceState","location","href","back","warn","console","utils","generateDomElementFromString","str","abc","createElement","innerHTML","firstChild","generateDomElementFromStringAndAppendText","text","$tmp","innerText","hasClass","selector","className","addClass","querySelectorAll","forEach","i","removeClass","removeElement","$elem","parent","parentNode","removeChild","ajaxGet","url","success","xhr","XMLHttpRequest","open","onreadystatechange","readyState","status","responseText","setRequestHeader","send","dialog","displayDialog","$elementToDisplay","$dialog","$overlay","$preparedElementToDisplay","resetElementsFunctionList","closeCallbacks","appendChild","push","body","handleTouch","elements","join","close","shift","fn","value","getAttribute","keepFocus","modalFocus","getElementById","stopPropagation","focus","elemToFocusOnReset","activeElement","removeEventListener","setupFocusHandlerAndFocusDialog","keydownListener","e","keyCode","setupKeydownHandler","touches","changedTouches","closeDialog","setAriaLabelledBy","addCloseHandler","closeHandler","ValidateInput","RedirectHelper","TimeoutDialog","$sessionActivityService","currentTimer","options","settings","cleanupFunctions","sessionActivityService","listenForSessionActivityAndResetDialogTimer","synchroniseTabs","onActivity","timeOfActivity","timestamp","cleanup","setupDialogTimer","validateInput","config","missingRequiredConfig","item","concat","replace","toLowerCase","Error","mergeOptionsWithDefaults","theOptions","localisedDefaults","clone","_objectSpread","key","_typeof","undefined","timeOfLastActivity","getDateNow","signoutTime","delta","secondsUntilTimeoutDialog","countdown","setupDialog","$element","title","$countdownElement","$audibleMessage","$visualMessge","message","createTextNode","messageSuffix","$staySignedInButton","keepAliveButtonText","$wrapper","keepAliveAndClose","hideSignOutButton","$signOutButton","signOutButtonText","signOut","signOutUrl","dialogControl","getMillisecondsRemaining","getHumanText","counter","minutes","visibleMessage","properties","Math","ceil","roundSecondsUp","updateTextIfChanged","updateCountdown","audibleHumanText","humanText","messageParts","getAudibleHumanText","runUpdate","remaining","roundedRemaining","max","round","floor","keepAliveUrl","logActivity","Date","now","redirectToUrl","timeoutUrl","validate","lookupData","attributes","getNamedItem","string","minute","seconds","second","stringToValidate","parsedInt","parseInt","Number","isNaN","String","redirectHelper","UserResearchBanner","$closeLink","cookieName","cookieExpiryDays","name","nameEQ","cookies","cookie","split","len","charAt","substring","indexOf","decodeURIComponent","getCookie","noThanksClick","cookieString","days","date","setTime","getTime","toGMTString","protocol","setCookie","SessionActivityService","BrowserBroadcastChannel","_classCallCheck","activityChannel","_createClass","postMessage","callback","onmessage","data","HmrcPrintLink","print","HMRCFrontend","initAll","$AccountMenuSelector","$HmrcPrintLink","BroadcastChannel","$TimeoutDialog","$UserResearchBanner","$BackLink"],"mappings":"wvuCAEO,IAAMA,EAAc,CACzBC,GAAI,EACJC,OAAQ,IACRC,OAAQ,IACRC,QAAS,KAGJ,SAASC,EA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AChC6N,EAAS7N,EAAM+N,K,OAGpBR,CAAA,CAlBwC,GCA3C,SAASS,EAAcvQ,EAASL,GAC9BM,KAAKD,QAAUA,EACfC,KAAKN,OAASA,CAChB,CAEA4Q,EAAc5P,UAAUC,KAAO,WAAgB,IAAAU,EAAArB,KAC7CA,KAAKD,QAAQc,iBAAiB,SAAS,SAACyB,GACtCA,EAAMC,iBACNlB,EAAK3B,OAAO6Q,O,GAEhB,EC2BA,IAAAC,EAAe,CACbC,QA/BF,WACE,IAAMC,EAAuB,oCACzBzQ,SAASC,cAAcwQ,IACzB,IAAI5Q,EAAY4Q,GAAsB/P,OAGhBV,SAASsE,iBAAiB,oCAClCC,SAAQ,SAACmM,GACvB,IAAIL,EAAcK,EAAgBjR,QAAQiB,M,IAG5C,IAAM+H,EAAyB,IAAImH,EAAuBnQ,OAAOkR,kBACjElI,EAAuBuE,cAEvB,IAAM4D,EAAiB5Q,SAASC,cAAc,oCAC1C2Q,GACF,IAAIzI,EAAcyI,EAAgBnI,GAAwB/H,OAG5D,IAAMmQ,EAAsB7Q,SAASC,cAAc,6CAC/C4Q,GACF,IAAIzC,EAAmByC,GAAqBnQ,OAG3BV,SAASsE,iBAAiB,kCAClCC,SAAQ,SAACuM,GAClB,IAAItQ,EAAesQ,EAAWrR,OAAQO,UAAUU,M,GAEpD,EAIEb,cACAsI,gBACAiG,qBACA5N,mB,wyBCvCFgQ,GACAD,EAAaC,S","file":"../hmrc-frontend-6.52.0.min.js","sourcesContent":["// TODO\n// Retrieve breakpoints from Sass vars?\nexport const breakpoints = {\n xs: 0,\n mobile: 320,\n tablet: 641,\n desktop: 769,\n};\n\nexport function getCurrentBreakpoint(windowWidth) {\n const reducer = (acc, curr) => {\n const windowInsideBreakpoint = (windowWidth || window.innerWidth) >= breakpoints[curr];\n return windowInsideBreakpoint ? curr : acc;\n };\n return Object.keys(breakpoints).reduce(reducer);\n}\n","import { debounce } from '../../utils/debounce';\nimport { getCurrentBreakpoint } from '../../utils/breakpoints';\n\nconst isSmall = (element) => element.innerWidth <= 768;\n\nfunction AccountMenu($module) {\n this.$module = document.querySelector($module);\n this.$moduleBottomMargin = this.$module.style.marginBottom;\n this.$mainNav = this.$module.querySelector('.hmrc-account-menu__main');\n this.$showNavLinkMobile = this.$module.querySelector('.hmrc-account-menu__link--menu');\n this.$currentBreakpoint = getCurrentBreakpoint();\n}\n\nAccountMenu.prototype.init = function init() {\n this.setup();\n\n this.$showNavLinkMobile.addEventListener('click', this.eventHandlers.showNavLinkMobileClick.bind(this));\n\n window.addEventListener('resize', debounce(this.reinstantiate.bind(this)));\n};\n\nAccountMenu.prototype.reinstantiate = function reinstantiate(resizeEvent) {\n const newBreakpoint = getCurrentBreakpoint(resizeEvent.target.innerWidth);\n const hasCrossedBreakpoint = this.$currentBreakpoint !== newBreakpoint;\n if (hasCrossedBreakpoint) {\n this.$currentBreakpoint = newBreakpoint;\n this.setup();\n }\n};\n\nAccountMenu.prototype.eventHandlers = {\n showNavLinkMobileClick(event) {\n event.preventDefault();\n\n if (isSmall(window)) {\n if (this.$mainNav.classList.contains('main-nav-is-open')) {\n this.hideMainNavMobile(event.currentTarget);\n } else {\n this.showMainNavMobile();\n }\n }\n },\n};\n\nAccountMenu.prototype.setup = function setup() {\n if (isSmall(window)) {\n this.$module.classList.add('is-smaller');\n this.$showNavLinkMobile.setAttribute('aria-hidden', 'false');\n this.$showNavLinkMobile.removeAttribute('tabindex');\n this.$showNavLinkMobile.classList.remove('js-hidden');\n\n this.hideMainNavMobile(this.$showNavLinkMobile);\n } else {\n this.$module.classList.remove('is-smaller');\n this.$mainNav.classList.remove('main-nav-is-open', 'js-hidden');\n this.$showNavLinkMobile.setAttribute('aria-hidden', 'true');\n this.$showNavLinkMobile.setAttribute('tabindex', '-1');\n this.$showNavLinkMobile.classList.add('js-hidden');\n }\n};\n\nAccountMenu.prototype.showMainNavMobile = function showMainNavMobile() {\n // TODO: shall we add main-nav-is-open to `nav`????\n this.$mainNav.classList.remove('js-hidden');\n this.$mainNav.classList.add('main-nav-is-open');\n this.$mainNav.setAttribute('aria-expanded', 'true');\n\n this.$showNavLinkMobile.setAttribute('aria-expanded', 'true');\n this.$showNavLinkMobile.classList.add('hmrc-account-home--account--is-open');\n};\n\nAccountMenu.prototype.hideMainNavMobile = function hideMainNavMobile(element) {\n this.$mainNav.classList.remove('main-nav-is-open');\n this.$mainNav.setAttribute('aria-expanded', 'false');\n\n if (element.classList.contains('hmrc-account-menu__link--menu')) {\n this.$mainNav.classList.add('js-hidden');\n\n this.$showNavLinkMobile.setAttribute('aria-expanded', 'false');\n this.$showNavLinkMobile.classList.remove('hmrc-account-home--account--is-open');\n }\n};\n\nexport default AccountMenu;\n","function BackLinkHelper($module, window, document) {\n this.$module = $module;\n this.window = window;\n this.document = document;\n}\n\nBackLinkHelper.prototype.init = function init() {\n // do nothing if History API is absent\n if (this.window.history) {\n // prevent resubmit warning\n if (this.window.history.replaceState && typeof this.window.history.replaceState === 'function') {\n this.window.history.replaceState(null, null, this.window.location.href);\n }\n\n this.$module.addEventListener('click', (event) => {\n event.preventDefault();\n if (this.window.history.back && typeof this.window.history.back === 'function') {\n this.window.history.back();\n }\n });\n }\n};\n\nexport default BackLinkHelper;\n","// Returns a function, that, as long as it continues to be invoked, will not\n// be triggered. The function will be called after it stops being called for\n// N milliseconds. If `immediate` is passed, trigger the function on the\n// leading edge, instead of the trailing.\n\n// eslint-disable-next-line import/prefer-default-export\nexport function debounce(func, wait, immediate) {\n let timeout;\n\n return (...theParams) => {\n const context = this;\n\n const later = () => {\n timeout = null;\n if (!immediate) func.apply(context, theParams);\n };\n\n const callNow = immediate && !timeout;\n\n clearTimeout(timeout);\n\n timeout = setTimeout(later, wait);\n\n if (callNow) func.apply(context, theParams);\n };\n}\n","const { warn } = console;\n\nconst utils = {\n generateDomElementFromString(str) {\n const abc = document.createElement('div');\n abc.innerHTML = str;\n return abc.firstChild;\n },\n\n generateDomElementFromStringAndAppendText(str, text) {\n const $tmp = utils.generateDomElementFromString(str);\n $tmp.innerText = text;\n return $tmp;\n },\n\n hasClass(selector, className) {\n return document.querySelector(selector).classList.contains(className);\n },\n\n addClass(selector, className) {\n const elements = document.querySelectorAll(selector);\n elements.forEach((i) => { i.classList.add(className); });\n },\n\n removeClass(selector, className) {\n const elements = document.querySelectorAll(selector);\n elements.forEach((i) => { i.classList.remove(className); });\n },\n\n removeElement($elem) {\n const parent = $elem.parentNode;\n if (parent) {\n parent.removeChild($elem);\n } else {\n warn(\"couldn't find parent for elem\", $elem);\n }\n },\n\n ajaxGet(url, success) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url);\n xhr.onreadystatechange = () => {\n if (xhr.readyState > 3 && xhr.status === 200) success(xhr.responseText);\n };\n xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n xhr.send();\n return xhr;\n },\n};\n\nexport default utils;\n","import utils from './utils';\n\nfunction displayDialog($elementToDisplay) {\n const $dialog = utils.generateDomElementFromString('<div id=\"hmrc-timeout-dialog\" tabindex=\"-1\" role=\"dialog\" aria-modal=\"true\" class=\"hmrc-timeout-dialog\">');\n const $overlay = utils.generateDomElementFromString('<div id=\"hmrc-timeout-overlay\" class=\"hmrc-timeout-overlay\">');\n const $preparedElementToDisplay = typeof $elementToDisplay === 'string' ? utils.generateDomElementFromString($elementToDisplay) : $elementToDisplay;\n const resetElementsFunctionList = [];\n const closeCallbacks = [];\n\n $dialog.appendChild($preparedElementToDisplay);\n\n if (!utils.hasClass('html', 'noScroll')) {\n utils.addClass('html', 'noScroll');\n resetElementsFunctionList.push(() => {\n utils.removeClass('html', 'noScroll');\n });\n }\n document.body.appendChild($dialog);\n document.body.appendChild($overlay);\n\n resetElementsFunctionList.push(() => {\n utils.removeElement($dialog);\n utils.removeElement($overlay);\n });\n\n const setupFocusHandlerAndFocusDialog = () => {\n function keepFocus(event) {\n const modalFocus = document.getElementById('hmrc-timeout-dialog');\n if (modalFocus) {\n if (event.target !== modalFocus && !modalFocus.contains(event.target)) {\n event.stopPropagation();\n modalFocus.focus();\n }\n }\n }\n\n const elemToFocusOnReset = document.activeElement;\n $dialog.focus();\n\n document.addEventListener('focus', keepFocus, true);\n\n resetElementsFunctionList.push(() => {\n document.removeEventListener('focus', keepFocus);\n elemToFocusOnReset.focus();\n });\n };\n\n // disable the non-dialog page to prevent confusion for VoiceOver users\n const selectors = [\n '#skiplink-container',\n 'body > header',\n '#global-cookie-message',\n 'main',\n 'body > footer',\n 'body > .govuk-skip-link',\n '.cbanner-govuk-cookie-banner',\n 'body > .govuk-width-container',\n ];\n const elements = document.querySelectorAll(selectors.join(', '));\n const close = () => {\n while (resetElementsFunctionList.length > 0) {\n const fn = resetElementsFunctionList.shift();\n fn();\n }\n };\n const closeAndInform = () => {\n closeCallbacks.forEach((fn) => { fn(); });\n close();\n };\n const setupKeydownHandler = () => {\n function keydownListener(e) {\n if (e.keyCode === 27) {\n closeAndInform();\n }\n }\n\n document.addEventListener('keydown', keydownListener);\n\n resetElementsFunctionList.push(() => {\n document.removeEventListener('keydown', keydownListener);\n });\n };\n const preventMobileScrollWhileAllowingPinchZoom = () => {\n const handleTouch = (e) => {\n const touches = e.touches || e.changedTouches || [];\n\n if (touches.length === 1) {\n e.preventDefault();\n }\n };\n\n document.addEventListener('touchmove', handleTouch, true);\n\n resetElementsFunctionList.push(() => {\n document.removeEventListener('touchmove', handleTouch, true);\n });\n };\n\n elements.forEach(($elem) => {\n const value = $elem.getAttribute('aria-hidden');\n $elem.setAttribute('aria-hidden', 'true');\n resetElementsFunctionList.push(() => {\n if (value) {\n $elem.setAttribute('aria-hidden', value);\n } else {\n $elem.removeAttribute('aria-hidden');\n }\n });\n });\n\n //\n setupFocusHandlerAndFocusDialog();\n\n setupKeydownHandler();\n\n preventMobileScrollWhileAllowingPinchZoom();\n\n return {\n closeDialog() {\n close();\n },\n setAriaLabelledBy(value) {\n if (value) {\n $dialog.setAttribute('aria-labelledby', value);\n } else {\n $dialog.removeAttribute('aria-labelledby');\n }\n },\n addCloseHandler(closeHandler) {\n closeCallbacks.push(closeHandler);\n },\n };\n}\n\nexport default { displayDialog };\n","function ValidateInput() {\n}\n\nValidateInput.int = (stringToValidate) => {\n const parsedInt = parseInt(stringToValidate, 10);\n return Number.isNaN(parsedInt) ? undefined : parsedInt;\n};\n\nValidateInput.string = (stringToValidate) => (typeof stringToValidate === 'string' ? stringToValidate : undefined);\n\nValidateInput.boolean = (stringToValidate) => String(stringToValidate).toLowerCase() === 'true';\n\nexport default ValidateInput;\n","function RedirectHelper() {}\n\nRedirectHelper.redirectToUrl = (url) => {\n // This exists to make redirects more testable\n window.location.href = url;\n};\n\nexport default RedirectHelper;\n","import dialog from './dialog';\nimport ValidateInput from './validate-input';\nimport RedirectHelper from './redirectHelper';\nimport utils from './utils';\n\n// TODO: rewrite this to follow govuk-frontend prototype module pattern\n\nfunction TimeoutDialog($module, $sessionActivityService) {\n let options = {};\n let settings = {};\n const cleanupFunctions = [];\n let currentTimer;\n const sessionActivityService = $sessionActivityService;\n\n function init() {\n const validate = ValidateInput;\n\n function lookupData(key) {\n return ($module.attributes.getNamedItem(key) || {}).value;\n }\n\n const localisedDefaults = validate.string(lookupData('data-language')) === 'cy' ? {\n title: 'Rydych ar fin cael eich allgofnodi',\n message: 'Er eich diogelwch, byddwn yn eich allgofnodi cyn pen',\n keepAliveButtonText: 'Parhau i fod wedi’ch mewngofnodi',\n signOutButtonText: 'Allgofnodi',\n properties: {\n minutes: 'funud',\n minute: 'funud',\n seconds: 'eiliad',\n second: 'eiliad',\n },\n } : {\n title: 'You’re about to be signed out',\n message: 'For your security, we will sign you out in',\n keepAliveButtonText: 'Stay signed in',\n signOutButtonText: 'Sign out',\n properties: {\n minutes: 'minutes',\n minute: 'minute',\n seconds: 'seconds',\n second: 'second',\n },\n };\n\n options = {\n timeout: validate.int(lookupData('data-timeout')),\n countdown: validate.int(lookupData('data-countdown')),\n keepAliveUrl: validate.string(lookupData('data-keep-alive-url')),\n signOutUrl: validate.string(lookupData('data-sign-out-url')),\n timeoutUrl: validate.string(lookupData('data-timeout-url')),\n title: validate.string(lookupData('data-title')),\n message: validate.string(lookupData('data-message')),\n messageSuffix: validate.string(lookupData('data-message-suffix')),\n keepAliveButtonText: validate.string(\n lookupData('data-keep-alive-button-text'),\n ),\n signOutButtonText: validate.string(\n lookupData('data-sign-out-button-text'),\n ),\n synchroniseTabs: validate.boolean(\n lookupData('data-synchronise-tabs') || false,\n ),\n hideSignOutButton: validate.boolean(\n lookupData('data-hide-sign-out-button') || false,\n ),\n };\n\n // Default timeoutUrl to signOutUrl if not set\n options.timeoutUrl = options.timeoutUrl || options.signOutUrl;\n\n validateInput(options);\n settings = mergeOptionsWithDefaults(options, localisedDefaults);\n setupDialogTimer();\n listenForSessionActivityAndResetDialogTimer();\n }\n\n const broadcastSessionActivity = () => {\n sessionActivityService.logActivity();\n };\n\n const listenForSessionActivityAndResetDialogTimer = () => {\n if (settings.synchroniseTabs) {\n sessionActivityService.onActivity((event) => {\n const timeOfActivity = event.timestamp;\n cleanup();\n setupDialogTimer(timeOfActivity);\n });\n }\n };\n\n const validateInput = (config) => {\n const requiredConfig = ['timeout', 'countdown', 'keepAliveUrl', 'signOutUrl'];\n const missingRequiredConfig = [];\n\n requiredConfig.forEach((item) => {\n if (!config[item]) {\n missingRequiredConfig.push(`data-${item.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()}`);\n }\n });\n\n if (missingRequiredConfig.length > 0) {\n throw new Error(\n `Missing config item(s): [${missingRequiredConfig.join(', ')}]`,\n );\n }\n };\n\n const mergeOptionsWithDefaults = (theOptions, localisedDefaults) => {\n const clone = { ...theOptions };\n\n Object.keys(localisedDefaults).forEach((key) => {\n if (typeof clone[key] === 'object') {\n clone[key] = mergeOptionsWithDefaults(\n theOptions[key],\n localisedDefaults[key],\n );\n }\n if (clone[key] === undefined || clone[key] === '') {\n clone[key] = localisedDefaults[key];\n }\n });\n\n return clone;\n };\n\n const setupDialogTimer = (timeOfLastActivity = getDateNow()) => {\n const signoutTime = timeOfLastActivity + settings.timeout * 1000;\n\n const delta = getDateNow() - timeOfLastActivity;\n const secondsUntilTimeoutDialog = settings.timeout - settings.countdown;\n const timeout = window.setTimeout(() => {\n setupDialog(signoutTime);\n }, (secondsUntilTimeoutDialog * 1000) - delta);\n\n cleanupFunctions.push(() => {\n window.clearTimeout(timeout);\n if (currentTimer) {\n window.clearTimeout(currentTimer);\n }\n });\n };\n\n const setupDialog = (signoutTime) => {\n const $element = utils.generateDomElementFromString('<div>');\n\n if (settings.title) {\n const $tmp = utils.generateDomElementFromStringAndAppendText(\n '<h1 id=\"hmrc-timeout-heading\" class=\"govuk-heading-m push--top\">',\n settings.title,\n );\n $element.appendChild($tmp);\n }\n\n const $countdownElement = utils.generateDomElementFromString(\n '<span id=\"hmrc-timeout-countdown\" class=\"hmrc-timeout-dialog__countdown\">',\n );\n\n const $audibleMessage = utils.generateDomElementFromString('<p id=\"hmrc-timeout-message\" class=\"govuk-visually-hidden screenreader-content\" aria-live=\"assertive\">');\n const $visualMessge = utils.generateDomElementFromStringAndAppendText(\n '<p class=\"govuk-body hmrc-timeout-dialog__message\" aria-hidden=\"true\">',\n settings.message,\n );\n $visualMessge.appendChild(document.createTextNode(' '));\n $visualMessge.appendChild($countdownElement);\n $visualMessge.appendChild(document.createTextNode('.'));\n if (settings.messageSuffix) {\n $visualMessge.appendChild(document.createTextNode(` ${settings.messageSuffix}`));\n }\n\n const $staySignedInButton = utils.generateDomElementFromStringAndAppendText(\n '<button id=\"hmrc-timeout-keep-signin-btn\" class=\"govuk-button\">',\n settings.keepAliveButtonText,\n );\n\n const $wrapper = document.createElement('div');\n $wrapper.classList.add('govuk-button-group');\n $wrapper.appendChild($staySignedInButton);\n\n $element.appendChild($visualMessge);\n $element.appendChild($audibleMessage);\n $staySignedInButton.addEventListener('click', keepAliveAndClose);\n $element.appendChild(document.createTextNode(' '));\n\n if (!settings.hideSignOutButton) {\n const $signOutButton = utils.generateDomElementFromStringAndAppendText(\n '<a id=\"hmrc-timeout-sign-out-link\" class=\"govuk-link hmrc-timeout-dialog__link\">',\n settings.signOutButtonText,\n );\n $signOutButton.addEventListener('click', signOut);\n $signOutButton.setAttribute('href', settings.signOutUrl);\n\n $wrapper.appendChild($signOutButton);\n }\n\n $element.appendChild($wrapper);\n\n const dialogControl = dialog.displayDialog($element);\n\n cleanupFunctions.push(() => {\n dialogControl.closeDialog();\n });\n\n dialogControl.addCloseHandler(keepAliveAndClose);\n\n dialogControl.setAriaLabelledBy('hmrc-timeout-heading hmrc-timeout-message');\n\n const getMillisecondsRemaining = () => signoutTime - getDateNow();\n const getSecondsRemaining = () => Math.round(getMillisecondsRemaining() / 1000);\n\n const getHumanText = (counter) => {\n let minutes; let\n visibleMessage;\n if (counter < 60) {\n visibleMessage = `${counter} ${settings.properties[counter !== 1 ? 'seconds' : 'second']}`;\n } else {\n minutes = Math.ceil(counter / 60);\n visibleMessage = `${minutes} ${settings.properties[minutes === 1 ? 'minute' : 'minutes']}`;\n }\n return visibleMessage;\n };\n\n const getAudibleHumanText = (counter) => {\n const humanText = getHumanText(roundSecondsUp(counter));\n const messageParts = [settings.message, ' ', humanText, '.'];\n if (settings.messageSuffix) {\n messageParts.push(' ');\n messageParts.push(settings.messageSuffix);\n }\n return messageParts.join('');\n };\n\n const roundSecondsUp = (counter) => {\n if (counter > 60) {\n return counter;\n } if (counter < 20) {\n return 20;\n }\n return Math.ceil(counter / 20) * 20;\n };\n\n const updateTextIfChanged = ($elem, text) => {\n if ($elem.innerText !== text) {\n // eslint-disable-next-line no-param-reassign\n $elem.innerText = text;\n }\n };\n\n const updateCountdown = (counter) => {\n const visibleMessage = getHumanText(counter);\n const audibleHumanText = getAudibleHumanText(counter);\n\n updateTextIfChanged($countdownElement, visibleMessage);\n updateTextIfChanged($audibleMessage, audibleHumanText);\n };\n\n const getNextTimeout = () => {\n const remaining = getMillisecondsRemaining();\n const roundedRemaining = Math.floor(getMillisecondsRemaining() / 1000) * 1000;\n if (roundedRemaining <= 60000) {\n return (remaining - roundedRemaining) || 1000;\n }\n return remaining - (roundedRemaining - (roundedRemaining % 60000 || 60000));\n };\n\n const runUpdate = () => {\n const counter = Math.max(getSecondsRemaining(), 0);\n updateCountdown(counter);\n if (counter === 0) {\n timeout();\n } else {\n currentTimer = window.setTimeout(runUpdate, getNextTimeout());\n }\n };\n\n runUpdate();\n };\n\n const keepAliveAndClose = () => {\n cleanup();\n setupDialogTimer();\n utils.ajaxGet(settings.keepAliveUrl, () => {});\n broadcastSessionActivity();\n };\n\n const getDateNow = () => Date.now();\n\n const signOut = () => {\n RedirectHelper.redirectToUrl(settings.signOutUrl);\n };\n\n const timeout = () => {\n RedirectHelper.redirectToUrl(settings.timeoutUrl);\n };\n\n const cleanup = () => {\n while (cleanupFunctions.length > 0) {\n const fn = cleanupFunctions.shift();\n fn();\n }\n };\n\n return { init, cleanup };\n}\n\nTimeoutDialog.dialog = dialog;\nTimeoutDialog.redirectHelper = RedirectHelper;\nTimeoutDialog.utils = utils;\n\nexport default TimeoutDialog;\n","import { getCookie, setCookie } from '../../utils/cookies';\n\nfunction UserResearchBanner($module) {\n this.$module = $module;\n this.$closeLink = this.$module.querySelector('.hmrc-user-research-banner__close');\n this.cookieName = 'mdtpurr';\n this.cookieExpiryDays = 28;\n}\n\nUserResearchBanner.prototype.init = function init() {\n const cookieData = getCookie(this.cookieName);\n\n if (cookieData == null) {\n this.$module.classList.add('hmrc-user-research-banner--show');\n this.$closeLink.addEventListener('click', this.eventHandlers.noThanksClick.bind(this));\n }\n};\n\nUserResearchBanner.prototype.eventHandlers = {\n noThanksClick(event) {\n event.preventDefault();\n\n setCookie(this.cookieName, 'suppress_for_all_services', { days: this.cookieExpiryDays });\n this.$module.classList.remove('hmrc-user-research-banner--show');\n },\n};\n\nexport default UserResearchBanner;\n","// Based on https://github.com/alphagov/govuk_template_jinja\nexport const setCookie = (name, value, options = {}) => {\n let cookieString = `${name}=${value}; path=/`;\n if (options.days) {\n const date = new Date();\n date.setTime(date.getTime() + (options.days * 24 * 60 * 60 * 1000));\n cookieString = `${cookieString}; expires=${date.toGMTString()}`;\n }\n if (window.location.protocol === 'https:') {\n cookieString += '; Secure';\n }\n document.cookie = cookieString;\n\n return cookieString;\n};\n\nexport const getCookie = (name) => {\n const nameEQ = `${name}=`;\n const cookies = document.cookie.split(';');\n for (let i = 0, len = cookies.length; i < len; i += 1) {\n let cookie = cookies[i];\n while (cookie.charAt(0) === ' ') {\n cookie = cookie.substring(1, cookie.length);\n }\n if (cookie.indexOf(nameEQ) === 0) {\n return decodeURIComponent(cookie.substring(nameEQ.length));\n }\n }\n return null;\n};\n","export default class SessionActivityService {\n constructor(BrowserBroadcastChannel) {\n this.activityChannel = BrowserBroadcastChannel && new BrowserBroadcastChannel('session-activity');\n }\n\n logActivity() {\n if (this.activityChannel) {\n const event = { timestamp: Date.now() };\n this.activityChannel.postMessage(event);\n }\n }\n\n onActivity(callback) {\n if (this.activityChannel) {\n this.activityChannel.onmessage = (event) => {\n callback(event.data);\n };\n }\n }\n}\n","function HmrcPrintLink($module, window) {\n this.$module = $module;\n this.window = window;\n}\n\nHmrcPrintLink.prototype.init = function init() {\n this.$module.addEventListener('click', (event) => {\n event.preventDefault();\n this.window.print();\n });\n};\n\nexport default HmrcPrintLink;\n","import AccountMenu from './components/account-menu/account-menu';\nimport BackLinkHelper from './components/back-link-helper/back-link-helper';\nimport TimeoutDialog from './components/timeout-dialog/timeout-dialog';\nimport UserResearchBanner from './components/user-research-banner/user-research-banner';\nimport SessionActivityService from './components/timeout-dialog/session-activity-service';\nimport HmrcPrintLink from './components/hmrc-print-link/hmrc-print-link';\n\nfunction initAll() {\n const $AccountMenuSelector = '[data-module=\"hmrc-account-menu\"]';\n if (document.querySelector($AccountMenuSelector)) {\n new AccountMenu($AccountMenuSelector).init();\n }\n\n const $HmrcPrintLinks = document.querySelectorAll('a[data-module=\"hmrc-print-link\"]');\n $HmrcPrintLinks.forEach(($HmrcPrintLink) => {\n new HmrcPrintLink($HmrcPrintLink, window).init();\n });\n\n const sessionActivityService = new SessionActivityService(window.BroadcastChannel);\n sessionActivityService.logActivity();\n\n const $TimeoutDialog = document.querySelector('meta[name=\"hmrc-timeout-dialog\"]');\n if ($TimeoutDialog) {\n new TimeoutDialog($TimeoutDialog, sessionActivityService).init();\n }\n\n const $UserResearchBanner = document.querySelector('[data-module=\"hmrc-user-research-banner\"]');\n if ($UserResearchBanner) {\n new UserResearchBanner($UserResearchBanner).init();\n }\n\n const $BackLinks = document.querySelectorAll('[data-module=\"hmrc-back-link\"]');\n $BackLinks.forEach(($BackLink) => {\n new BackLinkHelper($BackLink, window, document).init();\n });\n}\n\nexport default {\n initAll,\n AccountMenu,\n TimeoutDialog,\n UserResearchBanner,\n BackLinkHelper,\n\n};\n","import { initAll } from 'govuk-frontend/dist/govuk/govuk-frontend.min';\nimport HMRCFrontend from './all';\n\ninitAll();\nHMRCFrontend.initAll();\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hmrc-frontend",
3
- "version": "6.50.0",
3
+ "version": "6.52.0",
4
4
  "description": "Design patterns for HMRC frontends",
5
5
  "scripts": {},
6
6
  "repository": {
@@ -23,6 +23,6 @@
23
23
  "homepage": "https://github.com/hmrc/hmrc-frontend#readme",
24
24
  "dependencies": {
25
25
  "accessible-autocomplete": "^3.0.1",
26
- "govuk-frontend": "^5.7.1"
26
+ "govuk-frontend": "^5.8.0"
27
27
  }
28
28
  }
@@ -1,3 +0,0 @@
1
- !function(){"use strict";function t(t,e){const i=t?t.trim():"";let n,s=null==e?void 0:e.type;switch(s||(["true","false"].includes(i)&&(s="boolean"),i.length>0&&isFinite(Number(i))&&(s="number")),s){case"boolean":n="true"===i;break;case"number":n=Number(i);break;default:n=t}return n}function e(...t){const i={};for(const n of t)for(const t of Object.keys(n)){const s=i[t],o=n[t];a(s)&&a(o)?i[t]=e(s,o):i[t]=o}return i}function i(e,i,n){const s=e.schema.properties[n];if("object"!==(null==s?void 0:s.type))return;const o={[n]:{}};for(const[e,s]of Object.entries(i)){let i=o;const r=e.split(".");for(const[o,c]of r.entries())"object"==typeof i&&(o<r.length-1?(a(i[c])||(i[c]={}),i=i[c]):e!==n&&(i[c]=t(s)))}return o[n]}function n(t){if(t.includes("#"))return t.split("#").pop()}function s(t){const e=`--govuk-frontend-breakpoint-${t}`;return{property:e,value:window.getComputedStyle(document.documentElement).getPropertyValue(e)||void 0}}function o(t,e={}){var i;const n=t.getAttribute("tabindex");function s(){var i;null==(i=e.onBlur)||i.call(t),n||t.removeAttribute("tabindex")}n||t.setAttribute("tabindex","-1"),t.addEventListener("focus",(function(){t.addEventListener("blur",s,{once:!0})}),{once:!0}),null==(i=e.onBeforeFocus)||i.call(t),t.focus()}function r(t=document.body){return!!t&&t.classList.contains("govuk-frontend-supported")}function a(t){return!!t&&"object"==typeof t&&!function(t){return Array.isArray(t)}(t)}function c(t,e){return`${t.moduleName}: ${e}`}function u(e,n){const s={};for(const[o,r]of Object.entries(e.schema.properties))o in n&&(s[o]=t(n[o],r)),"object"===(null==r?void 0:r.type)&&(s[o]=i(e,n,o));return s}class l extends Error{constructor(...t){super(...t),this.name="GOVUKFrontendError"}}class h extends l{constructor(t=document.body){const e="noModule"in HTMLScriptElement.prototype?'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet':"GOV.UK Frontend is not supported in this browser";super(t?e:'GOV.UK Frontend initialised without `<script type="module">`'),this.name="SupportError"}}class d extends l{constructor(...t){super(...t),this.name="ConfigError"}}class m extends l{constructor(t){let e="string"==typeof t?t:"";if("object"==typeof t){const{component:i,identifier:n,element:s,expectedType:o}=t;e=n,e+=s?` is not of type ${null!=o?o:"HTMLElement"}`:" not found",e=c(i,e)}super(e),this.name="ElementError"}}class p extends l{constructor(t){super("string"==typeof t?t:c(t,"Root element (`$root`) already initialised")),this.name="InitError"}}class g{get $root(){return this._$root}constructor(t){this._$root=void 0;const e=this.constructor;if("string"!=typeof e.moduleName)throw new p("`moduleName` not defined in component");if(!(t instanceof e.elementType))throw new m({element:t,component:e,identifier:"Root element (`$root`)",expectedType:e.elementType.name});this._$root=t,e.checkSupport(),this.checkInitialised();const i=e.moduleName;this.$root.setAttribute(`data-${i}-init`,"")}checkInitialised(){const t=this.constructor,e=t.moduleName;if(e&&function(t,e){return t instanceof HTMLElement&&t.hasAttribute(`data-${e}-init`)}(this.$root,e))throw new p(t)}static checkSupport(){if(!r())throw new h}}g.elementType=HTMLElement;class f{constructor(t={},e={}){var i;this.translations=void 0,this.locale=void 0,this.translations=t,this.locale=null!=(i=e.locale)?i:document.documentElement.lang||"en"}t(t,e){if(!t)throw new Error("i18n: lookup key missing");let i=this.translations[t];if("number"==typeof(null==e?void 0:e.count)&&"object"==typeof i){const n=i[this.getPluralSuffix(t,e.count)];n&&(i=n)}if("string"==typeof i){if(i.match(/%{(.\S+)}/)){if(!e)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(i,e)}return i}return t}replacePlaceholders(t,e){const i=Intl.NumberFormat.supportedLocalesOf(this.locale).length?new Intl.NumberFormat(this.locale):void 0;return t.replace(/%{(.\S+)}/g,(function(t,n){if(Object.prototype.hasOwnProperty.call(e,n)){const t=e[n];return!1===t||"number"!=typeof t&&"string"!=typeof t?"":"number"==typeof t?i?i.format(t):`${t}`:t}throw new Error(`i18n: no data found to replace ${t} placeholder in string`)}))}hasIntlPluralRulesSupport(){return Boolean("PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)}getPluralSuffix(t,e){if(e=Number(e),!isFinite(e))return"other";const i=this.translations[t],n=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(e):this.selectPluralFormUsingFallbackRules(e);if("object"==typeof i){if(n in i)return n;if("other"in i)return console.warn(`i18n: Missing plural form ".${n}" for "${this.locale}" locale. Falling back to ".other".`),"other"}throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`)}selectPluralFormUsingFallbackRules(t){t=Math.abs(Math.floor(t));const e=this.getPluralRulesForLocale();return e?f.pluralRules[e](t):"other"}getPluralRulesForLocale(){const t=this.locale.split("-")[0];for(const e in f.pluralRulesMap){const i=f.pluralRulesMap[e];if(i.includes(this.locale)||i.includes(t))return e}}}f.pluralRulesMap={arabic:["ar"],chinese:["my","zh","id","ja","jv","ko","ms","th","vi"],french:["hy","bn","fr","gu","hi","fa","pa","zu"],german:["af","sq","az","eu","bg","ca","da","nl","en","et","fi","ka","de","el","hu","lb","no","so","sw","sv","ta","te","tr","ur"],irish:["ga"],russian:["ru","uk"],scottish:["gd"],spanish:["pt-PT","it","es"],welsh:["cy"]},f.pluralRules={arabic:t=>0===t?"zero":1===t?"one":2===t?"two":t%100>=3&&t%100<=10?"few":t%100>=11&&t%100<=99?"many":"other",chinese:()=>"other",french:t=>0===t||1===t?"one":"other",german:t=>1===t?"one":"other",irish:t=>1===t?"one":2===t?"two":t>=3&&t<=6?"few":t>=7&&t<=10?"many":"other",russian(t){const e=t%100,i=e%10;return 1===i&&11!==e?"one":i>=2&&i<=4&&!(e>=12&&e<=14)?"few":0===i||i>=5&&i<=9||e>=11&&e<=14?"many":"other"},scottish:t=>1===t||11===t?"one":2===t||12===t?"two":t>=3&&t<=10||t>=13&&t<=19?"few":"other",spanish:t=>1===t?"one":t%1e6==0&&0!==t?"many":"other",welsh:t=>0===t?"zero":1===t?"one":2===t?"two":3===t?"few":6===t?"many":"other"};class v extends g{constructor(t,i={}){super(t),this.config=void 0,this.i18n=void 0,this.controlsClass="govuk-accordion__controls",this.showAllClass="govuk-accordion__show-all",this.showAllTextClass="govuk-accordion__show-all-text",this.sectionClass="govuk-accordion__section",this.sectionExpandedClass="govuk-accordion__section--expanded",this.sectionButtonClass="govuk-accordion__section-button",this.sectionHeaderClass="govuk-accordion__section-header",this.sectionHeadingClass="govuk-accordion__section-heading",this.sectionHeadingDividerClass="govuk-accordion__section-heading-divider",this.sectionHeadingTextClass="govuk-accordion__section-heading-text",this.sectionHeadingTextFocusClass="govuk-accordion__section-heading-text-focus",this.sectionShowHideToggleClass="govuk-accordion__section-toggle",this.sectionShowHideToggleFocusClass="govuk-accordion__section-toggle-focus",this.sectionShowHideTextClass="govuk-accordion__section-toggle-text",this.upChevronIconClass="govuk-accordion-nav__chevron",this.downChevronIconClass="govuk-accordion-nav__chevron--down",this.sectionSummaryClass="govuk-accordion__section-summary",this.sectionSummaryFocusClass="govuk-accordion__section-summary-focus",this.sectionContentClass="govuk-accordion__section-content",this.$sections=void 0,this.$showAllButton=null,this.$showAllIcon=null,this.$showAllText=null,this.config=e(v.defaults,i,u(v,this.$root.dataset)),this.i18n=new f(this.config.i18n);const n=this.$root.querySelectorAll(`.${this.sectionClass}`);if(!n.length)throw new m({component:v,identifier:`Sections (\`<div class="${this.sectionClass}">\`)`});this.$sections=n,this.initControls(),this.initSectionHeaders(),this.updateShowAllButton(this.areAllSectionsOpen())}initControls(){this.$showAllButton=document.createElement("button"),this.$showAllButton.setAttribute("type","button"),this.$showAllButton.setAttribute("class",this.showAllClass),this.$showAllButton.setAttribute("aria-expanded","false"),this.$showAllIcon=document.createElement("span"),this.$showAllIcon.classList.add(this.upChevronIconClass),this.$showAllButton.appendChild(this.$showAllIcon);const t=document.createElement("div");t.setAttribute("class",this.controlsClass),t.appendChild(this.$showAllButton),this.$root.insertBefore(t,this.$root.firstChild),this.$showAllText=document.createElement("span"),this.$showAllText.classList.add(this.showAllTextClass),this.$showAllButton.appendChild(this.$showAllText),this.$showAllButton.addEventListener("click",(()=>this.onShowOrHideAllToggle())),"onbeforematch"in document&&document.addEventListener("beforematch",(t=>this.onBeforeMatch(t)))}initSectionHeaders(){this.$sections.forEach(((t,e)=>{const i=t.querySelector(`.${this.sectionHeaderClass}`);if(!i)throw new m({component:v,identifier:`Section headers (\`<div class="${this.sectionHeaderClass}">\`)`});this.constructHeaderMarkup(i,e),this.setExpanded(this.isExpanded(t),t),i.addEventListener("click",(()=>this.onSectionToggle(t))),this.setInitialState(t)}))}constructHeaderMarkup(t,e){const i=t.querySelector(`.${this.sectionButtonClass}`),n=t.querySelector(`.${this.sectionHeadingClass}`),s=t.querySelector(`.${this.sectionSummaryClass}`);if(!n)throw new m({component:v,identifier:`Section heading (\`.${this.sectionHeadingClass}\`)`});if(!i)throw new m({component:v,identifier:`Section button placeholder (\`<span class="${this.sectionButtonClass}">\`)`});const o=document.createElement("button");o.setAttribute("type","button"),o.setAttribute("aria-controls",`${this.$root.id}-content-${e+1}`);for(const t of Array.from(i.attributes))"id"!==t.name&&o.setAttribute(t.name,t.value);const r=document.createElement("span");r.classList.add(this.sectionHeadingTextClass),r.id=i.id;const a=document.createElement("span");a.classList.add(this.sectionHeadingTextFocusClass),r.appendChild(a),Array.from(i.childNodes).forEach((t=>a.appendChild(t)));const c=document.createElement("span");c.classList.add(this.sectionShowHideToggleClass),c.setAttribute("data-nosnippet","");const u=document.createElement("span");u.classList.add(this.sectionShowHideToggleFocusClass),c.appendChild(u);const l=document.createElement("span"),h=document.createElement("span");if(h.classList.add(this.upChevronIconClass),u.appendChild(h),l.classList.add(this.sectionShowHideTextClass),u.appendChild(l),o.appendChild(r),o.appendChild(this.getButtonPunctuationEl()),s){const t=document.createElement("span"),e=document.createElement("span");e.classList.add(this.sectionSummaryFocusClass),t.appendChild(e);for(const e of Array.from(s.attributes))t.setAttribute(e.name,e.value);Array.from(s.childNodes).forEach((t=>e.appendChild(t))),s.remove(),o.appendChild(t),o.appendChild(this.getButtonPunctuationEl())}o.appendChild(c),n.removeChild(i),n.appendChild(o)}onBeforeMatch(t){const e=t.target;if(!(e instanceof Element))return;const i=e.closest(`.${this.sectionClass}`);i&&this.setExpanded(!0,i)}onSectionToggle(t){const e=!this.isExpanded(t);this.setExpanded(e,t),this.storeState(t,e)}onShowOrHideAllToggle(){const t=!this.areAllSectionsOpen();this.$sections.forEach((e=>{this.setExpanded(t,e),this.storeState(e,t)})),this.updateShowAllButton(t)}setExpanded(t,e){const i=e.querySelector(`.${this.upChevronIconClass}`),n=e.querySelector(`.${this.sectionShowHideTextClass}`),s=e.querySelector(`.${this.sectionButtonClass}`),o=e.querySelector(`.${this.sectionContentClass}`);if(!o)throw new m({component:v,identifier:`Section content (\`<div class="${this.sectionContentClass}">\`)`});if(!i||!n||!s)return;const r=t?this.i18n.t("hideSection"):this.i18n.t("showSection");n.textContent=r,s.setAttribute("aria-expanded",`${t}`);const a=[],c=e.querySelector(`.${this.sectionHeadingTextClass}`);c&&a.push(`${c.textContent}`.trim());const u=e.querySelector(`.${this.sectionSummaryClass}`);u&&a.push(`${u.textContent}`.trim());const l=t?this.i18n.t("hideSectionAriaLabel"):this.i18n.t("showSectionAriaLabel");a.push(l),s.setAttribute("aria-label",a.join(" , ")),t?(o.removeAttribute("hidden"),e.classList.add(this.sectionExpandedClass),i.classList.remove(this.downChevronIconClass)):(o.setAttribute("hidden","until-found"),e.classList.remove(this.sectionExpandedClass),i.classList.add(this.downChevronIconClass)),this.updateShowAllButton(this.areAllSectionsOpen())}isExpanded(t){return t.classList.contains(this.sectionExpandedClass)}areAllSectionsOpen(){return Array.from(this.$sections).every((t=>this.isExpanded(t)))}updateShowAllButton(t){this.$showAllButton&&this.$showAllText&&this.$showAllIcon&&(this.$showAllButton.setAttribute("aria-expanded",t.toString()),this.$showAllText.textContent=t?this.i18n.t("hideAllSections"):this.i18n.t("showAllSections"),this.$showAllIcon.classList.toggle(this.downChevronIconClass,!t))}getIdentifier(t){const e=t.querySelector(`.${this.sectionButtonClass}`);return null==e?void 0:e.getAttribute("aria-controls")}storeState(t,e){if(!this.config.rememberExpanded)return;const i=this.getIdentifier(t);if(i)try{window.sessionStorage.setItem(i,e.toString())}catch(t){}}setInitialState(t){if(!this.config.rememberExpanded)return;const e=this.getIdentifier(t);if(e)try{const i=window.sessionStorage.getItem(e);null!==i&&this.setExpanded("true"===i,t)}catch(t){}}getButtonPunctuationEl(){const t=document.createElement("span");return t.classList.add("govuk-visually-hidden",this.sectionHeadingDividerClass),t.textContent=", ",t}}v.moduleName="govuk-accordion",v.defaults=Object.freeze({i18n:{hideAllSections:"Hide all sections",hideSection:"Hide",hideSectionAriaLabel:"Hide this section",showAllSections:"Show all sections",showSection:"Show",showSectionAriaLabel:"Show this section"},rememberExpanded:!0}),v.schema=Object.freeze({properties:{i18n:{type:"object"},rememberExpanded:{type:"boolean"}}});class b extends g{constructor(t,i={}){super(t),this.config=void 0,this.debounceFormSubmitTimer=null,this.config=e(b.defaults,i,u(b,this.$root.dataset)),this.$root.addEventListener("keydown",(t=>this.handleKeyDown(t))),this.$root.addEventListener("click",(t=>this.debounce(t)))}handleKeyDown(t){const e=t.target;" "===t.key&&e instanceof HTMLElement&&"button"===e.getAttribute("role")&&(t.preventDefault(),e.click())}debounce(t){if(this.config.preventDoubleClick)return this.debounceFormSubmitTimer?(t.preventDefault(),!1):void(this.debounceFormSubmitTimer=window.setTimeout((()=>{this.debounceFormSubmitTimer=null}),1e3))}}function w(t,e){const i=t.closest(`[${e}]`);return i?i.getAttribute(e):null}b.moduleName="govuk-button",b.defaults=Object.freeze({preventDoubleClick:!1}),b.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class y extends g{constructor(t,i={}){var n,s;super(t),this.$textarea=void 0,this.$visibleCountMessage=void 0,this.$screenReaderCountMessage=void 0,this.lastInputTimestamp=null,this.lastInputValue="",this.valueChecker=null,this.config=void 0,this.i18n=void 0,this.maxLength=void 0;const o=this.$root.querySelector(".govuk-js-character-count");if(!(o instanceof HTMLTextAreaElement||o instanceof HTMLInputElement))throw new m({component:y,element:o,expectedType:"HTMLTextareaElement or HTMLInputElement",identifier:"Form field (`.govuk-js-character-count`)"});const r=u(y,this.$root.dataset);let a={};("maxwords"in r||"maxlength"in r)&&(a={maxlength:void 0,maxwords:void 0}),this.config=e(y.defaults,i,a,r);const l=function(t,e){const i=[];for(const[n,s]of Object.entries(t)){const t=[];if(Array.isArray(s)){for(const{required:i,errorMessage:n}of s)i.every((t=>!!e[t]))||t.push(n);"anyOf"!==n||s.length-t.length>=1||i.push(...t)}}return i}(y.schema,this.config);if(l[0])throw new d(c(y,l[0]));this.i18n=new f(this.config.i18n,{locale:w(this.$root,"lang")}),this.maxLength=null!=(n=null!=(s=this.config.maxwords)?s:this.config.maxlength)?n:1/0,this.$textarea=o;const h=`${this.$textarea.id}-info`,p=document.getElementById(h);if(!p)throw new m({component:y,element:p,identifier:`Count message (\`id="${h}"\`)`});`${p.textContent}`.match(/^\s*$/)&&(p.textContent=this.i18n.t("textareaDescription",{count:this.maxLength})),this.$textarea.insertAdjacentElement("afterend",p);const g=document.createElement("div");g.className="govuk-character-count__sr-status govuk-visually-hidden",g.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=g,p.insertAdjacentElement("afterend",g);const v=document.createElement("div");v.className=p.className,v.classList.add("govuk-character-count__status"),v.setAttribute("aria-hidden","true"),this.$visibleCountMessage=v,p.insertAdjacentElement("afterend",v),p.classList.add("govuk-visually-hidden"),this.$textarea.removeAttribute("maxlength"),this.bindChangeEvents(),window.addEventListener("pageshow",(()=>this.updateCountMessage())),this.updateCountMessage()}bindChangeEvents(){this.$textarea.addEventListener("keyup",(()=>this.handleKeyUp())),this.$textarea.addEventListener("focus",(()=>this.handleFocus())),this.$textarea.addEventListener("blur",(()=>this.handleBlur()))}handleKeyUp(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()}handleFocus(){this.valueChecker=window.setInterval((()=>{(!this.lastInputTimestamp||Date.now()-500>=this.lastInputTimestamp)&&this.updateIfValueChanged()}),1e3)}handleBlur(){this.valueChecker&&window.clearInterval(this.valueChecker)}updateIfValueChanged(){this.$textarea.value!==this.lastInputValue&&(this.lastInputValue=this.$textarea.value,this.updateCountMessage())}updateCountMessage(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()}updateVisibleCountMessage(){const t=this.maxLength-this.count(this.$textarea.value)<0;this.$visibleCountMessage.classList.toggle("govuk-character-count__message--disabled",!this.isOverThreshold()),this.$textarea.classList.toggle("govuk-textarea--error",t),this.$visibleCountMessage.classList.toggle("govuk-error-message",t),this.$visibleCountMessage.classList.toggle("govuk-hint",!t),this.$visibleCountMessage.textContent=this.getCountMessage()}updateScreenReaderCountMessage(){this.isOverThreshold()?this.$screenReaderCountMessage.removeAttribute("aria-hidden"):this.$screenReaderCountMessage.setAttribute("aria-hidden","true"),this.$screenReaderCountMessage.textContent=this.getCountMessage()}count(t){var e;return this.config.maxwords?(null!=(e=t.match(/\S+/g))?e:[]).length:t.length}getCountMessage(){const t=this.maxLength-this.count(this.$textarea.value),e=this.config.maxwords?"words":"characters";return this.formatCountMessage(t,e)}formatCountMessage(t,e){if(0===t)return this.i18n.t(`${e}AtLimit`);const i=t<0?"OverLimit":"UnderLimit";return this.i18n.t(`${e}${i}`,{count:Math.abs(t)})}isOverThreshold(){if(!this.config.threshold)return!0;const t=this.count(this.$textarea.value);return this.maxLength*this.config.threshold/100<=t}}y.moduleName="govuk-character-count",y.defaults=Object.freeze({threshold:0,i18n:{charactersUnderLimit:{one:"You have %{count} character remaining",other:"You have %{count} characters remaining"},charactersAtLimit:"You have 0 characters remaining",charactersOverLimit:{one:"You have %{count} character too many",other:"You have %{count} characters too many"},wordsUnderLimit:{one:"You have %{count} word remaining",other:"You have %{count} words remaining"},wordsAtLimit:"You have 0 words remaining",wordsOverLimit:{one:"You have %{count} word too many",other:"You have %{count} words too many"},textareaDescription:{other:""}}}),y.schema=Object.freeze({properties:{i18n:{type:"object"},maxwords:{type:"number"},maxlength:{type:"number"},threshold:{type:"number"}},anyOf:[{required:["maxwords"],errorMessage:'Either "maxlength" or "maxwords" must be provided'},{required:["maxlength"],errorMessage:'Either "maxlength" or "maxwords" must be provided'}]});class k extends g{constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="checkbox"]');if(!e.length)throw new m({component:k,identifier:'Form inputs (`<input type="checkbox">`)'});this.$inputs=e,this.$inputs.forEach((t=>{const e=t.getAttribute("data-aria-controls");if(e){if(!document.getElementById(e))throw new m({component:k,identifier:`Conditional reveal (\`id="${e}"\`)`});t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$root.addEventListener("click",(t=>this.handleClick(t)))}syncAllConditionalReveals(){this.$inputs.forEach((t=>this.syncConditionalRevealWithInputState(t)))}syncConditionalRevealWithInputState(t){const e=t.getAttribute("aria-controls");if(!e)return;const i=document.getElementById(e);if(null!=i&&i.classList.contains("govuk-checkboxes__conditional")){const e=t.checked;t.setAttribute("aria-expanded",e.toString()),i.classList.toggle("govuk-checkboxes__conditional--hidden",!e)}}unCheckAllInputsExcept(t){document.querySelectorAll(`input[type="checkbox"][name="${t.name}"]`).forEach((e=>{t.form===e.form&&e!==t&&(e.checked=!1,this.syncConditionalRevealWithInputState(e))}))}unCheckExclusiveInputs(t){document.querySelectorAll(`input[data-behaviour="exclusive"][type="checkbox"][name="${t.name}"]`).forEach((e=>{t.form===e.form&&(e.checked=!1,this.syncConditionalRevealWithInputState(e))}))}handleClick(t){const e=t.target;e instanceof HTMLInputElement&&"checkbox"===e.type&&(e.getAttribute("aria-controls")&&this.syncConditionalRevealWithInputState(e),e.checked&&("exclusive"===e.getAttribute("data-behaviour")?this.unCheckAllInputsExcept(e):this.unCheckExclusiveInputs(e)))}}k.moduleName="govuk-checkboxes";class $ extends g{constructor(t,i={}){super(t),this.config=void 0,this.config=e($.defaults,i,u($,this.$root.dataset)),this.config.disableAutoFocus||o(this.$root),this.$root.addEventListener("click",(t=>this.handleClick(t)))}handleClick(t){const e=t.target;e&&this.focusTarget(e)&&t.preventDefault()}focusTarget(t){if(!(t instanceof HTMLAnchorElement))return!1;const e=n(t.href);if(!e)return!1;const i=document.getElementById(e);if(!i)return!1;const s=this.getAssociatedLegendOrLabel(i);return!!s&&(s.scrollIntoView(),i.focus({preventScroll:!0}),!0)}getAssociatedLegendOrLabel(t){var e;const i=t.closest("fieldset");if(i){const e=i.getElementsByTagName("legend");if(e.length){const i=e[0];if(t instanceof HTMLInputElement&&("checkbox"===t.type||"radio"===t.type))return i;const n=i.getBoundingClientRect().top,s=t.getBoundingClientRect();if(s.height&&window.innerHeight&&s.top+s.height-n<window.innerHeight/2)return i}}return null!=(e=document.querySelector(`label[for='${t.getAttribute("id")}']`))?e:t.closest("label")}}$.moduleName="govuk-error-summary",$.defaults=Object.freeze({disableAutoFocus:!1}),$.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class C extends g{constructor(t,i={}){super(t),this.config=void 0,this.i18n=void 0,this.$button=void 0,this.$skiplinkButton=null,this.$updateSpan=null,this.$indicatorContainer=null,this.$overlay=null,this.keypressCounter=0,this.lastKeyWasModified=!1,this.timeoutTime=5e3,this.keypressTimeoutId=null,this.timeoutMessageId=null;const n=this.$root.querySelector(".govuk-exit-this-page__button");if(!(n instanceof HTMLAnchorElement))throw new m({component:C,element:n,expectedType:"HTMLAnchorElement",identifier:"Button (`.govuk-exit-this-page__button`)"});this.config=e(C.defaults,i,u(C,this.$root.dataset)),this.i18n=new f(this.config.i18n),this.$button=n;const s=document.querySelector(".govuk-js-exit-this-page-skiplink");s instanceof HTMLAnchorElement&&(this.$skiplinkButton=s),this.buildIndicator(),this.initUpdateSpan(),this.initButtonClickHandler(),"govukFrontendExitThisPageKeypress"in document.body.dataset||(document.addEventListener("keyup",this.handleKeypress.bind(this),!0),document.body.dataset.govukFrontendExitThisPageKeypress="true"),window.addEventListener("pageshow",this.resetPage.bind(this))}initUpdateSpan(){this.$updateSpan=document.createElement("span"),this.$updateSpan.setAttribute("role","status"),this.$updateSpan.className="govuk-visually-hidden",this.$root.appendChild(this.$updateSpan)}initButtonClickHandler(){this.$button.addEventListener("click",this.handleClick.bind(this)),this.$skiplinkButton&&this.$skiplinkButton.addEventListener("click",this.handleClick.bind(this))}buildIndicator(){this.$indicatorContainer=document.createElement("div"),this.$indicatorContainer.className="govuk-exit-this-page__indicator",this.$indicatorContainer.setAttribute("aria-hidden","true");for(let t=0;t<3;t++){const t=document.createElement("div");t.className="govuk-exit-this-page__indicator-light",this.$indicatorContainer.appendChild(t)}this.$button.appendChild(this.$indicatorContainer)}updateIndicator(){this.$indicatorContainer&&(this.$indicatorContainer.classList.toggle("govuk-exit-this-page__indicator--visible",this.keypressCounter>0),this.$indicatorContainer.querySelectorAll(".govuk-exit-this-page__indicator-light").forEach(((t,e)=>{t.classList.toggle("govuk-exit-this-page__indicator-light--on",e<this.keypressCounter)})))}exitPage(){this.$updateSpan&&(this.$updateSpan.textContent="",document.body.classList.add("govuk-exit-this-page-hide-content"),this.$overlay=document.createElement("div"),this.$overlay.className="govuk-exit-this-page-overlay",this.$overlay.setAttribute("role","alert"),document.body.appendChild(this.$overlay),this.$overlay.textContent=this.i18n.t("activated"),window.location.href=this.$button.href)}handleClick(t){t.preventDefault(),this.exitPage()}handleKeypress(t){this.$updateSpan&&("Shift"!==t.key||this.lastKeyWasModified?this.keypressTimeoutId&&this.resetKeypressTimer():(this.keypressCounter+=1,this.updateIndicator(),this.timeoutMessageId&&(window.clearTimeout(this.timeoutMessageId),this.timeoutMessageId=null),this.keypressCounter>=3?(this.keypressCounter=0,this.keypressTimeoutId&&(window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null),this.exitPage()):1===this.keypressCounter?this.$updateSpan.textContent=this.i18n.t("pressTwoMoreTimes"):this.$updateSpan.textContent=this.i18n.t("pressOneMoreTime"),this.setKeypressTimer()),this.lastKeyWasModified=t.shiftKey)}setKeypressTimer(){this.keypressTimeoutId&&window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=window.setTimeout(this.resetKeypressTimer.bind(this),this.timeoutTime)}resetKeypressTimer(){if(!this.$updateSpan)return;this.keypressTimeoutId&&(window.clearTimeout(this.keypressTimeoutId),this.keypressTimeoutId=null);const t=this.$updateSpan;this.keypressCounter=0,t.textContent=this.i18n.t("timedOut"),this.timeoutMessageId=window.setTimeout((()=>{t.textContent=""}),this.timeoutTime),this.updateIndicator()}resetPage(){document.body.classList.remove("govuk-exit-this-page-hide-content"),this.$overlay&&(this.$overlay.remove(),this.$overlay=null),this.$updateSpan&&(this.$updateSpan.setAttribute("role","status"),this.$updateSpan.textContent=""),this.updateIndicator(),this.keypressTimeoutId&&window.clearTimeout(this.keypressTimeoutId),this.timeoutMessageId&&window.clearTimeout(this.timeoutMessageId)}}C.moduleName="govuk-exit-this-page",C.defaults=Object.freeze({i18n:{activated:"Loading.",timedOut:"Exit this page expired.",pressTwoMoreTimes:"Shift, press 2 more times to exit.",pressOneMoreTime:"Shift, press 1 more time to exit."}}),C.schema=Object.freeze({properties:{i18n:{type:"object"}}});class A extends g{constructor(t){super(t),this.$menuButton=void 0,this.$menu=void 0,this.menuIsOpen=!1,this.mql=null;const e=this.$root.querySelector(".govuk-js-header-toggle");if(!e)return this;const i=e.getAttribute("aria-controls");if(!i)throw new m({component:A,identifier:'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'});const n=document.getElementById(i);if(!n)throw new m({component:A,element:n,identifier:`Navigation (\`<ul id="${i}">\`)`});this.$menu=n,this.$menuButton=e,this.setupResponsiveChecks(),this.$menuButton.addEventListener("click",(()=>this.handleMenuButtonClick()))}setupResponsiveChecks(){const t=s("desktop");if(!t.value)throw new m({component:A,identifier:`CSS custom property (\`${t.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${t.value})`),"addEventListener"in this.mql?this.mql.addEventListener("change",(()=>this.checkMode())):this.mql.addListener((()=>this.checkMode())),this.checkMode()}checkMode(){this.mql&&this.$menu&&this.$menuButton&&(this.mql.matches?(this.$menu.removeAttribute("hidden"),this.$menuButton.setAttribute("hidden","")):(this.$menuButton.removeAttribute("hidden"),this.$menuButton.setAttribute("aria-expanded",this.menuIsOpen.toString()),this.menuIsOpen?this.$menu.removeAttribute("hidden"):this.$menu.setAttribute("hidden","")))}handleMenuButtonClick(){this.menuIsOpen=!this.menuIsOpen,this.checkMode()}}A.moduleName="govuk-header";class E extends g{constructor(t,i={}){super(t),this.config=void 0,this.config=e(E.defaults,i,u(E,this.$root.dataset)),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||o(this.$root)}}E.moduleName="govuk-notification-banner",E.defaults=Object.freeze({disableAutoFocus:!1}),E.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class x extends g{constructor(t,i={}){super(t),this.config=void 0,this.i18n=void 0,this.$input=void 0,this.$showHideButton=void 0,this.$screenReaderStatusMessage=void 0;const n=this.$root.querySelector(".govuk-js-password-input-input");if(!(n instanceof HTMLInputElement))throw new m({component:x,element:n,expectedType:"HTMLInputElement",identifier:"Form field (`.govuk-js-password-input-input`)"});if("password"!==n.type)throw new m("Password input: Form field (`.govuk-js-password-input-input`) must be of type `password`.");const s=this.$root.querySelector(".govuk-js-password-input-toggle");if(!(s instanceof HTMLButtonElement))throw new m({component:x,element:s,expectedType:"HTMLButtonElement",identifier:"Button (`.govuk-js-password-input-toggle`)"});if("button"!==s.type)throw new m("Password input: Button (`.govuk-js-password-input-toggle`) must be of type `button`.");this.$input=n,this.$showHideButton=s,this.config=e(x.defaults,i,u(x,this.$root.dataset)),this.i18n=new f(this.config.i18n,{locale:w(this.$root,"lang")}),this.$showHideButton.removeAttribute("hidden");const o=document.createElement("div");o.className="govuk-password-input__sr-status govuk-visually-hidden",o.setAttribute("aria-live","polite"),this.$screenReaderStatusMessage=o,this.$input.insertAdjacentElement("afterend",o),this.$showHideButton.addEventListener("click",this.toggle.bind(this)),this.$input.form&&this.$input.form.addEventListener("submit",(()=>this.hide())),window.addEventListener("pageshow",(t=>{t.persisted&&"password"!==this.$input.type&&this.hide()})),this.hide()}toggle(t){t.preventDefault(),"password"!==this.$input.type?this.hide():this.show()}show(){this.setType("text")}hide(){this.setType("password")}setType(t){if(t===this.$input.type)return;this.$input.setAttribute("type",t);const e="password"===t,i=e?"show":"hide",n=e?"passwordHidden":"passwordShown";this.$showHideButton.innerText=this.i18n.t(`${i}Password`),this.$showHideButton.setAttribute("aria-label",this.i18n.t(`${i}PasswordAriaLabel`)),this.$screenReaderStatusMessage.innerText=this.i18n.t(`${n}Announcement`)}}x.moduleName="govuk-password-input",x.defaults=Object.freeze({i18n:{showPassword:"Show",hidePassword:"Hide",showPasswordAriaLabel:"Show password",hidePasswordAriaLabel:"Hide password",passwordShownAnnouncement:"Your password is visible",passwordHiddenAnnouncement:"Your password is hidden"}}),x.schema=Object.freeze({properties:{i18n:{type:"object"}}});class S extends g{constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="radio"]');if(!e.length)throw new m({component:S,identifier:'Form inputs (`<input type="radio">`)'});this.$inputs=e,this.$inputs.forEach((t=>{const e=t.getAttribute("data-aria-controls");if(e){if(!document.getElementById(e))throw new m({component:S,identifier:`Conditional reveal (\`id="${e}"\`)`});t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls")}})),window.addEventListener("pageshow",(()=>this.syncAllConditionalReveals())),this.syncAllConditionalReveals(),this.$root.addEventListener("click",(t=>this.handleClick(t)))}syncAllConditionalReveals(){this.$inputs.forEach((t=>this.syncConditionalRevealWithInputState(t)))}syncConditionalRevealWithInputState(t){const e=t.getAttribute("aria-controls");if(!e)return;const i=document.getElementById(e);if(null!=i&&i.classList.contains("govuk-radios__conditional")){const e=t.checked;t.setAttribute("aria-expanded",e.toString()),i.classList.toggle("govuk-radios__conditional--hidden",!e)}}handleClick(t){const e=t.target;if(!(e instanceof HTMLInputElement)||"radio"!==e.type)return;const i=document.querySelectorAll('input[type="radio"][aria-controls]'),n=e.form,s=e.name;i.forEach((t=>{const e=t.form===n;t.name===s&&e&&this.syncConditionalRevealWithInputState(t)}))}}S.moduleName="govuk-radios";class T extends g{constructor(t){super(t),this.$menuButton=void 0,this.$menu=void 0,this.menuIsOpen=!1,this.mql=null;const e=this.$root.querySelector(".govuk-js-service-navigation-toggle");if(!e)return this;const i=e.getAttribute("aria-controls");if(!i)throw new m({component:T,identifier:'Navigation button (`<button class="govuk-js-service-navigation-toggle">`) attribute (`aria-controls`)'});const n=document.getElementById(i);if(!n)throw new m({component:T,element:n,identifier:`Navigation (\`<ul id="${i}">\`)`});this.$menu=n,this.$menuButton=e,this.setupResponsiveChecks(),this.$menuButton.addEventListener("click",(()=>this.handleMenuButtonClick()))}setupResponsiveChecks(){const t=s("tablet");if(!t.value)throw new m({component:T,identifier:`CSS custom property (\`${t.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${t.value})`),"addEventListener"in this.mql?this.mql.addEventListener("change",(()=>this.checkMode())):this.mql.addListener((()=>this.checkMode())),this.checkMode()}checkMode(){this.mql&&this.$menu&&this.$menuButton&&(this.mql.matches?(this.$menu.removeAttribute("hidden"),this.$menuButton.setAttribute("hidden","")):(this.$menuButton.removeAttribute("hidden"),this.$menuButton.setAttribute("aria-expanded",this.menuIsOpen.toString()),this.menuIsOpen?this.$menu.removeAttribute("hidden"):this.$menu.setAttribute("hidden","")))}handleMenuButtonClick(){this.menuIsOpen=!this.menuIsOpen,this.checkMode()}}T.moduleName="govuk-service-navigation";class L extends g{constructor(t){var e;super(t);const i=this.$root.hash,s=null!=(e=this.$root.getAttribute("href"))?e:"";let r;try{r=new window.URL(this.$root.href)}catch(t){throw new m(`Skip link: Target link (\`href="${s}"\`) is invalid`)}if(r.origin!==window.location.origin||r.pathname!==window.location.pathname)return;const a=n(i);if(!a)throw new m(`Skip link: Target link (\`href="${s}"\`) has no hash fragment`);const c=document.getElementById(a);if(!c)throw new m({component:L,element:c,identifier:`Target content (\`id="${a}"\`)`});this.$root.addEventListener("click",(()=>o(c,{onBeforeFocus(){c.classList.add("govuk-skip-link-focused-element")},onBlur(){c.classList.remove("govuk-skip-link-focused-element")}})))}}L.elementType=HTMLAnchorElement,L.moduleName="govuk-skip-link";class M extends g{constructor(t){super(t),this.$tabs=void 0,this.$tabList=void 0,this.$tabListItems=void 0,this.jsHiddenClass="govuk-tabs__panel--hidden",this.changingHash=!1,this.boundTabClick=void 0,this.boundTabKeydown=void 0,this.boundOnHashChange=void 0,this.mql=null;const e=this.$root.querySelectorAll("a.govuk-tabs__tab");if(!e.length)throw new m({component:M,identifier:'Links (`<a class="govuk-tabs__tab">`)'});this.$tabs=e,this.boundTabClick=this.onTabClick.bind(this),this.boundTabKeydown=this.onTabKeydown.bind(this),this.boundOnHashChange=this.onHashChange.bind(this);const i=this.$root.querySelector(".govuk-tabs__list"),n=this.$root.querySelectorAll("li.govuk-tabs__list-item");if(!i)throw new m({component:M,identifier:'List (`<ul class="govuk-tabs__list">`)'});if(!n.length)throw new m({component:M,identifier:'List items (`<li class="govuk-tabs__list-item">`)'});this.$tabList=i,this.$tabListItems=n,this.setupResponsiveChecks()}setupResponsiveChecks(){const t=s("tablet");if(!t.value)throw new m({component:M,identifier:`CSS custom property (\`${t.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${t.value})`),"addEventListener"in this.mql?this.mql.addEventListener("change",(()=>this.checkMode())):this.mql.addListener((()=>this.checkMode())),this.checkMode()}checkMode(){var t;null!=(t=this.mql)&&t.matches?this.setup():this.teardown()}setup(){var t;this.$tabList.setAttribute("role","tablist"),this.$tabListItems.forEach((t=>{t.setAttribute("role","presentation")})),this.$tabs.forEach((t=>{this.setAttributes(t),t.addEventListener("click",this.boundTabClick,!0),t.addEventListener("keydown",this.boundTabKeydown,!0),this.hideTab(t)}));const e=null!=(t=this.getTab(window.location.hash))?t:this.$tabs[0];this.showTab(e),window.addEventListener("hashchange",this.boundOnHashChange,!0)}teardown(){this.$tabList.removeAttribute("role"),this.$tabListItems.forEach((t=>{t.removeAttribute("role")})),this.$tabs.forEach((t=>{t.removeEventListener("click",this.boundTabClick,!0),t.removeEventListener("keydown",this.boundTabKeydown,!0),this.unsetAttributes(t)})),window.removeEventListener("hashchange",this.boundOnHashChange,!0)}onHashChange(){const t=window.location.hash,e=this.getTab(t);if(!e)return;if(this.changingHash)return void(this.changingHash=!1);const i=this.getCurrentTab();i&&(this.hideTab(i),this.showTab(e),e.focus())}hideTab(t){this.unhighlightTab(t),this.hidePanel(t)}showTab(t){this.highlightTab(t),this.showPanel(t)}getTab(t){return this.$root.querySelector(`a.govuk-tabs__tab[href="${t}"]`)}setAttributes(t){const e=n(t.href);if(!e)return;t.setAttribute("id",`tab_${e}`),t.setAttribute("role","tab"),t.setAttribute("aria-controls",e),t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");const i=this.getPanel(t);i&&(i.setAttribute("role","tabpanel"),i.setAttribute("aria-labelledby",t.id),i.classList.add(this.jsHiddenClass))}unsetAttributes(t){t.removeAttribute("id"),t.removeAttribute("role"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-selected"),t.removeAttribute("tabindex");const e=this.getPanel(t);e&&(e.removeAttribute("role"),e.removeAttribute("aria-labelledby"),e.classList.remove(this.jsHiddenClass))}onTabClick(t){const e=this.getCurrentTab(),i=t.currentTarget;e&&i instanceof HTMLAnchorElement&&(t.preventDefault(),this.hideTab(e),this.showTab(i),this.createHistoryEntry(i))}createHistoryEntry(t){const e=this.getPanel(t);if(!e)return;const i=e.id;e.id="",this.changingHash=!0,window.location.hash=i,e.id=i}onTabKeydown(t){switch(t.key){case"ArrowLeft":case"Left":this.activatePreviousTab(),t.preventDefault();break;case"ArrowRight":case"Right":this.activateNextTab(),t.preventDefault()}}activateNextTab(){const t=this.getCurrentTab();if(null==t||!t.parentElement)return;const e=t.parentElement.nextElementSibling;if(!e)return;const i=e.querySelector("a.govuk-tabs__tab");i&&(this.hideTab(t),this.showTab(i),i.focus(),this.createHistoryEntry(i))}activatePreviousTab(){const t=this.getCurrentTab();if(null==t||!t.parentElement)return;const e=t.parentElement.previousElementSibling;if(!e)return;const i=e.querySelector("a.govuk-tabs__tab");i&&(this.hideTab(t),this.showTab(i),i.focus(),this.createHistoryEntry(i))}getPanel(t){const e=n(t.href);return e?this.$root.querySelector(`#${e}`):null}showPanel(t){const e=this.getPanel(t);e&&e.classList.remove(this.jsHiddenClass)}hidePanel(t){const e=this.getPanel(t);e&&e.classList.add(this.jsHiddenClass)}unhighlightTab(t){t.parentElement&&(t.setAttribute("aria-selected","false"),t.parentElement.classList.remove("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","-1"))}highlightTab(t){t.parentElement&&(t.setAttribute("aria-selected","true"),t.parentElement.classList.add("govuk-tabs__list-item--selected"),t.setAttribute("tabindex","0"))}getCurrentTab(){return this.$root.querySelector(".govuk-tabs__list-item--selected a.govuk-tabs__tab")}}M.moduleName="govuk-tabs";var _={xs:0,mobile:320,tablet:641,desktop:769};function I(t){return Object.keys(_).reduce((function(e,i){return(t||window.innerWidth)>=_[i]?i:e}))}var B=function(t){return t.innerWidth<=768};function H(t){this.$module=document.querySelector(t),this.$moduleBottomMargin=this.$module.style.marginBottom,this.$mainNav=this.$module.querySelector(".hmrc-account-menu__main"),this.$showNavLinkMobile=this.$module.querySelector(".hmrc-account-menu__link--menu"),this.$currentBreakpoint=I()}function O(t,e,i){this.$module=t,this.window=e,this.document=i}function j(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,P(n.key),n)}}function N(t,e,i){return(e=P(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function q(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function P(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function R(t){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(t)}H.prototype.init=function(){this.setup(),this.$showNavLinkMobile.addEventListener("click",this.eventHandlers.showNavLinkMobileClick.bind(this)),window.addEventListener("resize",function(t,e,i){var n,s=this;return function(){for(var o=arguments.length,r=new Array(o),a=0;a<o;a++)r[a]=arguments[a];var c=s,u=i&&!n;clearTimeout(n),n=setTimeout((function(){n=null,i||t.apply(c,r)}),e),u&&t.apply(c,r)}}(this.reinstantiate.bind(this)))},H.prototype.reinstantiate=function(t){var e=I(t.target.innerWidth);this.$currentBreakpoint!==e&&(this.$currentBreakpoint=e,this.setup())},H.prototype.eventHandlers={showNavLinkMobileClick:function(t){t.preventDefault(),B(window)&&(this.$mainNav.classList.contains("main-nav-is-open")?this.hideMainNavMobile(t.currentTarget):this.showMainNavMobile())}},H.prototype.setup=function(){B(window)?(this.$module.classList.add("is-smaller"),this.$showNavLinkMobile.setAttribute("aria-hidden","false"),this.$showNavLinkMobile.removeAttribute("tabindex"),this.$showNavLinkMobile.classList.remove("js-hidden"),this.hideMainNavMobile(this.$showNavLinkMobile)):(this.$module.classList.remove("is-smaller"),this.$mainNav.classList.remove("main-nav-is-open","js-hidden"),this.$showNavLinkMobile.setAttribute("aria-hidden","true"),this.$showNavLinkMobile.setAttribute("tabindex","-1"),this.$showNavLinkMobile.classList.add("js-hidden"))},H.prototype.showMainNavMobile=function(){this.$mainNav.classList.remove("js-hidden"),this.$mainNav.classList.add("main-nav-is-open"),this.$mainNav.setAttribute("aria-expanded","true"),this.$showNavLinkMobile.setAttribute("aria-expanded","true"),this.$showNavLinkMobile.classList.add("hmrc-account-home--account--is-open")},H.prototype.hideMainNavMobile=function(t){this.$mainNav.classList.remove("main-nav-is-open"),this.$mainNav.setAttribute("aria-expanded","false"),t.classList.contains("hmrc-account-menu__link--menu")&&(this.$mainNav.classList.add("js-hidden"),this.$showNavLinkMobile.setAttribute("aria-expanded","false"),this.$showNavLinkMobile.classList.remove("hmrc-account-home--account--is-open"))},O.prototype.init=function(){var t=this;this.window.history&&(this.window.history.replaceState&&"function"==typeof this.window.history.replaceState&&this.window.history.replaceState(null,null,this.window.location.href),this.$module.addEventListener("click",(function(e){e.preventDefault(),t.window.history.back&&"function"==typeof t.window.history.back&&t.window.history.back()})))};var F=console.warn,D={generateDomElementFromString:function(t){var e=document.createElement("div");return e.innerHTML=t,e.firstChild},generateDomElementFromStringAndAppendText:function(t,e){var i=D.generateDomElementFromString(t);return i.innerText=e,i},hasClass:function(t,e){return document.querySelector(t).classList.contains(e)},addClass:function(t,e){document.querySelectorAll(t).forEach((function(t){t.classList.add(e)}))},removeClass:function(t,e){document.querySelectorAll(t).forEach((function(t){t.classList.remove(e)}))},removeElement:function(t){var e=t.parentNode;e?e.removeChild(t):F("couldn't find parent for elem",t)},ajaxGet:function(t,e){var i=new XMLHttpRequest;return i.open("GET",t),i.onreadystatechange=function(){i.readyState>3&&200===i.status&&e(i.responseText)},i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.send(),i}};var U={displayDialog:function(t){var e=D.generateDomElementFromString('<div id="hmrc-timeout-dialog" tabindex="-1" role="dialog" aria-modal="true" class="hmrc-timeout-dialog">'),i=D.generateDomElementFromString('<div id="hmrc-timeout-overlay" class="hmrc-timeout-overlay">'),n="string"==typeof t?D.generateDomElementFromString(t):t,s=[],o=[];e.appendChild(n),D.hasClass("html","noScroll")||(D.addClass("html","noScroll"),s.push((function(){D.removeClass("html","noScroll")}))),document.body.appendChild(e),document.body.appendChild(i),s.push((function(){D.removeElement(e),D.removeElement(i)}));var r,a=document.querySelectorAll(["#skiplink-container","body > header","#global-cookie-message","main","body > footer","body > .govuk-skip-link",".cbanner-govuk-cookie-banner","body > .govuk-width-container"].join(", ")),c=function(){for(;s.length>0;){s.shift()()}};return a.forEach((function(t){var e=t.getAttribute("aria-hidden");t.setAttribute("aria-hidden","true"),s.push((function(){e?t.setAttribute("aria-hidden",e):t.removeAttribute("aria-hidden")}))})),function(){function t(t){var e=document.getElementById("hmrc-timeout-dialog");e&&(t.target===e||e.contains(t.target)||(t.stopPropagation(),e.focus()))}var i=document.activeElement;e.focus(),document.addEventListener("focus",t,!0),s.push((function(){document.removeEventListener("focus",t),i.focus()}))}(),function(){function t(t){27===t.keyCode&&(o.forEach((function(t){t()})),c())}document.addEventListener("keydown",t),s.push((function(){document.removeEventListener("keydown",t)}))}(),r=function(t){1===(t.touches||t.changedTouches||[]).length&&t.preventDefault()},document.addEventListener("touchmove",r,!0),s.push((function(){document.removeEventListener("touchmove",r,!0)})),{closeDialog:function(){c()},setAriaLabelledBy:function(t){t?e.setAttribute("aria-labelledby",t):e.removeAttribute("aria-labelledby")},addCloseHandler:function(t){o.push(t)}}}};function K(){}function z(){}function W(t,e){var i,n={},s={},o=[],r=e;var a=function(){s.synchroniseTabs&&r.onActivity((function(t){var e=t.timestamp;f(),l(e)}))},c=function(t){var e=[];if(["timeout","countdown","keepAliveUrl","signOutUrl"].forEach((function(i){t[i]||e.push("data-".concat(i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()))})),e.length>0)throw new Error("Missing config item(s): [".concat(e.join(", "),"]"))},u=function t(e,i){var n=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?q(Object(i),!0).forEach((function(e){N(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):q(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},e);return Object.keys(i).forEach((function(s){"object"===R(n[s])&&(n[s]=t(e[s],i[s])),void 0!==n[s]&&""!==n[s]||(n[s]=i[s])})),n},l=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m(),e=t+1e3*s.timeout,n=m()-t,r=s.timeout-s.countdown,a=window.setTimeout((function(){h(e)}),1e3*r-n);o.push((function(){window.clearTimeout(a),i&&window.clearTimeout(i)}))},h=function(t){var e=D.generateDomElementFromString("<div>");if(s.title){var n=D.generateDomElementFromStringAndAppendText('<h1 id="hmrc-timeout-heading" class="govuk-heading-m push--top">',s.title);e.appendChild(n)}var r=D.generateDomElementFromString('<span id="hmrc-timeout-countdown" class="hmrc-timeout-dialog__countdown">'),a=D.generateDomElementFromString('<p id="hmrc-timeout-message" class="govuk-visually-hidden screenreader-content" aria-live="assertive">'),c=D.generateDomElementFromStringAndAppendText('<p class="govuk-body hmrc-timeout-dialog__message" aria-hidden="true">',s.message);c.appendChild(document.createTextNode(" ")),c.appendChild(r),c.appendChild(document.createTextNode(".")),s.messageSuffix&&c.appendChild(document.createTextNode(" ".concat(s.messageSuffix)));var u=D.generateDomElementFromStringAndAppendText('<button id="hmrc-timeout-keep-signin-btn" class="govuk-button">',s.keepAliveButtonText),l=document.createElement("div");if(l.classList.add("govuk-button-group"),l.appendChild(u),e.appendChild(c),e.appendChild(a),u.addEventListener("click",d),e.appendChild(document.createTextNode(" ")),!s.hideSignOutButton){var h=D.generateDomElementFromStringAndAppendText('<a id="hmrc-timeout-sign-out-link" class="govuk-link hmrc-timeout-dialog__link">',s.signOutButtonText);h.addEventListener("click",p),h.setAttribute("href",s.signOutUrl),l.appendChild(h)}e.appendChild(l);var f=U.displayDialog(e);o.push((function(){f.closeDialog()})),f.addCloseHandler(d),f.setAriaLabelledBy("hmrc-timeout-heading hmrc-timeout-message");var v=function(){return t-m()},b=function(t){var e,i;return t<60?i="".concat(t," ").concat(s.properties[1!==t?"seconds":"second"]):(e=Math.ceil(t/60),i="".concat(e," ").concat(s.properties[1===e?"minute":"minutes"])),i},w=function(t){return t>60?t:t<20?20:20*Math.ceil(t/20)},y=function(t,e){t.innerText!==e&&(t.innerText=e)},k=function(t){var e=b(t),i=function(t){var e=b(w(t)),i=[s.message," ",e,"."];return s.messageSuffix&&(i.push(" "),i.push(s.messageSuffix)),i.join("")}(t);y(r,e),y(a,i)};!function t(){var e,n,s=Math.max(Math.round(v()/1e3),0);k(s),0===s?g():i=window.setTimeout(t,(e=v(),(n=1e3*Math.floor(v()/1e3))<=6e4?e-n||1e3:e-(n-(n%6e4||6e4))))}()},d=function(){f(),l(),D.ajaxGet(s.keepAliveUrl,(function(){})),r.logActivity()},m=function(){return Date.now()},p=function(){z.redirectToUrl(s.signOutUrl)},g=function(){z.redirectToUrl(s.timeoutUrl)},f=function(){for(;o.length>0;){o.shift()()}};return{init:function(){var e=K;function i(e){return(t.attributes.getNamedItem(e)||{}).value}var o="cy"===e.string(i("data-language"))?{title:"Rydych ar fin cael eich allgofnodi",message:"Er eich diogelwch, byddwn yn eich allgofnodi cyn pen",keepAliveButtonText:"Parhau i fod wedi’ch mewngofnodi",signOutButtonText:"Allgofnodi",properties:{minutes:"funud",minute:"funud",seconds:"eiliad",second:"eiliad"}}:{title:"You’re about to be signed out",message:"For your security, we will sign you out in",keepAliveButtonText:"Stay signed in",signOutButtonText:"Sign out",properties:{minutes:"minutes",minute:"minute",seconds:"seconds",second:"second"}};(n={timeout:e.int(i("data-timeout")),countdown:e.int(i("data-countdown")),keepAliveUrl:e.string(i("data-keep-alive-url")),signOutUrl:e.string(i("data-sign-out-url")),timeoutUrl:e.string(i("data-timeout-url")),title:e.string(i("data-title")),message:e.string(i("data-message")),messageSuffix:e.string(i("data-message-suffix")),keepAliveButtonText:e.string(i("data-keep-alive-button-text")),signOutButtonText:e.string(i("data-sign-out-button-text")),synchroniseTabs:e.boolean(i("data-synchronise-tabs")||!1),hideSignOutButton:e.boolean(i("data-hide-sign-out-button")||!1)}).timeoutUrl=n.timeoutUrl||n.signOutUrl,c(n),s=u(n,o),l(),a()},cleanup:f}}K.int=function(t){var e=parseInt(t,10);return Number.isNaN(e)?void 0:e},K.string=function(t){return"string"==typeof t?t:void 0},K.boolean=function(t){return"true"===String(t).toLowerCase()},z.redirectToUrl=function(t){window.location.href=t},W.dialog=U,W.redirectHelper=z,W.utils=D;function V(t){this.$module=t,this.$closeLink=this.$module.querySelector(".hmrc-user-research-banner__close"),this.cookieName="mdtpurr",this.cookieExpiryDays=28}V.prototype.init=function(){null==function(t){for(var e="".concat(t,"="),i=document.cookie.split(";"),n=0,s=i.length;n<s;n+=1){for(var o=i[n];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(e))return decodeURIComponent(o.substring(e.length))}return null}(this.cookieName)&&(this.$module.classList.add("hmrc-user-research-banner--show"),this.$closeLink.addEventListener("click",this.eventHandlers.noThanksClick.bind(this)))},V.prototype.eventHandlers={noThanksClick:function(t){t.preventDefault(),function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="".concat(t,"=").concat(e,"; path=/");if(i.days){var s=new Date;s.setTime(s.getTime()+24*i.days*60*60*1e3),n="".concat(n,"; expires=").concat(s.toGMTString())}"https:"===window.location.protocol&&(n+="; Secure"),document.cookie=n}(this.cookieName,"suppress_for_all_services",{days:this.cookieExpiryDays}),this.$module.classList.remove("hmrc-user-research-banner--show")}};var Y=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.activityChannel=e&&new e("session-activity")}var e,i,n;return e=t,(i=[{key:"logActivity",value:function(){if(this.activityChannel){var t={timestamp:Date.now()};this.activityChannel.postMessage(t)}}},{key:"onActivity",value:function(t){this.activityChannel&&(this.activityChannel.onmessage=function(e){t(e.data)})}}])&&j(e.prototype,i),n&&j(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function G(t,e){this.$module=t,this.window=e}G.prototype.init=function(){var t=this;this.$module.addEventListener("click",(function(e){e.preventDefault(),t.window.print()}))};var X={initAll:function(){var t='[data-module="hmrc-account-menu"]';document.querySelector(t)&&new H(t).init(),document.querySelectorAll('a[data-module="hmrc-print-link"]').forEach((function(t){new G(t,window).init()}));var e=new Y(window.BroadcastChannel);e.logActivity();var i=document.querySelector('meta[name="hmrc-timeout-dialog"]');i&&new W(i,e).init();var n=document.querySelector('[data-module="hmrc-user-research-banner"]');n&&new V(n).init(),document.querySelectorAll('[data-module="hmrc-back-link"]').forEach((function(t){new O(t,window,document).init()}))},AccountMenu:H,TimeoutDialog:W,UserResearchBanner:V,BackLinkHelper:O};!function(t){var e;if(t=void 0!==t?t:{},!r())return void(t.onError?t.onError(new h,{config:t}):console.log(new h));const i=[[v,t.accordion],[b,t.button],[y,t.characterCount],[k],[$,t.errorSummary],[C,t.exitThisPage],[A],[E,t.notificationBanner],[x,t.passwordInput],[S],[T],[L],[M]],n={scope:null!=(e=t.scope)?e:document,onError:t.onError};i.forEach((([t,e])=>{!function(t,e,i){let n,s=document;var o;"object"==typeof i&&(s=null!=(o=i.scope)?o:s,n=i.onError),"function"==typeof i&&(n=i),i instanceof HTMLElement&&(s=i);const a=s.querySelectorAll(`[data-module="${t.moduleName}"]`);r()?Array.from(a).map((i=>{try{return void 0!==e?new t(i,e):new t(i)}catch(s){return n?n(s,{element:i,component:t,config:e}):console.log(s),null}})).filter(Boolean):n?n(new h,{component:t,config:e}):console.log(new h)}(t,e,n)}))}(),X.initAll()}();
2
-
3
- //# sourceMappingURL=maps/hmrc-frontend-6.50.0.min.js.map