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AkC,KAClC,gCAAiC,KACjC,+BAAgC,KAChC,gCAAiC,KACjC,iCAAkC,KAClC,gCAAiC,KACjC,sCAAuC,KACvC,wCAAyC,KACzC,yCAA0C,KAC1C,0CAA2C,IAC3C,yCAA0C,KAC1C,6BAA8B,KAC9B,6BAA8B,KAC9B,iCAAkC,KAClC,oCAAqC,IACrC,oCAAqC,KACrC,oCAAqC,KACrC,qCAAsC,KACtC,2CAA4C,KAC5C,wBAAyB,MAI1B,SAASC,EAAeC,GACvB,IAAIC,EAAKC,EAAsBF,GAC/B,OAAOG,EAAoBF,EAC5B,CACA,SAASC,EAAsBF,GAC9B,IAAIG,EAAoBC,EAAEN,EAAKE,GAAM,CACpC,IAAIK,EAAI,IAAIC,MAAM,uBAAyBN,EAAM,KAEjD,MADAK,EAAEE,KAAO,mBACHF,CACP,CACA,OAAOP,EAAIE,EACZ,CACAD,EAAeS,KAAO,WACrB,OAAOC,OAAOD,KAAKV,EACpB,EACAC,EAAeW,QAAUR,EACzBS,EAAOC,QAAUb,EACjBA,EAAeE,GAAK,I","sources":["webpack://vmpr-change-keeper-external-ui/./app/javascript/images/ sync ^\\.\\/.*$","webpack://vmpr-change-keeper-external-ui/./app/javascript/stylesheets/ sync nonrecursive ^\\.\\/[^_].*\\.(css%7Cscss%7Csass)$i","webpack://vmpr-change-keeper-external-ui/./app/javascript/components/js-form-utils/index.js","webpack://vmpr-change-keeper-external-ui/./app/javascript/components/out-of-hours/index.js","webpack://vmpr-change-keeper-external-ui/./app/javascript/packs/application.js","webpack://vmpr-change-keeper-external-ui/./node_modules/dvla-external-frontend/dist/media/ sync ^\\.\\/.*$"],"sourcesContent":["var map = {\n\t\"./PRNreferencehint.png\": 6663,\n\t\"./V5Creferencehint.png\": 9037,\n\t\"./VRMreferencehint.png\": 8168,\n\t\"./card-types.png\": 3741,\n\t\"./icon-tick-green.gif\": 1097,\n\t\"./loading-buffering.gif\": 8425,\n\t\"./mastercard.png\": 3971,\n\t\"./visa.png\": 2576\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 6190;","var map = {\n\t\"./application.scss\": 179\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 8402;","/**\n * @typedef {[\n * className: string,\n * eventType: string,\n * handler: (event: Event) => void\n * ]} EventTuple\n */\n\n/**\n * Forces the input to be numeric only.\n *\n * @param {Event} event - The input event.\n * @returns {void}\n */\nexport function forceInputNumeric(event) {\n const target = event.target;\n const start = target.selectionStart;\n const end = target.selectionEnd;\n\n target.value = target.value.replace(/[^\\d\\s]/g, '');\n target.setSelectionRange(start, end);\n}\n\n/**\n * Forces the input to be numeric and hyphen only.\n *\n * @param {Event} event - The input event.\n * @returns {void}\n */\nexport function forceInputNumericAndHyphen(event) {\n const target = event.target;\n const start = target.selectionStart;\n const end = target.selectionEnd;\n\n target.value = target.value.replace(/[^0-9-]/g, '');\n target.setSelectionRange(start, end);\n}\n\n/**\n * Forces the input to be alphanumeric only.\n *\n * @param {Event} event - The input event.\n * @returns {void}\n */\nexport function forceInputAlphnumeric(event) {\n const target = event.target;\n const start = target.selectionStart;\n const end = target.selectionEnd;\n\n target.value = target.value.replace(/[^a-zA-Z\\d\\s]/g, '');\n target.setSelectionRange(start, end);\n}\n\n/**\n * Forces the input to be alphanumeric and allow left chevron.\n *\n * @param {Event} event - The input event.\n * @returns {void}\n */\nexport function forceInputAlphnumericLeftChevron(event) {\n const target = event.target;\n const start = target.selectionStart;\n const end = target.selectionEnd;\n\n target.value = target.value.replace(/[^a-zA-Z<\\d\\s]/g, '');\n target.setSelectionRange(start, end);\n}\n\n/**\n * Forces the input to be uppercase.\n *\n * @param {Event} event - The input event.\n * @returns {void}\n */\nexport function forceInputUppercase(event) {\n const target = event.target;\n const start = target.selectionStart;\n const end = target.selectionEnd;\n\n target.value = target.value.toLocaleUpperCase();\n target.setSelectionRange(start, end);\n}\n\n/**\n * Prevents spaces from being entered.\n *\n * @param {KeyboardEvent} event - The keypress event.\n * @returns {void}\n */\nexport function forceInputNoSpaces(event) {\n const key = event.key;\n\n if (key === ' ') {\n event.preventDefault();\n }\n}\n\n/**\n * Prevent the default event action, such as submit or paste.\n *\n * @param {Event} event - The submit or paste event, etc.\n * @returns {boolean} Returns false to prevent event propagation.\n */\nexport function preventEventDefault(event) {\n event.preventDefault();\n\n return false;\n}\n\n/**\n * Registers event listeners for elements with a specific class name.\n *\n * @param {string} className - The class name of the elements.\n * @param {string} type - The event type.\n * @param {EventListener} callback - The event listener callback.\n */\nexport function registerEventsByClassName(className, type, callback) {\n const elements = document.getElementsByClassName(className);\n\n for (const element of elements) {\n element.addEventListener(type, callback);\n }\n}\n\n/** @type {EventTuple[]} */\nconst events = [\n ['uppercase', 'input', forceInputUppercase],\n ['alphanumericOnly', 'input', forceInputAlphnumeric],\n ['alphanumericChevronInputs', 'input', forceInputAlphnumericLeftChevron],\n ['numericOnly', 'input', forceInputNumeric],\n ['numericAndHyphenOnly', 'input', forceInputNumericAndHyphen],\n ['noSpace', 'keypress', forceInputNoSpaces],\n ['noPaste', 'paste', preventEventDefault],\n ['disableOnSubmit', 'submit', preventEventDefault],\n];\n\n/**\n * Registers input listeners for the given elements\n *\n * @returns {void}\n */\nexport function registerInputListeners() {\n for (const [className, type, callback] of events) {\n registerEventsByClassName(className, type, callback);\n }\n}\n\nexport default {\n registerInputListeners,\n};\n","/**\n * @typedef {Object} BannerElementsFromDOM\n *\n * @property {HTMLElement} bannerElement - The main banner element.\n * @property {HTMLElement} innerBannerElement - The inner banner element.\n * @property {HTMLElement} bannerTextElement - The element displaying the banner text.\n * @property {HTMLElement} remainingTimeElement - The element displaying the remaining time.\n * @property {HTMLElement} warningText1Element - The first warning text element.\n * @property {HTMLElement} warningText2Element - The second warning text element.\n * @property {HTMLElement} warningText3Element - The third warning text element.\n * @property {HTMLElement} closedTextElement - The element displaying the closed text.\n */\n\n/**\n * @typedef {Object} CloseAndWarningTimes\n *\n * @property {Date} close - The close time.\n * @property {number} warningSeconds - The number of seconds to display the first warning.\n * @property {number} finalWarningSeconds - The number of seconds to display the final warning.\n */\n\n/**\n * @typedef {BannerElementsFromDOM & CloseAndWarningTimes} Options\n */\n\n/**\n * The interval to check the remaining time in milliseconds\n * @private\n */\nconst CHECK_INTERVAL_MS = 1000;\n\n/**\n * Flags used to avoid repeating work on the DOM\n * @private\n */\nlet _flags = {\n hasClassHidden: false,\n hasClassFinal: false,\n};\n\n/**\n * Sets a flag to a value.\n *\n * @param {string} flag - The flag to set.\n * @param {boolean} value - The value to set the flag to.\n * @returns {void}\n */\nexport function setFlag(flag, value) {\n _flags = {\n ..._flags,\n [flag]: value,\n };\n}\n\n/**\n * Gets a flag value.\n *\n * @param {string} flag\n * @returns {boolean}\n */\nexport function getFlag(flag) {\n return _flags[flag];\n}\n\n/**\n * Retrieves elements from the DOM.\n *\n * @returns {BannerElementsFromDOM | null} An object containing the elements or null if the root element is not found.\n */\nexport function getElementsFromDom() {\n const bannerElement = document.getElementById('out_of_hours_banner');\n\n // Return early if no banner element is found.\n if (bannerElement == null) {\n return null;\n }\n\n const innerBannerElement = document.getElementById(\n 'out_of_hours_banner_inner'\n );\n const bannerTextElement = document.getElementById('out_of_hours_banner_text');\n const remainingTimeElement = document.getElementById(\n 'out_of_hours_banner_time_remaining_time'\n );\n const warningText1Element = document.getElementById(\n 'out_of_hours_banner_time_remaining_warning'\n );\n const warningText2Element = document.getElementById(\n 'out_of_hours_banner_time_remaining_warning2'\n );\n const warningText3Element = document.getElementById(\n 'out_of_hours_banner_time_remaining_warning3'\n );\n const closedTextElement = document.getElementById(\n 'out_of_hours_banner_closed_text'\n );\n\n return {\n bannerElement,\n innerBannerElement,\n bannerTextElement,\n remainingTimeElement,\n warningText1Element,\n warningText2Element,\n warningText3Element,\n closedTextElement,\n };\n}\n\n/**\n * Retrieves close and warning times from the remaining time element.\n *\n * @param {HTMLElement | null} remainingTimeElement - The element containing the close and warning times.\n * @returns {CloseAndWarningTimes} An object containing the close time, warning seconds, and final warning seconds.\n */\nexport function getCloseAndWarningTimes(remainingTimeElement) {\n const dateString = remainingTimeElement?.dataset?.closeTime || '';\n const closeDate = dateString ? new Date(dateString) : new Date();\n\n const warningSecondsValue = dateString\n ? parseInt(remainingTimeElement.dataset.warningSeconds, 10)\n : 0;\n\n const finalWarningSecondsValue = dateString\n ? parseInt(remainingTimeElement.dataset.finalWarningSeconds, 10)\n : 0;\n\n // Ensure the values are valid and if not, set them to defaults.\n const close = isNaN(closeDate) ? new Date() : closeDate;\n const warningSeconds = isNaN(warningSecondsValue) ? 0 : warningSecondsValue;\n const finalWarningSeconds = isNaN(finalWarningSecondsValue) ? 0 : finalWarningSecondsValue;\n\n return {\n close,\n warningSeconds,\n finalWarningSeconds,\n };\n}\n\n/**\n * Calculates the seconds remaining until the close time.\n *\n * @param {Date} close - The close time.\n * @returns {number} The number of seconds remaining.\n */\nexport function getSecondsRemaining(close) {\n const now = new Date();\n return Math.floor((close - now) / 1000);\n}\n\n/**\n * Formats the remaining time as MM:SS.\n *\n * @param {number} secondsRemaining - The number of seconds remaining.\n * @returns {string} The time remaining formatted as `MM:SS`.\n */\nexport function getTimeRemainingText(secondsRemaining) {\n const minutes = Math.floor(secondsRemaining / 60);\n const seconds = Math.floor(secondsRemaining % 60);\n const minutesRemainingText = minutes < 10 ? '0' + minutes : minutes;\n const secondsRemainingText = seconds < 10 ? '0' + seconds : seconds;\n\n return minutesRemainingText + ':' + secondsRemainingText;\n}\n\n/**\n * Updates the text content of the remaining time element.\n *\n * @param {HTMLElement} remainingTimeElement - The element displaying the remaining time.\n * @param {number} secondsRemaining - The number of seconds remaining.\n * @returns {void}\n */\nexport function updateSecondRemainingText(\n remainingTimeElement,\n secondsRemaining\n) {\n if (secondsRemaining >= 0) {\n remainingTimeElement.textContent = getTimeRemainingText(secondsRemaining);\n }\n}\n\n/**\n * Updates the display of the warning banner.\n *\n * @param {boolean} isWarning - Whether the warning should be displayed.\n * @param {Options} options - The banner element.\n * @returns {void}\n */\nexport function updateWarningDisplay(isWarning, options) {\n const { bannerElement } = options;\n\n if (isWarning && getFlag('hasClassHidden')) {\n bannerElement.classList.remove('out_of_hours_banner__hidden');\n bannerElement.removeAttribute('aria-hidden');\n setFlag('hasClassHidden', false);\n }\n}\n\n/**\n * Updates the display of the final warning banner.\n *\n * @param {boolean} isFinalWarning - Whether the final warning should be displayed.\n * @param {Options} options - The inner banner element.\n * @returns {void}\n */\nexport function updateFinalWarningDisplay(isFinalWarning, options) {\n const { innerBannerElement } = options;\n\n if (isFinalWarning && !getFlag('hasClassFinal')) {\n innerBannerElement.classList.add(\n 'out_of_hours_banner__closing_warning--final'\n );\n setFlag('hasClassFinal', true);\n }\n}\n\n/**\n * Sets an element to hidden.\n *\n * @param {HTMLElement} element - The element to hide.\n * @returns {void}\n */\nexport function setElementToHidden(element) {\n element.classList.add('out_of_hours_banner__hidden');\n element.setAttribute('aria-hidden', 'true');\n}\n\n/**\n * Sets an element to visible.\n *\n * @param {HTMLElement} element - The element to show.\n * @returns {void}\n */\nexport function setElementToVisible(element) {\n element.classList.remove('out_of_hours_banner__hidden');\n element.removeAttribute('aria-hidden');\n}\n\n/**\n * Updates the display when the service is closed.\n *\n * @param {boolean} isServiceClosed - Whether the service is closed.\n * @param {Options} options - The elements to update.\n * @returns {void}\n */\nexport function updateServiceClosedDisplay(isServiceClosed, options) {\n const {\n warningText1Element,\n warningText2Element,\n warningText3Element,\n remainingTimeElement,\n closedTextElement,\n bannerTextElement,\n } = options;\n\n if (isServiceClosed) {\n setElementToHidden(warningText1Element);\n setElementToHidden(warningText2Element);\n setElementToHidden(warningText3Element);\n setElementToHidden(remainingTimeElement);\n setElementToVisible(closedTextElement);\n bannerTextElement.setAttribute('aria-live', 'polite');\n }\n}\n\n/** @type {typeof setInterval | null} */\nlet interval = null;\n\n/**\n * Wraps the interval to clean up when checkElements returns false\n * \n * @param {Options} options\n * @returns {void}\n */\nexport function intervalCallback(options) {\n const shouldContinue = checkElements(options);\n if (!shouldContinue) {\n clearInterval(interval);\n }\n}\n\n/**\n * Checks the elements and updates their display based on the remaining time.\n *\n * @param {Options} options - The elements and times to check.\n * @returns {boolean} True if the interval should continue, otherwise false.\n */\nexport function checkElements(options) {\n if (!options) return false;\n\n const { remainingTimeElement, close, warningSeconds, finalWarningSeconds } =\n options;\n\n const secondsRemaining = getSecondsRemaining(close);\n const isWarning = secondsRemaining <= warningSeconds;\n const isFinalWarning = secondsRemaining <= finalWarningSeconds;\n const isServiceClosed = secondsRemaining <= 0;\n\n updateSecondRemainingText(remainingTimeElement, secondsRemaining);\n updateWarningDisplay(isWarning, options);\n updateFinalWarningDisplay(isFinalWarning, options);\n updateServiceClosedDisplay(isServiceClosed, options);\n\n return !isServiceClosed;\n}\n\n/**\n * Sets up the interval to check and update the elements.\n *\n * @param {BannerElementsFromDOM} elements - The elements to check and update.\n * @returns {void}\n */\nexport function setupInterval(elements) {\n if (!elements) return;\n\n const { bannerElement, innerBannerElement, remainingTimeElement } = elements;\n\n setFlag(\n 'hasClassHidden',\n bannerElement.classList.contains('out_of_hours_banner__hidden')\n );\n setFlag(\n 'hasClassFinal',\n innerBannerElement.classList.contains(\n 'out_of_hours_banner__closing_warning--final'\n )\n );\n\n /** @type {Options} */\n const options = {\n ...elements,\n ...getCloseAndWarningTimes(remainingTimeElement),\n };\n\n interval = setInterval(() => intervalCallback(options), CHECK_INTERVAL_MS);\n}\n\n/**\n * Initializes the script by retrieving elements and setting up the interval.\n * It will bail early if no banner element is found.\n *\n * @returns {void}\n */\nexport function initialise() {\n const elements = getElementsFromDom();\n if (elements == null) return;\n\n setupInterval(elements);\n}\n\nexport default {\n initialise,\n};\n","import {\n GOVUKInitAll,\n HMRCInitAll,\n ClearCookies,\n ProgressiveDisclosure,\n Webchat,\n} from 'dvla-external-frontend';\nimport formUtils from '../components/js-form-utils';\nimport outOfHours from '../components/out-of-hours';\n\n// ensure the stylesheets are included in the compiled pack\nrequire.context('../stylesheets/', false, /^\\.\\/[^_].*\\.(css|scss|sass)$/i);\n// ensure images are included in the compiled pack\nrequire.context('../images', true);\n// ensure dvla-external-frontend/dist/media are included in the compiled pack\nrequire.context('dvla-external-frontend/dist/media', true);\n\n// initialise javascript\nGOVUKInitAll();\nHMRCInitAll();\nClearCookies.init();\nProgressiveDisclosure();\nWebchat();\n\n// initialise form utils\nwindow.onload = () => {\n formUtils.registerInputListeners();\n outOfHours.initialise();\n};\n","var map = {\n\t\"./capture-photo/acceptable.jpg\": 8702,\n\t\"./capture-photo/background-object.png\": 3780,\n\t\"./capture-photo/background-textured.png\": 3350,\n\t\"./capture-photo/harsh.png\": 7052,\n\t\"./capture-photo/shadow.png\": 2370,\n\t\"./common/processing-spinner.gif\": 9852,\n\t\"./dvla-common-customer/A.png\": 3214,\n\t\"./dvla-common-customer/AM.png\": 3241,\n\t\"./dvla-common-customer/B.png\": 1365,\n\t\"./dvla-common-customer/B1.png\": 9816,\n\t\"./dvla-common-customer/BE.png\": 6988,\n\t\"./dvla-common-customer/C.png\": 1948,\n\t\"./dvla-common-customer/C1.png\": 1631,\n\t\"./dvla-common-customer/C1E.png\": 4338,\n\t\"./dvla-common-customer/CE.png\": 6475,\n\t\"./dvla-common-customer/D.png\": 5555,\n\t\"./dvla-common-customer/D1.png\": 8818,\n\t\"./dvla-common-customer/D1E.png\": 8357,\n\t\"./dvla-common-customer/DE.png\": 7574,\n\t\"./dvla-common-customer/pdf-icon.png\": 7115,\n\t\"./govuk/fonts/bold-affa96571d-v2.woff\": 6152,\n\t\"./govuk/fonts/bold-b542beb274-v2.woff2\": 1487,\n\t\"./govuk/fonts/light-94a07e06a1-v2.woff2\": 889,\n\t\"./govuk/fonts/light-f591b13f7d-v2.woff\": 2997,\n\t\"./govuk/images/favicon.ico\": 2172,\n\t\"./govuk/images/favicon.svg\": 4729,\n\t\"./govuk/images/govuk-crest.svg\": 5791,\n\t\"./govuk/images/govuk-icon-180.png\": 400,\n\t\"./govuk/images/govuk-icon-192.png\": 4905,\n\t\"./govuk/images/govuk-icon-512.png\": 2437,\n\t\"./govuk/images/govuk-icon-mask.svg\": 3714,\n\t\"./govuk/images/govuk-opengraph-image.png\": 3609,\n\t\"./govuk/manifest.json\": 1788\n};\n\n\nfunction webpackContext(req) {\n\tvar id = webpackContextResolve(req);\n\treturn __webpack_require__(id);\n}\nfunction webpackContextResolve(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\treturn map[req];\n}\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 5711;"],"names":["map","webpackContext","req","id","webpackContextResolve","__webpack_require__","o","e","Error","code","keys","Object","resolve","module","exports","preventEventDefault","event","preventDefault","registerEventsByClassName","className","type","callback","_step","_iterator","_createForOfIteratorHelper","document","getElementsByClassName","s","n","done","value","addEventListener","err","f","events","target","start","selectionStart","end","selectionEnd","toLocaleUpperCase","setSelectionRange","replace","key","registerInputListeners","_step2","_iterator2","_step2$value","_slicedToArray","CHECK_INTERVAL_MS","_flags","hasClassHidden","hasClassFinal","setFlag","flag","_objectSpread","_defineProperty","getFlag","updateSecondRemainingText","remainingTimeElement","secondsRemaining","textContent","minutes","Math","floor","seconds","getTimeRemainingText","setElementToHidden","element","classList","add","setAttribute","interval","intervalCallback","options","shouldContinue","close","warningSeconds","finalWarningSeconds","now","Date","getSecondsRemaining","isWarning","isFinalWarning","isServiceClosed","bannerElement","remove","removeAttribute","updateWarningDisplay","innerBannerElement","updateFinalWarningDisplay","warningText1Element","warningText2Element","warningText3Element","closedTextElement","bannerTextElement","updateServiceClosedDisplay","checkElements","clearInterval","setupInterval","elements","contains","_remainingTimeElement","dateString","dataset","closeTime","closeDate","warningSecondsValue","parseInt","finalWarningSecondsValue","isNaN","getCloseAndWarningTimes","setInterval","initialise","getElementById","require","GOVUKInitAll","HMRCInitAll","ClearCookies","init","ProgressiveDisclosure","Webchat","window","onload","formUtils","outOfHours"],"sourceRoot":""}