{"version":3,"file":"file-upload.bundle.mjs","sources":["../../../../src/govuk/errors/index.mjs","../../../../src/govuk/common/index.mjs","../../../../src/govuk/govuk-frontend-component.mjs","../../../../src/govuk/components/file-upload/file-upload.mjs"],"sourcesContent":["/**\n * GOV.UK Frontend error\n *\n * A base class for `Error`s thrown by GOV.UK Frontend.\n *\n * It is meant to be extended into specific types of errors\n * to be thrown by our code.\n *\n * @example\n * ```js\n * class MissingRootError extends GOVUKFrontendError {\n *   // Setting an explicit name is important as extending the class will not\n *   // set a new `name` on the subclass. The `name` property is important\n *   // to ensure intelligible error names even if the class name gets\n *   // mangled by a minifier\n *   name = \"MissingRootError\"\n * }\n * ```\n * @abstract\n */\nexport class GOVUKFrontendError extends Error {\n  name = 'GOVUKFrontendError'\n}\n\n/**\n * Indicates that GOV.UK Frontend is not supported\n */\nexport class SupportError extends GOVUKFrontendError {\n  name = 'SupportError'\n\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 =\n      'noModule' in HTMLScriptElement.prototype\n        ? 'GOV.UK Frontend initialised without `<body class=\"govuk-frontend-supported\">` from template `<script>` snippet'\n        : 'GOV.UK Frontend is not supported in this browser'\n\n    super(\n      $scope\n        ? supportMessage\n        : 'GOV.UK Frontend initialised without `<script type=\"module\">`'\n    )\n  }\n}\n\n/**\n * Indicates that a component has received an illegal configuration\n */\nexport class ConfigError extends GOVUKFrontendError {\n  name = 'ConfigError'\n}\n\n/**\n * Indicates an issue with an element (possibly `null` or `undefined`)\n */\nexport class ElementError extends GOVUKFrontendError {\n  name = 'ElementError'\n\n  /**\n   * @internal\n   * @overload\n   * @param {string} message - Element error message\n   */\n\n  /**\n   * @internal\n   * @overload\n   * @param {ElementErrorOptions} options - Element error options\n   */\n\n  /**\n   * @internal\n   * @param {string | ElementErrorOptions} messageOrOptions - Element error message or options\n   */\n  constructor(messageOrOptions) {\n    let message = typeof messageOrOptions === 'string' ? messageOrOptions : ''\n\n    // Build message from options\n    if (typeof messageOrOptions === 'object') {\n      const { componentName, identifier, element, expectedType } =\n        messageOrOptions\n\n      // Add prefix and identifier\n      message = `${componentName}: ${identifier}`\n\n      // Append reason\n      message += element\n        ? ` is not of type ${expectedType ?? 'HTMLElement'}`\n        : ' not found'\n    }\n\n    super(message)\n  }\n}\n\n/**\n * Element error options\n *\n * @internal\n * @typedef {object} ElementErrorOptions\n * @property {string} componentName - The name of the component throwing the error\n * @property {string} identifier - An identifier that'll let the user understand which element has an error. This is whatever makes the most sense\n * @property {Element | null} [element] - The element in error\n * @property {string} [expectedType] - The type that was expected for the identifier\n */\n","import { normaliseString } from './normalise-string.mjs'\n\n/**\n * Common helpers which do not require polyfill.\n *\n * IMPORTANT: If a helper require a polyfill, please isolate it in its own module\n * so that the polyfill can be properly tree-shaken and does not burden\n * the components that do not need that helper\n */\n\n/**\n * Config merging function\n *\n * Takes any number of objects and combines them together, with\n * greatest priority on the LAST item passed in.\n *\n * @internal\n * @param {...{ [key: string]: unknown }} configObjects - Config objects to merge\n * @returns {{ [key: string]: unknown }} A merged config object\n */\nexport function mergeConfigs(...configObjects) {\n  // Start with an empty object as our base\n  /** @type {{ [key: string]: unknown }} */\n  const formattedConfigObject = {}\n\n  // Loop through each of the passed objects\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\n      // Push their keys one-by-one into formattedConfigObject. Any duplicate\n      // keys with object values will be merged, otherwise the new value will\n      // override the existing value.\n      if (isObject(option) && isObject(override)) {\n        // @ts-expect-error Index signature for type 'string' is missing\n        formattedConfigObject[key] = mergeConfigs(option, override)\n      } else {\n        // Apply override\n        formattedConfigObject[key] = override\n      }\n    }\n  }\n\n  return formattedConfigObject\n}\n\n/**\n * Extracts keys starting with a particular namespace from dataset ('data-*')\n * object, removing the namespace in the process, normalising all values\n *\n * @internal\n * @param {{ schema: Schema }} Component - Component class\n * @param {DOMStringMap} dataset - The object to extract key-value pairs from\n * @param {string} namespace - The namespace to filter keys with\n * @returns {ObjectNested | undefined} Nested object with dot-separated key namespace removed\n */\nexport function extractConfigByNamespace(Component, dataset, namespace) {\n  const property = Component.schema.properties[namespace]\n\n  // Only extract configs for object schema properties\n  if (property?.type !== 'object') {\n    return\n  }\n\n  // Add default empty config\n  const newObject = {\n    [namespace]: /** @type {ObjectNested} */ ({})\n  }\n\n  for (const [key, value] of Object.entries(dataset)) {\n    /** @type {ObjectNested | ObjectNested[NestedKey]} */\n    let current = newObject\n\n    // Split the key into parts, using . as our namespace separator\n    const keyParts = key.split('.')\n\n    /**\n     * Create new level per part\n     *\n     * e.g. 'i18n.textareaDescription.other' becomes\n     * `{ i18n: { textareaDescription: { other } } }`\n     */\n    for (const [index, name] of keyParts.entries()) {\n      if (typeof current === 'object') {\n        // Drop down to nested object until the last part\n        if (index < keyParts.length - 1) {\n          // New nested object (optionally) replaces existing value\n          if (!isObject(current[name])) {\n            current[name] = {}\n          }\n\n          // Drop down into new or existing nested object\n          current = current[name]\n        } else if (key !== namespace) {\n          // Normalised value (optionally) replaces existing value\n          current[name] = normaliseString(value)\n        }\n      }\n    }\n  }\n\n  return newObject[namespace]\n}\n\n/**\n * Get hash fragment from URL\n *\n * Extract the hash fragment (everything after the hash) from a URL,\n * but not including the hash symbol\n *\n * @private\n * @param {string} url - URL\n * @returns {string | undefined} Fragment from URL, without the hash\n */\nexport function getFragmentFromUrl(url) {\n  if (!url.includes('#')) {\n    return undefined\n  }\n\n  return url.split('#').pop()\n}\n\n/**\n * Get GOV.UK Frontend breakpoint value from CSS custom property\n *\n * @private\n * @param {string} name - Breakpoint name\n * @returns {{ property: string, value?: string }} Breakpoint object\n */\nexport function getBreakpoint(name) {\n  const property = `--govuk-frontend-breakpoint-${name}`\n\n  // Get value from `<html>` with breakpoints on CSS :root\n  const value = window\n    .getComputedStyle(document.documentElement)\n    .getPropertyValue(property)\n\n  return {\n    property,\n    value: value || undefined\n  }\n}\n\n/**\n * Move focus to element\n *\n * Sets tabindex to -1 to make the element programmatically focusable,\n * but removes it on blur as the element doesn't need to be focused again.\n *\n * @private\n * @template {HTMLElement} FocusElement\n * @param {FocusElement} $element - HTML element\n * @param {object} [options] - Handler options\n * @param {function(this: FocusElement): void} [options.onBeforeFocus] - Callback before focus\n * @param {function(this: FocusElement): void} [options.onBlur] - Callback on blur\n */\nexport function setFocus($element, options = {}) {\n  const isFocusable = $element.getAttribute('tabindex')\n\n  if (!isFocusable) {\n    $element.setAttribute('tabindex', '-1')\n  }\n\n  /**\n   * Handle element focus\n   */\n  function onFocus() {\n    $element.addEventListener('blur', onBlur, { once: true })\n  }\n\n  /**\n   * Handle element blur\n   */\n  function onBlur() {\n    options.onBlur?.call($element)\n\n    if (!isFocusable) {\n      $element.removeAttribute('tabindex')\n    }\n  }\n\n  // Add listener to reset element on blur, after focus\n  $element.addEventListener('focus', onFocus, { once: true })\n\n  // Focus element\n  options.onBeforeFocus?.call($element)\n  $element.focus()\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 * @internal\n * @param {HTMLElement | null} [$scope] - HTML element `<body>` checked for browser support\n * @returns {boolean} Whether GOV.UK Frontend is supported on this page\n */\nexport function isSupported($scope = document.body) {\n  if (!$scope) {\n    return false\n  }\n\n  return $scope.classList.contains('govuk-frontend-supported')\n}\n\n/**\n * Validate component config by schema\n *\n * Follows limited examples in JSON schema for wider support in future\n *\n * {@link https://ajv.js.org/json-schema.html#compound-keywords}\n * {@link https://ajv.js.org/packages/ajv-errors.html#single-message}\n *\n * @internal\n * @param {Schema} schema - Config schema\n * @param {{ [key: string]: unknown }} config - Component config\n * @returns {string[]} List of validation errors\n */\nexport function validateConfig(schema, config) {\n  const validationErrors = []\n\n  // Check errors for each schema\n  for (const [name, conditions] of Object.entries(schema)) {\n    const errors = []\n\n    // Check errors for each schema condition\n    if (Array.isArray(conditions)) {\n      for (const { required, errorMessage } of conditions) {\n        if (!required.every((key) => !!config[key])) {\n          errors.push(errorMessage) // Missing config key value\n        }\n      }\n\n      // Check one condition passes or add errors\n      if (name === 'anyOf' && !(conditions.length - errors.length >= 1)) {\n        validationErrors.push(...errors)\n      }\n    }\n  }\n\n  return validationErrors\n}\n\n/**\n * Check for an array\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an array\n */\nfunction isArray(option) {\n  return Array.isArray(option)\n}\n\n/**\n * Check for an object\n *\n * @internal\n * @param {unknown} option - Option to check\n * @returns {boolean} Whether the option is an object\n */\nfunction isObject(option) {\n  return !!option && typeof option === 'object' && !isArray(option)\n}\n\n/**\n * Schema for component config\n *\n * @typedef {object} Schema\n * @property {{ [field: string]: SchemaProperty | undefined }} properties - Schema properties\n * @property {SchemaCondition[]} [anyOf] - List of schema conditions\n */\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/**\n * Schema condition for component config\n *\n * @typedef {object} SchemaCondition\n * @property {string[]} required - List of required config fields\n * @property {string} errorMessage - Error message when required config fields not provided\n */\n\n/**\n * @internal\n * @typedef {keyof ObjectNested} NestedKey\n * @typedef {{ [key: string]: string | boolean | number | ObjectNested | undefined }} ObjectNested\n */\n","import { isSupported } from './common/index.mjs'\nimport { SupportError } from './errors/index.mjs'\n\n/**\n * Base Component class\n *\n * Centralises the behaviours shared by our components\n *\n * @internal\n * @abstract\n */\nexport class GOVUKFrontendComponent {\n  /**\n   * Constructs a new component, validating that GOV.UK Frontend is supported\n   *\n   * @internal\n   */\n  constructor() {\n    this.checkSupport()\n  }\n\n  /**\n   * Validates whether GOV.UK Frontend is supported\n   *\n   * @private\n   * @throws {SupportError} when GOV.UK Frontend is not supported\n   */\n  checkSupport() {\n    if (!isSupported()) {\n      throw new SupportError()\n    }\n  }\n}\n","import { ElementError } from '../../errors/index.mjs'\nimport { GOVUKFrontendComponent } from '../../govuk-frontend-component.mjs'\n\n/**\n * File upload component\n *\n * Allow user to drag and drop file to upload\n */\nexport class FileUpload extends GOVUKFrontendComponent {\n  /** @private */\n  $module\n\n  /**\n   * Container for file upload.\n   *\n   * @private\n   * @type {HTMLElement | undefined}\n   */\n  $uploadContainer\n\n  /**\n   * Hidden input for file selection.\n   *\n   * @private\n   * @type {HTMLInputElement | undefined}\n   */\n  $fileInput\n\n  /**\n   * Button to open the file selection dialog.\n   *\n   * @type {HTMLButtonElement | undefined}\n   */\n  $uploadButton\n\n  /**\n   * Creates an instance of FileUploader.\n   *\n   * @param {Element | null} $module - HTML element to be used for error summary.\n   */\n  constructor($module) {\n    super()\n\n    if (!($module instanceof HTMLElement)) {\n      throw new ElementError({\n        componentName: 'File-upload',\n        element: $module,\n        identifier: 'Root element (`$module`)'\n      })\n    }\n\n    this.$module = $module\n\n    const uploadContainer = $module.querySelector('.upload-box')\n    if (uploadContainer instanceof HTMLElement) {\n      this.$uploadContainer = uploadContainer\n    }\n\n    const fileInput = $module.querySelector('input[data-file-input]')\n\n    if (fileInput instanceof HTMLInputElement) {\n      this.$fileInput = fileInput\n    }\n\n    const uploadButton = $module.querySelector('.upload-button')\n\n    if (uploadButton instanceof HTMLButtonElement) {\n      this.$uploadButton = uploadButton\n    }\n\n    // Initialize event listeners\n    this.initEventListeners()\n  }\n\n  /**\n   * Initializes event listeners for handling drag-and-drop and button file selection.\n   */\n  initEventListeners() {\n    // Clicking the button opens the file selection dialog\n    if (this.$uploadButton) {\n      this.$uploadButton.addEventListener('click', () =>\n        this.$fileInput?.click()\n      )\n    }\n\n    // Input change handles selected files\n    this.$fileInput?.addEventListener('change', () =>\n      this.handleFiles(this.$fileInput?.files)\n    )\n\n    if (this.$uploadContainer) {\n      // Drag-and-drop events\n      this.$uploadContainer.addEventListener('dragenter', (e) =>\n        this.onDragEnter(e)\n      )\n      this.$uploadContainer.addEventListener('dragover', (e) =>\n        this.onDragOver(e)\n      )\n      this.$uploadContainer.addEventListener('dragleave', (e) =>\n        this.onDragLeave(e)\n      )\n      this.$uploadContainer.addEventListener('drop', (e) => this.onDrop(e))\n    }\n  }\n\n  /**\n   * Handles the dragenter event.\n   *\n   * @param {DragEvent} event - The dragenter event.\n   */\n  onDragEnter(event) {\n    event.preventDefault()\n    event.stopPropagation()\n    this.$uploadContainer?.classList.add('dragover')\n  }\n\n  /**\n   * Handles the dragover event.\n   *\n   * @param {DragEvent} event - The dragover event.\n   */\n  onDragOver(event) {\n    event.preventDefault()\n    event.stopPropagation()\n  }\n\n  /**\n   * Handles the dragleave event.\n   *\n   * @param {DragEvent} event - The dragleave event.\n   */\n  onDragLeave(event) {\n    event.preventDefault()\n    event.stopPropagation()\n    this.$uploadContainer?.classList.remove('dragover')\n  }\n\n  /**\n   * Handles the drop event.\n   *\n   * @param {DragEvent} event - The drop event.\n   */\n  onDrop(event) {\n    event.preventDefault()\n    event.stopPropagation()\n    this.$uploadContainer?.classList.remove('dragover')\n    const files = event.dataTransfer?.files\n    this.handleFiles(files)\n  }\n\n  /**\n   * Handles the selected or dropped files.\n   *\n   * @param {FileList | null | undefined} files - The list of files to handle.\n   */\n  handleFiles(files) {\n    if (files && files.length > 0) {\n      alert(`Selected file: ${files[0].name}`)\n      // Add your file handling logic here\n    }\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'govuk-fileUpload'\n}\n\n/**\n * File upload config\n *\n * @typedef {object} FileUploadConfig\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 * @typedef {import('../../common/index.mjs').Schema} Schema\n */\n"],"names":["GOVUKFrontendError","Error","constructor","args","name","SupportError","$scope","document","body","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","message","componentName","identifier","element","expectedType","isSupported","classList","contains","GOVUKFrontendComponent","checkSupport","FileUpload","$module","$uploadContainer","$fileInput","$uploadButton","HTMLElement","uploadContainer","querySelector","fileInput","HTMLInputElement","uploadButton","HTMLButtonElement","initEventListeners","_this$$fileInput2","addEventListener","_this$$fileInput","click","_this$$fileInput3","handleFiles","files","e","onDragEnter","onDragOver","onDragLeave","onDrop","event","_this$$uploadContaine","preventDefault","stopPropagation","add","_this$$uploadContaine2","remove","_this$$uploadContaine3","_event$dataTransfer","dataTransfer","length","alert","moduleName"],"mappings":"AAoBO,MAAMA,kBAAkB,SAASC,KAAK,CAAC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;IAAA,IAC5CC,CAAAA,IAAI,GAAG,oBAAoB,CAAA;AAAA,GAAA;AAC7B,CAAA;AAKO,MAAMC,YAAY,SAASL,kBAAkB,CAAC;AAGnD;AACF;AACA;AACA;AACA;AACEE,EAAAA,WAAWA,CAACI,MAAM,GAAGC,QAAQ,CAACC,IAAI,EAAE;IAClC,MAAMC,cAAc,GAClB,UAAU,IAAIC,iBAAiB,CAACC,SAAS,GACrC,gHAAgH,GAChH,kDAAkD,CAAA;AAExD,IAAA,KAAK,CACHL,MAAM,GACFG,cAAc,GACd,8DACN,CAAC,CAAA;IAAA,IAjBHL,CAAAA,IAAI,GAAG,cAAc,CAAA;AAkBrB,GAAA;AACF,CAAA;AAYO,MAAMQ,YAAY,SAASZ,kBAAkB,CAAC;EAmBnDE,WAAWA,CAACW,gBAAgB,EAAE;IAC5B,IAAIC,OAAO,GAAG,OAAOD,gBAAgB,KAAK,QAAQ,GAAGA,gBAAgB,GAAG,EAAE,CAAA;AAG1E,IAAA,IAAI,OAAOA,gBAAgB,KAAK,QAAQ,EAAE;MACxC,MAAM;QAAEE,aAAa;QAAEC,UAAU;QAAEC,OAAO;AAAEC,QAAAA,YAAAA;AAAa,OAAC,GACxDL,gBAAgB,CAAA;AAGlBC,MAAAA,OAAO,GAAI,CAAA,EAAEC,aAAc,CAAA,EAAA,EAAIC,UAAW,CAAC,CAAA,CAAA;MA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