{"version":3,"file":"add-another.bundle.mjs","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","../../../../src/moj/components/add-another/add-another.mjs"],"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 'govuk-frontend'\n\nexport class AddAnother extends Component {\n  /**\n   * @param {Element | null} $root - HTML element to use for add another\n   */\n  constructor($root) {\n    super($root)\n\n    this.$root.addEventListener('click', this.onRemoveButtonClick.bind(this))\n    this.$root.addEventListener('click', this.onAddButtonClick.bind(this))\n\n    const $buttons = this.$root.querySelectorAll(\n      '.moj-add-another__add-button, moj-add-another__remove-button'\n    )\n\n    $buttons.forEach(($button) => {\n      if (!($button instanceof HTMLButtonElement)) {\n        return\n      }\n\n      $button.type = 'button'\n    })\n  }\n\n  /**\n   * @param {MouseEvent} event - Click event\n   */\n  onAddButtonClick(event) {\n    const $button = event.target\n\n    if (\n      !$button ||\n      !($button instanceof HTMLButtonElement) ||\n      !$button.classList.contains('moj-add-another__add-button')\n    ) {\n      return\n    }\n\n    const $items = this.getItems()\n    const $item = this.getNewItem()\n\n    if (!$item || !($item instanceof HTMLElement)) {\n      return\n    }\n\n    this.updateAttributes($item, $items.length)\n    this.resetItem($item)\n\n    const $firstItem = $items[0]\n    if (!this.hasRemoveButton($firstItem)) {\n      this.createRemoveButton($firstItem)\n    }\n\n    $items[$items.length - 1].after($item)\n\n    const $input = $item.querySelector('input, textarea, select')\n    if ($input && $input instanceof HTMLInputElement) {\n      $input.focus()\n    }\n  }\n\n  /**\n   * @param {HTMLElement} $item - Add another item\n   */\n  hasRemoveButton($item) {\n    return $item.querySelectorAll('.moj-add-another__remove-button').length\n  }\n\n  getItems() {\n    if (!this.$root) {\n      return []\n    }\n\n    const $items = Array.from(\n      this.$root.querySelectorAll('.moj-add-another__item')\n    )\n\n    return $items.filter((item) => item instanceof HTMLElement)\n  }\n\n  getNewItem() {\n    const $items = this.getItems()\n    const $item = $items[0].cloneNode(true)\n\n    if (!$item || !($item instanceof HTMLElement)) {\n      return\n    }\n\n    if (!this.hasRemoveButton($item)) {\n      this.createRemoveButton($item)\n    }\n\n    return $item\n  }\n\n  /**\n   * @param {HTMLElement} $item - Add another item\n   * @param {number} index - Add another item index\n   */\n  updateAttributes($item, index) {\n    $item.querySelectorAll('[data-name]').forEach(($input) => {\n      if (!this.isValidInputElement($input)) {\n        return\n      }\n\n      const name = $input.getAttribute('data-name') || ''\n      const id = $input.getAttribute('data-id') || ''\n      const originalId = $input.id\n\n      $input.name = name.replace(/%index%/, `${index}`)\n      $input.id = id.replace(/%index%/, `${index}`)\n\n      const $label =\n        $input.parentElement.querySelector('label') ||\n        $input.closest('label') ||\n        $item.querySelector(`[for=\"${originalId}\"]`)\n\n      if ($label && $label instanceof HTMLLabelElement) {\n        $label.htmlFor = $input.id\n      }\n    })\n  }\n\n  /**\n   * @param {HTMLElement} $item - Add another item\n   */\n  createRemoveButton($item) {\n    const $button = document.createElement('button')\n    $button.type = 'button'\n\n    $button.classList.add(\n      'govuk-button',\n      'govuk-button--secondary',\n      'moj-add-another__remove-button'\n    )\n\n    $button.textContent = 'Remove'\n\n    $item.append($button)\n  }\n\n  /**\n   * @param {HTMLElement} $item - Add another item\n   */\n  resetItem($item) {\n    $item.querySelectorAll('[data-name], [data-id]').forEach(($input) => {\n      if (!this.isValidInputElement($input)) {\n        return\n      }\n\n      if ($input instanceof HTMLSelectElement) {\n        $input.selectedIndex = -1\n        $input.value = ''\n      } else if ($input instanceof HTMLTextAreaElement) {\n        $input.value = ''\n      } else {\n        switch ($input.type) {\n          case 'checkbox':\n          case 'radio':\n            $input.checked = false\n            break\n          default:\n            $input.value = ''\n        }\n      }\n    })\n  }\n\n  /**\n   * @param {MouseEvent} event - Click event\n   */\n  onRemoveButtonClick(event) {\n    const $button = event.target\n\n    if (\n      !$button ||\n      !($button instanceof HTMLButtonElement) ||\n      !$button.classList.contains('moj-add-another__remove-button')\n    ) {\n      return\n    }\n\n    $button.closest('.moj-add-another__item').remove()\n\n    const $items = this.getItems()\n\n    if ($items.length === 1) {\n      $items[0].querySelector('.moj-add-another__remove-button').remove()\n    }\n\n    $items.forEach(($item, index) => {\n      this.updateAttributes($item, index)\n    })\n\n    this.focusHeading()\n  }\n\n  focusHeading() {\n    const $heading = this.$root.querySelector('.moj-add-another__heading')\n\n    if ($heading && $heading instanceof HTMLElement) {\n      $heading.focus()\n    }\n  }\n\n  /**\n   * @param {Element} $input - the input to validate\n   */\n  isValidInputElement($input) {\n    return (\n      $input instanceof HTMLInputElement ||\n      $input instanceof HTMLSelectElement ||\n      $input instanceof HTMLTextAreaElement\n    )\n  }\n\n  /**\n   * Name for the component used when initialising using data-module attributes.\n   */\n  static moduleName = 'moj-add-another'\n}\n"],"names":["isInitialised","$root","moduleName","HTMLElement","hasAttribute","isSupported","$scope","document","body","classList","contains","isArray","option","Array","isObject","formatErrorMessage","Component","message","GOVUKFrontendError","Error","constructor","args","name","SupportError","supportMessage","HTMLScriptElement","prototype","ElementError","messageOrOptions","component","identifier","element","expectedType","InitError","componentOrMessage","_$root","childConstructor","elementType","checkSupport","checkInitialised","setAttribute","AddAnother","addEventListener","onRemoveButtonClick","bind","onAddButtonClick","$buttons","querySelectorAll","forEach","$button","HTMLButtonElement","type","event","target","$items","getItems","$item","getNewItem","updateAttributes","length","resetItem","$firstItem","hasRemoveButton","createRemoveButton","after","$input","querySelector","HTMLInputElement","focus","from","filter","item","cloneNode","index","isValidInputElement","getAttribute","id","originalId","replace","$label","parentElement","closest","HTMLLabelElement","htmlFor","createElement","add","textContent","append","HTMLSelectElement","selectedIndex","value","HTMLTextAreaElement","checked","remove","focusHeading","$heading"],"mappings":"AAmFO,SAASA,aAAaA,CAACC,KAAK,EAAEC,UAAU,EAAE;EAC/C,OACED,KAAK,YAAYE,WAAW,IAC5BF,KAAK,CAACG,YAAY,CAAC,CAAA,KAAA,EAAQF,UAAU,CAAA,KAAA,CAAO,CAAC;AAEjD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,WAAWA,CAACC,MAAM,GAAGC,QAAQ,CAACC,IAAI,EAAE;EAClD,IAAI,CAACF,MAAM,EAAE;AACX,IAAA,OAAO,KAAK;AACd,EAAA;AAEA,EAAA,OAAOA,MAAM,CAACG,SAAS,CAACC,QAAQ,CAAC,0BAA0B,CAAC;AAC9D;AASA,SAASC,OAAOA,CAACC,MAAM,EAAE;AACvB,EAAA,OAAOC,KAAK,CAACF,OAAO,CAACC,MAAM,CAAC;AAC9B;AAUO,SAASE,QAAQA,CAACF,MAAM,EAAE;AAC/B,EAAA,OAAO,CAAC,CAACA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAI,CAACD,OAAO,CAACC,MAAM,CAAC;AACnE;AAsBO,SAASG,kBAAkBA,CAACC,SAAS,EAAEC,OAAO,EAAE;AACrD,EAAA,OAAO,GAAGD,SAAS,CAAC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