@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.
- package/.public/javascripts/application.min.js +1 -1
- package/.public/javascripts/application.min.js.map +1 -1
- package/.public/javascripts/shared.min.js +1 -1
- package/.public/javascripts/shared.min.js.map +1 -1
- package/.public/stylesheets/application.min.css +2 -2
- package/.public/stylesheets/application.min.css.map +1 -1
- package/.server/client/javascripts/location-map.d.ts +93 -0
- package/.server/client/javascripts/location-map.js +749 -0
- package/.server/client/javascripts/location-map.js.map +1 -0
- package/.server/client/javascripts/shared.d.ts +4 -0
- package/.server/client/javascripts/shared.js +5 -0
- package/.server/client/javascripts/shared.js.map +1 -1
- package/.server/client/stylesheets/_location-fields.scss +11 -0
- package/.server/client/stylesheets/application.scss +0 -1
- package/.server/client/stylesheets/shared.scss +1 -0
- package/.server/config/index.js +1 -1
- package/.server/config/index.js.map +1 -1
- package/.server/server/plugins/engine/configureEnginePlugin.d.ts +1 -1
- package/.server/server/plugins/engine/configureEnginePlugin.js +4 -2
- package/.server/server/plugins/engine/configureEnginePlugin.js.map +1 -1
- package/.server/server/plugins/engine/options.js +2 -1
- package/.server/server/plugins/engine/options.js.map +1 -1
- package/.server/server/plugins/engine/plugin.js +14 -1
- package/.server/server/plugins/engine/plugin.js.map +1 -1
- package/.server/server/plugins/engine/types.d.ts +1 -0
- package/.server/server/plugins/engine/types.js.map +1 -1
- package/.server/server/plugins/engine/views/components/_location-field-base.html +1 -1
- package/.server/server/plugins/engine/views/components/osgridreffield.html +4 -2
- package/.server/server/plugins/map/index.d.ts +7 -0
- package/.server/server/plugins/map/index.js +20 -0
- package/.server/server/plugins/map/index.js.map +1 -0
- package/.server/server/plugins/map/routes/get-os-token.d.ts +6 -0
- package/.server/server/plugins/map/routes/get-os-token.js +41 -0
- package/.server/server/plugins/map/routes/get-os-token.js.map +1 -0
- package/.server/server/plugins/map/routes/get-os-token.test.js +49 -0
- package/.server/server/plugins/map/routes/get-os-token.test.js.map +1 -0
- package/.server/server/plugins/map/routes/index.d.ts +10 -0
- package/.server/server/plugins/map/routes/index.js +172 -0
- package/.server/server/plugins/map/routes/index.js.map +1 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark.json +690 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark.png +0 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark@2x.json +690 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark@2x.png +0 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale.json +690 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale.png +0 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale@2x.json +690 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale@2x.png +0 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite.json +690 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite.png +0 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite@2x.json +690 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite@2x.png +0 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857_Black_and_White.json +7858 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857_Dark.json +7669 -0
- package/.server/server/plugins/map/routes/vts/OS_VTS_3857_Outdoor.json +7653 -0
- package/.server/server/plugins/map/routes/vts/README.md +5 -0
- package/.server/server/plugins/map/service.d.ts +14 -0
- package/.server/server/plugins/map/service.js +76 -0
- package/.server/server/plugins/map/service.js.map +1 -0
- package/.server/server/plugins/map/service.test.js +120 -0
- package/.server/server/plugins/map/service.test.js.map +1 -0
- package/.server/server/plugins/map/test/__stubs__/find.d.ts +3 -0
- package/.server/server/plugins/map/test/__stubs__/find.js +216 -0
- package/.server/server/plugins/map/test/__stubs__/find.js.map +1 -0
- package/.server/server/plugins/map/test/__stubs__/nearest.d.ts +37 -0
- package/.server/server/plugins/map/test/__stubs__/nearest.js +38 -0
- package/.server/server/plugins/map/test/__stubs__/nearest.js.map +1 -0
- package/.server/server/plugins/map/types.d.ts +233 -0
- package/.server/server/plugins/map/types.js +121 -0
- package/.server/server/plugins/map/types.js.map +1 -0
- package/.server/server/types.d.ts +1 -0
- package/.server/server/types.js.map +1 -1
- package/package.json +3 -1
- package/src/client/javascripts/location-map.js +774 -0
- package/src/client/javascripts/shared.js +4 -0
- package/src/client/stylesheets/_location-fields.scss +11 -0
- package/src/client/stylesheets/application.scss +0 -1
- package/src/client/stylesheets/shared.scss +1 -0
- package/src/config/index.ts +1 -1
- package/src/server/plugins/engine/configureEnginePlugin.ts +4 -2
- package/src/server/plugins/engine/options.js +2 -1
- package/src/server/plugins/engine/plugin.ts +14 -1
- package/src/server/plugins/engine/types.ts +1 -0
- package/src/server/plugins/engine/views/components/_location-field-base.html +1 -1
- package/src/server/plugins/engine/views/components/osgridreffield.html +4 -2
- package/src/server/plugins/map/index.js +19 -0
- package/src/server/plugins/map/routes/get-os-token.js +41 -0
- package/src/server/plugins/map/routes/get-os-token.test.js +55 -0
- package/src/server/plugins/map/routes/index.js +192 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark.json +690 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark.png +0 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark@2x.json +690 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/dark@2x.png +0 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale.json +690 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale.png +0 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale@2x.json +690 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/greyscale@2x.png +0 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite.json +690 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite.png +0 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite@2x.json +690 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857/resources/sprites/sprite@2x.png +0 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857_Black_and_White.json +7858 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857_Dark.json +7669 -0
- package/src/server/plugins/map/routes/vts/OS_VTS_3857_Outdoor.json +7653 -0
- package/src/server/plugins/map/routes/vts/README.md +5 -0
- package/src/server/plugins/map/service.js +84 -0
- package/src/server/plugins/map/service.test.js +144 -0
- package/src/server/plugins/map/test/__stubs__/find.js +271 -0
- package/src/server/plugins/map/test/__stubs__/nearest.js +46 -0
- package/src/server/plugins/map/types.js +120 -0
- package/src/server/types.ts +1 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see application.min.js.LICENSE.txt */
|
|
2
|
-
var e,t,n,o={313:(e,t,n)=>{n.d(t,{Yi:()=>F,IW:()=>B,AC:()=>q,u8:()=>N,DK:()=>R});const o="aria-describedby",r="error-summary-title";function i(e,t,n){if(document.querySelector(".govuk-error-summary"))return void(document.getElementById(r)?n.setAttribute(o,r):n.removeAttribute(o));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="${r}">\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(o,r));const i=n.closest(".govuk-form-group");if(i){i.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}`,i.insertBefore(r,n)),n.setAttribute(o,`error-summary-title ${t}-error`)}}function s(){window.history.replaceState(null,"",window.location.href),window.location.href=window.location.pathname}function a(){var e;const t=document.querySelector('form:has(input[type="file"])'),n=t?t.querySelector('input[type="file"]'):null,r=t?t.querySelector(".upload-file-button"):null,a=null!=(e=Array.from(document.querySelectorAll("button.govuk-button")).find(e=>"Continue"===e.textContent.trim()))?e:null,l=document.querySelector(".govuk-error-summary-container");if(!t||!n||!r)return;const u=t;let c=null,d=!1;const h=u.dataset.uploadId;n.addEventListener("change",()=>{l&&(l.innerHTML=""),n.files&&n.files.length>0&&(c=n.files[0])}),r.addEventListener("click",e=>{if(!c)return e.preventDefault(),void i("Select a file",l,n);d?e.preventDefault():(d=!0,function(e,t,n,r,i){(function(e,t,n){var r;const i=document.getElementById("uploadedFilesContainer"),s=i?i.closest("form"):null;if(!(s&&s instanceof HTMLFormElement))return;const a=s.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}(s,a),u=n.querySelector('input[type="file"]');u&&u.setAttribute(o,"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}(s,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!=(r=null==e?void 0:e.name)?r:""} ${t}`})(i,"Uploading…",e),t.focus(),setTimeout(()=>{t.disabled=!0,n.disabled=!0,r.disabled=!0},100)}(u,n,r,a,c),function(e,t,n,o,r,a){var l;if(!t.action||!a)return!1;e.preventDefault();const u=new FormData(t),c=!!t.dataset.proxyUrl,d=null!=(l=t.dataset.proxyUrl)?l:t.action,h={method:"POST",body:u,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 s();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),s())}).catch(()=>{clearInterval(n),s()})},1e3)}(a)}).catch(()=>(n.disabled=!1,o.disabled=!1,i("There was a problem uploading the file",r,n),null))}(e,u,n,r,l,h))})}function l(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 u(e=document.body){return!!e&&e.classList.contains("govuk-frontend-supported")}function c(e){return!!e&&"object"==typeof e&&!function(e){return Array.isArray(e)}(e)}function d(e){return!!e&&(e instanceof Element||e instanceof Document)}function h(e,t){return`${e.moduleName}: ${t}`}class m extends Error{constructor(...e){super(...e),this.name="GOVUKFrontendError"}}class p extends m{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 f extends m{constructor(...e){super(...e),this.name="ConfigError"}}class g extends m{constructor(e){let t="string"==typeof e?e:"";if(c(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=h(n,t))}super(t),this.name="ElementError"}}class v extends m{constructor(e){super("string"==typeof e?e:h(e,"Root element (`$root`) already initialised")),this.name="InitError"}}class b{get $root(){return this._$root}constructor(e){this._$root=void 0;const t=this.constructor;if("string"!=typeof t.moduleName)throw new v("`moduleName` not defined in component");if(!(e instanceof t.elementType))throw new g({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 v(e)}static checkSupport(){if(!u())throw new p}}b.elementType=HTMLElement;const y=Symbol.for("configOverride");class w extends b{[y](e){return{}}get config(){return this._config}constructor(e,t){super(e),this._config=void 0;const n=this.constructor;if(!c(n.defaults))throw new f(h(n,"Config passed as parameter into constructor but no defaults defined"));const o=function(e,t){if(!c(e.schema))throw new f(h(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]=k(t[s],i)),"object"===(null==i?void 0:i.type)&&(n[s]=E(e.schema,t,o))}return n}(n,this._$root.dataset);this._config=$(n.defaults,null!=t?t:{},this[y](o),o)}}function k(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 $(...e){const t={};for(const n of e)for(const e of Object.keys(n)){const o=t[e],r=n[e];c(o)&&c(r)?t[e]=$(o,r):t[e]=r}return t}function E(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())c(e)&&(o<t.length-1?(c(e[r])||(e[r]={}),e=e[r]):i!==n&&(e[r]=k(s)))}return r[n]}function x(e,t,n){let o;const r=function(e){let t,n=document;if(c(e)){const o=e;(d(o.scope)||null===o.scope)&&(n=o.scope),"function"==typeof o.onError&&(t=o.onError)}return d(e)?n=e:null===e?n=null:"function"==typeof e&&(t=e),{scope:n,onError:t}}(n);try{var i;if(!u())throw new p;if(null===r.scope)throw new g({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 C extends w{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 A(e,t){const n=e.closest(`[${t}]`);return n?n.getAttribute(t):null}C.moduleName="govuk-button",C.defaults=Object.freeze({preventDoubleClick:!1}),C.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class L{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)&&c(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(c(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 S extends w{[y](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 g({component:S,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}(S.schema,this.config);if(i[0])throw new f(h(S,i[0]));this.i18n=new L(this.config.i18n,{locale:A(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 g({component:S,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}}S.moduleName="govuk-character-count",S.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:""}}}),S.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 I extends b{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="checkbox"]');if(!t.length)throw new g({component:I,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 g({component:I,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)))}}I.moduleName="govuk-checkboxes";class M extends w{constructor(e,t={}){super(e,t),this.config.disableAutoFocus||l(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")}}M.moduleName="govuk-error-summary",M.defaults=Object.freeze({disableAutoFocus:!1}),M.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class T extends b{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 g({component:T,identifier:'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'});const o=document.getElementById(n);if(!o)throw new g({component:T,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 g({component:T,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()}}T.moduleName="govuk-header";class O extends w{constructor(e,t={}){super(e,t),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||l(this.$root)}}O.moduleName="govuk-notification-banner",O.defaults=Object.freeze({disableAutoFocus:!1}),O.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class j extends b{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="radio"]');if(!t.length)throw new g({component:j,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 g({component:j,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)})}}j.moduleName="govuk-radios";class _ extends b{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 g(`Skip link: Target link (\`href="${o}"\`) has no hash fragment`);const i=document.getElementById(r);if(!i)throw new g({component:_,element:i,identifier:`Target content (\`id="${r}"\`)`});this.$root.addEventListener("click",()=>l(i,{onBeforeFocus(){i.classList.add("govuk-skip-link-focused-element")},onBlur(){i.classList.remove("govuk-skip-link-focused-element")}}))}}_.elementType=HTMLAnchorElement,_.moduleName="govuk-skip-link";const q=function(){x(C),x(S),x(I),x(M),x(T),x(O),x(j),x(_)},B=function(){const e=document.querySelectorAll('[data-module="govuk-accessible-autocomplete"]');e.length&&n.e(7).then(n.t.bind(n,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)},N=function(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",a):a()},R=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 F(){q(),B(),N(),R()}}},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={543:0,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))})(),(0,i(313).Yi)();
|
|
2
|
+
var e,t,n,o={313:(e,t,n)=>{n.d(t,{Yi:()=>F,IW:()=>B,AC:()=>q,u8:()=>N,Yv:()=>location_map.Yv,DK:()=>R});const o="aria-describedby",r="error-summary-title";function i(e,t,n){if(document.querySelector(".govuk-error-summary"))return void(document.getElementById(r)?n.setAttribute(o,r):n.removeAttribute(o));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="${r}">\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(o,r));const i=n.closest(".govuk-form-group");if(i){i.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}`,i.insertBefore(r,n)),n.setAttribute(o,`error-summary-title ${t}-error`)}}function s(){window.history.replaceState(null,"",window.location.href),window.location.href=window.location.pathname}function a(){var e;const t=document.querySelector('form:has(input[type="file"])'),n=t?t.querySelector('input[type="file"]'):null,r=t?t.querySelector(".upload-file-button"):null,a=null!=(e=Array.from(document.querySelectorAll("button.govuk-button")).find(e=>"Continue"===e.textContent.trim()))?e:null,l=document.querySelector(".govuk-error-summary-container");if(!t||!n||!r)return;const u=t;let c=null,d=!1;const h=u.dataset.uploadId;n.addEventListener("change",()=>{l&&(l.innerHTML=""),n.files&&n.files.length>0&&(c=n.files[0])}),r.addEventListener("click",e=>{if(!c)return e.preventDefault(),void i("Select a file",l,n);d?e.preventDefault():(d=!0,function(e,t,n,r,i){(function(e,t,n){var r;const i=document.getElementById("uploadedFilesContainer"),s=i?i.closest("form"):null;if(!(s&&s instanceof HTMLFormElement))return;const a=s.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}(s,a),u=n.querySelector('input[type="file"]');u&&u.setAttribute(o,"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}(s,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!=(r=null==e?void 0:e.name)?r:""} ${t}`})(i,"Uploading…",e),t.focus(),setTimeout(()=>{t.disabled=!0,n.disabled=!0,r.disabled=!0},100)}(u,n,r,a,c),function(e,t,n,o,r,a){var l;if(!t.action||!a)return!1;e.preventDefault();const u=new FormData(t),c=!!t.dataset.proxyUrl,d=null!=(l=t.dataset.proxyUrl)?l:t.action,h={method:"POST",body:u,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 s();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),s())}).catch(()=>{clearInterval(n),s()})},1e3)}(a)}).catch(()=>(n.disabled=!1,o.disabled=!1,i("There was a problem uploading the file",r,n),null))}(e,u,n,r,l,h))})}function l(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 u(e=document.body){return!!e&&e.classList.contains("govuk-frontend-supported")}function c(e){return!!e&&"object"==typeof e&&!function(e){return Array.isArray(e)}(e)}function d(e){return!!e&&(e instanceof Element||e instanceof Document)}function h(e,t){return`${e.moduleName}: ${t}`}class m extends Error{constructor(...e){super(...e),this.name="GOVUKFrontendError"}}class p extends m{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 f extends m{constructor(...e){super(...e),this.name="ConfigError"}}class g extends m{constructor(e){let t="string"==typeof e?e:"";if(c(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=h(n,t))}super(t),this.name="ElementError"}}class v extends m{constructor(e){super("string"==typeof e?e:h(e,"Root element (`$root`) already initialised")),this.name="InitError"}}class b{get $root(){return this._$root}constructor(e){this._$root=void 0;const t=this.constructor;if("string"!=typeof t.moduleName)throw new v("`moduleName` not defined in component");if(!(e instanceof t.elementType))throw new g({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 v(e)}static checkSupport(){if(!u())throw new p}}b.elementType=HTMLElement;const y=Symbol.for("configOverride");class w extends b{[y](e){return{}}get config(){return this._config}constructor(e,t){super(e),this._config=void 0;const n=this.constructor;if(!c(n.defaults))throw new f(h(n,"Config passed as parameter into constructor but no defaults defined"));const o=function(e,t){if(!c(e.schema))throw new f(h(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]=k(t[s],i)),"object"===(null==i?void 0:i.type)&&(n[s]=E(e.schema,t,o))}return n}(n,this._$root.dataset);this._config=$(n.defaults,null!=t?t:{},this[y](o),o)}}function k(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 $(...e){const t={};for(const n of e)for(const e of Object.keys(n)){const o=t[e],r=n[e];c(o)&&c(r)?t[e]=$(o,r):t[e]=r}return t}function E(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())c(e)&&(o<t.length-1?(c(e[r])||(e[r]={}),e=e[r]):i!==n&&(e[r]=k(s)))}return r[n]}function x(e,t,n){let o;const r=function(e){let t,n=document;if(c(e)){const o=e;(d(o.scope)||null===o.scope)&&(n=o.scope),"function"==typeof o.onError&&(t=o.onError)}return d(e)?n=e:null===e?n=null:"function"==typeof e&&(t=e),{scope:n,onError:t}}(n);try{var i;if(!u())throw new p;if(null===r.scope)throw new g({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 C extends w{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 A(e,t){const n=e.closest(`[${t}]`);return n?n.getAttribute(t):null}C.moduleName="govuk-button",C.defaults=Object.freeze({preventDoubleClick:!1}),C.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class L{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)&&c(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(c(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 S extends w{[y](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 g({component:S,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}(S.schema,this.config);if(i[0])throw new f(h(S,i[0]));this.i18n=new L(this.config.i18n,{locale:A(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 g({component:S,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}}S.moduleName="govuk-character-count",S.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:""}}}),S.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 I extends b{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="checkbox"]');if(!t.length)throw new g({component:I,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 g({component:I,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)))}}I.moduleName="govuk-checkboxes";class M extends w{constructor(e,t={}){super(e,t),this.config.disableAutoFocus||l(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")}}M.moduleName="govuk-error-summary",M.defaults=Object.freeze({disableAutoFocus:!1}),M.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class T extends b{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 g({component:T,identifier:'Navigation button (`<button class="govuk-js-header-toggle">`) attribute (`aria-controls`)'});const o=document.getElementById(n);if(!o)throw new g({component:T,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 g({component:T,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()}}T.moduleName="govuk-header";class O extends w{constructor(e,t={}){super(e,t),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||l(this.$root)}}O.moduleName="govuk-notification-banner",O.defaults=Object.freeze({disableAutoFocus:!1}),O.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class _ extends b{constructor(e){super(e),this.$inputs=void 0;const t=this.$root.querySelectorAll('input[type="radio"]');if(!t.length)throw new g({component:_,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 g({component:_,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)})}}_.moduleName="govuk-radios";class j extends b{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 g(`Skip link: Target link (\`href="${o}"\`) has no hash fragment`);const i=document.getElementById(r);if(!i)throw new g({component:j,element:i,identifier:`Target content (\`id="${r}"\`)`});this.$root.addEventListener("click",()=>l(i,{onBeforeFocus(){i.classList.add("govuk-skip-link-focused-element")},onBlur(){i.classList.remove("govuk-skip-link-focused-element")}}))}}j.elementType=HTMLAnchorElement,j.moduleName="govuk-skip-link";const q=function(){x(C),x(S),x(I),x(M),x(T),x(O),x(_),x(j)},B=function(){const e=document.querySelectorAll('[data-module="govuk-accessible-autocomplete"]');e.length&&n.e(7).then(n.t.bind(n,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)},N=function(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",a):a()},R=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 F(){q(),B(),N(),R()}}},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={543: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))})(),(0,i(313).Yi)();
|
|
3
3
|
//# sourceMappingURL=application.min.js.map
|