@defra/forms-engine-plugin 4.0.41 → 4.0.43

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.
Files changed (110) hide show
  1. package/.public/javascripts/application.min.js +1 -1
  2. package/.public/javascripts/application.min.js.map +1 -1
  3. package/.public/javascripts/shared.min.js +1 -1
  4. package/.public/javascripts/shared.min.js.map +1 -1
  5. package/.public/stylesheets/application.min.css +2 -2
  6. package/.public/stylesheets/application.min.css.map +1 -1
  7. package/.server/client/javascripts/location-map.d.ts +93 -0
  8. package/.server/client/javascripts/location-map.js +749 -0
  9. package/.server/client/javascripts/location-map.js.map +1 -0
  10. package/.server/client/javascripts/shared.d.ts +4 -0
  11. package/.server/client/javascripts/shared.js +5 -0
  12. package/.server/client/javascripts/shared.js.map +1 -1
  13. package/.server/client/stylesheets/_location-fields.scss +11 -0
  14. package/.server/client/stylesheets/application.scss +0 -1
  15. package/.server/client/stylesheets/shared.scss +1 -0
  16. package/.server/config/index.js +1 -1
  17. package/.server/config/index.js.map +1 -1
  18. package/.server/server/plugins/engine/configureEnginePlugin.d.ts +1 -1
  19. package/.server/server/plugins/engine/configureEnginePlugin.js +4 -2
  20. package/.server/server/plugins/engine/configureEnginePlugin.js.map +1 -1
  21. package/.server/server/plugins/engine/options.js +2 -1
  22. package/.server/server/plugins/engine/options.js.map +1 -1
  23. package/.server/server/plugins/engine/plugin.js +14 -1
  24. package/.server/server/plugins/engine/plugin.js.map +1 -1
  25. package/.server/server/plugins/engine/types.d.ts +1 -0
  26. package/.server/server/plugins/engine/types.js.map +1 -1
  27. package/.server/server/plugins/engine/views/components/_location-field-base.html +1 -1
  28. package/.server/server/plugins/engine/views/components/osgridreffield.html +4 -2
  29. package/.server/server/plugins/map/index.d.ts +7 -0
  30. package/.server/server/plugins/map/index.js +20 -0
  31. package/.server/server/plugins/map/index.js.map +1 -0
  32. package/.server/server/plugins/map/routes/get-os-token.d.ts +6 -0
  33. package/.server/server/plugins/map/routes/get-os-token.js +41 -0
  34. package/.server/server/plugins/map/routes/get-os-token.js.map +1 -0
  35. package/.server/server/plugins/map/routes/get-os-token.test.js +49 -0
  36. package/.server/server/plugins/map/routes/get-os-token.test.js.map +1 -0
  37. package/.server/server/plugins/map/routes/index.d.ts +10 -0
  38. package/.server/server/plugins/map/routes/index.js +172 -0
  39. package/.server/server/plugins/map/routes/index.js.map +1 -0
  40. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark.json +690 -0
  41. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark.png +0 -0
  42. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark@2x.json +690 -0
  43. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark@2x.png +0 -0
  44. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale.json +690 -0
  45. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale.png +0 -0
  46. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale@2x.json +690 -0
  47. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale@2x.png +0 -0
  48. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite.json +690 -0
  49. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite.png +0 -0
  50. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite@2x.json +690 -0
  51. package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite@2x.png +0 -0
  52. package/.server/server/plugins/map/routes/vts/OS_VTS_3857_Black_and_White.json +7858 -0
  53. package/.server/server/plugins/map/routes/vts/OS_VTS_3857_Dark.json +7669 -0
  54. package/.server/server/plugins/map/routes/vts/OS_VTS_3857_Outdoor.json +7653 -0
  55. package/.server/server/plugins/map/routes/vts/README.md +5 -0
  56. package/.server/server/plugins/map/service.d.ts +14 -0
  57. package/.server/server/plugins/map/service.js +76 -0
  58. package/.server/server/plugins/map/service.js.map +1 -0
  59. package/.server/server/plugins/map/service.test.js +120 -0
  60. package/.server/server/plugins/map/service.test.js.map +1 -0
  61. package/.server/server/plugins/map/test/__stubs__/find.d.ts +3 -0
  62. package/.server/server/plugins/map/test/__stubs__/find.js +216 -0
  63. package/.server/server/plugins/map/test/__stubs__/find.js.map +1 -0
  64. package/.server/server/plugins/map/test/__stubs__/nearest.d.ts +37 -0
  65. package/.server/server/plugins/map/test/__stubs__/nearest.js +38 -0
  66. package/.server/server/plugins/map/test/__stubs__/nearest.js.map +1 -0
  67. package/.server/server/plugins/map/types.d.ts +233 -0
  68. package/.server/server/plugins/map/types.js +121 -0
  69. package/.server/server/plugins/map/types.js.map +1 -0
  70. package/.server/server/types.d.ts +1 -0
  71. package/.server/server/types.js.map +1 -1
  72. package/package.json +3 -1
  73. package/src/client/javascripts/location-map.js +774 -0
  74. package/src/client/javascripts/shared.js +4 -0
  75. package/src/client/stylesheets/_location-fields.scss +11 -0
  76. package/src/client/stylesheets/application.scss +0 -1
  77. package/src/client/stylesheets/shared.scss +1 -0
  78. package/src/config/index.ts +1 -1
  79. package/src/server/plugins/engine/configureEnginePlugin.ts +4 -2
  80. package/src/server/plugins/engine/options.js +2 -1
  81. package/src/server/plugins/engine/plugin.ts +14 -1
  82. package/src/server/plugins/engine/types.ts +1 -0
  83. package/src/server/plugins/engine/views/components/_location-field-base.html +1 -1
  84. package/src/server/plugins/engine/views/components/osgridreffield.html +4 -2
  85. package/src/server/plugins/map/index.js +19 -0
  86. package/src/server/plugins/map/routes/get-os-token.js +41 -0
  87. package/src/server/plugins/map/routes/get-os-token.test.js +55 -0
  88. package/src/server/plugins/map/routes/index.js +192 -0
  89. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark.json +690 -0
  90. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark.png +0 -0
  91. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark@2x.json +690 -0
  92. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark@2x.png +0 -0
  93. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale.json +690 -0
  94. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale.png +0 -0
  95. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale@2x.json +690 -0
  96. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale@2x.png +0 -0
  97. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite.json +690 -0
  98. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite.png +0 -0
  99. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite@2x.json +690 -0
  100. package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite@2x.png +0 -0
  101. package/src/server/plugins/map/routes/vts/OS_VTS_3857_Black_and_White.json +7858 -0
  102. package/src/server/plugins/map/routes/vts/OS_VTS_3857_Dark.json +7669 -0
  103. package/src/server/plugins/map/routes/vts/OS_VTS_3857_Outdoor.json +7653 -0
  104. package/src/server/plugins/map/routes/vts/README.md +5 -0
  105. package/src/server/plugins/map/service.js +84 -0
  106. package/src/server/plugins/map/service.test.js +144 -0
  107. package/src/server/plugins/map/test/__stubs__/find.js +271 -0
  108. package/src/server/plugins/map/test/__stubs__/nearest.js +46 -0
  109. package/src/server/plugins/map/types.js +120 -0
  110. package/src/server/types.ts +1 -0
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see shared.min.js.LICENSE.txt */
2
- var e,t,n,o={},r={};function i(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return o[e](n,n.exports,i),n.exports}i.m=o,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,i.t=function(n,o){if(1&o&&(n=this(n)),8&o)return n;if("object"==typeof n&&n){if(4&o&&n.__esModule)return n;if(16&o&&"function"==typeof n.then)return n}var r=Object.create(null);i.r(r);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&o&&n;("object"==typeof a||"function"==typeof a)&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach(e=>s[e]=()=>n[e]);return s.default=()=>n,i.d(r,s),r},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,n)=>(i.f[n](e,t),t),[])),i.u=e=>"javascripts/vendor/accessible-autocomplete.min.js",i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},i.l=(e,t,o,r)=>{if(n[e])n[e].push(t);else{var s,a;if(void 0!==o)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var c=l[u];if(c.getAttribute("src")==e){s=c;break}}s||(a=!0,(s=document.createElement("script")).type="module",s.charset="utf-8",i.nc&&s.setAttribute("nonce",i.nc),s.src=e),n[e]=[t];var d=(t,o)=>{s.onerror=s.onload=null,clearTimeout(h);var r=n[e];if(delete n[e],s.parentNode&&s.parentNode.removeChild(s),r&&r.forEach(e=>e(o)),t)return t(o)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),a&&document.head.appendChild(s)}},i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e+"../"})(),(()=>{var e={804:0};i.f.j=(t,n)=>{var o=i.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise((n,r)=>o=e[t]=[n,r]);n.push(o[2]=r);var s=i.p+i.u(t),a=new Error;i.l(s,n=>{if(i.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+s+")",a.name="ChunkLoadError",a.type=r,a.request=s,o[1](a)}},"chunk-"+t,t)}};var t=(t,n)=>{var o,r,s=n[0],a=n[1],l=n[2],u=0;if(s.some(t=>0!==e[t])){for(o in a)i.o(a,o)&&(i.m[o]=a[o]);l&&l(i)}for(t&&t(n);u<s.length;u++)r=s[u],i.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=self.webpackChunk=self.webpackChunk||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();const s="aria-describedby",a="error-summary-title";function l(e,t,n){if(document.querySelector(".govuk-error-summary"))return void(document.getElementById(a)?n.setAttribute(s,a):n.removeAttribute(s));t&&(t.innerHTML=`\n <div class="govuk-error-summary" data-module="govuk-error-summary">\n <div role="alert">\n <h2 class="govuk-error-summary__title" id="${a}">\n There is a problem\n </h2>\n <div class="govuk-error-summary__body">\n <ul class="govuk-list govuk-error-summary__list">\n <li>\n <a href="#file-upload">${e}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n `,n.setAttribute(s,a));const o=n.closest(".govuk-form-group");if(o){o.classList.add("govuk-form-group--error"),n.classList.add("govuk-file-upload--error");const t=n.id;let r=document.getElementById(`${t}-error`);r||(r=document.createElement("p"),r.id=`${t}-error`,r.className="govuk-error-message",r.innerHTML=`<span class="govuk-visually-hidden">Error:</span> ${e}`,o.insertBefore(r,n)),n.setAttribute(s,`error-summary-title ${t}-error`)}}function u(){window.history.replaceState(null,"",window.location.href),window.location.href=window.location.pathname}function c(){var e;const t=document.querySelector('form:has(input[type="file"])'),n=t?t.querySelector('input[type="file"]'):null,o=t?t.querySelector(".upload-file-button"):null,r=null!=(e=Array.from(document.querySelectorAll("button.govuk-button")).find(e=>"Continue"===e.textContent.trim()))?e:null,i=document.querySelector(".govuk-error-summary-container");if(!t||!n||!o)return;const a=t;let c=null,d=!1;const h=a.dataset.uploadId;n.addEventListener("change",()=>{i&&(i.innerHTML=""),n.files&&n.files.length>0&&(c=n.files[0])}),o.addEventListener("click",e=>{if(!c)return e.preventDefault(),void l("Select a file",i,n);d?e.preventDefault():(d=!0,function(e,t,n,o,r){(function(e,t,n){var o;const r=document.getElementById("uploadedFilesContainer"),i=r?r.closest("form"):null;if(!(i&&i instanceof HTMLFormElement))return;const a=i.querySelector("p.govuk-body");if(!a)return;const l=function(e,t){let n=null==e?void 0:e.querySelector("#statusInformation");if(!n){n=document.createElement("div"),n.id="statusInformation",n.className="govuk-visually-hidden",n.setAttribute("aria-live","polite");try{!function(e,t,n){var o;null!=t&&t.nextSibling&&t.parentNode===e?e.insertBefore(n,t.nextSibling):(null!=(o=null==t?void 0:t.parentNode)?o:e).appendChild(n)}(e,t,n)}catch(o){try{null==e||e.appendChild(n)}catch(r){document.body.appendChild(n)}}}return n}(i,a),u=n.querySelector('input[type="file"]');u&&u.setAttribute(s,"statusInformation");const c=function(e,t){let n=e.querySelector("dl.govuk-summary-list");if(!n){n=document.createElement("dl"),n.className="govuk-summary-list govuk-summary-list--long-key";const o=e.querySelector(".govuk-button-group");o?e.insertBefore(n,o):e.insertBefore(n,t.nextSibling)}return n}(i,a),d=document.querySelector(`[data-filename="${null==e?void 0:e.name}"]`);d&&d.remove();const h=function(e,t){var n,o;const r=document.createElement("div");return r.className="govuk-summary-list__row",r.setAttribute("data-filename",null!=(n=null==e?void 0:e.name)?n:""),r.innerHTML=`\n <dt class="govuk-summary-list__key">\n ${null!=(o=null==e?void 0:e.name)?o:""}\n </dt>\n <dd class="govuk-summary-list__value">\n <strong class="govuk-tag govuk-tag--yellow">${t}</strong>\n </dd>\n <dd class="govuk-summary-list__actions">\n </dd>\n `,r}(e,t);c.insertBefore(h,c.firstChild),l.textContent=`${null!=(o=null==e?void 0:e.name)?o:""} ${t}`})(r,"Uploading…",e),t.focus(),setTimeout(()=>{t.disabled=!0,n.disabled=!0,o.disabled=!0},100)}(a,n,o,r,c),function(e,t,n,o,r,i){var s;if(!t.action||!i)return!1;e.preventDefault();const a=new FormData(t),c=!!t.dataset.proxyUrl,d=null!=(s=t.dataset.proxyUrl)?s:t.action,h={method:"POST",body:a,redirect:c?"follow":"manual"};c&&(h.mode="no-cors"),fetch(d,h).then(()=>{!function(e){let t=0;const n=setInterval(()=>{if(t++,t>=300)return clearInterval(n),void u();const o=function(e,t){const n=e.replace(/\/preview\/(draft|live)/g,"").replace(/\/{2,}/g,"/").replace(/\/$/,"").split("/").filter(Boolean);return`${n.length>2?`/${n.slice(0,n.length-2).join("/")}`:""}/upload-status/${t}`}(window.location.pathname,e);fetch(o,{headers:{Accept:"application/json"}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{"ready"===e.uploadStatus&&(clearInterval(n),u())}).catch(()=>{clearInterval(n),u()})},1e3)}(i)}).catch(()=>(n.disabled=!1,o.disabled=!1,l("There was a problem uploading the file",r,n),null))}(e,a,n,o,i,h))})}function d(e,t={}){var n;const o=e.getAttribute("tabindex");function r(){var n;null==(n=t.onBlur)||n.call(e),o||e.removeAttribute("tabindex")}o||e.setAttribute("tabindex","-1"),e.addEventListener("focus",function(){e.addEventListener("blur",r,{once:!0})},{once:!0}),null==(n=t.onBeforeFocus)||n.call(e),e.focus()}function h(e=document.body){return!!e&&e.classList.contains("govuk-frontend-supported")}function m(e){return!!e&&"object"==typeof e&&!function(e){return Array.isArray(e)}(e)}function p(e){return!!e&&(e instanceof Element||e instanceof Document)}function f(e,t){return`${e.moduleName}: ${t}`}class g extends Error{constructor(...e){super(...e),this.name="GOVUKFrontendError"}}class v extends g{constructor(e=document.body){const t="noModule"in HTMLScriptElement.prototype?'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet':"GOV.UK Frontend is not supported in this browser";super(e?t:'GOV.UK Frontend initialised without `<script type="module">`'),this.name="SupportError"}}class b extends g{constructor(...e){super(...e),this.name="ConfigError"}}class y extends g{constructor(e){let t="string"==typeof e?e:"";if(m(e)){const{component:n,identifier:o,element:r,expectedType:i}=e;t=o,t+=r?` is not of type ${null!=i?i:"HTMLElement"}`:" not found",n&&(t=f(n,t))}super(t),this.name="ElementError"}}class w extends g{constructor(e){super("string"==typeof e?e:f(e,"Root element (`$root`) already initialised")),this.name="InitError"}}class k{get $root(){return this._$root}constructor(e){this._$root=void 0;const t=this.constructor;if("string"!=typeof t.moduleName)throw new w("`moduleName` not defined in component");if(!(e instanceof t.elementType))throw new y({element:e,component:t,identifier:"Root element (`$root`)",expectedType:t.elementType.name});this._$root=e,t.checkSupport(),this.checkInitialised();const n=t.moduleName;this.$root.setAttribute(`data-${n}-init`,"")}checkInitialised(){const e=this.constructor,t=e.moduleName;if(t&&function(e,t){return e instanceof HTMLElement&&e.hasAttribute(`data-${t}-init`)}(this.$root,t))throw new w(e)}static checkSupport(){if(!h())throw new v}}k.elementType=HTMLElement;const $=Symbol.for("configOverride");class E extends k{[$](e){return{}}get config(){return this._config}constructor(e,t){super(e),this._config=void 0;const n=this.constructor;if(!m(n.defaults))throw new b(f(n,"Config passed as parameter into constructor but no defaults defined"));const o=function(e,t){if(!m(e.schema))throw new b(f(e,"Config passed as parameter into constructor but no schema defined"));const n={},o=Object.entries(e.schema.properties);for(const r of o){const[o,i]=r,s=o.toString();s in t&&(n[s]=x(t[s],i)),"object"===(null==i?void 0:i.type)&&(n[s]=A(e.schema,t,o))}return n}(n,this._$root.dataset);this._config=C(n.defaults,null!=t?t:{},this[$](o),o)}}function x(e,t){const n=e?e.trim():"";let o,r=null==t?void 0:t.type;switch(r||(["true","false"].includes(n)&&(r="boolean"),n.length>0&&isFinite(Number(n))&&(r="number")),r){case"boolean":o="true"===n;break;case"number":o=Number(n);break;default:o=e}return o}function C(...e){const t={};for(const n of e)for(const e of Object.keys(n)){const o=t[e],r=n[e];m(o)&&m(r)?t[e]=C(o,r):t[e]=r}return t}function A(e,t,n){const o=e.properties[n];if("object"!==(null==o?void 0:o.type))return;const r={[n]:{}};for(const[i,s]of Object.entries(t)){let e=r;const t=i.split(".");for(const[o,r]of t.entries())m(e)&&(o<t.length-1?(m(e[r])||(e[r]={}),e=e[r]):i!==n&&(e[r]=x(s)))}return r[n]}function L(e,t,n){let o;const r=function(e){let t,n=document;if(m(e)){const o=e;(p(o.scope)||null===o.scope)&&(n=o.scope),"function"==typeof o.onError&&(t=o.onError)}return p(e)?n=e:null===e?n=null:"function"==typeof e&&(t=e),{scope:n,onError:t}}(n);try{var i;if(!h())throw new v;if(null===r.scope)throw new y({element:r.scope,component:e,identifier:"Scope element (`$scope`)"});o=null==(i=r.scope)?void 0:i.querySelectorAll(`[data-module="${e.moduleName}"]`)}catch(s){return r.onError?r.onError(s,{component:e,config:t}):console.log(s),[]}return Array.from(null!=o?o:[]).map(n=>{try{return void 0!==t?new e(n,t):new e(n)}catch(s){return r.onError?r.onError(s,{element:n,component:e,config:t}):console.log(s),null}}).filter(Boolean)}class S extends E{constructor(e,t={}){super(e,t),this.debounceFormSubmitTimer=null,this.$root.addEventListener("keydown",e=>this.handleKeyDown(e)),this.$root.addEventListener("click",e=>this.debounce(e))}handleKeyDown(e){const t=e.target;" "===e.key&&t instanceof HTMLElement&&"button"===t.getAttribute("role")&&(e.preventDefault(),t.click())}debounce(e){if(this.config.preventDoubleClick)return this.debounceFormSubmitTimer?(e.preventDefault(),!1):void(this.debounceFormSubmitTimer=window.setTimeout(()=>{this.debounceFormSubmitTimer=null},1e3))}}function M(e,t){const n=e.closest(`[${t}]`);return n?n.getAttribute(t):null}S.moduleName="govuk-button",S.defaults=Object.freeze({preventDoubleClick:!1}),S.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class I{constructor(e={},t={}){var n;this.translations=void 0,this.locale=void 0,this.translations=e,this.locale=null!=(n=t.locale)?n:document.documentElement.lang||"en"}t(e,t){if(!e)throw new Error("i18n: lookup key missing");let n=this.translations[e];if("number"==typeof(null==t?void 0:t.count)&&m(n)){const o=n[this.getPluralSuffix(e,t.count)];o&&(n=o)}if("string"==typeof n){if(n.match(/%{(.\S+)}/)){if(!t)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,t)}return n}return e}replacePlaceholders(e,t){const n=Intl.NumberFormat.supportedLocalesOf(this.locale).length?new Intl.NumberFormat(this.locale):void 0;return e.replace(/%{(.\S+)}/g,function(e,o){if(Object.prototype.hasOwnProperty.call(t,o)){const e=t[o];return!1===e||"number"!=typeof e&&"string"!=typeof e?"":"number"==typeof e?n?n.format(e):`${e}`:e}throw new Error(`i18n: no data found to replace ${e} placeholder in string`)})}hasIntlPluralRulesSupport(){return Boolean("PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)}getPluralSuffix(e,t){if(t=Number(t),!isFinite(t))return"other";const n=this.translations[e],o=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(t):"other";if(m(n)){if(o in n)return o;if("other"in n)return console.warn(`i18n: Missing plural form ".${o}" for "${this.locale}" locale. Falling back to ".other".`),"other"}throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`)}}class T extends E{[$](e){let t={};return("maxwords"in e||"maxlength"in e)&&(t={maxlength:void 0,maxwords:void 0}),t}constructor(e,t={}){var n,o;super(e,t),this.$textarea=void 0,this.$visibleCountMessage=void 0,this.$screenReaderCountMessage=void 0,this.lastInputTimestamp=null,this.lastInputValue="",this.valueChecker=null,this.i18n=void 0,this.maxLength=void 0;const r=this.$root.querySelector(".govuk-js-character-count");if(!(r instanceof HTMLTextAreaElement||r instanceof HTMLInputElement))throw new y({component:T,element:r,expectedType:"HTMLTextareaElement or HTMLInputElement",identifier:"Form field (`.govuk-js-character-count`)"});const i=function(e,t){const n=[];for(const[o,r]of Object.entries(e)){const e=[];if(Array.isArray(r)){for(const{required:n,errorMessage:o}of r)n.every(e=>!!t[e])||e.push(o);"anyOf"!==o||r.length-e.length>=1||n.push(...e)}}return n}(T.schema,this.config);if(i[0])throw new b(f(T,i[0]));this.i18n=new I(this.config.i18n,{locale:M(this.$root,"lang")}),this.maxLength=null!=(n=null!=(o=this.config.maxwords)?o:this.config.maxlength)?n:1/0,this.$textarea=r;const s=`${this.$textarea.id}-info`,a=document.getElementById(s);if(!a)throw new y({component:T,element:a,identifier:`Count message (\`id="${s}"\`)`});this.$errorMessage=this.$root.querySelector(".govuk-error-message"),a.textContent.match(/^\s*$/)&&(a.textContent=this.i18n.t("textareaDescription",{count:this.maxLength})),this.$textarea.insertAdjacentElement("afterend",a);const l=document.createElement("div");l.className="govuk-character-count__sr-status govuk-visually-hidden",l.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=l,a.insertAdjacentElement("afterend",l);const u=document.createElement("div");u.className=a.className,u.classList.add("govuk-character-count__status"),u.setAttribute("aria-hidden","true"),this.$visibleCountMessage=u,a.insertAdjacentElement("afterend",u),a.classList.add("govuk-visually-hidden"),this.$textarea.removeAttribute("maxlength"),this.bindChangeEvents(),window.addEventListener("pageshow",()=>this.updateCountMessage()),this.updateCountMessage()}bindChangeEvents(){this.$textarea.addEventListener("keyup",()=>this.handleKeyUp()),this.$textarea.addEventListener("focus",()=>this.handleFocus()),this.$textarea.addEventListener("blur",()=>this.handleBlur())}handleKeyUp(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()}handleFocus(){this.valueChecker=window.setInterval(()=>{(!this.lastInputTimestamp||Date.now()-500>=this.lastInputTimestamp)&&this.updateIfValueChanged()},1e3)}handleBlur(){this.valueChecker&&window.clearInterval(this.valueChecker)}updateIfValueChanged(){this.$textarea.value!==this.lastInputValue&&(this.lastInputValue=this.$textarea.value,this.updateCountMessage())}updateCountMessage(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()}updateVisibleCountMessage(){const e=this.maxLength-this.count(this.$textarea.value)<0;this.$visibleCountMessage.classList.toggle("govuk-character-count__message--disabled",!this.isOverThreshold()),this.$errorMessage||this.$textarea.classList.toggle("govuk-textarea--error",e),this.$visibleCountMessage.classList.toggle("govuk-error-message",e),this.$visibleCountMessage.classList.toggle("govuk-hint",!e),this.$visibleCountMessage.textContent=this.getCountMessage()}updateScreenReaderCountMessage(){this.isOverThreshold()?this.$screenReaderCountMessage.removeAttribute("aria-hidden"):this.$screenReaderCountMessage.setAttribute("aria-hidden","true"),this.$screenReaderCountMessage.textContent=this.getCountMessage()}count(e){var t;return this.config.maxwords?(null!=(t=e.match(/\S+/g))?t:[]).length:e.length}getCountMessage(){const e=this.maxLength-this.count(this.$textarea.value),t=this.config.maxwords?"words":"characters";return this.formatCountMessage(e,t)}formatCountMessage(e,t){if(0===e)return this.i18n.t(`${t}AtLimit`);const n=e<0?"OverLimit":"UnderLimit";return this.i18n.t(`${t}${n}`,{count:Math.abs(e)})}isOverThreshold(){if(!this.config.threshold)return!0;const e=this.count(this.$textarea.value);return this.maxLength*this.config.threshold/100<=e}}T.moduleName="govuk-character-count",T.defaults=Object.freeze({threshold:0,i18n:{charactersUnderLimit:{one:"You have %{count} character remaining",other:"You have %{count} characters remaining"},charactersAtLimit:"You have 0 characters remaining",charactersOverLimit:{one:"You have %{count} character too many",other:"You have %{count} characters too many"},wordsUnderLimit:{one:"You have %{count} word remaining",other:"You have %{count} words remaining"},wordsAtLimit:"You have 0 words remaining",wordsOverLimit:{one:"You have %{count} word too many",other:"You have %{count} words too many"},textareaDescription:{other:""}}}),T.schema=Object.freeze({properties:{i18n:{type:"object"},maxwords:{type:"number"},maxlength:{type:"number"},threshold:{type:"number"}},anyOf:[{required:["maxwords"],errorMessage:'Either "maxlength" or "maxwords" must be provided'},{required:["maxlength"],errorMessage:'Either "maxlength" or "maxwords" must be provided'}]});class O extends k{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="checkbox"]');if(!t.length)throw new y({component:O,identifier:'Form inputs (`<input type="checkbox">`)'});this.$inputs=t,this.$inputs.forEach(e=>{const t=e.getAttribute("data-aria-controls");if(t){if(!document.getElementById(t))throw new y({component:O,identifier:`Conditional reveal (\`id="${t}"\`)`});e.setAttribute("aria-controls",t),e.removeAttribute("data-aria-controls")}}),window.addEventListener("pageshow",()=>this.syncAllConditionalReveals()),this.syncAllConditionalReveals(),this.$root.addEventListener("click",e=>this.handleClick(e))}syncAllConditionalReveals(){this.$inputs.forEach(e=>this.syncConditionalRevealWithInputState(e))}syncConditionalRevealWithInputState(e){const t=e.getAttribute("aria-controls");if(!t)return;const n=document.getElementById(t);if(null!=n&&n.classList.contains("govuk-checkboxes__conditional")){const t=e.checked;e.setAttribute("aria-expanded",t.toString()),n.classList.toggle("govuk-checkboxes__conditional--hidden",!t)}}unCheckAllInputsExcept(e){document.querySelectorAll(`input[type="checkbox"][name="${e.name}"]`).forEach(t=>{e.form===t.form&&t!==e&&(t.checked=!1,this.syncConditionalRevealWithInputState(t))})}unCheckExclusiveInputs(e){document.querySelectorAll(`input[data-behaviour="exclusive"][type="checkbox"][name="${e.name}"]`).forEach(t=>{e.form===t.form&&(t.checked=!1,this.syncConditionalRevealWithInputState(t))})}handleClick(e){const t=e.target;t instanceof HTMLInputElement&&"checkbox"===t.type&&(t.getAttribute("aria-controls")&&this.syncConditionalRevealWithInputState(t),t.checked&&("exclusive"===t.getAttribute("data-behaviour")?this.unCheckAllInputsExcept(t):this.unCheckExclusiveInputs(t)))}}O.moduleName="govuk-checkboxes";class j extends E{constructor(e,t={}){super(e,t),this.config.disableAutoFocus||d(this.$root),this.$root.addEventListener("click",e=>this.handleClick(e))}handleClick(e){const t=e.target;t&&this.focusTarget(t)&&e.preventDefault()}focusTarget(e){if(!(e instanceof HTMLAnchorElement))return!1;const t=e.hash.replace("#","");if(!t)return!1;const n=document.getElementById(t);if(!n)return!1;const o=this.getAssociatedLegendOrLabel(n);return!!o&&(o.scrollIntoView(),n.focus({preventScroll:!0}),!0)}getAssociatedLegendOrLabel(e){var t;const n=e.closest("fieldset");if(n){const t=n.getElementsByTagName("legend");if(t.length){const n=t[0];if(e instanceof HTMLInputElement&&("checkbox"===e.type||"radio"===e.type))return n;const o=n.getBoundingClientRect().top,r=e.getBoundingClientRect();if(r.height&&window.innerHeight&&r.top+r.height-o<window.innerHeight/2)return n}}return null!=(t=document.querySelector(`label[for='${e.getAttribute("id")}']`))?t:e.closest("label")}}j.moduleName="govuk-error-summary",j.defaults=Object.freeze({disableAutoFocus:!1}),j.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class _ extends k{constructor(e){super(e),this.$menuButton=void 0,this.$menu=void 0,this.menuIsOpen=!1,this.mql=null;const t=this.$root.querySelector(".govuk-js-header-toggle");if(!t)return this;this.$root.classList.add("govuk-header--with-js-navigation");const n=t.getAttribute("aria-controls");if(!n)throw new y({component:_,identifier:'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'});const o=document.getElementById(n);if(!o)throw new y({component:_,element:o,identifier:`Navigation (\`<ul id="${n}">\`)`});this.$menu=o,this.$menuButton=t,this.setupResponsiveChecks(),this.$menuButton.addEventListener("click",()=>this.handleMenuButtonClick())}setupResponsiveChecks(){const e=function(){const e="--govuk-breakpoint-desktop";return{property:e,value:window.getComputedStyle(document.documentElement).getPropertyValue(e)||void 0}}();if(!e.value)throw new y({component:_,identifier:`CSS custom property (\`${e.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${e.value})`),"addEventListener"in this.mql?this.mql.addEventListener("change",()=>this.checkMode()):this.mql.addListener(()=>this.checkMode()),this.checkMode()}checkMode(){this.mql&&this.$menu&&this.$menuButton&&(this.mql.matches?(this.$menu.removeAttribute("hidden"),this.$menuButton.setAttribute("hidden","")):(this.$menuButton.removeAttribute("hidden"),this.$menuButton.setAttribute("aria-expanded",this.menuIsOpen.toString()),this.menuIsOpen?this.$menu.removeAttribute("hidden"):this.$menu.setAttribute("hidden","")))}handleMenuButtonClick(){this.menuIsOpen=!this.menuIsOpen,this.checkMode()}}_.moduleName="govuk-header";class q extends E{constructor(e,t={}){super(e,t),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||d(this.$root)}}q.moduleName="govuk-notification-banner",q.defaults=Object.freeze({disableAutoFocus:!1}),q.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class B extends k{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="radio"]');if(!t.length)throw new y({component:B,identifier:'Form inputs (`<input type="radio">`)'});this.$inputs=t,this.$inputs.forEach(e=>{const t=e.getAttribute("data-aria-controls");if(t){if(!document.getElementById(t))throw new y({component:B,identifier:`Conditional reveal (\`id="${t}"\`)`});e.setAttribute("aria-controls",t),e.removeAttribute("data-aria-controls")}}),window.addEventListener("pageshow",()=>this.syncAllConditionalReveals()),this.syncAllConditionalReveals(),this.$root.addEventListener("click",e=>this.handleClick(e))}syncAllConditionalReveals(){this.$inputs.forEach(e=>this.syncConditionalRevealWithInputState(e))}syncConditionalRevealWithInputState(e){const t=e.getAttribute("aria-controls");if(!t)return;const n=document.getElementById(t);if(null!=n&&n.classList.contains("govuk-radios__conditional")){const t=e.checked;e.setAttribute("aria-expanded",t.toString()),n.classList.toggle("govuk-radios__conditional--hidden",!t)}}handleClick(e){const t=e.target;if(!(t instanceof HTMLInputElement)||"radio"!==t.type)return;const n=document.querySelectorAll('input[type="radio"][aria-controls]'),o=t.form,r=t.name;n.forEach(e=>{const t=e.form===o;e.name===r&&t&&this.syncConditionalRevealWithInputState(e)})}}B.moduleName="govuk-radios";class N extends k{constructor(e){var t;super(e);const n=this.$root.hash,o=null!=(t=this.$root.getAttribute("href"))?t:"";if(this.$root.origin!==window.location.origin||this.$root.pathname!==window.location.pathname)return;const r=n.replace("#","");if(!r)throw new y(`Skip link: Target link (\`href="${o}"\`) has no hash fragment`);const i=document.getElementById(r);if(!i)throw new y({component:N,element:i,identifier:`Target content (\`id="${r}"\`)`});this.$root.addEventListener("click",()=>d(i,{onBeforeFocus(){i.classList.add("govuk-skip-link-focused-element")},onBlur(){i.classList.remove("govuk-skip-link-focused-element")}}))}}N.elementType=HTMLAnchorElement,N.moduleName="govuk-skip-link";const R=function(){L(S),L(T),L(O),L(j),L(_),L(q),L(B),L(N)},F=function(){const e=document.querySelectorAll('[data-module="govuk-accessible-autocomplete"]');e.length&&i.e(7).then(i.t.bind(i,60,19)).then(t=>{const{default:n}=t;e.forEach(e=>function(e,t){if(!e)return;const n={id:e.id,selectElement:e};t(n);const o=document.querySelector(`#${n.id}`),r=[...e.options].map(e=>e.text);null==o||o.addEventListener("blur",()=>{o.value&&r.includes(o.value)||(e.value="")})}(e.querySelector("select"),n.enhanceSelectElement))}).catch(console.error)},P=function(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c):c()},H=function(){if(window.opener){const e=document.querySelector(".js-preview-banner-close");null==e||e.removeAttribute("hidden"),null==e||e.addEventListener("click",e=>{e.preventDefault(),window.close()})}};function D(){R(),F(),P(),H()}export{D as initAll,F as initAllAutocomplete,R as initAllGovuk,P as initFileUpload,H as initPreviewCloseLink};
2
+ var t,e,n,r={57:(t,e,n)=>{n.d(e,{Yv:()=>M});let r=" ";class o{static get separator(){return r}static set separator(t){r=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let n=null;switch(e.length){case 3:n=e[0]/1+e[1]/60+e[2]/3600;break;case 2:n=e[0]/1+e[1]/60;break;case 1:n=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(n=-n),Number(n)}static toDms(t,e="d",n=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===n)switch(e){case"d":case"deg":n=4;break;case"dm":case"deg+min":n=2;break;case"dms":case"deg+min+sec":n=0;break;default:e="d",n=4}t=Math.abs(t);let r=null,i=null,s=null,a=null;switch(e){default:case"d":case"deg":i=t.toFixed(n),i<100&&(i="0"+i),i<10&&(i="0"+i),r=i+"°";break;case"dm":case"deg+min":i=Math.floor(t),s=(60*t%60).toFixed(n),60==s&&(s=(0).toFixed(n),i++),i=("000"+i).slice(-3),s<10&&(s="0"+s),r=i+"°"+o.separator+s+"′";break;case"dms":case"deg+min+sec":i=Math.floor(t),s=Math.floor(3600*t/60)%60,a=(3600*t%60).toFixed(n),60==a&&(a=(0).toFixed(n),s++),60==s&&(s=0,i++),i=("000"+i).slice(-3),s=("00"+s).slice(-2),a<10&&(a="0"+a),r=i+"°"+o.separator+s+"′"+o.separator+a+"″"}return r}static toLat(t,e,n){const r=o.toDms(o.wrap90(t),e,n);return null===r?"–":r.slice(1)+o.separator+(t<0?"S":"N")}static toLon(t,e,n){const r=o.toDms(o.wrap180(t),e,n);return null===r?"–":r+o.separator+(t<0?"W":"E")}static toBrng(t,e,n){const r=o.toDms(o.wrap360(t),e,n);return null===r?"–":r.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(n.thousands,"⁜").replace(n.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),n={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",n.decimal).replace("⁜",n.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=o.wrap360(t);const n=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*n/360)%n*16/n]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const i=o;class s{constructor(t,e,n){if(isNaN(t)||isNaN(e)||isNaN(n))throw new TypeError(`invalid vector [${t},${e},${n}]`);this.x=Number(t),this.y=Number(e),this.z=Number(n)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");return new s(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");return new s(this.x-t.x,this.y-t.y,this.z-t.z)}times(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new s(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new s(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");const e=this.y*t.z-this.z*t.y,n=this.z*t.x-this.x*t.z,r=this.x*t.y-this.y*t.x;return new s(e,n,r)}negate(){return new s(-this.x,-this.y,-this.z)}unit(){const t=this.length;if(1==t)return this;if(0==t)return this;const e=this.x/t,n=this.y/t,r=this.z/t;return new s(e,n,r)}angleTo(t,e=void 0){if(!(t instanceof s))throw new TypeError("v is not Vector3d object");if(!(e instanceof s||null==e))throw new TypeError("n is not Vector3d object");const n=null==e||this.cross(t).dot(e)>=0?1:-1,r=this.cross(t).length*n,o=this.dot(t);return Math.atan2(r,o)}rotateAround(t,e){if(!(t instanceof s))throw new TypeError("axis is not Vector3d object");const n=e.toRadians(),r=this.unit(),o=t.unit(),i=Math.sin(n),a=Math.cos(n),l=1-a,u=o.x,c=o.y,d=o.z,h=[[l*u*u+a,l*u*c-i*d,l*u*d+i*c],[l*u*c+i*d,l*c*c+a,l*c*d-i*u],[l*u*d-i*c,l*c*d+i*u,l*d*d+a]],m=[h[0][0]*r.x+h[0][1]*r.y+h[0][2]*r.z,h[1][0]*r.x+h[1][1]*r.y+h[1][2]*r.z,h[2][0]*r.x+h[2][1]*r.y+h[2][2]*r.z];return new s(m[0],m[1],m[2])}toString(t=3){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const a=s,l={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},u={WGS84:{ellipsoid:l.WGS84}};Object.freeze(l.WGS84),Object.freeze(u.WGS84);class c{constructor(t,e,n=0){if(isNaN(t)||null==t)throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e)||null==e)throw new TypeError(`invalid lon ‘${e}’`);if(isNaN(n)||null==n)throw new TypeError(`invalid height ‘${n}’`);this._lat=i.wrap90(Number(t)),this._lon=i.wrap180(Number(e)),this._height=Number(n)}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?i.wrap90(i.parse(t)):i.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?i.wrap90(i.parse(t)):i.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?i.wrap180(i.parse(t)):i.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}get height(){return this._height}set height(t){if(this._height=Number(t),isNaN(this._height))throw new TypeError(`invalid height ‘${t}’`)}get datum(){return this._datum}set datum(t){this._datum=t}static get ellipsoids(){return l}static get datums(){return u}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");let e,n,r;if("object"==typeof t[0]&&(1==t.length||!isNaN(parseFloat(t[1])))){const o=t[0];if("Point"==o.type&&Array.isArray(o.coordinates)?([n,e,r]=o.coordinates,r=r||0):(null!=o.latitude&&(e=o.latitude),null!=o.lat&&(e=o.lat),null!=o.longitude&&(n=o.longitude),null!=o.lng&&(n=o.lng),null!=o.lon&&(n=o.lon),null!=o.height&&(r=o.height),e=i.wrap90(i.parse(e)),n=i.wrap180(i.parse(n))),null!=t[1]&&(r=t[1]),isNaN(e)||isNaN(n))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if("string"==typeof t[0]&&2==t[0].split(",").length&&([e,n]=t[0].split(","),e=i.wrap90(i.parse(e)),n=i.wrap180(i.parse(n)),r=t[1]||0,isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t[0]}’`);if(null==e&&null==n&&([e,n]=t,e=i.wrap90(i.parse(e)),n=i.wrap180(i.parse(n)),r=t[2]||0,isNaN(e)||isNaN(n)))throw new TypeError(`invalid point ‘${t.toString()}’`);return new this(e,n,r)}toCartesian(){const t=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:l.WGS84,e=this.lat.toRadians(),n=this.lon.toRadians(),r=this.height,{a:o,f:i}=t,s=Math.sin(e),a=Math.cos(e),u=Math.sin(n),c=Math.cos(n),h=2*i-i*i,m=o/Math.sqrt(1-h*s*s);return new d((m+r)*a*c,(m+r)*a*u,(m*(1-h)+r)*s)}equals(t){if(!(t instanceof c))throw new TypeError(`invalid point ‘${t}’`);return!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON||Math.abs(this.height-t.height)>Number.EPSILON||this.datum!=t.datum||this.referenceFrame!=t.referenceFrame||this.epoch!=t.epoch)}toString(t="d",e=void 0,n=null){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);const r=(this.height>=0?" +":" ")+this.height.toFixed(n)+"m";return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)}, ${this.lon.toFixed(e)}${null==n?"":r}`):`${i.toLat(this.lat,t,e)}, ${i.toLon(this.lon,t,e)}${null==n?"":r}`}}class d extends a{constructor(t,e,n){super(t,e,n)}toLatLon(t=l.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:n,z:r}=this,{a:o,b:i,f:s}=t,a=2*s-s*s,u=a/(1-a),d=Math.sqrt(e*e+n*n),h=i*r/(o*d)*(1+u*i/Math.sqrt(d*d+r*r)),m=h/Math.sqrt(1+h*h),p=m/h,f=isNaN(p)?0:Math.atan2(r+u*i*m*m*m,d-a*o*p*p*p),g=Math.atan2(n,e),v=Math.sin(f),b=d*Math.cos(f)+r*v-o*o/(o/Math.sqrt(1-a*v*v));return new c(f.toDegrees(),g.toDegrees(),b)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const h={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},m={ED50:{ellipsoid:h.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:h.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:h.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:h.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:h.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:h.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:h.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:h.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:h.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:h.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:h.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(h).forEach(t=>Object.freeze(h[t])),Object.keys(m).forEach(t=>{Object.freeze(m[t]),Object.freeze(m[t].transform)});class p extends c{constructor(t,e,n=0,r=m.WGS84){if(!r||null==r.ellipsoid)throw new TypeError(`unrecognised datum ‘${r}’`);super(t,e,n),this._datum=r}get datum(){return this._datum}static get ellipsoids(){return h}static get datums(){return m}static parse(...t){let e=m.WGS84;if((4==t.length||3==t.length&&"object"==typeof t[2])&&(e=t.pop()),!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const n=super.parse(...t);return n._datum=e,n}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);return this.toCartesian().convertDatum(t).toLatLon()}toCartesian(){const t=super.toCartesian();return new f(t.x,t.y,t.z,this.datum)}}class f extends d{constructor(t,e,n,r=void 0){if(r&&null==r.ellipsoid)throw new TypeError(`unrecognised datum ‘${r}’`);super(t,e,n),r&&(this._datum=r)}get datum(){return this._datum}set datum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);this._datum=t}toLatLon(t=void 0){t&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=t);const e=this.datum||m.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const n=super.toLatLon(e.ellipsoid);return new p(n.lat,n.lon,n.height,this.datum)}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let e=null,n=null;null!=this.datum&&this.datum!=m.WGS84||(e=this,n=t.transform),t==m.WGS84&&(e=this,n=this.datum.transform.map(t=>-t)),null==n&&(e=this.convertDatum(m.WGS84),n=t.transform);const r=e.applyTransform(n);return r.datum=t,r}applyTransform(t){const{x:e,y:n,z:r}=this,o=t[0],i=t[1],s=t[2],a=t[3]/1e6+1,l=(t[4]/3600).toRadians(),u=(t[5]/3600).toRadians(),c=(t[6]/3600).toRadians();return new f(o+e*a-n*c+r*u,i+e*c+n*a-r*l,s-e*u+n*l+r*a)}}const g={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:p.ellipsoids.Airy1830};class v{constructor(t,e){if(this.easting=Number(t),this.northing=Number(e),isNaN(t)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${t}’`);if(isNaN(e)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${e}’`)}toLatLon(t=p.datums.WGS84){const{easting:e,northing:n}=this,{a:r,b:o}=g.ellipsoid,i=g.trueOrigin.lat.toRadians(),s=g.trueOrigin.lon.toRadians(),a=-g.falseOrigin.easting,l=-g.falseOrigin.northing,u=g.scaleFactor,c=1-o*o/(r*r),d=(r-o)/(r+o),h=d*d,m=d*d*d;let f=i,v=0;do{f=(n-l-v)/(r*u)+f,v=o*u*((1+d+5/4*h+5/4*m)*(f-i)-(3*d+3*d*d+21/8*m)*Math.sin(f-i)*Math.cos(f+i)+(15/8*h+15/8*m)*Math.sin(2*(f-i))*Math.cos(2*(f+i))-35/24*m*Math.sin(3*(f-i))*Math.cos(3*(f+i)))}while(Math.abs(n-l-v)>=1e-5);const w=Math.cos(f),y=Math.sin(f),$=r*u/Math.sqrt(1-c*y*y),k=r*u*(1-c)/Math.pow(1-c*y*y,1.5),E=$/k-1,S=Math.tan(f),x=S*S,N=x*x,M=1/w,L=$*$*$,C=L*$*$,A=e-a,T=A*A,O=T*A,_=T*T,I=O*T;f=f-S/(2*k*$)*T+S/(24*k*L)*(5+3*x+E-9*x*E)*_-S/(720*k*C)*(61+90*x+45*N)*(_*T);const R=s+M/$*A-M/(6*L)*($/k+2*x)*O+M/(120*C)*(5+28*x+24*N)*I-M/(C*$*$*5040)*(61+662*x+1320*N+N*x*720)*(I*T);let j=new b(f.toDegrees(),R.toDegrees(),0,p.datums.OSGB36);return t!=p.datums.OSGB36&&(j=j.convertDatum(t),j=new b(j.lat,j.lon,j.height,j.datum)),j}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new v(e[1],e[2]);if(e=t.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!e)throw new Error(`invalid grid reference ‘${t}’`);let n=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),r=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);n>7&&n--,r>7&&r--;const o=(n-2)%5*5+r%5,i=19-5*Math.floor(n/5)-Math.floor(r/5);let s=t.slice(2).trim().split(/\s+/);if(1==s.length&&(s=[s[0].slice(0,s[0].length/2),s[0].slice(s[0].length/2)]),s[0].length!=s[1].length)throw new Error(`invalid grid reference ‘${t}’`);s[0]=s[0].padEnd(5,"0"),s[1]=s[1].padEnd(5,"0");const a=o+s[0],l=i+s[1];return new v(a,l)}toString(t=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);let{easting:e,northing:n}=this;if(0==t){const t={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${e.toLocaleString("en",t)},${n.toLocaleString("en",t)}`}const r=Math.floor(e/1e5),o=Math.floor(n/1e5);let i=19-o-(19-o)%5+Math.floor((r+10)/5),s=5*(19-o)%25+r%5;i>7&&i++,s>7&&s++;const a=String.fromCharCode(i+"A".charCodeAt(0),s+"A".charCodeAt(0));return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),n=Math.floor(n%1e5/Math.pow(10,5-t/2)),e=e.toString().padStart(t/2,"0"),n=n.toString().padStart(t/2,"0"),`${a} ${e} ${n}`}}class b extends p{toOsGrid(){const t=this.datum==p.datums.OSGB36?this:this.convertDatum(p.datums.OSGB36),e=t.lat.toRadians(),n=t.lon.toRadians(),{a:r,b:o}=g.ellipsoid,i=g.trueOrigin.lat.toRadians(),s=g.trueOrigin.lon.toRadians(),a=-g.falseOrigin.easting,l=-g.falseOrigin.northing,u=g.scaleFactor,c=1-o*o/(r*r),d=(r-o)/(r+o),h=d*d,m=d*d*d,f=Math.cos(e),b=Math.sin(e),w=r*u/Math.sqrt(1-c*b*b),y=r*u*(1-c)/Math.pow(1-c*b*b,1.5),$=w/y-1,k=o*u*((1+d+5/4*h+5/4*m)*(e-i)-(3*d+3*d*d+21/8*m)*Math.sin(e-i)*Math.cos(e+i)+(15/8*h+15/8*m)*Math.sin(2*(e-i))*Math.cos(2*(e+i))-35/24*m*Math.sin(3*(e-i))*Math.cos(3*(e+i))),E=f*f*f,S=E*f*f,x=Math.tan(e)*Math.tan(e),N=x*x,M=n-s,L=M*M,C=L*M,A=C*M,T=A*M;let O=k+l+w/2*b*f*L+w/24*b*E*(5-x+9*$)*A+w/720*b*S*(61-58*x+N)*(T*M),_=a+w*f*M+w/6*E*(w/y-x)*C+w/120*S*(5-18*x+N+14*$-58*x*$)*T;O=Number(O.toFixed(3)),_=Number(_.toFixed(3));try{return new v(_,O)}catch(I){throw new Error(`${I.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new b(e.lat,e.lon,e.height,e.datum)}}function w(){return w=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},w.apply(null,arguments)}function y({easting:t,northing:e}){const n=new v(t,e).toLatLon();return{lat:n.latitude,long:n.longitude}}function $(t){const e=v.parse(t).toLatLon();return{lat:e.latitude,long:e.longitude}}const k={zoom:"6",center:[-2.421975,53.825564]},E=169,S="input.govuk-input",x={interactMarkerChange:"interact:markerchange"},N={VTS_OUTDOOR_URL:"/api/maps/vts/OS_VTS_3857_Outdoor.json",VTS_DARK_URL:"/api/maps/vts/OS_VTS_3857_Dark.json",VTS_BLACK_AND_WHITE_URL:"/api/maps/vts/OS_VTS_3857_Black_and_White.json"};function M(t={}){const{assetPath:e="/assets",apiPath:n="/form/api",data:r=N}=t,o=document.querySelectorAll(".app-location-field");if(o.length){const t=document.querySelector("form");if(null===t)return;const e=Array.from(t.querySelectorAll("button"));t.addEventListener("submit",function(t){return function(e){e.submitter instanceof HTMLButtonElement&&t.includes(e.submitter)||e.preventDefault()}}(e),!1)}o.forEach((t,o)=>{!function(t,e,n){var r;if(!(e instanceof HTMLDivElement))return;const o=e.querySelector(".app-location-field-inputs");if(!(o instanceof HTMLDivElement))return;const i=e.dataset.locationtype;if(!i||!["latlongfield","eastingnorthingfield","osgridreffield"].includes(i))return;const s=document.createElement("div"),a=`map_${n}`;s.setAttribute("id",a),s.setAttribute("class","map-container");const l=null!=(r=function(t){switch(t.dataset.locationtype){case"latlongfield":return function(t){const{latInput:e,longInput:n}=O(t),r=C(e.value,n.value);if(r.valid)return R([r.value.long,r.value.lat])}(t);case"eastingnorthingfield":return function(t){const{eastingInput:e,northingInput:n}=_(t),r=A(e.value,n.value);if(!r.valid)return;const o=y(r.value);return R([o.long,o.lat])}(t);case"osgridreffield":return function(t){const e=T(I(t).value);if(!e.valid)return;const n=$(e.value);return R([n.long,n.lat])}(t);default:throw new Error("Not implemented")}}(e))?r:k;o.after(s);const{map:u,interactPlugin:c}=function(t,e,n){const{assetPath:r,apiPath:o,data:i=N}=n,s="Ordnance survey logo",a=window.defra,l=a.interactPlugin({dataLayers:[],markerColor:{outdoor:"#ff0000",dark:"#00ff00"},interactionMode:"marker",multiSelect:!1});return{map:new a.InteractiveMap(t,w({},e,{mapProvider:a.maplibreProvider(),reverseGeocodeProvider:a.openNamesProvider({url:`${o}/reverse-geocode-proxy?easting={easting}&northing={northing}`}),behaviour:"inline",minZoom:6,maxZoom:18,containerHeight:"400px",enableZoomControls:!0,transformRequest:L(o),plugins:[a.mapStylesPlugin({mapStyles:[{id:"outdoor",label:"Outdoor",url:i.VTS_OUTDOOR_URL,thumbnail:`${r}/interactive-map/assets/images/outdoor-map-thumb.jpg`,logo:`${r}/interactive-map/assets/images/os-logo.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(E)} Crown copyright and database rights ${(new Date).getFullYear()}`,backgroundColor:"#f5f5f0"},{id:"dark",label:"Dark",url:i.VTS_DARK_URL,mapColorScheme:"dark",appColorScheme:"dark",thumbnail:`${r}/interactive-map/assets/images/dark-map-thumb.jpg`,logo:`${r}/interactive-map/assets/images/os-logo-white.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(E)} Crown copyright and database rights ${(new Date).getFullYear()}`},{id:"black-and-white",label:"Black/White",url:i.VTS_BLACK_AND_WHITE_URL,thumbnail:`${r}/interactive-map/assets/images/black-and-white-map-thumb.jpg`,logo:`${r}/interactive-map/assets/images/os-logo-black.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(E)} Crown copyright and database rights ${(new Date).getFullYear()}`}]}),l,a.searchPlugin({osNamesURL:`${o}/geocode-proxy?query={query}`,width:"300px",showMarker:!1}),a.scaleBarPlugin({units:"metric"})]})),interactPlugin:l}}(a,l,t);u.on("map:ready",function(t){switch(i){case"latlongfield":!function(t,e,n){const{latInput:r,longInput:o}=O(t);function i(){const t=C(r.value,o.value);if(t.valid){const r=[t.value.long,t.value.lat];j(e,n,r)}}e.on(x.interactMarkerChange,function(t){r.value=t.coords[1].toFixed(7),o.value=t.coords[0].toFixed(7)}),r.addEventListener("change",i,!1),o.addEventListener("change",i,!1)}(e,u,t.map);break;case"eastingnorthingfield":!function(t,e,n){const{eastingInput:r,northingInput:o}=_(t);function i(){const t=A(r.value,o.value);if(t.valid){const r=y(t.value),o=[r.long,r.lat];j(e,n,o)}}e.on(x.interactMarkerChange,function(t){const e=function({lat:t,long:e}){return new b(t,e).toOsGrid()}({lat:t.coords[1],long:t.coords[0]});r.value=e.easting.toFixed(0),o.value=e.northing.toFixed(0)}),r.addEventListener("change",i,!1),o.addEventListener("change",i,!1)}(e,u,t.map);break;case"osgridreffield":!function(t,e,n){const r=I(t);e.on(x.interactMarkerChange,function(t){const e=function({lat:t,long:e}){return new b(t,e).toOsGrid().toString()}({lat:t.coords[1],long:t.coords[0]});r.value=e}),r.addEventListener("change",function(){const t=T(r.value);if(t.valid){const r=$(t.value),o=[r.long,r.lat];j(e,n,o)}},!1)}(e,u,t.map);break;default:throw new Error("Not implemented")}u.addPanel("info",{showLabel:!0,label:"How to use the map",mobile:{slot:"bottom",initiallyOpen:!0,dismissable:!0,modal:!1},tablet:{slot:"bottom",initiallyOpen:!0,dismissable:!0,modal:!1},desktop:{slot:"bottom",initiallyOpen:!0,dismissable:!0,modal:!1},html:"If using a map click on a point to update the location.<br><br>If using a keyboard, navigate to the point, centering the crosshair at the location and press enter."}),c.enable()})}({assetPath:e,apiPath:n,data:r},t,o)})}function L(t){return function(e,n){if(e.startsWith("https://api.os.uk")){if("Tile"===n)return{url:e.replace("https://api.os.uk/maps/vector/v1/vts",`${window.location.origin}${t}`),headers:{}};if("Style"!==n)return{url:`${t}/map-proxy?url=${encodeURIComponent(e)}`,headers:{}}}if(e.startsWith("https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main")){const n=e.substring(84);return{url:`${t}/maps/vts${n}`,headers:{}}}return{url:e,headers:{}}}}function C(t,e){const n=t.trim()&&Number(t.trim()),r=e.trim()&&Number(e.trim());return n&&r&&n>=49.85&&n<=60.859&&r>=-13.687&&r<=1.767?{valid:!0,value:{lat:n,long:r}}:{valid:!1}}function A(t,e){const n=t.trim()&&Number(t.trim()),r=e.trim()&&Number(e.trim());return n&&r&&n>=0&&n<=7e5&&r>=0&&r<=13e5?{valid:!0,value:{easting:n,northing:r}}:{valid:!1}}function T(t){if(!t)return{valid:!1};const e=/^((([sS]|[nN])[a-hA-Hj-zJ-Z])|(([tT]|[oO])[abfglmqrvwABFGLMQRVW])|([hH][l-zL-Z])|([jJ][lmqrvwLMQRVW]))\s?(([0-9]{3})\s?([0-9]{3})|([0-9]{4})\s?([0-9]{4})|([0-9]{5})\s?([0-9]{5}))$/.exec(t);return null===e?{valid:!1}:{valid:!0,value:e[0]}}function O(t){const e=t.querySelectorAll(S);if(2!==e.length)throw new Error("Expected 2 inputs for lat and long");return{latInput:e[0],longInput:e[1]}}function _(t){const e=t.querySelectorAll(S);if(2!==e.length)throw new Error("Expected 2 inputs for easting and northing");return{eastingInput:e[0],northingInput:e[1]}}function I(t){const e=t.querySelector(S);if(null===e)throw new Error("Expected 1 input for osgridref");return e}function R(t){return{zoom:"16",center:t,markers:[{id:"location",coords:t}]}}function j(t,e,n){t.addMarker("location",n),e.flyTo({center:n,zoom:14,essential:!0})}}},o={};function i(t){var e=o[t];if(void 0!==e)return e.exports;var n=o[t]={exports:{}};return r[t](n,n.exports,i),n.exports}i.m=r,e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__,i.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var o=Object.create(null);i.r(o);var s={};t=t||[null,e({}),e([]),e(e)];for(var a=2&r&&n;("object"==typeof a||"function"==typeof a)&&!~t.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(t=>s[t]=()=>n[t]);return s.default=()=>n,i.d(o,s),o},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.f={},i.e=t=>Promise.all(Object.keys(i.f).reduce((e,n)=>(i.f[n](t,e),e),[])),i.u=t=>"javascripts/vendor/accessible-autocomplete.min.js",i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n={},i.l=(t,e,r,o)=>{if(n[t])n[t].push(e);else{var s,a;if(void 0!==r)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var c=l[u];if(c.getAttribute("src")==t){s=c;break}}s||(a=!0,(s=document.createElement("script")).type="module",s.charset="utf-8",i.nc&&s.setAttribute("nonce",i.nc),s.src=t),n[t]=[e];var d=(e,r)=>{s.onerror=s.onload=null,clearTimeout(h);var o=n[t];if(delete n[t],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach(t=>t(r)),e)return e(r)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=d.bind(null,s.onerror),s.onload=d.bind(null,s.onload),a&&document.head.appendChild(s)}},i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t+"../"})(),(()=>{var t={804:0};i.f.j=(e,n)=>{var r=i.o(t,e)?t[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise((n,o)=>r=t[e]=[n,o]);n.push(r[2]=o);var s=i.p+i.u(e),a=new Error;i.l(s,n=>{if(i.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),s=n&&n.target&&n.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+s+")",a.name="ChunkLoadError",a.type=o,a.request=s,r[1](a)}},"chunk-"+e,e)}};var e=(e,n)=>{var r,o,s=n[0],a=n[1],l=n[2],u=0;if(s.some(e=>0!==t[e])){for(r in a)i.o(a,r)&&(i.m[r]=a[r]);l&&l(i)}for(e&&e(n);u<s.length;u++)o=s[u],i.o(t,o)&&t[o]&&t[o][0](),t[o]=0},n=self.webpackChunk=self.webpackChunk||[];n.forEach(e.bind(null,0)),n.push=e.bind(null,n.push.bind(n))})();const s="aria-describedby",a="error-summary-title";function l(t,e,n){if(document.querySelector(".govuk-error-summary"))return void(document.getElementById(a)?n.setAttribute(s,a):n.removeAttribute(s));e&&(e.innerHTML=`\n <div class="govuk-error-summary" data-module="govuk-error-summary">\n <div role="alert">\n <h2 class="govuk-error-summary__title" id="${a}">\n There is a problem\n </h2>\n <div class="govuk-error-summary__body">\n <ul class="govuk-list govuk-error-summary__list">\n <li>\n <a href="#file-upload">${t}</a>\n </li>\n </ul>\n </div>\n </div>\n </div>\n `,n.setAttribute(s,a));const r=n.closest(".govuk-form-group");if(r){r.classList.add("govuk-form-group--error"),n.classList.add("govuk-file-upload--error");const e=n.id;let o=document.getElementById(`${e}-error`);o||(o=document.createElement("p"),o.id=`${e}-error`,o.className="govuk-error-message",o.innerHTML=`<span class="govuk-visually-hidden">Error:</span> ${t}`,r.insertBefore(o,n)),n.setAttribute(s,`error-summary-title ${e}-error`)}}function u(){window.history.replaceState(null,"",window.location.href),window.location.href=window.location.pathname}function c(){var t;const e=document.querySelector('form:has(input[type="file"])'),n=e?e.querySelector('input[type="file"]'):null,r=e?e.querySelector(".upload-file-button"):null,o=null!=(t=Array.from(document.querySelectorAll("button.govuk-button")).find(t=>"Continue"===t.textContent.trim()))?t:null,i=document.querySelector(".govuk-error-summary-container");if(!e||!n||!r)return;const a=e;let c=null,d=!1;const h=a.dataset.uploadId;n.addEventListener("change",()=>{i&&(i.innerHTML=""),n.files&&n.files.length>0&&(c=n.files[0])}),r.addEventListener("click",t=>{if(!c)return t.preventDefault(),void l("Select a file",i,n);d?t.preventDefault():(d=!0,function(t,e,n,r,o){(function(t,e,n){var r;const o=document.getElementById("uploadedFilesContainer"),i=o?o.closest("form"):null;if(!(i&&i instanceof HTMLFormElement))return;const a=i.querySelector("p.govuk-body");if(!a)return;const l=function(t,e){let n=null==t?void 0:t.querySelector("#statusInformation");if(!n){n=document.createElement("div"),n.id="statusInformation",n.className="govuk-visually-hidden",n.setAttribute("aria-live","polite");try{!function(t,e,n){var r;null!=e&&e.nextSibling&&e.parentNode===t?t.insertBefore(n,e.nextSibling):(null!=(r=null==e?void 0:e.parentNode)?r:t).appendChild(n)}(t,e,n)}catch(r){try{null==t||t.appendChild(n)}catch(o){document.body.appendChild(n)}}}return n}(i,a),u=n.querySelector('input[type="file"]');u&&u.setAttribute(s,"statusInformation");const c=function(t,e){let n=t.querySelector("dl.govuk-summary-list");if(!n){n=document.createElement("dl"),n.className="govuk-summary-list govuk-summary-list--long-key";const r=t.querySelector(".govuk-button-group");r?t.insertBefore(n,r):t.insertBefore(n,e.nextSibling)}return n}(i,a),d=document.querySelector(`[data-filename="${null==t?void 0:t.name}"]`);d&&d.remove();const h=function(t,e){var n,r;const o=document.createElement("div");return o.className="govuk-summary-list__row",o.setAttribute("data-filename",null!=(n=null==t?void 0:t.name)?n:""),o.innerHTML=`\n <dt class="govuk-summary-list__key">\n ${null!=(r=null==t?void 0:t.name)?r:""}\n </dt>\n <dd class="govuk-summary-list__value">\n <strong class="govuk-tag govuk-tag--yellow">${e}</strong>\n </dd>\n <dd class="govuk-summary-list__actions">\n </dd>\n `,o}(t,e);c.insertBefore(h,c.firstChild),l.textContent=`${null!=(r=null==t?void 0:t.name)?r:""} ${e}`})(o,"Uploading…",t),e.focus(),setTimeout(()=>{e.disabled=!0,n.disabled=!0,r.disabled=!0},100)}(a,n,r,o,c),function(t,e,n,r,o,i){var s;if(!e.action||!i)return!1;t.preventDefault();const a=new FormData(e),c=!!e.dataset.proxyUrl,d=null!=(s=e.dataset.proxyUrl)?s:e.action,h={method:"POST",body:a,redirect:c?"follow":"manual"};c&&(h.mode="no-cors"),fetch(d,h).then(()=>{!function(t){let e=0;const n=setInterval(()=>{if(e++,e>=300)return clearInterval(n),void u();const r=function(t,e){const n=t.replace(/\/preview\/(draft|live)/g,"").replace(/\/{2,}/g,"/").replace(/\/$/,"").split("/").filter(Boolean);return`${n.length>2?`/${n.slice(0,n.length-2).join("/")}`:""}/upload-status/${e}`}(window.location.pathname,t);fetch(r,{headers:{Accept:"application/json"}}).then(t=>{if(!t.ok)throw new Error("Network response was not ok");return t.json()}).then(t=>{"ready"===t.uploadStatus&&(clearInterval(n),u())}).catch(()=>{clearInterval(n),u()})},1e3)}(i)}).catch(()=>(n.disabled=!1,r.disabled=!1,l("There was a problem uploading the file",o,n),null))}(t,a,n,r,i,h))})}function d(t,e={}){var n;const r=t.getAttribute("tabindex");function o(){var n;null==(n=e.onBlur)||n.call(t),r||t.removeAttribute("tabindex")}r||t.setAttribute("tabindex","-1"),t.addEventListener("focus",function(){t.addEventListener("blur",o,{once:!0})},{once:!0}),null==(n=e.onBeforeFocus)||n.call(t),t.focus()}function h(t=document.body){return!!t&&t.classList.contains("govuk-frontend-supported")}function m(t){return!!t&&"object"==typeof t&&!function(t){return Array.isArray(t)}(t)}function p(t){return!!t&&(t instanceof Element||t instanceof Document)}function f(t,e){return`${t.moduleName}: ${e}`}class g extends Error{constructor(...t){super(...t),this.name="GOVUKFrontendError"}}class v extends g{constructor(t=document.body){const e="noModule"in HTMLScriptElement.prototype?'GOV.UK Frontend initialised without `<body class="govuk-frontend-supported">` from template `<script>` snippet':"GOV.UK Frontend is not supported in this browser";super(t?e:'GOV.UK Frontend initialised without `<script type="module">`'),this.name="SupportError"}}class b extends g{constructor(...t){super(...t),this.name="ConfigError"}}class w extends g{constructor(t){let e="string"==typeof t?t:"";if(m(t)){const{component:n,identifier:r,element:o,expectedType:i}=t;e=r,e+=o?` is not of type ${null!=i?i:"HTMLElement"}`:" not found",n&&(e=f(n,e))}super(e),this.name="ElementError"}}class y extends g{constructor(t){super("string"==typeof t?t:f(t,"Root element (`$root`) already initialised")),this.name="InitError"}}class ${get $root(){return this._$root}constructor(t){this._$root=void 0;const e=this.constructor;if("string"!=typeof e.moduleName)throw new y("`moduleName` not defined in component");if(!(t instanceof e.elementType))throw new w({element:t,component:e,identifier:"Root element (`$root`)",expectedType:e.elementType.name});this._$root=t,e.checkSupport(),this.checkInitialised();const n=e.moduleName;this.$root.setAttribute(`data-${n}-init`,"")}checkInitialised(){const t=this.constructor,e=t.moduleName;if(e&&function(t,e){return t instanceof HTMLElement&&t.hasAttribute(`data-${e}-init`)}(this.$root,e))throw new y(t)}static checkSupport(){if(!h())throw new v}}$.elementType=HTMLElement;const k=Symbol.for("configOverride");class E extends ${[k](t){return{}}get config(){return this._config}constructor(t,e){super(t),this._config=void 0;const n=this.constructor;if(!m(n.defaults))throw new b(f(n,"Config passed as parameter into constructor but no defaults defined"));const r=function(t,e){if(!m(t.schema))throw new b(f(t,"Config passed as parameter into constructor but no schema defined"));const n={},r=Object.entries(t.schema.properties);for(const o of r){const[r,i]=o,s=r.toString();s in e&&(n[s]=S(e[s],i)),"object"===(null==i?void 0:i.type)&&(n[s]=N(t.schema,e,r))}return n}(n,this._$root.dataset);this._config=x(n.defaults,null!=e?e:{},this[k](r),r)}}function S(t,e){const n=t?t.trim():"";let r,o=null==e?void 0:e.type;switch(o||(["true","false"].includes(n)&&(o="boolean"),n.length>0&&isFinite(Number(n))&&(o="number")),o){case"boolean":r="true"===n;break;case"number":r=Number(n);break;default:r=t}return r}function x(...t){const e={};for(const n of t)for(const t of Object.keys(n)){const r=e[t],o=n[t];m(r)&&m(o)?e[t]=x(r,o):e[t]=o}return e}function N(t,e,n){const r=t.properties[n];if("object"!==(null==r?void 0:r.type))return;const o={[n]:{}};for(const[i,s]of Object.entries(e)){let t=o;const e=i.split(".");for(const[r,o]of e.entries())m(t)&&(r<e.length-1?(m(t[o])||(t[o]={}),t=t[o]):i!==n&&(t[o]=S(s)))}return o[n]}function M(t,e,n){let r;const o=function(t){let e,n=document;if(m(t)){const r=t;(p(r.scope)||null===r.scope)&&(n=r.scope),"function"==typeof r.onError&&(e=r.onError)}return p(t)?n=t:null===t?n=null:"function"==typeof t&&(e=t),{scope:n,onError:e}}(n);try{var i;if(!h())throw new v;if(null===o.scope)throw new w({element:o.scope,component:t,identifier:"Scope element (`$scope`)"});r=null==(i=o.scope)?void 0:i.querySelectorAll(`[data-module="${t.moduleName}"]`)}catch(s){return o.onError?o.onError(s,{component:t,config:e}):console.log(s),[]}return Array.from(null!=r?r:[]).map(n=>{try{return void 0!==e?new t(n,e):new t(n)}catch(s){return o.onError?o.onError(s,{element:n,component:t,config:e}):console.log(s),null}}).filter(Boolean)}class L extends E{constructor(t,e={}){super(t,e),this.debounceFormSubmitTimer=null,this.$root.addEventListener("keydown",t=>this.handleKeyDown(t)),this.$root.addEventListener("click",t=>this.debounce(t))}handleKeyDown(t){const e=t.target;" "===t.key&&e instanceof HTMLElement&&"button"===e.getAttribute("role")&&(t.preventDefault(),e.click())}debounce(t){if(this.config.preventDoubleClick)return this.debounceFormSubmitTimer?(t.preventDefault(),!1):void(this.debounceFormSubmitTimer=window.setTimeout(()=>{this.debounceFormSubmitTimer=null},1e3))}}function C(t,e){const n=t.closest(`[${e}]`);return n?n.getAttribute(e):null}L.moduleName="govuk-button",L.defaults=Object.freeze({preventDoubleClick:!1}),L.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class A{constructor(t={},e={}){var n;this.translations=void 0,this.locale=void 0,this.translations=t,this.locale=null!=(n=e.locale)?n:document.documentElement.lang||"en"}t(t,e){if(!t)throw new Error("i18n: lookup key missing");let n=this.translations[t];if("number"==typeof(null==e?void 0:e.count)&&m(n)){const r=n[this.getPluralSuffix(t,e.count)];r&&(n=r)}if("string"==typeof n){if(n.match(/%{(.\S+)}/)){if(!e)throw new Error("i18n: cannot replace placeholders in string if no option data provided");return this.replacePlaceholders(n,e)}return n}return t}replacePlaceholders(t,e){const n=Intl.NumberFormat.supportedLocalesOf(this.locale).length?new Intl.NumberFormat(this.locale):void 0;return t.replace(/%{(.\S+)}/g,function(t,r){if(Object.prototype.hasOwnProperty.call(e,r)){const t=e[r];return!1===t||"number"!=typeof t&&"string"!=typeof t?"":"number"==typeof t?n?n.format(t):`${t}`:t}throw new Error(`i18n: no data found to replace ${t} placeholder in string`)})}hasIntlPluralRulesSupport(){return Boolean("PluralRules"in window.Intl&&Intl.PluralRules.supportedLocalesOf(this.locale).length)}getPluralSuffix(t,e){if(e=Number(e),!isFinite(e))return"other";const n=this.translations[t],r=this.hasIntlPluralRulesSupport()?new Intl.PluralRules(this.locale).select(e):"other";if(m(n)){if(r in n)return r;if("other"in n)return console.warn(`i18n: Missing plural form ".${r}" for "${this.locale}" locale. Falling back to ".other".`),"other"}throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`)}}class T extends E{[k](t){let e={};return("maxwords"in t||"maxlength"in t)&&(e={maxlength:void 0,maxwords:void 0}),e}constructor(t,e={}){var n,r;super(t,e),this.$textarea=void 0,this.$visibleCountMessage=void 0,this.$screenReaderCountMessage=void 0,this.lastInputTimestamp=null,this.lastInputValue="",this.valueChecker=null,this.i18n=void 0,this.maxLength=void 0;const o=this.$root.querySelector(".govuk-js-character-count");if(!(o instanceof HTMLTextAreaElement||o instanceof HTMLInputElement))throw new w({component:T,element:o,expectedType:"HTMLTextareaElement or HTMLInputElement",identifier:"Form field (`.govuk-js-character-count`)"});const i=function(t,e){const n=[];for(const[r,o]of Object.entries(t)){const t=[];if(Array.isArray(o)){for(const{required:n,errorMessage:r}of o)n.every(t=>!!e[t])||t.push(r);"anyOf"!==r||o.length-t.length>=1||n.push(...t)}}return n}(T.schema,this.config);if(i[0])throw new b(f(T,i[0]));this.i18n=new A(this.config.i18n,{locale:C(this.$root,"lang")}),this.maxLength=null!=(n=null!=(r=this.config.maxwords)?r:this.config.maxlength)?n:1/0,this.$textarea=o;const s=`${this.$textarea.id}-info`,a=document.getElementById(s);if(!a)throw new w({component:T,element:a,identifier:`Count message (\`id="${s}"\`)`});this.$errorMessage=this.$root.querySelector(".govuk-error-message"),a.textContent.match(/^\s*$/)&&(a.textContent=this.i18n.t("textareaDescription",{count:this.maxLength})),this.$textarea.insertAdjacentElement("afterend",a);const l=document.createElement("div");l.className="govuk-character-count__sr-status govuk-visually-hidden",l.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=l,a.insertAdjacentElement("afterend",l);const u=document.createElement("div");u.className=a.className,u.classList.add("govuk-character-count__status"),u.setAttribute("aria-hidden","true"),this.$visibleCountMessage=u,a.insertAdjacentElement("afterend",u),a.classList.add("govuk-visually-hidden"),this.$textarea.removeAttribute("maxlength"),this.bindChangeEvents(),window.addEventListener("pageshow",()=>this.updateCountMessage()),this.updateCountMessage()}bindChangeEvents(){this.$textarea.addEventListener("keyup",()=>this.handleKeyUp()),this.$textarea.addEventListener("focus",()=>this.handleFocus()),this.$textarea.addEventListener("blur",()=>this.handleBlur())}handleKeyUp(){this.updateVisibleCountMessage(),this.lastInputTimestamp=Date.now()}handleFocus(){this.valueChecker=window.setInterval(()=>{(!this.lastInputTimestamp||Date.now()-500>=this.lastInputTimestamp)&&this.updateIfValueChanged()},1e3)}handleBlur(){this.valueChecker&&window.clearInterval(this.valueChecker)}updateIfValueChanged(){this.$textarea.value!==this.lastInputValue&&(this.lastInputValue=this.$textarea.value,this.updateCountMessage())}updateCountMessage(){this.updateVisibleCountMessage(),this.updateScreenReaderCountMessage()}updateVisibleCountMessage(){const t=this.maxLength-this.count(this.$textarea.value)<0;this.$visibleCountMessage.classList.toggle("govuk-character-count__message--disabled",!this.isOverThreshold()),this.$errorMessage||this.$textarea.classList.toggle("govuk-textarea--error",t),this.$visibleCountMessage.classList.toggle("govuk-error-message",t),this.$visibleCountMessage.classList.toggle("govuk-hint",!t),this.$visibleCountMessage.textContent=this.getCountMessage()}updateScreenReaderCountMessage(){this.isOverThreshold()?this.$screenReaderCountMessage.removeAttribute("aria-hidden"):this.$screenReaderCountMessage.setAttribute("aria-hidden","true"),this.$screenReaderCountMessage.textContent=this.getCountMessage()}count(t){var e;return this.config.maxwords?(null!=(e=t.match(/\S+/g))?e:[]).length:t.length}getCountMessage(){const t=this.maxLength-this.count(this.$textarea.value),e=this.config.maxwords?"words":"characters";return this.formatCountMessage(t,e)}formatCountMessage(t,e){if(0===t)return this.i18n.t(`${e}AtLimit`);const n=t<0?"OverLimit":"UnderLimit";return this.i18n.t(`${e}${n}`,{count:Math.abs(t)})}isOverThreshold(){if(!this.config.threshold)return!0;const t=this.count(this.$textarea.value);return this.maxLength*this.config.threshold/100<=t}}T.moduleName="govuk-character-count",T.defaults=Object.freeze({threshold:0,i18n:{charactersUnderLimit:{one:"You have %{count} character remaining",other:"You have %{count} characters remaining"},charactersAtLimit:"You have 0 characters remaining",charactersOverLimit:{one:"You have %{count} character too many",other:"You have %{count} characters too many"},wordsUnderLimit:{one:"You have %{count} word remaining",other:"You have %{count} words remaining"},wordsAtLimit:"You have 0 words remaining",wordsOverLimit:{one:"You have %{count} word too many",other:"You have %{count} words too many"},textareaDescription:{other:""}}}),T.schema=Object.freeze({properties:{i18n:{type:"object"},maxwords:{type:"number"},maxlength:{type:"number"},threshold:{type:"number"}},anyOf:[{required:["maxwords"],errorMessage:'Either "maxlength" or "maxwords" must be provided'},{required:["maxlength"],errorMessage:'Either "maxlength" or "maxwords" must be provided'}]});class O extends ${constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="checkbox"]');if(!e.length)throw new w({component:O,identifier:'Form inputs (`<input type="checkbox">`)'});this.$inputs=e,this.$inputs.forEach(t=>{const e=t.getAttribute("data-aria-controls");if(e){if(!document.getElementById(e))throw new w({component:O,identifier:`Conditional reveal (\`id="${e}"\`)`});t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls")}}),window.addEventListener("pageshow",()=>this.syncAllConditionalReveals()),this.syncAllConditionalReveals(),this.$root.addEventListener("click",t=>this.handleClick(t))}syncAllConditionalReveals(){this.$inputs.forEach(t=>this.syncConditionalRevealWithInputState(t))}syncConditionalRevealWithInputState(t){const e=t.getAttribute("aria-controls");if(!e)return;const n=document.getElementById(e);if(null!=n&&n.classList.contains("govuk-checkboxes__conditional")){const e=t.checked;t.setAttribute("aria-expanded",e.toString()),n.classList.toggle("govuk-checkboxes__conditional--hidden",!e)}}unCheckAllInputsExcept(t){document.querySelectorAll(`input[type="checkbox"][name="${t.name}"]`).forEach(e=>{t.form===e.form&&e!==t&&(e.checked=!1,this.syncConditionalRevealWithInputState(e))})}unCheckExclusiveInputs(t){document.querySelectorAll(`input[data-behaviour="exclusive"][type="checkbox"][name="${t.name}"]`).forEach(e=>{t.form===e.form&&(e.checked=!1,this.syncConditionalRevealWithInputState(e))})}handleClick(t){const e=t.target;e instanceof HTMLInputElement&&"checkbox"===e.type&&(e.getAttribute("aria-controls")&&this.syncConditionalRevealWithInputState(e),e.checked&&("exclusive"===e.getAttribute("data-behaviour")?this.unCheckAllInputsExcept(e):this.unCheckExclusiveInputs(e)))}}O.moduleName="govuk-checkboxes";class _ extends E{constructor(t,e={}){super(t,e),this.config.disableAutoFocus||d(this.$root),this.$root.addEventListener("click",t=>this.handleClick(t))}handleClick(t){const e=t.target;e&&this.focusTarget(e)&&t.preventDefault()}focusTarget(t){if(!(t instanceof HTMLAnchorElement))return!1;const e=t.hash.replace("#","");if(!e)return!1;const n=document.getElementById(e);if(!n)return!1;const r=this.getAssociatedLegendOrLabel(n);return!!r&&(r.scrollIntoView(),n.focus({preventScroll:!0}),!0)}getAssociatedLegendOrLabel(t){var e;const n=t.closest("fieldset");if(n){const e=n.getElementsByTagName("legend");if(e.length){const n=e[0];if(t instanceof HTMLInputElement&&("checkbox"===t.type||"radio"===t.type))return n;const r=n.getBoundingClientRect().top,o=t.getBoundingClientRect();if(o.height&&window.innerHeight&&o.top+o.height-r<window.innerHeight/2)return n}}return null!=(e=document.querySelector(`label[for='${t.getAttribute("id")}']`))?e:t.closest("label")}}_.moduleName="govuk-error-summary",_.defaults=Object.freeze({disableAutoFocus:!1}),_.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class I extends ${constructor(t){super(t),this.$menuButton=void 0,this.$menu=void 0,this.menuIsOpen=!1,this.mql=null;const e=this.$root.querySelector(".govuk-js-header-toggle");if(!e)return this;this.$root.classList.add("govuk-header--with-js-navigation");const n=e.getAttribute("aria-controls");if(!n)throw new w({component:I,identifier:'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'});const r=document.getElementById(n);if(!r)throw new w({component:I,element:r,identifier:`Navigation (\`<ul id="${n}">\`)`});this.$menu=r,this.$menuButton=e,this.setupResponsiveChecks(),this.$menuButton.addEventListener("click",()=>this.handleMenuButtonClick())}setupResponsiveChecks(){const t=function(){const t="--govuk-breakpoint-desktop";return{property:t,value:window.getComputedStyle(document.documentElement).getPropertyValue(t)||void 0}}();if(!t.value)throw new w({component:I,identifier:`CSS custom property (\`${t.property}\`) on pseudo-class \`:root\``});this.mql=window.matchMedia(`(min-width: ${t.value})`),"addEventListener"in this.mql?this.mql.addEventListener("change",()=>this.checkMode()):this.mql.addListener(()=>this.checkMode()),this.checkMode()}checkMode(){this.mql&&this.$menu&&this.$menuButton&&(this.mql.matches?(this.$menu.removeAttribute("hidden"),this.$menuButton.setAttribute("hidden","")):(this.$menuButton.removeAttribute("hidden"),this.$menuButton.setAttribute("aria-expanded",this.menuIsOpen.toString()),this.menuIsOpen?this.$menu.removeAttribute("hidden"):this.$menu.setAttribute("hidden","")))}handleMenuButtonClick(){this.menuIsOpen=!this.menuIsOpen,this.checkMode()}}I.moduleName="govuk-header";class R extends E{constructor(t,e={}){super(t,e),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||d(this.$root)}}R.moduleName="govuk-notification-banner",R.defaults=Object.freeze({disableAutoFocus:!1}),R.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class j extends ${constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="radio"]');if(!e.length)throw new w({component:j,identifier:'Form inputs (`<input type="radio">`)'});this.$inputs=e,this.$inputs.forEach(t=>{const e=t.getAttribute("data-aria-controls");if(e){if(!document.getElementById(e))throw new w({component:j,identifier:`Conditional reveal (\`id="${e}"\`)`});t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls")}}),window.addEventListener("pageshow",()=>this.syncAllConditionalReveals()),this.syncAllConditionalReveals(),this.$root.addEventListener("click",t=>this.handleClick(t))}syncAllConditionalReveals(){this.$inputs.forEach(t=>this.syncConditionalRevealWithInputState(t))}syncConditionalRevealWithInputState(t){const e=t.getAttribute("aria-controls");if(!e)return;const n=document.getElementById(e);if(null!=n&&n.classList.contains("govuk-radios__conditional")){const e=t.checked;t.setAttribute("aria-expanded",e.toString()),n.classList.toggle("govuk-radios__conditional--hidden",!e)}}handleClick(t){const e=t.target;if(!(e instanceof HTMLInputElement)||"radio"!==e.type)return;const n=document.querySelectorAll('input[type="radio"][aria-controls]'),r=e.form,o=e.name;n.forEach(t=>{const e=t.form===r;t.name===o&&e&&this.syncConditionalRevealWithInputState(t)})}}j.moduleName="govuk-radios";class F extends ${constructor(t){var e;super(t);const n=this.$root.hash,r=null!=(e=this.$root.getAttribute("href"))?e:"";if(this.$root.origin!==window.location.origin||this.$root.pathname!==window.location.pathname)return;const o=n.replace("#","");if(!o)throw new w(`Skip link: Target link (\`href="${r}"\`) has no hash fragment`);const i=document.getElementById(o);if(!i)throw new w({component:F,element:i,identifier:`Target content (\`id="${o}"\`)`});this.$root.addEventListener("click",()=>d(i,{onBeforeFocus(){i.classList.add("govuk-skip-link-focused-element")},onBlur(){i.classList.remove("govuk-skip-link-focused-element")}}))}}F.elementType=HTMLAnchorElement,F.moduleName="govuk-skip-link";var q=i(57);const D=function(){M(L),M(T),M(O),M(_),M(I),M(R),M(j),M(F)},P=function(){const t=document.querySelectorAll('[data-module="govuk-accessible-autocomplete"]');t.length&&i.e(7).then(i.t.bind(i,60,19)).then(e=>{const{default:n}=e;t.forEach(t=>function(t,e){if(!t)return;const n={id:t.id,selectElement:t};e(n);const r=document.querySelector(`#${n.id}`),o=[...t.options].map(t=>t.text);null==r||r.addEventListener("blur",()=>{r.value&&o.includes(r.value)||(t.value="")})}(t.querySelector("select"),n.enhanceSelectElement))}).catch(console.error)},B=function(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c):c()},W=function(){if(window.opener){const t=document.querySelector(".js-preview-banner-close");null==t||t.removeAttribute("hidden"),null==t||t.addEventListener("click",t=>{t.preventDefault(),window.close()})}};function z(){D(),P(),B(),W()}export{z as initAll,P as initAllAutocomplete,D as initAllGovuk,B as initFileUpload,W as initPreviewCloseLink};export const initMaps=q.Yv;
3
3
  //# sourceMappingURL=shared.min.js.map