@defra/forms-engine-plugin 4.11.1 → 4.11.3
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/shared.min.js +1 -1
- package/.public/javascripts/shared.min.js.map +1 -1
- package/.server/client/javascripts/location-map.js +1 -1
- package/.server/client/javascripts/location-map.js.map +1 -1
- package/.server/server/plugins/engine/components/CheckboxesField.js +3 -3
- package/.server/server/plugins/engine/components/CheckboxesField.js.map +1 -1
- package/.server/server/plugins/engine/pageControllers/validationOptions.js +4 -1
- package/.server/server/plugins/engine/pageControllers/validationOptions.js.map +1 -1
- package/.server/server/plugins/engine/routes/payment.test.js +3 -0
- package/.server/server/plugins/engine/routes/payment.test.js.map +1 -1
- package/.server/server/plugins/map/routes/index.js +8 -0
- package/.server/server/plugins/map/routes/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client/javascripts/location-map.js +1 -1
- package/src/server/plugins/engine/components/CheckboxesField.ts +3 -3
- package/src/server/plugins/engine/pageControllers/validationOptions.ts +4 -1
- package/src/server/plugins/map/routes/index.js +8 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see shared.min.js.LICENSE.txt */
|
|
2
|
-
var t,e,n,r={457:(t,e,n)=>{n.d(e,{addFeatureToMap:()=>v,createFeatureHTML:()=>w,createFeaturesHTML:()=>y,focusFeature:()=>b,getBoundingBox:()=>g,getGeoJSON:()=>p,processGeospatial:()=>f}),n.r(e);var r=n(356);function o(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return(0,r.Fh)(t,t=>{n[0]>t[0]&&(n[0]=t[0]),n[1]>t[1]&&(n[1]=t[1]),n[2]<t[0]&&(n[2]=t[0]),n[3]<t[1]&&(n[3]=t[1])}),n}var i=n(559);function a(){return a=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},a.apply(null,arguments)}const s={showLabel:!0,label:"How to use this map",mobile:{slot:"drawer",open:!0,dismissible:!0,modal:!1},tablet:{slot:"drawer",open:!0,dismissible:!0,modal:!1},desktop:{slot:"drawer",open:!0,dismissible:!0,modal:!1},html:'<p class="govuk-body-s govuk-!-margin-bottom-2">You can add points, shapes or lines to the map.</p><ul class="govuk-list govuk-list--number govuk-body-s"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Double‑click, or select \'Done\', when you have finished drawing a line or shape</li><li>Give the location a name</li></ul>'},l={stroke:"rgba(0, 11, 112, 1)",fill:"rgba(0, 11, 112, 0.2)",strokeWidth:2},u={stroke:"rgb(0, 0, 0)",fill:"rgba(255, 221, 0, 0.2)",strokeWidth:2},c={Point:"Point",LineString:"Line",Polygon:"Shape"},d='<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" /><circle cx="12" cy="10" r="3" />',h='<path d="M19.5 7v10M4.5 7v10M7 19.5h10M7 4.5h10"/><path d="M22 18v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm0-15v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 18v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 3v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1z"/>',m='<path d="M5.706 16.294L16.294 5.706"/><path d="M21 2v3c0 .549-.451 1-1 1h-3c-.549 0-1-.451-1-1V2c0-.549.451-1 1-1h3c.549 0 1 .451 1 1zM6 17v3c0 .549-.451 1-1 1H2c-.549 0-1-.451-1-1v-3c0-.549.451-1 1-1h3c.549 0 1 .451 1 1z"/>';function p(t){const e=t.value.trim();return{type:"FeatureCollection",features:e?JSON.parse(e):[]}}function g(t){return o(t)}function f(t,e,n){const r=window.defra;if(!(e instanceof HTMLDivElement))return;const o=e.querySelector(".govuk-textarea");if(!(o instanceof HTMLTextAreaElement))return;const{listEl:c,mapId:f}=function(t,e){const n=document.createElement("div"),r=`geospatialmap_${e}`;n.setAttribute("id",r),n.setAttribute("class","map-container");const o=document.createElement("div"),i=`${r}_list`;return o.setAttribute("id",i),t.after(n),n.after(o),t.classList.add("js-hidden"),{mapEl:n,listEl:o,mapId:r}}(o,n),w=p(o),$=w.features.length?g(w):void 0,S=r.drawMLPlugin(),M=[S],x=e.dataset.country;if(x){const e=r.datasetsMaplibrePlugin({datasets:[{id:"invalid-area",label:"Invalid areas",geojson:`${t.apiPath}/maps/countries.geojson?omit=${x}`,showInKey:!1,showInMenu:!1,style:{stroke:"gray",strokeWidth:1,fill:"rgba(211,211,211,0.8)"}},{id:"valid-area",label:"Valid areas",geojson:`${t.apiPath}/maps/countries.geojson?only=${x}`,showInKey:!1,showInMenu:!1,style:{stroke:"rgba(0,112,60,1)",strokeWidth:1}}]});M.push(e)}const L=a({},i.defaultConfig,{bounds:$,plugins:M}),{map:N,interactPlugin:A}=(0,i.createMap)(f,L,t),C=function(t){function e(e){return t.features.find(t=>t.id===e)}return{getFeatures:function(){return t.features},getFeature:e,addFeature:function(e){e.properties.coordinateGridReference=(0,i.getCoordinateGridRef)(e),e.properties.centroidGridReference=(0,i.getCentroidGridRef)(e),E(e),t.features.push(e)},updateFeature:function(t,n){const r=e(t);return r&&(r.properties.coordinateGridReference=(0,i.getCoordinateGridRef)(r),r.properties.centroidGridReference=(0,i.getCentroidGridRef)(r),r.geometry=n,E(r)),r},removeFeature:function(e){const n=t.features.findIndex(t=>t.id===e);return n>-1?t.features.splice(n,1):void 0}}}(w),_=function(){let t;return{getActiveFeature:function(){return t},setActiveFeature:function(e){t=e},resetActiveFeature:function(){t=void 0}}}(),T=function(t,e,n,r,o){const i=function(t,e){return function(){e.value=JSON.stringify(t.features,null,2)}}(t,o),a=function(t,e,n,r){return function(o=!1){const i=y(t.features,e,o);n.innerHTML=i,r()}}(t,n,r,i);return{renderList:a,renderValue:i,listEl:r,toggleActionButtons:function(t){e.toggleButtonState("btnAddPoint","hidden",t),e.toggleButtonState("btnAddPolygon","hidden",t),e.toggleButtonState("btnAddLine","hidden",t)},focusDescriptionInput:function(){const t=r.querySelectorAll("input");if(t.length){const e=t.item(t.length-1);e.focus(),e.select()}}}}(w,N,f,c,o);!function(t){const{map:e}=t;e.on(i.EVENTS.mapReady,function(t){const{map:e,activeFeatureManager:n,uiManager:r,interactPlugin:o,drawPlugin:c}=t,{toggleActionButtons:p,renderList:g}=r,{resetActiveFeature:f}=n;return function(n){e.addPanel("info",s),e.addButton("btnAddPoint",{variant:"tertiary",label:"Add point",iconSvgContent:d,onClick:()=>{f(),p(!0),g(!0),o.enable()},mobile:{slot:"actions"},tablet:{slot:"actions"},desktop:{slot:"actions"}}),e.addButton("btnAddPolygon",{variant:"tertiary",label:"Add shape",iconSvgContent:h,onClick:()=>{f(),p(!0),g(!0),c.newPolygon(k(),u)},mobile:{slot:"actions"},tablet:{slot:"actions"},desktop:{slot:"actions"}}),e.addButton("btnAddLine",{variant:"tertiary",label:"Add line",iconSvgContent:m,onClick:()=>{f(),p(!0),g(!0),c.newLine(k(),l)},mobile:{slot:"actions"},tablet:{slot:"actions"},desktop:{slot:"actions"}}),t.mapProvider=n.map,e.on(i.EVENTS.drawReady,function(t){const{featuresManager:e,uiManager:n,drawPlugin:r,map:o}=t,{renderList:i}=n,{getFeatures:a}=e;return function(){a().forEach(t=>v(t,r,o)),i()}}(t)),e.on(i.EVENTS.drawCreated,function(t){const{featuresManager:e,uiManager:n}=t,{addFeature:r}=e,{renderList:o,toggleActionButtons:i,focusDescriptionInput:s}=n;return function(t){r(a({},t,{properties:{description:""}})),o(),i(!1),s()}}(t)),e.on(i.EVENTS.drawEdited,function(t){const{featuresManager:e,activeFeatureManager:n,uiManager:r}=t,{updateFeature:o}=e,{getActiveFeature:i,resetActiveFeature:a}=n,{renderList:s,toggleActionButtons:l}=r;return function(t){const e=t,n=e.id;i()===n&&(o(n,e.geometry),s()),a(),l(!1)}}(t)),e.on(i.EVENTS.drawCancelled,function(t){const{uiManager:e,activeFeatureManager:n}=t,{toggleActionButtons:r,renderList:o}=e,{resetActiveFeature:i}=n;return function(){r(!1),i(),o()}}(t)),e.on(i.EVENTS.interactMarkerChange,function(t){const{featuresManager:e,activeFeatureManager:n,map:r,interactPlugin:o,uiManager:i}=t,{addFeature:a,updateFeature:s}=e,{getActiveFeature:l,resetActiveFeature:u}=n,{renderList:c,focusDescriptionInput:d,toggleActionButtons:h}=i;return function(t){const e=l();if(e){const n=s(e,{type:"Point",coordinates:t.coords});r.addMarker(e,t.coords),n&&c(),u()}else{const e=k();a({type:"Feature",properties:{description:""},geometry:{type:"Point",coordinates:t.coords},id:e}),r.addMarker(e,t.coords),c(),d()}r.removeMarker("location"),o.disable(),h(!1)}}(t));const{listEl:y}=r;y.addEventListener("click",function(t){const{map:e,mapProvider:n,featuresManager:r,activeFeatureManager:o,interactPlugin:i,uiManager:a,drawPlugin:s}=t,{getFeature:l,removeFeature:u}=r,{getActiveFeature:c,setActiveFeature:d}=o,{renderList:h,toggleActionButtons:m}=a;return function(t){const r=t.target;if(r instanceof HTMLElement){if(c())return t.preventDefault(),void t.stopPropagation();if("A"===r.tagName&&r.dataset.action&&r.dataset.id&&r.dataset.type){const{action:o,id:a,type:c}=r.dataset;"edit"===o?function(t,e){d(t),"Point"===e?(i.selectFeature({featureId:t}),i.enable()):s.editFeature(t);const r=l(t);r&&n&&b(r,n),m(!0),h(!0)}(a,c):(t.preventDefault(),t.stopPropagation(),"delete"===o&&function(t,n){"Point"===n?(e.removeMarker(t),u(t)):(s.deleteFeature(t),u(t)),h()}(a,c))}}}}(t),!1),y.addEventListener("change",function(t){const{featuresManager:e,uiManager:n}=t,{getFeature:r}=e,{renderValue:o}=n;return function(t){t.preventDefault(),t.stopPropagation();const e=t.target;if(!(e instanceof HTMLInputElement&&e.dataset.id))return;const{id:n}=e.dataset,i=r(n);i&&(i.properties.description=e.value.trim(),o())}}(t),!1),y.addEventListener("keydown",function(t){t.target instanceof HTMLInputElement&&("Enter"!==t.code&&"NumpadEnter"!==t.code||(t.preventDefault(),t.stopPropagation()))},!1)}}(t))}({map:N,featuresManager:C,activeFeatureManager:_,uiManager:T,interactPlugin:A,drawPlugin:S})}function v(t,e,n){switch(t.geometry.type){case"Polygon":e.addFeature(a({},t,u));break;case"LineString":e.addFeature(a({},t,l));break;case"Point":n.addMarker(t.id,t.geometry.coordinates)}}function y(t,e,n=!1,r=!1){return`<dl class="govuk-summary-list">\n ${t.map((t,o)=>w(t,o,e,n,r)).join("\n")}\n </dl>`}function b(t,e){e.fitBounds(o(t))}function w(t,e,n,r=!1,o=!1){const i=t.geometry.coordinates.flat(2),a=[];for(let l=0;l<i.length;l+=2)a.push(i.slice(l,l+2).join(", "));const s=a.map(t=>`<li>${t}</li>`).join("");return`<div class="govuk-summary-list__row govuk-summary-list__row--no-border">\n <dt class="govuk-summary-list__key">\n <div class="govuk-form-group">\n <label class="govuk-label govuk-label--s" ${o?"":`for="description_${e}"`}>Location ${e+1} description</label>\n ${o?`<p class="govuk-body govuk-!-margin-bottom-0">${t.properties.description}</p>`:`<input class="govuk-input govuk-!-width-two-thirds" type="text" id="description_${e}" value="${t.properties.description}" data-id="${t.id}">`}\n </div>\n </dt>\n <dd class="govuk-summary-list__actions">\n <ul class="govuk-summary-list__actions-list">${o?`<li class="govuk-summary-list__actions-list-item">\n <a class="govuk-link govuk-link--no-visited-state" href="#${n}" data-action="focus" data-id="${t.id}">Show<span class="govuk-visually-hidden"> location</span></a>\n</li>`:`<li class="govuk-summary-list__actions-list-item">\n <a class="govuk-link govuk-link--no-visited-state ${r?"govuk-link--disabled":""}" href="#${n}" data-action="edit" data-id="${t.id}"\n data-type="${t.geometry.type}">Update<span class="govuk-visually-hidden"> location</span></a>\n</li><li class="govuk-summary-list__actions-list-item">\n <a class="govuk-link govuk-link--no-visited-state ${r?"govuk-link--disabled":""}" href="#" data-action="delete" data-id="${t.id}"\n data-type="${t.geometry.type}">Delete<span class="govuk-visually-hidden"> location</span></a>\n</li>`}</ul>\n </dd>\n</div>\n<div class="govuk-summary-list__row">\n <details class="govuk-details govuk-!-margin-bottom-2">\n <summary class="govuk-details__summary">\n <span class="govuk-details__summary-text">Coordinates</span>\n </summary>\n <div class="govuk-details__text">\n <dl class="govuk-summary-list">\n <div class="govuk-summary-list__row">\n <dt class="govuk-summary-list__key">Type</dt>\n <dd class="govuk-summary-list__value">${c[t.geometry.type]}</dd>\n </div>\n <div class="govuk-summary-list__row">\n <dt class="govuk-summary-list__key">Centre grid reference</dt>\n <dd class="govuk-summary-list__value">${t.properties.centroidGridReference}</dd>\n </div>\n <div class="govuk-summary-list__row">\n <dt class="govuk-summary-list__key">First point grid reference</dt>\n <dd class="govuk-summary-list__value">${t.properties.coordinateGridReference}</dd>\n </div>\n <div class="govuk-summary-list__row">\n <dt class="govuk-summary-list__key">Detailed coordinates</dt>\n <dd class="govuk-summary-list__value">\n <ol class="govuk-list govuk-list--number">${s}</ol>\n </dd>\n </div>\n </dl>\n </div>\n </details>\n</div>`}function k(){return window.crypto.randomUUID()}function E(t){const{geometry:e}=t;function n(t){t[0]=+t[0].toFixed(7),t[1]=+t[1].toFixed(7)}"Point"===e.type?n(e.coordinates):"LineString"===e.type?e.coordinates.forEach(n):e.coordinates.flat().forEach(n)}},559:(t,e,n)=>{n.d(e,{EVENTS:()=>q,centerMap:()=>U,createMap:()=>H,defaultConfig:()=>G,eastingNorthingToLatLong:()=>P,formSubmitFactory:()=>W,getCentroidGridRef:()=>D,getCoordinateGridRef:()=>B,initMaps:()=>z,latLongToEastingNorthing:()=>I,latLongToOsGridRef:()=>R,makeTileRequestTransformer:()=>V,osGridRefToLatLong:()=>j}),n.r(e);function r(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}Math.PI;var o=n(356);function i(t,e={}){let n=0,i=0,a=0;return(0,o.Fh)(t,function(t){n+=t[0],i+=t[1],a++},!0),function(t,e,n={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!r(t[0])||!r(t[1]))throw new Error("coordinates must contain numbers");return function(t,e,n={}){const r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}({type:"Point",coordinates:t},e,n)}([n/a,i/a],e.properties)}let a=" ";class s{static get separator(){return a}static set separator(t){a=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,o=null,i=null,a=null;switch(e){default:case"d":case"deg":o=t.toFixed(n),o<100&&(o="0"+o),o<10&&(o="0"+o),r=o+"°";break;case"dm":case"deg+min":o=Math.floor(t),i=(60*t%60).toFixed(n),60==i&&(i=(0).toFixed(n),o++),o=("000"+o).slice(-3),i<10&&(i="0"+i),r=o+"°"+s.separator+i+"′";break;case"dms":case"deg+min+sec":o=Math.floor(t),i=Math.floor(3600*t/60)%60,a=(3600*t%60).toFixed(n),60==a&&(a=(0).toFixed(n),i++),60==i&&(i=0,o++),o=("000"+o).slice(-3),i=("00"+i).slice(-2),a<10&&(a="0"+a),r=o+"°"+s.separator+i+"′"+s.separator+a+"″"}return r}static toLat(t,e,n){const r=s.toDms(s.wrap90(t),e,n);return null===r?"–":r.slice(1)+s.separator+(t<0?"S":"N")}static toLon(t,e,n){const r=s.toDms(s.wrap180(t),e,n);return null===r?"–":r+s.separator+(t<0?"W":"E")}static toBrng(t,e,n){const r=s.toDms(s.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=s.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 l=s;class u{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 u))throw new TypeError("v is not Vector3d object");return new u(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof u))throw new TypeError("v is not Vector3d object");return new u(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 u(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new u(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof u))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 u))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 u(e,n,r)}negate(){return new u(-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 u(e,n,r)}angleTo(t,e=void 0){if(!(t instanceof u))throw new TypeError("v is not Vector3d object");if(!(e instanceof u||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 u))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),s=1-a,l=o.x,c=o.y,d=o.z,h=[[s*l*l+a,s*l*c-i*d,s*l*d+i*c],[s*l*c+i*d,s*c*c+a,s*c*d-i*l],[s*l*d-i*c,s*c*d+i*l,s*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 u(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 c=u,d={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},h={WGS84:{ellipsoid:d.WGS84}};Object.freeze(d.WGS84),Object.freeze(h.WGS84);class m{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=l.wrap90(Number(t)),this._lon=l.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)?l.wrap90(l.parse(t)):l.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?l.wrap90(l.parse(t)):l.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)?l.wrap180(l.parse(t)):l.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?l.wrap180(l.parse(t)):l.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?l.wrap180(l.parse(t)):l.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 d}static get datums(){return h}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=l.wrap90(l.parse(e)),n=l.wrap180(l.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=l.wrap90(l.parse(e)),n=l.wrap180(l.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=l.wrap90(l.parse(e)),n=l.wrap180(l.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:d.WGS84,e=this.lat.toRadians(),n=this.lon.toRadians(),r=this.height,{a:o,f:i}=t,a=Math.sin(e),s=Math.cos(e),l=Math.sin(n),u=Math.cos(n),c=2*i-i*i,h=o/Math.sqrt(1-c*a*a);return new p((h+r)*s*u,(h+r)*s*l,(h*(1-c)+r)*a)}equals(t){if(!(t instanceof m))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}`):`${l.toLat(this.lat,t,e)}, ${l.toLon(this.lon,t,e)}${null==n?"":r}`}}class p extends c{constructor(t,e,n){super(t,e,n)}toLatLon(t=d.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:n,z:r}=this,{a:o,b:i,f:a}=t,s=2*a-a*a,l=s/(1-s),u=Math.sqrt(e*e+n*n),c=i*r/(o*u)*(1+l*i/Math.sqrt(u*u+r*r)),h=c/Math.sqrt(1+c*c),p=h/c,g=isNaN(p)?0:Math.atan2(r+l*i*h*h*h,u-s*o*p*p*p),f=Math.atan2(n,e),v=Math.sin(g),y=u*Math.cos(g)+r*v-o*o/(o/Math.sqrt(1-s*v*v));return new m(g.toDegrees(),f.toDegrees(),y)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const g={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}},f={ED50:{ellipsoid:g.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:g.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:g.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:g.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:g.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:g.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:g.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:g.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:g.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:g.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:g.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(g).forEach(t=>Object.freeze(g[t])),Object.keys(f).forEach(t=>{Object.freeze(f[t]),Object.freeze(f[t].transform)});class v extends m{constructor(t,e,n=0,r=f.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 g}static get datums(){return f}static parse(...t){let e=f.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 y(t.x,t.y,t.z,this.datum)}}class y extends p{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||f.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const n=super.toLatLon(e.ellipsoid);return new v(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!=f.WGS84||(e=this,n=t.transform),t==f.WGS84&&(e=this,n=this.datum.transform.map(t=>-t)),null==n&&(e=this.convertDatum(f.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],a=t[2],s=t[3]/1e6+1,l=(t[4]/3600).toRadians(),u=(t[5]/3600).toRadians(),c=(t[6]/3600).toRadians();return new y(o+e*s-n*c+r*u,i+e*c+n*s-r*l,a-e*u+n*l+r*s)}}const b={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:v.ellipsoids.Airy1830};class w{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=v.datums.WGS84){const{easting:e,northing:n}=this,{a:r,b:o}=b.ellipsoid,i=b.trueOrigin.lat.toRadians(),a=b.trueOrigin.lon.toRadians(),s=-b.falseOrigin.easting,l=-b.falseOrigin.northing,u=b.scaleFactor,c=1-o*o/(r*r),d=(r-o)/(r+o),h=d*d,m=d*d*d;let p=i,g=0;do{p=(n-l-g)/(r*u)+p,g=o*u*((1+d+5/4*h+5/4*m)*(p-i)-(3*d+3*d*d+21/8*m)*Math.sin(p-i)*Math.cos(p+i)+(15/8*h+15/8*m)*Math.sin(2*(p-i))*Math.cos(2*(p+i))-35/24*m*Math.sin(3*(p-i))*Math.cos(3*(p+i)))}while(Math.abs(n-l-g)>=1e-5);const f=Math.cos(p),y=Math.sin(p),w=r*u/Math.sqrt(1-c*y*y),E=r*u*(1-c)/Math.pow(1-c*y*y,1.5),$=w/E-1,S=Math.tan(p),M=S*S,x=M*M,L=1/f,N=w*w*w,A=N*w*w,C=e-s,_=C*C,T=_*C,F=_*_,O=T*_;p=p-S/(2*E*w)*_+S/(24*E*N)*(5+3*M+$-9*M*$)*F-S/(720*E*A)*(61+90*M+45*x)*(F*_);const I=a+L/w*C-L/(6*N)*(w/E+2*M)*T+L/(120*A)*(5+28*M+24*x)*O-L/(A*w*w*5040)*(61+662*M+1320*x+x*M*720)*(O*_);let P=new k(p.toDegrees(),I.toDegrees(),0,v.datums.OSGB36);return t!=v.datums.OSGB36&&(P=P.convertDatum(t),P=new k(P.lat,P.lon,P.height,P.datum)),P}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new w(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 a=t.slice(2).trim().split(/\s+/);if(1==a.length&&(a=[a[0].slice(0,a[0].length/2),a[0].slice(a[0].length/2)]),a[0].length!=a[1].length)throw new Error(`invalid grid reference ‘${t}’`);a[0]=a[0].padEnd(5,"0"),a[1]=a[1].padEnd(5,"0");const s=o+a[0],l=i+a[1];return new w(s,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),a=5*(19-o)%25+r%5;i>7&&i++,a>7&&a++;const s=String.fromCharCode(i+"A".charCodeAt(0),a+"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"),`${s} ${e} ${n}`}}class k extends v{toOsGrid(){const t=this.datum==v.datums.OSGB36?this:this.convertDatum(v.datums.OSGB36),e=t.lat.toRadians(),n=t.lon.toRadians(),{a:r,b:o}=b.ellipsoid,i=b.trueOrigin.lat.toRadians(),a=b.trueOrigin.lon.toRadians(),s=-b.falseOrigin.easting,l=-b.falseOrigin.northing,u=b.scaleFactor,c=1-o*o/(r*r),d=(r-o)/(r+o),h=d*d,m=d*d*d,p=Math.cos(e),g=Math.sin(e),f=r*u/Math.sqrt(1-c*g*g),y=r*u*(1-c)/Math.pow(1-c*g*g,1.5),k=f/y-1,E=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))),$=p*p*p,S=$*p*p,M=Math.tan(e)*Math.tan(e),x=M*M,L=n-a,N=L*L,A=N*L,C=A*L,_=C*L;let T=E+l+f/2*g*p*N+f/24*g*$*(5-M+9*k)*C+f/720*g*S*(61-58*M+x)*(_*L),F=s+f*p*L+f/6*$*(f/y-M)*A+f/120*S*(5-18*M+x+14*k-58*M*k)*_;T=Number(T.toFixed(3)),F=Number(F.toFixed(3));try{return new w(F,T)}catch(O){throw new Error(`${O.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new k(e.lat,e.lon,e.height,e.datum)}}var E=n(457);const $="input.govuk-input";function S(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 M(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 x(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 L(t){const e=t.querySelectorAll($);if(2!==e.length)throw new Error("Expected 2 inputs for lat and long");return{latInput:e[0],longInput:e[1]}}function N(t){const e=t.querySelectorAll($);if(2!==e.length)throw new Error("Expected 2 inputs for easting and northing");return{eastingInput:e[0],northingInput:e[1]}}function A(t){const e=t.querySelector($);if(null===e)throw new Error("Expected 1 input for osgridref");return e}function C(t){return{zoom:"16",center:t,markers:[{id:"location",coords:t}]}}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 a=document.createElement("div"),s=`map_${n}`;a.setAttribute("id",s),a.setAttribute("class","map-container");const l=null!=(r=function(t){switch(t.dataset.locationtype){case"latlongfield":return function(t){const{latInput:e,longInput:n}=L(t),r=S(e.value,n.value);if(r.valid)return C([r.value.long,r.value.lat])}(t);case"eastingnorthingfield":return function(t){const{eastingInput:e,northingInput:n}=N(t),r=M(e.value,n.value);if(!r.valid)return;const o=P(r.value);return C([o.long,o.lat])}(t);case"osgridreffield":return function(t){const e=x(A(t).value);if(!e.valid)return;const n=j(e.value);return C([n.long,n.lat])}(t);default:throw new Error("Not implemented")}}(e))?r:G;o.after(a);const{map:u,interactPlugin:c}=H(s,l,t);u.on(q.mapReady,function(t){switch(i){case"latlongfield":!function(t,e,n){const{latInput:r,longInput:o}=L(t);function i(){const t=S(r.value,o.value);if(t.valid){const r=[t.value.long,t.value.lat];U(e,n,r)}}e.on(q.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}=N(t);function i(){const t=M(r.value,o.value);if(t.valid){const r=P(t.value),o=[r.long,r.lat];U(e,n,o)}}e.on(q.interactMarkerChange,function(t){const e=I({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=A(t);e.on(q.interactMarkerChange,function(t){const e=R({lat:t.coords[1],long:t.coords[0]});r.value=e}),r.addEventListener("change",function(){const t=x(r.value);if(t.valid){const r=j(t.value),o=[r.long,r.lat];U(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:"drawer",open:!0,dismissible:!0,modal:!1},tablet:{slot:"drawer",open:!0,dismissible:!0,modal:!1},desktop:{slot:"drawer",open:!0,dismissible:!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()})}function T(){return T=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},T.apply(null,arguments)}const F=169,O={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",VTS_AERIAL_URL:"/api/maps/vts/esri-aerial.json"};function I({lat:t,long:e}){return new k(t,e).toOsGrid()}function P({easting:t,northing:e}){const n=new w(t,e).toLatLon();return{lat:n.latitude,long:n.longitude}}function R({lat:t,long:e}){return new k(t,e).toOsGrid().toString()}function j(t){const e=w.parse(t).toLatLon();return{lat:e.latitude,long:e.longitude}}function B(t){if("Point"===t.geometry.type){const[e,n]=t.geometry.coordinates;return new k(n,e).toOsGrid().toString()}if("LineString"===t.geometry.type){const[e,n]=t.geometry.coordinates[0];return new k(n,e).toOsGrid().toString()}{const[e,n]=t.geometry.coordinates[0][0];return new k(n,e).toOsGrid().toString()}}function D(t){if("Point"===t.geometry.type){const[e,n]=t.geometry.coordinates;return new k(n,e).toOsGrid().toString()}{const e=i(t),[n,r]=e.geometry.coordinates;return new k(r,n).toOsGrid().toString()}}const G={zoom:"6",center:[-2.421975,53.825564]},q={mapReady:"map:ready",interactMarkerChange:"interact:markerchange",drawReady:"draw:ready",drawCreated:"draw:created",drawEdited:"draw:edited",drawCancelled:"draw:cancelled"};function W(t){return function(e){e.submitter instanceof HTMLButtonElement&&t.includes(e.submitter)||e.preventDefault()}}function z(t={}){const{assetPath:e="/assets",apiPath:n="/form/api",data:r=O}=t,o=document.querySelectorAll(".app-location-field"),i=document.querySelectorAll(".app-geospatial-field");if(o.length){const t=o[0].closest("form");if(null===t)return;const e=Array.from(t.querySelectorAll("button"));t.addEventListener("submit",W(e),!1)}if(i.length){const t=i[0].closest("form");if(null===t)return;const e=Array.from(t.querySelectorAll("button"));t.addEventListener("submit",W(e),!1)}o.forEach((t,o)=>{_({assetPath:e,apiPath:n,data:r},t,o)}),i.forEach((t,o)=>{(0,E.processGeospatial)({assetPath:e,apiPath:n,data:r},t,o)})}function V(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 H(t,e,n){var r;const{assetPath:o,apiPath:i,data:a=O}=n,s="Ordnance survey logo",l=window.defra,u=l.interactPlugin({markerColor:{outdoor:"#ff0000",dark:"#00ff00"},interactionModes:["placeMarker"],multiSelect:!1});return{map:new l.InteractiveMap(t,T({enableFullscreen:!0,autoColorScheme:!1,mapProvider:l.maplibreProvider(),reverseGeocodeProvider:l.openNamesProvider({url:`${i}/reverse-geocode-proxy?easting={easting}&northing={northing}`}),behaviour:"inline",minZoom:6,maxZoom:18,containerHeight:"400px",enableZoomControls:!0,transformRequest:V(i)},e,{plugins:[l.mapStylesPlugin({mapStyles:[{id:"outdoor",label:"Outdoor",url:a.VTS_OUTDOOR_URL,thumbnail:`${o}/interactive-map/assets/images/outdoor-map-thumb.jpg`,logo:`${o}/interactive-map/assets/images/os-logo.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(F)} Crown copyright and database rights ${(new Date).getFullYear()}`,backgroundColor:"#f5f5f0"},{id:"dark",label:"Dark",url:a.VTS_DARK_URL,mapColorScheme:"dark",appColorScheme:"dark",thumbnail:`${o}/interactive-map/assets/images/dark-map-thumb.jpg`,logo:`${o}/interactive-map/assets/images/os-logo-white.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(F)} Crown copyright and database rights ${(new Date).getFullYear()}`},{id:"black-and-white",label:"Black/White",url:a.VTS_BLACK_AND_WHITE_URL,thumbnail:`${o}/interactive-map/assets/images/black-and-white-map-thumb.jpg`,logo:`${o}/interactive-map/assets/images/os-logo-black.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(F)} Crown copyright and database rights ${(new Date).getFullYear()}`},{id:"aerial",label:"Aerial",url:a.VTS_AERIAL_URL,thumbnail:`${o}/interactive-map/assets/images/aerial-map-thumb.jpg`,logo:`${o}/interactive-map/assets/images/esri-logo.png`,logoAltText:"Powered by Esri",attribution:`Tiles ${String.fromCodePoint(F)} Esri — Source: Esri, Maxar, Earthstar Geographics, and the GIS User Community ${(new Date).getFullYear()}`}]}),u,l.searchPlugin({osNamesURL:`${i}/geocode-proxy?query={query}`,width:"300px",showMarker:!1}),l.scaleBarPlugin({units:"metric"}),...null!=(r=e.plugins)?r:[]]})),interactPlugin:u}}function U(t,e,n){t.addMarker("location",n),e.flyTo({center:n,zoom:14,essential:!0})}},356:(t,e,n)=>{function r(t,e,n){if(null!==t)for(var o,i,a,s,l,u,c,d,h=0,m=0,p=t.type,g="FeatureCollection"===p,f="Feature"===p,v=g?t.features.length:1,y=0;y<v;y++){l=(d=!!(c=g?t.features[y].geometry:f?t.geometry:t)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var b=0;b<l;b++){var w=0,k=0;if(null!==(s=d?c.geometries[b]:c)){u=s.coordinates;var E=s.type;switch(h=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":if(!1===e(u,m,y,w,k))return!1;m++,w++;break;case"LineString":case"MultiPoint":for(o=0;o<u.length;o++){if(!1===e(u[o],m,y,w,k))return!1;m++,"MultiPoint"===E&&w++}"LineString"===E&&w++;break;case"Polygon":case"MultiLineString":for(o=0;o<u.length;o++){for(i=0;i<u[o].length-h;i++){if(!1===e(u[o][i],m,y,w,k))return!1;m++}"MultiLineString"===E&&w++,"Polygon"===E&&k++}"Polygon"===E&&w++;break;case"MultiPolygon":for(o=0;o<u.length;o++){for(k=0,i=0;i<u[o].length;i++){for(a=0;a<u[o][i].length-h;a++){if(!1===e(u[o][i][a],m,y,w,k))return!1;m++}k++}w++}break;case"GeometryCollection":for(o=0;o<s.geometries.length;o++)if(!1===r(s.geometries[o],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}n.d(e,{Fh:()=>r})}},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 a={};t=t||[null,e({}),e([]),e(e)];for(var s=2&r&&n;("object"==typeof s||"function"==typeof s)&&!~t.indexOf(s);s=e(s))Object.getOwnPropertyNames(s).forEach(t=>a[t]=()=>n[t]);return a.default=()=>n,i.d(o,a),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 a,s;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){a=c;break}}a||(s=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",i.nc&&a.setAttribute("nonce",i.nc),a.src=t),n[t]=[e];var d=(e,r)=>{a.onerror=a.onload=null,clearTimeout(h);var o=n[t];if(delete n[t],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach(t=>t(r)),e)return e(r)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),s&&document.head.appendChild(a)}},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 a=i.p+i.u(e),s=new Error;i.l(a,n=>{if(i.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;s.message="Loading chunk "+e+" failed.\n("+o+": "+a+")",s.name="ChunkLoadError",s.type=o,s.request=a,r[1](s)}},"chunk-"+e,e)}};var e=(e,n)=>{var r,o,a=n[0],s=n[1],l=n[2],u=0;if(a.some(e=>0!==t[e])){for(r in s)i.o(s,r)&&(i.m[r]=s[r]);l&&l(i)}for(e&&e(n);u<a.length;u++)o=a[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 a="aria-describedby",s="error-summary-title";function l(t,e,n){var r;const o=document.getElementById("uploadedFilesContainer"),i=o?o.closest("form"):null;if(!(i&&i instanceof HTMLFormElement))return;const s=i.querySelector("p.govuk-body");if(!s)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,s),u=n.querySelector('input[type="file"]');u&&u.setAttribute(a,"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,s),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}`}function u(t,e,n){if(document.querySelector(".govuk-error-summary"))return void(document.getElementById(s)?n.setAttribute(a,s):n.removeAttribute(a));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="${s}">\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(a,s));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(a,`error-summary-title ${e}-error`)}}function c(){window.history.replaceState(null,"",window.location.href),window.location.href=window.location.pathname}function d(){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 s=[],d=!1;const h=a.dataset.uploadId;n.addEventListener("change",()=>{i&&(i.innerHTML=""),n.files&&n.files.length>0&&(s=Array.from(n.files))}),r.addEventListener("click",t=>{if(0===s.length)return t.preventDefault(),void u("Select a file",i,n);d?t.preventDefault():(d=!0,function(t,e,n,r,o){for(let i=o.length-1;i>=0;i--)l(o[i],"Uploading…",t);e.focus(),setTimeout(()=>{e.disabled=!0,n.disabled=!0,r.disabled=!0},100)}(a,n,r,o,s),function(t,e,n,r,o,i){var a;if(!e.action||!i)return!1;t.preventDefault();const s=new FormData(e),l=!!e.dataset.proxyUrl,d=null!=(a=e.dataset.proxyUrl)?a:e.action,h={method:"POST",body:s,redirect:l?"follow":"manual"};l&&(h.mode="no-cors"),fetch(d,h).then(()=>{!function(t){let e=0;const n=setInterval(()=>{if(e++,e>=300)return clearInterval(n),void c();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),c())}).catch(()=>{clearInterval(n),c()})},1e3)}(i)}).catch(()=>(n.disabled=!1,r.disabled=!1,u("There was a problem uploading the file",o,n),null))}(t,a,n,r,i,h))})}function h(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 m(t=document.body){return!!t&&t.classList.contains("govuk-frontend-supported")}function p(t){return!!t&&"object"==typeof t&&!function(t){return Array.isArray(t)}(t)}function g(t){return!!t&&(t instanceof Element||t instanceof Document)}function f(t,e){return`${t.moduleName}: ${e}`}class v extends Error{constructor(...t){super(...t),this.name="GOVUKFrontendError"}}class y extends v{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 v{constructor(...t){super(...t),this.name="ConfigError"}}class w extends v{constructor(t){let e="string"==typeof t?t:"";if(p(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 k extends v{constructor(t){super("string"==typeof t?t:f(t,"Root element (`$root`) already initialised")),this.name="InitError"}}class E{get $root(){return this._$root}constructor(t){this._$root=void 0;const e=this.constructor;if("string"!=typeof e.moduleName)throw new k("`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 k(t)}static checkSupport(){if(!m())throw new y}}E.elementType=HTMLElement;const $=Symbol.for("configOverride");class S extends E{[$](t){return{}}get config(){return this._config}constructor(t,e){super(t),this._config=void 0;const n=this.constructor;if(!p(n.defaults))throw new b(f(n,"Config passed as parameter into constructor but no defaults defined"));const r=function(t,e){if(!p(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,a=r.toString();a in e&&(n[a]=M(e[a],i)),"object"===(null==i?void 0:i.type)&&(n[a]=L(t.schema,e,r))}return n}(n,this._$root.dataset);this._config=x(n.defaults,null!=e?e:{},this[$](r),r)}}function M(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];p(r)&&p(o)?e[t]=x(r,o):e[t]=o}return e}function L(t,e,n){const r=t.properties[n];if("object"!==(null==r?void 0:r.type))return;const o={[n]:{}};for(const[i,a]of Object.entries(e)){let t=o;const e=i.split(".");for(const[r,o]of e.entries())p(t)&&(r<e.length-1?(p(t[o])||(t[o]={}),t=t[o]):i!==n&&(t[o]=M(a)))}return o[n]}function N(t,e,n){let r;const o=function(t){let e,n=document;if(p(t)){const r=t;(g(r.scope)||null===r.scope)&&(n=r.scope),"function"==typeof r.onError&&(e=r.onError)}return g(t)?n=t:null===t?n=null:"function"==typeof t&&(e=t),{scope:n,onError:e}}(n);try{var i;if(!m())throw new y;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(a){return o.onError?o.onError(a,{component:t,config:e}):console.log(a),[]}return Array.from(null!=r?r:[]).map(n=>{try{return void 0!==e?new t(n,e):new t(n)}catch(a){return o.onError?o.onError(a,{element:n,component:t,config:e}):console.log(a),null}}).filter(Boolean)}class A extends S{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}A.moduleName="govuk-button",A.defaults=Object.freeze({preventDoubleClick:!1}),A.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class _{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)&&p(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(p(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 S{[$](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 _(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 a=`${this.$textarea.id}-info`,s=document.getElementById(a);if(!s)throw new w({component:T,element:s,identifier:`Count message (\`id="${a}"\`)`});this.$errorMessage=this.$root.querySelector(".govuk-error-message"),s.textContent.match(/^\s*$/)&&(s.textContent=this.i18n.t("textareaDescription",{count:this.maxLength})),this.$textarea.insertAdjacentElement("afterend",s);const l=document.createElement("div");l.className="govuk-character-count__sr-status govuk-visually-hidden",l.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=l,s.insertAdjacentElement("afterend",l);const u=document.createElement("div");u.className=s.className,u.classList.add("govuk-character-count__status"),u.setAttribute("aria-hidden","true"),this.$visibleCountMessage=u,s.insertAdjacentElement("afterend",u),s.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 F extends E{constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="checkbox"]');if(!e.length)throw new w({component:F,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:F,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)))}}F.moduleName="govuk-checkboxes";class O extends S{constructor(t,e={}){super(t,e),this.config.disableAutoFocus||h(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")}}O.moduleName="govuk-error-summary",O.defaults=Object.freeze({disableAutoFocus:!1}),O.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class I extends E{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 P extends S{constructor(t,e={}){super(t,e),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||h(this.$root)}}P.moduleName="govuk-notification-banner",P.defaults=Object.freeze({disableAutoFocus:!1}),P.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class R extends E{constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="radio"]');if(!e.length)throw new w({component:R,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:R,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)})}}R.moduleName="govuk-radios";class j extends E{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:j,element:i,identifier:`Target content (\`id="${o}"\`)`});this.$root.addEventListener("click",()=>h(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";var B=i(559),D=i(457);const G=function(){N(A),N(T),N(F),N(O),N(I),N(P),N(R),N(j)},q=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)},W=function(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",d):d()},z=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 V(){G(),q(),W(),z()}export{D as geospatialMap,V as initAll,q as initAllAutocomplete,G as initAllGovuk,W as initFileUpload,z as initPreviewCloseLink,B as map};export const initMaps=B.initMaps;
|
|
2
|
+
var t,e,n,r={457:(t,e,n)=>{n.d(e,{addFeatureToMap:()=>v,createFeatureHTML:()=>w,createFeaturesHTML:()=>y,focusFeature:()=>b,getBoundingBox:()=>g,getGeoJSON:()=>p,processGeospatial:()=>f}),n.r(e);var r=n(356);function o(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const n=[1/0,1/0,-1/0,-1/0];return(0,r.Fh)(t,t=>{n[0]>t[0]&&(n[0]=t[0]),n[1]>t[1]&&(n[1]=t[1]),n[2]<t[0]&&(n[2]=t[0]),n[3]<t[1]&&(n[3]=t[1])}),n}var i=n(559);function a(){return a=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},a.apply(null,arguments)}const s={showLabel:!0,label:"How to use this map",mobile:{slot:"drawer",open:!0,dismissible:!0,modal:!1},tablet:{slot:"drawer",open:!0,dismissible:!0,modal:!1},desktop:{slot:"drawer",open:!0,dismissible:!0,modal:!1},html:'<p class="govuk-body-s govuk-!-margin-bottom-2">You can add points, shapes or lines to the map.</p><ul class="govuk-list govuk-list--number govuk-body-s"><li>Search for a county, place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Double‑click, or select \'Done\', when you have finished drawing a line or shape</li><li>Give the location a name</li></ul>'},l={stroke:"rgba(0, 11, 112, 1)",fill:"rgba(0, 11, 112, 0.2)",strokeWidth:2},u={stroke:"rgb(0, 0, 0)",fill:"rgba(255, 221, 0, 0.2)",strokeWidth:2},c={Point:"Point",LineString:"Line",Polygon:"Shape"},d='<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" /><circle cx="12" cy="10" r="3" />',h='<path d="M19.5 7v10M4.5 7v10M7 19.5h10M7 4.5h10"/><path d="M22 18v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zm0-15v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 18v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1zM7 3v3a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1z"/>',m='<path d="M5.706 16.294L16.294 5.706"/><path d="M21 2v3c0 .549-.451 1-1 1h-3c-.549 0-1-.451-1-1V2c0-.549.451-1 1-1h3c.549 0 1 .451 1 1zM6 17v3c0 .549-.451 1-1 1H2c-.549 0-1-.451-1-1v-3c0-.549.451-1 1-1h3c.549 0 1 .451 1 1z"/>';function p(t){const e=t.value.trim();return{type:"FeatureCollection",features:e?JSON.parse(e):[]}}function g(t){return o(t)}function f(t,e,n){const r=window.defra;if(!(e instanceof HTMLDivElement))return;const o=e.querySelector(".govuk-textarea");if(!(o instanceof HTMLTextAreaElement))return;const{listEl:c,mapId:f}=function(t,e){const n=document.createElement("div"),r=`geospatialmap_${e}`;n.setAttribute("id",r),n.setAttribute("class","map-container");const o=document.createElement("div"),i=`${r}_list`;return o.setAttribute("id",i),t.after(n),n.after(o),t.classList.add("js-hidden"),{mapEl:n,listEl:o,mapId:r}}(o,n),w=p(o),$=w.features.length?g(w):void 0,S=r.drawMLPlugin(),M=[S],x=e.dataset.country;if(x){const e=r.datasetsMaplibrePlugin({datasets:[{id:"invalid-area",label:"Invalid areas",geojson:`${t.apiPath}/maps/countries.geojson?omit=${x}`,showInKey:!1,showInMenu:!1,style:{stroke:"gray",strokeWidth:1,fill:"rgba(211,211,211,0.8)"}},{id:"valid-area",label:"Valid areas",geojson:`${t.apiPath}/maps/countries.geojson?only=${x}`,showInKey:!1,showInMenu:!1,style:{stroke:"rgba(0,112,60,1)",strokeWidth:1}}]});M.push(e)}const L=a({},i.defaultConfig,{bounds:$,plugins:M}),{map:N,interactPlugin:A}=(0,i.createMap)(f,L,t),C=function(t){function e(e){return t.features.find(t=>t.id===e)}return{getFeatures:function(){return t.features},getFeature:e,addFeature:function(e){e.properties.coordinateGridReference=(0,i.getCoordinateGridRef)(e),e.properties.centroidGridReference=(0,i.getCentroidGridRef)(e),E(e),t.features.push(e)},updateFeature:function(t,n){const r=e(t);return r&&(r.properties.coordinateGridReference=(0,i.getCoordinateGridRef)(r),r.properties.centroidGridReference=(0,i.getCentroidGridRef)(r),r.geometry=n,E(r)),r},removeFeature:function(e){const n=t.features.findIndex(t=>t.id===e);return n>-1?t.features.splice(n,1):void 0}}}(w),_=function(){let t;return{getActiveFeature:function(){return t},setActiveFeature:function(e){t=e},resetActiveFeature:function(){t=void 0}}}(),T=function(t,e,n,r,o){const i=function(t,e){return function(){e.value=JSON.stringify(t.features,null,2)}}(t,o),a=function(t,e,n,r){return function(o=!1){const i=y(t.features,e,o);n.innerHTML=i,r()}}(t,n,r,i);return{renderList:a,renderValue:i,listEl:r,toggleActionButtons:function(t){e.toggleButtonState("btnAddPoint","hidden",t),e.toggleButtonState("btnAddPolygon","hidden",t),e.toggleButtonState("btnAddLine","hidden",t)},focusDescriptionInput:function(){const t=r.querySelectorAll("input");if(t.length){const e=t.item(t.length-1);e.focus(),e.select()}}}}(w,N,f,c,o);!function(t){const{map:e}=t;e.on(i.EVENTS.mapReady,function(t){const{map:e,activeFeatureManager:n,uiManager:r,interactPlugin:o,drawPlugin:c}=t,{toggleActionButtons:p,renderList:g}=r,{resetActiveFeature:f}=n;return function(n){e.addPanel("info",s),e.addButton("btnAddPoint",{variant:"tertiary",label:"Add point",iconSvgContent:d,onClick:()=>{f(),p(!0),g(!0),o.enable()},mobile:{slot:"actions"},tablet:{slot:"actions"},desktop:{slot:"actions"}}),e.addButton("btnAddPolygon",{variant:"tertiary",label:"Add shape",iconSvgContent:h,onClick:()=>{f(),p(!0),g(!0),c.newPolygon(k(),u)},mobile:{slot:"actions"},tablet:{slot:"actions"},desktop:{slot:"actions"}}),e.addButton("btnAddLine",{variant:"tertiary",label:"Add line",iconSvgContent:m,onClick:()=>{f(),p(!0),g(!0),c.newLine(k(),l)},mobile:{slot:"actions"},tablet:{slot:"actions"},desktop:{slot:"actions"}}),t.mapProvider=n.map,e.on(i.EVENTS.drawReady,function(t){const{featuresManager:e,uiManager:n,drawPlugin:r,map:o}=t,{renderList:i}=n,{getFeatures:a}=e;return function(){a().forEach(t=>v(t,r,o)),i()}}(t)),e.on(i.EVENTS.drawCreated,function(t){const{featuresManager:e,uiManager:n}=t,{addFeature:r}=e,{renderList:o,toggleActionButtons:i,focusDescriptionInput:s}=n;return function(t){r(a({},t,{properties:{description:""}})),o(),i(!1),s()}}(t)),e.on(i.EVENTS.drawEdited,function(t){const{featuresManager:e,activeFeatureManager:n,uiManager:r}=t,{updateFeature:o}=e,{getActiveFeature:i,resetActiveFeature:a}=n,{renderList:s,toggleActionButtons:l}=r;return function(t){const e=t,n=e.id;i()===n&&(o(n,e.geometry),s()),a(),l(!1)}}(t)),e.on(i.EVENTS.drawCancelled,function(t){const{uiManager:e,activeFeatureManager:n}=t,{toggleActionButtons:r,renderList:o}=e,{resetActiveFeature:i}=n;return function(){r(!1),i(),o()}}(t)),e.on(i.EVENTS.interactMarkerChange,function(t){const{featuresManager:e,activeFeatureManager:n,map:r,interactPlugin:o,uiManager:i}=t,{addFeature:a,updateFeature:s}=e,{getActiveFeature:l,resetActiveFeature:u}=n,{renderList:c,focusDescriptionInput:d,toggleActionButtons:h}=i;return function(t){const e=l();if(e){const n=s(e,{type:"Point",coordinates:t.coords});r.addMarker(e,t.coords),n&&c(),u()}else{const e=k();a({type:"Feature",properties:{description:""},geometry:{type:"Point",coordinates:t.coords},id:e}),r.addMarker(e,t.coords),c(),d()}r.removeMarker("location"),o.disable(),h(!1)}}(t));const{listEl:y}=r;y.addEventListener("click",function(t){const{map:e,mapProvider:n,featuresManager:r,activeFeatureManager:o,interactPlugin:i,uiManager:a,drawPlugin:s}=t,{getFeature:l,removeFeature:u}=r,{getActiveFeature:c,setActiveFeature:d}=o,{renderList:h,toggleActionButtons:m}=a;return function(t){const r=t.target;if(r instanceof HTMLElement){if(c())return t.preventDefault(),void t.stopPropagation();if("A"===r.tagName&&r.dataset.action&&r.dataset.id&&r.dataset.type){const{action:o,id:a,type:c}=r.dataset;"edit"===o?function(t,e){d(t),"Point"===e?(i.selectFeature({featureId:t}),i.enable()):s.editFeature(t);const r=l(t);r&&n&&b(r,n),m(!0),h(!0)}(a,c):(t.preventDefault(),t.stopPropagation(),"delete"===o&&function(t,n){"Point"===n?(e.removeMarker(t),u(t)):(s.deleteFeature(t),u(t)),h()}(a,c))}}}}(t),!1),y.addEventListener("change",function(t){const{featuresManager:e,uiManager:n}=t,{getFeature:r}=e,{renderValue:o}=n;return function(t){t.preventDefault(),t.stopPropagation();const e=t.target;if(!(e instanceof HTMLInputElement&&e.dataset.id))return;const{id:n}=e.dataset,i=r(n);i&&(i.properties.description=e.value.trim(),o())}}(t),!1),y.addEventListener("keydown",function(t){t.target instanceof HTMLInputElement&&("Enter"!==t.code&&"NumpadEnter"!==t.code||(t.preventDefault(),t.stopPropagation()))},!1)}}(t))}({map:N,featuresManager:C,activeFeatureManager:_,uiManager:T,interactPlugin:A,drawPlugin:S})}function v(t,e,n){switch(t.geometry.type){case"Polygon":e.addFeature(a({},t,u));break;case"LineString":e.addFeature(a({},t,l));break;case"Point":n.addMarker(t.id,t.geometry.coordinates)}}function y(t,e,n=!1,r=!1){return`<dl class="govuk-summary-list">\n ${t.map((t,o)=>w(t,o,e,n,r)).join("\n")}\n </dl>`}function b(t,e){e.fitBounds(o(t))}function w(t,e,n,r=!1,o=!1){const i=t.geometry.coordinates.flat(2),a=[];for(let l=0;l<i.length;l+=2)a.push(i.slice(l,l+2).join(", "));const s=a.map(t=>`<li>${t}</li>`).join("");return`<div class="govuk-summary-list__row govuk-summary-list__row--no-border">\n <dt class="govuk-summary-list__key">\n <div class="govuk-form-group">\n <label class="govuk-label govuk-label--s" ${o?"":`for="description_${e}"`}>Location ${e+1} description</label>\n ${o?`<p class="govuk-body govuk-!-margin-bottom-0">${t.properties.description}</p>`:`<input class="govuk-input govuk-!-width-two-thirds" type="text" id="description_${e}" value="${t.properties.description}" data-id="${t.id}">`}\n </div>\n </dt>\n <dd class="govuk-summary-list__actions">\n <ul class="govuk-summary-list__actions-list">${o?`<li class="govuk-summary-list__actions-list-item">\n <a class="govuk-link govuk-link--no-visited-state" href="#${n}" data-action="focus" data-id="${t.id}">Show<span class="govuk-visually-hidden"> location</span></a>\n</li>`:`<li class="govuk-summary-list__actions-list-item">\n <a class="govuk-link govuk-link--no-visited-state ${r?"govuk-link--disabled":""}" href="#${n}" data-action="edit" data-id="${t.id}"\n data-type="${t.geometry.type}">Update<span class="govuk-visually-hidden"> location</span></a>\n</li><li class="govuk-summary-list__actions-list-item">\n <a class="govuk-link govuk-link--no-visited-state ${r?"govuk-link--disabled":""}" href="#" data-action="delete" data-id="${t.id}"\n data-type="${t.geometry.type}">Delete<span class="govuk-visually-hidden"> location</span></a>\n</li>`}</ul>\n </dd>\n</div>\n<div class="govuk-summary-list__row">\n <details class="govuk-details govuk-!-margin-bottom-2">\n <summary class="govuk-details__summary">\n <span class="govuk-details__summary-text">Coordinates</span>\n </summary>\n <div class="govuk-details__text">\n <dl class="govuk-summary-list">\n <div class="govuk-summary-list__row">\n <dt class="govuk-summary-list__key">Type</dt>\n <dd class="govuk-summary-list__value">${c[t.geometry.type]}</dd>\n </div>\n <div class="govuk-summary-list__row">\n <dt class="govuk-summary-list__key">Centre grid reference</dt>\n <dd class="govuk-summary-list__value">${t.properties.centroidGridReference}</dd>\n </div>\n <div class="govuk-summary-list__row">\n <dt class="govuk-summary-list__key">First point grid reference</dt>\n <dd class="govuk-summary-list__value">${t.properties.coordinateGridReference}</dd>\n </div>\n <div class="govuk-summary-list__row">\n <dt class="govuk-summary-list__key">Detailed coordinates</dt>\n <dd class="govuk-summary-list__value">\n <ol class="govuk-list govuk-list--number">${s}</ol>\n </dd>\n </div>\n </dl>\n </div>\n </details>\n</div>`}function k(){return window.crypto.randomUUID()}function E(t){const{geometry:e}=t;function n(t){t[0]=+t[0].toFixed(7),t[1]=+t[1].toFixed(7)}"Point"===e.type?n(e.coordinates):"LineString"===e.type?e.coordinates.forEach(n):e.coordinates.flat().forEach(n)}},559:(t,e,n)=>{n.d(e,{EVENTS:()=>q,centerMap:()=>U,createMap:()=>H,defaultConfig:()=>G,eastingNorthingToLatLong:()=>P,formSubmitFactory:()=>W,getCentroidGridRef:()=>D,getCoordinateGridRef:()=>B,initMaps:()=>z,latLongToEastingNorthing:()=>I,latLongToOsGridRef:()=>R,makeTileRequestTransformer:()=>V,osGridRefToLatLong:()=>j}),n.r(e);function r(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}Math.PI;var o=n(356);function i(t,e={}){let n=0,i=0,a=0;return(0,o.Fh)(t,function(t){n+=t[0],i+=t[1],a++},!0),function(t,e,n={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!r(t[0])||!r(t[1]))throw new Error("coordinates must contain numbers");return function(t,e,n={}){const r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}({type:"Point",coordinates:t},e,n)}([n/a,i/a],e.properties)}let a=" ";class s{static get separator(){return a}static set separator(t){a=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,o=null,i=null,a=null;switch(e){default:case"d":case"deg":o=t.toFixed(n),o<100&&(o="0"+o),o<10&&(o="0"+o),r=o+"°";break;case"dm":case"deg+min":o=Math.floor(t),i=(60*t%60).toFixed(n),60==i&&(i=(0).toFixed(n),o++),o=("000"+o).slice(-3),i<10&&(i="0"+i),r=o+"°"+s.separator+i+"′";break;case"dms":case"deg+min+sec":o=Math.floor(t),i=Math.floor(3600*t/60)%60,a=(3600*t%60).toFixed(n),60==a&&(a=(0).toFixed(n),i++),60==i&&(i=0,o++),o=("000"+o).slice(-3),i=("00"+i).slice(-2),a<10&&(a="0"+a),r=o+"°"+s.separator+i+"′"+s.separator+a+"″"}return r}static toLat(t,e,n){const r=s.toDms(s.wrap90(t),e,n);return null===r?"–":r.slice(1)+s.separator+(t<0?"S":"N")}static toLon(t,e,n){const r=s.toDms(s.wrap180(t),e,n);return null===r?"–":r+s.separator+(t<0?"W":"E")}static toBrng(t,e,n){const r=s.toDms(s.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=s.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 l=s;class u{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 u))throw new TypeError("v is not Vector3d object");return new u(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof u))throw new TypeError("v is not Vector3d object");return new u(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 u(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new u(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof u))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 u))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 u(e,n,r)}negate(){return new u(-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 u(e,n,r)}angleTo(t,e=void 0){if(!(t instanceof u))throw new TypeError("v is not Vector3d object");if(!(e instanceof u||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 u))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),s=1-a,l=o.x,c=o.y,d=o.z,h=[[s*l*l+a,s*l*c-i*d,s*l*d+i*c],[s*l*c+i*d,s*c*c+a,s*c*d-i*l],[s*l*d-i*c,s*c*d+i*l,s*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 u(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 c=u,d={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},h={WGS84:{ellipsoid:d.WGS84}};Object.freeze(d.WGS84),Object.freeze(h.WGS84);class m{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=l.wrap90(Number(t)),this._lon=l.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)?l.wrap90(l.parse(t)):l.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?l.wrap90(l.parse(t)):l.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)?l.wrap180(l.parse(t)):l.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?l.wrap180(l.parse(t)):l.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?l.wrap180(l.parse(t)):l.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 d}static get datums(){return h}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=l.wrap90(l.parse(e)),n=l.wrap180(l.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=l.wrap90(l.parse(e)),n=l.wrap180(l.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=l.wrap90(l.parse(e)),n=l.wrap180(l.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:d.WGS84,e=this.lat.toRadians(),n=this.lon.toRadians(),r=this.height,{a:o,f:i}=t,a=Math.sin(e),s=Math.cos(e),l=Math.sin(n),u=Math.cos(n),c=2*i-i*i,h=o/Math.sqrt(1-c*a*a);return new p((h+r)*s*u,(h+r)*s*l,(h*(1-c)+r)*a)}equals(t){if(!(t instanceof m))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}`):`${l.toLat(this.lat,t,e)}, ${l.toLon(this.lon,t,e)}${null==n?"":r}`}}class p extends c{constructor(t,e,n){super(t,e,n)}toLatLon(t=d.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:n,z:r}=this,{a:o,b:i,f:a}=t,s=2*a-a*a,l=s/(1-s),u=Math.sqrt(e*e+n*n),c=i*r/(o*u)*(1+l*i/Math.sqrt(u*u+r*r)),h=c/Math.sqrt(1+c*c),p=h/c,g=isNaN(p)?0:Math.atan2(r+l*i*h*h*h,u-s*o*p*p*p),f=Math.atan2(n,e),v=Math.sin(g),y=u*Math.cos(g)+r*v-o*o/(o/Math.sqrt(1-s*v*v));return new m(g.toDegrees(),f.toDegrees(),y)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const g={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}},f={ED50:{ellipsoid:g.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:g.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:g.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:g.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:g.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:g.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:g.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:g.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:g.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:g.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:g.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(g).forEach(t=>Object.freeze(g[t])),Object.keys(f).forEach(t=>{Object.freeze(f[t]),Object.freeze(f[t].transform)});class v extends m{constructor(t,e,n=0,r=f.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 g}static get datums(){return f}static parse(...t){let e=f.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 y(t.x,t.y,t.z,this.datum)}}class y extends p{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||f.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const n=super.toLatLon(e.ellipsoid);return new v(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!=f.WGS84||(e=this,n=t.transform),t==f.WGS84&&(e=this,n=this.datum.transform.map(t=>-t)),null==n&&(e=this.convertDatum(f.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],a=t[2],s=t[3]/1e6+1,l=(t[4]/3600).toRadians(),u=(t[5]/3600).toRadians(),c=(t[6]/3600).toRadians();return new y(o+e*s-n*c+r*u,i+e*c+n*s-r*l,a-e*u+n*l+r*s)}}const b={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:v.ellipsoids.Airy1830};class w{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=v.datums.WGS84){const{easting:e,northing:n}=this,{a:r,b:o}=b.ellipsoid,i=b.trueOrigin.lat.toRadians(),a=b.trueOrigin.lon.toRadians(),s=-b.falseOrigin.easting,l=-b.falseOrigin.northing,u=b.scaleFactor,c=1-o*o/(r*r),d=(r-o)/(r+o),h=d*d,m=d*d*d;let p=i,g=0;do{p=(n-l-g)/(r*u)+p,g=o*u*((1+d+5/4*h+5/4*m)*(p-i)-(3*d+3*d*d+21/8*m)*Math.sin(p-i)*Math.cos(p+i)+(15/8*h+15/8*m)*Math.sin(2*(p-i))*Math.cos(2*(p+i))-35/24*m*Math.sin(3*(p-i))*Math.cos(3*(p+i)))}while(Math.abs(n-l-g)>=1e-5);const f=Math.cos(p),y=Math.sin(p),w=r*u/Math.sqrt(1-c*y*y),E=r*u*(1-c)/Math.pow(1-c*y*y,1.5),$=w/E-1,S=Math.tan(p),M=S*S,x=M*M,L=1/f,N=w*w*w,A=N*w*w,C=e-s,_=C*C,T=_*C,F=_*_,O=T*_;p=p-S/(2*E*w)*_+S/(24*E*N)*(5+3*M+$-9*M*$)*F-S/(720*E*A)*(61+90*M+45*x)*(F*_);const I=a+L/w*C-L/(6*N)*(w/E+2*M)*T+L/(120*A)*(5+28*M+24*x)*O-L/(A*w*w*5040)*(61+662*M+1320*x+x*M*720)*(O*_);let P=new k(p.toDegrees(),I.toDegrees(),0,v.datums.OSGB36);return t!=v.datums.OSGB36&&(P=P.convertDatum(t),P=new k(P.lat,P.lon,P.height,P.datum)),P}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new w(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 a=t.slice(2).trim().split(/\s+/);if(1==a.length&&(a=[a[0].slice(0,a[0].length/2),a[0].slice(a[0].length/2)]),a[0].length!=a[1].length)throw new Error(`invalid grid reference ‘${t}’`);a[0]=a[0].padEnd(5,"0"),a[1]=a[1].padEnd(5,"0");const s=o+a[0],l=i+a[1];return new w(s,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),a=5*(19-o)%25+r%5;i>7&&i++,a>7&&a++;const s=String.fromCharCode(i+"A".charCodeAt(0),a+"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"),`${s} ${e} ${n}`}}class k extends v{toOsGrid(){const t=this.datum==v.datums.OSGB36?this:this.convertDatum(v.datums.OSGB36),e=t.lat.toRadians(),n=t.lon.toRadians(),{a:r,b:o}=b.ellipsoid,i=b.trueOrigin.lat.toRadians(),a=b.trueOrigin.lon.toRadians(),s=-b.falseOrigin.easting,l=-b.falseOrigin.northing,u=b.scaleFactor,c=1-o*o/(r*r),d=(r-o)/(r+o),h=d*d,m=d*d*d,p=Math.cos(e),g=Math.sin(e),f=r*u/Math.sqrt(1-c*g*g),y=r*u*(1-c)/Math.pow(1-c*g*g,1.5),k=f/y-1,E=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))),$=p*p*p,S=$*p*p,M=Math.tan(e)*Math.tan(e),x=M*M,L=n-a,N=L*L,A=N*L,C=A*L,_=C*L;let T=E+l+f/2*g*p*N+f/24*g*$*(5-M+9*k)*C+f/720*g*S*(61-58*M+x)*(_*L),F=s+f*p*L+f/6*$*(f/y-M)*A+f/120*S*(5-18*M+x+14*k-58*M*k)*_;T=Number(T.toFixed(3)),F=Number(F.toFixed(3));try{return new w(F,T)}catch(O){throw new Error(`${O.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new k(e.lat,e.lon,e.height,e.datum)}}var E=n(457);const $="input.govuk-input";function S(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 M(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 x(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 L(t){const e=t.querySelectorAll($);if(2!==e.length)throw new Error("Expected 2 inputs for lat and long");return{latInput:e[0],longInput:e[1]}}function N(t){const e=t.querySelectorAll($);if(2!==e.length)throw new Error("Expected 2 inputs for easting and northing");return{eastingInput:e[0],northingInput:e[1]}}function A(t){const e=t.querySelector($);if(null===e)throw new Error("Expected 1 input for osgridref");return e}function C(t){return{zoom:"16",center:t,markers:[{id:"location",coords:t}]}}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 a=document.createElement("div"),s=`map_${n}`;a.setAttribute("id",s),a.setAttribute("class","map-container");const l=null!=(r=function(t){switch(t.dataset.locationtype){case"latlongfield":return function(t){const{latInput:e,longInput:n}=L(t),r=S(e.value,n.value);if(r.valid)return C([r.value.long,r.value.lat])}(t);case"eastingnorthingfield":return function(t){const{eastingInput:e,northingInput:n}=N(t),r=M(e.value,n.value);if(!r.valid)return;const o=P(r.value);return C([o.long,o.lat])}(t);case"osgridreffield":return function(t){const e=x(A(t).value);if(!e.valid)return;const n=j(e.value);return C([n.long,n.lat])}(t);default:throw new Error("Not implemented")}}(e))?r:G;o.after(a);const{map:u,interactPlugin:c}=H(s,l,t);u.on(q.mapReady,function(t){switch(i){case"latlongfield":!function(t,e,n){const{latInput:r,longInput:o}=L(t);function i(){const t=S(r.value,o.value);if(t.valid){const r=[t.value.long,t.value.lat];U(e,n,r)}}e.on(q.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}=N(t);function i(){const t=M(r.value,o.value);if(t.valid){const r=P(t.value),o=[r.long,r.lat];U(e,n,o)}}e.on(q.interactMarkerChange,function(t){const e=I({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=A(t);e.on(q.interactMarkerChange,function(t){const e=R({lat:t.coords[1],long:t.coords[0]});r.value=e}),r.addEventListener("change",function(){const t=x(r.value);if(t.valid){const r=j(t.value),o=[r.long,r.lat];U(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:"drawer",open:!0,dismissible:!0,modal:!1},tablet:{slot:"drawer",open:!0,dismissible:!0,modal:!1},desktop:{slot:"drawer",open:!0,dismissible:!0,modal:!1},html:"<ul><li>Search for a place or postcode</li><li>Use the + and - icons to zoom in and out</li><li>Use a mouse or keyboard to centre the point at the location</li><li>Click to add the location to the map</li></ul>"}),c.enable()})}function T(){return T=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},T.apply(null,arguments)}const F=169,O={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",VTS_AERIAL_URL:"/api/maps/vts/esri-aerial.json"};function I({lat:t,long:e}){return new k(t,e).toOsGrid()}function P({easting:t,northing:e}){const n=new w(t,e).toLatLon();return{lat:n.latitude,long:n.longitude}}function R({lat:t,long:e}){return new k(t,e).toOsGrid().toString()}function j(t){const e=w.parse(t).toLatLon();return{lat:e.latitude,long:e.longitude}}function B(t){if("Point"===t.geometry.type){const[e,n]=t.geometry.coordinates;return new k(n,e).toOsGrid().toString()}if("LineString"===t.geometry.type){const[e,n]=t.geometry.coordinates[0];return new k(n,e).toOsGrid().toString()}{const[e,n]=t.geometry.coordinates[0][0];return new k(n,e).toOsGrid().toString()}}function D(t){if("Point"===t.geometry.type){const[e,n]=t.geometry.coordinates;return new k(n,e).toOsGrid().toString()}{const e=i(t),[n,r]=e.geometry.coordinates;return new k(r,n).toOsGrid().toString()}}const G={zoom:"6",center:[-2.421975,53.825564]},q={mapReady:"map:ready",interactMarkerChange:"interact:markerchange",drawReady:"draw:ready",drawCreated:"draw:created",drawEdited:"draw:edited",drawCancelled:"draw:cancelled"};function W(t){return function(e){e.submitter instanceof HTMLButtonElement&&t.includes(e.submitter)||e.preventDefault()}}function z(t={}){const{assetPath:e="/assets",apiPath:n="/form/api",data:r=O}=t,o=document.querySelectorAll(".app-location-field"),i=document.querySelectorAll(".app-geospatial-field");if(o.length){const t=o[0].closest("form");if(null===t)return;const e=Array.from(t.querySelectorAll("button"));t.addEventListener("submit",W(e),!1)}if(i.length){const t=i[0].closest("form");if(null===t)return;const e=Array.from(t.querySelectorAll("button"));t.addEventListener("submit",W(e),!1)}o.forEach((t,o)=>{_({assetPath:e,apiPath:n,data:r},t,o)}),i.forEach((t,o)=>{(0,E.processGeospatial)({assetPath:e,apiPath:n,data:r},t,o)})}function V(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 H(t,e,n){var r;const{assetPath:o,apiPath:i,data:a=O}=n,s="Ordnance survey logo",l=window.defra,u=l.interactPlugin({markerColor:{outdoor:"#ff0000",dark:"#00ff00"},interactionModes:["placeMarker"],multiSelect:!1});return{map:new l.InteractiveMap(t,T({enableFullscreen:!0,autoColorScheme:!1,mapProvider:l.maplibreProvider(),reverseGeocodeProvider:l.openNamesProvider({url:`${i}/reverse-geocode-proxy?easting={easting}&northing={northing}`}),behaviour:"inline",minZoom:6,maxZoom:18,containerHeight:"400px",enableZoomControls:!0,transformRequest:V(i)},e,{plugins:[l.mapStylesPlugin({mapStyles:[{id:"outdoor",label:"Outdoor",url:a.VTS_OUTDOOR_URL,thumbnail:`${o}/interactive-map/assets/images/outdoor-map-thumb.jpg`,logo:`${o}/interactive-map/assets/images/os-logo.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(F)} Crown copyright and database rights ${(new Date).getFullYear()}`,backgroundColor:"#f5f5f0"},{id:"dark",label:"Dark",url:a.VTS_DARK_URL,mapColorScheme:"dark",appColorScheme:"dark",thumbnail:`${o}/interactive-map/assets/images/dark-map-thumb.jpg`,logo:`${o}/interactive-map/assets/images/os-logo-white.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(F)} Crown copyright and database rights ${(new Date).getFullYear()}`},{id:"black-and-white",label:"Black/White",url:a.VTS_BLACK_AND_WHITE_URL,thumbnail:`${o}/interactive-map/assets/images/black-and-white-map-thumb.jpg`,logo:`${o}/interactive-map/assets/images/os-logo-black.svg`,logoAltText:s,attribution:`Contains OS data ${String.fromCodePoint(F)} Crown copyright and database rights ${(new Date).getFullYear()}`},{id:"aerial",label:"Aerial",url:a.VTS_AERIAL_URL,thumbnail:`${o}/interactive-map/assets/images/aerial-map-thumb.jpg`,logo:`${o}/interactive-map/assets/images/esri-logo.png`,logoAltText:"Powered by Esri",attribution:`Tiles ${String.fromCodePoint(F)} Esri — Source: Esri, Maxar, Earthstar Geographics, and the GIS User Community ${(new Date).getFullYear()}`}]}),u,l.searchPlugin({osNamesURL:`${i}/geocode-proxy?query={query}`,width:"300px",showMarker:!1}),l.scaleBarPlugin({units:"metric"}),...null!=(r=e.plugins)?r:[]]})),interactPlugin:u}}function U(t,e,n){t.addMarker("location",n),e.flyTo({center:n,zoom:14,essential:!0})}},356:(t,e,n)=>{function r(t,e,n){if(null!==t)for(var o,i,a,s,l,u,c,d,h=0,m=0,p=t.type,g="FeatureCollection"===p,f="Feature"===p,v=g?t.features.length:1,y=0;y<v;y++){l=(d=!!(c=g?t.features[y].geometry:f?t.geometry:t)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var b=0;b<l;b++){var w=0,k=0;if(null!==(s=d?c.geometries[b]:c)){u=s.coordinates;var E=s.type;switch(h=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":if(!1===e(u,m,y,w,k))return!1;m++,w++;break;case"LineString":case"MultiPoint":for(o=0;o<u.length;o++){if(!1===e(u[o],m,y,w,k))return!1;m++,"MultiPoint"===E&&w++}"LineString"===E&&w++;break;case"Polygon":case"MultiLineString":for(o=0;o<u.length;o++){for(i=0;i<u[o].length-h;i++){if(!1===e(u[o][i],m,y,w,k))return!1;m++}"MultiLineString"===E&&w++,"Polygon"===E&&k++}"Polygon"===E&&w++;break;case"MultiPolygon":for(o=0;o<u.length;o++){for(k=0,i=0;i<u[o].length;i++){for(a=0;a<u[o][i].length-h;a++){if(!1===e(u[o][i][a],m,y,w,k))return!1;m++}k++}w++}break;case"GeometryCollection":for(o=0;o<s.geometries.length;o++)if(!1===r(s.geometries[o],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}n.d(e,{Fh:()=>r})}},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 a={};t=t||[null,e({}),e([]),e(e)];for(var s=2&r&&n;("object"==typeof s||"function"==typeof s)&&!~t.indexOf(s);s=e(s))Object.getOwnPropertyNames(s).forEach(t=>a[t]=()=>n[t]);return a.default=()=>n,i.d(o,a),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 a,s;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){a=c;break}}a||(s=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",i.nc&&a.setAttribute("nonce",i.nc),a.src=t),n[t]=[e];var d=(e,r)=>{a.onerror=a.onload=null,clearTimeout(h);var o=n[t];if(delete n[t],a.parentNode&&a.parentNode.removeChild(a),o&&o.forEach(t=>t(r)),e)return e(r)},h=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),s&&document.head.appendChild(a)}},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 a=i.p+i.u(e),s=new Error;i.l(a,n=>{if(i.o(t,e)&&(0!==(r=t[e])&&(t[e]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;s.message="Loading chunk "+e+" failed.\n("+o+": "+a+")",s.name="ChunkLoadError",s.type=o,s.request=a,r[1](s)}},"chunk-"+e,e)}};var e=(e,n)=>{var r,o,a=n[0],s=n[1],l=n[2],u=0;if(a.some(e=>0!==t[e])){for(r in s)i.o(s,r)&&(i.m[r]=s[r]);l&&l(i)}for(e&&e(n);u<a.length;u++)o=a[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 a="aria-describedby",s="error-summary-title";function l(t,e,n){var r;const o=document.getElementById("uploadedFilesContainer"),i=o?o.closest("form"):null;if(!(i&&i instanceof HTMLFormElement))return;const s=i.querySelector("p.govuk-body");if(!s)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,s),u=n.querySelector('input[type="file"]');u&&u.setAttribute(a,"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,s),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}`}function u(t,e,n){if(document.querySelector(".govuk-error-summary"))return void(document.getElementById(s)?n.setAttribute(a,s):n.removeAttribute(a));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="${s}">\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(a,s));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(a,`error-summary-title ${e}-error`)}}function c(){window.history.replaceState(null,"",window.location.href),window.location.href=window.location.pathname}function d(){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 s=[],d=!1;const h=a.dataset.uploadId;n.addEventListener("change",()=>{i&&(i.innerHTML=""),n.files&&n.files.length>0&&(s=Array.from(n.files))}),r.addEventListener("click",t=>{if(0===s.length)return t.preventDefault(),void u("Select a file",i,n);d?t.preventDefault():(d=!0,function(t,e,n,r,o){for(let i=o.length-1;i>=0;i--)l(o[i],"Uploading…",t);e.focus(),setTimeout(()=>{e.disabled=!0,n.disabled=!0,r.disabled=!0},100)}(a,n,r,o,s),function(t,e,n,r,o,i){var a;if(!e.action||!i)return!1;t.preventDefault();const s=new FormData(e),l=!!e.dataset.proxyUrl,d=null!=(a=e.dataset.proxyUrl)?a:e.action,h={method:"POST",body:s,redirect:l?"follow":"manual"};l&&(h.mode="no-cors"),fetch(d,h).then(()=>{!function(t){let e=0;const n=setInterval(()=>{if(e++,e>=300)return clearInterval(n),void c();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),c())}).catch(()=>{clearInterval(n),c()})},1e3)}(i)}).catch(()=>(n.disabled=!1,r.disabled=!1,u("There was a problem uploading the file",o,n),null))}(t,a,n,r,i,h))})}function h(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 m(t=document.body){return!!t&&t.classList.contains("govuk-frontend-supported")}function p(t){return!!t&&"object"==typeof t&&!function(t){return Array.isArray(t)}(t)}function g(t){return!!t&&(t instanceof Element||t instanceof Document)}function f(t,e){return`${t.moduleName}: ${e}`}class v extends Error{constructor(...t){super(...t),this.name="GOVUKFrontendError"}}class y extends v{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 v{constructor(...t){super(...t),this.name="ConfigError"}}class w extends v{constructor(t){let e="string"==typeof t?t:"";if(p(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 k extends v{constructor(t){super("string"==typeof t?t:f(t,"Root element (`$root`) already initialised")),this.name="InitError"}}class E{get $root(){return this._$root}constructor(t){this._$root=void 0;const e=this.constructor;if("string"!=typeof e.moduleName)throw new k("`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 k(t)}static checkSupport(){if(!m())throw new y}}E.elementType=HTMLElement;const $=Symbol.for("configOverride");class S extends E{[$](t){return{}}get config(){return this._config}constructor(t,e){super(t),this._config=void 0;const n=this.constructor;if(!p(n.defaults))throw new b(f(n,"Config passed as parameter into constructor but no defaults defined"));const r=function(t,e){if(!p(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,a=r.toString();a in e&&(n[a]=M(e[a],i)),"object"===(null==i?void 0:i.type)&&(n[a]=L(t.schema,e,r))}return n}(n,this._$root.dataset);this._config=x(n.defaults,null!=e?e:{},this[$](r),r)}}function M(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];p(r)&&p(o)?e[t]=x(r,o):e[t]=o}return e}function L(t,e,n){const r=t.properties[n];if("object"!==(null==r?void 0:r.type))return;const o={[n]:{}};for(const[i,a]of Object.entries(e)){let t=o;const e=i.split(".");for(const[r,o]of e.entries())p(t)&&(r<e.length-1?(p(t[o])||(t[o]={}),t=t[o]):i!==n&&(t[o]=M(a)))}return o[n]}function N(t,e,n){let r;const o=function(t){let e,n=document;if(p(t)){const r=t;(g(r.scope)||null===r.scope)&&(n=r.scope),"function"==typeof r.onError&&(e=r.onError)}return g(t)?n=t:null===t?n=null:"function"==typeof t&&(e=t),{scope:n,onError:e}}(n);try{var i;if(!m())throw new y;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(a){return o.onError?o.onError(a,{component:t,config:e}):console.log(a),[]}return Array.from(null!=r?r:[]).map(n=>{try{return void 0!==e?new t(n,e):new t(n)}catch(a){return o.onError?o.onError(a,{element:n,component:t,config:e}):console.log(a),null}}).filter(Boolean)}class A extends S{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}A.moduleName="govuk-button",A.defaults=Object.freeze({preventDoubleClick:!1}),A.schema=Object.freeze({properties:{preventDoubleClick:{type:"boolean"}}});class _{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)&&p(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(p(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 S{[$](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 _(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 a=`${this.$textarea.id}-info`,s=document.getElementById(a);if(!s)throw new w({component:T,element:s,identifier:`Count message (\`id="${a}"\`)`});this.$errorMessage=this.$root.querySelector(".govuk-error-message"),s.textContent.match(/^\s*$/)&&(s.textContent=this.i18n.t("textareaDescription",{count:this.maxLength})),this.$textarea.insertAdjacentElement("afterend",s);const l=document.createElement("div");l.className="govuk-character-count__sr-status govuk-visually-hidden",l.setAttribute("aria-live","polite"),this.$screenReaderCountMessage=l,s.insertAdjacentElement("afterend",l);const u=document.createElement("div");u.className=s.className,u.classList.add("govuk-character-count__status"),u.setAttribute("aria-hidden","true"),this.$visibleCountMessage=u,s.insertAdjacentElement("afterend",u),s.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 F extends E{constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="checkbox"]');if(!e.length)throw new w({component:F,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:F,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)))}}F.moduleName="govuk-checkboxes";class O extends S{constructor(t,e={}){super(t,e),this.config.disableAutoFocus||h(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")}}O.moduleName="govuk-error-summary",O.defaults=Object.freeze({disableAutoFocus:!1}),O.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class I extends E{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 P extends S{constructor(t,e={}){super(t,e),"alert"!==this.$root.getAttribute("role")||this.config.disableAutoFocus||h(this.$root)}}P.moduleName="govuk-notification-banner",P.defaults=Object.freeze({disableAutoFocus:!1}),P.schema=Object.freeze({properties:{disableAutoFocus:{type:"boolean"}}});class R extends E{constructor(t){super(t),this.$inputs=void 0;const e=this.$root.querySelectorAll('input[type="radio"]');if(!e.length)throw new w({component:R,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:R,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)})}}R.moduleName="govuk-radios";class j extends E{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:j,element:i,identifier:`Target content (\`id="${o}"\`)`});this.$root.addEventListener("click",()=>h(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";var B=i(559),D=i(457);const G=function(){N(A),N(T),N(F),N(O),N(I),N(P),N(R),N(j)},q=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)},W=function(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",d):d()},z=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 V(){G(),q(),W(),z()}export{D as geospatialMap,V as initAll,q as initAllAutocomplete,G as initAllGovuk,W as initFileUpload,z as initPreviewCloseLink,B as map};export const initMaps=B.initMaps;
|
|
3
3
|
//# sourceMappingURL=shared.min.js.map
|