katalyst-govuk-formbuilder 1.30.0 → 2.0.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.
- checksums.yaml +4 -4
- data/README.md +141 -15
- data/app/assets/builds/katalyst/govuk/formbuilder.css +77 -0
- data/app/assets/builds/katalyst/govuk/formbuilder.js +573 -10
- data/app/assets/builds/katalyst/govuk/formbuilder.min.js +8 -8
- data/app/assets/builds/katalyst/govuk/formbuilder.min.js.map +1 -1
- data/app/assets/stylesheets/katalyst/govuk/components/_index.scss +1 -0
- data/app/assets/stylesheets/katalyst/govuk/components/attachment/_index.scss +3 -0
- data/app/assets/stylesheets/katalyst/govuk/components/attachment/_mixin.scss +89 -0
- data/app/helpers/katalyst/govuk/form_builder/builder.rb +504 -0
- data/app/helpers/katalyst/govuk/form_builder/containers/fieldset_context.rb +19 -0
- data/app/helpers/katalyst/govuk/form_builder/elements/attachment.rb +80 -0
- data/app/helpers/katalyst/govuk/form_builder/elements/combobox.rb +85 -0
- data/app/helpers/katalyst/govuk/form_builder/elements/document.rb +68 -0
- data/app/helpers/katalyst/govuk/form_builder/elements/image.rb +65 -0
- data/app/helpers/katalyst/govuk/form_builder/elements/label.rb +38 -0
- data/app/helpers/katalyst/govuk/form_builder/elements/legend.rb +32 -0
- data/app/helpers/katalyst/govuk/form_builder/elements/rich_textarea.rb +70 -0
- data/app/helpers/katalyst/govuk/form_builder/frontend.rb +34 -0
- data/app/helpers/katalyst/govuk/form_builder/traits/attachment.rb +215 -0
- data/app/helpers/katalyst/govuk/form_builder/traits/file.rb +104 -0
- data/app/helpers/katalyst/govuk/form_builder/traits/label.rb +33 -0
- data/config/importmap.rb +1 -0
- data/config/locales/en.yml +16 -0
- data/lib/katalyst/govuk/form_builder/config.rb +20 -0
- data/lib/katalyst/govuk/form_builder/engine.rb +1 -1
- metadata +31 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formbuilder.min.js","sources":["../../../../../node_modules/govuk-frontend/dist/govuk/common/index.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/errors/index.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/component.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/common/configuration.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/i18n.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/button/button.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/common/closest-attribute-value.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs","../../../../javascript/katalyst/govuk/controllers/file_field_controller.js","../../../../javascript/katalyst/govuk/controllers/index.js","../../../../javascript/katalyst/govuk/controllers/document_field_controller.js","../../../../javascript/katalyst/govuk/controllers/image_field_controller.js","../../../../javascript/katalyst/govuk/formbuilder.js"],"sourcesContent":["function getBreakpoint(name) {\n const property = `--govuk-breakpoint-${name}`;\n const value = window.getComputedStyle(document.documentElement).getPropertyValue(property);\n return {\n property,\n value: value || undefined\n };\n}\nfunction setFocus($element, options = {}) {\n var _options$onBeforeFocu;\n const isFocusable = $element.getAttribute('tabindex');\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1');\n }\n function onFocus() {\n $element.addEventListener('blur', onBlur, {\n once: true\n });\n }\n function onBlur() {\n var _options$onBlur;\n (_options$onBlur = options.onBlur) == null || _options$onBlur.call($element);\n if (!isFocusable) {\n $element.removeAttribute('tabindex');\n }\n }\n $element.addEventListener('focus', onFocus, {\n once: true\n });\n (_options$onBeforeFocu = options.onBeforeFocus) == null || _options$onBeforeFocu.call($element);\n $element.focus();\n}\nfunction isInitialised($root, moduleName) {\n return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nfunction isSupported($scope = document.body) {\n if (!$scope) {\n return false;\n }\n return $scope.classList.contains('govuk-frontend-supported');\n}\nfunction isArray(option) {\n return Array.isArray(option);\n}\nfunction isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option);\n}\nfunction isScope($scope) {\n return !!$scope && ($scope instanceof Element || $scope instanceof Document);\n}\nfunction formatErrorMessage(Component, message) {\n return `${Component.moduleName}: ${message}`;\n}\n/**\n * @typedef ComponentWithModuleName\n * @property {string} moduleName - Name of the component\n */\n\nexport { formatErrorMessage, getBreakpoint, isInitialised, isObject, isScope, isSupported, setFocus };\n//# sourceMappingURL=index.mjs.map\n","import { isObject, formatErrorMessage } from '../common/index.mjs';\n\nclass GOVUKFrontendError extends Error {\n constructor(...args) {\n super(...args);\n this.name = 'GOVUKFrontendError';\n }\n}\nclass SupportError extends GOVUKFrontendError {\n /**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n */\n constructor($scope = document.body) {\n const supportMessage = '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';\n super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type=\"module\">`');\n this.name = 'SupportError';\n }\n}\nclass ConfigError extends GOVUKFrontendError {\n constructor(...args) {\n super(...args);\n this.name = 'ConfigError';\n }\n}\nclass ElementError extends GOVUKFrontendError {\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';\n if (isObject(messageOrOptions)) {\n const {\n component,\n identifier,\n element,\n expectedType\n } = messageOrOptions;\n message = identifier;\n message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';\n if (component) {\n message = formatErrorMessage(component, message);\n }\n }\n super(message);\n this.name = 'ElementError';\n }\n}\nclass InitError extends GOVUKFrontendError {\n constructor(componentOrMessage) {\n const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\\`$root\\`) already initialised`);\n super(message);\n this.name = 'InitError';\n }\n}\n/**\n * @import { ComponentWithModuleName } from '../common/index.mjs'\n */\n\nexport { ConfigError, ElementError, GOVUKFrontendError, InitError, SupportError };\n//# sourceMappingURL=index.mjs.map\n","import { isInitialised, isSupported } from './common/index.mjs';\nimport { InitError, ElementError, SupportError } from './errors/index.mjs';\n\nclass Component {\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {RootElementType} - the root element of component\n */\n get $root() {\n return this._$root;\n }\n constructor($root) {\n this._$root = void 0;\n const childConstructor = this.constructor;\n if (typeof childConstructor.moduleName !== 'string') {\n throw new InitError(`\\`moduleName\\` not defined in component`);\n }\n if (!($root instanceof childConstructor.elementType)) {\n throw new ElementError({\n element: $root,\n component: childConstructor,\n identifier: 'Root element (`$root`)',\n expectedType: childConstructor.elementType.name\n });\n } else {\n this._$root = $root;\n }\n childConstructor.checkSupport();\n this.checkInitialised();\n const moduleName = childConstructor.moduleName;\n this.$root.setAttribute(`data-${moduleName}-init`, '');\n }\n checkInitialised() {\n const constructor = this.constructor;\n const moduleName = constructor.moduleName;\n if (moduleName && isInitialised(this.$root, moduleName)) {\n throw new InitError(constructor);\n }\n }\n static checkSupport() {\n if (!isSupported()) {\n throw new SupportError();\n }\n }\n}\n\n/**\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n */\n\n/**\n * @typedef {typeof Component & ChildClass} ChildClassConstructor\n */\nComponent.elementType = HTMLElement;\n\nexport { Component };\n//# sourceMappingURL=component.mjs.map\n","import { Component } from '../component.mjs';\nimport { ConfigError } from '../errors/index.mjs';\nimport { isObject, formatErrorMessage, isScope } from './index.mjs';\n\nconst configOverride = Symbol.for('configOverride');\nclass ConfigurableComponent extends Component {\n [configOverride](param) {\n return {};\n }\n\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {ConfigurationType} - the root element of component\n */\n get config() {\n return this._config;\n }\n constructor($root, config) {\n super($root);\n this._config = void 0;\n const childConstructor = this.constructor;\n if (!isObject(childConstructor.defaults)) {\n throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));\n }\n const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);\n this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}, this[configOverride](datasetConfig), datasetConfig);\n }\n}\nfunction normaliseString(value, property) {\n const trimmedValue = value ? value.trim() : '';\n let output;\n let outputType = property == null ? void 0 : property.type;\n if (!outputType) {\n if (['true', 'false'].includes(trimmedValue)) {\n outputType = 'boolean';\n }\n if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {\n outputType = 'number';\n }\n }\n switch (outputType) {\n case 'boolean':\n output = trimmedValue === 'true';\n break;\n case 'number':\n output = Number(trimmedValue);\n break;\n default:\n output = value;\n }\n return output;\n}\nfunction normaliseDataset(Component, dataset) {\n if (!isObject(Component.schema)) {\n throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));\n }\n const out = {};\n const entries = Object.entries(Component.schema.properties);\n for (const entry of entries) {\n const [namespace, property] = entry;\n const field = namespace.toString();\n if (field in dataset) {\n out[field] = normaliseString(dataset[field], property);\n }\n if ((property == null ? void 0 : property.type) === 'object') {\n out[field] = extractConfigByNamespace(Component.schema, dataset, namespace);\n }\n }\n return out;\n}\nfunction normaliseOptions(scopeOrOptions) {\n let $scope = document;\n let onError;\n if (isObject(scopeOrOptions)) {\n const options = scopeOrOptions;\n if (isScope(options.scope) || options.scope === null) {\n $scope = options.scope;\n }\n if (typeof options.onError === 'function') {\n onError = options.onError;\n }\n }\n if (isScope(scopeOrOptions)) {\n $scope = scopeOrOptions;\n } else if (scopeOrOptions === null) {\n $scope = null;\n } else if (typeof scopeOrOptions === 'function') {\n onError = scopeOrOptions;\n }\n return {\n scope: $scope,\n onError\n };\n}\nfunction mergeConfigs(...configObjects) {\n const formattedConfigObject = {};\n for (const configObject of configObjects) {\n for (const key of Object.keys(configObject)) {\n const option = formattedConfigObject[key];\n const override = configObject[key];\n if (isObject(option) && isObject(override)) {\n formattedConfigObject[key] = mergeConfigs(option, override);\n } else {\n formattedConfigObject[key] = override;\n }\n }\n }\n return formattedConfigObject;\n}\nfunction validateConfig(schema, config) {\n const validationErrors = [];\n for (const [name, conditions] of Object.entries(schema)) {\n const errors = [];\n if (Array.isArray(conditions)) {\n for (const {\n required,\n errorMessage\n } of conditions) {\n if (!required.every(key => !!config[key])) {\n errors.push(errorMessage);\n }\n }\n if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {\n validationErrors.push(...errors);\n }\n }\n }\n return validationErrors;\n}\nfunction extractConfigByNamespace(schema, dataset, namespace) {\n const property = schema.properties[namespace];\n if ((property == null ? void 0 : property.type) !== 'object') {\n return;\n }\n const newObject = {\n [namespace]: {}\n };\n for (const [key, value] of Object.entries(dataset)) {\n let current = newObject;\n const keyParts = key.split('.');\n for (const [index, name] of keyParts.entries()) {\n if (isObject(current)) {\n if (index < keyParts.length - 1) {\n if (!isObject(current[name])) {\n current[name] = {};\n }\n current = current[name];\n } else if (key !== namespace) {\n current[name] = normaliseString(value);\n }\n }\n }\n }\n return newObject[namespace];\n}\n/**\n * Schema for component config\n *\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @typedef {object} Schema\n * @property {Record<keyof ConfigurationType, SchemaProperty | undefined>} properties - Schema properties\n * @property {SchemaCondition<ConfigurationType>[]} [anyOf] - List of schema conditions\n */\n/**\n * Schema property for component config\n *\n * @typedef {object} SchemaProperty\n * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type\n */\n/**\n * Schema condition for component config\n *\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @typedef {object} SchemaCondition\n * @property {(keyof ConfigurationType)[]} required - List of required config fields\n * @property {string} errorMessage - Error message when required config fields not provided\n */\n/**\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n * @property {Schema<ConfigurationType>} [schema] - The schema of the component configuration\n * @property {ConfigurationType} [defaults] - The default values of the configuration of the component\n */\n/**\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>\n */\n/**\n * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'\n */\n\nexport { ConfigurableComponent, configOverride, extractConfigByNamespace, mergeConfigs, normaliseDataset, normaliseOptions, normaliseString, validateConfig };\n//# sourceMappingURL=configuration.mjs.map\n","import { isObject } from './common/index.mjs';\n\nclass I18n {\n constructor(translations = {}, config = {}) {\n var _config$locale;\n this.translations = void 0;\n this.locale = void 0;\n this.translations = translations;\n this.locale = (_config$locale = config.locale) != null ? _config$locale : document.documentElement.lang || 'en';\n }\n t(lookupKey, options) {\n if (!lookupKey) {\n throw new Error('i18n: lookup key missing');\n }\n let translation = this.translations[lookupKey];\n if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {\n const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];\n if (translationPluralForm) {\n translation = translationPluralForm;\n }\n }\n if (typeof translation === 'string') {\n if (translation.match(/%{(.\\S+)}/)) {\n if (!options) {\n throw new Error('i18n: cannot replace placeholders in string if no option data provided');\n }\n return this.replacePlaceholders(translation, options);\n }\n return translation;\n }\n return lookupKey;\n }\n replacePlaceholders(translationString, options) {\n const formatter = Intl.NumberFormat.supportedLocalesOf(this.locale).length ? new Intl.NumberFormat(this.locale) : undefined;\n return translationString.replace(/%{(.\\S+)}/g, function (placeholderWithBraces, placeholderKey) {\n if (Object.prototype.hasOwnProperty.call(options, placeholderKey)) {\n const placeholderValue = options[placeholderKey];\n if (placeholderValue === false || typeof placeholderValue !== 'number' && typeof placeholderValue !== 'string') {\n return '';\n }\n if (typeof placeholderValue === 'number') {\n return formatter ? formatter.format(placeholderValue) : `${placeholderValue}`;\n }\n return placeholderValue;\n }\n throw new Error(`i18n: no data found to replace ${placeholderWithBraces} placeholder in string`);\n });\n }\n hasIntlPluralRulesSupport() {\n return Boolean('PluralRules' in window.Intl && Intl.PluralRules.supportedLocalesOf(this.locale).length);\n }\n getPluralSuffix(lookupKey, count) {\n count = Number(count);\n if (!isFinite(count)) {\n return 'other';\n }\n const translation = this.translations[lookupKey];\n const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';\n if (isObject(translation)) {\n if (preferredForm in translation) {\n return preferredForm;\n } else if ('other' in translation) {\n console.warn(`i18n: Missing plural form \".${preferredForm}\" for \"${this.locale}\" locale. Falling back to \".other\".`);\n return 'other';\n }\n }\n throw new Error(`i18n: Plural form \".other\" is required for \"${this.locale}\" locale`);\n }\n}\n\nexport { I18n };\n//# sourceMappingURL=i18n.mjs.map\n","import { ConfigurableComponent } from '../../common/configuration.mjs';\n\nconst DEBOUNCE_TIMEOUT_IN_SECONDS = 1;\n\n/**\n * JavaScript enhancements for the Button component\n *\n * @preserve\n * @augments ConfigurableComponent<ButtonConfig>\n */\nclass Button extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - HTML element to use for button\n * @param {ButtonConfig} [config] - Button config\n */\n constructor($root, config = {}) {\n super($root, config);\n this.debounceFormSubmitTimer = null;\n this.$root.addEventListener('keydown', event => this.handleKeyDown(event));\n this.$root.addEventListener('click', event => this.debounce(event));\n }\n handleKeyDown(event) {\n const $target = event.target;\n if (event.key !== ' ') {\n return;\n }\n if ($target instanceof HTMLElement && $target.getAttribute('role') === 'button') {\n event.preventDefault();\n $target.click();\n }\n }\n debounce(event) {\n if (!this.config.preventDoubleClick) {\n return;\n }\n if (this.debounceFormSubmitTimer) {\n event.preventDefault();\n return false;\n }\n this.debounceFormSubmitTimer = window.setTimeout(() => {\n this.debounceFormSubmitTimer = null;\n }, DEBOUNCE_TIMEOUT_IN_SECONDS * 1000);\n }\n}\n\n/**\n * Button config\n *\n * @typedef {object} ButtonConfig\n * @property {boolean} [preventDoubleClick=false] - Prevent accidental double\n * clicks on submit buttons from submitting forms multiple times.\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n */\nButton.moduleName = 'govuk-button';\nButton.defaults = Object.freeze({\n preventDoubleClick: false\n});\nButton.schema = Object.freeze({\n properties: {\n preventDoubleClick: {\n type: 'boolean'\n }\n }\n});\n\nexport { Button };\n//# sourceMappingURL=button.mjs.map\n","function closestAttributeValue($element, attributeName) {\n const $closestElementWithAttribute = $element.closest(`[${attributeName}]`);\n return $closestElementWithAttribute ? $closestElementWithAttribute.getAttribute(attributeName) : null;\n}\n\nexport { closestAttributeValue };\n//# sourceMappingURL=closest-attribute-value.mjs.map\n","import { closestAttributeValue } from '../../common/closest-attribute-value.mjs';\nimport { ConfigurableComponent, configOverride, validateConfig } from '../../common/configuration.mjs';\nimport { formatErrorMessage } from '../../common/index.mjs';\nimport { ElementError, ConfigError } from '../../errors/index.mjs';\nimport { I18n } from '../../i18n.mjs';\n\n/**\n * Character count component\n *\n * Tracks the number of characters or words in the `.govuk-js-character-count`\n * `<textarea>` inside the element. Displays a message with the remaining number\n * of characters/words available, or the number of characters/words in excess.\n *\n * You can configure the message to only appear after a certain percentage\n * of the available characters/words has been entered.\n *\n * @preserve\n * @augments ConfigurableComponent<CharacterCountConfig>\n */\nclass CharacterCount extends ConfigurableComponent {\n [configOverride](datasetConfig) {\n let configOverrides = {};\n if ('maxwords' in datasetConfig || 'maxlength' in datasetConfig) {\n configOverrides = {\n maxlength: undefined,\n maxwords: undefined\n };\n }\n return configOverrides;\n }\n\n /**\n * @param {Element | null} $root - HTML element to use for character count\n * @param {CharacterCountConfig} [config] - Character count config\n */\n constructor($root, config = {}) {\n var _ref, _this$config$maxwords;\n super($root, config);\n this.$textarea = void 0;\n this.count = 0;\n this.$visibleCountMessage = void 0;\n this.$screenReaderCountMessage = void 0;\n this.lastInputTimestamp = null;\n this.lastInputValue = '';\n this.valueChecker = null;\n this.i18n = void 0;\n this.maxLength = void 0;\n const $textarea = this.$root.querySelector('.govuk-js-character-count');\n if (!($textarea instanceof HTMLTextAreaElement || $textarea instanceof HTMLInputElement)) {\n throw new ElementError({\n component: CharacterCount,\n element: $textarea,\n expectedType: 'HTMLTextareaElement or HTMLInputElement',\n identifier: 'Form field (`.govuk-js-character-count`)'\n });\n }\n const errors = validateConfig(CharacterCount.schema, this.config);\n if (errors[0]) {\n throw new ConfigError(formatErrorMessage(CharacterCount, errors[0]));\n }\n this.i18n = new I18n(this.config.i18n, {\n locale: closestAttributeValue(this.$root, 'lang')\n });\n this.maxLength = (_ref = (_this$config$maxwords = this.config.maxwords) != null ? _this$config$maxwords : this.config.maxlength) != null ? _ref : Infinity;\n this.$textarea = $textarea;\n const textareaDescriptionId = `${this.$textarea.id}-info`;\n const $textareaDescription = document.getElementById(textareaDescriptionId);\n if (!$textareaDescription) {\n throw new ElementError({\n component: CharacterCount,\n element: $textareaDescription,\n identifier: `Count message (\\`id=\"${textareaDescriptionId}\"\\`)`\n });\n }\n this.$errorMessage = this.$root.querySelector('.govuk-error-message');\n if ($textareaDescription.textContent.match(/^\\s*$/)) {\n $textareaDescription.textContent = this.i18n.t('textareaDescription', {\n count: this.maxLength\n });\n }\n this.$textarea.insertAdjacentElement('afterend', $textareaDescription);\n const $screenReaderCountMessage = document.createElement('div');\n $screenReaderCountMessage.className = 'govuk-character-count__sr-status govuk-visually-hidden';\n $screenReaderCountMessage.setAttribute('aria-live', 'polite');\n this.$screenReaderCountMessage = $screenReaderCountMessage;\n $textareaDescription.insertAdjacentElement('afterend', $screenReaderCountMessage);\n const $visibleCountMessage = document.createElement('div');\n $visibleCountMessage.className = $textareaDescription.className;\n $visibleCountMessage.classList.add('govuk-character-count__status');\n $visibleCountMessage.setAttribute('aria-hidden', 'true');\n this.$visibleCountMessage = $visibleCountMessage;\n $textareaDescription.insertAdjacentElement('afterend', $visibleCountMessage);\n $textareaDescription.classList.add('govuk-visually-hidden');\n this.$textarea.removeAttribute('maxlength');\n this.bindChangeEvents();\n window.addEventListener('pageshow', () => {\n if (this.$textarea.value !== this.$textarea.textContent) {\n this.updateCount();\n this.updateCountMessage();\n }\n });\n this.updateCount();\n this.updateCountMessage();\n }\n bindChangeEvents() {\n this.$textarea.addEventListener('input', () => this.handleInput());\n this.$textarea.addEventListener('focus', () => this.handleFocus());\n this.$textarea.addEventListener('blur', () => this.handleBlur());\n }\n handleInput() {\n this.updateCount();\n this.updateVisibleCountMessage();\n this.lastInputTimestamp = Date.now();\n }\n handleFocus() {\n this.valueChecker = window.setInterval(() => {\n if (!this.lastInputTimestamp || Date.now() - 500 >= this.lastInputTimestamp) {\n this.updateIfValueChanged();\n }\n }, 1000);\n }\n handleBlur() {\n if (this.valueChecker) {\n window.clearInterval(this.valueChecker);\n }\n }\n updateIfValueChanged() {\n if (this.$textarea.value !== this.lastInputValue) {\n this.lastInputValue = this.$textarea.value;\n this.updateCountMessage();\n }\n }\n updateCountMessage() {\n this.updateVisibleCountMessage();\n this.updateScreenReaderCountMessage();\n }\n updateVisibleCountMessage() {\n const remainingNumber = this.maxLength - this.count;\n const isError = remainingNumber < 0;\n this.$visibleCountMessage.classList.toggle('govuk-character-count__message--disabled', !this.isOverThreshold());\n if (!this.$errorMessage) {\n this.$textarea.classList.toggle('govuk-textarea--error', isError);\n }\n this.$visibleCountMessage.classList.toggle('govuk-error-message', isError);\n this.$visibleCountMessage.classList.toggle('govuk-hint', !isError);\n this.$visibleCountMessage.textContent = this.getCountMessage();\n }\n updateScreenReaderCountMessage() {\n if (this.isOverThreshold()) {\n this.$screenReaderCountMessage.removeAttribute('aria-hidden');\n } else {\n this.$screenReaderCountMessage.setAttribute('aria-hidden', 'true');\n }\n this.$screenReaderCountMessage.textContent = this.getCountMessage();\n }\n updateCount() {\n const text = this.$textarea.value;\n if (this.config.maxwords) {\n var _text$match;\n const tokens = (_text$match = text.match(/\\S+/g)) != null ? _text$match : [];\n this.count = tokens.length;\n return;\n }\n this.count = text.length;\n }\n getCountMessage() {\n const remainingNumber = this.maxLength - this.count;\n const countType = this.config.maxwords ? 'words' : 'characters';\n return this.formatCountMessage(remainingNumber, countType);\n }\n formatCountMessage(remainingNumber, countType) {\n if (remainingNumber === 0) {\n return this.i18n.t(`${countType}AtLimit`);\n }\n const translationKeySuffix = remainingNumber < 0 ? 'OverLimit' : 'UnderLimit';\n return this.i18n.t(`${countType}${translationKeySuffix}`, {\n count: Math.abs(remainingNumber)\n });\n }\n isOverThreshold() {\n if (!this.config.threshold) {\n return true;\n }\n const currentLength = this.count;\n const maxLength = this.maxLength;\n const thresholdValue = maxLength * this.config.threshold / 100;\n return thresholdValue <= currentLength;\n }\n}\n\n/**\n * Character count config\n *\n * @see {@link CharacterCount.defaults}\n * @typedef {object} CharacterCountConfig\n * @property {number} [maxlength] - The maximum number of characters.\n * If maxwords is provided, the maxlength option will be ignored.\n * @property {number} [maxwords] - The maximum number of words. If maxwords is\n * provided, the maxlength option will be ignored.\n * @property {number} [threshold=0] - The percentage value of the limit at\n * which point the count message is displayed. If this attribute is set, the\n * count message will be hidden by default.\n * @property {CharacterCountTranslations} [i18n=CharacterCount.defaults.i18n] - Character count translations\n */\n\n/**\n * Character count translations\n *\n * @see {@link CharacterCount.defaults.i18n}\n * @typedef {object} CharacterCountTranslations\n *\n * Messages shown to users as they type. It provides feedback on how many words\n * or characters they have remaining or if they are over the limit. This also\n * includes a message used as an accessible description for the textarea.\n * @property {TranslationPluralForms} [charactersUnderLimit] - Message displayed\n * when the number of characters is under the configured maximum, `maxlength`.\n * This message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining characters. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {string} [charactersAtLimit] - Message displayed when the number of\n * characters reaches the configured maximum, `maxlength`. This message is\n * displayed visually and through assistive technologies.\n * @property {TranslationPluralForms} [charactersOverLimit] - Message displayed\n * when the number of characters is over the configured maximum, `maxlength`.\n * This message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining characters. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {TranslationPluralForms} [wordsUnderLimit] - Message displayed when\n * the number of words is under the configured maximum, `maxlength`. This\n * message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining words. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {string} [wordsAtLimit] - Message displayed when the number of\n * words reaches the configured maximum, `maxlength`. This message is\n * displayed visually and through assistive technologies.\n * @property {TranslationPluralForms} [wordsOverLimit] - Message displayed when\n * the number of words is over the configured maximum, `maxlength`. This\n * message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining words. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {TranslationPluralForms} [textareaDescription] - Message made\n * available to assistive technologies, if none is already present in the\n * HTML, to describe that the component accepts only a limited amount of\n * content. It is visible on the page when JavaScript is unavailable. The\n * component will replace the `%{count}` placeholder with the value of the\n * `maxlength` or `maxwords` parameter.\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n * @import { TranslationPluralForms } from '../../i18n.mjs'\n */\nCharacterCount.moduleName = 'govuk-character-count';\nCharacterCount.defaults = Object.freeze({\n threshold: 0,\n i18n: {\n charactersUnderLimit: {\n one: 'You have %{count} character remaining',\n other: 'You have %{count} characters remaining'\n },\n charactersAtLimit: 'You have 0 characters remaining',\n charactersOverLimit: {\n one: 'You have %{count} character too many',\n other: 'You have %{count} characters too many'\n },\n wordsUnderLimit: {\n one: 'You have %{count} word remaining',\n other: 'You have %{count} words remaining'\n },\n wordsAtLimit: 'You have 0 words remaining',\n wordsOverLimit: {\n one: 'You have %{count} word too many',\n other: 'You have %{count} words too many'\n },\n textareaDescription: {\n other: ''\n }\n }\n});\nCharacterCount.schema = Object.freeze({\n properties: {\n i18n: {\n type: 'object'\n },\n maxwords: {\n type: 'number'\n },\n maxlength: {\n type: 'number'\n },\n threshold: {\n type: 'number'\n }\n },\n anyOf: [{\n required: ['maxwords'],\n errorMessage: 'Either \"maxlength\" or \"maxwords\" must be provided'\n }, {\n required: ['maxlength'],\n errorMessage: 'Either \"maxlength\" or \"maxwords\" must be provided'\n }]\n});\n\nexport { CharacterCount };\n//# sourceMappingURL=character-count.mjs.map\n","import { Component } from '../../component.mjs';\nimport { ElementError } from '../../errors/index.mjs';\n\n/**\n * Checkboxes component\n *\n * @preserve\n */\nclass Checkboxes extends Component {\n /**\n * Checkboxes can be associated with a 'conditionally revealed' content block\n * – for example, a checkbox for 'Phone' could reveal an additional form field\n * for the user to enter their phone number.\n *\n * These associations are made using a `data-aria-controls` attribute, which\n * is promoted to an aria-controls attribute during initialisation.\n *\n * We also need to restore the state of any conditional reveals on the page\n * (for example if the user has navigated back), and set up event handlers to\n * keep the reveal in sync with the checkbox state.\n *\n * @param {Element | null} $root - HTML element to use for checkboxes\n */\n constructor($root) {\n super($root);\n this.$inputs = void 0;\n const $inputs = this.$root.querySelectorAll('input[type=\"checkbox\"]');\n if (!$inputs.length) {\n throw new ElementError({\n component: Checkboxes,\n identifier: 'Form inputs (`<input type=\"checkbox\">`)'\n });\n }\n this.$inputs = $inputs;\n this.$inputs.forEach($input => {\n const targetId = $input.getAttribute('data-aria-controls');\n if (!targetId) {\n return;\n }\n if (!document.getElementById(targetId)) {\n throw new ElementError({\n component: Checkboxes,\n identifier: `Conditional reveal (\\`id=\"${targetId}\"\\`)`\n });\n }\n $input.setAttribute('aria-controls', targetId);\n $input.removeAttribute('data-aria-controls');\n });\n window.addEventListener('pageshow', () => this.syncAllConditionalReveals());\n this.syncAllConditionalReveals();\n this.$root.addEventListener('click', event => this.handleClick(event));\n }\n syncAllConditionalReveals() {\n this.$inputs.forEach($input => this.syncConditionalRevealWithInputState($input));\n }\n syncConditionalRevealWithInputState($input) {\n const targetId = $input.getAttribute('aria-controls');\n if (!targetId) {\n return;\n }\n const $target = document.getElementById(targetId);\n if ($target != null && $target.classList.contains('govuk-checkboxes__conditional')) {\n const inputIsChecked = $input.checked;\n $input.setAttribute('aria-expanded', inputIsChecked.toString());\n $target.classList.toggle('govuk-checkboxes__conditional--hidden', !inputIsChecked);\n }\n }\n unCheckAllInputsExcept($input) {\n const allInputsWithSameName = document.querySelectorAll(`input[type=\"checkbox\"][name=\"${$input.name}\"]`);\n allInputsWithSameName.forEach($inputWithSameName => {\n const hasSameFormOwner = $input.form === $inputWithSameName.form;\n if (hasSameFormOwner && $inputWithSameName !== $input) {\n $inputWithSameName.checked = false;\n this.syncConditionalRevealWithInputState($inputWithSameName);\n }\n });\n }\n unCheckExclusiveInputs($input) {\n const allInputsWithSameNameAndExclusiveBehaviour = document.querySelectorAll(`input[data-behaviour=\"exclusive\"][type=\"checkbox\"][name=\"${$input.name}\"]`);\n allInputsWithSameNameAndExclusiveBehaviour.forEach($exclusiveInput => {\n const hasSameFormOwner = $input.form === $exclusiveInput.form;\n if (hasSameFormOwner) {\n $exclusiveInput.checked = false;\n this.syncConditionalRevealWithInputState($exclusiveInput);\n }\n });\n }\n handleClick(event) {\n const $clickedInput = event.target;\n if (!($clickedInput instanceof HTMLInputElement) || $clickedInput.type !== 'checkbox') {\n return;\n }\n const hasAriaControls = $clickedInput.getAttribute('aria-controls');\n if (hasAriaControls) {\n this.syncConditionalRevealWithInputState($clickedInput);\n }\n if (!$clickedInput.checked) {\n return;\n }\n const hasBehaviourExclusive = $clickedInput.getAttribute('data-behaviour') === 'exclusive';\n if (hasBehaviourExclusive) {\n this.unCheckAllInputsExcept($clickedInput);\n } else {\n this.unCheckExclusiveInputs($clickedInput);\n }\n }\n}\nCheckboxes.moduleName = 'govuk-checkboxes';\n\nexport { Checkboxes };\n//# sourceMappingURL=checkboxes.mjs.map\n","import { ConfigurableComponent } from '../../common/configuration.mjs';\nimport { setFocus } from '../../common/index.mjs';\n\n/**\n * Error summary component\n *\n * Takes focus on initialisation for accessible announcement, unless disabled in\n * configuration.\n *\n * @preserve\n * @augments ConfigurableComponent<ErrorSummaryConfig>\n */\nclass ErrorSummary extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - HTML element to use for error summary\n * @param {ErrorSummaryConfig} [config] - Error summary config\n */\n constructor($root, config = {}) {\n super($root, config);\n if (!this.config.disableAutoFocus) {\n setFocus(this.$root);\n }\n this.$root.addEventListener('click', event => this.handleClick(event));\n }\n handleClick(event) {\n const $target = event.target;\n if ($target && this.focusTarget($target)) {\n event.preventDefault();\n }\n }\n focusTarget($target) {\n if (!($target instanceof HTMLAnchorElement)) {\n return false;\n }\n const inputId = $target.hash.replace('#', '');\n if (!inputId) {\n return false;\n }\n const $input = document.getElementById(inputId);\n if (!$input) {\n return false;\n }\n const $legendOrLabel = this.getAssociatedLegendOrLabel($input);\n if (!$legendOrLabel) {\n return false;\n }\n $legendOrLabel.scrollIntoView();\n $input.focus({\n preventScroll: true\n });\n return true;\n }\n getAssociatedLegendOrLabel($input) {\n var _document$querySelect;\n const $fieldset = $input.closest('fieldset');\n if ($fieldset) {\n const $legends = $fieldset.getElementsByTagName('legend');\n if ($legends.length) {\n const $candidateLegend = $legends[0];\n if ($input instanceof HTMLInputElement && ($input.type === 'checkbox' || $input.type === 'radio')) {\n return $candidateLegend;\n }\n const legendTop = $candidateLegend.getBoundingClientRect().top;\n const inputRect = $input.getBoundingClientRect();\n if (inputRect.height && window.innerHeight) {\n const inputBottom = inputRect.top + inputRect.height;\n if (inputBottom - legendTop < window.innerHeight / 2) {\n return $candidateLegend;\n }\n }\n }\n }\n return (_document$querySelect = document.querySelector(`label[for='${$input.getAttribute('id')}']`)) != null ? _document$querySelect : $input.closest('label');\n }\n}\n\n/**\n * Error summary config\n *\n * @typedef {object} ErrorSummaryConfig\n * @property {boolean} [disableAutoFocus=false] - If set to `true` the error\n * summary will not be focussed when the page loads.\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n */\nErrorSummary.moduleName = 'govuk-error-summary';\nErrorSummary.defaults = Object.freeze({\n disableAutoFocus: false\n});\nErrorSummary.schema = Object.freeze({\n properties: {\n disableAutoFocus: {\n type: 'boolean'\n }\n }\n});\n\nexport { ErrorSummary };\n//# sourceMappingURL=error-summary.mjs.map\n","import { closestAttributeValue } from '../../common/closest-attribute-value.mjs';\nimport { ConfigurableComponent } from '../../common/configuration.mjs';\nimport { ElementError } from '../../errors/index.mjs';\nimport { I18n } from '../../i18n.mjs';\n\n/**\n * File upload component\n *\n * @preserve\n * @augments ConfigurableComponent<FileUploadConfig>\n */\nclass FileUpload extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - File input element\n * @param {FileUploadConfig} [config] - File Upload config\n */\n constructor($root, config = {}) {\n super($root, config);\n this.$input = void 0;\n this.$button = void 0;\n this.$status = void 0;\n this.$label = void 0;\n this.i18n = void 0;\n this.id = void 0;\n this.$announcements = void 0;\n this.enteredAnotherElement = void 0;\n const $input = this.$root.querySelector('input[type=\"file\"]');\n if ($input === null) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File inputs (`<input type=\"file\">`)'\n });\n }\n this.$input = $input;\n if (!this.$input.id) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File input (`<input type=\"file\">`) attribute (`id`)'\n });\n }\n this.id = this.$input.id;\n this.i18n = new I18n(this.config.i18n, {\n locale: closestAttributeValue(this.$root, 'lang')\n });\n const $label = this.findLabel();\n if (!$label.id) {\n $label.id = `${this.id}-label`;\n }\n this.$label = $label;\n this.$input.id = `${this.id}-input`;\n this.$input.setAttribute('hidden', 'hidden');\n this.$status = this.createStatus();\n this.$button = this.createButton();\n this.$root.insertAdjacentElement('afterbegin', this.$button);\n this.$input.addEventListener('change', this.onChange.bind(this));\n this.updateDisabledState();\n this.observeDisabledState();\n this.$announcements = document.createElement('span');\n this.$announcements.classList.add('govuk-file-upload-announcements');\n this.$announcements.classList.add('govuk-visually-hidden');\n this.$announcements.setAttribute('aria-live', 'assertive');\n this.$root.insertAdjacentElement('afterend', this.$announcements);\n this.bindDraggingEvents();\n }\n createStatus() {\n const $status = document.createElement('span');\n $status.className = 'govuk-body govuk-file-upload-button__status';\n $status.setAttribute('aria-live', 'polite');\n $status.innerText = this.i18n.t('noFileChosen');\n return $status;\n }\n createButton() {\n const $button = document.createElement('button');\n $button.classList.add('govuk-file-upload-button');\n $button.type = 'button';\n $button.id = this.id;\n $button.classList.add('govuk-file-upload-button--empty');\n const ariaDescribedBy = this.$input.getAttribute('aria-describedby');\n if (ariaDescribedBy) {\n $button.setAttribute('aria-describedby', ariaDescribedBy);\n }\n $button.appendChild(this.$status);\n const commaSpan = document.createElement('span');\n commaSpan.className = 'govuk-visually-hidden';\n commaSpan.innerText = ', ';\n commaSpan.id = `${this.id}-comma`;\n $button.appendChild(commaSpan);\n const containerSpan = document.createElement('span');\n containerSpan.className = 'govuk-file-upload-button__pseudo-button-container';\n const buttonSpan = document.createElement('span');\n buttonSpan.className = 'govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button';\n buttonSpan.innerText = this.i18n.t('chooseFilesButton');\n containerSpan.appendChild(buttonSpan);\n containerSpan.insertAdjacentText('beforeend', ' ');\n const instructionSpan = document.createElement('span');\n instructionSpan.className = 'govuk-body govuk-file-upload-button__instruction';\n instructionSpan.innerText = this.i18n.t('dropInstruction');\n containerSpan.appendChild(instructionSpan);\n $button.appendChild(containerSpan);\n $button.setAttribute('aria-labelledby', `${this.$label.id} ${commaSpan.id} ${$button.id}`);\n $button.addEventListener('click', this.onClick.bind(this));\n $button.addEventListener('dragover', event => {\n event.preventDefault();\n });\n return $button;\n }\n bindDraggingEvents() {\n this.$button.addEventListener('drop', this.onDrop.bind(this));\n document.addEventListener('dragenter', this.updateDropzoneVisibility.bind(this));\n document.addEventListener('dragenter', () => {\n this.enteredAnotherElement = true;\n });\n document.addEventListener('dragleave', () => {\n if (!this.enteredAnotherElement && !this.$button.disabled) {\n this.hideDraggingState();\n this.$announcements.innerText = this.i18n.t('leftDropZone');\n }\n this.enteredAnotherElement = false;\n });\n }\n updateDropzoneVisibility(event) {\n if (this.$button.disabled) return;\n if (event.target instanceof Node) {\n if (this.$root.contains(event.target)) {\n if (event.dataTransfer && this.canDrop(event.dataTransfer)) {\n if (!this.$button.classList.contains('govuk-file-upload-button--dragging')) {\n this.showDraggingState();\n this.$announcements.innerText = this.i18n.t('enteredDropZone');\n }\n }\n } else {\n if (this.$button.classList.contains('govuk-file-upload-button--dragging')) {\n this.hideDraggingState();\n this.$announcements.innerText = this.i18n.t('leftDropZone');\n }\n }\n }\n }\n showDraggingState() {\n this.$button.classList.add('govuk-file-upload-button--dragging');\n }\n hideDraggingState() {\n this.$button.classList.remove('govuk-file-upload-button--dragging');\n }\n onDrop(event) {\n event.preventDefault();\n if (event.dataTransfer && this.canFillInput(event.dataTransfer)) {\n this.$input.files = event.dataTransfer.files;\n this.$input.dispatchEvent(new CustomEvent('change'));\n this.hideDraggingState();\n }\n }\n canFillInput(dataTransfer) {\n return this.matchesInputCapacity(dataTransfer.files.length);\n }\n canDrop(dataTransfer) {\n if (dataTransfer.items.length) {\n return this.matchesInputCapacity(countFileItems(dataTransfer.items));\n }\n if (dataTransfer.types.length) {\n return dataTransfer.types.includes('Files');\n }\n return true;\n }\n matchesInputCapacity(numberOfFiles) {\n if (this.$input.multiple) {\n return numberOfFiles > 0;\n }\n return numberOfFiles === 1;\n }\n onChange() {\n const fileCount = this.$input.files.length;\n if (fileCount === 0) {\n this.$status.innerText = this.i18n.t('noFileChosen');\n this.$button.classList.add('govuk-file-upload-button--empty');\n } else {\n if (fileCount === 1) {\n this.$status.innerText = this.$input.files[0].name;\n } else {\n this.$status.innerText = this.i18n.t('multipleFilesChosen', {\n count: fileCount\n });\n }\n this.$button.classList.remove('govuk-file-upload-button--empty');\n }\n }\n findLabel() {\n const $label = document.querySelector(`label[for=\"${this.$input.id}\"]`);\n if (!$label) {\n throw new ElementError({\n component: FileUpload,\n identifier: `Field label (\\`<label for=${this.$input.id}>\\`)`\n });\n }\n return $label;\n }\n onClick() {\n this.$input.click();\n }\n observeDisabledState() {\n const observer = new MutationObserver(mutationList => {\n for (const mutation of mutationList) {\n if (mutation.type === 'attributes' && mutation.attributeName === 'disabled') {\n this.updateDisabledState();\n }\n }\n });\n observer.observe(this.$input, {\n attributes: true\n });\n }\n updateDisabledState() {\n this.$button.disabled = this.$input.disabled;\n this.$root.classList.toggle('govuk-file-upload-wrapper--disabled', this.$button.disabled);\n }\n}\n\n/**\n * Counts the number of `DataTransferItem` whose kind is `file`\n *\n * @param {DataTransferItemList} list - The list\n * @returns {number} - The number of items whose kind is `file` in the list\n */\nFileUpload.moduleName = 'govuk-file-upload';\nFileUpload.defaults = Object.freeze({\n i18n: {\n chooseFilesButton: 'Choose file',\n dropInstruction: 'or drop file',\n noFileChosen: 'No file chosen',\n multipleFilesChosen: {\n one: '%{count} file chosen',\n other: '%{count} files chosen'\n },\n enteredDropZone: 'Entered drop zone',\n leftDropZone: 'Left drop zone'\n }\n});\nFileUpload.schema = Object.freeze({\n properties: {\n i18n: {\n type: 'object'\n }\n }\n});\nfunction countFileItems(list) {\n let result = 0;\n for (let i = 0; i < list.length; i++) {\n if (list[i].kind === 'file') {\n result++;\n }\n }\n return result;\n}\n\n/**\n * @typedef {HTMLInputElement & {files: FileList}} HTMLFileInputElement\n */\n\n/**\n * File upload config\n *\n * @see {@link FileUpload.defaults}\n * @typedef {object} FileUploadConfig\n * @property {FileUploadTranslations} [i18n=FileUpload.defaults.i18n] - File upload translations\n */\n\n/**\n * File upload translations\n *\n * @see {@link FileUpload.defaults.i18n}\n * @typedef {object} FileUploadTranslations\n *\n * Messages used by the component\n * @property {string} [chooseFile] - The text of the button that opens the file picker\n * @property {string} [dropInstruction] - The text informing users they can drop files\n * @property {TranslationPluralForms} [multipleFilesChosen] - The text displayed when multiple files\n * have been chosen by the user\n * @property {string} [noFileChosen] - The text to displayed when no file has been chosen by the user\n * @property {string} [enteredDropZone] - The text announced by assistive technology\n * when user drags files and enters the drop zone\n * @property {string} [leftDropZone] - The text announced by assistive technology\n * when user drags files and leaves the drop zone without dropping\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n * @import { TranslationPluralForms } from '../../i18n.mjs'\n */\n\nexport { FileUpload };\n//# sourceMappingURL=file-upload.mjs.map\n","import { closestAttributeValue } from '../../common/closest-attribute-value.mjs';\nimport { ConfigurableComponent } from '../../common/configuration.mjs';\nimport { ElementError } from '../../errors/index.mjs';\nimport { I18n } from '../../i18n.mjs';\n\n/**\n * Password input component\n *\n * @preserve\n * @augments ConfigurableComponent<PasswordInputConfig>\n */\nclass PasswordInput extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - HTML element to use for password input\n * @param {PasswordInputConfig} [config] - Password input config\n */\n constructor($root, config = {}) {\n super($root, config);\n this.i18n = void 0;\n this.$input = void 0;\n this.$showHideButton = void 0;\n this.$screenReaderStatusMessage = void 0;\n const $input = this.$root.querySelector('.govuk-js-password-input-input');\n if (!($input instanceof HTMLInputElement)) {\n throw new ElementError({\n component: PasswordInput,\n element: $input,\n expectedType: 'HTMLInputElement',\n identifier: 'Form field (`.govuk-js-password-input-input`)'\n });\n }\n if ($input.type !== 'password') {\n throw new ElementError('Password input: Form field (`.govuk-js-password-input-input`) must be of type `password`.');\n }\n const $showHideButton = this.$root.querySelector('.govuk-js-password-input-toggle');\n if (!($showHideButton instanceof HTMLButtonElement)) {\n throw new ElementError({\n component: PasswordInput,\n element: $showHideButton,\n expectedType: 'HTMLButtonElement',\n identifier: 'Button (`.govuk-js-password-input-toggle`)'\n });\n }\n if ($showHideButton.type !== 'button') {\n throw new ElementError('Password input: Button (`.govuk-js-password-input-toggle`) must be of type `button`.');\n }\n this.$input = $input;\n this.$showHideButton = $showHideButton;\n this.i18n = new I18n(this.config.i18n, {\n locale: closestAttributeValue(this.$root, 'lang')\n });\n this.$showHideButton.removeAttribute('hidden');\n const $screenReaderStatusMessage = document.createElement('div');\n $screenReaderStatusMessage.className = 'govuk-password-input__sr-status govuk-visually-hidden';\n $screenReaderStatusMessage.setAttribute('aria-live', 'polite');\n this.$screenReaderStatusMessage = $screenReaderStatusMessage;\n this.$input.insertAdjacentElement('afterend', $screenReaderStatusMessage);\n this.$showHideButton.addEventListener('click', this.toggle.bind(this));\n if (this.$input.form) {\n this.$input.form.addEventListener('submit', () => this.hide());\n }\n window.addEventListener('pageshow', event => {\n if (event.persisted && this.$input.type !== 'password') {\n this.hide();\n }\n });\n this.hide();\n }\n toggle(event) {\n event.preventDefault();\n if (this.$input.type === 'password') {\n this.show();\n return;\n }\n this.hide();\n }\n show() {\n this.setType('text');\n }\n hide() {\n this.setType('password');\n }\n setType(type) {\n if (type === this.$input.type) {\n return;\n }\n this.$input.setAttribute('type', type);\n const isHidden = type === 'password';\n const prefixButton = isHidden ? 'show' : 'hide';\n const prefixStatus = isHidden ? 'passwordHidden' : 'passwordShown';\n this.$showHideButton.innerText = this.i18n.t(`${prefixButton}Password`);\n this.$showHideButton.setAttribute('aria-label', this.i18n.t(`${prefixButton}PasswordAriaLabel`));\n this.$screenReaderStatusMessage.innerText = this.i18n.t(`${prefixStatus}Announcement`);\n }\n}\n\n/**\n * Password input config\n *\n * @typedef {object} PasswordInputConfig\n * @property {PasswordInputTranslations} [i18n=PasswordInput.defaults.i18n] - Password input translations\n */\n\n/**\n * Password input translations\n *\n * @see {@link PasswordInput.defaults.i18n}\n * @typedef {object} PasswordInputTranslations\n *\n * Messages displayed to the user indicating the state of the show/hide toggle.\n * @property {string} [showPassword] - Visible text of the button when the\n * password is currently hidden. Plain text only.\n * @property {string} [hidePassword] - Visible text of the button when the\n * password is currently visible. Plain text only.\n * @property {string} [showPasswordAriaLabel] - aria-label of the button when\n * the password is currently hidden. Plain text only.\n * @property {string} [hidePasswordAriaLabel] - aria-label of the button when\n * the password is currently visible. Plain text only.\n * @property {string} [passwordShownAnnouncement] - Screen reader\n * announcement to make when the password has just become visible.\n * Plain text only.\n * @property {string} [passwordHiddenAnnouncement] - Screen reader\n * announcement to make when the password has just been hidden.\n * Plain text only.\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n */\nPasswordInput.moduleName = 'govuk-password-input';\nPasswordInput.defaults = Object.freeze({\n i18n: {\n showPassword: 'Show',\n hidePassword: 'Hide',\n showPasswordAriaLabel: 'Show password',\n hidePasswordAriaLabel: 'Hide password',\n passwordShownAnnouncement: 'Your password is visible',\n passwordHiddenAnnouncement: 'Your password is hidden'\n }\n});\nPasswordInput.schema = Object.freeze({\n properties: {\n i18n: {\n type: 'object'\n }\n }\n});\n\nexport { PasswordInput };\n//# sourceMappingURL=password-input.mjs.map\n","import { Component } from '../../component.mjs';\nimport { ElementError } from '../../errors/index.mjs';\n\n/**\n * Radios component\n *\n * @preserve\n */\nclass Radios extends Component {\n /**\n * Radios can be associated with a 'conditionally revealed' content block –\n * for example, a radio for 'Phone' could reveal an additional form field for\n * the user to enter their phone number.\n *\n * These associations are made using a `data-aria-controls` attribute, which\n * is promoted to an aria-controls attribute during initialisation.\n *\n * We also need to restore the state of any conditional reveals on the page\n * (for example if the user has navigated back), and set up event handlers to\n * keep the reveal in sync with the radio state.\n *\n * @param {Element | null} $root - HTML element to use for radios\n */\n constructor($root) {\n super($root);\n this.$inputs = void 0;\n const $inputs = this.$root.querySelectorAll('input[type=\"radio\"]');\n if (!$inputs.length) {\n throw new ElementError({\n component: Radios,\n identifier: 'Form inputs (`<input type=\"radio\">`)'\n });\n }\n this.$inputs = $inputs;\n this.$inputs.forEach($input => {\n const targetId = $input.getAttribute('data-aria-controls');\n if (!targetId) {\n return;\n }\n if (!document.getElementById(targetId)) {\n throw new ElementError({\n component: Radios,\n identifier: `Conditional reveal (\\`id=\"${targetId}\"\\`)`\n });\n }\n $input.setAttribute('aria-controls', targetId);\n $input.removeAttribute('data-aria-controls');\n });\n window.addEventListener('pageshow', () => this.syncAllConditionalReveals());\n this.syncAllConditionalReveals();\n this.$root.addEventListener('click', event => this.handleClick(event));\n }\n syncAllConditionalReveals() {\n this.$inputs.forEach($input => this.syncConditionalRevealWithInputState($input));\n }\n syncConditionalRevealWithInputState($input) {\n const targetId = $input.getAttribute('aria-controls');\n if (!targetId) {\n return;\n }\n const $target = document.getElementById(targetId);\n if ($target != null && $target.classList.contains('govuk-radios__conditional')) {\n const inputIsChecked = $input.checked;\n $input.setAttribute('aria-expanded', inputIsChecked.toString());\n $target.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked);\n }\n }\n handleClick(event) {\n const $clickedInput = event.target;\n if (!($clickedInput instanceof HTMLInputElement) || $clickedInput.type !== 'radio') {\n return;\n }\n const $allInputs = document.querySelectorAll('input[type=\"radio\"][aria-controls]');\n const $clickedInputForm = $clickedInput.form;\n const $clickedInputName = $clickedInput.name;\n $allInputs.forEach($input => {\n const hasSameFormOwner = $input.form === $clickedInputForm;\n const hasSameName = $input.name === $clickedInputName;\n if (hasSameName && hasSameFormOwner) {\n this.syncConditionalRevealWithInputState($input);\n }\n });\n }\n}\nRadios.moduleName = 'govuk-radios';\n\nexport { Radios };\n//# sourceMappingURL=radios.mjs.map\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class FileFieldController extends Controller {\n static targets = [\"preview\", \"destroy\"];\n static values = {\n mimeTypes: Array,\n };\n\n connect() {\n this.counter = 0;\n this.initialPreviewContent = null;\n this.onUploadFlag = false;\n }\n\n onUpload(event) {\n this.onUploadFlag = true;\n\n // Set the file to be destroyed only if it is already persisted\n if (this.hasDestroyTarget) {\n this.destroyTarget.value = false;\n }\n this.previewTarget.removeAttribute(\"hidden\");\n\n // Show preview only if a file has been selected in the file picker popup. If cancelled, show previous file or do\n // not show preview at all\n if (this.hasPreviewTarget) {\n if (event.currentTarget.files.length > 0) {\n this.showPreview(event.currentTarget.files[0]);\n } else {\n this.setPreviewContent(this.initialPreviewContent);\n }\n }\n }\n\n setDestroy(event) {\n event.preventDefault();\n\n // If the data is already persisted and another image has been picked from the file picker popup, but the new image\n // is removed, show the original image\n if (this.initialPreviewContent && this.onUploadFlag) {\n this.onUploadFlag = false;\n this.setPreviewContent(this.initialPreviewContent);\n } else {\n // Set image to be destroyed, hide preview and remove image url\n if (this.hasDestroyTarget) {\n this.destroyTarget.value = true;\n }\n if (this.hasPreviewTarget) {\n this.previewTarget.setAttribute(\"hidden\", \"\");\n this.setPreviewContent(\"\");\n }\n if (this.previousInput) {\n this.previousInput.toggleAttribute(\"disabled\", true);\n }\n }\n\n this.fileInput.value = \"\";\n }\n\n setPreviewContent(content) {\n if (this.filenameTag) {\n this.filenameTag.innerText = text;\n }\n }\n\n drop(event) {\n event.preventDefault();\n\n const file = this.fileForEvent(event, this.mimeTypesValue);\n if (file) {\n const dT = new DataTransfer();\n dT.items.add(file);\n this.fileInput.files = dT.files;\n this.fileInput.dispatchEvent(new Event(\"change\"));\n }\n\n this.counter = 0;\n this.element.classList.remove(\"droppable\");\n }\n\n dragover(event) {\n event.preventDefault();\n }\n\n dragenter(event) {\n event.preventDefault();\n\n if (this.counter === 0) {\n this.element.classList.add(\"droppable\");\n }\n this.counter++;\n }\n\n dragleave(event) {\n event.preventDefault();\n\n this.counter--;\n if (this.counter === 0) {\n this.element.classList.remove(\"droppable\");\n }\n }\n\n get fileInput() {\n return this.element.querySelector(\"input[type='file']\");\n }\n\n get previousInput() {\n return this.element.querySelector(\n `input[type='hidden'][name='${this.fileInput.name}']`,\n );\n }\n\n get filenameTag() {\n if (!this.hasPreviewTarget) return null;\n\n return this.previewTarget.querySelector(\"p.preview-filename\");\n }\n\n showPreview(file) {\n const reader = new FileReader();\n\n reader.onload = (e) => {\n if (this.filenameTag) {\n this.filenameTag.innerText = file.name;\n }\n };\n reader.readAsDataURL(file);\n }\n\n /**\n * Given a drop event, find the first acceptable file.\n * @param event {DropEvent}\n * @param mimeTypes {String[]}\n * @returns {File}\n */\n fileForEvent(event, mimeTypes) {\n const accept = (file) => mimeTypes.indexOf(file.type) > -1;\n\n let file;\n\n if (event.dataTransfer.items) {\n const item = [...event.dataTransfer.items].find(accept);\n if (item) {\n file = item.getAsFile();\n }\n } else {\n file = [...event.dataTransfer.files].find(accept);\n }\n\n return file;\n }\n}\n","import DocumentFieldController from \"./document_field_controller\";\nimport ImageFieldController from \"./image_field_controller\";\n\nconst Definitions = [\n {\n identifier: \"govuk-document-field\",\n controllerConstructor: DocumentFieldController,\n },\n {\n identifier: \"govuk-image-field\",\n controllerConstructor: ImageFieldController,\n },\n];\n\nexport { Definitions as default };\n","import FileFieldController from \"./file_field_controller\";\n\nexport default class DocumentFieldController extends FileFieldController {\n connect() {\n super.connect();\n\n this.initialPreviewContent = this.filenameTag.text;\n }\n\n setPreviewContent(content) {\n this.filenameTag.innerText = content;\n }\n\n showPreview(file) {\n const reader = new FileReader();\n\n reader.onload = (e) => {\n if (this.filenameTag) {\n this.filenameTag.innerText = file.name;\n }\n };\n reader.readAsDataURL(file);\n }\n\n get filenameTag() {\n return this.previewTarget.querySelector(\"p.preview-filename\");\n }\n}\n","import FileFieldController from \"./file_field_controller\";\n\nexport default class ImageFieldController extends FileFieldController {\n connect() {\n super.connect();\n\n this.initialPreviewContent = this.imageTag.getAttribute(\"src\");\n }\n\n setPreviewContent(content) {\n this.imageTag.src = content;\n }\n\n showPreview(file) {\n const reader = new FileReader();\n\n reader.onload = (e) => {\n this.imageTag.src = e.target.result;\n };\n reader.readAsDataURL(file);\n }\n\n get imageTag() {\n return this.previewTarget.querySelector(\"img\");\n }\n}\n","import {\n Button,\n CharacterCount,\n Checkboxes,\n ErrorSummary,\n FileUpload,\n PasswordInput,\n Radios,\n} from \"govuk-frontend/dist/govuk/all.mjs\";\nimport { SupportError } from \"govuk-frontend/dist/govuk/errors/index.mjs\";\nimport { isSupported } from \"govuk-frontend/dist/govuk/common/index.mjs\";\n\nfunction initAll(config) {\n let _config$scope;\n config = typeof config !== \"undefined\" ? config : {};\n if (!isSupported()) {\n console.log(new SupportError());\n return;\n }\n const components = [\n [Button, config.button],\n [CharacterCount, config.characterCount],\n [Checkboxes],\n [ErrorSummary, config.errorSummary],\n [FileUpload, config.fileUpload],\n [Radios],\n [PasswordInput, config.passwordInput],\n ];\n const $scope =\n (_config$scope = config.scope) != null ? _config$scope : document;\n components.forEach(([Component, config]) => {\n const $elements = $scope.querySelectorAll(\n `[data-module=\"${Component.moduleName}\"]`,\n );\n $elements.forEach(($element) => {\n try {\n \"defaults\" in Component\n ? new Component($element, config)\n : new Component($element);\n } catch (error) {\n console.log(error);\n }\n });\n });\n}\n\n// stimulus controllers\nimport controllers from \"./controllers\";\n\nexport {\n controllers as default,\n initAll,\n Button,\n CharacterCount,\n Checkboxes,\n ErrorSummary,\n PasswordInput,\n Radios,\n};\n"],"names":["isSupported","$scope","document","body","classList","contains","isObject","option","Array","isArray","formatErrorMessage","Component","message","moduleName","GOVUKFrontendError","Error","constructor","args","super","this","name","SupportError","supportMessage","HTMLScriptElement","prototype","ConfigError","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","$root","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","HTMLElement","hasAttribute","isInitialised","configOverride","Symbol","for","ConfigurableComponent","param","config","_config","defaults","datasetConfig","dataset","schema","out","entries","Object","properties","entry","namespace","property","field","toString","normaliseString","type","extractConfigByNamespace","normaliseDataset","mergeConfigs","value","trimmedValue","trim","output","outputType","includes","length","isFinite","Number","configObjects","formattedConfigObject","configObject","key","keys","override","newObject","current","keyParts","split","index","I18n","translations","_config$locale","locale","documentElement","lang","t","lookupKey","options","translation","count","translationPluralForm","getPluralSuffix","match","replacePlaceholders","translationString","formatter","Intl","NumberFormat","supportedLocalesOf","undefined","replace","placeholderWithBraces","placeholderKey","hasOwnProperty","call","placeholderValue","format","hasIntlPluralRulesSupport","Boolean","window","PluralRules","preferredForm","select","console","warn","Button","debounceFormSubmitTimer","addEventListener","event","handleKeyDown","debounce","$target","target","getAttribute","preventDefault","click","preventDoubleClick","setTimeout","DEBOUNCE_TIMEOUT_IN_SECONDS","closestAttributeValue","$element","attributeName","$closestElementWithAttribute","closest","freeze","CharacterCount","configOverrides","maxlength","maxwords","_ref","_this$config$maxwords","$textarea","$visibleCountMessage","$screenReaderCountMessage","lastInputTimestamp","lastInputValue","valueChecker","i18n","maxLength","querySelector","HTMLTextAreaElement","HTMLInputElement","errors","validationErrors","conditions","required","errorMessage","every","push","validateConfig","Infinity","textareaDescriptionId","id","$textareaDescription","getElementById","$errorMessage","textContent","insertAdjacentElement","createElement","className","add","removeAttribute","bindChangeEvents","updateCount","updateCountMessage","handleInput","handleFocus","handleBlur","updateVisibleCountMessage","Date","now","setInterval","updateIfValueChanged","clearInterval","updateScreenReaderCountMessage","isError","toggle","isOverThreshold","getCountMessage","text","_text$match","tokens","remainingNumber","countType","formatCountMessage","translationKeySuffix","Math","abs","threshold","currentLength","charactersUnderLimit","one","other","charactersAtLimit","charactersOverLimit","wordsUnderLimit","wordsAtLimit","wordsOverLimit","textareaDescription","anyOf","Checkboxes","$inputs","querySelectorAll","forEach","$input","targetId","syncAllConditionalReveals","handleClick","syncConditionalRevealWithInputState","inputIsChecked","checked","unCheckAllInputsExcept","$inputWithSameName","form","unCheckExclusiveInputs","$exclusiveInput","$clickedInput","ErrorSummary","disableAutoFocus","_options$onBeforeFocu","isFocusable","onBlur","_options$onBlur","once","onBeforeFocus","focus","setFocus","focusTarget","HTMLAnchorElement","inputId","hash","$legendOrLabel","getAssociatedLegendOrLabel","scrollIntoView","preventScroll","_document$querySelect","$fieldset","$legends","getElementsByTagName","$candidateLegend","legendTop","getBoundingClientRect","top","inputRect","height","innerHeight","FileUpload","$button","$status","$label","$announcements","enteredAnotherElement","findLabel","createStatus","createButton","onChange","bind","updateDisabledState","observeDisabledState","bindDraggingEvents","innerText","ariaDescribedBy","appendChild","commaSpan","containerSpan","buttonSpan","insertAdjacentText","instructionSpan","onClick","onDrop","updateDropzoneVisibility","disabled","hideDraggingState","Node","dataTransfer","canDrop","showDraggingState","remove","canFillInput","files","dispatchEvent","CustomEvent","matchesInputCapacity","items","list","result","i","kind","countFileItems","types","numberOfFiles","multiple","fileCount","MutationObserver","mutationList","mutation","observe","attributes","chooseFilesButton","dropInstruction","noFileChosen","multipleFilesChosen","enteredDropZone","leftDropZone","PasswordInput","$showHideButton","$screenReaderStatusMessage","HTMLButtonElement","hide","persisted","show","setType","isHidden","prefixButton","prefixStatus","showPassword","hidePassword","showPasswordAriaLabel","hidePasswordAriaLabel","passwordShownAnnouncement","passwordHiddenAnnouncement","Radios","$allInputs","$clickedInputForm","$clickedInputName","hasSameFormOwner","FileFieldController","Controller","static","mimeTypes","connect","counter","initialPreviewContent","onUploadFlag","onUpload","hasDestroyTarget","destroyTarget","previewTarget","hasPreviewTarget","currentTarget","showPreview","setPreviewContent","setDestroy","previousInput","toggleAttribute","fileInput","content","filenameTag","drop","file","fileForEvent","mimeTypesValue","dT","DataTransfer","Event","dragover","dragenter","dragleave","reader","FileReader","onload","e","readAsDataURL","accept","indexOf","item","find","getAsFile","Definitions","controllerConstructor","imageTag","src","initAll","_config$scope","log","components","button","characterCount","errorSummary","fileUpload","passwordInput","scope","error"],"mappings":"gDA6CA,SAASA,EAAYC,EAASC,SAASC,MACrC,QAAKF,GAGEA,EAAOG,UAAUC,SAAS,2BACnC,CAIA,SAASC,EAASC,GAChB,QAASA,GAA4B,iBAAXA,IAJ5B,SAAiBA,GACf,OAAOC,MAAMC,QAAQF,EACvB,CAEoDE,CAAQF,EAC5D,CAIA,SAASG,EAAmBC,EAAWC,GACrC,MAAO,GAAGD,EAAUE,eAAeD,GACrC,CC5DA,MAAME,UAA2BC,MAC/B,WAAAC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,OAGtCsW,EAAOI,cAAcb,EACvB,CAEA,eAAIF,GACF,OAAO5V,KAAKkV,cAActM,cAAc,qBAC1C,IDlBA,CACElI,WAAY,oBACZwW,sBERW,cAAmC3C,EAChD,OAAAI,GACE5U,MAAM4U,UAEN3U,KAAK6U,sBAAwB7U,KAAKmX,SAASjQ,aAAa,MAC1D,CAEA,iBAAAoO,CAAkBK,GAChB3V,KAAKmX,SAASC,IAAMzB,CACtB,CAEA,WAAAN,CAAYS,GACV,MAAMS,EAAS,IAAIC,WAEnBD,EAAOE,OAAUC,IACf1W,KAAKmX,SAASC,IAAMV,EAAEzP,OAAO6K,QAE/ByE,EAAOI,cAAcb,EACvB,CAEA,YAAIqB,GACF,OAAOnX,KAAKkV,cAActM,cAAc,MAC1C,KCZF,SAASyO,EAAQvV,GACf,IAAIwV,EAEJ,GADAxV,OAA2B,IAAXA,EAAyBA,EAAS,CAAA,GAC7CjD,IAEH,YADA2H,QAAQ+Q,IAAI,IAAIrX,GAGlB,MAAMsX,EAAa,CACjB,CAAC9Q,EAAQ5E,EAAO2V,QAChB,CAAC3P,EAAgBhG,EAAO4V,gBACxB,CAACjL,GACD,CAACiB,EAAc5L,EAAO6V,cACtB,CAACpI,EAAYzN,EAAO8V,YACpB,CAAC1D,GACD,CAACjB,EAAenR,EAAO+V,gBAEnB/Y,EAC8B,OAAjCwY,EAAgBxV,EAAOgW,OAAiBR,EAAgBvY,SAC3DyY,EAAW5K,QAAQ,EAAEpN,EAAWsC,MACZhD,EAAO6N,iBACvB,iBAAiBnN,EAAUE,gBAEnBkN,QAASnF,IACjB,IACE,aAAcjI,EACV,IAAIA,EAAUiI,EAAU3F,GACxB,IAAItC,EAAUiI,EACpB,CAAE,MAAOsQ,GACPvR,QAAQ+Q,IAAIQ,EACd,KAGN","x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12]}
|
|
1
|
+
{"version":3,"file":"formbuilder.min.js","sources":["../../../../../node_modules/govuk-frontend/dist/govuk/common/index.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/errors/index.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/component.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/common/configuration.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/i18n.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/button/button.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/common/closest-attribute-value.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.mjs","../../../../../node_modules/govuk-frontend/dist/govuk/components/radios/radios.mjs","../../../../javascript/katalyst/govuk/config.js","../../../../javascript/katalyst/govuk/controllers/attachment_controller.js","../../../../javascript/katalyst/govuk/controllers/file_field_controller.js","../../../../javascript/katalyst/govuk/controllers/index.js","../../../../javascript/katalyst/govuk/controllers/document_field_controller.js","../../../../javascript/katalyst/govuk/controllers/file_upload_controller.js","../../../../javascript/katalyst/govuk/controllers/image_field_controller.js","../../../../javascript/katalyst/govuk/formbuilder.js"],"sourcesContent":["function getBreakpoint(name) {\n const property = `--govuk-breakpoint-${name}`;\n const value = window.getComputedStyle(document.documentElement).getPropertyValue(property);\n return {\n property,\n value: value || undefined\n };\n}\nfunction setFocus($element, options = {}) {\n var _options$onBeforeFocu;\n const isFocusable = $element.getAttribute('tabindex');\n if (!isFocusable) {\n $element.setAttribute('tabindex', '-1');\n }\n function onFocus() {\n $element.addEventListener('blur', onBlur, {\n once: true\n });\n }\n function onBlur() {\n var _options$onBlur;\n (_options$onBlur = options.onBlur) == null || _options$onBlur.call($element);\n if (!isFocusable) {\n $element.removeAttribute('tabindex');\n }\n }\n $element.addEventListener('focus', onFocus, {\n once: true\n });\n (_options$onBeforeFocu = options.onBeforeFocus) == null || _options$onBeforeFocu.call($element);\n $element.focus();\n}\nfunction isInitialised($root, moduleName) {\n return $root instanceof HTMLElement && $root.hasAttribute(`data-${moduleName}-init`);\n}\n\n/**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * Some browsers will load and run our JavaScript but GOV.UK Frontend\n * won't be supported.\n *\n * @param {HTMLElement | null} [$scope] - (internal) `<body>` HTML element checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nfunction isSupported($scope = document.body) {\n if (!$scope) {\n return false;\n }\n return $scope.classList.contains('govuk-frontend-supported');\n}\nfunction isArray(option) {\n return Array.isArray(option);\n}\nfunction isObject(option) {\n return !!option && typeof option === 'object' && !isArray(option);\n}\nfunction isScope($scope) {\n return !!$scope && ($scope instanceof Element || $scope instanceof Document);\n}\nfunction formatErrorMessage(Component, message) {\n return `${Component.moduleName}: ${message}`;\n}\n/**\n * @typedef ComponentWithModuleName\n * @property {string} moduleName - Name of the component\n */\n\nexport { formatErrorMessage, getBreakpoint, isInitialised, isObject, isScope, isSupported, setFocus };\n//# sourceMappingURL=index.mjs.map\n","import { isObject, formatErrorMessage } from '../common/index.mjs';\n\nclass GOVUKFrontendError extends Error {\n constructor(...args) {\n super(...args);\n this.name = 'GOVUKFrontendError';\n }\n}\nclass SupportError extends GOVUKFrontendError {\n /**\n * Checks if GOV.UK Frontend is supported on this page\n *\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n */\n constructor($scope = document.body) {\n const supportMessage = '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';\n super($scope ? supportMessage : 'GOV.UK Frontend initialised without `<script type=\"module\">`');\n this.name = 'SupportError';\n }\n}\nclass ConfigError extends GOVUKFrontendError {\n constructor(...args) {\n super(...args);\n this.name = 'ConfigError';\n }\n}\nclass ElementError extends GOVUKFrontendError {\n constructor(messageOrOptions) {\n let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';\n if (isObject(messageOrOptions)) {\n const {\n component,\n identifier,\n element,\n expectedType\n } = messageOrOptions;\n message = identifier;\n message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';\n if (component) {\n message = formatErrorMessage(component, message);\n }\n }\n super(message);\n this.name = 'ElementError';\n }\n}\nclass InitError extends GOVUKFrontendError {\n constructor(componentOrMessage) {\n const message = typeof componentOrMessage === 'string' ? componentOrMessage : formatErrorMessage(componentOrMessage, `Root element (\\`$root\\`) already initialised`);\n super(message);\n this.name = 'InitError';\n }\n}\n/**\n * @import { ComponentWithModuleName } from '../common/index.mjs'\n */\n\nexport { ConfigError, ElementError, GOVUKFrontendError, InitError, SupportError };\n//# sourceMappingURL=index.mjs.map\n","import { isInitialised, isSupported } from './common/index.mjs';\nimport { InitError, ElementError, SupportError } from './errors/index.mjs';\n\nclass Component {\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {RootElementType} - the root element of component\n */\n get $root() {\n return this._$root;\n }\n constructor($root) {\n this._$root = void 0;\n const childConstructor = this.constructor;\n if (typeof childConstructor.moduleName !== 'string') {\n throw new InitError(`\\`moduleName\\` not defined in component`);\n }\n if (!($root instanceof childConstructor.elementType)) {\n throw new ElementError({\n element: $root,\n component: childConstructor,\n identifier: 'Root element (`$root`)',\n expectedType: childConstructor.elementType.name\n });\n } else {\n this._$root = $root;\n }\n childConstructor.checkSupport();\n this.checkInitialised();\n const moduleName = childConstructor.moduleName;\n this.$root.setAttribute(`data-${moduleName}-init`, '');\n }\n checkInitialised() {\n const constructor = this.constructor;\n const moduleName = constructor.moduleName;\n if (moduleName && isInitialised(this.$root, moduleName)) {\n throw new InitError(constructor);\n }\n }\n static checkSupport() {\n if (!isSupported()) {\n throw new SupportError();\n }\n }\n}\n\n/**\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n */\n\n/**\n * @typedef {typeof Component & ChildClass} ChildClassConstructor\n */\nComponent.elementType = HTMLElement;\n\nexport { Component };\n//# sourceMappingURL=component.mjs.map\n","import { Component } from '../component.mjs';\nimport { ConfigError } from '../errors/index.mjs';\nimport { isObject, formatErrorMessage, isScope } from './index.mjs';\n\nconst configOverride = Symbol.for('configOverride');\nclass ConfigurableComponent extends Component {\n [configOverride](param) {\n return {};\n }\n\n /**\n * Returns the root element of the component\n *\n * @protected\n * @returns {ConfigurationType} - the root element of component\n */\n get config() {\n return this._config;\n }\n constructor($root, config) {\n super($root);\n this._config = void 0;\n const childConstructor = this.constructor;\n if (!isObject(childConstructor.defaults)) {\n throw new ConfigError(formatErrorMessage(childConstructor, 'Config passed as parameter into constructor but no defaults defined'));\n }\n const datasetConfig = normaliseDataset(childConstructor, this._$root.dataset);\n this._config = mergeConfigs(childConstructor.defaults, config != null ? config : {}, this[configOverride](datasetConfig), datasetConfig);\n }\n}\nfunction normaliseString(value, property) {\n const trimmedValue = value ? value.trim() : '';\n let output;\n let outputType = property == null ? void 0 : property.type;\n if (!outputType) {\n if (['true', 'false'].includes(trimmedValue)) {\n outputType = 'boolean';\n }\n if (trimmedValue.length > 0 && isFinite(Number(trimmedValue))) {\n outputType = 'number';\n }\n }\n switch (outputType) {\n case 'boolean':\n output = trimmedValue === 'true';\n break;\n case 'number':\n output = Number(trimmedValue);\n break;\n default:\n output = value;\n }\n return output;\n}\nfunction normaliseDataset(Component, dataset) {\n if (!isObject(Component.schema)) {\n throw new ConfigError(formatErrorMessage(Component, 'Config passed as parameter into constructor but no schema defined'));\n }\n const out = {};\n const entries = Object.entries(Component.schema.properties);\n for (const entry of entries) {\n const [namespace, property] = entry;\n const field = namespace.toString();\n if (field in dataset) {\n out[field] = normaliseString(dataset[field], property);\n }\n if ((property == null ? void 0 : property.type) === 'object') {\n out[field] = extractConfigByNamespace(Component.schema, dataset, namespace);\n }\n }\n return out;\n}\nfunction normaliseOptions(scopeOrOptions) {\n let $scope = document;\n let onError;\n if (isObject(scopeOrOptions)) {\n const options = scopeOrOptions;\n if (isScope(options.scope) || options.scope === null) {\n $scope = options.scope;\n }\n if (typeof options.onError === 'function') {\n onError = options.onError;\n }\n }\n if (isScope(scopeOrOptions)) {\n $scope = scopeOrOptions;\n } else if (scopeOrOptions === null) {\n $scope = null;\n } else if (typeof scopeOrOptions === 'function') {\n onError = scopeOrOptions;\n }\n return {\n scope: $scope,\n onError\n };\n}\nfunction mergeConfigs(...configObjects) {\n const formattedConfigObject = {};\n for (const configObject of configObjects) {\n for (const key of Object.keys(configObject)) {\n const option = formattedConfigObject[key];\n const override = configObject[key];\n if (isObject(option) && isObject(override)) {\n formattedConfigObject[key] = mergeConfigs(option, override);\n } else {\n formattedConfigObject[key] = override;\n }\n }\n }\n return formattedConfigObject;\n}\nfunction validateConfig(schema, config) {\n const validationErrors = [];\n for (const [name, conditions] of Object.entries(schema)) {\n const errors = [];\n if (Array.isArray(conditions)) {\n for (const {\n required,\n errorMessage\n } of conditions) {\n if (!required.every(key => !!config[key])) {\n errors.push(errorMessage);\n }\n }\n if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {\n validationErrors.push(...errors);\n }\n }\n }\n return validationErrors;\n}\nfunction extractConfigByNamespace(schema, dataset, namespace) {\n const property = schema.properties[namespace];\n if ((property == null ? void 0 : property.type) !== 'object') {\n return;\n }\n const newObject = {\n [namespace]: {}\n };\n for (const [key, value] of Object.entries(dataset)) {\n let current = newObject;\n const keyParts = key.split('.');\n for (const [index, name] of keyParts.entries()) {\n if (isObject(current)) {\n if (index < keyParts.length - 1) {\n if (!isObject(current[name])) {\n current[name] = {};\n }\n current = current[name];\n } else if (key !== namespace) {\n current[name] = normaliseString(value);\n }\n }\n }\n }\n return newObject[namespace];\n}\n/**\n * Schema for component config\n *\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @typedef {object} Schema\n * @property {Record<keyof ConfigurationType, SchemaProperty | undefined>} properties - Schema properties\n * @property {SchemaCondition<ConfigurationType>[]} [anyOf] - List of schema conditions\n */\n/**\n * Schema property for component config\n *\n * @typedef {object} SchemaProperty\n * @property {'string' | 'boolean' | 'number' | 'object'} type - Property type\n */\n/**\n * Schema condition for component config\n *\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} ConfigurationType\n * @typedef {object} SchemaCondition\n * @property {(keyof ConfigurationType)[]} required - List of required config fields\n * @property {string} errorMessage - Error message when required config fields not provided\n */\n/**\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @typedef ChildClass\n * @property {string} moduleName - The module name that'll be looked for in the DOM when initialising the component\n * @property {Schema<ConfigurationType>} [schema] - The schema of the component configuration\n * @property {ConfigurationType} [defaults] - The default values of the configuration of the component\n */\n/**\n * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]\n * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>\n */\n/**\n * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'\n */\n\nexport { ConfigurableComponent, configOverride, extractConfigByNamespace, mergeConfigs, normaliseDataset, normaliseOptions, normaliseString, validateConfig };\n//# sourceMappingURL=configuration.mjs.map\n","import { isObject } from './common/index.mjs';\n\nclass I18n {\n constructor(translations = {}, config = {}) {\n var _config$locale;\n this.translations = void 0;\n this.locale = void 0;\n this.translations = translations;\n this.locale = (_config$locale = config.locale) != null ? _config$locale : document.documentElement.lang || 'en';\n }\n t(lookupKey, options) {\n if (!lookupKey) {\n throw new Error('i18n: lookup key missing');\n }\n let translation = this.translations[lookupKey];\n if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {\n const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];\n if (translationPluralForm) {\n translation = translationPluralForm;\n }\n }\n if (typeof translation === 'string') {\n if (translation.match(/%{(.\\S+)}/)) {\n if (!options) {\n throw new Error('i18n: cannot replace placeholders in string if no option data provided');\n }\n return this.replacePlaceholders(translation, options);\n }\n return translation;\n }\n return lookupKey;\n }\n replacePlaceholders(translationString, options) {\n const formatter = Intl.NumberFormat.supportedLocalesOf(this.locale).length ? new Intl.NumberFormat(this.locale) : undefined;\n return translationString.replace(/%{(.\\S+)}/g, function (placeholderWithBraces, placeholderKey) {\n if (Object.prototype.hasOwnProperty.call(options, placeholderKey)) {\n const placeholderValue = options[placeholderKey];\n if (placeholderValue === false || typeof placeholderValue !== 'number' && typeof placeholderValue !== 'string') {\n return '';\n }\n if (typeof placeholderValue === 'number') {\n return formatter ? formatter.format(placeholderValue) : `${placeholderValue}`;\n }\n return placeholderValue;\n }\n throw new Error(`i18n: no data found to replace ${placeholderWithBraces} placeholder in string`);\n });\n }\n hasIntlPluralRulesSupport() {\n return Boolean('PluralRules' in window.Intl && Intl.PluralRules.supportedLocalesOf(this.locale).length);\n }\n getPluralSuffix(lookupKey, count) {\n count = Number(count);\n if (!isFinite(count)) {\n return 'other';\n }\n const translation = this.translations[lookupKey];\n const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';\n if (isObject(translation)) {\n if (preferredForm in translation) {\n return preferredForm;\n } else if ('other' in translation) {\n console.warn(`i18n: Missing plural form \".${preferredForm}\" for \"${this.locale}\" locale. Falling back to \".other\".`);\n return 'other';\n }\n }\n throw new Error(`i18n: Plural form \".other\" is required for \"${this.locale}\" locale`);\n }\n}\n\nexport { I18n };\n//# sourceMappingURL=i18n.mjs.map\n","import { ConfigurableComponent } from '../../common/configuration.mjs';\n\nconst DEBOUNCE_TIMEOUT_IN_SECONDS = 1;\n\n/**\n * JavaScript enhancements for the Button component\n *\n * @preserve\n * @augments ConfigurableComponent<ButtonConfig>\n */\nclass Button extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - HTML element to use for button\n * @param {ButtonConfig} [config] - Button config\n */\n constructor($root, config = {}) {\n super($root, config);\n this.debounceFormSubmitTimer = null;\n this.$root.addEventListener('keydown', event => this.handleKeyDown(event));\n this.$root.addEventListener('click', event => this.debounce(event));\n }\n handleKeyDown(event) {\n const $target = event.target;\n if (event.key !== ' ') {\n return;\n }\n if ($target instanceof HTMLElement && $target.getAttribute('role') === 'button') {\n event.preventDefault();\n $target.click();\n }\n }\n debounce(event) {\n if (!this.config.preventDoubleClick) {\n return;\n }\n if (this.debounceFormSubmitTimer) {\n event.preventDefault();\n return false;\n }\n this.debounceFormSubmitTimer = window.setTimeout(() => {\n this.debounceFormSubmitTimer = null;\n }, DEBOUNCE_TIMEOUT_IN_SECONDS * 1000);\n }\n}\n\n/**\n * Button config\n *\n * @typedef {object} ButtonConfig\n * @property {boolean} [preventDoubleClick=false] - Prevent accidental double\n * clicks on submit buttons from submitting forms multiple times.\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n */\nButton.moduleName = 'govuk-button';\nButton.defaults = Object.freeze({\n preventDoubleClick: false\n});\nButton.schema = Object.freeze({\n properties: {\n preventDoubleClick: {\n type: 'boolean'\n }\n }\n});\n\nexport { Button };\n//# sourceMappingURL=button.mjs.map\n","function closestAttributeValue($element, attributeName) {\n const $closestElementWithAttribute = $element.closest(`[${attributeName}]`);\n return $closestElementWithAttribute ? $closestElementWithAttribute.getAttribute(attributeName) : null;\n}\n\nexport { closestAttributeValue };\n//# sourceMappingURL=closest-attribute-value.mjs.map\n","import { closestAttributeValue } from '../../common/closest-attribute-value.mjs';\nimport { ConfigurableComponent, configOverride, validateConfig } from '../../common/configuration.mjs';\nimport { formatErrorMessage } from '../../common/index.mjs';\nimport { ElementError, ConfigError } from '../../errors/index.mjs';\nimport { I18n } from '../../i18n.mjs';\n\n/**\n * Character count component\n *\n * Tracks the number of characters or words in the `.govuk-js-character-count`\n * `<textarea>` inside the element. Displays a message with the remaining number\n * of characters/words available, or the number of characters/words in excess.\n *\n * You can configure the message to only appear after a certain percentage\n * of the available characters/words has been entered.\n *\n * @preserve\n * @augments ConfigurableComponent<CharacterCountConfig>\n */\nclass CharacterCount extends ConfigurableComponent {\n [configOverride](datasetConfig) {\n let configOverrides = {};\n if ('maxwords' in datasetConfig || 'maxlength' in datasetConfig) {\n configOverrides = {\n maxlength: undefined,\n maxwords: undefined\n };\n }\n return configOverrides;\n }\n\n /**\n * @param {Element | null} $root - HTML element to use for character count\n * @param {CharacterCountConfig} [config] - Character count config\n */\n constructor($root, config = {}) {\n var _ref, _this$config$maxwords;\n super($root, config);\n this.$textarea = void 0;\n this.count = 0;\n this.$visibleCountMessage = void 0;\n this.$screenReaderCountMessage = void 0;\n this.lastInputTimestamp = null;\n this.lastInputValue = '';\n this.valueChecker = null;\n this.i18n = void 0;\n this.maxLength = void 0;\n const $textarea = this.$root.querySelector('.govuk-js-character-count');\n if (!($textarea instanceof HTMLTextAreaElement || $textarea instanceof HTMLInputElement)) {\n throw new ElementError({\n component: CharacterCount,\n element: $textarea,\n expectedType: 'HTMLTextareaElement or HTMLInputElement',\n identifier: 'Form field (`.govuk-js-character-count`)'\n });\n }\n const errors = validateConfig(CharacterCount.schema, this.config);\n if (errors[0]) {\n throw new ConfigError(formatErrorMessage(CharacterCount, errors[0]));\n }\n this.i18n = new I18n(this.config.i18n, {\n locale: closestAttributeValue(this.$root, 'lang')\n });\n this.maxLength = (_ref = (_this$config$maxwords = this.config.maxwords) != null ? _this$config$maxwords : this.config.maxlength) != null ? _ref : Infinity;\n this.$textarea = $textarea;\n const textareaDescriptionId = `${this.$textarea.id}-info`;\n const $textareaDescription = document.getElementById(textareaDescriptionId);\n if (!$textareaDescription) {\n throw new ElementError({\n component: CharacterCount,\n element: $textareaDescription,\n identifier: `Count message (\\`id=\"${textareaDescriptionId}\"\\`)`\n });\n }\n this.$errorMessage = this.$root.querySelector('.govuk-error-message');\n if ($textareaDescription.textContent.match(/^\\s*$/)) {\n $textareaDescription.textContent = this.i18n.t('textareaDescription', {\n count: this.maxLength\n });\n }\n this.$textarea.insertAdjacentElement('afterend', $textareaDescription);\n const $screenReaderCountMessage = document.createElement('div');\n $screenReaderCountMessage.className = 'govuk-character-count__sr-status govuk-visually-hidden';\n $screenReaderCountMessage.setAttribute('aria-live', 'polite');\n this.$screenReaderCountMessage = $screenReaderCountMessage;\n $textareaDescription.insertAdjacentElement('afterend', $screenReaderCountMessage);\n const $visibleCountMessage = document.createElement('div');\n $visibleCountMessage.className = $textareaDescription.className;\n $visibleCountMessage.classList.add('govuk-character-count__status');\n $visibleCountMessage.setAttribute('aria-hidden', 'true');\n this.$visibleCountMessage = $visibleCountMessage;\n $textareaDescription.insertAdjacentElement('afterend', $visibleCountMessage);\n $textareaDescription.classList.add('govuk-visually-hidden');\n this.$textarea.removeAttribute('maxlength');\n this.bindChangeEvents();\n window.addEventListener('pageshow', () => {\n if (this.$textarea.value !== this.$textarea.textContent) {\n this.updateCount();\n this.updateCountMessage();\n }\n });\n this.updateCount();\n this.updateCountMessage();\n }\n bindChangeEvents() {\n this.$textarea.addEventListener('input', () => this.handleInput());\n this.$textarea.addEventListener('focus', () => this.handleFocus());\n this.$textarea.addEventListener('blur', () => this.handleBlur());\n }\n handleInput() {\n this.updateCount();\n this.updateVisibleCountMessage();\n this.lastInputTimestamp = Date.now();\n }\n handleFocus() {\n this.valueChecker = window.setInterval(() => {\n if (!this.lastInputTimestamp || Date.now() - 500 >= this.lastInputTimestamp) {\n this.updateIfValueChanged();\n }\n }, 1000);\n }\n handleBlur() {\n if (this.valueChecker) {\n window.clearInterval(this.valueChecker);\n }\n }\n updateIfValueChanged() {\n if (this.$textarea.value !== this.lastInputValue) {\n this.lastInputValue = this.$textarea.value;\n this.updateCountMessage();\n }\n }\n updateCountMessage() {\n this.updateVisibleCountMessage();\n this.updateScreenReaderCountMessage();\n }\n updateVisibleCountMessage() {\n const remainingNumber = this.maxLength - this.count;\n const isError = remainingNumber < 0;\n this.$visibleCountMessage.classList.toggle('govuk-character-count__message--disabled', !this.isOverThreshold());\n if (!this.$errorMessage) {\n this.$textarea.classList.toggle('govuk-textarea--error', isError);\n }\n this.$visibleCountMessage.classList.toggle('govuk-error-message', isError);\n this.$visibleCountMessage.classList.toggle('govuk-hint', !isError);\n this.$visibleCountMessage.textContent = this.getCountMessage();\n }\n updateScreenReaderCountMessage() {\n if (this.isOverThreshold()) {\n this.$screenReaderCountMessage.removeAttribute('aria-hidden');\n } else {\n this.$screenReaderCountMessage.setAttribute('aria-hidden', 'true');\n }\n this.$screenReaderCountMessage.textContent = this.getCountMessage();\n }\n updateCount() {\n const text = this.$textarea.value;\n if (this.config.maxwords) {\n var _text$match;\n const tokens = (_text$match = text.match(/\\S+/g)) != null ? _text$match : [];\n this.count = tokens.length;\n return;\n }\n this.count = text.length;\n }\n getCountMessage() {\n const remainingNumber = this.maxLength - this.count;\n const countType = this.config.maxwords ? 'words' : 'characters';\n return this.formatCountMessage(remainingNumber, countType);\n }\n formatCountMessage(remainingNumber, countType) {\n if (remainingNumber === 0) {\n return this.i18n.t(`${countType}AtLimit`);\n }\n const translationKeySuffix = remainingNumber < 0 ? 'OverLimit' : 'UnderLimit';\n return this.i18n.t(`${countType}${translationKeySuffix}`, {\n count: Math.abs(remainingNumber)\n });\n }\n isOverThreshold() {\n if (!this.config.threshold) {\n return true;\n }\n const currentLength = this.count;\n const maxLength = this.maxLength;\n const thresholdValue = maxLength * this.config.threshold / 100;\n return thresholdValue <= currentLength;\n }\n}\n\n/**\n * Character count config\n *\n * @see {@link CharacterCount.defaults}\n * @typedef {object} CharacterCountConfig\n * @property {number} [maxlength] - The maximum number of characters.\n * If maxwords is provided, the maxlength option will be ignored.\n * @property {number} [maxwords] - The maximum number of words. If maxwords is\n * provided, the maxlength option will be ignored.\n * @property {number} [threshold=0] - The percentage value of the limit at\n * which point the count message is displayed. If this attribute is set, the\n * count message will be hidden by default.\n * @property {CharacterCountTranslations} [i18n=CharacterCount.defaults.i18n] - Character count translations\n */\n\n/**\n * Character count translations\n *\n * @see {@link CharacterCount.defaults.i18n}\n * @typedef {object} CharacterCountTranslations\n *\n * Messages shown to users as they type. It provides feedback on how many words\n * or characters they have remaining or if they are over the limit. This also\n * includes a message used as an accessible description for the textarea.\n * @property {TranslationPluralForms} [charactersUnderLimit] - Message displayed\n * when the number of characters is under the configured maximum, `maxlength`.\n * This message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining characters. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {string} [charactersAtLimit] - Message displayed when the number of\n * characters reaches the configured maximum, `maxlength`. This message is\n * displayed visually and through assistive technologies.\n * @property {TranslationPluralForms} [charactersOverLimit] - Message displayed\n * when the number of characters is over the configured maximum, `maxlength`.\n * This message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining characters. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {TranslationPluralForms} [wordsUnderLimit] - Message displayed when\n * the number of words is under the configured maximum, `maxlength`. This\n * message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining words. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {string} [wordsAtLimit] - Message displayed when the number of\n * words reaches the configured maximum, `maxlength`. This message is\n * displayed visually and through assistive technologies.\n * @property {TranslationPluralForms} [wordsOverLimit] - Message displayed when\n * the number of words is over the configured maximum, `maxlength`. This\n * message is displayed visually and through assistive technologies. The\n * component will replace the `%{count}` placeholder with the number of\n * remaining words. This is a [pluralised list of\n * messages](https://frontend.design-system.service.gov.uk/localise-govuk-frontend).\n * @property {TranslationPluralForms} [textareaDescription] - Message made\n * available to assistive technologies, if none is already present in the\n * HTML, to describe that the component accepts only a limited amount of\n * content. It is visible on the page when JavaScript is unavailable. The\n * component will replace the `%{count}` placeholder with the value of the\n * `maxlength` or `maxwords` parameter.\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n * @import { TranslationPluralForms } from '../../i18n.mjs'\n */\nCharacterCount.moduleName = 'govuk-character-count';\nCharacterCount.defaults = Object.freeze({\n threshold: 0,\n i18n: {\n charactersUnderLimit: {\n one: 'You have %{count} character remaining',\n other: 'You have %{count} characters remaining'\n },\n charactersAtLimit: 'You have 0 characters remaining',\n charactersOverLimit: {\n one: 'You have %{count} character too many',\n other: 'You have %{count} characters too many'\n },\n wordsUnderLimit: {\n one: 'You have %{count} word remaining',\n other: 'You have %{count} words remaining'\n },\n wordsAtLimit: 'You have 0 words remaining',\n wordsOverLimit: {\n one: 'You have %{count} word too many',\n other: 'You have %{count} words too many'\n },\n textareaDescription: {\n other: ''\n }\n }\n});\nCharacterCount.schema = Object.freeze({\n properties: {\n i18n: {\n type: 'object'\n },\n maxwords: {\n type: 'number'\n },\n maxlength: {\n type: 'number'\n },\n threshold: {\n type: 'number'\n }\n },\n anyOf: [{\n required: ['maxwords'],\n errorMessage: 'Either \"maxlength\" or \"maxwords\" must be provided'\n }, {\n required: ['maxlength'],\n errorMessage: 'Either \"maxlength\" or \"maxwords\" must be provided'\n }]\n});\n\nexport { CharacterCount };\n//# sourceMappingURL=character-count.mjs.map\n","import { Component } from '../../component.mjs';\nimport { ElementError } from '../../errors/index.mjs';\n\n/**\n * Checkboxes component\n *\n * @preserve\n */\nclass Checkboxes extends Component {\n /**\n * Checkboxes can be associated with a 'conditionally revealed' content block\n * – for example, a checkbox for 'Phone' could reveal an additional form field\n * for the user to enter their phone number.\n *\n * These associations are made using a `data-aria-controls` attribute, which\n * is promoted to an aria-controls attribute during initialisation.\n *\n * We also need to restore the state of any conditional reveals on the page\n * (for example if the user has navigated back), and set up event handlers to\n * keep the reveal in sync with the checkbox state.\n *\n * @param {Element | null} $root - HTML element to use for checkboxes\n */\n constructor($root) {\n super($root);\n this.$inputs = void 0;\n const $inputs = this.$root.querySelectorAll('input[type=\"checkbox\"]');\n if (!$inputs.length) {\n throw new ElementError({\n component: Checkboxes,\n identifier: 'Form inputs (`<input type=\"checkbox\">`)'\n });\n }\n this.$inputs = $inputs;\n this.$inputs.forEach($input => {\n const targetId = $input.getAttribute('data-aria-controls');\n if (!targetId) {\n return;\n }\n if (!document.getElementById(targetId)) {\n throw new ElementError({\n component: Checkboxes,\n identifier: `Conditional reveal (\\`id=\"${targetId}\"\\`)`\n });\n }\n $input.setAttribute('aria-controls', targetId);\n $input.removeAttribute('data-aria-controls');\n });\n window.addEventListener('pageshow', () => this.syncAllConditionalReveals());\n this.syncAllConditionalReveals();\n this.$root.addEventListener('click', event => this.handleClick(event));\n }\n syncAllConditionalReveals() {\n this.$inputs.forEach($input => this.syncConditionalRevealWithInputState($input));\n }\n syncConditionalRevealWithInputState($input) {\n const targetId = $input.getAttribute('aria-controls');\n if (!targetId) {\n return;\n }\n const $target = document.getElementById(targetId);\n if ($target != null && $target.classList.contains('govuk-checkboxes__conditional')) {\n const inputIsChecked = $input.checked;\n $input.setAttribute('aria-expanded', inputIsChecked.toString());\n $target.classList.toggle('govuk-checkboxes__conditional--hidden', !inputIsChecked);\n }\n }\n unCheckAllInputsExcept($input) {\n const allInputsWithSameName = document.querySelectorAll(`input[type=\"checkbox\"][name=\"${$input.name}\"]`);\n allInputsWithSameName.forEach($inputWithSameName => {\n const hasSameFormOwner = $input.form === $inputWithSameName.form;\n if (hasSameFormOwner && $inputWithSameName !== $input) {\n $inputWithSameName.checked = false;\n this.syncConditionalRevealWithInputState($inputWithSameName);\n }\n });\n }\n unCheckExclusiveInputs($input) {\n const allInputsWithSameNameAndExclusiveBehaviour = document.querySelectorAll(`input[data-behaviour=\"exclusive\"][type=\"checkbox\"][name=\"${$input.name}\"]`);\n allInputsWithSameNameAndExclusiveBehaviour.forEach($exclusiveInput => {\n const hasSameFormOwner = $input.form === $exclusiveInput.form;\n if (hasSameFormOwner) {\n $exclusiveInput.checked = false;\n this.syncConditionalRevealWithInputState($exclusiveInput);\n }\n });\n }\n handleClick(event) {\n const $clickedInput = event.target;\n if (!($clickedInput instanceof HTMLInputElement) || $clickedInput.type !== 'checkbox') {\n return;\n }\n const hasAriaControls = $clickedInput.getAttribute('aria-controls');\n if (hasAriaControls) {\n this.syncConditionalRevealWithInputState($clickedInput);\n }\n if (!$clickedInput.checked) {\n return;\n }\n const hasBehaviourExclusive = $clickedInput.getAttribute('data-behaviour') === 'exclusive';\n if (hasBehaviourExclusive) {\n this.unCheckAllInputsExcept($clickedInput);\n } else {\n this.unCheckExclusiveInputs($clickedInput);\n }\n }\n}\nCheckboxes.moduleName = 'govuk-checkboxes';\n\nexport { Checkboxes };\n//# sourceMappingURL=checkboxes.mjs.map\n","import { ConfigurableComponent } from '../../common/configuration.mjs';\nimport { setFocus } from '../../common/index.mjs';\n\n/**\n * Error summary component\n *\n * Takes focus on initialisation for accessible announcement, unless disabled in\n * configuration.\n *\n * @preserve\n * @augments ConfigurableComponent<ErrorSummaryConfig>\n */\nclass ErrorSummary extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - HTML element to use for error summary\n * @param {ErrorSummaryConfig} [config] - Error summary config\n */\n constructor($root, config = {}) {\n super($root, config);\n if (!this.config.disableAutoFocus) {\n setFocus(this.$root);\n }\n this.$root.addEventListener('click', event => this.handleClick(event));\n }\n handleClick(event) {\n const $target = event.target;\n if ($target && this.focusTarget($target)) {\n event.preventDefault();\n }\n }\n focusTarget($target) {\n if (!($target instanceof HTMLAnchorElement)) {\n return false;\n }\n const inputId = $target.hash.replace('#', '');\n if (!inputId) {\n return false;\n }\n const $input = document.getElementById(inputId);\n if (!$input) {\n return false;\n }\n const $legendOrLabel = this.getAssociatedLegendOrLabel($input);\n if (!$legendOrLabel) {\n return false;\n }\n $legendOrLabel.scrollIntoView();\n $input.focus({\n preventScroll: true\n });\n return true;\n }\n getAssociatedLegendOrLabel($input) {\n var _document$querySelect;\n const $fieldset = $input.closest('fieldset');\n if ($fieldset) {\n const $legends = $fieldset.getElementsByTagName('legend');\n if ($legends.length) {\n const $candidateLegend = $legends[0];\n if ($input instanceof HTMLInputElement && ($input.type === 'checkbox' || $input.type === 'radio')) {\n return $candidateLegend;\n }\n const legendTop = $candidateLegend.getBoundingClientRect().top;\n const inputRect = $input.getBoundingClientRect();\n if (inputRect.height && window.innerHeight) {\n const inputBottom = inputRect.top + inputRect.height;\n if (inputBottom - legendTop < window.innerHeight / 2) {\n return $candidateLegend;\n }\n }\n }\n }\n return (_document$querySelect = document.querySelector(`label[for='${$input.getAttribute('id')}']`)) != null ? _document$querySelect : $input.closest('label');\n }\n}\n\n/**\n * Error summary config\n *\n * @typedef {object} ErrorSummaryConfig\n * @property {boolean} [disableAutoFocus=false] - If set to `true` the error\n * summary will not be focussed when the page loads.\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n */\nErrorSummary.moduleName = 'govuk-error-summary';\nErrorSummary.defaults = Object.freeze({\n disableAutoFocus: false\n});\nErrorSummary.schema = Object.freeze({\n properties: {\n disableAutoFocus: {\n type: 'boolean'\n }\n }\n});\n\nexport { ErrorSummary };\n//# sourceMappingURL=error-summary.mjs.map\n","import { closestAttributeValue } from '../../common/closest-attribute-value.mjs';\nimport { ConfigurableComponent } from '../../common/configuration.mjs';\nimport { ElementError } from '../../errors/index.mjs';\nimport { I18n } from '../../i18n.mjs';\n\n/**\n * File upload component\n *\n * @preserve\n * @augments ConfigurableComponent<FileUploadConfig>\n */\nclass FileUpload extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - File input element\n * @param {FileUploadConfig} [config] - File Upload config\n */\n constructor($root, config = {}) {\n super($root, config);\n this.$input = void 0;\n this.$button = void 0;\n this.$status = void 0;\n this.$label = void 0;\n this.i18n = void 0;\n this.id = void 0;\n this.$announcements = void 0;\n this.enteredAnotherElement = void 0;\n const $input = this.$root.querySelector('input[type=\"file\"]');\n if ($input === null) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File inputs (`<input type=\"file\">`)'\n });\n }\n this.$input = $input;\n if (!this.$input.id) {\n throw new ElementError({\n component: FileUpload,\n identifier: 'File input (`<input type=\"file\">`) attribute (`id`)'\n });\n }\n this.id = this.$input.id;\n this.i18n = new I18n(this.config.i18n, {\n locale: closestAttributeValue(this.$root, 'lang')\n });\n const $label = this.findLabel();\n if (!$label.id) {\n $label.id = `${this.id}-label`;\n }\n this.$label = $label;\n this.$input.id = `${this.id}-input`;\n this.$input.setAttribute('hidden', 'hidden');\n this.$status = this.createStatus();\n this.$button = this.createButton();\n this.$root.insertAdjacentElement('afterbegin', this.$button);\n this.$input.addEventListener('change', this.onChange.bind(this));\n this.updateDisabledState();\n this.observeDisabledState();\n this.$announcements = document.createElement('span');\n this.$announcements.classList.add('govuk-file-upload-announcements');\n this.$announcements.classList.add('govuk-visually-hidden');\n this.$announcements.setAttribute('aria-live', 'assertive');\n this.$root.insertAdjacentElement('afterend', this.$announcements);\n this.bindDraggingEvents();\n }\n createStatus() {\n const $status = document.createElement('span');\n $status.className = 'govuk-body govuk-file-upload-button__status';\n $status.setAttribute('aria-live', 'polite');\n $status.innerText = this.i18n.t('noFileChosen');\n return $status;\n }\n createButton() {\n const $button = document.createElement('button');\n $button.classList.add('govuk-file-upload-button');\n $button.type = 'button';\n $button.id = this.id;\n $button.classList.add('govuk-file-upload-button--empty');\n const ariaDescribedBy = this.$input.getAttribute('aria-describedby');\n if (ariaDescribedBy) {\n $button.setAttribute('aria-describedby', ariaDescribedBy);\n }\n $button.appendChild(this.$status);\n const commaSpan = document.createElement('span');\n commaSpan.className = 'govuk-visually-hidden';\n commaSpan.innerText = ', ';\n commaSpan.id = `${this.id}-comma`;\n $button.appendChild(commaSpan);\n const containerSpan = document.createElement('span');\n containerSpan.className = 'govuk-file-upload-button__pseudo-button-container';\n const buttonSpan = document.createElement('span');\n buttonSpan.className = 'govuk-button govuk-button--secondary govuk-file-upload-button__pseudo-button';\n buttonSpan.innerText = this.i18n.t('chooseFilesButton');\n containerSpan.appendChild(buttonSpan);\n containerSpan.insertAdjacentText('beforeend', ' ');\n const instructionSpan = document.createElement('span');\n instructionSpan.className = 'govuk-body govuk-file-upload-button__instruction';\n instructionSpan.innerText = this.i18n.t('dropInstruction');\n containerSpan.appendChild(instructionSpan);\n $button.appendChild(containerSpan);\n $button.setAttribute('aria-labelledby', `${this.$label.id} ${commaSpan.id} ${$button.id}`);\n $button.addEventListener('click', this.onClick.bind(this));\n $button.addEventListener('dragover', event => {\n event.preventDefault();\n });\n return $button;\n }\n bindDraggingEvents() {\n this.$button.addEventListener('drop', this.onDrop.bind(this));\n document.addEventListener('dragenter', this.updateDropzoneVisibility.bind(this));\n document.addEventListener('dragenter', () => {\n this.enteredAnotherElement = true;\n });\n document.addEventListener('dragleave', () => {\n if (!this.enteredAnotherElement && !this.$button.disabled) {\n this.hideDraggingState();\n this.$announcements.innerText = this.i18n.t('leftDropZone');\n }\n this.enteredAnotherElement = false;\n });\n }\n updateDropzoneVisibility(event) {\n if (this.$button.disabled) return;\n if (event.target instanceof Node) {\n if (this.$root.contains(event.target)) {\n if (event.dataTransfer && this.canDrop(event.dataTransfer)) {\n if (!this.$button.classList.contains('govuk-file-upload-button--dragging')) {\n this.showDraggingState();\n this.$announcements.innerText = this.i18n.t('enteredDropZone');\n }\n }\n } else {\n if (this.$button.classList.contains('govuk-file-upload-button--dragging')) {\n this.hideDraggingState();\n this.$announcements.innerText = this.i18n.t('leftDropZone');\n }\n }\n }\n }\n showDraggingState() {\n this.$button.classList.add('govuk-file-upload-button--dragging');\n }\n hideDraggingState() {\n this.$button.classList.remove('govuk-file-upload-button--dragging');\n }\n onDrop(event) {\n event.preventDefault();\n if (event.dataTransfer && this.canFillInput(event.dataTransfer)) {\n this.$input.files = event.dataTransfer.files;\n this.$input.dispatchEvent(new CustomEvent('change'));\n this.hideDraggingState();\n }\n }\n canFillInput(dataTransfer) {\n return this.matchesInputCapacity(dataTransfer.files.length);\n }\n canDrop(dataTransfer) {\n if (dataTransfer.items.length) {\n return this.matchesInputCapacity(countFileItems(dataTransfer.items));\n }\n if (dataTransfer.types.length) {\n return dataTransfer.types.includes('Files');\n }\n return true;\n }\n matchesInputCapacity(numberOfFiles) {\n if (this.$input.multiple) {\n return numberOfFiles > 0;\n }\n return numberOfFiles === 1;\n }\n onChange() {\n const fileCount = this.$input.files.length;\n if (fileCount === 0) {\n this.$status.innerText = this.i18n.t('noFileChosen');\n this.$button.classList.add('govuk-file-upload-button--empty');\n } else {\n if (fileCount === 1) {\n this.$status.innerText = this.$input.files[0].name;\n } else {\n this.$status.innerText = this.i18n.t('multipleFilesChosen', {\n count: fileCount\n });\n }\n this.$button.classList.remove('govuk-file-upload-button--empty');\n }\n }\n findLabel() {\n const $label = document.querySelector(`label[for=\"${this.$input.id}\"]`);\n if (!$label) {\n throw new ElementError({\n component: FileUpload,\n identifier: `Field label (\\`<label for=${this.$input.id}>\\`)`\n });\n }\n return $label;\n }\n onClick() {\n this.$input.click();\n }\n observeDisabledState() {\n const observer = new MutationObserver(mutationList => {\n for (const mutation of mutationList) {\n if (mutation.type === 'attributes' && mutation.attributeName === 'disabled') {\n this.updateDisabledState();\n }\n }\n });\n observer.observe(this.$input, {\n attributes: true\n });\n }\n updateDisabledState() {\n this.$button.disabled = this.$input.disabled;\n this.$root.classList.toggle('govuk-file-upload-wrapper--disabled', this.$button.disabled);\n }\n}\n\n/**\n * Counts the number of `DataTransferItem` whose kind is `file`\n *\n * @param {DataTransferItemList} list - The list\n * @returns {number} - The number of items whose kind is `file` in the list\n */\nFileUpload.moduleName = 'govuk-file-upload';\nFileUpload.defaults = Object.freeze({\n i18n: {\n chooseFilesButton: 'Choose file',\n dropInstruction: 'or drop file',\n noFileChosen: 'No file chosen',\n multipleFilesChosen: {\n one: '%{count} file chosen',\n other: '%{count} files chosen'\n },\n enteredDropZone: 'Entered drop zone',\n leftDropZone: 'Left drop zone'\n }\n});\nFileUpload.schema = Object.freeze({\n properties: {\n i18n: {\n type: 'object'\n }\n }\n});\nfunction countFileItems(list) {\n let result = 0;\n for (let i = 0; i < list.length; i++) {\n if (list[i].kind === 'file') {\n result++;\n }\n }\n return result;\n}\n\n/**\n * @typedef {HTMLInputElement & {files: FileList}} HTMLFileInputElement\n */\n\n/**\n * File upload config\n *\n * @see {@link FileUpload.defaults}\n * @typedef {object} FileUploadConfig\n * @property {FileUploadTranslations} [i18n=FileUpload.defaults.i18n] - File upload translations\n */\n\n/**\n * File upload translations\n *\n * @see {@link FileUpload.defaults.i18n}\n * @typedef {object} FileUploadTranslations\n *\n * Messages used by the component\n * @property {string} [chooseFile] - The text of the button that opens the file picker\n * @property {string} [dropInstruction] - The text informing users they can drop files\n * @property {TranslationPluralForms} [multipleFilesChosen] - The text displayed when multiple files\n * have been chosen by the user\n * @property {string} [noFileChosen] - The text to displayed when no file has been chosen by the user\n * @property {string} [enteredDropZone] - The text announced by assistive technology\n * when user drags files and enters the drop zone\n * @property {string} [leftDropZone] - The text announced by assistive technology\n * when user drags files and leaves the drop zone without dropping\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n * @import { TranslationPluralForms } from '../../i18n.mjs'\n */\n\nexport { FileUpload };\n//# sourceMappingURL=file-upload.mjs.map\n","import { closestAttributeValue } from '../../common/closest-attribute-value.mjs';\nimport { ConfigurableComponent } from '../../common/configuration.mjs';\nimport { ElementError } from '../../errors/index.mjs';\nimport { I18n } from '../../i18n.mjs';\n\n/**\n * Password input component\n *\n * @preserve\n * @augments ConfigurableComponent<PasswordInputConfig>\n */\nclass PasswordInput extends ConfigurableComponent {\n /**\n * @param {Element | null} $root - HTML element to use for password input\n * @param {PasswordInputConfig} [config] - Password input config\n */\n constructor($root, config = {}) {\n super($root, config);\n this.i18n = void 0;\n this.$input = void 0;\n this.$showHideButton = void 0;\n this.$screenReaderStatusMessage = void 0;\n const $input = this.$root.querySelector('.govuk-js-password-input-input');\n if (!($input instanceof HTMLInputElement)) {\n throw new ElementError({\n component: PasswordInput,\n element: $input,\n expectedType: 'HTMLInputElement',\n identifier: 'Form field (`.govuk-js-password-input-input`)'\n });\n }\n if ($input.type !== 'password') {\n throw new ElementError('Password input: Form field (`.govuk-js-password-input-input`) must be of type `password`.');\n }\n const $showHideButton = this.$root.querySelector('.govuk-js-password-input-toggle');\n if (!($showHideButton instanceof HTMLButtonElement)) {\n throw new ElementError({\n component: PasswordInput,\n element: $showHideButton,\n expectedType: 'HTMLButtonElement',\n identifier: 'Button (`.govuk-js-password-input-toggle`)'\n });\n }\n if ($showHideButton.type !== 'button') {\n throw new ElementError('Password input: Button (`.govuk-js-password-input-toggle`) must be of type `button`.');\n }\n this.$input = $input;\n this.$showHideButton = $showHideButton;\n this.i18n = new I18n(this.config.i18n, {\n locale: closestAttributeValue(this.$root, 'lang')\n });\n this.$showHideButton.removeAttribute('hidden');\n const $screenReaderStatusMessage = document.createElement('div');\n $screenReaderStatusMessage.className = 'govuk-password-input__sr-status govuk-visually-hidden';\n $screenReaderStatusMessage.setAttribute('aria-live', 'polite');\n this.$screenReaderStatusMessage = $screenReaderStatusMessage;\n this.$input.insertAdjacentElement('afterend', $screenReaderStatusMessage);\n this.$showHideButton.addEventListener('click', this.toggle.bind(this));\n if (this.$input.form) {\n this.$input.form.addEventListener('submit', () => this.hide());\n }\n window.addEventListener('pageshow', event => {\n if (event.persisted && this.$input.type !== 'password') {\n this.hide();\n }\n });\n this.hide();\n }\n toggle(event) {\n event.preventDefault();\n if (this.$input.type === 'password') {\n this.show();\n return;\n }\n this.hide();\n }\n show() {\n this.setType('text');\n }\n hide() {\n this.setType('password');\n }\n setType(type) {\n if (type === this.$input.type) {\n return;\n }\n this.$input.setAttribute('type', type);\n const isHidden = type === 'password';\n const prefixButton = isHidden ? 'show' : 'hide';\n const prefixStatus = isHidden ? 'passwordHidden' : 'passwordShown';\n this.$showHideButton.innerText = this.i18n.t(`${prefixButton}Password`);\n this.$showHideButton.setAttribute('aria-label', this.i18n.t(`${prefixButton}PasswordAriaLabel`));\n this.$screenReaderStatusMessage.innerText = this.i18n.t(`${prefixStatus}Announcement`);\n }\n}\n\n/**\n * Password input config\n *\n * @typedef {object} PasswordInputConfig\n * @property {PasswordInputTranslations} [i18n=PasswordInput.defaults.i18n] - Password input translations\n */\n\n/**\n * Password input translations\n *\n * @see {@link PasswordInput.defaults.i18n}\n * @typedef {object} PasswordInputTranslations\n *\n * Messages displayed to the user indicating the state of the show/hide toggle.\n * @property {string} [showPassword] - Visible text of the button when the\n * password is currently hidden. Plain text only.\n * @property {string} [hidePassword] - Visible text of the button when the\n * password is currently visible. Plain text only.\n * @property {string} [showPasswordAriaLabel] - aria-label of the button when\n * the password is currently hidden. Plain text only.\n * @property {string} [hidePasswordAriaLabel] - aria-label of the button when\n * the password is currently visible. Plain text only.\n * @property {string} [passwordShownAnnouncement] - Screen reader\n * announcement to make when the password has just become visible.\n * Plain text only.\n * @property {string} [passwordHiddenAnnouncement] - Screen reader\n * announcement to make when the password has just been hidden.\n * Plain text only.\n */\n\n/**\n * @import { Schema } from '../../common/configuration.mjs'\n */\nPasswordInput.moduleName = 'govuk-password-input';\nPasswordInput.defaults = Object.freeze({\n i18n: {\n showPassword: 'Show',\n hidePassword: 'Hide',\n showPasswordAriaLabel: 'Show password',\n hidePasswordAriaLabel: 'Hide password',\n passwordShownAnnouncement: 'Your password is visible',\n passwordHiddenAnnouncement: 'Your password is hidden'\n }\n});\nPasswordInput.schema = Object.freeze({\n properties: {\n i18n: {\n type: 'object'\n }\n }\n});\n\nexport { PasswordInput };\n//# sourceMappingURL=password-input.mjs.map\n","import { Component } from '../../component.mjs';\nimport { ElementError } from '../../errors/index.mjs';\n\n/**\n * Radios component\n *\n * @preserve\n */\nclass Radios extends Component {\n /**\n * Radios can be associated with a 'conditionally revealed' content block –\n * for example, a radio for 'Phone' could reveal an additional form field for\n * the user to enter their phone number.\n *\n * These associations are made using a `data-aria-controls` attribute, which\n * is promoted to an aria-controls attribute during initialisation.\n *\n * We also need to restore the state of any conditional reveals on the page\n * (for example if the user has navigated back), and set up event handlers to\n * keep the reveal in sync with the radio state.\n *\n * @param {Element | null} $root - HTML element to use for radios\n */\n constructor($root) {\n super($root);\n this.$inputs = void 0;\n const $inputs = this.$root.querySelectorAll('input[type=\"radio\"]');\n if (!$inputs.length) {\n throw new ElementError({\n component: Radios,\n identifier: 'Form inputs (`<input type=\"radio\">`)'\n });\n }\n this.$inputs = $inputs;\n this.$inputs.forEach($input => {\n const targetId = $input.getAttribute('data-aria-controls');\n if (!targetId) {\n return;\n }\n if (!document.getElementById(targetId)) {\n throw new ElementError({\n component: Radios,\n identifier: `Conditional reveal (\\`id=\"${targetId}\"\\`)`\n });\n }\n $input.setAttribute('aria-controls', targetId);\n $input.removeAttribute('data-aria-controls');\n });\n window.addEventListener('pageshow', () => this.syncAllConditionalReveals());\n this.syncAllConditionalReveals();\n this.$root.addEventListener('click', event => this.handleClick(event));\n }\n syncAllConditionalReveals() {\n this.$inputs.forEach($input => this.syncConditionalRevealWithInputState($input));\n }\n syncConditionalRevealWithInputState($input) {\n const targetId = $input.getAttribute('aria-controls');\n if (!targetId) {\n return;\n }\n const $target = document.getElementById(targetId);\n if ($target != null && $target.classList.contains('govuk-radios__conditional')) {\n const inputIsChecked = $input.checked;\n $input.setAttribute('aria-expanded', inputIsChecked.toString());\n $target.classList.toggle('govuk-radios__conditional--hidden', !inputIsChecked);\n }\n }\n handleClick(event) {\n const $clickedInput = event.target;\n if (!($clickedInput instanceof HTMLInputElement) || $clickedInput.type !== 'radio') {\n return;\n }\n const $allInputs = document.querySelectorAll('input[type=\"radio\"][aria-controls]');\n const $clickedInputForm = $clickedInput.form;\n const $clickedInputName = $clickedInput.name;\n $allInputs.forEach($input => {\n const hasSameFormOwner = $input.form === $clickedInputForm;\n const hasSameName = $input.name === $clickedInputName;\n if (hasSameName && hasSameFormOwner) {\n this.syncConditionalRevealWithInputState($input);\n }\n });\n }\n}\nRadios.moduleName = 'govuk-radios';\n\nexport { Radios };\n//# sourceMappingURL=radios.mjs.map\n","import { FileUpload } from \"govuk-frontend/dist/govuk/all.mjs\";\nimport {\n mergeConfigs,\n normaliseDataset,\n} from \"govuk-frontend/dist/govuk/common/configuration.mjs\";\n\n// CSS classes written or queried by this bundle follow the configured\n// brand, mirroring the Ruby builder's class prefixes. Behavioural wiring\n// (Stimulus identifiers, data-actions, events) is always govuk-prefixed.\n// Set from the govuk_formbuilder_init snippet via initAll({ brand }).\nconst config = { brand: \"govuk\" };\n\nexport default config;\n\n// The pseudo upload button, identified structurally — the button fronting\n// the (hidden) file input it precedes — so the selector holds under any\n// brand.\nexport const uploadButtonSelector = \"[type='button']:has(+ input[type='file'])\";\n\n// The attachment field replaces govuk-frontend's FileUpload, so its\n// vocabulary is FileUpload's strings plus the attachment additions — one\n// table for the whole field. The inherited keys keep their upstream names:\n// the data-i18n.* attribute shapes are the compatibility bar.\nconst Attachment = {\n moduleName: \"govuk-attachment\",\n defaults: {\n i18n: {\n ...FileUpload.defaults.i18n,\n uploadSucceeded: \"Uploaded successfully\",\n uploadFailed: \"Upload failed — try again\",\n retryButton: \"Try again\",\n fileRemoved: \"%{filename} removed\",\n removeButton: \"Remove %{filename}\",\n removeButtonContent: \"Remove\",\n },\n },\n schema: { properties: { i18n: { type: \"object\" } } },\n};\n\n// The wrapper's data-i18n.* attributes (the builder's text options) merged\n// over the bundled defaults — what ConfigurableComponent would provide as\n// this.config. Each controller constructs its own I18n from it, with locale\n// resolved from its own root, matching govuk-frontend's component pattern.\nexport function attachmentConfig(wrapper) {\n return mergeConfigs(\n Attachment.defaults,\n normaliseDataset(Attachment, wrapper?.dataset ?? {}),\n );\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { DirectUploadController } from \"@rails/activestorage\";\nimport { I18n } from \"govuk-frontend/dist/govuk/i18n.mjs\";\nimport { closestAttributeValue } from \"govuk-frontend/dist/govuk/common/closest-attribute-value.mjs\";\nimport config, { attachmentConfig, uploadButtonSelector } from \"../config\";\n\nclass AttachmentUploadController extends DirectUploadController {\n async start(option) {\n this.dispatch(\"start\");\n try {\n const attributes = await new Promise((resolve, reject) => {\n this.directUpload.create((error, attributes) =>\n error ? reject(error) : resolve(attributes),\n );\n });\n option.value = attributes.signed_id;\n } catch (error) {\n this.dispatch(\"error\", { error });\n throw error;\n } finally {\n this.dispatch(\"end\");\n }\n }\n}\n\nexport default class AttachmentController extends Controller {\n connect() {\n this.config = attachmentConfig(\n this.element.closest(`.${config.brand}-file-upload-wrapper`),\n );\n this.i18n = new I18n(this.config.i18n, {\n locale: closestAttributeValue(this.element, \"lang\"),\n });\n\n this.select.addEventListener(\"change\", this.change);\n this.previewPendingFile();\n this.uploadPendingFile();\n }\n\n disconnect() {\n this.select?.removeEventListener(\"change\", this.change);\n }\n\n previewPendingFile() {\n const file = this.element.file;\n\n if (!file) return;\n\n if (!file.type.startsWith(\"image/\")) {\n this.imageTag?.remove();\n return;\n }\n\n const preview = new FileReader();\n preview.onload = this.onPreviewReady;\n preview.readAsDataURL(file);\n }\n\n uploadPendingFile() {\n const file = this.element.file;\n\n if (!file) return;\n if (!this.input?.dataset.directUploadUrl) return;\n\n delete this.element.file;\n\n this.input.dispatchEvent(\n new CustomEvent(\"govuk:upload\", { detail: { file } }),\n );\n\n this.performUpload(file);\n }\n\n async performUpload(file) {\n this.uploader = new AttachmentUploadController(this.input, file);\n\n // Update element state, clearing any earlier failure\n this.element.dataset.state = \"uploading\";\n this.statusText = \"\";\n this.retryButton?.remove();\n const progressTag = createProgressTag(this.filenameTag.id);\n this.captionTag.appendChild(progressTag);\n this.input.addEventListener(\"direct-upload:progress\", this.progress);\n\n try {\n await this.uploader.start(this.inputOption);\n this.element.dataset.state = \"upload-successful\";\n this.statusText = this.i18n.t(\"uploadSucceeded\");\n } catch (error) {\n console.warn(error);\n this.element.dataset.state = \"upload-failed\";\n this.statusText = this.i18n.t(\"uploadFailed\");\n this.actionsTag?.prepend(createRetryButton(file.name, this.i18n));\n } finally {\n this.input.removeEventListener(\"direct-upload:progress\", this.progress);\n progressTag.remove();\n }\n }\n\n /**\n * @param e {ProgressEvent<FileReader>} file reader event\n */\n onPreviewReady = (e) => {\n this.imageTag.src = e.target.result;\n };\n\n change = () => {\n if (this.select.value === \"\") this.destroy();\n };\n\n retry() {\n this.performUpload(this.directUpload.file);\n this.removeButton?.focus();\n }\n\n progress = ({ detail }) => {\n if (detail.id !== this.id) return;\n if (this.progressTag) this.progressTag.value = detail.progress;\n };\n\n destroy() {\n const focusTarget = this.uploadButton;\n\n const remove = new CustomEvent(\"govuk:remove\", {\n detail: {\n name: this.element.querySelector(\".filename\")?.textContent,\n // Unclaimed figures still own a file in the input's FileList; pass\n // it so the file-upload controller can release it.\n file: this.element.file,\n },\n cancelable: true,\n });\n\n if (!this.input.dispatchEvent(remove)) return;\n\n this.element.remove();\n focusTarget?.focus();\n }\n\n get id() {\n return this.directUpload?.id ?? this.select.id;\n }\n\n get directUpload() {\n return this.uploader?.directUpload;\n }\n\n get input() {\n return this.element\n .closest(`.${config.brand}-file-upload-wrapper`)\n ?.querySelector(\"input[type=file]\");\n }\n\n get uploadButton() {\n return this.element\n .closest(`.${config.brand}-file-upload-wrapper`)\n ?.querySelector(uploadButtonSelector);\n }\n\n set statusText(message) {\n const tag = this.element.querySelector(\"figcaption .status\");\n\n if (tag) tag.textContent = message;\n }\n\n /**\n * @returns {HTMLElement} the figure's caption, or null\n */\n get captionTag() {\n return this.element.querySelector(\"figcaption\");\n }\n\n /**\n * @returns {HTMLElement} the caption's filename span, or null\n */\n get filenameTag() {\n return this.element.querySelector(\"figcaption .filename\");\n }\n\n /**\n * @returns {HTMLElement} the figure's actions container, or null\n */\n get actionsTag() {\n return this.element.querySelector(\".actions\");\n }\n\n get select() {\n return this.element.querySelector(\"select\");\n }\n\n /**\n * @returns {HTMLOptionElement} the option that records the file's blob id\n */\n get inputOption() {\n return this.element.querySelector(\"option\");\n }\n\n /**\n * @returns {HTMLImageElement} the preview image, or null\n */\n get imageTag() {\n return this.element.querySelector(\"img\");\n }\n\n get progressTag() {\n return this.element.querySelector(\"progress\");\n }\n\n get retryButton() {\n return this.element.querySelector(\".actions button[data-action*='retry']\");\n }\n\n get removeButton() {\n return this.element.querySelector(\n \".actions button[data-action*='destroy']\",\n );\n }\n}\n\nlet nextAttachmentId = 0;\n\nexport function createAttachment(input, file, i18n) {\n const template = document.createElement(\"TEMPLATE\");\n const id = ++nextAttachmentId;\n\n template.innerHTML = `\n <figure class=\"${config.brand}-attachment\" data-controller=\"govuk-attachment\" aria-labelledby=\"attachment-${id}-filename\">\n <img alt=\"\" class=\"preview\" src=\"\">\n <figcaption class=\"caption\" aria-atomic=\"true\" aria-live=\"polite\">\n <span id=\"attachment-${id}-filename\" class=\"filename\"></span>\n <span class=\"size\"></span>\n <span class=\"status\"></span>\n </figcaption>\n <div class=\"actions\">\n <select id=\"attachment-${id}-input\" name=\"${input.name}\" aria-labelledby=\"attachment-${id}-filename\">\n <option selected=\"selected\" value=\"\"></option>\n <option value=\"\"></option>\n </select>\n <button type=\"button\" class=\"${config.brand}-button ${config.brand}-button--secondary ${config.brand}-attachment__remove\" data-action=\"govuk-attachment#destroy\" data-module=\"govuk-button\"></button>\n </div>\n </figure>\n `;\n\n const figure = template.content.firstElementChild;\n\n figure.querySelector(\".filename\").textContent = file.name;\n figure.querySelector(\".size\").textContent = humanSize(file.size);\n\n const [keep, remove] = figure.querySelectorAll(\"option\");\n keep.textContent = file.name;\n remove.textContent = i18n.t(\"removeButton\", { filename: file.name });\n\n const removeButton = figure.querySelector(\"button\");\n removeButton.textContent = i18n.t(\"removeButtonContent\");\n removeButton.setAttribute(\n \"aria-label\",\n i18n.t(\"removeButton\", { filename: file.name }),\n );\n\n // The figure carries its File until an attachment controller connects and\n // claims it for upload; while it remains, the file is still in the input's\n // FileList and will submit as ordinary multipart.\n figure.file = file;\n\n return figure;\n}\n\nconst UNITS = [\"Bytes\", \"KB\", \"MB\", \"GB\", \"TB\", \"PB\"];\n\nfunction humanSize(bytes) {\n if (bytes === 1) return \"1 Byte\";\n if (bytes < 1024) return `${bytes} Bytes`;\n\n const exp = Math.min(Math.floor(Math.log2(bytes) / 10), UNITS.length - 1);\n const value = Number((bytes / 1024 ** exp).toPrecision(3));\n\n return `${value} ${UNITS[exp]}`;\n}\n\nfunction createRetryButton(filename, i18n) {\n const button = document.createElement(\"BUTTON\");\n button.type = \"button\";\n button.className = `${config.brand}-button ${config.brand}-button--secondary ${config.brand}-attachment__retry`;\n button.textContent = i18n.t(\"retryButton\");\n button.setAttribute(\"aria-label\", `${i18n.t(\"retryButton\")} ${filename}`);\n button.dataset.action = \"govuk-attachment#retry\";\n button.dataset.module = \"govuk-button\";\n return button;\n}\n\nfunction createProgressTag(labelId) {\n const progress = document.createElement(\"PROGRESS\");\n progress.className = `${config.brand}-attachment-progress`;\n if (labelId) progress.setAttribute(\"aria-labelledby\", labelId);\n progress.value = 0;\n progress.max = 100;\n return progress;\n}\n","import { Controller } from \"@hotwired/stimulus\";\n\nexport default class FileFieldController extends Controller {\n static targets = [\"preview\", \"destroy\"];\n static values = {\n mimeTypes: Array,\n };\n\n connect() {\n this.counter = 0;\n this.initialPreviewContent = null;\n this.onUploadFlag = false;\n }\n\n onUpload(event) {\n this.onUploadFlag = true;\n\n // Set the file to be destroyed only if it is already persisted\n if (this.hasDestroyTarget) {\n this.destroyTarget.value = false;\n }\n this.previewTarget.removeAttribute(\"hidden\");\n\n // Show preview only if a file has been selected in the file picker popup. If cancelled, show previous file or do\n // not show preview at all\n if (this.hasPreviewTarget) {\n if (event.currentTarget.files.length > 0) {\n this.showPreview(event.currentTarget.files[0]);\n } else {\n this.setPreviewContent(this.initialPreviewContent);\n }\n }\n }\n\n setDestroy(event) {\n event.preventDefault();\n\n // If the data is already persisted and another image has been picked from the file picker popup, but the new image\n // is removed, show the original image\n if (this.initialPreviewContent && this.onUploadFlag) {\n this.onUploadFlag = false;\n this.setPreviewContent(this.initialPreviewContent);\n } else {\n // Set image to be destroyed, hide preview and remove image url\n if (this.hasDestroyTarget) {\n this.destroyTarget.value = true;\n }\n if (this.hasPreviewTarget) {\n this.previewTarget.setAttribute(\"hidden\", \"\");\n this.setPreviewContent(\"\");\n }\n if (this.previousInput) {\n this.previousInput.toggleAttribute(\"disabled\", true);\n }\n }\n\n this.fileInput.value = \"\";\n }\n\n setPreviewContent(content) {\n if (this.filenameTag) {\n this.filenameTag.innerText = text;\n }\n }\n\n drop(event) {\n event.preventDefault();\n\n const file = this.fileForEvent(event, this.mimeTypesValue);\n if (file) {\n const dT = new DataTransfer();\n dT.items.add(file);\n this.fileInput.files = dT.files;\n this.fileInput.dispatchEvent(new Event(\"change\"));\n }\n\n this.counter = 0;\n this.element.classList.remove(\"droppable\");\n }\n\n dragover(event) {\n event.preventDefault();\n }\n\n dragenter(event) {\n event.preventDefault();\n\n if (this.counter === 0) {\n this.element.classList.add(\"droppable\");\n }\n this.counter++;\n }\n\n dragleave(event) {\n event.preventDefault();\n\n this.counter--;\n if (this.counter === 0) {\n this.element.classList.remove(\"droppable\");\n }\n }\n\n get fileInput() {\n return this.element.querySelector(\"input[type='file']\");\n }\n\n get previousInput() {\n return this.element.querySelector(\n `input[type='hidden'][name='${this.fileInput.name}']`,\n );\n }\n\n get filenameTag() {\n if (!this.hasPreviewTarget) return null;\n\n return this.previewTarget.querySelector(\"p.preview-filename\");\n }\n\n showPreview(file) {\n const reader = new FileReader();\n\n reader.onload = (e) => {\n if (this.filenameTag) {\n this.filenameTag.innerText = file.name;\n }\n };\n reader.readAsDataURL(file);\n }\n\n /**\n * Given a drop event, find the first acceptable file.\n * @param event {DropEvent}\n * @param mimeTypes {String[]}\n * @returns {File}\n */\n fileForEvent(event, mimeTypes) {\n const accept = (file) => mimeTypes.indexOf(file.type) > -1;\n\n let file;\n\n if (event.dataTransfer.items) {\n const item = [...event.dataTransfer.items].find(accept);\n if (item) {\n file = item.getAsFile();\n }\n } else {\n file = [...event.dataTransfer.files].find(accept);\n }\n\n return file;\n }\n}\n","import AttachmentController from \"./attachment_controller\";\nimport DocumentFieldController from \"./document_field_controller\";\nimport FileUploadController from \"./file_upload_controller\";\nimport ImageFieldController from \"./image_field_controller\";\n\nconst Definitions = [\n {\n identifier: \"govuk-attachment\",\n controllerConstructor: AttachmentController,\n },\n {\n identifier: \"govuk-document-field\",\n controllerConstructor: DocumentFieldController,\n },\n {\n identifier: \"govuk-file-upload\",\n controllerConstructor: FileUploadController,\n },\n {\n identifier: \"govuk-image-field\",\n controllerConstructor: ImageFieldController,\n },\n];\n\nexport { Definitions as default };\n","import FileFieldController from \"./file_field_controller\";\n\nexport default class DocumentFieldController extends FileFieldController {\n connect() {\n super.connect();\n\n this.initialPreviewContent = this.filenameTag.text;\n }\n\n setPreviewContent(content) {\n this.filenameTag.innerText = content;\n }\n\n showPreview(file) {\n const reader = new FileReader();\n\n reader.onload = (e) => {\n if (this.filenameTag) {\n this.filenameTag.innerText = file.name;\n }\n };\n reader.readAsDataURL(file);\n }\n\n get filenameTag() {\n return this.previewTarget.querySelector(\"p.preview-filename\");\n }\n}\n","import { Controller } from \"@hotwired/stimulus\";\nimport { I18n } from \"govuk-frontend/dist/govuk/i18n.mjs\";\nimport { closestAttributeValue } from \"govuk-frontend/dist/govuk/common/closest-attribute-value.mjs\";\nimport { createAttachment } from \"./attachment_controller\";\nimport config, { attachmentConfig, uploadButtonSelector } from \"../config\";\n\nexport default class FileUploadController extends Controller {\n connect() {\n if (!this.fileInput) {\n throw new Error(`Missing file input for ${this.element}`);\n }\n\n this.config = attachmentConfig(this.element);\n this.i18n = new I18n(this.config.i18n, {\n locale: closestAttributeValue(this.element, \"lang\"),\n });\n this.id = this.uploadButton?.id ?? this.fileInput.id;\n\n // dragenter/dragleave are on the document so we can tell a move between\n // child elements from truly leaving the drop zone; the document outlives\n // any re-enhancement, so these bind once per controller lifecycle.\n document.addEventListener(\"dragenter\", this.onDragenter);\n document.addEventListener(\"dragleave\", this.onDragleave);\n\n // The whole wrapper — figures included — is the drop target: a file\n // dragged anywhere over the field can be dropped.\n this.element.addEventListener(\"dragover\", this.onDragover);\n this.element.addEventListener(\"drop\", this.onDrop);\n\n this.enhance();\n\n // A morph reconciles this element against a server response that has no\n // JS-injected UI, in place and with no Stimulus lifecycle events (a\n // morph that changes the surrounding structure instead recreates the\n // element, which lands in connect()). The button vanishing without a\n // disconnect is the signal to re-enhance.\n this.morphObserver = new MutationObserver(this.onMorph);\n this.morphObserver.observe(this.element, { childList: true });\n }\n\n disconnect() {\n this.morphObserver?.disconnect();\n this.disabledObserver?.disconnect();\n this.uploadButton?.removeEventListener(\"click\", this.onClick);\n this.element.removeEventListener(\"dragover\", this.onDragover);\n this.element.removeEventListener(\"drop\", this.onDrop);\n this.unbindInput();\n document.removeEventListener(\"dragenter\", this.onDragenter);\n document.removeEventListener(\"dragleave\", this.onDragleave);\n this.announcements?.remove();\n }\n\n // Builds the JS-only UI over the server-rendered markup: a pseudo button\n // fronting the (hidden) input, and the assertive announcements region.\n // Idempotent over fresh server markup or whatever a morph left behind.\n enhance() {\n const fileInput = this.fileInput;\n let uploadButton = this.uploadButton;\n\n if (!uploadButton) {\n // The label's `for` still points at the input's original id (now the\n // button's id), so the label labels the button. Give it an id too, so\n // the button's `aria-labelledby` reference resolves.\n this.ensureLabelId();\n fileInput.id = `${this.id}-input`;\n fileInput.setAttribute(\"hidden\", \"hidden\");\n uploadButton = createUploadButton(this.id, this.i18n, fileInput);\n fileInput.insertAdjacentElement(\"beforebegin\", uploadButton);\n\n // The click listener dies with a stripped button and rebinds with\n // its replacement; the drag listeners live on the wrapper.\n uploadButton.addEventListener(\"click\", this.onClick);\n }\n\n // Appended to the drop zone (not between button and input, whose\n // adjacency the uploadButton getter relies on).\n if (!this.announcements) this.element.appendChild(createAnnouncements());\n\n // A morph may retain the input node (its listeners survive) or replace\n // it (they vanish); removing before adding makes rebinding safe in both.\n this.unbindInput();\n fileInput.addEventListener(\"change\", this.onChange);\n fileInput.addEventListener(\"govuk:upload\", this.onUpload);\n fileInput.addEventListener(\"govuk:remove\", this.onRemove);\n\n // The injected button is not a real input, so it does not inherit the\n // file input's disabled state; mirror it, and keep mirroring it if the\n // input's `disabled` attribute changes at runtime.\n this.updateDisabledState();\n this.observeDisabledState();\n\n this.updateCount();\n }\n\n unbindInput() {\n this.fileInput?.removeEventListener(\"change\", this.onChange);\n this.fileInput?.removeEventListener(\"govuk:upload\", this.onUpload);\n this.fileInput?.removeEventListener(\"govuk:remove\", this.onRemove);\n }\n\n onMorph = () => {\n if (this.uploadButton) return;\n\n // The morphed-in server response is the truth: files still held by the\n // input were either persisted (they came back as server figures) or\n // lost with the refresh, and a File handle on a retained figure node is\n // stale either way. Discard both, then rebuild the injected UI.\n this.fileInput.value = \"\";\n this.element.querySelectorAll(\"figure\").forEach((figure) => {\n delete figure.file;\n });\n\n this.enhance();\n };\n\n // The label is rendered by the form group, outside the drop zone, and\n // carries only a `for` (no id). The injected button references `${id}-label`\n // in its `aria-labelledby`, so ensure the label has that id.\n ensureLabelId() {\n const label = document.querySelector(`label[for=\"${this.id}\"]`);\n\n if (label && !label.id) label.id = `${this.id}-label`;\n }\n\n updateDisabledState() {\n if (!this.uploadButton) return;\n\n const disabled = this.fileInput.disabled;\n\n this.uploadButton.disabled = disabled;\n this.element.classList.toggle(\n `${config.brand}-file-upload-wrapper--disabled`,\n disabled,\n );\n }\n\n observeDisabledState() {\n this.disabledObserver?.disconnect();\n this.disabledObserver = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.attributeName === \"disabled\") this.updateDisabledState();\n }\n });\n\n this.disabledObserver.observe(this.fileInput, { attributes: true });\n }\n\n onClick = (event) => {\n this.fileInput.click();\n };\n\n // Drag & drop: the whole wrapper is the drop target, the button shows\n // the dragging state, and enter/leave are announced.\n onDragover = (event) => {\n if (this.fileInput.disabled) return;\n\n event.preventDefault();\n };\n\n onDragenter = (event) => {\n this.updateDropzoneVisibility(event);\n // A dragenter immediately before a dragleave means the pointer moved to\n // another element rather than leaving the window.\n this.enteredAnotherElement = true;\n };\n\n onDragleave = () => {\n if (!this.enteredAnotherElement && !this.uploadButton.disabled) {\n this.hideDraggingState();\n this.announce(this.i18n.t(\"leftDropZone\"));\n }\n\n this.enteredAnotherElement = false;\n };\n\n onDrop = (event) => {\n if (this.fileInput.disabled) return;\n\n event.preventDefault();\n\n if (event.dataTransfer && this.canFillInput(event.dataTransfer)) {\n this.fileInput.files = event.dataTransfer.files;\n this.fileInput.dispatchEvent(new CustomEvent(\"change\"));\n this.hideDraggingState();\n }\n };\n\n updateDropzoneVisibility(event) {\n if (this.uploadButton.disabled) return;\n if (!(event.target instanceof Node)) return;\n\n if (this.element.contains(event.target)) {\n if (event.dataTransfer && this.canDrop(event.dataTransfer)) {\n if (!this.isDragging) {\n this.showDraggingState();\n this.announce(this.i18n.t(\"enteredDropZone\"));\n }\n }\n } else if (this.isDragging) {\n this.hideDraggingState();\n this.announce(this.i18n.t(\"leftDropZone\"));\n }\n }\n\n showDraggingState() {\n this.uploadButton.classList.add(\n `${config.brand}-file-upload-button--dragging`,\n );\n }\n\n hideDraggingState() {\n this.uploadButton.classList.remove(\n `${config.brand}-file-upload-button--dragging`,\n );\n }\n\n announce(message) {\n if (this.announcements) this.announcements.textContent = message;\n }\n\n get announcements() {\n return this.element.querySelector(\n `.${config.brand}-file-upload-announcements`,\n );\n }\n\n // Whether a drop of this many files is allowed: any for a multiple input,\n // exactly one otherwise.\n matchesInputCapacity(numberOfFiles) {\n if (this.fileInput.multiple) return numberOfFiles > 0;\n\n return numberOfFiles === 1;\n }\n\n // During drag the files aren't readable, so count droppable items by kind.\n canDrop(dataTransfer) {\n if (dataTransfer.items.length) {\n return this.matchesInputCapacity(countFileItems(dataTransfer.items));\n }\n\n if (dataTransfer.types.length) {\n return dataTransfer.types.includes(\"Files\");\n }\n\n return true;\n }\n\n canFillInput(dataTransfer) {\n return this.matchesInputCapacity(dataTransfer.files.length);\n }\n\n onChange = () => {\n const files = Array.from(this.fileInput.files);\n const figures = Array.from(this.element.querySelectorAll(\"figure\"));\n\n // Re-selection replaces the FileList, so drop unclaimed previews whose\n // file is no longer in the input. Claimed figures own their file (an\n // upload is running or done) and are unaffected.\n figures.forEach((figure) => {\n if (figure.file && !files.includes(figure.file)) figure.remove();\n });\n\n // Render a figure per new file; each carries its File until a figure\n // controller claims it for upload (govuk:upload). Unclaimed files —\n // no endpoint, or no controller — stay in the input and submit as\n // ordinary multipart.\n files.forEach((file) => {\n if (figures.some((figure) => figure.file === file)) return;\n\n const attachment = createAttachment(this.fileInput, file, this.i18n);\n this.uploadButton.insertAdjacentElement(\"beforebegin\", attachment);\n });\n\n this.updateCount();\n };\n\n // A figure claimed its file for upload: release it from the FileList so\n // the same bytes don't also submit as multipart.\n onUpload = ({ detail: { file } }) => {\n this.releaseFile(file);\n this.updateCount();\n };\n\n releaseFile(file) {\n const remaining = new DataTransfer();\n\n for (const held of this.fileInput.files) {\n if (held !== file) remaining.items.add(held);\n }\n\n this.fileInput.files = remaining.files;\n }\n\n onRemove = async (event) => {\n // govuk:remove is dispatched before the figure is removed so listeners\n // can cancel it; wait until the current task ends, when the removal\n // (or the cancellation) is a fact.\n await Promise.resolve();\n\n if (event.defaultPrevented) return;\n\n const { name, file } = event.detail;\n\n // A removed figure that never claimed an upload still owns a file in\n // the input; release it so it no longer submits.\n if (file) this.releaseFile(file);\n\n // The removal is an event, so it is announced through the assertive\n // announcements region; the polite status region only ever carries\n // state (the count), which updates in place.\n this.announce(this.i18n.t(\"fileRemoved\", { filename: name }));\n this.updateCount();\n };\n\n updateCount() {\n const count = this.fileCount;\n\n if (count === 0) {\n this.statusTag.innerText = this.i18n.t(\"noFileChosen\");\n this.uploadButton.classList.add(\n `${config.brand}-file-upload-button--empty`,\n );\n } else {\n this.statusTag.innerText = this.i18n.t(\"multipleFilesChosen\", { count });\n this.uploadButton.classList.remove(\n `${config.brand}-file-upload-button--empty`,\n );\n }\n }\n\n get fileInput() {\n return this.element.querySelector(\"input[type='file']\");\n }\n\n get uploadButton() {\n return this.element.querySelector(uploadButtonSelector);\n }\n\n get isDragging() {\n return this.uploadButton.classList.contains(\n `${config.brand}-file-upload-button--dragging`,\n );\n }\n\n get statusTag() {\n return this.element.querySelector(\"button [aria-live]\");\n }\n\n get fileCount() {\n let count = this.fileInput.files.length;\n\n this.element\n .querySelectorAll(`select[name='${this.fileInput.name}']`)\n .forEach((select) => {\n // A figure still holding its unclaimed File is backed by a FileList\n // entry counted above.\n if (!select.closest(\"figure\")?.file) count += 1;\n });\n\n if (!this.fileInput.multiple) count = Math.min(count, 1);\n\n return count;\n }\n}\n\n// Counts DataTransferItems whose kind is \"file\" (ignoring dragged text etc.).\nfunction countFileItems(items) {\n return Array.from(items).filter((item) => item.kind === \"file\").length;\n}\n\n// A visually-hidden assertive live region for event announcements (drag\n// enter/leave, removals), kept separate from the polite status region that\n// carries the file count.\nfunction createAnnouncements() {\n const region = document.createElement(\"span\");\n region.className = `${config.brand}-file-upload-announcements ${config.brand}-visually-hidden`;\n region.setAttribute(\"aria-live\", \"assertive\");\n return region;\n}\n\nfunction createUploadButton(id, i18n, fileInput) {\n const brand = config.brand;\n const template = document.createElement(\"TEMPLATE\");\n template.innerHTML = `\n <button\n class=\"${brand}-file-upload-button ${brand}-file-upload-button--empty\"\n type=\"button\"\n id=\"${id}\"\n aria-labelledby=\"${id}-label ${id}-comma ${id}\"\n >\n <span class=\"${brand}-body ${brand}-file-upload-button__status\"\n aria-live=\"polite\">${i18n.t(\"noFileChosen\")}</span>\n <span class=\"${brand}-visually-hidden\" id=\"${id}-comma\">, </span>\n <span class=\"${brand}-file-upload-button__pseudo-button-container\">\n <span class=\"${brand}-button\n ${brand}-button--secondary\n ${brand}-file-upload-button__pseudo-button\">${i18n.t(\"chooseFilesButton\")}</span>\n <span class=\"${brand}-body ${brand}-file-upload-button__instruction\">${i18n.t(\"dropInstruction\")}</span>\n </span>\n </button>\n `;\n const button = template.content.firstElementChild;\n\n // Carry the input's hint/error descriptions onto the button, so the control\n // the user actually operates is described the same way the input was.\n const describedBy = fileInput.getAttribute(\"aria-describedby\");\n if (describedBy) button.setAttribute(\"aria-describedby\", describedBy);\n\n return button;\n}\n","import FileFieldController from \"./file_field_controller\";\n\nexport default class ImageFieldController extends FileFieldController {\n connect() {\n super.connect();\n\n this.initialPreviewContent = this.imageTag.getAttribute(\"src\");\n }\n\n setPreviewContent(content) {\n this.imageTag.src = content;\n }\n\n showPreview(file) {\n const reader = new FileReader();\n\n reader.onload = (e) => {\n this.imageTag.src = e.target.result;\n };\n reader.readAsDataURL(file);\n }\n\n get imageTag() {\n return this.previewTarget.querySelector(\"img\");\n }\n}\n","import {\n Button,\n CharacterCount,\n Checkboxes,\n ErrorSummary,\n FileUpload,\n PasswordInput,\n Radios,\n} from \"govuk-frontend/dist/govuk/all.mjs\";\nimport { SupportError } from \"govuk-frontend/dist/govuk/errors/index.mjs\";\nimport {\n isInitialised,\n isSupported,\n} from \"govuk-frontend/dist/govuk/common/index.mjs\";\n\n// Component options captured from the initAll call, reused by every\n// observer-driven sweep.\nlet options = {};\n\nfunction enhance($scope = document) {\n if (!isSupported()) {\n console.log(new SupportError());\n return;\n }\n const components = [\n [Button, options.button],\n [CharacterCount, options.characterCount],\n [Checkboxes],\n [ErrorSummary, options.errorSummary],\n [FileUpload, options.fileUpload],\n [Radios],\n [PasswordInput, options.passwordInput],\n ];\n components.forEach(([Component, config]) => {\n const selector = `[data-module=\"${Component.moduleName}\"]`;\n // The scope itself can be a component root (an observed insertion is\n // often the component element, not a container around one).\n const $elements = [\n ...($scope instanceof Element && $scope.matches(selector)\n ? [$scope]\n : []),\n ...$scope.querySelectorAll(selector),\n ];\n $elements.forEach(($element) => {\n if (isInitialised($element, Component.moduleName)) return;\n\n try {\n \"defaults\" in Component\n ? new Component($element, config)\n : new Component($element);\n } catch (error) {\n console.log(error);\n }\n });\n });\n}\n\n// The support markers are a JS-capability probe (govuk-frontend's own\n// pattern): a browser that can run this bundle marks <body> so component\n// initialisation and `govuk-frontend-supported`-gated CSS switch on. The\n// server never renders the markers.\nfunction markSupport(body) {\n body.classList.toggle(\"js-enabled\", true);\n body.classList.toggle(\n \"govuk-frontend-supported\",\n \"noModule\" in HTMLScriptElement.prototype,\n );\n}\n\nfunction supportMarked(body) {\n const supported = \"noModule\" in HTMLScriptElement.prototype;\n\n return (\n body.classList.contains(\"js-enabled\") &&\n body.classList.contains(\"govuk-frontend-supported\") === supported\n );\n}\n\nfunction observe(body) {\n // The body markers are JS-set, so a morph — which reconciles the live DOM\n // against server HTML, with no lifecycle events — strips them, along with\n // every component's data-*-init flag. Missing markers signal the morph:\n // re-mark, then sweep; the isInitialised guard re-enhances only roots\n // whose flags were stripped. Re-marking is check-then-set, so observing\n // our own write terminates in one bounce.\n //\n // Registered before the arrival observer: callbacks run in creation\n // order, so markers are back before an arrival sweep consults\n // isSupported().\n new MutationObserver(() => {\n if (supportMarked(body)) return;\n\n markSupport(body);\n enhance();\n }).observe(body, { attributes: true, attributeFilter: [\"class\"] });\n\n // Components can also arrive after load — lazily-loaded turbo frames,\n // stream inserts, any dynamic DOM — with no event in common. Enhance\n // added subtrees as they land; the per-component guard makes overlapping\n // sweeps harmless.\n new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n for (const node of mutation.addedNodes) {\n if (node instanceof Element) enhance(node);\n }\n }\n }).observe(body, { childList: true, subtree: true });\n}\n\nfunction setup(body) {\n if (!body || body.__govukFormbuilderInit) return;\n body.__govukFormbuilderInit = true;\n\n markSupport(body);\n enhance();\n observe(body);\n}\n\n// The gem's Stimulus controllers register exactly once, on whichever\n// application claims them first: the consumer's (via start) or a gem-owned\n// application created on demand (the snippet path, for apps not otherwise\n// running Stimulus). Stimulus itself observes the whole document, so\n// registration — unlike the body-scoped setup — survives Turbo visits.\nlet registered = false;\n\nfunction register(application = undefined) {\n if (registered) return;\n registered = true;\n\n (application ?? Application.start()).load(controllers);\n}\n\nfunction applyConfig(config) {\n if (config.brand) brandConfig.brand = config.brand;\n options = config;\n}\n\n/**\n * Enhance the current <body>: mark it as JS-capable, enhance its GOV.UK\n * components, and observe it for arrivals and morphs. Scoped to the body it\n * ran against — it does not survive a body replacement, so render it with\n * every page (the govuk_formbuilder_init snippet at the end of <body>).\n * Registers the gem's Stimulus controllers on a gem-owned application\n * unless start() has already claimed them.\n *\n * @param {object} [config] per-component config (button, characterCount,\n * errorSummary, fileUpload, passwordInput)\n * @param {string} [config.brand] CSS class prefix for injected UI (default \"govuk\")\n */\nfunction initAll(config = {}) {\n applyConfig(config);\n register();\n setup(document.body);\n}\n\nlet watching = false;\n\n/**\n * Wire the gem into your Stimulus application and keep the page enhanced\n * for the life of the session, including across Turbo visits — call once\n * from your own bundle:\n *\n * import GOVUK from \"@katalyst/govuk-formbuilder\";\n * GOVUK.start(application);\n *\n * @param {object} [application] Stimulus application to register the gem's\n * controllers on (a gem-owned application is created when omitted)\n * @param {object} [config] as initAll's config\n */\nfunction start(application = undefined, config = {}) {\n applyConfig(config);\n register(application);\n\n if (!watching) {\n watching = true;\n\n // The body-scoped setup dies with each Turbo visit; the documentElement\n // survives them, so watch it and set up against every new body. Also\n // covers a start() before <body> exists — the body's insertion is\n // itself a childList mutation here.\n new MutationObserver(() => setup(document.body)).observe(\n document.documentElement,\n { childList: true },\n );\n }\n\n setup(document.body);\n}\n\n// stimulus controllers\nimport { Application } from \"@hotwired/stimulus\";\nimport controllers from \"./controllers\";\nimport brandConfig from \"./config\";\n\nexport default { start };\n\nexport {\n initAll,\n Button,\n CharacterCount,\n Checkboxes,\n ErrorSummary,\n PasswordInput,\n Radios,\n};\n"],"names":["isInitialised","$root","moduleName","HTMLElement","hasAttribute","isSupported","$scope","document","body","classList","contains","isObject","option","Array","isArray","formatErrorMessage","Component","message","GOVUKFrontendError","Error","constructor","args","super","this","name","SupportError","supportMessage","HTMLScriptElement","prototype","ConfigError","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","configOverride","Symbol","for","ConfigurableComponent","param","config","_config","defaults","datasetConfig","normaliseDataset","dataset","mergeConfigs","normaliseString","value","property","trimmedValue","trim","output","outputType","type","includes","length","isFinite","Number","schema","out","entries","Object","properties","entry","namespace","field","toString","extractConfigByNamespace","configObjects","formattedConfigObject","configObject","key","keys","override","newObject","current","keyParts","split","index","I18n","translations","_config$locale","locale","documentElement","lang","t","lookupKey","options","translation","count","translationPluralForm","getPluralSuffix","match","replacePlaceholders","translationString","formatter","Intl","NumberFormat","supportedLocalesOf","undefined","replace","placeholderWithBraces","placeholderKey","hasOwnProperty","call","placeholderValue","format","hasIntlPluralRulesSupport","Boolean","window","PluralRules","preferredForm","select","console","warn","Button","debounceFormSubmitTimer","addEventListener","event","handleKeyDown","debounce","$target","target","getAttribute","preventDefault","click","preventDoubleClick","setTimeout","DEBOUNCE_TIMEOUT_IN_SECONDS","closestAttributeValue","$element","attributeName","$closestElementWithAttribute","closest","freeze","CharacterCount","configOverrides","maxlength","maxwords","_ref","_this$config$maxwords","$textarea","$visibleCountMessage","$screenReaderCountMessage","lastInputTimestamp","lastInputValue","valueChecker","i18n","maxLength","querySelector","HTMLTextAreaElement","HTMLInputElement","errors","validationErrors","conditions","required","errorMessage","every","push","validateConfig","Infinity","textareaDescriptionId","id","$textareaDescription","getElementById","$errorMessage","textContent","insertAdjacentElement","createElement","className","add","removeAttribute","bindChangeEvents","updateCount","updateCountMessage","handleInput","handleFocus","handleBlur","updateVisibleCountMessage","Date","now","setInterval","updateIfValueChanged","clearInterval","updateScreenReaderCountMessage","isError","toggle","isOverThreshold","getCountMessage","text","_text$match","tokens","remainingNumber","countType","formatCountMessage","translationKeySuffix","Math","abs","threshold","currentLength","charactersUnderLimit","one","other","charactersAtLimit","charactersOverLimit","wordsUnderLimit","wordsAtLimit","wordsOverLimit","textareaDescription","anyOf","Checkboxes","$inputs","querySelectorAll","forEach","$input","targetId","syncAllConditionalReveals","handleClick","syncConditionalRevealWithInputState","inputIsChecked","checked","unCheckAllInputsExcept","$inputWithSameName","form","unCheckExclusiveInputs","$exclusiveInput","$clickedInput","ErrorSummary","disableAutoFocus","_options$onBeforeFocu","isFocusable","onBlur","_options$onBlur","once","onBeforeFocus","focus","setFocus","focusTarget","HTMLAnchorElement","inputId","hash","$legendOrLabel","getAssociatedLegendOrLabel","scrollIntoView","preventScroll","_document$querySelect","$fieldset","$legends","getElementsByTagName","$candidateLegend","legendTop","getBoundingClientRect","top","inputRect","height","innerHeight","FileUpload","$button","$status","$label","$announcements","enteredAnotherElement","findLabel","createStatus","createButton","onChange","bind","updateDisabledState","observeDisabledState","bindDraggingEvents","innerText","ariaDescribedBy","appendChild","commaSpan","containerSpan","buttonSpan","insertAdjacentText","instructionSpan","onClick","onDrop","updateDropzoneVisibility","disabled","hideDraggingState","Node","dataTransfer","canDrop","showDraggingState","remove","canFillInput","files","dispatchEvent","CustomEvent","matchesInputCapacity","items","list","result","i","kind","countFileItems","types","numberOfFiles","multiple","fileCount","MutationObserver","mutationList","mutation","observe","attributes","chooseFilesButton","dropInstruction","noFileChosen","multipleFilesChosen","enteredDropZone","leftDropZone","PasswordInput","$showHideButton","$screenReaderStatusMessage","HTMLButtonElement","hide","persisted","show","setType","isHidden","prefixButton","prefixStatus","showPassword","hidePassword","showPasswordAriaLabel","hidePasswordAriaLabel","passwordShownAnnouncement","passwordHiddenAnnouncement","Radios","$allInputs","$clickedInputForm","$clickedInputName","hasSameFormOwner","brand","uploadButtonSelector","Attachment","uploadSucceeded","uploadFailed","retryButton","fileRemoved","removeButton","removeButtonContent","attachmentConfig","wrapper","AttachmentUploadController","DirectUploadController","start","dispatch","Promise","resolve","reject","directUpload","create","error","signed_id","nextAttachmentId","createAttachment","input","file","template","innerHTML","figure","content","firstElementChild","bytes","exp","min","floor","log2","UNITS","toPrecision","humanSize","size","keep","filename","FileFieldController","Controller","static","mimeTypes","connect","counter","initialPreviewContent","onUploadFlag","onUpload","hasDestroyTarget","destroyTarget","previewTarget","hasPreviewTarget","currentTarget","showPreview","setPreviewContent","setDestroy","previousInput","toggleAttribute","fileInput","filenameTag","drop","fileForEvent","mimeTypesValue","dT","DataTransfer","Event","dragover","dragenter","dragleave","reader","FileReader","onload","e","readAsDataURL","accept","indexOf","item","find","getAsFile","Definitions","controllerConstructor","change","previewPendingFile","uploadPendingFile","disconnect","removeEventListener","startsWith","imageTag","preview","onPreviewReady","directUploadUrl","detail","performUpload","uploader","state","statusText","progressTag","labelId","progress","max","createProgressTag","captionTag","inputOption","actionsTag","prepend","button","action","module","createRetryButton","src","destroy","retry","uploadButton","cancelable","tag","onDragenter","onDragleave","onDragover","enhance","morphObserver","onMorph","childList","disabledObserver","unbindInput","announcements","ensureLabelId","describedBy","createUploadButton","region","createAnnouncements","onRemove","label","mutations","announce","isDragging","from","filter","figures","some","attachment","releaseFile","remaining","held","async","defaultPrevented","statusTag","log","characterCount","errorSummary","fileUpload","passwordInput","selector","Element","matches","markSupport","supported","supportMarked","attributeFilter","node","addedNodes","subtree","setup","__govukFormbuilderInit","registered","register","application","Application","load","controllers","applyConfig","brandConfig","initAll","watching","formbuilder"],"mappings":"+HAgCA,SAASA,EAAcC,EAAOC,GAC5B,OAAOD,aAAiBE,aAAeF,EAAMG,aAAa,QAAQF,SACpE,CAWA,SAASG,EAAYC,EAASC,SAASC,MACrC,QAAKF,GAGEA,EAAOG,UAAUC,SAAS,2BACnC,CAIA,SAASC,EAASC,GAChB,QAASA,GAA4B,iBAAXA,IAJ5B,SAAiBA,GACf,OAAOC,MAAMC,QAAQF,EACvB,CAEoDE,CAAQF,EAC5D,CAIA,SAASG,EAAmBC,EAAWC,GACrC,MAAO,GAAGD,EAAUd,eAAee,GACrC,CC5DA,MAAMC,UAA2BC,MAC/B,WAAAC,IAAeC,GACbC,SAASD,GACTE,KAAKC,KAAO,oBACd,EAEF,MAAMC,UAAqBP,EAMzB,WAAAE,CAAYd,EAASC,SAASC,MAC5B,MAAMkB,EAAiB,aAAcC,kBAAkBC,UAAY,iHAAmH,mDACtLN,MAAMhB,EAASoB,EAAiB,gEAChCH,KAAKC,KAAO,cACd,EAEF,MAAMK,UAAoBX,EACxB,WAAAE,IAAeC,GACbC,SAASD,GACTE,KAAKC,KAAO,aACd,EAEF,MAAMM,UAAqBZ,EACzB,WAAAE,CAAYW,GACV,IAAId,EAAsC,iBAArBc,EAAgCA,EAAmB,GACxE,GAAIpB,EAASoB,GAAmB,CAC9B,MAAMC,UACJA,EAASC,WACT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